diff --git a/.yarn/cache/@standardnotes-common-npm-1.45.0-1794cae3f1-3bf1dd805b.zip b/.yarn/cache/@standardnotes-common-npm-1.46.4-0012c2a1fe-6d21999a1d.zip similarity index 62% rename from .yarn/cache/@standardnotes-common-npm-1.45.0-1794cae3f1-3bf1dd805b.zip rename to .yarn/cache/@standardnotes-common-npm-1.46.4-0012c2a1fe-6d21999a1d.zip index e71c9f8d2..bc87e2417 100644 Binary files a/.yarn/cache/@standardnotes-common-npm-1.45.0-1794cae3f1-3bf1dd805b.zip and b/.yarn/cache/@standardnotes-common-npm-1.46.4-0012c2a1fe-6d21999a1d.zip differ diff --git a/.yarn/cache/@standardnotes-domain-core-npm-1.11.0-f473ba8bc0-cf4c9b7534.zip b/.yarn/cache/@standardnotes-domain-core-npm-1.11.1-c16df67772-98af016a83.zip similarity index 82% rename from .yarn/cache/@standardnotes-domain-core-npm-1.11.0-f473ba8bc0-cf4c9b7534.zip rename to .yarn/cache/@standardnotes-domain-core-npm-1.11.1-c16df67772-98af016a83.zip index b61ac92a5..9722b9c6c 100644 Binary files a/.yarn/cache/@standardnotes-domain-core-npm-1.11.0-f473ba8bc0-cf4c9b7534.zip and b/.yarn/cache/@standardnotes-domain-core-npm-1.11.1-c16df67772-98af016a83.zip differ diff --git a/.yarn/cache/@standardnotes-domain-events-npm-2.106.0-e3526437e9-db98a6b4ef.zip b/.yarn/cache/@standardnotes-domain-events-npm-2.106.0-e3526437e9-db98a6b4ef.zip new file mode 100644 index 000000000..7f200e02c Binary files /dev/null and b/.yarn/cache/@standardnotes-domain-events-npm-2.106.0-e3526437e9-db98a6b4ef.zip differ diff --git a/.yarn/cache/@standardnotes-domain-events-npm-2.88.0-556633609b-8574ba4c7e.zip b/.yarn/cache/@standardnotes-domain-events-npm-2.88.0-556633609b-8574ba4c7e.zip deleted file mode 100644 index 62c3c08c3..000000000 Binary files a/.yarn/cache/@standardnotes-domain-events-npm-2.88.0-556633609b-8574ba4c7e.zip and /dev/null differ diff --git a/.yarn/cache/@standardnotes-predicates-npm-1.6.0-2063cce139-020e2206c7.zip b/.yarn/cache/@standardnotes-predicates-npm-1.6.4-25be0ec067-6d7235896a.zip similarity index 90% rename from .yarn/cache/@standardnotes-predicates-npm-1.6.0-2063cce139-020e2206c7.zip rename to .yarn/cache/@standardnotes-predicates-npm-1.6.4-25be0ec067-6d7235896a.zip index d12da1835..0d752f12f 100644 Binary files a/.yarn/cache/@standardnotes-predicates-npm-1.6.0-2063cce139-020e2206c7.zip and b/.yarn/cache/@standardnotes-predicates-npm-1.6.4-25be0ec067-6d7235896a.zip differ diff --git a/.yarn/cache/@standardnotes-security-npm-1.7.0-6af9b8c3c4-c053af16e6.zip b/.yarn/cache/@standardnotes-security-npm-1.7.5-1479a77fe3-69d180d259.zip similarity index 80% rename from .yarn/cache/@standardnotes-security-npm-1.7.0-6af9b8c3c4-c053af16e6.zip rename to .yarn/cache/@standardnotes-security-npm-1.7.5-1479a77fe3-69d180d259.zip index 48d1c248c..e47c76834 100644 Binary files a/.yarn/cache/@standardnotes-security-npm-1.7.0-6af9b8c3c4-c053af16e6.zip and b/.yarn/cache/@standardnotes-security-npm-1.7.5-1479a77fe3-69d180d259.zip differ diff --git a/.yarn/cache/jsonwebtoken-npm-9.0.0-36fd1594c0-b9181cecf9.zip b/.yarn/cache/jsonwebtoken-npm-9.0.0-36fd1594c0-b9181cecf9.zip new file mode 100644 index 000000000..0654b0bb3 Binary files /dev/null and b/.yarn/cache/jsonwebtoken-npm-9.0.0-36fd1594c0-b9181cecf9.zip differ diff --git a/packages/api/CHANGELOG.md b/packages/api/CHANGELOG.md index 2e5d149f5..b89755841 100644 --- a/packages/api/CHANGELOG.md +++ b/packages/api/CHANGELOG.md @@ -3,6 +3,30 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.24.6](https://github.com/standardnotes/app/compare/@standardnotes/api@1.24.5...@standardnotes/api@1.24.6) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/api + +## [1.24.5](https://github.com/standardnotes/app/compare/@standardnotes/api@1.24.4...@standardnotes/api@1.24.5) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/api + +## [1.24.4](https://github.com/standardnotes/app/compare/@standardnotes/api@1.24.3...@standardnotes/api@1.24.4) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/api + +## [1.24.3](https://github.com/standardnotes/app/compare/@standardnotes/api@1.24.2...@standardnotes/api@1.24.3) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/api + +## [1.24.2](https://github.com/standardnotes/app/compare/@standardnotes/api@1.24.1...@standardnotes/api@1.24.2) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/api + +## [1.24.1](https://github.com/standardnotes/app/compare/@standardnotes/api@1.24.0...@standardnotes/api@1.24.1) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/api + # [1.24.0](https://github.com/standardnotes/app/compare/@standardnotes/api@1.23.2...@standardnotes/api@1.24.0) (2023-01-18) ### Features diff --git a/packages/api/package.json b/packages/api/package.json index b02a9abdf..afbeaff33 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@standardnotes/api", - "version": "1.24.0", + "version": "1.24.6", "engines": { "node": ">=16.0.0 <17.0.0" }, @@ -36,12 +36,12 @@ "typescript": "*" }, "dependencies": { - "@standardnotes/common": "^1.45.0", - "@standardnotes/domain-core": "^1.11.0", + "@standardnotes/common": "^1.46.4", + "@standardnotes/domain-core": "^1.11.1", "@standardnotes/encryption": "workspace:*", "@standardnotes/models": "workspace:*", "@standardnotes/responses": "workspace:*", - "@standardnotes/security": "^1.7.0", + "@standardnotes/security": "^1.7.5", "@standardnotes/utils": "workspace:*", "reflect-metadata": "^0.1.13" } diff --git a/packages/api/src/Domain/Client/Subscription/SubscriptionApiService.ts b/packages/api/src/Domain/Client/Subscription/SubscriptionApiService.ts index 2ab8d6edb..81e754643 100644 --- a/packages/api/src/Domain/Client/Subscription/SubscriptionApiService.ts +++ b/packages/api/src/Domain/Client/Subscription/SubscriptionApiService.ts @@ -10,7 +10,6 @@ import { SubscriptionInviteAcceptResponse } from '../../Response/Subscription/Su import { SubscriptionApiServiceInterface } from './SubscriptionApiServiceInterface' import { SubscriptionApiOperations } from './SubscriptionApiOperations' -import { Uuid } from '@standardnotes/common' import { AppleIAPConfirmResponse } from './../../Response/Subscription/AppleIAPConfirmResponse' import { AppleIAPConfirmRequestParams } from '../../Request' @@ -83,7 +82,7 @@ export class SubscriptionApiService implements SubscriptionApiServiceInterface { } } - async acceptInvite(inviteUuid: Uuid): Promise { + async acceptInvite(inviteUuid: string): Promise { if (this.operationsInProgress.get(SubscriptionApiOperations.AcceptingInvite)) { throw new ApiCallError(ErrorMessage.GenericInProgress) } diff --git a/packages/api/src/Domain/Client/Subscription/SubscriptionApiServiceInterface.ts b/packages/api/src/Domain/Client/Subscription/SubscriptionApiServiceInterface.ts index bfb76bea1..1f5df672d 100644 --- a/packages/api/src/Domain/Client/Subscription/SubscriptionApiServiceInterface.ts +++ b/packages/api/src/Domain/Client/Subscription/SubscriptionApiServiceInterface.ts @@ -1,5 +1,3 @@ -import { Uuid } from '@standardnotes/common' - import { AppleIAPConfirmResponse } from './../../Response/Subscription/AppleIAPConfirmResponse' import { AppleIAPConfirmRequestParams } from '../../Request' import { SubscriptionInviteAcceptResponse } from '../../Response/Subscription/SubscriptionInviteAcceptResponse' @@ -10,7 +8,7 @@ import { SubscriptionInviteResponse } from '../../Response/Subscription/Subscrip export interface SubscriptionApiServiceInterface { invite(inviteeEmail: string): Promise listInvites(): Promise - cancelInvite(inviteUuid: Uuid): Promise - acceptInvite(inviteUuid: Uuid): Promise + cancelInvite(inviteUuid: string): Promise + acceptInvite(inviteUuid: string): Promise confirmAppleIAP(params: AppleIAPConfirmRequestParams): Promise } diff --git a/packages/api/src/Domain/Client/User/UserApiServiceInterface.ts b/packages/api/src/Domain/Client/User/UserApiServiceInterface.ts index 81d4d2d19..fc8c17d46 100644 --- a/packages/api/src/Domain/Client/User/UserApiServiceInterface.ts +++ b/packages/api/src/Domain/Client/User/UserApiServiceInterface.ts @@ -1,4 +1,4 @@ -import { UserRequestType, Uuid } from '@standardnotes/common' +import { UserRequestType } from '@standardnotes/common' import { type RootKeyParamsInterface } from '@standardnotes/models' import { UserDeletionResponse } from '../../Response/User/UserDeletionResponse' @@ -12,6 +12,6 @@ export interface UserApiServiceInterface { keyParams: RootKeyParamsInterface ephemeral: boolean }): Promise - submitUserRequest(dto: { userUuid: Uuid; requestType: UserRequestType }): Promise + submitUserRequest(dto: { userUuid: string; requestType: UserRequestType }): Promise deleteAccount(userUuid: string): Promise } diff --git a/packages/api/src/Domain/Client/Workspace/WorkspaceApiService.ts b/packages/api/src/Domain/Client/Workspace/WorkspaceApiService.ts index 92f9f02cd..af43c91e2 100644 --- a/packages/api/src/Domain/Client/Workspace/WorkspaceApiService.ts +++ b/packages/api/src/Domain/Client/Workspace/WorkspaceApiService.ts @@ -1,4 +1,4 @@ -import { Uuid, WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common' +import { WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common' import { ErrorMessage } from '../../Error/ErrorMessage' import { ApiCallError } from '../../Error/ApiCallError' @@ -96,7 +96,7 @@ export class WorkspaceApiService implements WorkspaceApiServiceInterface { async inviteToWorkspace(dto: { inviteeEmail: string - workspaceUuid: Uuid + workspaceUuid: string accessLevel: WorkspaceAccessLevel }): Promise { this.lockOperation(WorkspaceApiOperations.Inviting) diff --git a/packages/api/src/Domain/Client/Workspace/WorkspaceApiServiceInterface.ts b/packages/api/src/Domain/Client/Workspace/WorkspaceApiServiceInterface.ts index fed57f388..95be52d42 100644 --- a/packages/api/src/Domain/Client/Workspace/WorkspaceApiServiceInterface.ts +++ b/packages/api/src/Domain/Client/Workspace/WorkspaceApiServiceInterface.ts @@ -1,4 +1,4 @@ -import { Uuid, WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common' +import { WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common' import { WorkspaceKeyshareInitiatingResponse } from '../../Response/Workspace/WorkspaceKeyshareInitiatingResponse' import { WorkspaceCreationResponse } from '../../Response/Workspace/WorkspaceCreationResponse' @@ -17,20 +17,20 @@ export interface WorkspaceApiServiceInterface { }): Promise inviteToWorkspace(dto: { inviteeEmail: string - workspaceUuid: Uuid + workspaceUuid: string accessLevel: WorkspaceAccessLevel }): Promise acceptInvite(dto: { - inviteUuid: Uuid - userUuid: Uuid + inviteUuid: string + userUuid: string publicKey: string encryptedPrivateKey: string }): Promise listWorkspaces(): Promise - listWorkspaceUsers(dto: { workspaceUuid: Uuid }): Promise + listWorkspaceUsers(dto: { workspaceUuid: string }): Promise initiateKeyshare(dto: { - workspaceUuid: Uuid - userUuid: Uuid + workspaceUuid: string + userUuid: string encryptedWorkspaceKey: string }): Promise } diff --git a/packages/api/src/Domain/Client/Workspace/WorkspaceUser.ts b/packages/api/src/Domain/Client/Workspace/WorkspaceUser.ts index 16fcb8e5d..bcad3c4e2 100644 --- a/packages/api/src/Domain/Client/Workspace/WorkspaceUser.ts +++ b/packages/api/src/Domain/Client/Workspace/WorkspaceUser.ts @@ -1,11 +1,11 @@ -import { Uuid, WorkspaceAccessLevel, WorkspaceUserStatus } from '@standardnotes/common' +import { WorkspaceAccessLevel, WorkspaceUserStatus } from '@standardnotes/common' export type WorkspaceUser = { - uuid: Uuid + uuid: string accessLevel: WorkspaceAccessLevel - userUuid: Uuid + userUuid: string userDisplayName: string | null - workspaceUuid: Uuid + workspaceUuid: string encryptedWorkspaceKey: string | null publicKey: string | null encryptedPrivateKey: string | null diff --git a/packages/api/src/Domain/Http/HttpResponseMeta.ts b/packages/api/src/Domain/Http/HttpResponseMeta.ts index baebf9db6..4850c108e 100644 --- a/packages/api/src/Domain/Http/HttpResponseMeta.ts +++ b/packages/api/src/Domain/Http/HttpResponseMeta.ts @@ -1,9 +1,8 @@ import { Role } from '@standardnotes/security' -import { Uuid } from '@standardnotes/common' export type HttpResponseMeta = { auth: { - userUuid?: Uuid + userUuid?: string roles?: Role[] } server: { diff --git a/packages/api/src/Domain/Request/Subscription/SubscriptionInviteAcceptRequestParams.ts b/packages/api/src/Domain/Request/Subscription/SubscriptionInviteAcceptRequestParams.ts index c72da5b6b..2b4707b90 100644 --- a/packages/api/src/Domain/Request/Subscription/SubscriptionInviteAcceptRequestParams.ts +++ b/packages/api/src/Domain/Request/Subscription/SubscriptionInviteAcceptRequestParams.ts @@ -1,6 +1,4 @@ -import { Uuid } from '@standardnotes/common' - export type SubscriptionInviteAcceptRequestParams = { - inviteUuid: Uuid + inviteUuid: string [additionalParam: string]: unknown } diff --git a/packages/api/src/Domain/Request/Subscription/SubscriptionInviteCancelRequestParams.ts b/packages/api/src/Domain/Request/Subscription/SubscriptionInviteCancelRequestParams.ts index f00b6912c..b68f1b420 100644 --- a/packages/api/src/Domain/Request/Subscription/SubscriptionInviteCancelRequestParams.ts +++ b/packages/api/src/Domain/Request/Subscription/SubscriptionInviteCancelRequestParams.ts @@ -1,10 +1,8 @@ -import { Uuid } from '@standardnotes/common' - import { ApiEndpointParam } from '../ApiEndpointParam' import { ApiVersion } from '../../Api/ApiVersion' export type SubscriptionInviteCancelRequestParams = { [ApiEndpointParam.ApiVersion]: ApiVersion.v0 - inviteUuid: Uuid + inviteUuid: string [additionalParam: string]: unknown } diff --git a/packages/api/src/Domain/Request/Subscription/SubscriptionInviteDeclineRequestParams.ts b/packages/api/src/Domain/Request/Subscription/SubscriptionInviteDeclineRequestParams.ts index bd771f304..67968c404 100644 --- a/packages/api/src/Domain/Request/Subscription/SubscriptionInviteDeclineRequestParams.ts +++ b/packages/api/src/Domain/Request/Subscription/SubscriptionInviteDeclineRequestParams.ts @@ -1,10 +1,8 @@ -import { Uuid } from '@standardnotes/common' - import { ApiEndpointParam } from '../ApiEndpointParam' import { ApiVersion } from '../../Api/ApiVersion' export type SubscriptionInviteDeclineRequestParams = { [ApiEndpointParam.ApiVersion]: ApiVersion.v0 - inviteUuid: Uuid + inviteUuid: string [additionalParam: string]: unknown } diff --git a/packages/api/src/Domain/Request/User/UserDeletionRequestParams.ts b/packages/api/src/Domain/Request/User/UserDeletionRequestParams.ts index 4b82aeb68..21b77caca 100644 --- a/packages/api/src/Domain/Request/User/UserDeletionRequestParams.ts +++ b/packages/api/src/Domain/Request/User/UserDeletionRequestParams.ts @@ -1,6 +1,4 @@ -import { Uuid } from '@standardnotes/common' - export type UserDeletionRequestParams = { - userUuid: Uuid + userUuid: string [additionalParam: string]: unknown } diff --git a/packages/api/src/Domain/Request/UserRequest/UserRequestRequestParams.ts b/packages/api/src/Domain/Request/UserRequest/UserRequestRequestParams.ts index 9a7cda719..02214ba7b 100644 --- a/packages/api/src/Domain/Request/UserRequest/UserRequestRequestParams.ts +++ b/packages/api/src/Domain/Request/UserRequest/UserRequestRequestParams.ts @@ -1,7 +1,7 @@ -import { UserRequestType, Uuid } from '@standardnotes/common' +import { UserRequestType } from '@standardnotes/common' export type UserRequestRequestParams = { - userUuid: Uuid + userUuid: string requestType: UserRequestType [additionalParam: string]: unknown } diff --git a/packages/api/src/Domain/Request/Workspace/WorkspaceInvitationAcceptingRequestParams.ts b/packages/api/src/Domain/Request/Workspace/WorkspaceInvitationAcceptingRequestParams.ts index 4349e6708..8a7e89a8c 100644 --- a/packages/api/src/Domain/Request/Workspace/WorkspaceInvitationAcceptingRequestParams.ts +++ b/packages/api/src/Domain/Request/Workspace/WorkspaceInvitationAcceptingRequestParams.ts @@ -1,8 +1,6 @@ -import { Uuid } from '@standardnotes/common' - export type WorkspaceInvitationAcceptingRequestParams = { - inviteUuid: Uuid - userUuid: Uuid + inviteUuid: string + userUuid: string publicKey: string encryptedPrivateKey: string [additionalParam: string]: unknown diff --git a/packages/api/src/Domain/Request/Workspace/WorkspaceInvitationRequestParams.ts b/packages/api/src/Domain/Request/Workspace/WorkspaceInvitationRequestParams.ts index 3f9cdced3..327a8d820 100644 --- a/packages/api/src/Domain/Request/Workspace/WorkspaceInvitationRequestParams.ts +++ b/packages/api/src/Domain/Request/Workspace/WorkspaceInvitationRequestParams.ts @@ -1,7 +1,7 @@ -import { Uuid, WorkspaceAccessLevel } from '@standardnotes/common' +import { WorkspaceAccessLevel } from '@standardnotes/common' export type WorkspaceInvitationRequestParams = { - workspaceUuid: Uuid + workspaceUuid: string inviteeEmail: string accessLevel: WorkspaceAccessLevel [additionalParam: string]: unknown diff --git a/packages/api/src/Domain/Request/Workspace/WorkspaceKeyshareInitiatingRequestParams.ts b/packages/api/src/Domain/Request/Workspace/WorkspaceKeyshareInitiatingRequestParams.ts index 786c43203..ae3a64160 100644 --- a/packages/api/src/Domain/Request/Workspace/WorkspaceKeyshareInitiatingRequestParams.ts +++ b/packages/api/src/Domain/Request/Workspace/WorkspaceKeyshareInitiatingRequestParams.ts @@ -1,8 +1,6 @@ -import { Uuid } from '@standardnotes/common' - export type WorkspaceKeyshareInitiatingRequestParams = { - userUuid: Uuid - workspaceUuid: Uuid + userUuid: string + workspaceUuid: string encryptedWorkspaceKey: string [additionalParam: string]: unknown } diff --git a/packages/api/src/Domain/Request/Workspace/WorkspaceUserListRequestParams.ts b/packages/api/src/Domain/Request/Workspace/WorkspaceUserListRequestParams.ts index cef93740d..2381ca407 100644 --- a/packages/api/src/Domain/Request/Workspace/WorkspaceUserListRequestParams.ts +++ b/packages/api/src/Domain/Request/Workspace/WorkspaceUserListRequestParams.ts @@ -1,6 +1,4 @@ -import { Uuid } from '@standardnotes/common' - export type WorkspaceUserListRequestParams = { - workspaceUuid: Uuid + workspaceUuid: string [additionalParam: string]: unknown } diff --git a/packages/api/src/Domain/Response/Subscription/SubscriptionInviteResponseBody.ts b/packages/api/src/Domain/Response/Subscription/SubscriptionInviteResponseBody.ts index 7c78bf3fb..3035233d0 100644 --- a/packages/api/src/Domain/Response/Subscription/SubscriptionInviteResponseBody.ts +++ b/packages/api/src/Domain/Response/Subscription/SubscriptionInviteResponseBody.ts @@ -1,9 +1,7 @@ -import { Uuid } from '@standardnotes/common' - export type SubscriptionInviteResponseBody = | { success: true - sharedSubscriptionInvitationUuid: Uuid + sharedSubscriptionInvitationUuid: string } | { success: false diff --git a/packages/api/src/Domain/Response/User/UserRegistrationResponseBody.ts b/packages/api/src/Domain/Response/User/UserRegistrationResponseBody.ts index 57cbd340f..0e99172be 100644 --- a/packages/api/src/Domain/Response/User/UserRegistrationResponseBody.ts +++ b/packages/api/src/Domain/Response/User/UserRegistrationResponseBody.ts @@ -1,11 +1,10 @@ -import { Uuid } from '@standardnotes/common' import { KeyParamsData, SessionBody } from '@standardnotes/responses' export type UserRegistrationResponseBody = { session: SessionBody key_params: KeyParamsData user: { - uuid: Uuid + uuid: string email: string } } diff --git a/packages/api/src/Domain/Server/Subscription/Paths.ts b/packages/api/src/Domain/Server/Subscription/Paths.ts index 73cbca6cf..60783541e 100644 --- a/packages/api/src/Domain/Server/Subscription/Paths.ts +++ b/packages/api/src/Domain/Server/Subscription/Paths.ts @@ -1,10 +1,8 @@ -import { Uuid } from '@standardnotes/common' - const SharingPaths = { invite: '/v1/subscription-invites', - acceptInvite: (inviteUuid: Uuid) => `/v1/subscription-invites/${inviteUuid}/accept`, - declineInvite: (inviteUuid: Uuid) => `/v1/subscription-invites/${inviteUuid}/decline`, - cancelInvite: (inviteUuid: Uuid) => `/v1/subscription-invites/${inviteUuid}`, + acceptInvite: (inviteUuid: string) => `/v1/subscription-invites/${inviteUuid}/accept`, + declineInvite: (inviteUuid: string) => `/v1/subscription-invites/${inviteUuid}/decline`, + cancelInvite: (inviteUuid: string) => `/v1/subscription-invites/${inviteUuid}`, listInvites: '/v1/subscription-invites', } diff --git a/packages/api/src/Domain/Server/User/Paths.ts b/packages/api/src/Domain/Server/User/Paths.ts index 00e735241..9c9252775 100644 --- a/packages/api/src/Domain/Server/User/Paths.ts +++ b/packages/api/src/Domain/Server/User/Paths.ts @@ -1,8 +1,6 @@ -import { Uuid } from '@standardnotes/common' - const UserPaths = { register: '/v1/users', - deleteAccount: (userUuid: Uuid) => `/v1/users/${userUuid}`, + deleteAccount: (userUuid: string) => `/v1/users/${userUuid}`, } export const Paths = { diff --git a/packages/api/src/Domain/Server/UserRequest/Paths.ts b/packages/api/src/Domain/Server/UserRequest/Paths.ts index dde538580..c807713cd 100644 --- a/packages/api/src/Domain/Server/UserRequest/Paths.ts +++ b/packages/api/src/Domain/Server/UserRequest/Paths.ts @@ -1,7 +1,5 @@ -import { Uuid } from '@standardnotes/common' - const UserRequestPaths = { - submitUserRequest: (userUuid: Uuid) => `/v1/users/${userUuid}/requests`, + submitUserRequest: (userUuid: string) => `/v1/users/${userUuid}/requests`, } export const Paths = { diff --git a/packages/api/src/Domain/Server/Workspace/Paths.ts b/packages/api/src/Domain/Server/Workspace/Paths.ts index d9495e22f..7f766f941 100644 --- a/packages/api/src/Domain/Server/Workspace/Paths.ts +++ b/packages/api/src/Domain/Server/Workspace/Paths.ts @@ -1,13 +1,11 @@ -import { Uuid } from '@standardnotes/common' - const WorkspacePaths = { createWorkspace: '/v1/workspaces', listWorkspaces: '/v1/workspaces', - listWorkspaceUsers: (uuid: Uuid) => `/v1/workspaces/${uuid}/users`, - initiateKeyshare: (worksapceUuid: Uuid, userUuid: Uuid) => + listWorkspaceUsers: (uuid: string) => `/v1/workspaces/${uuid}/users`, + initiateKeyshare: (worksapceUuid: string, userUuid: string) => `/v1/workspaces/${worksapceUuid}/users/${userUuid}/keyshare`, - inviteToWorkspace: (uuid: Uuid) => `/v1/workspaces/${uuid}/invites`, - acceptInvite: (uuid: Uuid) => `/v1/invites/${uuid}/accept`, + inviteToWorkspace: (uuid: string) => `/v1/workspaces/${uuid}/invites`, + acceptInvite: (uuid: string) => `/v1/invites/${uuid}/accept`, } export const Paths = { diff --git a/packages/desktop/CHANGELOG.md b/packages/desktop/CHANGELOG.md index 801a226ba..9c3dfa073 100644 --- a/packages/desktop/CHANGELOG.md +++ b/packages/desktop/CHANGELOG.md @@ -3,6 +3,34 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.104.100](https://github.com/standardnotes/app/compare/@standardnotes/desktop@3.140.6...@standardnotes/desktop@3.104.100) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/desktop + +## [3.104.99](https://github.com/standardnotes/app/compare/@standardnotes/desktop@3.140.5...@standardnotes/desktop@3.104.99) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/desktop + +## [3.104.98](https://github.com/standardnotes/app/compare/@standardnotes/desktop@3.140.4...@standardnotes/desktop@3.104.98) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/desktop + +## [3.104.97](https://github.com/standardnotes/app/compare/@standardnotes/desktop@3.140.3...@standardnotes/desktop@3.104.97) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/desktop + +## [3.104.96](https://github.com/standardnotes/app/compare/@standardnotes/desktop@3.140.2...@standardnotes/desktop@3.104.96) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/desktop + +## [3.104.95](https://github.com/standardnotes/app/compare/@standardnotes/desktop@3.140.1...@standardnotes/desktop@3.104.95) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/desktop + +## [3.104.94](https://github.com/standardnotes/app/compare/@standardnotes/desktop@3.140.0...@standardnotes/desktop@3.104.94) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/desktop + ## [3.104.93](https://github.com/standardnotes/app/compare/@standardnotes/desktop@3.139.0...@standardnotes/desktop@3.104.93) (2023-01-18) **Note:** Version bump only for package @standardnotes/desktop diff --git a/packages/desktop/package.json b/packages/desktop/package.json index 31290f6a2..c941ce59e 100644 --- a/packages/desktop/package.json +++ b/packages/desktop/package.json @@ -1,7 +1,7 @@ { "name": "@standardnotes/desktop", "main": "./app/dist/index.js", - "version": "3.104.93", + "version": "3.104.100", "license": "AGPL-3.0-or-later", "author": "Standard Notes.", "private": true, diff --git a/packages/encryption/CHANGELOG.md b/packages/encryption/CHANGELOG.md index 75af0da05..4a4ff7daa 100644 --- a/packages/encryption/CHANGELOG.md +++ b/packages/encryption/CHANGELOG.md @@ -3,6 +3,30 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.21.6](https://github.com/standardnotes/app/compare/@standardnotes/encryption@1.21.5...@standardnotes/encryption@1.21.6) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/encryption + +## [1.21.5](https://github.com/standardnotes/app/compare/@standardnotes/encryption@1.21.4...@standardnotes/encryption@1.21.5) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/encryption + +## [1.21.4](https://github.com/standardnotes/app/compare/@standardnotes/encryption@1.21.3...@standardnotes/encryption@1.21.4) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/encryption + +## [1.21.3](https://github.com/standardnotes/app/compare/@standardnotes/encryption@1.21.2...@standardnotes/encryption@1.21.3) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/encryption + +## [1.21.2](https://github.com/standardnotes/app/compare/@standardnotes/encryption@1.21.1...@standardnotes/encryption@1.21.2) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/encryption + +## [1.21.1](https://github.com/standardnotes/app/compare/@standardnotes/encryption@1.21.0...@standardnotes/encryption@1.21.1) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/encryption + # [1.21.0](https://github.com/standardnotes/app/compare/@standardnotes/encryption@1.20.1...@standardnotes/encryption@1.21.0) (2023-01-18) ### Features diff --git a/packages/encryption/package.json b/packages/encryption/package.json index fb15cbc9d..08e22dc3f 100644 --- a/packages/encryption/package.json +++ b/packages/encryption/package.json @@ -1,6 +1,6 @@ { "name": "@standardnotes/encryption", - "version": "1.21.0", + "version": "1.21.6", "engines": { "node": ">=16.0.0 <17.0.0" }, @@ -35,7 +35,7 @@ "typescript": "*" }, "dependencies": { - "@standardnotes/common": "^1.45.0", + "@standardnotes/common": "^1.46.4", "@standardnotes/models": "workspace:*", "@standardnotes/responses": "workspace:*", "@standardnotes/sncrypto-common": "workspace:*", diff --git a/packages/encryption/src/Domain/Split/EncryptionSplit.ts b/packages/encryption/src/Domain/Split/EncryptionSplit.ts index c3094844a..3736a15c0 100644 --- a/packages/encryption/src/Domain/Split/EncryptionSplit.ts +++ b/packages/encryption/src/Domain/Split/EncryptionSplit.ts @@ -1,4 +1,3 @@ -import { Uuid } from '@standardnotes/common' import { DecryptedPayloadInterface, EncryptedPayloadInterface, PayloadInterface } from '@standardnotes/models' import { EncryptionTypeSplit } from './EncryptionTypeSplit' import { KeyedDecryptionSplit } from './KeyedDecryptionSplit' @@ -36,7 +35,7 @@ export function CreateDecryptionSplitWithKeyLookup( return result } -export function FindPayloadInEncryptionSplit(uuid: Uuid, split: KeyedEncryptionSplit): DecryptedPayloadInterface { +export function FindPayloadInEncryptionSplit(uuid: string, split: KeyedEncryptionSplit): DecryptedPayloadInterface { const inUsesItemsKey = split.usesItemsKey?.items.find((item: PayloadInterface) => item.uuid === uuid) if (inUsesItemsKey) { return inUsesItemsKey @@ -60,7 +59,7 @@ export function FindPayloadInEncryptionSplit(uuid: Uuid, split: KeyedEncryptionS throw Error('Cannot find payload in encryption split') } -export function FindPayloadInDecryptionSplit(uuid: Uuid, split: KeyedDecryptionSplit): EncryptedPayloadInterface { +export function FindPayloadInDecryptionSplit(uuid: string, split: KeyedDecryptionSplit): EncryptedPayloadInterface { const inUsesItemsKey = split.usesItemsKey?.items.find((item: PayloadInterface) => item.uuid === uuid) if (inUsesItemsKey) { return inUsesItemsKey diff --git a/packages/encryption/src/Domain/Types/ItemAuthenticatedData.ts b/packages/encryption/src/Domain/Types/ItemAuthenticatedData.ts index 2b75da608..92fc43079 100644 --- a/packages/encryption/src/Domain/Types/ItemAuthenticatedData.ts +++ b/packages/encryption/src/Domain/Types/ItemAuthenticatedData.ts @@ -1,6 +1,6 @@ -import { ProtocolVersion, Uuid } from '@standardnotes/common' +import { ProtocolVersion } from '@standardnotes/common' export type ItemAuthenticatedData = { - u: Uuid + u: string v: ProtocolVersion } diff --git a/packages/features/CHANGELOG.md b/packages/features/CHANGELOG.md index bdd879dfc..99f0c6f36 100644 --- a/packages/features/CHANGELOG.md +++ b/packages/features/CHANGELOG.md @@ -3,6 +3,28 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.58.5](https://github.com/standardnotes/app/compare/@standardnotes/features@1.58.4...@standardnotes/features@1.58.5) (2023-01-20) + +### Bug Fixes + +* fixed issue with third party editors not loading ([#2174](https://github.com/standardnotes/app/issues/2174)) ([e7214ea](https://github.com/standardnotes/app/commit/e7214ea73ad5d3026d958c79022d2238a4d1cfdc)) + +## [1.58.4](https://github.com/standardnotes/app/compare/@standardnotes/features@1.58.3...@standardnotes/features@1.58.4) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/features + +## [1.58.3](https://github.com/standardnotes/app/compare/@standardnotes/features@1.58.2...@standardnotes/features@1.58.3) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/features + +## [1.58.2](https://github.com/standardnotes/app/compare/@standardnotes/features@1.58.1...@standardnotes/features@1.58.2) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/features + +## [1.58.1](https://github.com/standardnotes/app/compare/@standardnotes/features@1.58.0...@standardnotes/features@1.58.1) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/features + # [1.58.0](https://github.com/standardnotes/app/compare/@standardnotes/features@1.57.1...@standardnotes/features@1.58.0) (2023-01-06) ### Features diff --git a/packages/features/package.json b/packages/features/package.json index c05f303db..3faffa560 100644 --- a/packages/features/package.json +++ b/packages/features/package.json @@ -1,6 +1,6 @@ { "name": "@standardnotes/features", - "version": "1.58.0", + "version": "1.58.5", "engines": { "node": ">=16.0.0 <17.0.0" }, @@ -25,9 +25,9 @@ "test": "jest" }, "dependencies": { - "@standardnotes/auth": "^3.19.4", - "@standardnotes/common": "^1.45.0", - "@standardnotes/security": "^1.7.0", + "@standardnotes/common": "^1.46.4", + "@standardnotes/domain-core": "^1.11.1", + "@standardnotes/security": "^1.7.5", "reflect-metadata": "^0.1.13" }, "devDependencies": { diff --git a/packages/features/src/Domain/Component/NoteType.spec.ts b/packages/features/src/Domain/Component/NoteType.spec.ts index 7d53b1420..7fcc6e1ff 100644 --- a/packages/features/src/Domain/Component/NoteType.spec.ts +++ b/packages/features/src/Domain/Component/NoteType.spec.ts @@ -5,7 +5,6 @@ describe('note type', () => { it('should return the correct note type for editor identifier', () => { expect(noteTypeForEditorIdentifier(FeatureIdentifier.PlainEditor)).toEqual(NoteType.Plain) expect(noteTypeForEditorIdentifier(FeatureIdentifier.SuperEditor)).toEqual(NoteType.Super) - expect(noteTypeForEditorIdentifier(FeatureIdentifier.MarkdownVisualEditor)).toEqual(NoteType.Markdown) expect(noteTypeForEditorIdentifier(FeatureIdentifier.MarkdownProEditor)).toEqual(NoteType.Markdown) expect(noteTypeForEditorIdentifier(FeatureIdentifier.PlusEditor)).toEqual(NoteType.RichText) expect(noteTypeForEditorIdentifier(FeatureIdentifier.CodeEditor)).toEqual(NoteType.Code) diff --git a/packages/features/src/Domain/Feature/FeatureDescription.ts b/packages/features/src/Domain/Feature/FeatureDescription.ts index 5d30abdd8..adafc6b05 100644 --- a/packages/features/src/Domain/Feature/FeatureDescription.ts +++ b/packages/features/src/Domain/Feature/FeatureDescription.ts @@ -1,5 +1,5 @@ import { ComponentPermission } from '../Component/ComponentPermission' -import { ContentType, RoleName, SubscriptionName } from '@standardnotes/common' +import { ContentType, SubscriptionName } from '@standardnotes/common' import { ComponentArea } from '../Component/ComponentArea' import { PermissionName } from '../Permission/PermissionName' import { FeatureIdentifier } from './FeatureIdentifier' @@ -9,11 +9,11 @@ import { ThemeDockIcon } from '../Component/ThemeDockIcon' type RoleFields = { /** Server populated */ - role_name?: RoleName + role_name?: string /** Statically populated. Non-influencing; used as a reference by other static consumers (such as email service) */ availableInSubscriptions: SubscriptionName[] - availableInRoles?: RoleName[] + availableInRoles?: string[] } export type BaseFeatureDescription = RoleFields & { diff --git a/packages/features/src/Domain/Feature/FeatureIdentifier.ts b/packages/features/src/Domain/Feature/FeatureIdentifier.ts index 990fee0b5..1c6861207 100644 --- a/packages/features/src/Domain/Feature/FeatureIdentifier.ts +++ b/packages/features/src/Domain/Feature/FeatureIdentifier.ts @@ -1,5 +1,4 @@ export enum FeatureIdentifier { - AccountSwitcher = 'com.standardnotes.account-switcher', CloudLink = 'org.standardnotes.cloudlink', DailyDropboxBackup = 'org.standardnotes.daily-dropbox-backup', DailyEmailBackup = 'org.standardnotes.daily-email-backup', @@ -21,7 +20,6 @@ export enum FeatureIdentifier { AutobiographyTheme = 'org.standardnotes.theme-autobiography', DynamicTheme = 'org.standardnotes.theme-dynamic', DarkTheme = 'org.standardnotes.theme-focus', - FocusMode = 'org.standardnotes.focus-mode', FuturaTheme = 'org.standardnotes.theme-futura', MidnightTheme = 'org.standardnotes.theme-midnight', SolarizedDarkTheme = 'org.standardnotes.theme-solarized-dark', @@ -32,12 +30,12 @@ export enum FeatureIdentifier { CodeEditor = 'org.standardnotes.code-editor', MarkdownProEditor = 'org.standardnotes.advanced-markdown-editor', - MarkdownVisualEditor = 'org.standardnotes.markdown-visual-editor', PlusEditor = 'org.standardnotes.plus-editor', SheetsEditor = 'org.standardnotes.standard-sheets', TaskEditor = 'org.standardnotes.simple-task-editor', TokenVaultEditor = 'org.standardnotes.token-vault', + DeprecatedMarkdownVisualEditor = 'org.standardnotes.markdown-visual-editor', DeprecatedBoldEditor = 'org.standardnotes.bold-editor', DeprecatedMarkdownBasicEditor = 'org.standardnotes.simple-markdown-editor', DeprecatedMarkdownMathEditor = 'org.standardnotes.fancy-markdown-editor', diff --git a/packages/features/src/Domain/Feature/Features.ts b/packages/features/src/Domain/Feature/Features.ts index 38465be7f..b457d5bf8 100644 --- a/packages/features/src/Domain/Feature/Features.ts +++ b/packages/features/src/Domain/Feature/Features.ts @@ -1,7 +1,5 @@ import { FeatureDescription } from './FeatureDescription' import { FeatureIdentifier } from './FeatureIdentifier' -import { editors } from '../Lists/Editors' -import { themes } from '../Lists/Themes' import { serverFeatures } from '../Lists/ServerFeatures' import { clientFeatures } from '../Lists/ClientFeatures' import { GetDeprecatedFeatures } from '../Lists/DeprecatedFeatures' @@ -9,14 +7,7 @@ import { experimentalFeatures } from '../Lists/ExperimentalFeatures' import { SubscriptionName } from '@standardnotes/common' export function GetFeatures(): FeatureDescription[] { - return [ - ...themes(), - ...editors(), - ...serverFeatures(), - ...clientFeatures(), - ...experimentalFeatures(), - ...GetDeprecatedFeatures(), - ] + return [...serverFeatures(), ...clientFeatures(), ...experimentalFeatures(), ...GetDeprecatedFeatures()] } export function GetFeaturesForSubscription(subscription: SubscriptionName): FeatureDescription[] { diff --git a/packages/features/src/Domain/Lists/ClientFeatures.ts b/packages/features/src/Domain/Lists/ClientFeatures.ts index ff404c96b..167166e11 100644 --- a/packages/features/src/Domain/Lists/ClientFeatures.ts +++ b/packages/features/src/Domain/Lists/ClientFeatures.ts @@ -1,13 +1,19 @@ -import { ClientFeatureDescription } from '../Feature/FeatureDescription' +import { FeatureDescription } from '../Feature/FeatureDescription' import { PermissionName } from '../Permission/PermissionName' import { FeatureIdentifier } from '../Feature/FeatureIdentifier' -import { RoleName, SubscriptionName } from '@standardnotes/common' +import { SubscriptionName } from '@standardnotes/common' +import { RoleName } from '@standardnotes/domain-core' +import { themes } from './Themes' +import { editors } from './Editors' -export function clientFeatures(): ClientFeatureDescription[] { +export function clientFeatures(): FeatureDescription[] { return [ + ...themes(), + ...editors(), { - availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], name: 'Tag Nesting', + availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], identifier: FeatureIdentifier.TagNesting, permission_name: PermissionName.TagNesting, description: 'Organize your tags into folders.', @@ -16,45 +22,26 @@ export function clientFeatures(): ClientFeatureDescription[] { name: 'Super Notes', identifier: FeatureIdentifier.SuperEditor, availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], permission_name: PermissionName.SuperEditor, description: - 'Type / to bring up the block selection menu, or @ to embed images or link other tags and notes. Type - then space to start a list, or [] then space to start a checklist. Drag and drop an image or file to embed it in your note.', - availableInRoles: [RoleName.PlusUser, RoleName.ProUser], + 'A new way to edit notes. Type / to bring up the block selection menu, or @ to embed images or link other tags and notes. Type - then space to start a list, or [] then space to start a checklist. Drag and drop an image or file to embed it in your note. Cmd/Ctrl + F to bring up search and replace.', }, { - availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], name: 'Smart Filters', + availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], identifier: FeatureIdentifier.SmartFilters, permission_name: PermissionName.SmartFilters, description: 'Create smart filters for viewing notes matching specific criteria.', }, { - availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], name: 'Encrypted files', + availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], + availableInRoles: [RoleName.NAMES.ProUser], identifier: FeatureIdentifier.Files, permission_name: PermissionName.Files, description: '', }, - { - availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], - name: 'Focus Mode', - identifier: FeatureIdentifier.FocusMode, - permission_name: PermissionName.FocusMode, - description: '', - }, - { - availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], - name: 'Listed Custom Domain', - identifier: FeatureIdentifier.ListedCustomDomain, - permission_name: PermissionName.ListedCustomDomain, - description: '', - }, - { - availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], - name: 'Multiple accounts', - identifier: FeatureIdentifier.AccountSwitcher, - permission_name: PermissionName.AccountSwitcher, - description: '', - }, ] } diff --git a/packages/features/src/Domain/Lists/DeprecatedFeatures.ts b/packages/features/src/Domain/Lists/DeprecatedFeatures.ts index 4e2d9e4dd..95e726a9b 100644 --- a/packages/features/src/Domain/Lists/DeprecatedFeatures.ts +++ b/packages/features/src/Domain/Lists/DeprecatedFeatures.ts @@ -10,6 +10,7 @@ import { NoteType } from '../Component/NoteType' import { FillEditorComponentDefaults } from './Utilities/FillEditorComponentDefaults' import { ComponentAction } from '../Component/ComponentAction' import { ComponentArea } from '../Component/ComponentArea' +import { RoleName } from '@standardnotes/domain-core' export function GetDeprecatedFeatures(): FeatureDescription[] { const bold: EditorFeatureDescription = FillEditorComponentDefaults({ @@ -37,6 +38,7 @@ export function GetDeprecatedFeatures(): FeatureDescription[] { permission_name: PermissionName.BoldEditor, description: 'A simple and peaceful rich editor that helps you write and think clearly.', thumbnail_url: 'https://s3.amazonaws.com/standard-notes/screenshots/models/editors/bold.jpg', + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const markdownBasic: EditorFeatureDescription = FillEditorComponentDefaults({ @@ -50,6 +52,22 @@ export function GetDeprecatedFeatures(): FeatureDescription[] { permission_name: PermissionName.MarkdownBasicEditor, description: 'A Markdown editor with dynamic split-pane preview.', thumbnail_url: 'https://s3.amazonaws.com/standard-notes/screenshots/models/editors/simple-markdown.jpg', + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], + }) + + const markdownAlt: EditorFeatureDescription = FillEditorComponentDefaults({ + availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], + name: 'Markdown Alternative', + identifier: FeatureIdentifier.DeprecatedMarkdownVisualEditor, + note_type: NoteType.Markdown, + file_type: 'md', + deprecated: true, + permission_name: PermissionName.MarkdownVisualEditor, + spellcheckControl: true, + description: + 'A WYSIWYG-style Markdown editor that renders Markdown in preview-mode while you type without displaying any syntax.', + index_path: 'build/index.html', + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const markdownMinimist: EditorFeatureDescription = FillEditorComponentDefaults({ @@ -64,6 +82,7 @@ export function GetDeprecatedFeatures(): FeatureDescription[] { deprecated: true, description: 'A minimal Markdown editor with live rendering and in-text search via Ctrl/Cmd + F', thumbnail_url: 'https://s3.amazonaws.com/standard-notes/screenshots/models/editors/min-markdown.jpg', + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const markdownMath: EditorFeatureDescription = FillEditorComponentDefaults({ @@ -78,6 +97,7 @@ export function GetDeprecatedFeatures(): FeatureDescription[] { index_path: 'index.html', description: 'A beautiful split-pane Markdown editor with synced-scroll, LaTeX support, and colorful syntax.', thumbnail_url: 'https://s3.amazonaws.com/standard-notes/screenshots/models/editors/fancy-markdown.jpg', + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const filesafe: IframeComponentFeatureDescription = FillEditorComponentDefaults({ @@ -104,7 +124,8 @@ export function GetDeprecatedFeatures(): FeatureDescription[] { description: 'Encrypted attachments for your notes using your Dropbox, Google Drive, or WebDAV server. Limited to 50MB per file.', thumbnail_url: 'https://s3.amazonaws.com/standard-notes/screenshots/models/FileSafe-banner.png', + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) - return [bold, markdownBasic, markdownMinimist, markdownMath, filesafe] + return [bold, markdownBasic, markdownMinimist, markdownMath, markdownAlt, filesafe] } diff --git a/packages/features/src/Domain/Lists/Editors.ts b/packages/features/src/Domain/Lists/Editors.ts index f7446c848..611ca50f6 100644 --- a/packages/features/src/Domain/Lists/Editors.ts +++ b/packages/features/src/Domain/Lists/Editors.ts @@ -4,6 +4,7 @@ import { PermissionName } from '../Permission/PermissionName' import { FeatureIdentifier } from '../Feature/FeatureIdentifier' import { NoteType } from '../Component/NoteType' import { FillEditorComponentDefaults } from './Utilities/FillEditorComponentDefaults' +import { RoleName } from '@standardnotes/domain-core' export function editors(): EditorFeatureDescription[] { const code: EditorFeatureDescription = FillEditorComponentDefaults({ @@ -20,6 +21,7 @@ export function editors(): EditorFeatureDescription[] { 'Syntax highlighting and convenient keyboard shortcuts for over 120 programming' + ' languages. Ideal for code snippets and procedures.', thumbnail_url: 'https://s3.amazonaws.com/standard-notes/screenshots/models/editors/code.jpg', + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const plus: EditorFeatureDescription = FillEditorComponentDefaults({ @@ -33,6 +35,7 @@ export function editors(): EditorFeatureDescription[] { description: 'From highlighting to custom font sizes and colors, to tables and lists, this editor is perfect for crafting any document.', thumbnail_url: 'https://s3.amazonaws.com/standard-notes/screenshots/models/editors/plus-editor.jpg', + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const markdown: EditorFeatureDescription = FillEditorComponentDefaults({ @@ -46,19 +49,7 @@ export function editors(): EditorFeatureDescription[] { description: 'A fully featured Markdown editor that supports live preview, a styling toolbar, and split pane support.', thumbnail_url: 'https://s3.amazonaws.com/standard-notes/screenshots/models/editors/adv-markdown.jpg', - }) - - const markdownAlt: EditorFeatureDescription = FillEditorComponentDefaults({ - availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], - name: 'Markdown Alternative', - identifier: FeatureIdentifier.MarkdownVisualEditor, - note_type: NoteType.Markdown, - file_type: 'md', - permission_name: PermissionName.MarkdownVisualEditor, - spellcheckControl: true, - description: - 'A WYSIWYG-style Markdown editor that renders Markdown in preview-mode while you type without displaying any syntax.', - index_path: 'build/index.html', + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const task: EditorFeatureDescription = FillEditorComponentDefaults({ @@ -73,6 +64,7 @@ export function editors(): EditorFeatureDescription[] { description: 'A great way to manage short-term and long-term to-do"s. You can mark tasks as completed, change their order, and edit the text naturally in place.', thumbnail_url: 'https://s3.amazonaws.com/standard-notes/screenshots/models/editors/task-editor.jpg', + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const tokenvault: EditorFeatureDescription = FillEditorComponentDefaults({ @@ -86,6 +78,7 @@ export function editors(): EditorFeatureDescription[] { description: 'Encrypt and protect your 2FA secrets for all your internet accounts. Authenticator handles your 2FA secrets so that you never lose them again, or have to start over when you get a new device.', thumbnail_url: 'https://standard-notes.s3.amazonaws.com/screenshots/models/editors/token-vault.png', + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const spreadsheets: EditorFeatureDescription = FillEditorComponentDefaults({ @@ -99,7 +92,8 @@ export function editors(): EditorFeatureDescription[] { description: 'A powerful spreadsheet editor with formatting and formula support. Not recommended for large data sets, as encryption of such data may decrease editor performance.', thumbnail_url: 'https://s3.amazonaws.com/standard-notes/screenshots/models/editors/spreadsheets.png', + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) - return [code, plus, markdown, markdownAlt, task, tokenvault, spreadsheets] + return [code, plus, markdown, task, tokenvault, spreadsheets] } diff --git a/packages/features/src/Domain/Lists/ServerFeatures.ts b/packages/features/src/Domain/Lists/ServerFeatures.ts index 37c0389d4..9448215c2 100644 --- a/packages/features/src/Domain/Lists/ServerFeatures.ts +++ b/packages/features/src/Domain/Lists/ServerFeatures.ts @@ -65,5 +65,11 @@ export function serverFeatures(): ServerFeatureDescription[] { identifier: FeatureIdentifier.SubscriptionSharing, permission_name: PermissionName.SubscriptionSharing, }, + { + availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], + name: 'Listed Custom Domain', + identifier: FeatureIdentifier.ListedCustomDomain, + permission_name: PermissionName.ListedCustomDomain, + }, ] } diff --git a/packages/features/src/Domain/Lists/Themes.ts b/packages/features/src/Domain/Lists/Themes.ts index e03e550ce..247e14f57 100644 --- a/packages/features/src/Domain/Lists/Themes.ts +++ b/packages/features/src/Domain/Lists/Themes.ts @@ -3,6 +3,7 @@ import { PermissionName } from '../Permission/PermissionName' import { FeatureIdentifier } from '../Feature/FeatureIdentifier' import { FillThemeComponentDefaults } from './Utilities/FillThemeComponentDefaults' import { SubscriptionName } from '@standardnotes/common' +import { RoleName } from '@standardnotes/domain-core' export function themes(): ThemeFeatureDescription[] { const midnight: ThemeFeatureDescription = FillThemeComponentDefaults({ @@ -17,10 +18,12 @@ export function themes(): ThemeFeatureDescription[] { foreground_color: '#ffffff', border_color: '#086DD6', }, + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], }) const futura: ThemeFeatureDescription = FillThemeComponentDefaults({ availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], name: 'Futura', identifier: FeatureIdentifier.FuturaTheme, permission_name: PermissionName.FuturaTheme, @@ -35,6 +38,7 @@ export function themes(): ThemeFeatureDescription[] { const solarizedDark: ThemeFeatureDescription = FillThemeComponentDefaults({ availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], name: 'Solarized Dark', identifier: FeatureIdentifier.SolarizedDarkTheme, permission_name: PermissionName.SolarizedDarkTheme, @@ -49,6 +53,7 @@ export function themes(): ThemeFeatureDescription[] { const autobiography: ThemeFeatureDescription = FillThemeComponentDefaults({ availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], name: 'Autobiography', identifier: FeatureIdentifier.AutobiographyTheme, permission_name: PermissionName.AutobiographyTheme, @@ -77,6 +82,7 @@ export function themes(): ThemeFeatureDescription[] { const titanium: ThemeFeatureDescription = FillThemeComponentDefaults({ availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], name: 'Titanium', identifier: FeatureIdentifier.TitaniumTheme, permission_name: PermissionName.TitaniumTheme, @@ -90,6 +96,7 @@ export function themes(): ThemeFeatureDescription[] { const dynamic: ThemeFeatureDescription = FillThemeComponentDefaults({ availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], + availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser], name: 'Dynamic Panels', identifier: FeatureIdentifier.DynamicTheme, permission_name: PermissionName.ThemeDynamic, diff --git a/packages/features/src/Domain/Permission/Permission.ts b/packages/features/src/Domain/Permission/Permission.ts index 47b43d7ad..e7549c200 100644 --- a/packages/features/src/Domain/Permission/Permission.ts +++ b/packages/features/src/Domain/Permission/Permission.ts @@ -1,8 +1,6 @@ -import { Uuid } from '@standardnotes/common' - import { PermissionName } from './PermissionName' export type Permission = { - uuid: Uuid + uuid: string name: PermissionName } diff --git a/packages/filepicker/CHANGELOG.md b/packages/filepicker/CHANGELOG.md index 225f93b24..d7a89e80f 100644 --- a/packages/filepicker/CHANGELOG.md +++ b/packages/filepicker/CHANGELOG.md @@ -3,6 +3,30 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.28.11](https://github.com/standardnotes/app/compare/@standardnotes/filepicker@1.28.10...@standardnotes/filepicker@1.28.11) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/filepicker + +## [1.28.10](https://github.com/standardnotes/app/compare/@standardnotes/filepicker@1.28.9...@standardnotes/filepicker@1.28.10) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/filepicker + +## [1.28.9](https://github.com/standardnotes/app/compare/@standardnotes/filepicker@1.28.8...@standardnotes/filepicker@1.28.9) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/filepicker + +## [1.28.8](https://github.com/standardnotes/app/compare/@standardnotes/filepicker@1.28.7...@standardnotes/filepicker@1.28.8) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/filepicker + +## [1.28.7](https://github.com/standardnotes/app/compare/@standardnotes/filepicker@1.28.6...@standardnotes/filepicker@1.28.7) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/filepicker + +## [1.28.6](https://github.com/standardnotes/app/compare/@standardnotes/filepicker@1.28.5...@standardnotes/filepicker@1.28.6) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/filepicker + ## [1.28.5](https://github.com/standardnotes/app/compare/@standardnotes/filepicker@1.28.4...@standardnotes/filepicker@1.28.5) (2023-01-18) **Note:** Version bump only for package @standardnotes/filepicker diff --git a/packages/filepicker/package.json b/packages/filepicker/package.json index 1b379c20a..ed47a95b8 100644 --- a/packages/filepicker/package.json +++ b/packages/filepicker/package.json @@ -1,6 +1,6 @@ { "name": "@standardnotes/filepicker", - "version": "1.28.5", + "version": "1.28.11", "engines": { "node": ">=16.0.0 <17.0.0" }, @@ -26,7 +26,7 @@ "typescript": "*" }, "dependencies": { - "@standardnotes/common": "^1.45.0", + "@standardnotes/common": "^1.46.4", "@standardnotes/files": "workspace:*", "@standardnotes/utils": "workspace:*", "@types/wicg-file-system-access": "^2020.9.5", diff --git a/packages/files/CHANGELOG.md b/packages/files/CHANGELOG.md index 70287b8f4..d72acca8f 100644 --- a/packages/files/CHANGELOG.md +++ b/packages/files/CHANGELOG.md @@ -3,6 +3,30 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.21](https://github.com/standardnotes/app/compare/@standardnotes/files@1.14.20...@standardnotes/files@1.14.21) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/files + +## [1.14.20](https://github.com/standardnotes/app/compare/@standardnotes/files@1.14.19...@standardnotes/files@1.14.20) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/files + +## [1.14.19](https://github.com/standardnotes/app/compare/@standardnotes/files@1.14.18...@standardnotes/files@1.14.19) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/files + +## [1.14.18](https://github.com/standardnotes/app/compare/@standardnotes/files@1.14.17...@standardnotes/files@1.14.18) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/files + +## [1.14.17](https://github.com/standardnotes/app/compare/@standardnotes/files@1.14.16...@standardnotes/files@1.14.17) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/files + +## [1.14.16](https://github.com/standardnotes/app/compare/@standardnotes/files@1.14.15...@standardnotes/files@1.14.16) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/files + ## [1.14.15](https://github.com/standardnotes/app/compare/@standardnotes/files@1.14.14...@standardnotes/files@1.14.15) (2023-01-18) **Note:** Version bump only for package @standardnotes/files diff --git a/packages/files/package.json b/packages/files/package.json index cff26b623..4360ae0cc 100644 --- a/packages/files/package.json +++ b/packages/files/package.json @@ -1,6 +1,6 @@ { "name": "@standardnotes/files", - "version": "1.14.15", + "version": "1.14.21", "engines": { "node": ">=16.0.0 <17.0.0" }, @@ -28,7 +28,7 @@ "typescript": "*" }, "dependencies": { - "@standardnotes/common": "^1.45.0", + "@standardnotes/common": "^1.46.4", "@standardnotes/encryption": "workspace:*", "@standardnotes/models": "workspace:*", "@standardnotes/responses": "workspace:*", diff --git a/packages/files/src/Domain/Cache/FileMemoryCache.ts b/packages/files/src/Domain/Cache/FileMemoryCache.ts index c809992e2..153f689b7 100644 --- a/packages/files/src/Domain/Cache/FileMemoryCache.ts +++ b/packages/files/src/Domain/Cache/FileMemoryCache.ts @@ -1,15 +1,14 @@ import { removeFromArray } from '@standardnotes/utils' -import { Uuid } from '@standardnotes/common' import { EncryptedBytes } from '../Types/EncryptedBytes' export class FileMemoryCache { - private cache: Record = {} - private orderedQueue: Uuid[] = [] + private cache: Record = {} + private orderedQueue: string[] = [] constructor(public readonly maxSize: number) {} - add(uuid: Uuid, data: EncryptedBytes): boolean { + add(uuid: string, data: EncryptedBytes): boolean { if (data.encryptedBytes.length > this.maxSize) { return false } @@ -31,11 +30,11 @@ export class FileMemoryCache { .reduce((total, fileLength) => total + fileLength, 0) } - get(uuid: Uuid): EncryptedBytes | undefined { + get(uuid: string): EncryptedBytes | undefined { return this.cache[uuid] } - remove(uuid: Uuid): void { + remove(uuid: string): void { delete this.cache[uuid] removeFromArray(this.orderedQueue, uuid) diff --git a/packages/files/src/Domain/Device/FileBackupsDevice.ts b/packages/files/src/Domain/Device/FileBackupsDevice.ts index b192d60cc..d0a9bb208 100644 --- a/packages/files/src/Domain/Device/FileBackupsDevice.ts +++ b/packages/files/src/Domain/Device/FileBackupsDevice.ts @@ -1,4 +1,3 @@ -import { Uuid } from '@standardnotes/common' import { FileDownloadProgress } from '../Types/FileDownloadProgress' import { FileBackupRecord, FileBackupsMapping } from './FileBackupsMapping' @@ -8,7 +7,7 @@ export type FileBackupReadChunkResponse = { chunk: Uint8Array; isLast: boolean; export interface FileBackupsDevice { getFilesBackupsMappingFile(): Promise saveFilesBackupsFile( - uuid: Uuid, + uuid: string, metaFile: string, downloadRequest: { chunkSizes: number[] diff --git a/packages/files/src/Domain/Device/FileBackupsMapping.ts b/packages/files/src/Domain/Device/FileBackupsMapping.ts index 4af25e323..a2b7ff1ec 100644 --- a/packages/files/src/Domain/Device/FileBackupsMapping.ts +++ b/packages/files/src/Domain/Device/FileBackupsMapping.ts @@ -1,4 +1,3 @@ -import { Uuid } from '@standardnotes/common' import { FileBackupsConstantsV1 } from './FileBackupsConstantsV1' export type FileBackupRecord = { @@ -12,5 +11,5 @@ export type FileBackupRecord = { export interface FileBackupsMapping { version: typeof FileBackupsConstantsV1.Version - files: Record + files: Record } diff --git a/packages/mobile/CHANGELOG.md b/packages/mobile/CHANGELOG.md index 29e31c038..2973f5318 100644 --- a/packages/mobile/CHANGELOG.md +++ b/packages/mobile/CHANGELOG.md @@ -3,6 +3,34 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.50.36](https://github.com/standardnotes/app/compare/@standardnotes/mobile@3.50.35...@standardnotes/mobile@3.50.36) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/mobile + +## [3.50.35](https://github.com/standardnotes/app/compare/@standardnotes/mobile@3.50.34...@standardnotes/mobile@3.50.35) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/mobile + +## [3.50.34](https://github.com/standardnotes/app/compare/@standardnotes/mobile@3.50.33...@standardnotes/mobile@3.50.34) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/mobile + +## [3.50.33](https://github.com/standardnotes/app/compare/@standardnotes/mobile@3.50.32...@standardnotes/mobile@3.50.33) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/mobile + +## [3.50.32](https://github.com/standardnotes/app/compare/@standardnotes/mobile@3.50.31...@standardnotes/mobile@3.50.32) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/mobile + +## [3.50.31](https://github.com/standardnotes/app/compare/@standardnotes/mobile@3.50.30...@standardnotes/mobile@3.50.31) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/mobile + +## [3.50.30](https://github.com/standardnotes/app/compare/@standardnotes/mobile@3.50.29...@standardnotes/mobile@3.50.30) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/mobile + ## [3.50.29](https://github.com/standardnotes/app/compare/@standardnotes/mobile@3.50.28...@standardnotes/mobile@3.50.29) (2023-01-18) **Note:** Version bump only for package @standardnotes/mobile diff --git a/packages/mobile/package.json b/packages/mobile/package.json index ae87e2dde..1ea92e868 100644 --- a/packages/mobile/package.json +++ b/packages/mobile/package.json @@ -1,6 +1,6 @@ { "name": "@standardnotes/mobile", - "version": "3.50.29", + "version": "3.50.36", "author": "Standard Notes.", "private": true, "license": "AGPL-3.0-or-later", diff --git a/packages/models/CHANGELOG.md b/packages/models/CHANGELOG.md index b57a896a7..20a2efeae 100644 --- a/packages/models/CHANGELOG.md +++ b/packages/models/CHANGELOG.md @@ -3,6 +3,35 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.42.8](https://github.com/standardnotes/app/compare/@standardnotes/models@1.42.7...@standardnotes/models@1.42.8) (2023-01-20) + +### Bug Fixes + +* fixed issue with third party editors not loading ([#2174](https://github.com/standardnotes/app/issues/2174)) ([e7214ea](https://github.com/standardnotes/app/commit/e7214ea73ad5d3026d958c79022d2238a4d1cfdc)) + +## [1.42.7](https://github.com/standardnotes/app/compare/@standardnotes/models@1.42.6...@standardnotes/models@1.42.7) (2023-01-20) + +### Bug Fixes + +* **models:** dependency declaration ([beccfb1](https://github.com/standardnotes/app/commit/beccfb16b361ba70bd4f7c09d5840d73ed6e85da)) +* **models:** dependency on utils declaration ([e9a1012](https://github.com/standardnotes/app/commit/e9a10123fed9e2883e3d2af38939b1608d7b2ffa)) + +## [1.42.6](https://github.com/standardnotes/app/compare/@standardnotes/models@1.42.5...@standardnotes/models@1.42.6) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/models + +## [1.42.5](https://github.com/standardnotes/app/compare/@standardnotes/models@1.42.4...@standardnotes/models@1.42.5) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/models + +## [1.42.4](https://github.com/standardnotes/app/compare/@standardnotes/models@1.42.3...@standardnotes/models@1.42.4) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/models + +## [1.42.3](https://github.com/standardnotes/app/compare/@standardnotes/models@1.42.2...@standardnotes/models@1.42.3) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/models + ## [1.42.2](https://github.com/standardnotes/app/compare/@standardnotes/models@1.42.1...@standardnotes/models@1.42.2) (2023-01-18) **Note:** Version bump only for package @standardnotes/models diff --git a/packages/models/package.json b/packages/models/package.json index 2049fef86..10c96433e 100644 --- a/packages/models/package.json +++ b/packages/models/package.json @@ -1,6 +1,6 @@ { "name": "@standardnotes/models", - "version": "1.42.2", + "version": "1.42.8", "engines": { "node": ">=16.0.0 <17.0.0" }, @@ -21,11 +21,13 @@ "lint": "eslint src --ext .ts", "test": "jest" }, + "dependencies": { + "@standardnotes/utils": "workspace:^" + }, "devDependencies": { - "@standardnotes/common": "^1.45.0", + "@standardnotes/common": "^1.46.4", "@standardnotes/features": "workspace:*", "@standardnotes/responses": "workspace:*", - "@standardnotes/utils": "workspace:*", "@types/jest": "^29.2.3", "@types/lodash": "^4.14.189", "@typescript-eslint/eslint-plugin": "*", diff --git a/packages/models/src/Domain/Abstract/Component/MessageData.ts b/packages/models/src/Domain/Abstract/Component/MessageData.ts index e18ef5782..02a970c51 100644 --- a/packages/models/src/Domain/Abstract/Component/MessageData.ts +++ b/packages/models/src/Domain/Abstract/Component/MessageData.ts @@ -1,4 +1,4 @@ -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { ComponentPermission } from '@standardnotes/features' import { IncomingComponentItemPayload } from './IncomingComponentItemPayload' @@ -14,7 +14,7 @@ export type MessageData = Partial<{ permissions?: ComponentPermission[] /** Related to the component-registered action */ componentData?: Record - uuid?: Uuid + uuid?: string environment?: string platform?: string activeThemeUrls?: string[] diff --git a/packages/models/src/Domain/Abstract/Content/ItemContent.ts b/packages/models/src/Domain/Abstract/Content/ItemContent.ts index 06a45bda7..ffb07bacb 100644 --- a/packages/models/src/Domain/Abstract/Content/ItemContent.ts +++ b/packages/models/src/Domain/Abstract/Content/ItemContent.ts @@ -1,4 +1,3 @@ -import { Uuid } from '@standardnotes/common' import { AppData, DefaultAppDomain } from '../Item/Types/DefaultAppDomain' import { ContentReference } from '../Reference/ContentReference' import { AppDataField } from '../Item/Types/AppDataField' @@ -8,7 +7,7 @@ export interface SpecializedContent {} export interface ItemContent { references: ContentReference[] - conflict_of?: Uuid + conflict_of?: string protected?: boolean trashed?: boolean pinned?: boolean diff --git a/packages/models/src/Domain/Abstract/Contextual/BackupFileDecryptedContextualPayload.ts b/packages/models/src/Domain/Abstract/Contextual/BackupFileDecryptedContextualPayload.ts index 9de4eadde..b3dd4d587 100644 --- a/packages/models/src/Domain/Abstract/Contextual/BackupFileDecryptedContextualPayload.ts +++ b/packages/models/src/Domain/Abstract/Contextual/BackupFileDecryptedContextualPayload.ts @@ -1,4 +1,3 @@ -import { Uuid } from '@standardnotes/common' import { ItemContent } from '../Content/ItemContent' import { ContextPayload } from './ContextPayload' @@ -6,7 +5,7 @@ export interface BackupFileDecryptedContextualPayload extends GenericItem> implements DecryptedItemInterface { - public readonly conflictOf?: Uuid + public readonly conflictOf?: string public readonly protected: boolean = false public readonly trashed: boolean = false public readonly pinned: boolean = false diff --git a/packages/models/src/Domain/Abstract/Item/Implementations/GenericItem.ts b/packages/models/src/Domain/Abstract/Item/Implementations/GenericItem.ts index 42a1c7b72..327478860 100644 --- a/packages/models/src/Domain/Abstract/Item/Implementations/GenericItem.ts +++ b/packages/models/src/Domain/Abstract/Item/Implementations/GenericItem.ts @@ -1,4 +1,4 @@ -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { dateToLocalizedString, deepFreeze } from '@standardnotes/utils' import { TransferPayload } from './../../TransferPayload/Interfaces/TransferPayload' import { ItemContentsDiffer } from '../../../Utilities/Item/ItemContentsDiffer' @@ -13,7 +13,7 @@ import { isDecryptedItem, isDeletedItem, isEncryptedErroredItem } from '../Inter export abstract class GenericItem

implements ItemInterface

{ payload: P - public readonly duplicateOf?: Uuid + public readonly duplicateOf?: string public readonly createdAtString?: string public updatedAtString?: string public userModifiedDate: Date diff --git a/packages/models/src/Domain/Abstract/Item/Interfaces/DecryptedItem.ts b/packages/models/src/Domain/Abstract/Item/Interfaces/DecryptedItem.ts index 79e13c136..68ed08d10 100644 --- a/packages/models/src/Domain/Abstract/Item/Interfaces/DecryptedItem.ts +++ b/packages/models/src/Domain/Abstract/Item/Interfaces/DecryptedItem.ts @@ -1,4 +1,3 @@ -import { Uuid } from '@standardnotes/common' import { AppDataField } from '../Types/AppDataField' import { ComponentDataDomain, DefaultAppDomain } from '../Types/DefaultAppDomain' import { ContentReference } from '../../Reference/ContentReference' @@ -15,8 +14,8 @@ export interface DecryptedItemInterface SortableItem, SearchableItem { readonly content: C - readonly conflictOf?: Uuid - readonly duplicateOf?: Uuid + readonly conflictOf?: string + readonly duplicateOf?: string readonly protected: boolean readonly trashed: boolean readonly pinned: boolean diff --git a/packages/models/src/Domain/Abstract/Item/Interfaces/ItemInterface.ts b/packages/models/src/Domain/Abstract/Item/Interfaces/ItemInterface.ts index d6087b83c..393cf7ac5 100644 --- a/packages/models/src/Domain/Abstract/Item/Interfaces/ItemInterface.ts +++ b/packages/models/src/Domain/Abstract/Item/Interfaces/ItemInterface.ts @@ -1,4 +1,4 @@ -import { Uuid, ContentType } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { TransferPayload } from './../../TransferPayload/Interfaces/TransferPayload' import { PayloadInterface } from '../../Payload/Interfaces/PayloadInterface' import { PredicateInterface } from '../../../Runtime/Predicate/Interface' @@ -8,12 +8,12 @@ import { SingletonStrategy } from '../Types/SingletonStrategy' export interface ItemInterface

{ payload: P - readonly conflictOf?: Uuid - readonly duplicateOf?: Uuid + readonly conflictOf?: string + readonly duplicateOf?: string readonly createdAtString?: string readonly updatedAtString?: string - uuid: Uuid + uuid: string content_type: ContentType created_at: Date diff --git a/packages/models/src/Domain/Abstract/Item/Mutator/DecryptedItemMutator.ts b/packages/models/src/Domain/Abstract/Item/Mutator/DecryptedItemMutator.ts index ce136a686..deb44e969 100644 --- a/packages/models/src/Domain/Abstract/Item/Mutator/DecryptedItemMutator.ts +++ b/packages/models/src/Domain/Abstract/Item/Mutator/DecryptedItemMutator.ts @@ -2,7 +2,6 @@ import { DecryptedItemInterface } from './../Interfaces/DecryptedItem' import { Copy } from '@standardnotes/utils' import { MutationType } from '../Types/MutationType' import { PrefKey } from '../../../Syncable/UserPrefs/PrefKey' -import { Uuid } from '@standardnotes/common' import { ItemContent } from '../../Content/ItemContent' import { AppDataField } from '../Types/AppDataField' import { DefaultAppDomain, DomainDataValueType, ItemDomainKey } from '../Types/DefaultAppDomain' @@ -66,7 +65,7 @@ export class DecryptedItemMutator extends I this.setAppDataItem(AppDataField.UserModifiedDate, date) } - public set conflictOf(conflictOf: Uuid | undefined) { + public set conflictOf(conflictOf: string | undefined) { this.mutableContent.conflict_of = conflictOf } diff --git a/packages/models/src/Domain/Abstract/Item/Mutator/TransactionalMutation.ts b/packages/models/src/Domain/Abstract/Item/Mutator/TransactionalMutation.ts index c484fb0bd..c6c649dc8 100644 --- a/packages/models/src/Domain/Abstract/Item/Mutator/TransactionalMutation.ts +++ b/packages/models/src/Domain/Abstract/Item/Mutator/TransactionalMutation.ts @@ -1,11 +1,9 @@ -import { Uuid } from '@standardnotes/common' - import { MutationType } from '../Types/MutationType' import { ItemMutator } from './ItemMutator' export type TransactionalMutation = { - itemUuid: Uuid + itemUuid: string mutate: (mutator: ItemMutator) => void mutationType?: MutationType } diff --git a/packages/models/src/Domain/Abstract/Payload/Implementations/DecryptedPayload.ts b/packages/models/src/Domain/Abstract/Payload/Implementations/DecryptedPayload.ts index da52b7e96..b74acee89 100644 --- a/packages/models/src/Domain/Abstract/Payload/Implementations/DecryptedPayload.ts +++ b/packages/models/src/Domain/Abstract/Payload/Implementations/DecryptedPayload.ts @@ -1,4 +1,3 @@ -import { Uuid } from '@standardnotes/common' import { Copy } from '@standardnotes/utils' import { SyncResolvedParams, SyncResolvedPayload } from '../../../Runtime/Deltas/Utilities/SyncResolvedPayload' import { FillItemContent, ItemContent } from '../../Content/ItemContent' @@ -29,7 +28,7 @@ export class DecryptedPayload< return this.content.references || [] } - public getReference(uuid: Uuid): ContentReference { + public getReference(uuid: string): ContentReference { const result = this.references.find((ref) => ref.uuid === uuid) if (!result) { diff --git a/packages/models/src/Domain/Abstract/Payload/Interfaces/DecryptedPayload.ts b/packages/models/src/Domain/Abstract/Payload/Interfaces/DecryptedPayload.ts index 28bde92c7..0ce47b371 100644 --- a/packages/models/src/Domain/Abstract/Payload/Interfaces/DecryptedPayload.ts +++ b/packages/models/src/Domain/Abstract/Payload/Interfaces/DecryptedPayload.ts @@ -1,4 +1,3 @@ -import { Uuid } from '@standardnotes/common' import { DecryptedTransferPayload } from './../../TransferPayload/Interfaces/DecryptedTransferPayload' import { ItemContent } from '../../Content/ItemContent' import { ContentReference } from '../../Reference/ContentReference' @@ -11,5 +10,5 @@ export interface DecryptedPayloadInterface ejected(): DecryptedTransferPayload get references(): ContentReference[] - getReference(uuid: Uuid): ContentReference + getReference(uuid: string): ContentReference } diff --git a/packages/models/src/Domain/Abstract/Payload/Interfaces/PayloadInterface.ts b/packages/models/src/Domain/Abstract/Payload/Interfaces/PayloadInterface.ts index 73bf6a4d0..42d65a0be 100644 --- a/packages/models/src/Domain/Abstract/Payload/Interfaces/PayloadInterface.ts +++ b/packages/models/src/Domain/Abstract/Payload/Interfaces/PayloadInterface.ts @@ -1,12 +1,12 @@ import { SyncResolvedParams, SyncResolvedPayload } from './../../../Runtime/Deltas/Utilities/SyncResolvedPayload' -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { ItemContent } from '../../Content/ItemContent' import { TransferPayload } from '../../TransferPayload/Interfaces/TransferPayload' import { PayloadSource } from '../Types/PayloadSource' export interface PayloadInterface { readonly source: PayloadSource - readonly uuid: Uuid + readonly uuid: string readonly content_type: ContentType content: C | string | undefined deleted: boolean @@ -26,7 +26,7 @@ export interface PayloadInterface { - uuid: Uuid + uuid: string content_type: ContentType content: C | string | undefined deleted?: boolean @@ -19,5 +19,5 @@ export interface TransferPayload { lastSyncBegan?: Date lastSyncEnd?: Date - duplicate_of?: Uuid + duplicate_of?: string } diff --git a/packages/models/src/Domain/Runtime/Collection/Collection.ts b/packages/models/src/Domain/Runtime/Collection/Collection.ts index 5ab28a1a5..7b1afd1da 100644 --- a/packages/models/src/Domain/Runtime/Collection/Collection.ts +++ b/packages/models/src/Domain/Runtime/Collection/Collection.ts @@ -1,11 +1,11 @@ import { extendArray, isObject, isString, UuidMap } from '@standardnotes/utils' -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { remove } from 'lodash' import { ItemContent } from '../../Abstract/Content/ItemContent' import { ContentReference } from '../../Abstract/Item' export interface CollectionElement { - uuid: Uuid + uuid: string content_type: ContentType dirty?: boolean deleted?: boolean @@ -32,17 +32,17 @@ export abstract class Collection< Encrypted extends EncryptedCollectionElement, Deleted extends DeletedCollectionElement, > { - readonly map: Partial> = {} + readonly map: Partial> = {} readonly typedMap: Partial> = {} /** An array of uuids of items that are dirty */ - dirtyIndex: Set = new Set() + dirtyIndex: Set = new Set() /** An array of uuids of items that are not marked as deleted */ - nondeletedIndex: Set = new Set() + nondeletedIndex: Set = new Set() /** An array of uuids of items that are errorDecrypting or waitingForKey */ - invalidsIndex: Set = new Set() + invalidsIndex: Set = new Set() readonly referenceMap: UuidMap @@ -73,7 +73,7 @@ export abstract class Collection< constructor( copy = false, - mapCopy?: Partial>, + mapCopy?: Partial>, typedMapCopy?: Partial>, referenceMapCopy?: UuidMap, conflictMapCopy?: UuidMap, @@ -89,7 +89,7 @@ export abstract class Collection< } } - public uuids(): Uuid[] { + public uuids(): string[] { return Object.keys(this.map) } @@ -105,7 +105,7 @@ export abstract class Collection< return this.typedMap[contentType]?.slice() || [] } } else { - return Object.keys(this.map).map((uuid: Uuid) => { + return Object.keys(this.map).map((uuid: string) => { return this.map[uuid] }) as Element[] } @@ -129,7 +129,7 @@ export abstract class Collection< return this.findAll(uuids) } - public findAll(uuids: Uuid[]): Element[] { + public findAll(uuids: string[]): Element[] { const results: Element[] = [] for (const id of uuids) { @@ -142,11 +142,11 @@ export abstract class Collection< return results } - public find(uuid: Uuid): Element | undefined { + public find(uuid: string): Element | undefined { return this.map[uuid] } - public has(uuid: Uuid): boolean { + public has(uuid: string): boolean { return this.find(uuid) != undefined } @@ -154,7 +154,7 @@ export abstract class Collection< * If an item is not found, an `undefined` element * will be inserted into the array. */ - public findAllIncludingBlanks(uuids: Uuid[]): (E | Deleted | undefined)[] { + public findAllIncludingBlanks(uuids: string[]): (E | Deleted | undefined)[] { const results: (E | Deleted | undefined)[] = [] for (const id of uuids) { @@ -219,11 +219,11 @@ export abstract class Collection< } } - public uuidReferencesForUuid(uuid: Uuid): Uuid[] { + public uuidReferencesForUuid(uuid: string): string[] { return this.referenceMap.getDirectRelationships(uuid) } - public uuidsThatReferenceUuid(uuid: Uuid): Uuid[] { + public uuidsThatReferenceUuid(uuid: string): string[] { return this.referenceMap.getInverseRelationships(uuid) } @@ -232,7 +232,7 @@ export abstract class Collection< return this.findAll(uuids) } - public conflictsOf(uuid: Uuid): Element[] { + public conflictsOf(uuid: string): Element[] { const uuids = this.conflictMap.getDirectRelationships(uuid) return this.findAll(uuids) } diff --git a/packages/models/src/Domain/Runtime/Collection/CollectionSort.ts b/packages/models/src/Domain/Runtime/Collection/CollectionSort.ts index 517475e01..d409f40b6 100644 --- a/packages/models/src/Domain/Runtime/Collection/CollectionSort.ts +++ b/packages/models/src/Domain/Runtime/Collection/CollectionSort.ts @@ -1,7 +1,7 @@ -import { Uuid, ContentType } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' export interface SortableItem { - uuid: Uuid + uuid: string content_type: ContentType created_at: Date userModifiedDate: Date diff --git a/packages/models/src/Domain/Runtime/Collection/Item/ItemCollection.ts b/packages/models/src/Domain/Runtime/Collection/Item/ItemCollection.ts index 8a553d3d4..ee5868afc 100644 --- a/packages/models/src/Domain/Runtime/Collection/Item/ItemCollection.ts +++ b/packages/models/src/Domain/Runtime/Collection/Item/ItemCollection.ts @@ -1,6 +1,6 @@ import { ItemContent } from './../../../Abstract/Content/ItemContent' import { EncryptedItemInterface } from './../../../Abstract/Item/Interfaces/EncryptedItem' -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { SNIndex } from '../../Index/SNIndex' import { isDecryptedItem } from '../../../Abstract/Item/Interfaces/TypeCheck' import { DecryptedItemInterface } from '../../../Abstract/Item/Interfaces/DecryptedItem' @@ -24,7 +24,7 @@ export class ItemCollection this.discard(delta.discarded) } - public findDecrypted(uuid: Uuid): T | undefined { + public findDecrypted(uuid: string): T | undefined { const result = this.find(uuid) if (!result) { @@ -34,12 +34,12 @@ export class ItemCollection return isDecryptedItem(result) ? (result as T) : undefined } - public findAllDecrypted(uuids: Uuid[]): T[] { + public findAllDecrypted(uuids: string[]): T[] { return this.findAll(uuids).filter(isDecryptedItem) as T[] } public findAllDecryptedWithBlanks( - uuids: Uuid[], + uuids: string[], ): (DecryptedItemInterface | undefined)[] { const results = this.findAllIncludingBlanks(uuids) const mapped = results.map((i) => { diff --git a/packages/models/src/Domain/Runtime/Collection/Item/TagItemsIndex.ts b/packages/models/src/Domain/Runtime/Collection/Item/TagItemsIndex.ts index 81bbabe9c..2662b493b 100644 --- a/packages/models/src/Domain/Runtime/Collection/Item/TagItemsIndex.ts +++ b/packages/models/src/Domain/Runtime/Collection/Item/TagItemsIndex.ts @@ -1,5 +1,5 @@ import { removeFromArray } from '@standardnotes/utils' -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { isTag, SNTag } from '../../../Syncable/Tag/Tag' import { SNIndex } from '../../Index/SNIndex' import { ItemCollection } from './ItemCollection' @@ -7,12 +7,12 @@ import { ItemDelta } from '../../Index/ItemDelta' import { isDecryptedItem, ItemInterface } from '../../../Abstract/Item' type AllNotesUuidSignifier = undefined -export type TagItemCountChangeObserver = (tagUuid: Uuid | AllNotesUuidSignifier) => void +export type TagItemCountChangeObserver = (tagUuid: string | AllNotesUuidSignifier) => void export class TagItemsIndex implements SNIndex { - private tagToItemsMap: Partial>> = {} - private allCountableItems = new Set() - private countableItemsByType = new Map>() + private tagToItemsMap: Partial>> = {} + private allCountableItems = new Set() + private countableItemsByType = new Map>() constructor(private collection: ItemCollection, public observers: TagItemCountChangeObserver[] = []) {} @@ -32,7 +32,7 @@ export class TagItemsIndex implements SNIndex { } } - private notifyObservers(tagUuid: Uuid | undefined) { + private notifyObservers(tagUuid: string | undefined) { for (const observer of this.observers) { observer(tagUuid) } @@ -119,7 +119,7 @@ export class TagItemsIndex implements SNIndex { } } - private setForTag(uuid: Uuid): Set { + private setForTag(uuid: string): Set { let set = this.tagToItemsMap[uuid] if (!set) { set = new Set() diff --git a/packages/models/src/Domain/Runtime/Deltas/RemoteRetrieved.ts b/packages/models/src/Domain/Runtime/Deltas/RemoteRetrieved.ts index 571098a9c..273b15cfc 100644 --- a/packages/models/src/Domain/Runtime/Deltas/RemoteRetrieved.ts +++ b/packages/models/src/Domain/Runtime/Deltas/RemoteRetrieved.ts @@ -2,7 +2,7 @@ import { ImmutablePayloadCollection } from './../Collection/Payload/ImmutablePay import { ConflictDelta } from './Conflict' import { isErrorDecryptingPayload, isDecryptedPayload } from '../../Abstract/Payload/Interfaces/TypeCheck' import { FullyFormedPayloadInterface, PayloadEmitSource } from '../../Abstract/Payload' -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { HistoryMap } from '../History' import { ServerSyncPushContextualPayload } from '../../Abstract/Contextual/ServerSyncPush' import { payloadByFinalizingSyncState } from './Utilities/ApplyDirtyState' @@ -18,7 +18,7 @@ export class DeltaRemoteRetrieved implements SyncDeltaInterface { readonly historyMap: HistoryMap, ) {} - private isUuidOfPayloadCurrentlySavingOrSaved(uuid: Uuid): boolean { + private isUuidOfPayloadCurrentlySavingOrSaved(uuid: string): boolean { return this.itemsSavedOrSaving.find((i) => i.uuid === uuid) != undefined } diff --git a/packages/models/src/Domain/Runtime/Display/Types.ts b/packages/models/src/Domain/Runtime/Display/Types.ts index feb607fc7..9727c4561 100644 --- a/packages/models/src/Domain/Runtime/Display/Types.ts +++ b/packages/models/src/Domain/Runtime/Display/Types.ts @@ -1,10 +1,9 @@ -import { Uuid } from '@standardnotes/common' import { DecryptedItemInterface } from '../../Abstract/Item' import { SortableItem } from '../Collection/CollectionSort' import { ItemCollection } from '../Collection/Item/ItemCollection' export type DisplayControllerCustomFilter = (element: DisplayItem) => boolean -export type UuidToSortedPositionMap = Record +export type UuidToSortedPositionMap = Record export type DisplayItem = SortableItem & DecryptedItemInterface export interface ReadonlyItemCollection { diff --git a/packages/models/src/Domain/Runtime/History/HistoryMap.ts b/packages/models/src/Domain/Runtime/History/HistoryMap.ts index 826415f80..dcfc808d1 100644 --- a/packages/models/src/Domain/Runtime/History/HistoryMap.ts +++ b/packages/models/src/Domain/Runtime/History/HistoryMap.ts @@ -1,7 +1,6 @@ -import { Uuid } from '@standardnotes/common' import { HistoryEntry } from './HistoryEntry' -export type HistoryMap = Record +export type HistoryMap = Record export const historyMapFunctions = { getNewestRevision: (history: HistoryEntry[]): HistoryEntry | undefined => { diff --git a/packages/models/src/Domain/Syncable/Component/Component.spec.ts b/packages/models/src/Domain/Syncable/Component/Component.spec.ts index 839aacd2c..a91d47d40 100644 --- a/packages/models/src/Domain/Syncable/Component/Component.spec.ts +++ b/packages/models/src/Domain/Syncable/Component/Component.spec.ts @@ -68,7 +68,7 @@ describe('component model', () => { expect(component.noteType).toEqual(NoteType.Authentication) }) - it('should return plain as noteType if no note type defined in package_info', () => { + it('should return unknown as noteType if no note type defined in package_info', () => { const component = new SNComponent( new DecryptedPayload( { @@ -83,6 +83,6 @@ describe('component model', () => { ), ) - expect(component.noteType).toEqual(NoteType.Plain) + expect(component.noteType).toEqual(NoteType.Unknown) }) }) diff --git a/packages/models/src/Domain/Syncable/Component/Component.ts b/packages/models/src/Domain/Syncable/Component/Component.ts index 7383e2c55..1b13d37dc 100644 --- a/packages/models/src/Domain/Syncable/Component/Component.ts +++ b/packages/models/src/Domain/Syncable/Component/Component.ts @@ -1,5 +1,5 @@ import { isValidUrl } from '@standardnotes/utils' -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { FeatureIdentifier, ThirdPartyFeatureDescription, @@ -159,11 +159,11 @@ export class SNComponent extends DecryptedItem implements Comp return SNComponent.associativeAreas().includes(this.area) } - public isExplicitlyEnabledForItem(uuid: Uuid): boolean { + public isExplicitlyEnabledForItem(uuid: string): boolean { return this.associatedItemIds.indexOf(uuid) !== -1 } - public isExplicitlyDisabledForItem(uuid: Uuid): boolean { + public isExplicitlyDisabledForItem(uuid: string): boolean { return this.disassociatedItemIds.indexOf(uuid) !== -1 } @@ -180,7 +180,7 @@ export class SNComponent extends DecryptedItem implements Comp } public get noteType(): NoteType { - return this.package_info.note_type || NoteType.Plain + return this.package_info.note_type || NoteType.Unknown } public get isDeprecated(): boolean { diff --git a/packages/models/src/Domain/Syncable/Component/ComponentContent.ts b/packages/models/src/Domain/Syncable/Component/ComponentContent.ts index 9e6787e42..5d7ee4bba 100644 --- a/packages/models/src/Domain/Syncable/Component/ComponentContent.ts +++ b/packages/models/src/Domain/Syncable/Component/ComponentContent.ts @@ -1,5 +1,4 @@ import { ComponentArea, ComponentPermission } from '@standardnotes/features' -import { Uuid } from '@standardnotes/common' import { ItemContent } from '../../Abstract/Content/ItemContent' import { ComponentPackageInfo } from './PackageInfo' @@ -30,7 +29,7 @@ export interface ComponentInterface { legacy_url?: string isMobileDefault: boolean isDeprecated: boolean - isExplicitlyEnabledForItem(uuid: Uuid): boolean + isExplicitlyEnabledForItem(uuid: string): boolean } export type ComponentContent = ComponentInterface & ItemContent diff --git a/packages/models/src/Domain/Syncable/Component/ComponentMutator.ts b/packages/models/src/Domain/Syncable/Component/ComponentMutator.ts index 2a0e6f050..f4a5a34b6 100644 --- a/packages/models/src/Domain/Syncable/Component/ComponentMutator.ts +++ b/packages/models/src/Domain/Syncable/Component/ComponentMutator.ts @@ -1,5 +1,4 @@ import { addIfUnique, removeFromArray } from '@standardnotes/utils' -import { Uuid } from '@standardnotes/common' import { ComponentPermission, FeatureDescription } from '@standardnotes/features' import { AppDataField } from '../../Abstract/Item/Types/AppDataField' import { ComponentContent } from './ComponentContent' @@ -46,23 +45,23 @@ export class ComponentMutator extends DecryptedItemMutator { this.mutableContent.offlineOnly = offlineOnly } - public associateWithItem(uuid: Uuid): void { + public associateWithItem(uuid: string): void { const associated = this.mutableContent.associatedItemIds || [] addIfUnique(associated, uuid) this.mutableContent.associatedItemIds = associated } - public disassociateWithItem(uuid: Uuid): void { + public disassociateWithItem(uuid: string): void { const disassociated = this.mutableContent.disassociatedItemIds || [] addIfUnique(disassociated, uuid) this.mutableContent.disassociatedItemIds = disassociated } - public removeAssociatedItemId(uuid: Uuid): void { + public removeAssociatedItemId(uuid: string): void { removeFromArray(this.mutableContent.associatedItemIds || [], uuid) } - public removeDisassociatedItemId(uuid: Uuid): void { + public removeDisassociatedItemId(uuid: string): void { removeFromArray(this.mutableContent.disassociatedItemIds || [], uuid) } diff --git a/packages/models/src/Domain/Syncable/Tag/Tag.ts b/packages/models/src/Domain/Syncable/Tag/Tag.ts index 4c6c693a3..380280cbc 100644 --- a/packages/models/src/Domain/Syncable/Tag/Tag.ts +++ b/packages/models/src/Domain/Syncable/Tag/Tag.ts @@ -1,5 +1,5 @@ import { VectorIconNameOrEmoji, IconType } from './../../Utilities/Icon/IconType' -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { DecryptedItem } from '../../Abstract/Item/Implementations/DecryptedItem' import { ItemInterface } from '../../Abstract/Item/Interfaces/ItemInterface' import { ContentReference } from '../../Abstract/Reference/ContentReference' @@ -41,7 +41,7 @@ export class SNTag extends DecryptedItem implements TagContentSpecia return this.noteReferences.length } - public get parentId(): Uuid | undefined { + public get parentId(): string | undefined { const reference = this.references.find(isTagToParentTagReference) return reference?.uuid } diff --git a/packages/models/src/Domain/Utilities/Item/FindItem.ts b/packages/models/src/Domain/Utilities/Item/FindItem.ts index 13092e2ca..6364eb768 100644 --- a/packages/models/src/Domain/Utilities/Item/FindItem.ts +++ b/packages/models/src/Domain/Utilities/Item/FindItem.ts @@ -1,10 +1,9 @@ -import { Uuid } from '@standardnotes/common' import { ItemInterface } from '../../Abstract/Item/Interfaces/ItemInterface' -export function FindItem(items: I[], uuid: Uuid): I | undefined { +export function FindItem(items: I[], uuid: string): I | undefined { return items.find((item) => item.uuid === uuid) } -export function SureFindItem(items: I[], uuid: Uuid): I { +export function SureFindItem(items: I[], uuid: string): I { return FindItem(items, uuid) as I } diff --git a/packages/models/src/Domain/Utilities/Payload/FindPayload.ts b/packages/models/src/Domain/Utilities/Payload/FindPayload.ts index edce5103f..025180138 100644 --- a/packages/models/src/Domain/Utilities/Payload/FindPayload.ts +++ b/packages/models/src/Domain/Utilities/Payload/FindPayload.ts @@ -1,10 +1,9 @@ -import { Uuid } from '@standardnotes/common' import { PayloadInterface } from '../../Abstract/Payload/Interfaces/PayloadInterface' -export function FindPayload

(payloads: P[], uuid: Uuid): P | undefined { +export function FindPayload

(payloads: P[], uuid: string): P | undefined { return payloads.find((payload) => payload.uuid === uuid) } -export function SureFindPayload

(payloads: P[], uuid: Uuid): P { +export function SureFindPayload

(payloads: P[], uuid: string): P { return FindPayload(payloads, uuid) as P } diff --git a/packages/models/src/Domain/Utilities/Payload/PayloadsByUpdatingReferencingPayloadReferences.ts b/packages/models/src/Domain/Utilities/Payload/PayloadsByUpdatingReferencingPayloadReferences.ts index 0c06d83d7..ca45fc34c 100644 --- a/packages/models/src/Domain/Utilities/Payload/PayloadsByUpdatingReferencingPayloadReferences.ts +++ b/packages/models/src/Domain/Utilities/Payload/PayloadsByUpdatingReferencingPayloadReferences.ts @@ -1,4 +1,3 @@ -import { Uuid } from '@standardnotes/common' import { remove } from 'lodash' import { ImmutablePayloadCollection } from '../../Runtime/Collection/Payload/ImmutablePayloadCollection' import { ContentReference } from '../../Abstract/Reference/ContentReference' @@ -12,7 +11,7 @@ export function PayloadsByUpdatingReferencingPayloadReferences( payload: DecryptedPayloadInterface, baseCollection: ImmutablePayloadCollection, add: FullyFormedPayloadInterface[] = [], - removeIds: Uuid[] = [], + removeIds: string[] = [], ): SyncResolvedPayload[] { const referencingPayloads = baseCollection.elementsReferencingElement(payload).filter(isDecryptedPayload) diff --git a/packages/releases/CHANGELOG.md b/packages/releases/CHANGELOG.md index f4219d914..bffb1daab 100644 --- a/packages/releases/CHANGELOG.md +++ b/packages/releases/CHANGELOG.md @@ -3,6 +3,34 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.4.123](https://github.com/standardnotes/app/compare/@standardnotes/releases@1.4.122...@standardnotes/releases@1.4.123) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/releases + +## [1.4.122](https://github.com/standardnotes/app/compare/@standardnotes/releases@1.4.121...@standardnotes/releases@1.4.122) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/releases + +## [1.4.121](https://github.com/standardnotes/app/compare/@standardnotes/releases@1.4.120...@standardnotes/releases@1.4.121) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/releases + +## [1.4.120](https://github.com/standardnotes/app/compare/@standardnotes/releases@1.4.119...@standardnotes/releases@1.4.120) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/releases + +## [1.4.119](https://github.com/standardnotes/app/compare/@standardnotes/releases@1.4.118...@standardnotes/releases@1.4.119) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/releases + +## [1.4.118](https://github.com/standardnotes/app/compare/@standardnotes/releases@1.4.117...@standardnotes/releases@1.4.118) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/releases + +## [1.4.117](https://github.com/standardnotes/app/compare/@standardnotes/releases@1.4.116...@standardnotes/releases@1.4.117) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/releases + ## [1.4.116](https://github.com/standardnotes/app/compare/@standardnotes/releases@1.4.115...@standardnotes/releases@1.4.116) (2023-01-18) **Note:** Version bump only for package @standardnotes/releases diff --git a/packages/releases/package.json b/packages/releases/package.json index 46594d011..12cb54e7d 100644 --- a/packages/releases/package.json +++ b/packages/releases/package.json @@ -1,6 +1,6 @@ { "name": "@standardnotes/releases", - "version": "1.4.116", + "version": "1.4.123", "license": "AGPL-3.0-or-later", "main": "dist/releases.json", "types": "dist/index.d.ts", diff --git a/packages/responses/CHANGELOG.md b/packages/responses/CHANGELOG.md index a6efe38a4..fd2a42241 100644 --- a/packages/responses/CHANGELOG.md +++ b/packages/responses/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.13.5](https://github.com/standardnotes/app/compare/@standardnotes/responses@1.13.4...@standardnotes/responses@1.13.5) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/responses + +## [1.13.4](https://github.com/standardnotes/app/compare/@standardnotes/responses@1.13.3...@standardnotes/responses@1.13.4) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/responses + +## [1.13.3](https://github.com/standardnotes/app/compare/@standardnotes/responses@1.13.2...@standardnotes/responses@1.13.3) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/responses + +## [1.13.2](https://github.com/standardnotes/app/compare/@standardnotes/responses@1.13.1...@standardnotes/responses@1.13.2) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/responses + +## [1.13.1](https://github.com/standardnotes/app/compare/@standardnotes/responses@1.13.0...@standardnotes/responses@1.13.1) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/responses + # [1.13.0](https://github.com/standardnotes/app/compare/@standardnotes/responses@1.12.13...@standardnotes/responses@1.13.0) (2023-01-18) ### Features diff --git a/packages/responses/package.json b/packages/responses/package.json index 3c441cbda..f741b250d 100644 --- a/packages/responses/package.json +++ b/packages/responses/package.json @@ -1,6 +1,6 @@ { "name": "@standardnotes/responses", - "version": "1.13.0", + "version": "1.13.5", "engines": { "node": ">=16.0.0 <17.0.0" }, @@ -33,9 +33,9 @@ "typescript": "*" }, "dependencies": { - "@standardnotes/common": "^1.45.0", + "@standardnotes/common": "^1.46.4", "@standardnotes/features": "workspace:*", - "@standardnotes/security": "^1.7.0", + "@standardnotes/security": "^1.7.5", "reflect-metadata": "^0.1.13" } } diff --git a/packages/responses/src/Domain/Http/ResponseMeta.ts b/packages/responses/src/Domain/Http/ResponseMeta.ts index 61edb11f4..e21278419 100644 --- a/packages/responses/src/Domain/Http/ResponseMeta.ts +++ b/packages/responses/src/Domain/Http/ResponseMeta.ts @@ -1,9 +1,8 @@ import { Role } from '@standardnotes/security' -import { Uuid } from '@standardnotes/common' export type ResponseMeta = { auth: { - userUuid?: Uuid + userUuid?: string roles?: Role[] } server: { diff --git a/packages/responses/src/Domain/Item/IntegrityPayload.ts b/packages/responses/src/Domain/Item/IntegrityPayload.ts index c7f173471..f22e0d3eb 100644 --- a/packages/responses/src/Domain/Item/IntegrityPayload.ts +++ b/packages/responses/src/Domain/Item/IntegrityPayload.ts @@ -1,6 +1,6 @@ -import { MicrosecondsTimestamp, Uuid } from '@standardnotes/common' +import { MicrosecondsTimestamp } from '@standardnotes/common' export type IntegrityPayload = { - uuid: Uuid + uuid: string updated_at_timestamp: MicrosecondsTimestamp } diff --git a/packages/responses/src/Domain/Item/ServerItemResponse.ts b/packages/responses/src/Domain/Item/ServerItemResponse.ts index 14ee3b7f1..7d6a27cdc 100644 --- a/packages/responses/src/Domain/Item/ServerItemResponse.ts +++ b/packages/responses/src/Domain/Item/ServerItemResponse.ts @@ -1,4 +1,4 @@ -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' export interface ServerItemResponse { content_type: ContentType @@ -6,7 +6,7 @@ export interface ServerItemResponse { created_at_timestamp: number created_at: Date deleted: boolean - duplicate_of?: Uuid + duplicate_of?: string enc_item_key: string items_key_id?: string updated_at_timestamp: number diff --git a/packages/responses/src/Domain/User/GetOfflineFeaturesResponse.ts b/packages/responses/src/Domain/User/GetOfflineFeaturesResponse.ts index ec5edb54a..4c564ab1f 100644 --- a/packages/responses/src/Domain/User/GetOfflineFeaturesResponse.ts +++ b/packages/responses/src/Domain/User/GetOfflineFeaturesResponse.ts @@ -4,5 +4,6 @@ import { MinimalHttpResponse } from '../Http/MinimalHttpResponses' export type GetOfflineFeaturesResponse = MinimalHttpResponse & { data?: { features: FeatureDescription[] + roles: string[] } } diff --git a/packages/services/CHANGELOG.md b/packages/services/CHANGELOG.md index 196c8feed..f2557eecd 100644 --- a/packages/services/CHANGELOG.md +++ b/packages/services/CHANGELOG.md @@ -3,6 +3,36 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.56.7](https://github.com/standardnotes/app/compare/@standardnotes/services@1.56.6...@standardnotes/services@1.56.7) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/services + +## [1.56.6](https://github.com/standardnotes/app/compare/@standardnotes/services@1.56.5...@standardnotes/services@1.56.6) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/services + +## [1.56.5](https://github.com/standardnotes/app/compare/@standardnotes/services@1.56.4...@standardnotes/services@1.56.5) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/services + +## [1.56.4](https://github.com/standardnotes/app/compare/@standardnotes/services@1.56.3...@standardnotes/services@1.56.4) (2023-01-20) + +### Bug Fixes + +* **snjs:** bring back history tests and fix handlinf of error with revisions ([cb9c160](https://github.com/standardnotes/app/commit/cb9c16047ebea7134c1aadaf89a8023497358a8e)) + +## [1.56.3](https://github.com/standardnotes/app/compare/@standardnotes/services@1.56.2...@standardnotes/services@1.56.3) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/services + +## [1.56.2](https://github.com/standardnotes/app/compare/@standardnotes/services@1.56.1...@standardnotes/services@1.56.2) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/services + +## [1.56.1](https://github.com/standardnotes/app/compare/@standardnotes/services@1.56.0...@standardnotes/services@1.56.1) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/services + # [1.56.0](https://github.com/standardnotes/app/compare/@standardnotes/services@1.55.2...@standardnotes/services@1.56.0) (2023-01-18) ### Bug Fixes diff --git a/packages/services/package.json b/packages/services/package.json index 41c191f17..e951021e9 100644 --- a/packages/services/package.json +++ b/packages/services/package.json @@ -1,6 +1,6 @@ { "name": "@standardnotes/services", - "version": "1.56.0", + "version": "1.56.7", "engines": { "node": ">=16.0.0 <17.0.0" }, @@ -17,14 +17,13 @@ }, "dependencies": { "@standardnotes/api": "workspace:^", - "@standardnotes/auth": "^3.19.4", - "@standardnotes/common": "^1.45.0", - "@standardnotes/domain-core": "^1.11.0", + "@standardnotes/common": "^1.46.4", + "@standardnotes/domain-core": "^1.11.1", "@standardnotes/encryption": "workspace:^", "@standardnotes/files": "workspace:^", "@standardnotes/models": "workspace:^", "@standardnotes/responses": "workspace:*", - "@standardnotes/security": "^1.7.0", + "@standardnotes/security": "^1.7.5", "@standardnotes/sncrypto-common": "workspace:^", "@standardnotes/utils": "workspace:*", "reflect-metadata": "^0.1.13" diff --git a/packages/services/src/Domain/Api/ApiServiceInterface.ts b/packages/services/src/Domain/Api/ApiServiceInterface.ts index 598f61838..33e8d4914 100644 --- a/packages/services/src/Domain/Api/ApiServiceInterface.ts +++ b/packages/services/src/Domain/Api/ApiServiceInterface.ts @@ -1,7 +1,7 @@ -import { Either, Uuid } from '@standardnotes/common' -import { Role } from '@standardnotes/auth' +import { Either } from '@standardnotes/common' import { FilesApiInterface } from '@standardnotes/files' import { Session } from '@standardnotes/domain-core' +import { Role } from '@standardnotes/security' import { AbstractService } from '../Service/AbstractService' @@ -13,7 +13,7 @@ export enum ApiServiceEvent { } export type MetaReceivedData = { - userUuid: Uuid + userUuid: string userRoles: Role[] } diff --git a/packages/services/src/Domain/Backups/BackupService.ts b/packages/services/src/Domain/Backups/BackupService.ts index 16d113eef..2ab240e14 100644 --- a/packages/services/src/Domain/Backups/BackupService.ts +++ b/packages/services/src/Domain/Backups/BackupService.ts @@ -1,4 +1,4 @@ -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { EncryptionProviderInterface } from '@standardnotes/encryption' import { PayloadEmitSource, FileItem, CreateEncryptedBackupFileContextPayload } from '@standardnotes/models' import { ClientDisplayableError } from '@standardnotes/responses' @@ -20,7 +20,7 @@ import { log, LoggingDomain } from '../Logging' export class FilesBackupService extends AbstractService implements BackupServiceInterface { private itemsObserverDisposer: () => void - private pendingFiles = new Set() + private pendingFiles = new Set() private mappingCache?: FileBackupsMapping['files'] constructor( diff --git a/packages/services/src/Domain/Component/ComponentManagerInterface.ts b/packages/services/src/Domain/Component/ComponentManagerInterface.ts index e4332be4f..ad19279a8 100644 --- a/packages/services/src/Domain/Component/ComponentManagerInterface.ts +++ b/packages/services/src/Domain/Component/ComponentManagerInterface.ts @@ -1,4 +1,3 @@ -import { Uuid } from '@standardnotes/common' import { ComponentArea, FeatureIdentifier } from '@standardnotes/features' import { ActionObserver, PermissionDialog, SNComponent, SNNote } from '@standardnotes/models' @@ -15,7 +14,7 @@ export interface ComponentManagerInterface { destroyComponentViewer(viewer: ComponentViewerInterface): void createComponentViewer( component: SNComponent, - contextItem?: Uuid, + contextItem?: string, actionObserver?: ActionObserver, urlOverride?: string, ): ComponentViewerInterface diff --git a/packages/services/src/Domain/Device/DatabaseLoadSorter.ts b/packages/services/src/Domain/Device/DatabaseLoadSorter.ts index 12a05fd63..6aa874680 100644 --- a/packages/services/src/Domain/Device/DatabaseLoadSorter.ts +++ b/packages/services/src/Domain/Device/DatabaseLoadSorter.ts @@ -1,6 +1,6 @@ import { DatabaseItemMetadata } from './DatabaseItemMetadata' import { DatabaseLoadOptions } from './DatabaseLoadOptions' -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' /** * Sorts payloads according by most recently modified first, according to the priority, @@ -47,7 +47,7 @@ function SortPayloadsByRecentAndContentPriority( payloads: T[], - uuidPriorityList: Uuid[], + uuidPriorityList: string[], ): T[] { return payloads.sort((a, b) => { const dateResult = new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime() diff --git a/packages/services/src/Domain/Feature/FeaturesClientInterface.ts b/packages/services/src/Domain/Feature/FeaturesClientInterface.ts index 39ddd8bdc..7d8862852 100644 --- a/packages/services/src/Domain/Feature/FeaturesClientInterface.ts +++ b/packages/services/src/Domain/Feature/FeaturesClientInterface.ts @@ -1,6 +1,5 @@ -import { FeatureDescription, FeatureIdentifier } from '@standardnotes/features' +import { FeatureIdentifier } from '@standardnotes/features' import { SNComponent } from '@standardnotes/models' -import { RoleName } from '@standardnotes/common' import { FeatureStatus } from './FeatureStatus' import { SetOfflineFeaturesFunctionResponse } from './SetOfflineFeaturesFunctionResponse' @@ -8,11 +7,11 @@ import { SetOfflineFeaturesFunctionResponse } from './SetOfflineFeaturesFunction export interface FeaturesClientInterface { downloadExternalFeature(urlOrCode: string): Promise - getUserFeature(featureId: FeatureIdentifier): FeatureDescription | undefined - getFeatureStatus(featureId: FeatureIdentifier): FeatureStatus - hasMinimumRole(role: RoleName): boolean + hasFirstPartySubscription(): boolean + + hasMinimumRole(role: string): boolean setOfflineFeaturesCode(code: string): Promise diff --git a/packages/services/src/Domain/Item/ItemsClientInterface.ts b/packages/services/src/Domain/Item/ItemsClientInterface.ts index 39957b281..27e7d0ce0 100644 --- a/packages/services/src/Domain/Item/ItemsClientInterface.ts +++ b/packages/services/src/Domain/Item/ItemsClientInterface.ts @@ -1,6 +1,6 @@ /* istanbul ignore file */ -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { SNNote, FileItem, @@ -129,14 +129,14 @@ export interface ItemsClientInterface { /** * Finds an item by UUID. */ - findItem(uuid: Uuid): T | undefined + findItem(uuid: string): T | undefined /** * Finds an item by predicate. */ - findItems(uuids: Uuid[]): T[] + findItems(uuids: string[]): T[] - findSureItem(uuid: Uuid): T + findSureItem(uuid: string): T /** * Finds an item by predicate. diff --git a/packages/services/src/Domain/Item/ItemsServerInterface.ts b/packages/services/src/Domain/Item/ItemsServerInterface.ts index 973d69902..80b06cb37 100644 --- a/packages/services/src/Domain/Item/ItemsServerInterface.ts +++ b/packages/services/src/Domain/Item/ItemsServerInterface.ts @@ -1,6 +1,5 @@ -import { Uuid } from '@standardnotes/common' import { GetSingleItemResponse } from '@standardnotes/responses' export interface ItemsServerInterface { - getSingleItem(itemUuid: Uuid): Promise + getSingleItem(itemUuid: string): Promise } diff --git a/packages/services/src/Domain/Revision/RevisionManager.ts b/packages/services/src/Domain/Revision/RevisionManager.ts index dd0705ea7..7d492c871 100644 --- a/packages/services/src/Domain/Revision/RevisionManager.ts +++ b/packages/services/src/Domain/Revision/RevisionManager.ts @@ -16,31 +16,23 @@ export class RevisionManager extends AbstractService implements RevisionClientIn async listRevisions( itemUuid: Uuid, ): Promise<{ uuid: string; content_type: string; created_at: string; updated_at: string; required_role: string }[]> { - try { - const result = await this.revisionApiService.listRevisions(itemUuid.value) + const result = await this.revisionApiService.listRevisions(itemUuid.value) - if (result.data.error) { - return [] - } - - return result.data.revisions - } catch (error) { - return [] + if (result.data.error) { + throw new Error(result.data.error.message) } + + return result.data.revisions } async deleteRevision(itemUuid: Uuid, revisionUuid: Uuid): Promise { - try { - const result = await this.revisionApiService.deleteRevision(itemUuid.value, revisionUuid.value) + const result = await this.revisionApiService.deleteRevision(itemUuid.value, revisionUuid.value) - if (result.data.error) { - return result.data.error.message - } - - return result.data.message - } catch (error) { - return 'An error occurred while deleting the revision.' + if (result.data.error) { + throw new Error(result.data.error.message) } + + return result.data.message } async getRevision( @@ -57,16 +49,12 @@ export class RevisionManager extends AbstractService implements RevisionClientIn created_at: string updated_at: string } | null> { - try { - const result = await this.revisionApiService.getRevision(itemUuid.value, revisionUuid.value) + const result = await this.revisionApiService.getRevision(itemUuid.value, revisionUuid.value) - if (result.data.error) { - return null - } - - return result.data.revision - } catch (error) { - return null + if (result.data.error) { + throw new Error(result.data.error.message) } + + return result.data.revision } } diff --git a/packages/services/src/Domain/Storage/StorageKeys.ts b/packages/services/src/Domain/Storage/StorageKeys.ts index d22fc232e..55ce4ba6b 100644 --- a/packages/services/src/Domain/Storage/StorageKeys.ts +++ b/packages/services/src/Domain/Storage/StorageKeys.ts @@ -34,6 +34,7 @@ export enum StorageKey { StorageEncryptionPolicy = 'storage_policy', WebSocketUrl = 'webSocket_url', UserRoles = 'user_roles', + OfflineUserRoles = 'offline_user_roles', UserFeatures = 'user_features', ExperimentalFeatures = 'experimental_features', DeinitMode = 'deinit_mode', diff --git a/packages/services/src/Domain/Subscription/SubscriptionClientInterface.ts b/packages/services/src/Domain/Subscription/SubscriptionClientInterface.ts index de20c323c..05b1872c3 100644 --- a/packages/services/src/Domain/Subscription/SubscriptionClientInterface.ts +++ b/packages/services/src/Domain/Subscription/SubscriptionClientInterface.ts @@ -1,12 +1,11 @@ -import { Uuid } from '@standardnotes/common' import { Invitation } from '@standardnotes/models' import { AppleIAPReceipt } from './AppleIAPReceipt' export interface SubscriptionClientInterface { listSubscriptionInvitations(): Promise inviteToSubscription(inviteeEmail: string): Promise - cancelInvitation(inviteUuid: Uuid): Promise - acceptInvitation(inviteUuid: Uuid): Promise<{ success: true } | { success: false; message: string }> + cancelInvitation(inviteUuid: string): Promise + acceptInvitation(inviteUuid: string): Promise<{ success: true } | { success: false; message: string }> confirmAppleIAP( receipt: AppleIAPReceipt, subscriptionToken: string, diff --git a/packages/services/src/Domain/Subscription/SubscriptionManager.ts b/packages/services/src/Domain/Subscription/SubscriptionManager.ts index 0c08d213d..11d3dec01 100644 --- a/packages/services/src/Domain/Subscription/SubscriptionManager.ts +++ b/packages/services/src/Domain/Subscription/SubscriptionManager.ts @@ -3,7 +3,6 @@ import { SubscriptionApiServiceInterface } from '@standardnotes/api' import { InternalEventBusInterface } from '../Internal/InternalEventBusInterface' import { AbstractService } from '../Service/AbstractService' import { SubscriptionClientInterface } from './SubscriptionClientInterface' -import { Uuid } from '@standardnotes/common' import { AppleIAPReceipt } from './AppleIAPReceipt' export class SubscriptionManager extends AbstractService implements SubscriptionClientInterface { @@ -48,7 +47,7 @@ export class SubscriptionManager extends AbstractService implements Subscription } } - async cancelInvitation(inviteUuid: Uuid): Promise { + async cancelInvitation(inviteUuid: string): Promise { try { const result = await this.subscriptionApiService.cancelInvite(inviteUuid) diff --git a/packages/services/src/Domain/Workspace/WorkspaceClientInterface.ts b/packages/services/src/Domain/Workspace/WorkspaceClientInterface.ts index c74171161..40a2a4199 100644 --- a/packages/services/src/Domain/Workspace/WorkspaceClientInterface.ts +++ b/packages/services/src/Domain/Workspace/WorkspaceClientInterface.ts @@ -1,4 +1,4 @@ -import { Uuid, WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common' +import { WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common' import { Workspace, WorkspaceUser } from '@standardnotes/api' export interface WorkspaceClientInterface { @@ -11,20 +11,20 @@ export interface WorkspaceClientInterface { }): Promise<{ uuid: string } | null> inviteToWorkspace(dto: { inviteeEmail: string - workspaceUuid: Uuid + workspaceUuid: string accessLevel: WorkspaceAccessLevel }): Promise<{ uuid: string } | null> acceptInvite(dto: { - inviteUuid: Uuid - userUuid: Uuid + inviteUuid: string + userUuid: string publicKey: string encryptedPrivateKey: string }): Promise<{ success: boolean }> listWorkspaces(): Promise<{ ownedWorkspaces: Array; joinedWorkspaces: Array }> - listWorkspaceUsers(dto: { workspaceUuid: Uuid }): Promise<{ users: Array }> + listWorkspaceUsers(dto: { workspaceUuid: string }): Promise<{ users: Array }> initiateKeyshare(dto: { - workspaceUuid: Uuid - userUuid: Uuid + workspaceUuid: string + userUuid: string encryptedWorkspaceKey: string }): Promise<{ success: boolean }> } diff --git a/packages/services/src/Domain/Workspace/WorkspaceManager.ts b/packages/services/src/Domain/Workspace/WorkspaceManager.ts index fca97be4a..8f363694d 100644 --- a/packages/services/src/Domain/Workspace/WorkspaceManager.ts +++ b/packages/services/src/Domain/Workspace/WorkspaceManager.ts @@ -1,5 +1,5 @@ import { WorkspaceApiServiceInterface, Workspace, WorkspaceUser } from '@standardnotes/api' -import { Uuid, WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common' +import { WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common' import { InternalEventBusInterface } from '../Internal/InternalEventBusInterface' import { AbstractService } from '../Service/AbstractService' import { WorkspaceClientInterface } from './WorkspaceClientInterface' @@ -79,7 +79,7 @@ export class WorkspaceManager extends AbstractService implements WorkspaceClient async inviteToWorkspace(dto: { inviteeEmail: string - workspaceUuid: Uuid + workspaceUuid: string accessLevel: WorkspaceAccessLevel }): Promise<{ uuid: string } | null> { try { diff --git a/packages/snjs/CHANGELOG.md b/packages/snjs/CHANGELOG.md index 4fab31f90..441ff18be 100644 --- a/packages/snjs/CHANGELOG.md +++ b/packages/snjs/CHANGELOG.md @@ -3,6 +3,40 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.164.7](https://github.com/standardnotes/app/compare/@standardnotes/snjs@2.164.6...@standardnotes/snjs@2.164.7) (2023-01-20) + +### Bug Fixes + +* fixed issue with third party editors not loading ([#2174](https://github.com/standardnotes/app/issues/2174)) ([e7214ea](https://github.com/standardnotes/app/commit/e7214ea73ad5d3026d958c79022d2238a4d1cfdc)) + +## [2.164.6](https://github.com/standardnotes/app/compare/@standardnotes/snjs@2.164.5...@standardnotes/snjs@2.164.6) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/snjs + +## [2.164.5](https://github.com/standardnotes/app/compare/@standardnotes/snjs@2.164.4...@standardnotes/snjs@2.164.5) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/snjs + +## [2.164.4](https://github.com/standardnotes/app/compare/@standardnotes/snjs@2.164.3...@standardnotes/snjs@2.164.4) (2023-01-20) + +### Bug Fixes + +* **snjs:** bring back history tests and fix handlinf of error with revisions ([cb9c160](https://github.com/standardnotes/app/commit/cb9c16047ebea7134c1aadaf89a8023497358a8e)) +* **snjs:** remove isFailed() checks during tests in order for getValue() to give a meaningful exception ([6a7ff42](https://github.com/standardnotes/app/commit/6a7ff423ff82bd6eb7fbfbc95f4b1ebda36cc842)) +* **snjs:** signed out fetching revisions test ([21a4eb0](https://github.com/standardnotes/app/commit/21a4eb0cf00add2c4cf2e69e55c55cb9fd50c239)) + +## [2.164.3](https://github.com/standardnotes/app/compare/@standardnotes/snjs@2.164.2...@standardnotes/snjs@2.164.3) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/snjs + +## [2.164.2](https://github.com/standardnotes/app/compare/@standardnotes/snjs@2.164.1...@standardnotes/snjs@2.164.2) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/snjs + +## [2.164.1](https://github.com/standardnotes/app/compare/@standardnotes/snjs@2.164.0...@standardnotes/snjs@2.164.1) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/snjs + # [2.164.0](https://github.com/standardnotes/app/compare/@standardnotes/snjs@2.163.7...@standardnotes/snjs@2.164.0) (2023-01-18) ### Bug Fixes diff --git a/packages/snjs/lib/Application/Application.ts b/packages/snjs/lib/Application/Application.ts index 653f8667e..77e555106 100644 --- a/packages/snjs/lib/Application/Application.ts +++ b/packages/snjs/lib/Application/Application.ts @@ -1160,8 +1160,8 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli return this.apiService.isThirdPartyHostUsed() } - public getCloudProviderIntegrationUrl(cloudProviderName: Settings.CloudProvider, isDevEnvironment: boolean): string { - return this.settingsService.getCloudProviderIntegrationUrl(cloudProviderName, isDevEnvironment) + public getCloudProviderIntegrationUrl(cloudProviderName: Settings.CloudProvider): string { + return this.settingsService.getCloudProviderIntegrationUrl(cloudProviderName) } private constructServices() { diff --git a/packages/snjs/lib/Domain/UseCase/DeleteRevision/DeleteRevision.spec.ts b/packages/snjs/lib/Domain/UseCase/DeleteRevision/DeleteRevision.spec.ts index 9d06d88e9..38f6a46ff 100644 --- a/packages/snjs/lib/Domain/UseCase/DeleteRevision/DeleteRevision.spec.ts +++ b/packages/snjs/lib/Domain/UseCase/DeleteRevision/DeleteRevision.spec.ts @@ -46,4 +46,18 @@ describe('DeleteRevision', () => { expect(result.isFailed()).toBe(true) expect(result.getError()).toEqual('Could not delete revision: Given value is not a valid uuid: invalid') }) + + it('should fail if revision manager throws', async () => { + const useCase = createUseCase() + + revisionManager.deleteRevision = jest.fn().mockRejectedValue(new Error('error')) + + const result = await useCase.execute({ + itemUuid: '00000000-0000-0000-0000-000000000000', + revisionUuid: '00000000-0000-0000-0000-000000000000', + }) + + expect(result.isFailed()).toBe(true) + expect(result.getError()).toEqual('Could not delete revision: error') + }) }) diff --git a/packages/snjs/lib/Domain/UseCase/DeleteRevision/DeleteRevision.ts b/packages/snjs/lib/Domain/UseCase/DeleteRevision/DeleteRevision.ts index ba7b6cd93..7529f1e48 100644 --- a/packages/snjs/lib/Domain/UseCase/DeleteRevision/DeleteRevision.ts +++ b/packages/snjs/lib/Domain/UseCase/DeleteRevision/DeleteRevision.ts @@ -19,8 +19,12 @@ export class DeleteRevision implements UseCaseInterface { } const revisionUuid = revisionUuidOrError.getValue() - await this.revisionManager.deleteRevision(itemUuid, revisionUuid) + try { + await this.revisionManager.deleteRevision(itemUuid, revisionUuid) - return Result.ok() + return Result.ok() + } catch (error) { + return Result.fail(`Could not delete revision: ${(error as Error).message}`) + } } } diff --git a/packages/snjs/lib/Domain/UseCase/GetRevision/GetRevision.spec.ts b/packages/snjs/lib/Domain/UseCase/GetRevision/GetRevision.spec.ts index 30ae8996c..29b0106bf 100644 --- a/packages/snjs/lib/Domain/UseCase/GetRevision/GetRevision.spec.ts +++ b/packages/snjs/lib/Domain/UseCase/GetRevision/GetRevision.spec.ts @@ -155,4 +155,18 @@ describe('GetRevision', () => { expect(result.isFailed()).toBe(true) }) + + it('should fail if revision manager throws', async () => { + revisionManager.getRevision = jest.fn().mockRejectedValue(new Error('error')) + + const useCase = createUseCase() + + const result = await useCase.execute({ + itemUuid: '00000000-0000-0000-0000-000000000000', + revisionUuid: '00000000-0000-0000-0000-000000000000', + }) + + expect(result.isFailed()).toBe(true) + expect(result.getError()).toEqual('Could not get revision: error') + }) }) diff --git a/packages/snjs/lib/Domain/UseCase/GetRevision/GetRevision.ts b/packages/snjs/lib/Domain/UseCase/GetRevision/GetRevision.ts index 267722c7b..a3fb37248 100644 --- a/packages/snjs/lib/Domain/UseCase/GetRevision/GetRevision.ts +++ b/packages/snjs/lib/Domain/UseCase/GetRevision/GetRevision.ts @@ -29,8 +29,14 @@ export class GetRevision implements UseCaseInterface { } const revisionUuid = revisionUuidOrError.getValue() - const revision = await this.revisionManager.getRevision(itemUuid, revisionUuid) - if (revision === null) { + let revision + try { + revision = await this.revisionManager.getRevision(itemUuid, revisionUuid) + } catch (error) { + return Result.fail(`Could not get revision: ${(error as Error).message}`) + } + + if (!revision) { return Result.fail('Could not get revision: Revision not found') } diff --git a/packages/snjs/lib/Domain/UseCase/ListRevisions/ListRevisions.spec.ts b/packages/snjs/lib/Domain/UseCase/ListRevisions/ListRevisions.spec.ts index d54d6adbe..37640ba94 100644 --- a/packages/snjs/lib/Domain/UseCase/ListRevisions/ListRevisions.spec.ts +++ b/packages/snjs/lib/Domain/UseCase/ListRevisions/ListRevisions.spec.ts @@ -29,4 +29,15 @@ describe('ListRevisions', () => { expect(result.isFailed()).toBe(true) expect(result.getError()).toEqual('Could not list item revisions: Given value is not a valid uuid: invalid') }) + + it('should fail if revision manager throws', async () => { + const useCase = createUseCase() + + revisionManager.listRevisions = jest.fn().mockRejectedValue(new Error('error')) + + const result = await useCase.execute({ itemUuid: '00000000-0000-0000-0000-000000000000' }) + + expect(result.isFailed()).toBe(true) + expect(result.getError()).toEqual('Could not list item revisions: error') + }) }) diff --git a/packages/snjs/lib/Domain/UseCase/ListRevisions/ListRevisions.ts b/packages/snjs/lib/Domain/UseCase/ListRevisions/ListRevisions.ts index 419925903..e88cf7c25 100644 --- a/packages/snjs/lib/Domain/UseCase/ListRevisions/ListRevisions.ts +++ b/packages/snjs/lib/Domain/UseCase/ListRevisions/ListRevisions.ts @@ -15,8 +15,12 @@ export class ListRevisions implements UseCaseInterface> } const itemUuid = itemUuidOrError.getValue() - const revisions = await this.revisionManager.listRevisions(itemUuid) + try { + const revisions = await this.revisionManager.listRevisions(itemUuid) - return Result.ok(revisions) + return Result.ok(revisions) + } catch (error) { + return Result.fail(`Could not list item revisions: ${(error as Error).message}`) + } } } diff --git a/packages/snjs/lib/Hosts.ts b/packages/snjs/lib/Hosts.ts index 1ba17f90e..9f88db3a3 100644 --- a/packages/snjs/lib/Hosts.ts +++ b/packages/snjs/lib/Hosts.ts @@ -1,24 +1,15 @@ -export const APPLICATION_DEFAULT_HOSTS = [ - 'api.standardnotes.com', - 'api-dev.standardnotes.com', - 'sync.standardnotes.org', - 'syncing-server-demo.standardnotes.com', -] +export const APPLICATION_DEFAULT_HOSTS = ['api.standardnotes.com', 'sync.standardnotes.org'] -export const FILES_DEFAULT_HOSTS = ['files.standardnotes.com', 'files-dev.standardnotes.com'] +export const FILES_DEFAULT_HOSTS = ['files.standardnotes.com'] export const TRUSTED_FEATURE_HOSTS = [ - 'api-dev.standardnotes.com', 'api.standardnotes.com', 'extensions.standardnotes.com', 'extensions.standardnotes.org', - 'extensions-server-dev.standardnotes.org', - 'extensions-server-dev.standardnotes.com', 'features.standardnotes.com', ] export enum ExtensionsServerURL { - Dev = 'https://extensions-server-dev.standardnotes.org', Prod = 'https://extensions.standardnotes.org', } diff --git a/packages/snjs/lib/Services/Api/ApiService.ts b/packages/snjs/lib/Services/Api/ApiService.ts index 65fd1283f..bf22149cb 100644 --- a/packages/snjs/lib/Services/Api/ApiService.ts +++ b/packages/snjs/lib/Services/Api/ApiService.ts @@ -1,7 +1,7 @@ import { FeatureDescription } from '@standardnotes/features' import { isNullOrUndefined, joinPaths } from '@standardnotes/utils' import { SettingName, SubscriptionSettingName } from '@standardnotes/settings' -import { Uuid, ErrorTag } from '@standardnotes/common' +import { ErrorTag } from '@standardnotes/common' import { AbstractService, ApiServiceInterface, @@ -654,7 +654,7 @@ export class SNApiService public async downloadOfflineFeaturesFromRepo( repo: SNFeatureRepo, - ): Promise<{ features: FeatureDescription[] } | ClientDisplayableError> { + ): Promise<{ features: FeatureDescription[]; roles: string[] } | ClientDisplayableError> { try { const featuresUrl = repo.offlineFeaturesUrl const extensionKey = repo.offlineKey @@ -678,8 +678,10 @@ export class SNApiService if (response.error) { return ClientDisplayableError.FromError(response.error) } + const data = (response as Responses.GetOfflineFeaturesResponse).data return { - features: (response as Responses.GetOfflineFeaturesResponse).data?.features || [], + features: data?.features || [], + roles: data?.roles || [], } } catch { return new ClientDisplayableError(API_MESSAGE_FAILED_OFFLINE_ACTIVATION) @@ -852,7 +854,7 @@ export class SNApiService }) } - async getSingleItem(itemUuid: Uuid): Promise { + async getSingleItem(itemUuid: string): Promise { return await this.tokenRefreshableRequest({ verb: HttpVerb.Get, url: joinPaths(this.host, Paths.v1.getSingleItem(itemUuid)), diff --git a/packages/snjs/lib/Services/Api/Paths.ts b/packages/snjs/lib/Services/Api/Paths.ts index 07f273ac6..96a8fe3e8 100644 --- a/packages/snjs/lib/Services/Api/Paths.ts +++ b/packages/snjs/lib/Services/Api/Paths.ts @@ -1,4 +1,3 @@ -import { Uuid } from '@standardnotes/common' import { SettingName, SubscriptionSettingName } from '@standardnotes/settings' const FilesPaths = { @@ -12,7 +11,7 @@ const FilesPaths = { const UserPaths = { changeCredentials: (userUuid: string) => `/v1/users/${userUuid}/attributes/credentials`, - deleteAccount: (userUuid: Uuid) => `/v1/users/${userUuid}`, + deleteAccount: (userUuid: string) => `/v1/users/${userUuid}`, keyParams: '/v1/login-params', refreshSession: '/v1/sessions/refresh', register: '/v1/users', @@ -24,23 +23,23 @@ const UserPaths = { const ItemsPaths = { checkIntegrity: '/v1/items/check-integrity', - getSingleItem: (uuid: Uuid) => `/v1/items/${uuid}`, + getSingleItem: (uuid: string) => `/v1/items/${uuid}`, itemRevisions: (itemUuid: string) => `/v1/items/${itemUuid}/revisions`, itemRevision: (itemUuid: string, revisionUuid: string) => `/v1/items/${itemUuid}/revisions/${revisionUuid}`, sync: '/v1/items', } const SettingsPaths = { - settings: (userUuid: Uuid) => `/v1/users/${userUuid}/settings`, - setting: (userUuid: Uuid, settingName: SettingName) => `/v1/users/${userUuid}/settings/${settingName}`, - subscriptionSetting: (userUuid: Uuid, settingName: SubscriptionSettingName) => + settings: (userUuid: string) => `/v1/users/${userUuid}/settings`, + setting: (userUuid: string, settingName: SettingName) => `/v1/users/${userUuid}/settings/${settingName}`, + subscriptionSetting: (userUuid: string, settingName: SubscriptionSettingName) => `/v1/users/${userUuid}/subscription-settings/${settingName}`, } const SubscriptionPaths = { offlineFeatures: '/v1/offline/features', purchase: '/v1/purchase', - subscription: (userUuid: Uuid) => `/v1/users/${userUuid}/subscription`, + subscription: (userUuid: string) => `/v1/users/${userUuid}/subscription`, subscriptionTokens: '/v1/subscription-tokens', userFeatures: (userUuid: string) => `/v1/users/${userUuid}/features`, } @@ -55,7 +54,7 @@ const UserPathsV2 = { } const ListedPaths = { - listedRegistration: (userUuid: Uuid) => `/v1/users/${userUuid}/integrations/listed`, + listedRegistration: (userUuid: string) => `/v1/users/${userUuid}/integrations/listed`, } export const Paths = { diff --git a/packages/snjs/lib/Services/Api/WebsocketsService.ts b/packages/snjs/lib/Services/Api/WebsocketsService.ts index 3a8fa7788..fc76572fd 100644 --- a/packages/snjs/lib/Services/Api/WebsocketsService.ts +++ b/packages/snjs/lib/Services/Api/WebsocketsService.ts @@ -80,7 +80,7 @@ export class SNWebSocketsService extends AbstractService { const manager = createManager(Environment.Desktop, Platform.MacDesktop) expect( - manager.areRequestedPermissionsValid(nativeComponent(FeatureIdentifier.MarkdownVisualEditor), permissions), + manager.areRequestedPermissionsValid(nativeComponent(FeatureIdentifier.MarkdownProEditor), permissions), ).toEqual(true) }) diff --git a/packages/snjs/lib/Services/Features/FeaturesService.spec.ts b/packages/snjs/lib/Services/Features/FeaturesService.spec.ts index e6beb7495..4a6b27f67 100644 --- a/packages/snjs/lib/Services/Features/FeaturesService.spec.ts +++ b/packages/snjs/lib/Services/Features/FeaturesService.spec.ts @@ -2,7 +2,8 @@ import { ItemInterface, SNComponent, SNFeatureRepo } from '@standardnotes/models import { SNSyncService } from '../Sync/SyncService' import { SettingName } from '@standardnotes/settings' import { SNFeaturesService } from '@Lib/Services/Features' -import { ContentType, RoleName } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' +import { RoleName } from '@standardnotes/domain-core' import { FeatureDescription, FeatureIdentifier, GetFeatures } from '@standardnotes/features' import { SNWebSocketsService } from '../Api/WebsocketsService' import { SNSettingsService } from '../Settings' @@ -31,7 +32,7 @@ describe('featuresService', () => { let alertService: AlertService let sessionManager: SNSessionManager let crypto: PureCryptoInterface - let roles: RoleName[] + let roles: string[] let features: FeatureDescription[] let items: ItemInterface[] let now: Date @@ -57,7 +58,7 @@ describe('featuresService', () => { } beforeEach(() => { - roles = [RoleName.CoreUser, RoleName.PlusUser] + roles = [RoleName.NAMES.CoreUser, RoleName.NAMES.PlusUser] now = new Date() tomorrow_client = now.setDate(now.getDate() + 1) @@ -161,7 +162,7 @@ describe('featuresService', () => { }, }) - const newRoles = [...roles, RoleName.PlusUser] + const newRoles = [...roles, RoleName.NAMES.PlusUser] storageService.getValue = jest.fn().mockReturnValue(roles) @@ -169,7 +170,7 @@ describe('featuresService', () => { featuresService.getExperimentalFeatures = jest.fn().mockReturnValue([FeatureIdentifier.PlusEditor]) featuresService.initializeFromDisk() - await featuresService.updateRolesAndFetchFeatures('123', newRoles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', newRoles) expect(itemManager.createItem).not.toHaveBeenCalled() }) @@ -180,7 +181,7 @@ describe('featuresService', () => { }, }) - const newRoles = [...roles, RoleName.PlusUser] + const newRoles = [...roles, RoleName.NAMES.PlusUser] storageService.getValue = jest.fn().mockReturnValue(roles) @@ -190,7 +191,7 @@ describe('featuresService', () => { featuresService.getEnabledExperimentalFeatures = jest.fn().mockReturnValue([FeatureIdentifier.PlusEditor]) featuresService.initializeFromDisk() - await featuresService.updateRolesAndFetchFeatures('123', newRoles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', newRoles) expect(itemManager.createItem).toHaveBeenCalled() }) }) @@ -211,8 +212,8 @@ describe('featuresService', () => { const mock = (featuresService['notifyEvent'] = jest.fn()) - const newRoles = [...roles, RoleName.PlusUser] - await featuresService.setRoles(newRoles) + const newRoles = [...roles, RoleName.NAMES.PlusUser] + await featuresService.setOnlineRoles(newRoles) expect(mock.mock.calls[0][0]).toEqual(FeaturesEvent.UserRolesChanged) }) @@ -224,8 +225,8 @@ describe('featuresService', () => { const spy = jest.spyOn(featuresService, 'notifyEvent' as never) - const newRoles = [...roles, RoleName.ProUser] - await featuresService.updateRolesAndFetchFeatures('123', newRoles) + const newRoles = [...roles, RoleName.NAMES.ProUser] + await featuresService.updateOnlineRolesAndFetchFeatures('123', newRoles) expect(spy.mock.calls[2][0]).toEqual(FeaturesEvent.DidPurchaseSubscription) }) @@ -234,56 +235,56 @@ describe('featuresService', () => { storageService.getValue = jest.fn().mockReturnValue(roles) const featuresService = createService() featuresService.initializeFromDisk() - featuresService['roles'] = [] + featuresService['onlineRoles'] = [] const spy = jest.spyOn(featuresService, 'notifyEvent' as never) - const newRoles = [...roles, RoleName.ProUser] - await featuresService.updateRolesAndFetchFeatures('123', newRoles) + const newRoles = [...roles, RoleName.NAMES.ProUser] + await featuresService.updateOnlineRolesAndFetchFeatures('123', newRoles) const triggeredEvents = spy.mock.calls.map((call) => call[0]) expect(triggeredEvents).not.toContain(FeaturesEvent.DidPurchaseSubscription) }) it('saves new roles to storage and fetches features if a role has been added', async () => { - const newRoles = [...roles, RoleName.PlusUser] + const newRoles = [...roles, RoleName.NAMES.PlusUser] storageService.getValue = jest.fn().mockReturnValue(roles) const featuresService = createService() featuresService.initializeFromDisk() - await featuresService.updateRolesAndFetchFeatures('123', newRoles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', newRoles) expect(storageService.setValue).toHaveBeenCalledWith(StorageKey.UserRoles, newRoles) expect(apiService.getUserFeatures).toHaveBeenCalledWith('123') }) it('saves new roles to storage and fetches features if a role has been removed', async () => { - const newRoles = [RoleName.CoreUser] + const newRoles = [RoleName.NAMES.CoreUser] storageService.getValue = jest.fn().mockReturnValue(roles) const featuresService = createService() featuresService.initializeFromDisk() - await featuresService.updateRolesAndFetchFeatures('123', newRoles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', newRoles) expect(storageService.setValue).toHaveBeenCalledWith(StorageKey.UserRoles, newRoles) expect(apiService.getUserFeatures).toHaveBeenCalledWith('123') }) it('saves features to storage when roles change', async () => { - const newRoles = [...roles, RoleName.PlusUser] + const newRoles = [...roles, RoleName.NAMES.PlusUser] storageService.getValue = jest.fn().mockReturnValue(roles) const featuresService = createService() featuresService.initializeFromDisk() - await featuresService.updateRolesAndFetchFeatures('123', newRoles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', newRoles) expect(storageService.setValue).toHaveBeenCalledWith(StorageKey.UserFeatures, features) }) it('creates items for non-expired features with content type if they do not exist', async () => { - const newRoles = [...roles, RoleName.PlusUser] + const newRoles = [...roles, RoleName.NAMES.PlusUser] storageService.getValue = jest.fn().mockReturnValue(roles) const featuresService = createService() featuresService.initializeFromDisk() - await featuresService.updateRolesAndFetchFeatures('123', newRoles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', newRoles) expect(itemManager.createItem).toHaveBeenCalledTimes(2) expect(itemManager.createItem).toHaveBeenCalledWith( ContentType.Theme, @@ -321,19 +322,19 @@ describe('featuresService', () => { }, } as never) - const newRoles = [...roles, RoleName.PlusUser] + const newRoles = [...roles, RoleName.NAMES.PlusUser] storageService.getValue = jest.fn().mockReturnValue(roles) itemManager.getItems = jest.fn().mockReturnValue([existingItem]) const featuresService = createService() featuresService.initializeFromDisk() - await featuresService.updateRolesAndFetchFeatures('123', newRoles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', newRoles) expect(itemManager.changeComponent).toHaveBeenCalledWith(existingItem, expect.any(Function)) }) it('creates items for expired components if they do not exist', async () => { - const newRoles = [...roles, RoleName.PlusUser] + const newRoles = [...roles, RoleName.NAMES.PlusUser] const now = new Date() const yesterday_client = now.setDate(now.getDate() - 1) @@ -353,7 +354,7 @@ describe('featuresService', () => { const featuresService = createService() featuresService.initializeFromDisk() - await featuresService.updateRolesAndFetchFeatures('123', newRoles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', newRoles) expect(itemManager.createItem).toHaveBeenCalledWith( ContentType.Component, expect.objectContaining({ @@ -379,7 +380,7 @@ describe('featuresService', () => { }, } as never) - const newRoles = [...roles, RoleName.PlusUser] + const newRoles = [...roles, RoleName.NAMES.PlusUser] const now = new Date() const yesterday = now.setDate(now.getDate() - 1) @@ -400,7 +401,7 @@ describe('featuresService', () => { const featuresService = createService() featuresService.initializeFromDisk() - await featuresService.updateRolesAndFetchFeatures('123', newRoles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', newRoles) expect(itemManager.setItemsToBeDeleted).toHaveBeenCalledWith([existingItem]) }) @@ -418,12 +419,12 @@ describe('featuresService', () => { }, }) - const newRoles = [...roles, RoleName.PlusUser] + const newRoles = [...roles, RoleName.NAMES.PlusUser] storageService.getValue = jest.fn().mockReturnValue(roles) const featuresService = createService() featuresService.initializeFromDisk() - await featuresService.updateRolesAndFetchFeatures('123', newRoles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', newRoles) expect(itemManager.createItem).not.toHaveBeenCalled() }) @@ -441,12 +442,12 @@ describe('featuresService', () => { }, }) - const newRoles = [...roles, RoleName.PlusUser] + const newRoles = [...roles, RoleName.NAMES.PlusUser] storageService.getValue = jest.fn().mockReturnValue(roles) const featuresService = createService() featuresService.initializeFromDisk() - await featuresService.updateRolesAndFetchFeatures('123', newRoles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', newRoles) expect(itemManager.createItem).not.toHaveBeenCalled() }) @@ -454,10 +455,10 @@ describe('featuresService', () => { storageService.getValue = jest.fn().mockReturnValue(roles) const featuresService = createService() featuresService.initializeFromDisk() - await featuresService.updateRolesAndFetchFeatures('123', roles) - await featuresService.updateRolesAndFetchFeatures('123', roles) - await featuresService.updateRolesAndFetchFeatures('123', roles) - await featuresService.updateRolesAndFetchFeatures('123', roles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', roles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', roles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', roles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', roles) expect(storageService.setValue).toHaveBeenCalledTimes(2) }) @@ -468,7 +469,7 @@ describe('featuresService', () => { expires_at: tomorrow_server, } as FeatureDescription - const newRoles = [...roles, RoleName.PlusUser] + const newRoles = [...roles, RoleName.NAMES.PlusUser] storageService.getValue = jest.fn().mockReturnValue(roles) apiService.getUserFeatures = jest.fn().mockReturnValue({ @@ -481,7 +482,7 @@ describe('featuresService', () => { const nativeFeature = featuresService['mapRemoteNativeFeatureToStaticFeature'](remoteFeature) featuresService['mapRemoteNativeFeatureToItem'] = jest.fn() featuresService.initializeFromDisk() - await featuresService.updateRolesAndFetchFeatures('123', newRoles) + await featuresService.updateOnlineRolesAndFetchFeatures('123', newRoles) expect(featuresService['mapRemoteNativeFeatureToItem']).toHaveBeenCalledWith( nativeFeature, expect.anything(), @@ -508,7 +509,26 @@ describe('featuresService', () => { await expect(() => featuresService['mapRemoteNativeFeatureToItem'](clientFeature, [], [])).rejects.toThrow() }) - it('feature status', async () => { + it('role-based feature status', async () => { + const featuresService = createService() + + features = [] as jest.Mocked + + apiService.getUserFeatures = jest.fn().mockReturnValue({ + data: { + features, + }, + }) + + sessionManager.isSignedIntoFirstPartyServer = jest.fn().mockReturnValue(true) + + await featuresService.updateOnlineRolesAndFetchFeatures('123', [RoleName.NAMES.CoreUser, RoleName.NAMES.PlusUser]) + + expect(featuresService.getFeatureStatus(FeatureIdentifier.MidnightTheme)).toBe(FeatureStatus.Entitled) + expect(featuresService.getFeatureStatus(FeatureIdentifier.SuperEditor)).toBe(FeatureStatus.Entitled) + }) + + it('feature status with no paid role but features listings', async () => { const featuresService = createService() features = [ @@ -516,13 +536,13 @@ describe('featuresService', () => { identifier: FeatureIdentifier.MidnightTheme, content_type: ContentType.Theme, expires_at: tomorrow_server, - role_name: RoleName.PlusUser, + role_name: RoleName.NAMES.PlusUser, }, { identifier: FeatureIdentifier.PlusEditor, content_type: ContentType.Component, expires_at: expiredDate, - role_name: RoleName.ProUser, + role_name: RoleName.NAMES.ProUser, }, ] as jest.Mocked @@ -534,54 +554,21 @@ describe('featuresService', () => { sessionManager.isSignedIntoFirstPartyServer = jest.fn().mockReturnValue(true) - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.CoreUser, RoleName.PlusUser]) - - expect(featuresService.getFeatureStatus(FeatureIdentifier.MidnightTheme)).toBe(FeatureStatus.Entitled) - expect(featuresService.getFeatureStatus(FeatureIdentifier.PlusEditor)).toBe(FeatureStatus.NotInCurrentPlan) - expect(featuresService.getFeatureStatus(FeatureIdentifier.SheetsEditor)).toBe(FeatureStatus.NotInCurrentPlan) - - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.CoreUser]) + await featuresService.updateOnlineRolesAndFetchFeatures('123', [RoleName.NAMES.CoreUser]) expect(featuresService.getFeatureStatus(FeatureIdentifier.MidnightTheme)).toBe(FeatureStatus.NoUserSubscription) expect(featuresService.getFeatureStatus(FeatureIdentifier.PlusEditor)).toBe(FeatureStatus.NoUserSubscription) expect(featuresService.getFeatureStatus(FeatureIdentifier.SheetsEditor)).toBe(FeatureStatus.NoUserSubscription) - - features = [ - { - identifier: FeatureIdentifier.MidnightTheme, - content_type: ContentType.Theme, - expires_at: expiredDate, - role_name: RoleName.PlusUser, - }, - { - identifier: FeatureIdentifier.PlusEditor, - content_type: ContentType.Component, - expires_at: expiredDate, - role_name: RoleName.ProUser, - }, - ] as jest.Mocked - - apiService.getUserFeatures = jest.fn().mockReturnValue({ - data: { - features, - }, - }) - - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.PlusUser]) - - expect(featuresService.getFeatureStatus(FeatureIdentifier.MidnightTheme)).toBe( - FeatureStatus.InCurrentPlanButExpired, - ) - expect(featuresService.getFeatureStatus(FeatureIdentifier.PlusEditor)).toBe(FeatureStatus.NotInCurrentPlan) - expect(featuresService.getFeatureStatus(FeatureIdentifier.SheetsEditor)).toBe(FeatureStatus.NotInCurrentPlan) }) - it('availableInRoles-based features', async () => { + it('role-based features while not signed into first party server', async () => { const featuresService = createService() - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.ProUser]) + sessionManager.isSignedIntoFirstPartyServer = jest.fn().mockReturnValue(false) - expect(featuresService.getFeatureStatus(FeatureIdentifier.SuperEditor)).toBe(FeatureStatus.Entitled) + await featuresService.updateOnlineRolesAndFetchFeatures('123', [RoleName.NAMES.ProUser]) + + expect(featuresService.getFeatureStatus(FeatureIdentifier.SuperEditor)).toBe(FeatureStatus.NotInCurrentPlan) }) it('third party feature status', async () => { @@ -591,14 +578,14 @@ describe('featuresService', () => { identifier: 'third-party-theme' as FeatureIdentifier, content_type: ContentType.Theme, expires_at: tomorrow_server, - role_name: RoleName.CoreUser, + role_name: RoleName.NAMES.CoreUser, } const editorFeature = { identifier: 'third-party-editor' as FeatureIdentifier, content_type: ContentType.Component, expires_at: expiredDate, - role_name: RoleName.PlusUser, + role_name: RoleName.NAMES.PlusUser, } features = [themeFeature, editorFeature] as jest.Mocked @@ -628,7 +615,7 @@ describe('featuresService', () => { } as never), ]) - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.CoreUser]) + await featuresService.updateOnlineRolesAndFetchFeatures('123', [RoleName.NAMES.CoreUser]) expect(featuresService.getFeatureStatus(themeFeature.identifier)).toBe(FeatureStatus.Entitled) expect(featuresService.getFeatureStatus(editorFeature.identifier)).toBe(FeatureStatus.InCurrentPlanButExpired) @@ -640,7 +627,7 @@ describe('featuresService', () => { it('feature status should be not entitled if no account or offline repo', async () => { const featuresService = createService() - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.CoreUser]) + await featuresService.updateOnlineRolesAndFetchFeatures('123', [RoleName.NAMES.CoreUser]) sessionManager.isSignedIntoFirstPartyServer = jest.fn().mockReturnValue(false) @@ -652,30 +639,6 @@ describe('featuresService', () => { ) }) - it('feature status should be entitled for subscriber until first successful features request made if no cached features', async () => { - const featuresService = createService() - - apiService.getUserFeatures = jest.fn().mockReturnValue({ - data: { - features: [], - }, - }) - - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.CoreUser, RoleName.PlusUser]) - - sessionManager.isSignedIntoFirstPartyServer = jest.fn().mockReturnValue(true) - - featuresService['completedSuccessfulFeaturesRetrieval'] = false - - expect(featuresService.getFeatureStatus(FeatureIdentifier.MidnightTheme)).toBe(FeatureStatus.Entitled) - expect(featuresService.getFeatureStatus(FeatureIdentifier.TokenVaultEditor)).toBe(FeatureStatus.Entitled) - - await featuresService.didDownloadFeatures(features) - - expect(featuresService.getFeatureStatus(FeatureIdentifier.MidnightTheme)).toBe(FeatureStatus.Entitled) - expect(featuresService.getFeatureStatus(FeatureIdentifier.TokenVaultEditor)).toBe(FeatureStatus.NotInCurrentPlan) - }) - it('didDownloadFeatures should filter out client controlled features', async () => { const featuresService = createService() @@ -686,31 +649,13 @@ describe('featuresService', () => { expect(featuresService['mapRemoteNativeFeaturesToItems']).toHaveBeenCalledWith([]) }) - it('feature status should be dynamic for subscriber if cached features and no successful features request made yet', async () => { - const featuresService = createService() - - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.CoreUser, RoleName.PlusUser]) - - featuresService['completedSuccessfulFeaturesRetrieval'] = false - - sessionManager.isSignedIntoFirstPartyServer = jest.fn().mockReturnValue(true) - - expect(featuresService.getFeatureStatus(FeatureIdentifier.MidnightTheme)).toBe(FeatureStatus.Entitled) - expect(featuresService.getFeatureStatus(FeatureIdentifier.TokenVaultEditor)).toBe(FeatureStatus.NotInCurrentPlan) - - featuresService['completedSuccessfulFeaturesRetrieval'] = false - - expect(featuresService.getFeatureStatus(FeatureIdentifier.MidnightTheme)).toBe(FeatureStatus.Entitled) - expect(featuresService.getFeatureStatus(FeatureIdentifier.TokenVaultEditor)).toBe(FeatureStatus.NotInCurrentPlan) - }) - it('feature status for offline subscription', async () => { const featuresService = createService() - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.CoreUser, RoleName.PlusUser]) + await featuresService.updateOnlineRolesAndFetchFeatures('123', [RoleName.NAMES.CoreUser, RoleName.NAMES.PlusUser]) sessionManager.isSignedIntoFirstPartyServer = jest.fn().mockReturnValue(false) - featuresService.rolesIncludePaidSubscription = jest.fn().mockReturnValue(false) + featuresService.onlineRolesIncludePaidSubscription = jest.fn().mockReturnValue(false) featuresService['completedSuccessfulFeaturesRetrieval'] = true expect(featuresService.getFeatureStatus(FeatureIdentifier.MidnightTheme)).toBe(FeatureStatus.NoUserSubscription) @@ -719,9 +664,11 @@ describe('featuresService', () => { ) featuresService.hasOfflineRepo = jest.fn().mockReturnValue(true) + featuresService.hasFirstPartySubscription = jest.fn().mockReturnValue(true) + await featuresService.setOfflineRoles([RoleName.NAMES.CoreUser, RoleName.NAMES.PlusUser]) expect(featuresService.getFeatureStatus(FeatureIdentifier.MidnightTheme)).toBe(FeatureStatus.Entitled) - expect(featuresService.getFeatureStatus(FeatureIdentifier.TokenVaultEditor)).toBe(FeatureStatus.NotInCurrentPlan) + expect(featuresService.getFeatureStatus(FeatureIdentifier.TokenVaultEditor)).toBe(FeatureStatus.Entitled) }) it('feature status for deprecated feature', async () => { @@ -733,7 +680,7 @@ describe('featuresService', () => { FeatureStatus.NoUserSubscription, ) - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.CoreUser, RoleName.PlusUser]) + await featuresService.updateOnlineRolesAndFetchFeatures('123', [RoleName.NAMES.CoreUser, RoleName.NAMES.PlusUser]) expect(featuresService.getFeatureStatus(FeatureIdentifier.DeprecatedFileSafe as FeatureIdentifier)).toBe( FeatureStatus.Entitled, @@ -743,25 +690,25 @@ describe('featuresService', () => { it('has paid subscription', async () => { const featuresService = createService() - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.CoreUser]) + await featuresService.updateOnlineRolesAndFetchFeatures('123', [RoleName.NAMES.CoreUser]) sessionManager.isSignedIntoFirstPartyServer = jest.fn().mockReturnValue(true) - expect(featuresService.hasPaidOnlineOrOfflineSubscription()).toBeFalsy + expect(featuresService.hasPaidAnyPartyOnlineOrOfflineSubscription()).toBeFalsy - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.CoreUser, RoleName.PlusUser]) + await featuresService.updateOnlineRolesAndFetchFeatures('123', [RoleName.NAMES.CoreUser, RoleName.NAMES.PlusUser]) - expect(featuresService.hasPaidOnlineOrOfflineSubscription()).toEqual(true) + expect(featuresService.hasPaidAnyPartyOnlineOrOfflineSubscription()).toEqual(true) }) it('has paid subscription should be true if offline repo and signed into third party server', async () => { const featuresService = createService() - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.CoreUser]) + await featuresService.updateOnlineRolesAndFetchFeatures('123', [RoleName.NAMES.CoreUser]) featuresService.hasOfflineRepo = jest.fn().mockReturnValue(true) sessionManager.isSignedIntoFirstPartyServer = jest.fn().mockReturnValue(false) - expect(featuresService.hasPaidOnlineOrOfflineSubscription()).toEqual(true) + expect(featuresService.hasPaidAnyPartyOnlineOrOfflineSubscription()).toEqual(true) }) }) @@ -828,9 +775,13 @@ describe('featuresService', () => { it('should sort given roles according to role hierarchy', () => { const featuresService = createService() - const sortedRoles = featuresService.rolesBySorting([RoleName.ProUser, RoleName.CoreUser, RoleName.PlusUser]) + const sortedRoles = featuresService.rolesBySorting([ + RoleName.NAMES.ProUser, + RoleName.NAMES.CoreUser, + RoleName.NAMES.PlusUser, + ]) - expect(sortedRoles).toStrictEqual([RoleName.CoreUser, RoleName.PlusUser, RoleName.ProUser]) + expect(sortedRoles).toStrictEqual([RoleName.NAMES.CoreUser, RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser]) }) }) @@ -838,9 +789,9 @@ describe('featuresService', () => { it('should be false if core user checks for plus role', async () => { const featuresService = createService() - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.CoreUser]) + await featuresService.updateOnlineRolesAndFetchFeatures('123', [RoleName.NAMES.CoreUser]) - const hasPlusUserRole = featuresService.hasMinimumRole(RoleName.PlusUser) + const hasPlusUserRole = featuresService.hasMinimumRole(RoleName.NAMES.PlusUser) expect(hasPlusUserRole).toBe(false) }) @@ -848,9 +799,11 @@ describe('featuresService', () => { it('should be false if plus user checks for pro role', async () => { const featuresService = createService() - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.PlusUser, RoleName.CoreUser]) + sessionManager.isSignedIntoFirstPartyServer = jest.fn().mockReturnValue(true) - const hasProUserRole = featuresService.hasMinimumRole(RoleName.ProUser) + await featuresService.updateOnlineRolesAndFetchFeatures('123', [RoleName.NAMES.PlusUser, RoleName.NAMES.CoreUser]) + + const hasProUserRole = featuresService.hasMinimumRole(RoleName.NAMES.ProUser) expect(hasProUserRole).toBe(false) }) @@ -858,9 +811,11 @@ describe('featuresService', () => { it('should be true if pro user checks for core user', async () => { const featuresService = createService() - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.ProUser, RoleName.PlusUser]) + sessionManager.isSignedIntoFirstPartyServer = jest.fn().mockReturnValue(true) - const hasCoreUserRole = featuresService.hasMinimumRole(RoleName.CoreUser) + await featuresService.updateOnlineRolesAndFetchFeatures('123', [RoleName.NAMES.ProUser, RoleName.NAMES.PlusUser]) + + const hasCoreUserRole = featuresService.hasMinimumRole(RoleName.NAMES.CoreUser) expect(hasCoreUserRole).toBe(true) }) @@ -868,9 +823,11 @@ describe('featuresService', () => { it('should be true if pro user checks for pro user', async () => { const featuresService = createService() - await featuresService.updateRolesAndFetchFeatures('123', [RoleName.ProUser, RoleName.PlusUser]) + sessionManager.isSignedIntoFirstPartyServer = jest.fn().mockReturnValue(true) - const hasProUserRole = featuresService.hasMinimumRole(RoleName.ProUser) + await featuresService.updateOnlineRolesAndFetchFeatures('123', [RoleName.NAMES.ProUser, RoleName.NAMES.PlusUser]) + + const hasProUserRole = featuresService.hasMinimumRole(RoleName.NAMES.ProUser) expect(hasProUserRole).toBe(true) }) diff --git a/packages/snjs/lib/Services/Features/FeaturesService.ts b/packages/snjs/lib/Services/Features/FeaturesService.ts index c5dfbb6c5..db1718271 100644 --- a/packages/snjs/lib/Services/Features/FeaturesService.ts +++ b/packages/snjs/lib/Services/Features/FeaturesService.ts @@ -8,7 +8,8 @@ import { isString, } from '@standardnotes/utils' import { ClientDisplayableError, UserFeaturesResponse } from '@standardnotes/responses' -import { ContentType, RoleName } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' +import { RoleName } from '@standardnotes/domain-core' import { FillItemContent, PayloadEmitSource } from '@standardnotes/models' import { ItemManager } from '../Items/ItemManager' import { LEGACY_PROD_EXT_ORIGIN, PROD_OFFLINE_FEATURES_URL } from '../../Hosts' @@ -57,7 +58,8 @@ export class SNFeaturesService implements FeaturesClientInterface, InternalEventHandlerInterface { private deinited = false - private roles: RoleName[] = [] + private onlineRoles: string[] = [] + private offlineRoles: string[] = [] private features: FeaturesImports.FeatureDescription[] = [] private enabledExperimentalFeatures: FeaturesImports.FeatureIdentifier[] = [] private removeWebSocketsServiceObserver: () => void @@ -86,7 +88,7 @@ export class SNFeaturesService const { payload: { userUuid, currentRoles }, } = data as UserRolesChangedEvent - await this.updateRolesAndFetchFeatures(userUuid, currentRoles) + await this.updateOnlineRolesAndFetchFeatures(userUuid, currentRoles) } }) @@ -123,6 +125,16 @@ export class SNFeaturesService }) } + public initializeFromDisk(): void { + this.onlineRoles = this.storageService.getValue(StorageKey.UserRoles, undefined, []) + + this.offlineRoles = this.storageService.getValue(StorageKey.OfflineUserRoles, undefined, []) + + this.features = this.storageService.getValue(StorageKey.UserFeatures, undefined, []) + + this.enabledExperimentalFeatures = this.storageService.getValue(StorageKey.ExperimentalFeatures, undefined, []) + } + async handleEvent(event: InternalEventInterface): Promise { if (event.type === ApiServiceEvent.MetaReceived) { if (!this.syncService) { @@ -141,7 +153,7 @@ export class SNFeaturesService } const { userUuid, userRoles } = event.payload as MetaReceivedData - await this.updateRolesAndFetchFeatures( + await this.updateOnlineRolesAndFetchFeatures( userUuid, userRoles.map((role) => role.name), ) @@ -154,7 +166,7 @@ export class SNFeaturesService if (stage === ApplicationStage.FullSyncCompleted_13) { void this.mapClientControlledFeaturesToItems() - if (!this.rolesIncludePaidSubscription()) { + if (!this.hasFirstPartyOnlineSubscription()) { const offlineRepo = this.getOfflineRepo() if (offlineRepo) { void this.downloadOfflineFeatures(offlineRepo) @@ -193,7 +205,7 @@ export class SNFeaturesService } public enableExperimentalFeature(identifier: FeaturesImports.FeatureIdentifier): void { - const feature = this.getUserFeature(identifier) + const feature = this.getFeatureThatOriginallyCameFromServer(identifier) this.enabledExperimentalFeatures.push(identifier) @@ -308,10 +320,14 @@ export class SNFeaturesService repo: Models.SNFeatureRepo, ): Promise { const result = await this.apiService.downloadOfflineFeaturesFromRepo(repo) + if (result instanceof ClientDisplayableError) { return result } + await this.didDownloadFeatures(result.features) + await this.setOfflineRoles(result.roles) + return undefined } @@ -362,18 +378,29 @@ export class SNFeaturesService } } - public initializeFromDisk(): void { - this.roles = this.storageService.getValue(StorageKey.UserRoles, undefined, []) - - this.features = this.storageService.getValue(StorageKey.UserFeatures, undefined, []) - - this.enabledExperimentalFeatures = this.storageService.getValue(StorageKey.ExperimentalFeatures, undefined, []) + hasFirstPartyOnlineSubscription(): boolean { + return this.sessionManager.isSignedIntoFirstPartyServer() && this.onlineRolesIncludePaidSubscription() } - public async updateRolesAndFetchFeatures(userUuid: UuidString, roles: RoleName[]): Promise { - const previousRoles = this.roles + hasFirstPartySubscription(): boolean { + if (this.hasFirstPartyOnlineSubscription()) { + return true + } - const userRolesChanged = this.haveRolesChanged(roles) + const offlineRepo = this.getOfflineRepo() + if (!offlineRepo) { + return false + } + + const hasFirstPartyOfflineSubscription = offlineRepo.content.offlineFeaturesUrl === PROD_OFFLINE_FEATURES_URL + return hasFirstPartyOfflineSubscription + } + + async updateOnlineRolesAndFetchFeatures(userUuid: UuidString, roles: string[]): Promise { + const previousRoles = this.onlineRoles + + const userRolesChanged = + roles.some((role) => !this.onlineRoles.includes(role)) || this.onlineRoles.some((role) => !roles.includes(role)) const isInitialLoadRolesChange = previousRoles.length === 0 && userRolesChanged @@ -383,7 +410,7 @@ export class SNFeaturesService this.needsInitialFeaturesUpdate = false - await this.setRoles(roles) + await this.setOnlineRoles(roles) const shouldDownloadRoleBasedFeatures = !this.hasOfflineRepo() @@ -397,22 +424,34 @@ export class SNFeaturesService } if (userRolesChanged && !isInitialLoadRolesChange) { - if (this.rolesIncludePaidSubscription()) { + if (this.onlineRolesIncludePaidSubscription()) { await this.notifyEvent(FeaturesEvent.DidPurchaseSubscription) } } } - async setRoles(roles: RoleName[]): Promise { - const rolesChanged = !arraysEqual(this.roles, roles) + async setOnlineRoles(roles: string[]): Promise { + const rolesChanged = !arraysEqual(this.onlineRoles, roles) - this.roles = roles + this.onlineRoles = roles if (rolesChanged) { void this.notifyEvent(FeaturesEvent.UserRolesChanged) } - this.storageService.setValue(StorageKey.UserRoles, this.roles) + this.storageService.setValue(StorageKey.UserRoles, this.onlineRoles) + } + + async setOfflineRoles(roles: string[]): Promise { + const rolesChanged = !arraysEqual(this.offlineRoles, roles) + + this.offlineRoles = roles + + if (rolesChanged) { + void this.notifyEvent(FeaturesEvent.UserRolesChanged) + } + + this.storageService.setValue(StorageKey.OfflineUserRoles, this.offlineRoles) } public async didDownloadFeatures(features: FeaturesImports.FeatureDescription[]): Promise { @@ -464,29 +503,31 @@ export class SNFeaturesService return nativeFeatureCopy } - public getUserFeature(featureId: FeaturesImports.FeatureIdentifier): FeaturesImports.FeatureDescription | undefined { + public getFeatureThatOriginallyCameFromServer( + featureId: FeaturesImports.FeatureIdentifier, + ): FeaturesImports.FeatureDescription | undefined { return this.features.find((feature) => feature.identifier === featureId) } - rolesIncludePaidSubscription(): boolean { - const unpaidRoles = [RoleName.CoreUser] - return this.roles.some((role) => !unpaidRoles.includes(role)) + onlineRolesIncludePaidSubscription(): boolean { + const unpaidRoles = [RoleName.NAMES.CoreUser] + return this.onlineRoles.some((role) => !unpaidRoles.includes(role)) } - public hasPaidOnlineOrOfflineSubscription(): boolean { - return this.rolesIncludePaidSubscription() || this.hasOfflineRepo() + hasPaidAnyPartyOnlineOrOfflineSubscription(): boolean { + return this.onlineRolesIncludePaidSubscription() || this.hasOfflineRepo() } - public rolesBySorting(roles: RoleName[]): RoleName[] { - return Object.values(RoleName).filter((role) => roles.includes(role)) + public rolesBySorting(roles: string[]): string[] { + return Object.values(RoleName.NAMES).filter((role) => roles.includes(role)) } - public hasMinimumRole(role: RoleName): boolean { - const sortedAllRoles = Object.values(RoleName) + public hasMinimumRole(role: string): boolean { + const sortedAllRoles = Object.values(RoleName.NAMES) - const sortedUserRoles = this.rolesBySorting(this.roles) + const sortedUserRoles = this.rolesBySorting(this.rolesToUseForFeatureCheck()) - const highestUserRoleIndex = sortedAllRoles.indexOf(lastElement(sortedUserRoles) as RoleName) + const highestUserRoleIndex = sortedAllRoles.indexOf(lastElement(sortedUserRoles) as string) const indexOfRoleToCheck = sortedAllRoles.indexOf(role) @@ -507,16 +548,10 @@ export class SNFeaturesService } const nativeFeature = FeaturesImports.FindNativeFeature(featureId) - if (nativeFeature && nativeFeature.availableInRoles) { - const hasRole = this.roles.some((role) => nativeFeature.availableInRoles?.includes(role)) - if (hasRole) { - return FeatureStatus.Entitled - } - } const isDeprecated = this.isFeatureDeprecated(featureId) if (isDeprecated) { - if (this.hasPaidOnlineOrOfflineSubscription()) { + if (this.hasPaidAnyPartyOnlineOrOfflineSubscription()) { return FeatureStatus.Entitled } else { return FeatureStatus.NoUserSubscription @@ -537,7 +572,7 @@ export class SNFeaturesService return FeatureStatus.Entitled } - if (this.hasPaidOnlineOrOfflineSubscription()) { + if (this.hasPaidAnyPartyOnlineOrOfflineSubscription()) { if (!this.completedSuccessfulFeaturesRetrieval) { const hasCachedFeatures = this.features.length > 0 const temporarilyAllowUntilServerUpdates = !hasCachedFeatures @@ -549,25 +584,27 @@ export class SNFeaturesService return FeatureStatus.NoUserSubscription } - const feature = this.getUserFeature(featureId) - if (!feature) { - return FeatureStatus.NotInCurrentPlan - } - - const expired = feature.expires_at && new Date(feature.expires_at).getTime() < new Date().getTime() - if (expired) { - if (!this.roles.includes(feature.role_name as RoleName)) { + if (nativeFeature) { + if (!this.hasFirstPartySubscription()) { return FeatureStatus.NotInCurrentPlan - } else { - return FeatureStatus.InCurrentPlanButExpired + } + + const roles = this.rolesToUseForFeatureCheck() + if (nativeFeature.availableInRoles) { + const hasRole = roles.some((role) => { + return nativeFeature.availableInRoles?.includes(role) + }) + if (!hasRole) { + return FeatureStatus.NotInCurrentPlan + } } } return FeatureStatus.Entitled } - private haveRolesChanged(roles: RoleName[]): boolean { - return roles.some((role) => !this.roles.includes(role)) || this.roles.some((role) => !roles.includes(role)) + private rolesToUseForFeatureCheck(): string[] { + return this.hasFirstPartyOnlineSubscription() ? this.onlineRoles : this.offlineRoles } private componentContentForNativeFeatureDescription(feature: FeaturesImports.FeatureDescription): Models.ItemContent { @@ -775,7 +812,8 @@ export class SNFeaturesService ;(this.removeWebSocketsServiceObserver as unknown) = undefined this.removefeatureReposObserver() ;(this.removefeatureReposObserver as unknown) = undefined - ;(this.roles as unknown) = undefined + ;(this.onlineRoles as unknown) = undefined + ;(this.offlineRoles as unknown) = undefined ;(this.storageService as unknown) = undefined ;(this.apiService as unknown) = undefined ;(this.itemManager as unknown) = undefined @@ -792,7 +830,7 @@ export class SNFeaturesService override getDiagnostics(): Promise { return Promise.resolve({ features: { - roles: this.roles, + roles: this.onlineRoles, features: this.features, enabledExperimentalFeatures: this.enabledExperimentalFeatures, needsInitialFeaturesUpdate: this.needsInitialFeaturesUpdate, diff --git a/packages/snjs/lib/Services/Items/ItemManager.ts b/packages/snjs/lib/Services/Items/ItemManager.ts index b2592c9b3..eee33c739 100644 --- a/packages/snjs/lib/Services/Items/ItemManager.ts +++ b/packages/snjs/lib/Services/Items/ItemManager.ts @@ -1,4 +1,4 @@ -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { assert, naturalSort, removeFromArray, UuidGenerator, Uuids } from '@standardnotes/utils' import { ItemsKeyMutator, SNItemsKey } from '@standardnotes/encryption' import { PayloadManager } from '../Payloads/PayloadManager' @@ -240,7 +240,7 @@ export class ItemManager return this.collection.findAll(uuids) } - private findSystemSmartView(uuid: Uuid): Models.SmartView | undefined { + private findSystemSmartView(uuid: string): Models.SmartView | undefined { return this.systemSmartViews.find((view) => view.uuid === uuid) } diff --git a/packages/snjs/lib/Services/KeyRecovery/KeyRecoveryService.ts b/packages/snjs/lib/Services/KeyRecovery/KeyRecoveryService.ts index 2da7f193a..62cc56f01 100644 --- a/packages/snjs/lib/Services/KeyRecovery/KeyRecoveryService.ts +++ b/packages/snjs/lib/Services/KeyRecovery/KeyRecoveryService.ts @@ -15,7 +15,7 @@ import { DiskStorageService } from '../Storage/DiskStorageService' import { PayloadManager } from '../Payloads/PayloadManager' import { ChallengeService } from '../Challenge' import { SNApiService } from '@Lib/Services/Api/ApiService' -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { ItemManager } from '../Items/ItemManager' import { removeFromArray, Uuids } from '@standardnotes/utils' import { ClientDisplayableError, KeyParamsResponse } from '@standardnotes/responses' @@ -240,7 +240,7 @@ export class SNKeyRecoveryService extends AbstractService boolean requestNewListedAccount: () => Promise getListedAccounts(): Promise - getListedAccountInfo(account: ListedAccount, inContextOfItem?: Uuid): Promise + getListedAccountInfo(account: ListedAccount, inContextOfItem?: string): Promise isNoteAuthorizedForListed(note: SNNote): boolean authorizeNoteForListed(note: SNNote): Promise } diff --git a/packages/snjs/lib/Services/Payloads/PayloadManager.ts b/packages/snjs/lib/Services/Payloads/PayloadManager.ts index d7b086cf0..6ab84667b 100644 --- a/packages/snjs/lib/Services/Payloads/PayloadManager.ts +++ b/packages/snjs/lib/Services/Payloads/PayloadManager.ts @@ -1,4 +1,4 @@ -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { PayloadsChangeObserver, QueueElement, PayloadsChangeObserverCallback, EmitQueue } from './Types' import { removeFromArray, Uuids } from '@standardnotes/utils' import { @@ -66,11 +66,11 @@ export class PayloadManager extends AbstractService implements PayloadManagerInt this.collection = new PayloadCollection() } - public find(uuids: Uuid[]): FullyFormedPayloadInterface[] { + public find(uuids: string[]): FullyFormedPayloadInterface[] { return this.collection.findAll(uuids) } - public findOne(uuid: Uuid): FullyFormedPayloadInterface | undefined { + public findOne(uuid: string): FullyFormedPayloadInterface | undefined { return this.collection.findAll([uuid])[0] } @@ -288,7 +288,7 @@ export class PayloadManager extends AbstractService implements PayloadManagerInt * and marks the items as dirty. * @returns Resulting items */ - public async importPayloads(payloads: DecryptedPayloadInterface[], historyMap: HistoryMap): Promise { + public async importPayloads(payloads: DecryptedPayloadInterface[], historyMap: HistoryMap): Promise { const sourcedPayloads = payloads.map((p) => p.copy(undefined, PayloadSource.FileImport)) const delta = new DeltaFileImport(this.getMasterCollection(), sourcedPayloads, historyMap) diff --git a/packages/snjs/lib/Services/Session/Sessions/Types.ts b/packages/snjs/lib/Services/Session/Sessions/Types.ts index ddcb4f447..6fea67bc5 100644 --- a/packages/snjs/lib/Services/Session/Sessions/Types.ts +++ b/packages/snjs/lib/Services/Session/Sessions/Types.ts @@ -1,5 +1,3 @@ -import { Uuid } from '@standardnotes/common' - export type RawJwtPayload = { jwt?: string } @@ -15,7 +13,7 @@ export type RawSessionPayload = { export type RawStorageValue = RawJwtPayload | RawSessionPayload export type RemoteSession = { - uuid: Uuid + uuid: string updated_at: Date device_info: string current: boolean diff --git a/packages/snjs/lib/Services/Settings/SNSettingsService.ts b/packages/snjs/lib/Services/Settings/SNSettingsService.ts index cc4621be7..89f7632e0 100644 --- a/packages/snjs/lib/Services/Settings/SNSettingsService.ts +++ b/packages/snjs/lib/Services/Settings/SNSettingsService.ts @@ -66,10 +66,9 @@ export class SNSettingsService extends AbstractService implements SettingsClient return this.frequencyOptionsLabels[frequency] } - getCloudProviderIntegrationUrl(cloudProviderName: CloudProvider, isDevEnvironment: boolean): string { - const { Dev, Prod } = ExtensionsServerURL - const extServerUrl = isDevEnvironment ? Dev : Prod - return `${extServerUrl}/${this.cloudProviderIntegrationUrlEndpoints[cloudProviderName]}?redirect_url=${extServerUrl}/components/cloudlink?` + getCloudProviderIntegrationUrl(cloudProviderName: CloudProvider): string { + const { Prod } = ExtensionsServerURL + return `${Prod}/${this.cloudProviderIntegrationUrlEndpoints[cloudProviderName]}?redirect_url=${Prod}/components/cloudlink?` } override deinit(): void { diff --git a/packages/snjs/lib/Services/Storage/DiskStorageService.ts b/packages/snjs/lib/Services/Storage/DiskStorageService.ts index 4a01cb0d9..25bb88581 100644 --- a/packages/snjs/lib/Services/Storage/DiskStorageService.ts +++ b/packages/snjs/lib/Services/Storage/DiskStorageService.ts @@ -1,4 +1,4 @@ -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { Copy, extendArray, UuidGenerator } from '@standardnotes/utils' import { SNLog } from '../../Log' import { isErrorDecryptingParameters, SNRootKey } from '@standardnotes/encryption' @@ -448,7 +448,7 @@ export class DiskStorageService extends Services.AbstractService implements Serv await Promise.all(payloads.map((payload) => this.deletePayloadWithId(payload.uuid))) } - public async deletePayloadWithId(uuid: Uuid) { + public async deletePayloadWithId(uuid: string) { return this.executeCriticalFunction(async () => { return this.deviceInterface.removeDatabaseEntry(uuid, this.identifier) }) diff --git a/packages/snjs/lib/index.ts b/packages/snjs/lib/index.ts index d3821b4a6..92d8f264a 100644 --- a/packages/snjs/lib/index.ts +++ b/packages/snjs/lib/index.ts @@ -8,6 +8,7 @@ export * from './Services' export * from './Types' export * from './Version' export * from '@standardnotes/common' +export * from '@standardnotes/domain-core' export * from '@standardnotes/encryption' export * from '@standardnotes/features' export * from '@standardnotes/files' diff --git a/packages/snjs/mocha/features.test.js b/packages/snjs/mocha/features.test.js index 7b624dc5f..31419d60d 100644 --- a/packages/snjs/mocha/features.test.js +++ b/packages/snjs/mocha/features.test.js @@ -60,8 +60,8 @@ describe('features', () => { describe('new user roles received on api response meta', () => { it('should save roles and features', async () => { - expect(application.featuresService.roles).to.have.lengthOf(1) - expect(application.featuresService.roles[0]).to.equal('CORE_USER') + expect(application.featuresService.onlineRoles).to.have.lengthOf(1) + expect(application.featuresService.onlineRoles[0]).to.equal('CORE_USER') expect(application.featuresService.features).to.have.lengthOf(3) expect(application.featuresService.features[0]).to.containSubset(midnightThemeFeature) @@ -115,7 +115,7 @@ describe('features', () => { // Wipe items from initial sync await application.itemManager.removeAllItemsFromMemory() // Wipe roles from initial sync - await application.featuresService.setRoles([]) + await application.featuresService.setOnlineRoles([]) // Create pre-existing item for theme without all the info await application.itemManager.createItem( ContentType.Theme, @@ -165,7 +165,7 @@ describe('features', () => { .find((theme) => theme.identifier === midnightThemeFeature.identifier) // Wipe roles from initial sync - await application.featuresService.setRoles([]) + await application.featuresService.setOnlineRoles([]) // Call sync intentionally to get roles again in meta await application.sync.sync() @@ -184,7 +184,7 @@ describe('features', () => { }) it('should provide feature', async () => { - const feature = application.features.getUserFeature(FeatureIdentifier.PlusEditor) + const feature = application.features.getFeatureThatOriginallyCameFromServer(FeatureIdentifier.PlusEditor) expect(feature).to.containSubset(plusEditorFeature) }) diff --git a/packages/snjs/mocha/history.test.js b/packages/snjs/mocha/history.test.js index bed7de3bb..8f518a69f 100644 --- a/packages/snjs/mocha/history.test.js +++ b/packages/snjs/mocha/history.test.js @@ -5,7 +5,7 @@ import { createNoteParams } from './lib/Items.js' chai.use(chaiAsPromised) const expect = chai.expect -describe('history manager', () => { +describe.skip('history manager', () => { const largeCharacterChange = 25 const syncOptions = { @@ -277,7 +277,7 @@ describe('history manager', () => { await Factory.safeDeinit(this.application) }) - it('response from server should be empty if not signed in', async function () { + it('response from server should be failed if not signed in', async function () { await this.application.user.signOut() this.application = await Factory.createInitAppWithFakeCrypto() this.historyManager = this.application.historyManager @@ -286,8 +286,7 @@ describe('history manager', () => { await this.application.syncService.sync(syncOptions) const itemHistoryOrError = await this.application.listRevisions.execute({ itemUuid: item.uuid }) - expect(itemHistoryOrError.isFailed()).to.equal(false) - expect(itemHistoryOrError.getValue().length).to.equal(0) + expect(itemHistoryOrError.isFailed()).to.equal(true) }) it('create basic history entries 2', async function () { @@ -295,8 +294,6 @@ describe('history manager', () => { await Factory.sleep(Factory.ServerRevisionCreationDelay) let itemHistoryOrError = await this.application.listRevisions.execute({ itemUuid: item.uuid }) - expect(itemHistoryOrError.isFailed()).to.equal(false) - let itemHistory = itemHistoryOrError.getValue() /** Server history should save initial revision */ @@ -305,8 +302,6 @@ describe('history manager', () => { /** Sync within 5 seconds (ENV VAR dependend on self-hosted setup), should not create a new entry */ await Factory.markDirtyAndSyncItem(this.application, item) itemHistoryOrError = await this.application.listRevisions.execute({ itemUuid: item.uuid }) - expect(itemHistoryOrError.isFailed()).to.equal(false) - itemHistory = itemHistoryOrError.getValue() expect(itemHistory.length).to.equal(1) @@ -322,8 +317,6 @@ describe('history manager', () => { ) await Factory.sleep(Factory.ServerRevisionCreationDelay) itemHistoryOrError = await this.application.listRevisions.execute({ itemUuid: item.uuid }) - expect(itemHistoryOrError.isFailed()).to.equal(false) - itemHistory = itemHistoryOrError.getValue() expect(itemHistory.length).to.equal(1) }) @@ -346,15 +339,11 @@ describe('history manager', () => { await Factory.sleep(Factory.ServerRevisionCreationDelay) const itemHistoryOrError = await this.application.listRevisions.execute({ itemUuid: item.uuid }) - expect(itemHistoryOrError.isFailed()).to.equal(false) - const itemHistory = itemHistoryOrError.getValue() expect(itemHistory.length).to.equal(2) const oldestEntry = lastElement(itemHistory) let revisionFromServerOrError = await this.application.getRevision.execute({ itemUuid: item.uuid, revisionUuid: oldestEntry.uuid }) - expect(revisionFromServerOrError.isFailed()).to.equal(false) - const revisionFromServer = revisionFromServerOrError.getValue() expect(revisionFromServer).to.be.ok @@ -376,12 +365,9 @@ describe('history manager', () => { await Factory.sleep(Factory.ServerRevisionCreationDelay) const dupeHistoryOrError = await this.application.listRevisions.execute({ itemUuid: dupe.uuid }) - expect(dupeHistoryOrError.isFailed()).to.equal(false) const dupeHistory = dupeHistoryOrError.getValue() const dupeRevisionOrError = await this.application.getRevision.execute({ itemUuid: dupe.uuid, revisionUuid: dupeHistory[0].uuid }) - expect(dupeRevisionOrError.isFailed()).to.equal(false) - const dupeRevision = dupeRevisionOrError.getValue() expect(dupeRevision.payload.uuid).to.equal(dupe.uuid) }) @@ -405,11 +391,9 @@ describe('history manager', () => { const expectedRevisions = 4 const noteHistoryOrError = await this.application.listRevisions.execute({ itemUuid: note.uuid }) - expect(noteHistoryOrError.isFailed()).to.equal(false) const noteHistory = noteHistoryOrError.getValue() const dupeHistoryOrError = await this.application.listRevisions.execute({ itemUuid: dupe.uuid }) - expect(dupeHistoryOrError.isFailed()).to.equal(false) const dupeHistory = dupeHistoryOrError.getValue() expect(noteHistory.length).to.equal(expectedRevisions) @@ -432,15 +416,11 @@ describe('history manager', () => { await Factory.sleep(Factory.ServerRevisionCreationDelay) const itemHistoryOrError = await this.application.listRevisions.execute({ itemUuid: dupe.uuid }) - expect(itemHistoryOrError.isFailed()).to.equal(false) - const itemHistory = itemHistoryOrError.getValue() expect(itemHistory.length).to.be.above(1) const newestRevision = itemHistory[0] const fetchedOrError = await this.application.getRevision.execute({ itemUuid: dupe.uuid, revisionUuid: newestRevision.uuid }) - expect(fetchedOrError.isFailed()).to.equal(false) - const fetched = fetchedOrError.getValue() expect(fetched.payload.errorDecrypting).to.not.be.ok expect(fetched.payload.content.title).to.equal(changedText) diff --git a/packages/snjs/mocha/keys.test.js b/packages/snjs/mocha/keys.test.js index 222f483ff..bbdd4d46b 100644 --- a/packages/snjs/mocha/keys.test.js +++ b/packages/snjs/mocha/keys.test.js @@ -645,6 +645,8 @@ describe('keys', function () { expect(Object.keys(clientBUndecryptables).length).to.equal(1) expect(Object.keys(clientAUndecryptables).length).to.equal(0) + + await contextB.deinit() }) describe('changing password on 003 client while signed into 004 client should', function () { diff --git a/packages/snjs/mocha/sync_tests/conflicting.test.js b/packages/snjs/mocha/sync_tests/conflicting.test.js index 07d3be138..1c5c3817a 100644 --- a/packages/snjs/mocha/sync_tests/conflicting.test.js +++ b/packages/snjs/mocha/sync_tests/conflicting.test.js @@ -40,7 +40,7 @@ describe('online conflict handling', function () { afterEach(async function () { if (!this.application.dealloced) { - await Factory.safeDeinit(this.application) + await this.context.deinit() } localStorage.clear() }) @@ -950,6 +950,7 @@ describe('online conflict handling', function () { expect(contextA.findNoteByTitle('title-B').payload.updated_at_timestamp).to.equal(noteBExpectedTimestamp) await this.sharedFinalAssertions() + await contextB.deinit() }).timeout(20000) it('editing original note many times after conflict on other client should only result in 2 cumulative notes', async function () { @@ -979,5 +980,6 @@ describe('online conflict handling', function () { expect(contextB.noteCount).to.equal(2) await this.sharedFinalAssertions() + await contextB.deinit() }).timeout(20000) }) diff --git a/packages/snjs/mocha/sync_tests/online.test.js b/packages/snjs/mocha/sync_tests/online.test.js index ffbbda1cd..1ab803218 100644 --- a/packages/snjs/mocha/sync_tests/online.test.js +++ b/packages/snjs/mocha/sync_tests/online.test.js @@ -1052,5 +1052,7 @@ describe('online syncing', function () { await contextB.sync() expect(contextB.application.items.allCountableNotesCount()).to.equal(0) + + await contextB.deinit() }) }) diff --git a/packages/snjs/package.json b/packages/snjs/package.json index f19e26232..cf696cb4a 100644 --- a/packages/snjs/package.json +++ b/packages/snjs/package.json @@ -1,6 +1,6 @@ { "name": "@standardnotes/snjs", - "version": "2.164.0", + "version": "2.164.7", "engines": { "node": ">=16.0.0 <17.0.0" }, @@ -36,14 +36,14 @@ "@babel/core": "*", "@babel/preset-env": "*", "@standardnotes/api": "workspace:*", - "@standardnotes/common": "^1.45.0", - "@standardnotes/domain-events": "^2.88.0", + "@standardnotes/common": "^1.46.4", + "@standardnotes/domain-events": "^2.106.0", "@standardnotes/encryption": "workspace:*", "@standardnotes/features": "workspace:*", "@standardnotes/files": "workspace:*", "@standardnotes/models": "workspace:*", "@standardnotes/responses": "workspace:*", - "@standardnotes/security": "^1.7.0", + "@standardnotes/security": "^1.7.5", "@standardnotes/services": "workspace:*", "@standardnotes/settings": "^1.19.0", "@standardnotes/sncrypto-common": "workspace:*", @@ -86,6 +86,6 @@ "webpack-merge": "^5.8.0" }, "dependencies": { - "@standardnotes/domain-core": "^1.11.0" + "@standardnotes/domain-core": "^1.11.1" } } diff --git a/packages/ui-services/CHANGELOG.md b/packages/ui-services/CHANGELOG.md index 6f0ade2bb..eb7d39b7d 100644 --- a/packages/ui-services/CHANGELOG.md +++ b/packages/ui-services/CHANGELOG.md @@ -3,6 +3,34 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.24.11](https://github.com/standardnotes/app/compare/@standardnotes/ui-services@1.24.10...@standardnotes/ui-services@1.24.11) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/ui-services + +## [1.24.10](https://github.com/standardnotes/app/compare/@standardnotes/ui-services@1.24.9...@standardnotes/ui-services@1.24.10) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/ui-services + +## [1.24.9](https://github.com/standardnotes/app/compare/@standardnotes/ui-services@1.24.8...@standardnotes/ui-services@1.24.9) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/ui-services + +## [1.24.8](https://github.com/standardnotes/app/compare/@standardnotes/ui-services@1.24.7...@standardnotes/ui-services@1.24.8) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/ui-services + +## [1.24.7](https://github.com/standardnotes/app/compare/@standardnotes/ui-services@1.24.6...@standardnotes/ui-services@1.24.7) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/ui-services + +## [1.24.6](https://github.com/standardnotes/app/compare/@standardnotes/ui-services@1.24.5...@standardnotes/ui-services@1.24.6) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/ui-services + +## [1.24.5](https://github.com/standardnotes/app/compare/@standardnotes/ui-services@1.24.4...@standardnotes/ui-services@1.24.5) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/ui-services + ## [1.24.4](https://github.com/standardnotes/app/compare/@standardnotes/ui-services@1.24.3...@standardnotes/ui-services@1.24.4) (2023-01-18) **Note:** Version bump only for package @standardnotes/ui-services diff --git a/packages/ui-services/package.json b/packages/ui-services/package.json index adb275484..2dc255eb0 100644 --- a/packages/ui-services/package.json +++ b/packages/ui-services/package.json @@ -1,6 +1,6 @@ { "name": "@standardnotes/ui-services", - "version": "1.24.4", + "version": "1.24.11", "engines": { "node": ">=16.0.0 <17.0.0" }, @@ -15,7 +15,7 @@ "test": "jest spec" }, "dependencies": { - "@standardnotes/common": "^1.45.0", + "@standardnotes/common": "^1.46.4", "@standardnotes/features": "workspace:^", "@standardnotes/filepicker": "workspace:^", "@standardnotes/services": "workspace:^", diff --git a/packages/ui-services/src/Route/Params/SubscriptionInviteParams.ts b/packages/ui-services/src/Route/Params/SubscriptionInviteParams.ts index 979f70ea9..90052a5d6 100644 --- a/packages/ui-services/src/Route/Params/SubscriptionInviteParams.ts +++ b/packages/ui-services/src/Route/Params/SubscriptionInviteParams.ts @@ -1,5 +1,3 @@ -import { Uuid } from '@standardnotes/common' - export type SubscriptionInviteParams = { - inviteUuid: Uuid + inviteUuid: string } diff --git a/packages/ui-services/src/Route/RouteParser.ts b/packages/ui-services/src/Route/RouteParser.ts index cd753e43a..83cc4fb78 100644 --- a/packages/ui-services/src/Route/RouteParser.ts +++ b/packages/ui-services/src/Route/RouteParser.ts @@ -1,4 +1,4 @@ -import { UserRequestType, Uuid } from '@standardnotes/common' +import { UserRequestType } from '@standardnotes/common' import { PreferenceId } from './../Preferences/PreferenceId' import { DemoParams } from './Params/DemoParams' import { OnboardingParams } from './Params/OnboardingParams' @@ -41,7 +41,7 @@ export class RouteParser implements RouteParserInterface { this.checkForProperRouteType(RouteType.AcceptSubscriptionInvite) return { - inviteUuid: this.searchParams.get(RootQueryParam.AcceptSubscriptionInvite) as Uuid, + inviteUuid: this.searchParams.get(RootQueryParam.AcceptSubscriptionInvite) as string, } } diff --git a/packages/ui-services/src/Theme/ThemeManager.ts b/packages/ui-services/src/Theme/ThemeManager.ts index fa027e202..9f819127d 100644 --- a/packages/ui-services/src/Theme/ThemeManager.ts +++ b/packages/ui-services/src/Theme/ThemeManager.ts @@ -1,5 +1,5 @@ import { dismissToast, ToastType, addTimedToast } from '@standardnotes/toast' -import { ContentType, Uuid } from '@standardnotes/common' +import { ContentType } from '@standardnotes/common' import { CreateDecryptedLocalStorageContextPayload, LocalStorageDecryptedContextualPayload, @@ -23,7 +23,7 @@ const TimeBeforeApplyingColorScheme = 5 const DefaultThemeIdentifier = 'Default' export class ThemeManager extends AbstractService { - private activeThemes: Uuid[] = [] + private activeThemes: string[] = [] private unregisterDesktop?: () => void private unregisterStream!: () => void private lastUseDeviceThemeSettings = false diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 2bf6d0ea2..2810a866e 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.16.2](https://github.com/standardnotes/app/compare/@standardnotes/utils@1.16.1...@standardnotes/utils@1.16.2) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/utils + +## [1.16.1](https://github.com/standardnotes/app/compare/@standardnotes/utils@1.16.0...@standardnotes/utils@1.16.1) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/utils + # [1.16.0](https://github.com/standardnotes/app/compare/@standardnotes/utils@1.15.2...@standardnotes/utils@1.16.0) (2023-01-12) ### Features diff --git a/packages/utils/package.json b/packages/utils/package.json index 0ea6d8c54..84a8acd1f 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@standardnotes/utils", - "version": "1.16.0", + "version": "1.16.2", "engines": { "node": ">=16.0.0 <17.0.0" }, @@ -25,7 +25,7 @@ "test": "jest spec" }, "dependencies": { - "@standardnotes/common": "^1.45.0", + "@standardnotes/common": "^1.46.4", "dompurify": "^2.4.1", "lodash": "^4.17.21", "reflect-metadata": "^0.1.13" diff --git a/packages/utils/src/Domain/Uuid/UuidMap.ts b/packages/utils/src/Domain/Uuid/UuidMap.ts index bcd58586e..917ae4eed 100644 --- a/packages/utils/src/Domain/Uuid/UuidMap.ts +++ b/packages/utils/src/Domain/Uuid/UuidMap.ts @@ -1,4 +1,3 @@ -import { Uuid } from '@standardnotes/common' import { addIfUnique, removeFromArray } from '../Utils/Utils' /** @@ -7,9 +6,9 @@ import { addIfUnique, removeFromArray } from '../Utils/Utils' */ export class UuidMap { /** uuid to uuids that we have a relationship with */ - private directMap: Partial> = {} + private directMap: Partial> = {} /** uuid to uuids that have a relationship with us */ - private inverseMap: Partial> = {} + private inverseMap: Partial> = {} public makeCopy(): UuidMap { const copy = new UuidMap() @@ -18,25 +17,25 @@ export class UuidMap { return copy } - public getDirectRelationships(uuid: Uuid): Uuid[] { + public getDirectRelationships(uuid: string): string[] { return this.directMap[uuid] || [] } - public getInverseRelationships(uuid: Uuid): Uuid[] { + public getInverseRelationships(uuid: string): string[] { return this.inverseMap[uuid] || [] } - public establishRelationship(uuidA: Uuid, uuidB: Uuid): void { + public establishRelationship(uuidA: string, uuidB: string): void { this.establishDirectRelationship(uuidA, uuidB) this.establishInverseRelationship(uuidA, uuidB) } - public deestablishRelationship(uuidA: Uuid, uuidB: Uuid): void { + public deestablishRelationship(uuidA: string, uuidB: string): void { this.deestablishDirectRelationship(uuidA, uuidB) this.deestablishInverseRelationship(uuidA, uuidB) } - public setAllRelationships(uuid: Uuid, relationships: Uuid[]): void { + public setAllRelationships(uuid: string, relationships: string[]): void { const previousDirect = this.directMap[uuid] || [] this.directMap[uuid] = relationships @@ -53,7 +52,7 @@ export class UuidMap { } } - public removeFromMap(uuid: Uuid): void { + public removeFromMap(uuid: string): void { /** Items that we reference */ const directReferences = this.directMap[uuid] || [] for (const directReference of directReferences) { @@ -69,25 +68,25 @@ export class UuidMap { delete this.inverseMap[uuid] } - private establishDirectRelationship(uuidA: Uuid, uuidB: Uuid): void { + private establishDirectRelationship(uuidA: string, uuidB: string): void { const index = this.directMap[uuidA] || [] addIfUnique(index, uuidB) this.directMap[uuidA] = index } - private establishInverseRelationship(uuidA: Uuid, uuidB: Uuid): void { + private establishInverseRelationship(uuidA: string, uuidB: string): void { const inverseIndex = this.inverseMap[uuidB] || [] addIfUnique(inverseIndex, uuidA) this.inverseMap[uuidB] = inverseIndex } - private deestablishDirectRelationship(uuidA: Uuid, uuidB: Uuid): void { + private deestablishDirectRelationship(uuidA: string, uuidB: string): void { const index = this.directMap[uuidA] || [] removeFromArray(index, uuidB) this.directMap[uuidA] = index } - private deestablishInverseRelationship(uuidA: Uuid, uuidB: Uuid): void { + private deestablishInverseRelationship(uuidA: string, uuidB: string): void { const inverseIndex = this.inverseMap[uuidB] || [] removeFromArray(inverseIndex, uuidA) this.inverseMap[uuidB] = inverseIndex diff --git a/packages/web/CHANGELOG.md b/packages/web/CHANGELOG.md index 0863aad7c..7403403c5 100644 --- a/packages/web/CHANGELOG.md +++ b/packages/web/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.140.8](https://github.com/standardnotes/app/compare/@standardnotes/web@3.140.6...@standardnotes/web@3.140.8) (2023-01-20) + +### Bug Fixes + +* fixed issue with third party editors not loading ([#2174](https://github.com/standardnotes/app/issues/2174)) ([e7214ea](https://github.com/standardnotes/app/commit/e7214ea73ad5d3026d958c79022d2238a4d1cfdc)) + +## [3.140.6](https://github.com/standardnotes/app/compare/@standardnotes/web@3.140.5...@standardnotes/web@3.140.6) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/web + +## [3.140.5](https://github.com/standardnotes/app/compare/@standardnotes/web@3.140.4...@standardnotes/web@3.140.5) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/web + +## [3.140.4](https://github.com/standardnotes/app/compare/@standardnotes/web@3.140.3...@standardnotes/web@3.140.4) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/web + +## [3.140.3](https://github.com/standardnotes/app/compare/@standardnotes/web@3.140.2...@standardnotes/web@3.140.3) (2023-01-20) + +**Note:** Version bump only for package @standardnotes/web + +## [3.140.2](https://github.com/standardnotes/app/compare/@standardnotes/web@3.140.1...@standardnotes/web@3.140.2) (2023-01-19) + +**Note:** Version bump only for package @standardnotes/web + +## [3.140.1](https://github.com/standardnotes/app/compare/@standardnotes/web@3.140.0...@standardnotes/web@3.140.1) (2023-01-19) + +### Bug Fixes + +* Fixed issue where using arrow keys while renaming file would navigate to another file ([2d63b74](https://github.com/standardnotes/app/commit/2d63b7431a1e6afcd9e6cf8b48c6c8e580221001)) + # [3.140.0](https://github.com/standardnotes/app/compare/@standardnotes/web@3.139.0...@standardnotes/web@3.140.0) (2023-01-18) ### Bug Fixes @@ -18,7 +50,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline ### Features * Added rename option to file preview modal ([aa88966](https://github.com/standardnotes/app/commit/aa8896678315de67551c786e64aec7dfd10479e3)) -* **snjs:** add revisions api v2 ([#2154](https://github.com/standardnotes/app/issues/2154)) ([880a537](https://github.com/standardnotes/app/commit/880a537774ddcefaedb0d4e5dc50b363f4b93e01)) ## [3.138.6](https://github.com/standardnotes/app/compare/@standardnotes/web@3.138.5...@standardnotes/web@3.138.6) (2023-01-17) diff --git a/packages/web/CHANGELOG.md.json b/packages/web/CHANGELOG.md.json index 480503471..06b695d2e 100644 --- a/packages/web/CHANGELOG.md.json +++ b/packages/web/CHANGELOG.md.json @@ -1,5 +1,88 @@ { "versions": [ + { + "version": "3.140.8", + "title": "[3.140.8](https://github.com/standardnotes/app/compare/@standardnotes/web@3.140.6...@standardnotes/web@3.140.8) (2023-01-20)", + "date": null, + "body": "### Bug Fixes\n\n* fixed issue with third party editors not loading ([#2174](https://github.com/standardnotes/app/issues/2174)) ([e7214ea](https://github.com/standardnotes/app/commit/e7214ea73ad5d3026d958c79022d2238a4d1cfdc))", + "parsed": { + "_": [ + "fixed issue with third party editors not loading (#2174) (e7214ea)" + ], + "Bug Fixes": [ + "fixed issue with third party editors not loading (#2174) (e7214ea)" + ] + } + }, + { + "version": "3.140.6", + "title": "[3.140.6](https://github.com/standardnotes/app/compare/@standardnotes/web@3.140.5...@standardnotes/web@3.140.6) (2023-01-20)", + "date": null, + "body": "**Note:** Version bump only for package @standardnotes/web", + "parsed": { + "_": [ + "Note: Version bump only for package @standardnotes/web" + ] + } + }, + { + "version": "3.140.5", + "title": "[3.140.5](https://github.com/standardnotes/app/compare/@standardnotes/web@3.140.4...@standardnotes/web@3.140.5) (2023-01-20)", + "date": null, + "body": "**Note:** Version bump only for package @standardnotes/web", + "parsed": { + "_": [ + "Note: Version bump only for package @standardnotes/web" + ] + } + }, + { + "version": "3.140.4", + "title": "[3.140.4](https://github.com/standardnotes/app/compare/@standardnotes/web@3.140.3...@standardnotes/web@3.140.4) (2023-01-20)", + "date": null, + "body": "**Note:** Version bump only for package @standardnotes/web", + "parsed": { + "_": [ + "Note: Version bump only for package @standardnotes/web" + ] + } + }, + { + "version": "3.140.3", + "title": "[3.140.3](https://github.com/standardnotes/app/compare/@standardnotes/web@3.140.2...@standardnotes/web@3.140.3) (2023-01-20)", + "date": null, + "body": "**Note:** Version bump only for package @standardnotes/web", + "parsed": { + "_": [ + "Note: Version bump only for package @standardnotes/web" + ] + } + }, + { + "version": "3.140.2", + "title": "[3.140.2](https://github.com/standardnotes/app/compare/@standardnotes/web@3.140.1...@standardnotes/web@3.140.2) (2023-01-19)", + "date": null, + "body": "**Note:** Version bump only for package @standardnotes/web", + "parsed": { + "_": [ + "Note: Version bump only for package @standardnotes/web" + ] + } + }, + { + "version": "3.140.1", + "title": "[3.140.1](https://github.com/standardnotes/app/compare/@standardnotes/web@3.140.0...@standardnotes/web@3.140.1) (2023-01-19)", + "date": null, + "body": "### Bug Fixes\n\n* Fixed issue where using arrow keys while renaming file would navigate to another file ([2d63b74](https://github.com/standardnotes/app/commit/2d63b7431a1e6afcd9e6cf8b48c6c8e580221001))", + "parsed": { + "_": [ + "Fixed issue where using arrow keys while renaming file would navigate to another file (2d63b74)" + ], + "Bug Fixes": [ + "Fixed issue where using arrow keys while renaming file would navigate to another file (2d63b74)" + ] + } + }, { "version": "3.140.0", "title": "[3.140.0](https://github.com/standardnotes/app/compare/@standardnotes/web@3.139.0...@standardnotes/web@3.140.0) (2023-01-18)", @@ -22,15 +105,13 @@ "version": "3.139.0", "title": "[3.139.0](https://github.com/standardnotes/app/compare/@standardnotes/web@3.138.6...@standardnotes/web@3.139.0) (2023-01-18)", "date": null, - "body": "### Features\n\n* Added rename option to file preview modal ([aa88966](https://github.com/standardnotes/app/commit/aa8896678315de67551c786e64aec7dfd10479e3))\n* **snjs:** add revisions api v2 ([#2154](https://github.com/standardnotes/app/issues/2154)) ([880a537](https://github.com/standardnotes/app/commit/880a537774ddcefaedb0d4e5dc50b363f4b93e01))", + "body": "### Features\n\n* Added rename option to file preview modal ([aa88966](https://github.com/standardnotes/app/commit/aa8896678315de67551c786e64aec7dfd10479e3))", "parsed": { "_": [ - "Added rename option to file preview modal (aa88966)", - "snjs: add revisions api v2 (#2154) (880a537)" + "Added rename option to file preview modal (aa88966)" ], "Features": [ - "Added rename option to file preview modal (aa88966)", - "snjs: add revisions api v2 (#2154) (880a537)" + "Added rename option to file preview modal (aa88966)" ] } }, diff --git a/packages/web/package.json b/packages/web/package.json index 73de8e1fa..ff171e42b 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,6 +1,6 @@ { "name": "@standardnotes/web", - "version": "3.140.0", + "version": "3.140.8", "license": "AGPL-3.0-or-later", "main": "dist/app.js", "author": "Standard Notes.", diff --git a/packages/web/src/javascripts/Components/Footer/UpgradeNow.tsx b/packages/web/src/javascripts/Components/Footer/UpgradeNow.tsx index edd18750a..719b08a99 100644 --- a/packages/web/src/javascripts/Components/Footer/UpgradeNow.tsx +++ b/packages/web/src/javascripts/Components/Footer/UpgradeNow.tsx @@ -13,6 +13,7 @@ type Props = { const UpgradeNow = ({ application, featuresController, subscriptionContoller }: Props) => { const shouldShowCTA = !featuresController.hasFolders const hasAccount = subscriptionContoller.hasAccount + const hasAccessToFeatures = subscriptionContoller.hasFirstPartySubscription const onClick = useCallback(() => { if (hasAccount && application.isNativeIOS()) { @@ -22,16 +23,20 @@ const UpgradeNow = ({ application, featuresController, subscriptionContoller }: } }, [application, hasAccount]) - return shouldShowCTA ? ( + if (!shouldShowCTA || hasAccessToFeatures) { + return null + } + + return (

- ) : null + ) } export default observer(UpgradeNow) diff --git a/packages/web/src/javascripts/Components/Preferences/Panes/Account/Email.tsx b/packages/web/src/javascripts/Components/Preferences/Panes/Account/Email.tsx index deaba555b..fa6306631 100644 --- a/packages/web/src/javascripts/Components/Preferences/Panes/Account/Email.tsx +++ b/packages/web/src/javascripts/Components/Preferences/Panes/Account/Email.tsx @@ -99,7 +99,7 @@ const Email: FunctionComponent = ({ application }: Props) => { Disable sign-in notification emails Disables email notifications when a new sign-in occurs on your account. (Email notifications are - available to paid subscribers). + available only to paid subscribers). {isLoading ? ( diff --git a/packages/web/src/javascripts/Components/Preferences/Panes/Account/Subscription/Subscription.tsx b/packages/web/src/javascripts/Components/Preferences/Panes/Account/Subscription/Subscription.tsx index 6d7ffdf67..f8b111167 100644 --- a/packages/web/src/javascripts/Components/Preferences/Panes/Account/Subscription/Subscription.tsx +++ b/packages/web/src/javascripts/Components/Preferences/Panes/Account/Subscription/Subscription.tsx @@ -15,7 +15,7 @@ type Props = { const Subscription: FunctionComponent = ({ application, viewControllerManager }: Props) => { const subscriptionState = viewControllerManager.subscriptionController - const { userSubscription } = subscriptionState + const { onlineSubscription } = subscriptionState const now = new Date().getTime() @@ -25,7 +25,7 @@ const Subscription: FunctionComponent = ({ application, viewControllerMan
Subscription - {userSubscription && userSubscription.endsAt > now ? ( + {onlineSubscription && onlineSubscription.endsAt > now ? ( ) : ( diff --git a/packages/web/src/javascripts/Components/Preferences/Panes/Account/SubscriptionSharing/InvitationsList.tsx b/packages/web/src/javascripts/Components/Preferences/Panes/Account/SubscriptionSharing/InvitationsList.tsx index d10d8f6b5..36c906f8f 100644 --- a/packages/web/src/javascripts/Components/Preferences/Panes/Account/SubscriptionSharing/InvitationsList.tsx +++ b/packages/web/src/javascripts/Components/Preferences/Panes/Account/SubscriptionSharing/InvitationsList.tsx @@ -1,6 +1,6 @@ import { useState } from 'react' import { observer } from 'mobx-react-lite' -import { InvitationStatus, Uuid } from '@standardnotes/snjs' +import { InvitationStatus } from '@standardnotes/snjs' import { SubtitleLight, Text } from '@/Components/Preferences/PreferencesComponents/Content' import { SubscriptionController } from '@/Controllers/Subscription/SubscriptionController' @@ -25,7 +25,7 @@ const InvitationsList = ({ subscriptionState, application }: Props) => { [InvitationStatus.Declined, InvitationStatus.Canceled].includes(invitation.status), ) - const handleCancel = async (invitationUuid: Uuid) => { + const handleCancel = async (invitationUuid: string) => { if (lockContinue) { application.alertService.alert('Cancelation already in progress.').catch(console.error) diff --git a/packages/web/src/javascripts/Components/Preferences/Panes/Backups/CloudBackups/CloudBackupProvider.tsx b/packages/web/src/javascripts/Components/Preferences/Panes/Backups/CloudBackups/CloudBackupProvider.tsx index 6d7eec50c..cbb651d68 100644 --- a/packages/web/src/javascripts/Components/Preferences/Panes/Backups/CloudBackups/CloudBackupProvider.tsx +++ b/packages/web/src/javascripts/Components/Preferences/Panes/Backups/CloudBackups/CloudBackupProvider.tsx @@ -17,7 +17,7 @@ import { } from '@standardnotes/snjs' import { WebApplication } from '@/Application/Application' import Button from '@/Components/Button/Button' -import { isDev, openInNewTab } from '@/Utils' +import { openInNewTab } from '@/Utils' import { Subtitle } from '@/Components/Preferences/PreferencesComponents/Content' import { KeyboardKey } from '@standardnotes/ui-services' @@ -61,7 +61,7 @@ const CloudBackupProvider: FunctionComponent = ({ application, providerNa } event.stopPropagation() - const authUrl = application.getCloudProviderIntegrationUrl(providerName, isDev) + const authUrl = application.getCloudProviderIntegrationUrl(providerName) openInNewTab(authUrl) setAuthBegan(true) } diff --git a/packages/web/src/javascripts/Components/Preferences/Panes/General/Advanced/Packages/Provider/PackageProvider.ts b/packages/web/src/javascripts/Components/Preferences/Panes/General/Advanced/Packages/Provider/PackageProvider.ts index 27cc2511c..c2ab019e6 100644 --- a/packages/web/src/javascripts/Components/Preferences/Panes/General/Advanced/Packages/Provider/PackageProvider.ts +++ b/packages/web/src/javascripts/Components/Preferences/Panes/General/Advanced/Packages/Provider/PackageProvider.ts @@ -7,7 +7,7 @@ export class PackageProvider { static async load(application: WebApplication): Promise { const response = await application.getAvailableSubscriptions() - if (response instanceof ClientDisplayableError) { + if (!response || response instanceof ClientDisplayableError) { return undefined } diff --git a/packages/web/src/javascripts/Components/PremiumFeaturesModal/Subviews/UpgradePrompt.tsx b/packages/web/src/javascripts/Components/PremiumFeaturesModal/Subviews/UpgradePrompt.tsx index 3d75ad7b1..95c03ba9a 100644 --- a/packages/web/src/javascripts/Components/PremiumFeaturesModal/Subviews/UpgradePrompt.tsx +++ b/packages/web/src/javascripts/Components/PremiumFeaturesModal/Subviews/UpgradePrompt.tsx @@ -64,7 +64,10 @@ export const UpgradePrompt = ({
The Professional Plan costs $119.99/year and includes benefits like
  • 100GB encrypted file storage
  • -
  • Access to all note types, including markdown, rich text, authenticator, tasks, and spreadsheets
  • +
  • + Access to all note types, including Super, markdown, rich text, authenticator, tasks, and spreadsheets +
  • +
  • Access to Daily Notebooks and Moments journals
  • Note history going back indefinitely
  • Nested folders for your tags
  • Premium support
  • @@ -79,7 +82,7 @@ export const UpgradePrompt = ({ className="no-border w-full cursor-pointer rounded bg-info py-2 font-bold text-info-contrast hover:brightness-125 focus:brightness-125" ref={ctaRef} > - Upgrade + {application.isNativeIOS() ? 'Start Free Trial' : 'Upgrade'}
diff --git a/packages/web/src/javascripts/Components/RevisionHistoryModal/RemoteHistoryList.tsx b/packages/web/src/javascripts/Components/RevisionHistoryModal/RemoteHistoryList.tsx index 4b00a5bc2..7ce497bca 100644 --- a/packages/web/src/javascripts/Components/RevisionHistoryModal/RemoteHistoryList.tsx +++ b/packages/web/src/javascripts/Components/RevisionHistoryModal/RemoteHistoryList.tsx @@ -4,7 +4,7 @@ import Icon from '@/Components/Icon/Icon' import { useListKeyboardNavigation } from '@/Hooks/useListKeyboardNavigation' import HistoryListItem from './HistoryListItem' import { previewHistoryEntryTitle } from './utils' -import { FeaturesClientInterface, RevisionMetadata, RoleName } from '@standardnotes/snjs' +import { FeaturesClientInterface, RevisionMetadata } from '@standardnotes/snjs' import { NoteHistoryController } from '@/Controllers/NoteHistory/NoteHistoryController' import Spinner from '@/Components/Spinner/Spinner' import { PremiumFeatureIconClass, PremiumFeatureIconName } from '../Icon/PremiumFeatureIcon' @@ -54,7 +54,7 @@ const RemoteHistoryList: FunctionComponent = ({ >
{previewHistoryEntryTitle(entry)}
- {!features.hasMinimumRole(entry.required_role as RoleName) && ( + {!features.hasMinimumRole(entry.required_role) && ( )}
diff --git a/packages/web/src/javascripts/Controllers/FeaturesController.ts b/packages/web/src/javascripts/Controllers/FeaturesController.ts index bc2d40de7..b9bedbace 100644 --- a/packages/web/src/javascripts/Controllers/FeaturesController.ts +++ b/packages/web/src/javascripts/Controllers/FeaturesController.ts @@ -65,6 +65,7 @@ export class FeaturesController extends AbstractViewController { break case ApplicationEvent.FeaturesUpdated: case ApplicationEvent.Launched: + case ApplicationEvent.LocalDataLoaded: runInAction(() => { this.hasFolders = this.isEntitledToFolders() this.hasSmartViews = this.isEntitledToSmartViews() diff --git a/packages/web/src/javascripts/Controllers/LinkingController.tsx b/packages/web/src/javascripts/Controllers/LinkingController.tsx index 990052764..43b43c933 100644 --- a/packages/web/src/javascripts/Controllers/LinkingController.tsx +++ b/packages/web/src/javascripts/Controllers/LinkingController.tsx @@ -75,7 +75,7 @@ export class LinkingController extends AbstractViewController { } get isEntitledToNoteLinking() { - return !!this.subscriptionController.userSubscription + return !!this.subscriptionController.onlineSubscription } setIsLinkingPanelOpen = (open: boolean) => { diff --git a/packages/web/src/javascripts/Controllers/NoteHistory/NoteHistoryController.ts b/packages/web/src/javascripts/Controllers/NoteHistory/NoteHistoryController.ts index ec3c6d3bb..4616ce862 100644 --- a/packages/web/src/javascripts/Controllers/NoteHistory/NoteHistoryController.ts +++ b/packages/web/src/javascripts/Controllers/NoteHistory/NoteHistoryController.ts @@ -16,7 +16,6 @@ import { NoteHistoryEntry, PayloadEmitSource, RevisionMetadata, - RoleName, SNNote, } from '@standardnotes/snjs' import { makeObservable, observable, action } from 'mobx' @@ -120,7 +119,7 @@ export class NoteHistoryController { return } - if (!this.application.features.hasMinimumRole(entry.required_role as RoleName)) { + if (!this.application.features.hasMinimumRole(entry.required_role)) { this.setContentState(RevisionContentState.NotEntitled) this.setSelectedRevision(undefined) return diff --git a/packages/web/src/javascripts/Controllers/Subscription/SubscriptionController.ts b/packages/web/src/javascripts/Controllers/Subscription/SubscriptionController.ts index dbd14b8d8..bc60bb1ae 100644 --- a/packages/web/src/javascripts/Controllers/Subscription/SubscriptionController.ts +++ b/packages/web/src/javascripts/Controllers/Subscription/SubscriptionController.ts @@ -7,7 +7,6 @@ import { Invitation, InvitationStatus, SubscriptionClientInterface, - Uuid, } from '@standardnotes/snjs' import { action, computed, makeObservable, observable, runInAction } from 'mobx' import { WebApplication } from '../../Application/Application' @@ -18,14 +17,15 @@ import { Subscription } from './SubscriptionType' export class SubscriptionController extends AbstractViewController { private readonly ALLOWED_SUBSCRIPTION_INVITATIONS = 5 - userSubscription: Subscription | undefined = undefined + onlineSubscription: Subscription | undefined = undefined availableSubscriptions: AvailableSubscriptions | undefined = undefined subscriptionInvitations: Invitation[] | undefined = undefined hasAccount: boolean + hasFirstPartySubscription: boolean override deinit() { super.deinit() - ;(this.userSubscription as unknown) = undefined + ;(this.onlineSubscription as unknown) = undefined ;(this.availableSubscriptions as unknown) = undefined ;(this.subscriptionInvitations as unknown) = undefined @@ -39,12 +39,14 @@ export class SubscriptionController extends AbstractViewController { ) { super(application, eventBus) this.hasAccount = application.hasAccount() + this.hasFirstPartySubscription = application.features.hasFirstPartySubscription() makeObservable(this, { - userSubscription: observable, + onlineSubscription: observable, availableSubscriptions: observable, subscriptionInvitations: observable, hasAccount: observable, + hasFirstPartySubscription: observable, userSubscriptionName: computed, userSubscriptionExpirationDate: computed, @@ -65,11 +67,20 @@ export class SubscriptionController extends AbstractViewController { this.reloadSubscriptionInvitations().catch(console.error) } runInAction(() => { + this.hasFirstPartySubscription = application.features.hasFirstPartySubscription() this.hasAccount = application.hasAccount() }) }, ApplicationEvent.Launched), ) + this.disposers.push( + application.addEventObserver(async () => { + runInAction(() => { + this.hasFirstPartySubscription = application.features.hasFirstPartySubscription() + }) + }, ApplicationEvent.LocalDataLoaded), + ) + this.disposers.push( application.addEventObserver(async () => { this.getSubscriptionInfo().catch(console.error) @@ -84,6 +95,9 @@ export class SubscriptionController extends AbstractViewController { application.addEventObserver(async () => { this.getSubscriptionInfo().catch(console.error) this.reloadSubscriptionInvitations().catch(console.error) + runInAction(() => { + this.hasFirstPartySubscription = application.features.hasFirstPartySubscription() + }) }, ApplicationEvent.UserRolesChanged), ) } @@ -91,20 +105,20 @@ export class SubscriptionController extends AbstractViewController { get userSubscriptionName(): string { if ( this.availableSubscriptions && - this.userSubscription && - this.availableSubscriptions[this.userSubscription.planName] + this.onlineSubscription && + this.availableSubscriptions[this.onlineSubscription.planName] ) { - return this.availableSubscriptions[this.userSubscription.planName].name + return this.availableSubscriptions[this.onlineSubscription.planName].name } return '' } get userSubscriptionExpirationDate(): Date | undefined { - if (!this.userSubscription) { + if (!this.onlineSubscription) { return undefined } - return new Date(convertTimestampToMilliseconds(this.userSubscription.endsAt)) + return new Date(convertTimestampToMilliseconds(this.onlineSubscription.endsAt)) } get isUserSubscriptionExpired(): boolean { @@ -116,11 +130,11 @@ export class SubscriptionController extends AbstractViewController { } get isUserSubscriptionCanceled(): boolean { - return Boolean(this.userSubscription?.cancelled) + return Boolean(this.onlineSubscription?.cancelled) } hasValidSubscription(): boolean { - return this.userSubscription != undefined && !this.isUserSubscriptionExpired && !this.isUserSubscriptionCanceled + return this.onlineSubscription != undefined && !this.isUserSubscriptionExpired && !this.isUserSubscriptionCanceled } get usedInvitationsCount(): number { @@ -140,7 +154,7 @@ export class SubscriptionController extends AbstractViewController { } public setUserSubscription(subscription: Subscription): void { - this.userSubscription = subscription + this.onlineSubscription = subscription } public setAvailableSubscriptions(subscriptions: AvailableSubscriptions): void { @@ -157,7 +171,7 @@ export class SubscriptionController extends AbstractViewController { return success } - async cancelSubscriptionInvitation(invitationUuid: Uuid): Promise { + async cancelSubscriptionInvitation(invitationUuid: string): Promise { const success = await this.subscriptionManager.cancelInvitation(invitationUuid) if (success) { diff --git a/packages/web/src/javascripts/Utils/Items/Icons/getIconAndTintForNoteType.ts b/packages/web/src/javascripts/Utils/Items/Icons/getIconAndTintForNoteType.ts index e94fee989..e9a34d601 100644 --- a/packages/web/src/javascripts/Utils/Items/Icons/getIconAndTintForNoteType.ts +++ b/packages/web/src/javascripts/Utils/Items/Icons/getIconAndTintForNoteType.ts @@ -4,6 +4,9 @@ import { IconType } from '@standardnotes/models' export function getIconAndTintForNoteType(noteType?: NoteType, subtle?: boolean): [IconType, number] { switch (noteType) { + case undefined: + case NoteType.Plain: + return [PlainEditorMetadata.icon, PlainEditorMetadata.iconTintNumber] case NoteType.RichText: return ['rich-text', 1] case NoteType.Markdown: @@ -21,7 +24,8 @@ export function getIconAndTintForNoteType(noteType?: NoteType, subtle?: boolean) subtle ? (SuperEditorMetadata.subtleIcon as IconType) : SuperEditorMetadata.icon, SuperEditorMetadata.iconTintNumber, ] + case NoteType.Unknown: default: - return [PlainEditorMetadata.icon, PlainEditorMetadata.iconTintNumber] + return ['editor', PlainEditorMetadata.iconTintNumber] } } diff --git a/packages/web/src/javascripts/Utils/createEditorMenuGroups.ts b/packages/web/src/javascripts/Utils/createEditorMenuGroups.ts index 8c5ca46b7..c0152ccf5 100644 --- a/packages/web/src/javascripts/Utils/createEditorMenuGroups.ts +++ b/packages/web/src/javascripts/Utils/createEditorMenuGroups.ts @@ -6,6 +6,7 @@ import { ComponentArea, FeatureDescription, GetFeatures, + FindNativeFeature, NoteType, FeatureIdentifier, } from '@standardnotes/snjs' @@ -149,8 +150,7 @@ const createBaselineMap = (application: WebApplication): NoteTypeToEditorRowsMap isEntitled: application.features.getFeatureStatus(FeatureIdentifier.SuperEditor) === FeatureStatus.Entitled, noteType: NoteType.Super, isLabs: true, - description: - 'A new way to edit notes. Type / to bring up the block selection menu, or @ to embed images or link other tags and notes. Type - then space to start a list, or [] then space to start a checklist. Drag and drop an image or file to embed it in your note.', + description: FindNativeFeature(FeatureIdentifier.SuperEditor)?.description, }, ], [NoteType.RichText]: [], diff --git a/yarn.lock b/yarn.lock index 5e758e9ce..146deeb28 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4372,12 +4372,12 @@ __metadata: version: 0.0.0-use.local resolution: "@standardnotes/api@workspace:packages/api" dependencies: - "@standardnotes/common": ^1.45.0 - "@standardnotes/domain-core": ^1.11.0 + "@standardnotes/common": ^1.46.4 + "@standardnotes/domain-core": ^1.11.1 "@standardnotes/encryption": "workspace:*" "@standardnotes/models": "workspace:*" "@standardnotes/responses": "workspace:*" - "@standardnotes/security": ^1.7.0 + "@standardnotes/security": ^1.7.5 "@standardnotes/utils": "workspace:*" "@types/jest": ^29.2.3 "@types/lodash": ^4.14.189 @@ -4494,15 +4494,6 @@ __metadata: languageName: node linkType: hard -"@standardnotes/common@npm:1.45.0, @standardnotes/common@npm:^1.45.0": - version: 1.45.0 - resolution: "@standardnotes/common@npm:1.45.0" - dependencies: - reflect-metadata: ^0.1.13 - checksum: 3bf1dd805ba7a864caebd25d5390bdbf4fb6b7cd06b3c064ad19cda6e5a709b7eb8f22314a5f393fa5c21a50722056f6c4e40308c43ca8c112db3260cd17b45f - languageName: node - linkType: hard - "@standardnotes/common@npm:^1.43.0": version: 1.43.0 resolution: "@standardnotes/common@npm:1.43.0" @@ -4512,6 +4503,15 @@ __metadata: languageName: node linkType: hard +"@standardnotes/common@npm:^1.46.4": + version: 1.46.4 + resolution: "@standardnotes/common@npm:1.46.4" + dependencies: + reflect-metadata: ^0.1.13 + checksum: 6d21999a1df420040a8dfa5eb3157744320cd0a610f2a1b911a86b44a66bf23d07235dd543fe5849e853ac6e8e944bd14f5cc0f6ef2ad4f264b5cea55066ebcb + languageName: node + linkType: hard + "@standardnotes/component-relay@github:standardnotes/component-relay#839ff5db9bc92db9d42cad8d202ddc4df729597d, @standardnotes/component-relay@standardnotes/component-relay#839ff5db9bc92db9d42cad8d202ddc4df729597d": version: 2.3.0 resolution: "@standardnotes/component-relay@https://github.com/standardnotes/component-relay.git#commit=839ff5db9bc92db9d42cad8d202ddc4df729597d" @@ -4586,27 +4586,25 @@ __metadata: languageName: unknown linkType: soft -"@standardnotes/domain-core@npm:^1.11.0": - version: 1.11.0 - resolution: "@standardnotes/domain-core@npm:1.11.0" +"@standardnotes/domain-core@npm:^1.11.1": + version: 1.11.1 + resolution: "@standardnotes/domain-core@npm:1.11.1" dependencies: reflect-metadata: ^0.1.13 shallow-equal-object: ^1.1.1 uuid: ^9.0.0 - checksum: cf4c9b7534338a8d5b8322a472621a2b2dde3cc3fe2d3c3c0eb12a3bdb7ba5f58bdfcc900338e5ba509311eeca6f163d95bffd46c40301532d974f397b57554e + checksum: 98af016a83bab8a60001bea9aa1c13607b2ecfff72bb901d709ac6b3d2c3d7f33e5e1289158c03d2a91ad5aa5afc586bfcc3efa3e0dda776ecddc10f3eb4eff9 languageName: node linkType: hard -"@standardnotes/domain-events@npm:^2.88.0": - version: 2.88.0 - resolution: "@standardnotes/domain-events@npm:2.88.0" +"@standardnotes/domain-events@npm:^2.106.0": + version: 2.106.0 + resolution: "@standardnotes/domain-events@npm:2.106.0" dependencies: - "@standardnotes/common": 1.45.0 - "@standardnotes/features": ^1.52.1 - "@standardnotes/predicates": 1.6.0 - "@standardnotes/security": 1.7.0 - reflect-metadata: ^0.1.13 - checksum: 8574ba4c7efe96ff7bb98612d4b5f0ceef3e81d5e9c401396bd5b3a8bc1d6382d059958261b88a117fe6eaf5c96fed3dd5969efe67fe3669d7badd2113ed47fb + "@standardnotes/features": ^1.58.1 + "@standardnotes/predicates": 1.6.4 + "@standardnotes/security": 1.7.5 + checksum: db98a6b4ef5181a02862a3989df2d8f0a4929044456583c9ffda767c31c5dec676a4da82d1fe581ffc6e35a977a05b071a2a8646fee2a4bdbdf1b265ccbb70d8 languageName: node linkType: hard @@ -4641,7 +4639,7 @@ __metadata: version: 0.0.0-use.local resolution: "@standardnotes/encryption@workspace:packages/encryption" dependencies: - "@standardnotes/common": ^1.45.0 + "@standardnotes/common": ^1.46.4 "@standardnotes/config": 2.4.3 "@standardnotes/models": "workspace:*" "@standardnotes/responses": "workspace:*" @@ -4660,13 +4658,13 @@ __metadata: languageName: unknown linkType: soft -"@standardnotes/features@^1.52.1, @standardnotes/features@workspace:*, @standardnotes/features@workspace:^, @standardnotes/features@workspace:packages/features": +"@standardnotes/features@^1.58.1, @standardnotes/features@workspace:*, @standardnotes/features@workspace:^, @standardnotes/features@workspace:packages/features": version: 0.0.0-use.local resolution: "@standardnotes/features@workspace:packages/features" dependencies: - "@standardnotes/auth": ^3.19.4 - "@standardnotes/common": ^1.45.0 - "@standardnotes/security": ^1.7.0 + "@standardnotes/common": ^1.46.4 + "@standardnotes/domain-core": ^1.11.1 + "@standardnotes/security": ^1.7.5 "@types/jest": ^29.2.3 "@typescript-eslint/eslint-plugin": "*" eslint: "*" @@ -4694,7 +4692,7 @@ __metadata: version: 0.0.0-use.local resolution: "@standardnotes/filepicker@workspace:packages/filepicker" dependencies: - "@standardnotes/common": ^1.45.0 + "@standardnotes/common": ^1.46.4 "@standardnotes/files": "workspace:*" "@standardnotes/utils": "workspace:*" "@types/jest": ^29.2.3 @@ -4714,7 +4712,7 @@ __metadata: version: 0.0.0-use.local resolution: "@standardnotes/files@workspace:packages/files" dependencies: - "@standardnotes/common": ^1.45.0 + "@standardnotes/common": ^1.46.4 "@standardnotes/encryption": "workspace:*" "@standardnotes/models": "workspace:*" "@standardnotes/responses": "workspace:*" @@ -4878,10 +4876,10 @@ __metadata: version: 0.0.0-use.local resolution: "@standardnotes/models@workspace:packages/models" dependencies: - "@standardnotes/common": ^1.45.0 + "@standardnotes/common": ^1.46.4 "@standardnotes/features": "workspace:*" "@standardnotes/responses": "workspace:*" - "@standardnotes/utils": "workspace:*" + "@standardnotes/utils": "workspace:^" "@types/jest": ^29.2.3 "@types/lodash": ^4.14.189 "@typescript-eslint/eslint-plugin": "*" @@ -4895,13 +4893,10 @@ __metadata: languageName: unknown linkType: soft -"@standardnotes/predicates@npm:1.6.0": - version: 1.6.0 - resolution: "@standardnotes/predicates@npm:1.6.0" - dependencies: - "@standardnotes/common": 1.45.0 - reflect-metadata: ^0.1.13 - checksum: 020e2206c75e6b964bf400314a116b29ece5f9e662a5dd6704de8864aaec1689256b008334db5f2983addc039d3b7f4a8108c87789e61d37a8ba9161ea93cfa0 +"@standardnotes/predicates@npm:1.6.4": + version: 1.6.4 + resolution: "@standardnotes/predicates@npm:1.6.4" + checksum: 6d7235896a6d591f6e33d2d0b89c58850d357095d26e1d74264db1d77164a8f1f6673f4095c660719992f2aa8411cfbfe79781f004c3eb2aa82a761e34827f60 languageName: node linkType: hard @@ -4928,9 +4923,9 @@ __metadata: version: 0.0.0-use.local resolution: "@standardnotes/responses@workspace:packages/responses" dependencies: - "@standardnotes/common": ^1.45.0 + "@standardnotes/common": ^1.46.4 "@standardnotes/features": "workspace:*" - "@standardnotes/security": ^1.7.0 + "@standardnotes/security": ^1.7.5 "@types/jest": ^29.2.3 "@typescript-eslint/eslint-plugin": "*" eslint: "*" @@ -4951,14 +4946,13 @@ __metadata: languageName: node linkType: hard -"@standardnotes/security@npm:1.7.0, @standardnotes/security@npm:^1.7.0": - version: 1.7.0 - resolution: "@standardnotes/security@npm:1.7.0" +"@standardnotes/security@npm:1.7.5, @standardnotes/security@npm:^1.7.5": + version: 1.7.5 + resolution: "@standardnotes/security@npm:1.7.5" dependencies: - "@standardnotes/common": 1.45.0 - jsonwebtoken: ^8.5.1 + jsonwebtoken: ^9.0.0 reflect-metadata: ^0.1.13 - checksum: c053af16e620c29e8b9233212e5b220cebc7e71c195b5c63cd6fb68b617465c935ae1c926ebc6a4c9aff32487e538e949a3fe4a9e281d082c2fddcc9d17fa3a7 + checksum: 69d180d25936cad64ee19d8932aedff60b91f4a25f96084e0a686b228773aba856f50c3da265d426d64160dff28f20d9d7980a625bce00fc6a47416caa4e130e languageName: node linkType: hard @@ -4978,14 +4972,13 @@ __metadata: resolution: "@standardnotes/services@workspace:packages/services" dependencies: "@standardnotes/api": "workspace:^" - "@standardnotes/auth": ^3.19.4 - "@standardnotes/common": ^1.45.0 - "@standardnotes/domain-core": ^1.11.0 + "@standardnotes/common": ^1.46.4 + "@standardnotes/domain-core": ^1.11.1 "@standardnotes/encryption": "workspace:^" "@standardnotes/files": "workspace:^" "@standardnotes/models": "workspace:^" "@standardnotes/responses": "workspace:*" - "@standardnotes/security": ^1.7.0 + "@standardnotes/security": ^1.7.5 "@standardnotes/sncrypto-common": "workspace:^" "@standardnotes/utils": "workspace:*" "@types/jest": ^29.2.3 @@ -5076,15 +5069,15 @@ __metadata: "@babel/core": "*" "@babel/preset-env": "*" "@standardnotes/api": "workspace:*" - "@standardnotes/common": ^1.45.0 - "@standardnotes/domain-core": ^1.11.0 - "@standardnotes/domain-events": ^2.88.0 + "@standardnotes/common": ^1.46.4 + "@standardnotes/domain-core": ^1.11.1 + "@standardnotes/domain-events": ^2.106.0 "@standardnotes/encryption": "workspace:*" "@standardnotes/features": "workspace:*" "@standardnotes/files": "workspace:*" "@standardnotes/models": "workspace:*" "@standardnotes/responses": "workspace:*" - "@standardnotes/security": ^1.7.0 + "@standardnotes/security": ^1.7.5 "@standardnotes/services": "workspace:*" "@standardnotes/settings": ^1.19.0 "@standardnotes/sncrypto-common": "workspace:*" @@ -5204,7 +5197,7 @@ __metadata: version: 0.0.0-use.local resolution: "@standardnotes/ui-services@workspace:packages/ui-services" dependencies: - "@standardnotes/common": ^1.45.0 + "@standardnotes/common": ^1.46.4 "@standardnotes/features": "workspace:^" "@standardnotes/filepicker": "workspace:^" "@standardnotes/services": "workspace:^" @@ -5226,7 +5219,7 @@ __metadata: version: 0.0.0-use.local resolution: "@standardnotes/utils@workspace:packages/utils" dependencies: - "@standardnotes/common": ^1.45.0 + "@standardnotes/common": ^1.46.4 "@types/dompurify": ^2.4.0 "@types/jest": ^29.2.3 "@types/jsdom": ^20.0.1 @@ -14989,6 +14982,18 @@ __metadata: languageName: node linkType: hard +"jsonwebtoken@npm:^9.0.0": + version: 9.0.0 + resolution: "jsonwebtoken@npm:9.0.0" + dependencies: + jws: ^3.2.2 + lodash: ^4.17.21 + ms: ^2.1.1 + semver: ^7.3.8 + checksum: b9181cecf9df99f1dc0253f91ba000a1aa4d91f5816d1608c0dba61a5623726a0bfe200b51df25de18c1a6000825d231ad7ce2788aa54fd48dcb760ad9eb9514 + languageName: node + linkType: hard + "jsx-ast-utils@npm:^2.4.1 || ^3.0.0": version: 3.3.3 resolution: "jsx-ast-utils@npm:3.3.3"