@metamask/profile-sync-controller 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/{chunk-LNECIW4K.js → chunk-246Z6L5V.js} +39 -16
  3. package/dist/chunk-246Z6L5V.js.map +1 -0
  4. package/dist/{chunk-ZYYAQJ56.mjs → chunk-2677XY6G.mjs} +19 -15
  5. package/dist/chunk-2677XY6G.mjs.map +1 -0
  6. package/dist/{chunk-NSSHFDIS.mjs → chunk-2VEMA6OE.mjs} +2 -2
  7. package/dist/{chunk-HMRRB4EX.js → chunk-4LMFZDL4.js} +22 -13
  8. package/dist/chunk-4LMFZDL4.js.map +1 -0
  9. package/dist/{chunk-EYZFHZR2.js → chunk-5MQUI24U.js} +3 -3
  10. package/dist/{chunk-QU4EXKJO.mjs → chunk-6DAK2U35.mjs} +2 -2
  11. package/dist/{chunk-LYDHYB6I.mjs → chunk-76NMME23.mjs} +20 -11
  12. package/dist/chunk-76NMME23.mjs.map +1 -0
  13. package/dist/{chunk-4WXZXVLI.mjs → chunk-7MSQV43P.mjs} +3 -3
  14. package/dist/{chunk-T3FNDVE3.js → chunk-BKQE7DB5.js} +30 -18
  15. package/dist/chunk-BKQE7DB5.js.map +1 -0
  16. package/dist/{chunk-WAFY3R2F.js → chunk-CHUZGCDV.js} +27 -23
  17. package/dist/chunk-CHUZGCDV.js.map +1 -0
  18. package/dist/{chunk-K5UKU454.mjs → chunk-COBJUBZE.mjs} +31 -19
  19. package/dist/chunk-COBJUBZE.mjs.map +1 -0
  20. package/dist/{chunk-5TOWF6UW.mjs → chunk-KHASG4H3.mjs} +2 -2
  21. package/dist/{chunk-E7Z5TCQT.mjs → chunk-MK7ABX2V.mjs} +5 -5
  22. package/dist/{chunk-E7Z5TCQT.mjs.map → chunk-MK7ABX2V.mjs.map} +1 -1
  23. package/dist/{chunk-AK7OTIWA.js → chunk-NIUQ34PY.js} +3 -3
  24. package/dist/{chunk-M23ZCTKE.mjs → chunk-SZ6WMC6C.mjs} +35 -12
  25. package/dist/chunk-SZ6WMC6C.mjs.map +1 -0
  26. package/dist/{chunk-JJ5BDCKD.js → chunk-T2YURW25.js} +6 -6
  27. package/dist/chunk-UHX7HJAI.js +11 -0
  28. package/dist/{chunk-ZMQRPWJN.js → chunk-UIRAMHNM.js} +12 -12
  29. package/dist/chunk-UIRAMHNM.js.map +1 -0
  30. package/dist/controllers/index.js +7 -7
  31. package/dist/controllers/index.mjs +6 -6
  32. package/dist/controllers/user-storage/UserStorageController.js +6 -6
  33. package/dist/controllers/user-storage/UserStorageController.mjs +5 -5
  34. package/dist/controllers/user-storage/encryption/encryption.js +2 -2
  35. package/dist/controllers/user-storage/encryption/encryption.mjs +1 -1
  36. package/dist/controllers/user-storage/encryption/index.js +3 -3
  37. package/dist/controllers/user-storage/encryption/index.mjs +2 -2
  38. package/dist/controllers/user-storage/index.js +7 -7
  39. package/dist/controllers/user-storage/index.mjs +6 -6
  40. package/dist/controllers/user-storage/schema.js +4 -4
  41. package/dist/controllers/user-storage/schema.mjs +3 -3
  42. package/dist/controllers/user-storage/services.js +5 -5
  43. package/dist/controllers/user-storage/services.mjs +4 -4
  44. package/dist/index.js +10 -10
  45. package/dist/index.mjs +9 -9
  46. package/dist/sdk/encryption.js +3 -3
  47. package/dist/sdk/encryption.mjs +2 -2
  48. package/dist/sdk/index.js +7 -7
  49. package/dist/sdk/index.mjs +6 -6
  50. package/dist/sdk/user-storage.js +6 -6
  51. package/dist/sdk/user-storage.mjs +5 -5
  52. package/dist/tsconfig.build.tsbuildinfo +1 -1
  53. package/dist/types/controllers/user-storage/UserStorageController.d.ts +4 -1
  54. package/dist/types/controllers/user-storage/UserStorageController.d.ts.map +1 -1
  55. package/dist/types/controllers/user-storage/__fixtures__/mockResponses.d.ts +4 -4
  56. package/dist/types/controllers/user-storage/__fixtures__/mockResponses.d.ts.map +1 -1
  57. package/dist/types/controllers/user-storage/__fixtures__/mockServices.d.ts +2 -2
  58. package/dist/types/controllers/user-storage/__fixtures__/mockServices.d.ts.map +1 -1
  59. package/dist/types/controllers/user-storage/__fixtures__/mockStorage.d.ts +1 -1
  60. package/dist/types/controllers/user-storage/__fixtures__/mockStorage.d.ts.map +1 -1
  61. package/dist/types/controllers/user-storage/encryption/encryption.d.ts +3 -2
  62. package/dist/types/controllers/user-storage/encryption/encryption.d.ts.map +1 -1
  63. package/dist/types/controllers/user-storage/services.d.ts +3 -0
  64. package/dist/types/controllers/user-storage/services.d.ts.map +1 -1
  65. package/dist/types/sdk/__fixtures__/mock-userstorage.d.ts +5 -5
  66. package/dist/types/sdk/__fixtures__/mock-userstorage.d.ts.map +1 -1
  67. package/dist/types/sdk/user-storage.d.ts.map +1 -1
  68. package/package.json +1 -1
  69. package/dist/chunk-HMRRB4EX.js.map +0 -1
  70. package/dist/chunk-K5UKU454.mjs.map +0 -1
  71. package/dist/chunk-LDYHGAP4.js +0 -11
  72. package/dist/chunk-LNECIW4K.js.map +0 -1
  73. package/dist/chunk-LYDHYB6I.mjs.map +0 -1
  74. package/dist/chunk-M23ZCTKE.mjs.map +0 -1
  75. package/dist/chunk-T3FNDVE3.js.map +0 -1
  76. package/dist/chunk-WAFY3R2F.js.map +0 -1
  77. package/dist/chunk-ZMQRPWJN.js.map +0 -1
  78. package/dist/chunk-ZYYAQJ56.mjs.map +0 -1
  79. /package/dist/{chunk-NSSHFDIS.mjs.map → chunk-2VEMA6OE.mjs.map} +0 -0
  80. /package/dist/{chunk-EYZFHZR2.js.map → chunk-5MQUI24U.js.map} +0 -0
  81. /package/dist/{chunk-QU4EXKJO.mjs.map → chunk-6DAK2U35.mjs.map} +0 -0
  82. /package/dist/{chunk-4WXZXVLI.mjs.map → chunk-7MSQV43P.mjs.map} +0 -0
  83. /package/dist/{chunk-5TOWF6UW.mjs.map → chunk-KHASG4H3.mjs.map} +0 -0
  84. /package/dist/{chunk-AK7OTIWA.js.map → chunk-NIUQ34PY.js.map} +0 -0
  85. /package/dist/{chunk-JJ5BDCKD.js.map → chunk-T2YURW25.js.map} +0 -0
  86. /package/dist/{chunk-LDYHGAP4.js.map → chunk-UHX7HJAI.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/controllers/user-storage/UserStorageController.ts"],"sourcesContent":["import type {\n AccountsControllerListAccountsAction,\n AccountsControllerUpdateAccountMetadataAction,\n AccountsControllerGetAccountByAddressAction,\n} from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n RestrictedControllerMessenger,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type { InternalAccount } from '@metamask/keyring-api';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerLockEvent,\n KeyringControllerUnlockEvent,\n KeyringControllerAddNewAccountAction,\n} from '@metamask/keyring-controller';\nimport type { HandleSnapRequest } from '@metamask/snaps-controllers';\n\nimport { createSnapSignMessageRequest } from '../authentication/auth-snap-requests';\nimport type {\n AuthenticationControllerGetBearerToken,\n AuthenticationControllerGetSessionProfile,\n AuthenticationControllerIsSignedIn,\n AuthenticationControllerPerformSignIn,\n AuthenticationControllerPerformSignOut,\n} from '../authentication/AuthenticationController';\nimport type { UserStorageAccount } from './accounts/user-storage';\nimport {\n isNameDefaultAccountName,\n mapInternalAccountToUserStorageAccount,\n} from './accounts/user-storage';\nimport { createSHA256Hash } from './encryption';\nimport type {\n UserStoragePathWithFeatureAndKey,\n UserStoragePathWithFeatureOnly,\n} from './schema';\nimport {\n getUserStorage,\n getUserStorageAllFeatureEntries,\n upsertUserStorage,\n} from './services';\n\n// TODO: fix external dependencies\nexport declare type NotificationServicesControllerDisableNotificationServices =\n {\n type: `NotificationServicesController:disableNotificationServices`;\n handler: () => Promise<void>;\n };\n\nexport declare type NotificationServicesControllerSelectIsNotificationServicesEnabled =\n {\n type: `NotificationServicesController:selectIsNotificationServicesEnabled`;\n handler: () => boolean;\n };\n\nexport declare type NativeScrypt = (\n passwd: string,\n salt: Uint8Array,\n N: number,\n r: number,\n p: number,\n size: number,\n) => Promise<Uint8Array>;\n\nconst controllerName = 'UserStorageController';\n\n// State\nexport type UserStorageControllerState = {\n /**\n * Condition used by UI and to determine if we can use some of the User Storage methods.\n */\n isProfileSyncingEnabled: boolean | null;\n /**\n * Loading state for the profile syncing update\n */\n isProfileSyncingUpdateLoading: boolean;\n};\n\nexport const defaultState: UserStorageControllerState = {\n isProfileSyncingEnabled: true,\n isProfileSyncingUpdateLoading: false,\n};\n\nconst metadata: StateMetadata<UserStorageControllerState> = {\n isProfileSyncingEnabled: {\n persist: true,\n anonymous: true,\n },\n isProfileSyncingUpdateLoading: {\n persist: false,\n anonymous: false,\n },\n};\n\n// Messenger Actions\ntype CreateActionsObj<Controller extends keyof UserStorageController> = {\n [K in Controller]: {\n type: `${typeof controllerName}:${K}`;\n handler: UserStorageController[K];\n };\n};\ntype ActionsObj = CreateActionsObj<\n | 'performGetStorage'\n | 'performGetStorageAllFeatureEntries'\n | 'performSetStorage'\n | 'getStorageKey'\n | 'enableProfileSyncing'\n | 'disableProfileSyncing'\n | 'syncInternalAccountsWithUserStorage'\n | 'saveInternalAccountToUserStorage'\n>;\nexport type UserStorageControllerGetStateAction = ControllerGetStateAction<\n typeof controllerName,\n UserStorageControllerState\n>;\nexport type Actions =\n | ActionsObj[keyof ActionsObj]\n | UserStorageControllerGetStateAction;\nexport type UserStorageControllerPerformGetStorage =\n ActionsObj['performGetStorage'];\nexport type UserStorageControllerPerformGetStorageAllFeatureEntries =\n ActionsObj['performGetStorageAllFeatureEntries'];\nexport type UserStorageControllerPerformSetStorage =\n ActionsObj['performSetStorage'];\nexport type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey'];\nexport type UserStorageControllerEnableProfileSyncing =\n ActionsObj['enableProfileSyncing'];\nexport type UserStorageControllerDisableProfileSyncing =\n ActionsObj['disableProfileSyncing'];\nexport type UserStorageControllerSyncInternalAccountsWithUserStorage =\n ActionsObj['syncInternalAccountsWithUserStorage'];\nexport type UserStorageControllerSaveInternalAccountToUserStorage =\n ActionsObj['saveInternalAccountToUserStorage'];\n\nexport type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof controllerName,\n UserStorageControllerState\n>;\nexport type Events = UserStorageControllerStateChangeEvent;\n\n// Allowed Actions\nexport type AllowedActions =\n // Keyring Requests\n | KeyringControllerGetStateAction\n // Snap Requests\n | HandleSnapRequest\n // Auth Requests\n | AuthenticationControllerGetBearerToken\n | AuthenticationControllerGetSessionProfile\n | AuthenticationControllerPerformSignIn\n | AuthenticationControllerIsSignedIn\n | AuthenticationControllerPerformSignOut\n // Metamask Notifications\n | NotificationServicesControllerDisableNotificationServices\n | NotificationServicesControllerSelectIsNotificationServicesEnabled\n // Account syncing\n | AccountsControllerListAccountsAction\n | AccountsControllerGetAccountByAddressAction\n | AccountsControllerUpdateAccountMetadataAction\n | KeyringControllerAddNewAccountAction;\n\n// Messenger events\nexport type UserStorageControllerChangeEvent = ControllerStateChangeEvent<\n typeof controllerName,\n UserStorageControllerState\n>;\nexport type UserStorageControllerAccountSyncingInProgress = {\n type: `${typeof controllerName}:accountSyncingInProgress`;\n payload: [boolean];\n};\nexport type UserStorageControllerAccountSyncingComplete = {\n type: `${typeof controllerName}:accountSyncingComplete`;\n payload: [boolean];\n};\n\nexport type AllowedEvents =\n | UserStorageControllerChangeEvent\n | UserStorageControllerAccountSyncingInProgress\n | UserStorageControllerAccountSyncingComplete\n | KeyringControllerLockEvent\n | KeyringControllerUnlockEvent;\n\n// Messenger\nexport type UserStorageControllerMessenger = RestrictedControllerMessenger<\n typeof controllerName,\n Actions | AllowedActions,\n Events | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n\n/**\n * Reusable controller that allows any team to store synchronized data for a given user.\n * These can be settings shared cross MetaMask clients, or data we want to persist when uninstalling/reinstalling.\n *\n * NOTE:\n * - data stored on UserStorage is FULLY encrypted, with the only keys stored/managed on the client.\n * - No one can access this data unless they are have the SRP and are able to run the signing snap.\n */\nexport default class UserStorageController extends BaseController<\n typeof controllerName,\n UserStorageControllerState,\n UserStorageControllerMessenger\n> {\n #auth = {\n getBearerToken: async () => {\n return await this.messagingSystem.call(\n 'AuthenticationController:getBearerToken',\n );\n },\n getProfileId: async () => {\n const sessionProfile = await this.messagingSystem.call(\n 'AuthenticationController:getSessionProfile',\n );\n return sessionProfile?.profileId;\n },\n isAuthEnabled: () => {\n return this.messagingSystem.call('AuthenticationController:isSignedIn');\n },\n signIn: async () => {\n return await this.messagingSystem.call(\n 'AuthenticationController:performSignIn',\n );\n },\n signOut: async () => {\n return this.messagingSystem.call(\n 'AuthenticationController:performSignOut',\n );\n },\n };\n\n #accounts = {\n // This is replaced with the actual value in the constructor\n // We will remove this once the feature will be released\n isAccountSyncingEnabled: false,\n // This is replaced with the actual value in the constructor\n maxSyncInterval: 1000 * 60,\n lastSyncedAt: 0,\n shouldSync: () => {\n return (\n Date.now() - this.#accounts.lastSyncedAt >\n this.#accounts.maxSyncInterval\n );\n },\n getInternalAccountByAddress: async (address: string) => {\n return this.messagingSystem.call(\n 'AccountsController:getAccountByAddress',\n address,\n );\n },\n getInternalAccountsList: async (): Promise<InternalAccount[]> => {\n return this.messagingSystem.call('AccountsController:listAccounts');\n },\n getUserStorageAccountsList: async (): Promise<\n UserStorageAccount[] | null\n > => {\n const rawAccountsListResponse =\n await this.performGetStorageAllFeatureEntries('accounts');\n\n return (\n rawAccountsListResponse?.map((rawAccount) => JSON.parse(rawAccount)) ??\n null\n );\n },\n saveInternalAccountToUserStorage: async (address: string) => {\n const internalAccount = await this.#accounts.getInternalAccountByAddress(\n address,\n );\n\n if (!internalAccount) {\n return;\n }\n\n // Map the internal account to the user storage account schema\n const mappedAccount =\n mapInternalAccountToUserStorageAccount(internalAccount);\n\n await this.performSetStorage(\n `accounts.${address}`,\n JSON.stringify(mappedAccount),\n );\n },\n saveInternalAccountsListToUserStorage: async () => {\n const internalAccountsList =\n await this.#accounts.getInternalAccountsList();\n\n if (!internalAccountsList) {\n return;\n }\n\n const userStorageAccountsList = internalAccountsList.map(\n mapInternalAccountToUserStorageAccount,\n );\n\n await Promise.all(\n userStorageAccountsList.map(async (userStorageAccount) => {\n await this.performSetStorage(\n `accounts.${userStorageAccount.a}`,\n JSON.stringify(userStorageAccount),\n );\n }),\n );\n },\n };\n\n #notificationServices = {\n disableNotificationServices: async () => {\n return await this.messagingSystem.call(\n 'NotificationServicesController:disableNotificationServices',\n );\n },\n selectIsNotificationServicesEnabled: async () => {\n return this.messagingSystem.call(\n 'NotificationServicesController:selectIsNotificationServicesEnabled',\n );\n },\n };\n\n #isUnlocked = false;\n\n #keyringController = {\n setupLockedStateSubscriptions: () => {\n const { isUnlocked } = this.messagingSystem.call(\n 'KeyringController:getState',\n );\n this.#isUnlocked = isUnlocked;\n\n this.messagingSystem.subscribe(\n 'KeyringController:unlock',\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async () => {\n this.#isUnlocked = true;\n\n await this.syncInternalAccountsWithUserStorage();\n },\n );\n\n this.messagingSystem.subscribe('KeyringController:lock', () => {\n this.#isUnlocked = false;\n });\n },\n };\n\n #nativeScryptCrypto: NativeScrypt | undefined = undefined;\n\n getMetaMetricsState: () => boolean;\n\n constructor({\n messenger,\n state,\n env,\n getMetaMetricsState,\n nativeScryptCrypto,\n }: {\n messenger: UserStorageControllerMessenger;\n state?: UserStorageControllerState;\n env?: {\n isAccountSyncingEnabled?: boolean;\n accountSyncingMaxSyncInterval?: number;\n };\n getMetaMetricsState: () => boolean;\n nativeScryptCrypto?: NativeScrypt;\n }) {\n super({\n messenger,\n metadata,\n name: controllerName,\n state: { ...defaultState, ...state },\n });\n\n this.#accounts.isAccountSyncingEnabled = Boolean(\n env?.isAccountSyncingEnabled,\n );\n this.#accounts.maxSyncInterval =\n env?.accountSyncingMaxSyncInterval ?? this.#accounts.maxSyncInterval;\n\n this.getMetaMetricsState = getMetaMetricsState;\n this.#keyringController.setupLockedStateSubscriptions();\n this.#registerMessageHandlers();\n this.#nativeScryptCrypto = nativeScryptCrypto;\n }\n\n /**\n * Constructor helper for registering this controller's messaging system\n * actions.\n */\n #registerMessageHandlers(): void {\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performGetStorage',\n this.performGetStorage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performGetStorageAllFeatureEntries',\n this.performGetStorageAllFeatureEntries.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performSetStorage',\n this.performSetStorage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:getStorageKey',\n this.getStorageKey.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:enableProfileSyncing',\n this.enableProfileSyncing.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:disableProfileSyncing',\n this.disableProfileSyncing.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:syncInternalAccountsWithUserStorage',\n this.syncInternalAccountsWithUserStorage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:saveInternalAccountToUserStorage',\n this.saveInternalAccountToUserStorage.bind(this),\n );\n }\n\n public async enableProfileSyncing(): Promise<void> {\n try {\n this.#setIsProfileSyncingUpdateLoading(true);\n\n const authEnabled = this.#auth.isAuthEnabled();\n if (!authEnabled) {\n await this.#auth.signIn();\n }\n\n this.update((state) => {\n state.isProfileSyncingEnabled = true;\n });\n\n this.#setIsProfileSyncingUpdateLoading(false);\n } catch (e) {\n this.#setIsProfileSyncingUpdateLoading(false);\n const errorMessage = e instanceof Error ? e.message : JSON.stringify(e);\n throw new Error(\n `${controllerName} - failed to enable profile syncing - ${errorMessage}`,\n );\n }\n }\n\n public async setIsProfileSyncingEnabled(\n isProfileSyncingEnabled: boolean,\n ): Promise<void> {\n this.update((state) => {\n state.isProfileSyncingEnabled = isProfileSyncingEnabled;\n });\n }\n\n public async disableProfileSyncing(): Promise<void> {\n const isAlreadyDisabled = !this.state.isProfileSyncingEnabled;\n if (isAlreadyDisabled) {\n return;\n }\n\n try {\n this.#setIsProfileSyncingUpdateLoading(true);\n\n const isNotificationServicesEnabled =\n await this.#notificationServices.selectIsNotificationServicesEnabled();\n\n if (isNotificationServicesEnabled) {\n await this.#notificationServices.disableNotificationServices();\n }\n\n const isMetaMetricsParticipation = this.getMetaMetricsState();\n\n if (!isMetaMetricsParticipation) {\n await this.#auth.signOut();\n }\n\n this.#setIsProfileSyncingUpdateLoading(false);\n\n this.update((state) => {\n state.isProfileSyncingEnabled = false;\n });\n } catch (e) {\n this.#setIsProfileSyncingUpdateLoading(false);\n const errorMessage = e instanceof Error ? e.message : JSON.stringify(e);\n throw new Error(\n `${controllerName} - failed to disable profile syncing - ${errorMessage}`,\n );\n }\n }\n\n /**\n * Allows retrieval of stored data. Data stored is string formatted.\n * Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @returns the decrypted string contents found from user storage (or null if not found)\n */\n public async performGetStorage(\n path: UserStoragePathWithFeatureAndKey,\n ): Promise<string | null> {\n this.#assertProfileSyncingEnabled();\n\n const { bearerToken, storageKey } =\n await this.#getStorageKeyAndBearerToken();\n\n const result = await getUserStorage({\n path,\n bearerToken,\n storageKey,\n nativeScryptCrypto: this.#nativeScryptCrypto,\n });\n\n return result;\n }\n\n /**\n * Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @returns the array of decrypted string contents found from user storage (or null if not found)\n */\n public async performGetStorageAllFeatureEntries(\n path: UserStoragePathWithFeatureOnly,\n ): Promise<string[] | null> {\n this.#assertProfileSyncingEnabled();\n\n const { bearerToken, storageKey } =\n await this.#getStorageKeyAndBearerToken();\n\n const result = await getUserStorageAllFeatureEntries({\n path,\n bearerToken,\n storageKey,\n nativeScryptCrypto: this.#nativeScryptCrypto,\n });\n\n return result;\n }\n\n /**\n * Allows storage of user data. Data stored must be string formatted.\n * Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @param value - The string data you want to store.\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\n public async performSetStorage(\n path: UserStoragePathWithFeatureAndKey,\n value: string,\n ): Promise<void> {\n this.#assertProfileSyncingEnabled();\n\n const { bearerToken, storageKey } =\n await this.#getStorageKeyAndBearerToken();\n\n await upsertUserStorage(value, {\n path,\n bearerToken,\n storageKey,\n nativeScryptCrypto: this.#nativeScryptCrypto,\n });\n }\n\n /**\n * Retrieves the storage key, for internal use only!\n *\n * @returns the storage key\n */\n public async getStorageKey(): Promise<string> {\n this.#assertProfileSyncingEnabled();\n const storageKey = await this.#createStorageKey();\n return storageKey;\n }\n\n #assertProfileSyncingEnabled(): void {\n if (!this.state.isProfileSyncingEnabled) {\n throw new Error(\n `${controllerName}: Unable to call method, user is not authenticated`,\n );\n }\n }\n\n /**\n * Utility to get the bearer token and storage key\n */\n async #getStorageKeyAndBearerToken(): Promise<{\n bearerToken: string;\n storageKey: string;\n }> {\n const bearerToken = await this.#auth.getBearerToken();\n if (!bearerToken) {\n throw new Error('UserStorageController - unable to get bearer token');\n }\n const storageKey = await this.#createStorageKey();\n\n return { bearerToken, storageKey };\n }\n\n /**\n * Rather than storing the storage key, we can compute the storage key when needed.\n *\n * @returns the storage key\n */\n async #createStorageKey(): Promise<string> {\n const id: string = await this.#auth.getProfileId();\n if (!id) {\n throw new Error('UserStorageController - unable to create storage key');\n }\n\n const storageKeySignature = await this.#snapSignMessage(`metamask:${id}`);\n const storageKey = createSHA256Hash(storageKeySignature);\n return storageKey;\n }\n\n #_snapSignMessageCache: Record<`metamask:${string}`, string> = {};\n\n /**\n * Signs a specific message using an underlying auth snap.\n *\n * @param message - A specific tagged message to sign.\n * @returns A Signature created by the snap.\n */\n async #snapSignMessage(message: `metamask:${string}`): Promise<string> {\n if (this.#_snapSignMessageCache[message]) {\n return this.#_snapSignMessageCache[message];\n }\n\n if (!this.#isUnlocked) {\n throw new Error(\n '#snapSignMessage - unable to call snap, wallet is locked',\n );\n }\n\n const result = (await this.messagingSystem.call(\n 'SnapController:handleRequest',\n createSnapSignMessageRequest(message),\n )) as string;\n\n this.#_snapSignMessageCache[message] = result;\n\n return result;\n }\n\n #setIsProfileSyncingUpdateLoading(\n isProfileSyncingUpdateLoading: boolean,\n ): void {\n this.update((state) => {\n state.isProfileSyncingUpdateLoading = isProfileSyncingUpdateLoading;\n });\n }\n\n /**\n * Syncs the internal accounts list with the user storage accounts list.\n * This method is used to make sure that the internal accounts list is up-to-date with the user storage accounts list and vice-versa.\n * It will add new accounts to the internal accounts list, update/merge conflicting names and re-upload the results in some cases to the user storage.\n */\n async syncInternalAccountsWithUserStorage(): Promise<void> {\n if (!this.#accounts.isAccountSyncingEnabled) {\n return;\n }\n\n if (!this.#accounts.shouldSync()) {\n return;\n }\n\n this.#accounts.lastSyncedAt = Date.now();\n\n try {\n this.#assertProfileSyncingEnabled();\n\n const userStorageAccountsList =\n await this.#accounts.getUserStorageAccountsList();\n\n if (!userStorageAccountsList || !userStorageAccountsList.length) {\n await this.#accounts.saveInternalAccountsListToUserStorage();\n return;\n }\n\n // Compare internal accounts list with user storage accounts list\n // First step: compare lengths\n let internalAccountsList = await this.#accounts.getInternalAccountsList();\n\n if (!internalAccountsList || !internalAccountsList.length) {\n throw new Error(`Failed to get internal accounts list`);\n }\n\n const hasMoreInternalAccountsThanUserStorageAccounts =\n internalAccountsList.length > userStorageAccountsList.length;\n\n // We don't want to remove existing accounts for a user\n // so we only add new accounts if the user has more accounts than the internal accounts list\n if (!hasMoreInternalAccountsThanUserStorageAccounts) {\n const numberOfAccountsToAdd =\n userStorageAccountsList.length - internalAccountsList.length;\n\n // Create new accounts to match the user storage accounts list\n const addNewAccountsPromises = Array.from({\n length: numberOfAccountsToAdd,\n }).map(async () => {\n await this.messagingSystem.call('KeyringController:addNewAccount');\n });\n\n await Promise.all(addNewAccountsPromises);\n }\n\n // Second step: compare account names\n // Get the internal accounts list again since new accounts might have been added in the previous step\n internalAccountsList = await this.#accounts.getInternalAccountsList();\n\n for await (const internalAccount of internalAccountsList) {\n const userStorageAccount = userStorageAccountsList.find(\n (account) => account.a === internalAccount.address,\n );\n\n if (!userStorageAccount) {\n await this.#accounts.saveInternalAccountToUserStorage(\n internalAccount.address,\n );\n continue;\n }\n\n // One or both accounts have default names\n const isInternalAccountNameDefault = isNameDefaultAccountName(\n internalAccount.metadata.name,\n );\n const isUserStorageAccountNameDefault = isNameDefaultAccountName(\n userStorageAccount.n,\n );\n\n // Internal account has default name\n if (isInternalAccountNameDefault) {\n if (!isUserStorageAccountNameDefault) {\n this.messagingSystem.call(\n 'AccountsController:updateAccountMetadata',\n internalAccount.id,\n {\n name: userStorageAccount.n,\n },\n );\n }\n continue;\n }\n\n // Internal account has custom name but user storage account has default name\n if (isUserStorageAccountNameDefault) {\n await this.#accounts.saveInternalAccountToUserStorage(\n internalAccount.address,\n );\n continue;\n }\n\n // Both accounts have custom names\n\n // User storage account has a nameLastUpdatedAt timestamp\n // Note: not storing the undefined checks in constants to act as a type guard\n if (userStorageAccount.nlu !== undefined) {\n if (internalAccount.metadata.nameLastUpdatedAt !== undefined) {\n const isInternalAccountNameNewer =\n internalAccount.metadata.nameLastUpdatedAt >\n userStorageAccount.nlu;\n\n if (isInternalAccountNameNewer) {\n await this.#accounts.saveInternalAccountToUserStorage(\n internalAccount.address,\n );\n continue;\n }\n }\n\n this.messagingSystem.call(\n 'AccountsController:updateAccountMetadata',\n internalAccount.id,\n {\n name: userStorageAccount.n,\n nameLastUpdatedAt: userStorageAccount.nlu,\n },\n );\n\n continue;\n } else if (internalAccount.metadata.nameLastUpdatedAt !== undefined) {\n await this.#accounts.saveInternalAccountToUserStorage(\n internalAccount.address,\n );\n continue;\n }\n }\n } catch (e) {\n const errorMessage = e instanceof Error ? e.message : JSON.stringify(e);\n throw new Error(\n `${controllerName} - failed to sync user storage accounts list - ${errorMessage}`,\n );\n }\n }\n\n /**\n * Saves an individual internal account to the user storage.\n * @param address - The address of the internal account to save\n */\n async saveInternalAccountToUserStorage(address: string): Promise<void> {\n if (!this.#accounts.isAccountSyncingEnabled) {\n return;\n }\n\n try {\n await this.#accounts.saveInternalAccountToUserStorage(address);\n } catch (e) {\n const errorMessage = e instanceof Error ? e.message : JSON.stringify(e);\n throw new Error(\n `${controllerName} - failed to save account to user storage - ${errorMessage}`,\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAS,sBAAsB;AAwD/B,IAAM,iBAAiB;AAchB,IAAM,eAA2C;AAAA,EACtD,yBAAyB;AAAA,EACzB,+BAA+B;AACjC;AAEA,IAAM,WAAsD;AAAA,EAC1D,yBAAyB;AAAA,IACvB,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,+BAA+B;AAAA,IAC7B,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AACF;AA/FA;AA0MA,IAAqB,wBAArB,cAAmD,eAIjD;AAAA,EAgJA,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GASG;AACD,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA,MAAM;AAAA,MACN,OAAO,EAAE,GAAG,cAAc,GAAG,MAAM;AAAA,IACrC,CAAC;AAkBH;AAAA;AAAA;AAAA;AAAA;AAmMA;AAWA;AAAA;AAAA;AAAA,uBAAM;AAkBN;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAM;AAmBN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAM;AAqBN;AA9bA,8BAAQ;AAAA,MACN,gBAAgB,YAAY;AAC1B,eAAO,MAAM,KAAK,gBAAgB;AAAA,UAChC;AAAA,QACF;AAAA,MACF;AAAA,MACA,cAAc,YAAY;AACxB,cA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R;AAAA,IACF;AAAA,EACF;AAEA,QAAM,SAAU,MAAM,KAAK,gBAAgB;AAAA,IACzC;AAAA,IACA,6BAA6B,OAAO;AAAA,EACtC;AAEA,qBAAK,wBAAuB,OAAO,IAAI;AAEvC,SAAO;AACT;AAEA;AAAA,sCAAiC,SAC/B,+BACM;AACN,OAAK,OAAO,CAAC,UAAU;AACrB,UAAM,gCAAgC;AAAA,EACxC,CAAC;AACH;","names":[]}
@@ -20,10 +20,10 @@ var _chunkPQ5T4GHYjs = require('./chunk-PQ5T4GHY.js');
20
20
 
21
21
 
22
22
 
23
- var _chunkZMQRPWJNjs = require('./chunk-ZMQRPWJN.js');
23
+ var _chunkUIRAMHNMjs = require('./chunk-UIRAMHNM.js');
24
24
 
25
25
 
26
- var _chunkT3FNDVE3js = require('./chunk-T3FNDVE3.js');
26
+ var _chunkBKQE7DB5js = require('./chunk-BKQE7DB5.js');
27
27
 
28
28
 
29
29
 
@@ -57,14 +57,14 @@ _chunkIGY2S5BCjs.__export.call(void 0, sdk_exports, {
57
57
  SIWEJwtBearerAuth: () => _chunkKIVBL6OMjs.SIWEJwtBearerAuth,
58
58
  SNAP_ORIGIN: () => _chunkPQ5T4GHYjs.SNAP_ORIGIN,
59
59
  SRPJwtBearerAuth: () => _chunk4ZGRRVMIjs.SRPJwtBearerAuth,
60
- STORAGE_URL: () => _chunkZMQRPWJNjs.STORAGE_URL,
60
+ STORAGE_URL: () => _chunkUIRAMHNMjs.STORAGE_URL,
61
61
  SignInError: () => _chunkMBTBE4P5js.SignInError,
62
62
  UnsupportedAuthTypeError: () => _chunkMBTBE4P5js.UnsupportedAuthTypeError,
63
- UserStorage: () => _chunkZMQRPWJNjs.UserStorage,
63
+ UserStorage: () => _chunkUIRAMHNMjs.UserStorage,
64
64
  UserStorageError: () => _chunkMBTBE4P5js.UserStorageError,
65
65
  ValidationError: () => _chunkMBTBE4P5js.ValidationError,
66
66
  connectSnap: () => _chunkPQ5T4GHYjs.connectSnap,
67
- createSHA256Hash: () => _chunkT3FNDVE3js.createSHA256Hash,
67
+ createSHA256Hash: () => _chunkBKQE7DB5js.createSHA256Hash,
68
68
  getEnvUrls: () => _chunkDF24ZX4Hjs.getEnvUrls,
69
69
  getOidcClientId: () => _chunkDF24ZX4Hjs.getOidcClientId,
70
70
  getSnap: () => _chunkPQ5T4GHYjs.getSnap,
@@ -74,4 +74,4 @@ _chunkIGY2S5BCjs.__export.call(void 0, sdk_exports, {
74
74
 
75
75
 
76
76
  exports.sdk_exports = sdk_exports;
77
- //# sourceMappingURL=chunk-JJ5BDCKD.js.map
77
+ //# sourceMappingURL=chunk-T2YURW25.js.map
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkBKQE7DB5js = require('./chunk-BKQE7DB5.js');
4
+
5
+ // src/sdk/encryption.ts
6
+ var encryption_default2 = _chunkBKQE7DB5js.encryption_default;
7
+
8
+
9
+
10
+ exports.encryption_default = encryption_default2;
11
+ //# sourceMappingURL=chunk-UHX7HJAI.js.map
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkEYZFHZR2js = require('./chunk-EYZFHZR2.js');
3
+ var _chunk5MQUI24Ujs = require('./chunk-5MQUI24U.js');
4
4
 
5
5
 
6
- var _chunkLDYHGAP4js = require('./chunk-LDYHGAP4.js');
6
+ var _chunkUHX7HJAIjs = require('./chunk-UHX7HJAI.js');
7
7
 
8
8
 
9
- var _chunkT3FNDVE3js = require('./chunk-T3FNDVE3.js');
9
+ var _chunkBKQE7DB5js = require('./chunk-BKQE7DB5.js');
10
10
 
11
11
 
12
12
  var _chunkDF24ZX4Hjs = require('./chunk-DF24ZX4H.js');
@@ -53,7 +53,7 @@ var UserStorage = class {
53
53
  const storageKeySignature = await this.config.auth.signMessage(
54
54
  `metamask:${userProfile.profileId}`
55
55
  );
56
- const hashedStorageKeySignature = _chunkT3FNDVE3js.createSHA256Hash.call(void 0, storageKeySignature);
56
+ const hashedStorageKeySignature = _chunkBKQE7DB5js.createSHA256Hash.call(void 0, storageKeySignature);
57
57
  await this.options.storage?.setStorageKey(hashedStorageKeySignature);
58
58
  return hashedStorageKeySignature;
59
59
  }
@@ -63,8 +63,8 @@ upsertUserStorage_fn = async function(path, data) {
63
63
  try {
64
64
  const headers = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getAuthorizationHeader, getAuthorizationHeader_fn).call(this);
65
65
  const storageKey = await this.getStorageKey();
66
- const encryptedData = _chunkLDYHGAP4js.encryption_default.encryptString(data, storageKey);
67
- const encryptedPath = _chunkEYZFHZR2js.createEntryPath.call(void 0, path, storageKey);
66
+ const encryptedData = _chunkUHX7HJAIjs.encryption_default.encryptString(data, storageKey);
67
+ const encryptedPath = _chunk5MQUI24Ujs.createEntryPath.call(void 0, path, storageKey);
68
68
  const url = new URL(STORAGE_URL(this.env, encryptedPath));
69
69
  const response = await fetch(url.toString(), {
70
70
  method: "PUT",
@@ -95,7 +95,7 @@ getUserStorage_fn = async function(path) {
95
95
  try {
96
96
  const headers = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getAuthorizationHeader, getAuthorizationHeader_fn).call(this);
97
97
  const storageKey = await this.getStorageKey();
98
- const encryptedPath = _chunkEYZFHZR2js.createEntryPath.call(void 0, path, storageKey);
98
+ const encryptedPath = _chunk5MQUI24Ujs.createEntryPath.call(void 0, path, storageKey);
99
99
  const url = new URL(STORAGE_URL(this.env, encryptedPath));
100
100
  const response = await fetch(url.toString(), {
101
101
  headers: {
@@ -115,7 +115,7 @@ getUserStorage_fn = async function(path) {
115
115
  );
116
116
  }
117
117
  const { Data: encryptedData } = await response.json();
118
- return _chunkLDYHGAP4js.encryption_default.decryptString(encryptedData, storageKey);
118
+ return _chunkUHX7HJAIjs.encryption_default.decryptString(encryptedData, storageKey);
119
119
  } catch (e) {
120
120
  if (e instanceof _chunkMBTBE4P5js.NotFoundError) {
121
121
  throw e;
@@ -155,9 +155,9 @@ getUserStorageAllFeatureEntries_fn = async function(path) {
155
155
  if (!entry.Data) {
156
156
  return [];
157
157
  }
158
- return _chunkLDYHGAP4js.encryption_default.decryptString(entry.Data, storageKey);
158
+ return _chunkUHX7HJAIjs.encryption_default.decryptString(entry.Data, storageKey);
159
159
  });
160
- return decryptedData;
160
+ return (await Promise.allSettled(decryptedData)).map((d) => d.status === "fulfilled" ? d.value : void 0).filter((d) => d !== void 0);
161
161
  } catch (e) {
162
162
  if (e instanceof _chunkMBTBE4P5js.NotFoundError) {
163
163
  throw e;
@@ -170,7 +170,7 @@ getUserStorageAllFeatureEntries_fn = async function(path) {
170
170
  };
171
171
  _createEntryKey = new WeakSet();
172
172
  createEntryKey_fn = function(key, storageKey) {
173
- const hashedKey = _chunkT3FNDVE3js.createSHA256Hash.call(void 0, key + storageKey);
173
+ const hashedKey = _chunkBKQE7DB5js.createSHA256Hash.call(void 0, key + storageKey);
174
174
  return hashedKey;
175
175
  };
176
176
  _getAuthorizationHeader = new WeakSet();
@@ -183,4 +183,4 @@ getAuthorizationHeader_fn = async function() {
183
183
 
184
184
 
185
185
  exports.STORAGE_URL = STORAGE_URL; exports.UserStorage = UserStorage;
186
- //# sourceMappingURL=chunk-ZMQRPWJN.js.map
186
+ //# sourceMappingURL=chunk-UIRAMHNM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sdk/user-storage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAYO,IAAM,cAAc,CAAC,KAAU,kBACpC,GAAG,WAAW,GAAG,EAAE,iBAAiB,uBAAuB,aAAa;AAb1E;AAkCO,IAAM,cAAN,MAAkB;AAAA,EAOvB,YAAY,QAA2B,SAA6B;AAsCpE,uBAAM;AAwCN,uBAAM;AA+CN,uBAAM;AA4DN;AAOA;AAAA;AAAA,uBAAM;AA/LJ,SAAK,MAAM,OAAO;AAClB,SAAK,SAAS;AACd,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,MAAM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BAAuB,iBAAuC;AAClE,QAAM,cAAc,MAAM,KAAK,OAAO,KAAK,eAAe;AAC1D,SAAO,EAAE,eAAe,UAAU,WAAW,GAAG;AAClD","sourcesContent":["import type {\n UserStoragePathWithFeatureAndKey,\n UserStoragePathWithFeatureOnly,\n} from '../controllers/user-storage/schema';\nimport { createEntryPath } from '../controllers/user-storage/schema';\nimport type { GetUserStorageAllFeatureEntriesResponse } from '../controllers/user-storage/services';\nimport type { IBaseAuth } from './authentication-jwt-bearer/types';\nimport encryption, { createSHA256Hash } from './encryption';\nimport type { Env } from './env';\nimport { getEnvUrls } from './env';\nimport { NotFoundError, UserStorageError } from './errors';\n\nexport const STORAGE_URL = (env: Env, encryptedPath: string) =>\n `${getEnvUrls(env).userStorageApiUrl}/api/v1/userstorage/${encryptedPath}`;\n\nexport type UserStorageConfig = {\n env: Env;\n auth: Pick<IBaseAuth, 'getAccessToken' | 'getUserProfile' | 'signMessage'>;\n};\n\nexport type StorageOptions = {\n getStorageKey: () => Promise<string | null>;\n setStorageKey: (val: string) => Promise<void>;\n};\n\nexport type UserStorageOptions = {\n storage?: StorageOptions;\n};\n\ntype ErrorMessage = {\n message: string;\n error: string;\n};\n\nexport class UserStorage {\n protected config: UserStorageConfig;\n\n protected options: UserStorageOptions;\n\n protected env: Env;\n\n constructor(config: UserStorageConfig, options: UserStorageOptions) {\n this.env = config.env;\n this.config = config;\n this.options = options;\n }\n\n async setItem(\n path: UserStoragePathWithFeatureAndKey,\n value: string,\n ): Promise<void> {\n await this.#upsertUserStorage(path, value);\n }\n\n async getItem(path: UserStoragePathWithFeatureAndKey): Promise<string> {\n return this.#getUserStorage(path);\n }\n\n async getAllFeatureItems(\n path: UserStoragePathWithFeatureOnly,\n ): Promise<string[] | null> {\n return this.#getUserStorageAllFeatureEntries(path);\n }\n\n async getStorageKey(): Promise<string> {\n const storageKey = await this.options.storage?.getStorageKey();\n if (storageKey) {\n return storageKey;\n }\n\n const userProfile = await this.config.auth.getUserProfile();\n const storageKeySignature = await this.config.auth.signMessage(\n `metamask:${userProfile.profileId}`,\n );\n const hashedStorageKeySignature = createSHA256Hash(storageKeySignature);\n await this.options.storage?.setStorageKey(hashedStorageKeySignature);\n return hashedStorageKeySignature;\n }\n\n async #upsertUserStorage(\n path: UserStoragePathWithFeatureAndKey,\n data: string,\n ): Promise<void> {\n try {\n const headers = await this.#getAuthorizationHeader();\n const storageKey = await this.getStorageKey();\n const encryptedData = encryption.encryptString(data, storageKey);\n const encryptedPath = createEntryPath(path, storageKey);\n\n const url = new URL(STORAGE_URL(this.env, encryptedPath));\n\n const response = await fetch(url.toString(), {\n method: 'PUT',\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n body: JSON.stringify({ data: encryptedData }),\n });\n\n if (!response.ok) {\n const responseBody: ErrorMessage = await response.json().catch(() => ({\n message: 'unknown',\n error: 'unknown',\n }));\n throw new Error(\n `HTTP error message: ${responseBody.message}, error: ${responseBody.error}`,\n );\n }\n } catch (e) {\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n throw new UserStorageError(\n `failed to upsert user storage for path '${path}'. ${errorMessage}`,\n );\n }\n }\n\n async #getUserStorage(\n path: UserStoragePathWithFeatureAndKey,\n ): Promise<string> {\n try {\n const headers = await this.#getAuthorizationHeader();\n const storageKey = await this.getStorageKey();\n const encryptedPath = createEntryPath(path, storageKey);\n\n const url = new URL(STORAGE_URL(this.env, encryptedPath));\n\n const response = await fetch(url.toString(), {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n });\n\n if (response.status === 404) {\n throw new NotFoundError(\n `feature/key set not found for path '${path}'.`,\n );\n }\n\n if (!response.ok) {\n const responseBody = (await response.json()) as ErrorMessage;\n throw new Error(\n `HTTP error message: ${responseBody.message}, error: ${responseBody.error}`,\n );\n }\n\n const { Data: encryptedData } = await response.json();\n return encryption.decryptString(encryptedData, storageKey);\n } catch (e) {\n if (e instanceof NotFoundError) {\n throw e;\n }\n\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n\n throw new UserStorageError(\n `failed to get user storage for path '${path}'. ${errorMessage}`,\n );\n }\n }\n\n async #getUserStorageAllFeatureEntries(\n path: UserStoragePathWithFeatureOnly,\n ): Promise<string[] | null> {\n try {\n const headers = await this.#getAuthorizationHeader();\n const storageKey = await this.getStorageKey();\n\n const url = new URL(STORAGE_URL(this.env, path));\n\n const response = await fetch(url.toString(), {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n });\n\n if (response.status === 404) {\n throw new NotFoundError(`feature not found for path '${path}'.`);\n }\n\n if (!response.ok) {\n const responseBody = (await response.json()) as ErrorMessage;\n throw new Error(\n `HTTP error message: ${responseBody.message}, error: ${responseBody.error}`,\n );\n }\n\n const userStorage: GetUserStorageAllFeatureEntriesResponse | null =\n await response.json();\n\n if (!Array.isArray(userStorage)) {\n return null;\n }\n\n const decryptedData = userStorage.flatMap((entry) => {\n if (!entry.Data) {\n return [];\n }\n\n return encryption.decryptString(entry.Data, storageKey);\n });\n\n return (await Promise.allSettled(decryptedData))\n .map((d) => (d.status === 'fulfilled' ? d.value : undefined))\n .filter((d): d is string => d !== undefined);\n } catch (e) {\n if (e instanceof NotFoundError) {\n throw e;\n }\n\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n\n throw new UserStorageError(\n `failed to get user storage for path '${path}'. ${errorMessage}`,\n );\n }\n }\n\n #createEntryKey(key: string, storageKey: string): string {\n const hashedKey = createSHA256Hash(key + storageKey);\n return hashedKey;\n }\n\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n async #getAuthorizationHeader(): Promise<{ Authorization: string }> {\n const accessToken = await this.config.auth.getAccessToken();\n return { Authorization: `Bearer ${accessToken}` };\n }\n}\n"]}
@@ -5,15 +5,15 @@ require('../chunk-F6BAOSH2.js');
5
5
  require('../chunk-ZX2KHPXG.js');
6
6
 
7
7
 
8
- var _chunkWAFY3R2Fjs = require('../chunk-WAFY3R2F.js');
9
- require('../chunk-LNECIW4K.js');
8
+ var _chunkCHUZGCDVjs = require('../chunk-CHUZGCDV.js');
9
+ require('../chunk-246Z6L5V.js');
10
10
  require('../chunk-GQXYWBFK.js');
11
11
  require('../chunk-JAQ5TPSZ.js');
12
12
  require('../chunk-YHGWG3EQ.js');
13
- require('../chunk-HMRRB4EX.js');
14
- require('../chunk-EYZFHZR2.js');
15
- require('../chunk-AK7OTIWA.js');
16
- require('../chunk-T3FNDVE3.js');
13
+ require('../chunk-4LMFZDL4.js');
14
+ require('../chunk-5MQUI24U.js');
15
+ require('../chunk-NIUQ34PY.js');
16
+ require('../chunk-BKQE7DB5.js');
17
17
  require('../chunk-UAXWZN5J.js');
18
18
  require('../chunk-PCOIRDTO.js');
19
19
  require('../chunk-DF24ZX4H.js');
@@ -21,5 +21,5 @@ require('../chunk-IGY2S5BC.js');
21
21
 
22
22
 
23
23
 
24
- exports.Authentication = _chunkPRYLTXW4js.authentication_exports; exports.UserStorage = _chunkWAFY3R2Fjs.user_storage_exports;
24
+ exports.Authentication = _chunkPRYLTXW4js.authentication_exports; exports.UserStorage = _chunkCHUZGCDVjs.user_storage_exports;
25
25
  //# sourceMappingURL=index.js.map
@@ -5,15 +5,15 @@ import "../chunk-D4SNJOID.mjs";
5
5
  import "../chunk-LGXQBALM.mjs";
6
6
  import {
7
7
  user_storage_exports
8
- } from "../chunk-ZYYAQJ56.mjs";
9
- import "../chunk-M23ZCTKE.mjs";
8
+ } from "../chunk-2677XY6G.mjs";
9
+ import "../chunk-SZ6WMC6C.mjs";
10
10
  import "../chunk-ZUPTMFEA.mjs";
11
11
  import "../chunk-EHZFPUJH.mjs";
12
12
  import "../chunk-NMIF3LSX.mjs";
13
- import "../chunk-LYDHYB6I.mjs";
14
- import "../chunk-NSSHFDIS.mjs";
15
- import "../chunk-5TOWF6UW.mjs";
16
- import "../chunk-K5UKU454.mjs";
13
+ import "../chunk-76NMME23.mjs";
14
+ import "../chunk-2VEMA6OE.mjs";
15
+ import "../chunk-KHASG4H3.mjs";
16
+ import "../chunk-COBJUBZE.mjs";
17
17
  import "../chunk-H25EBXG5.mjs";
18
18
  import "../chunk-76VRE4BI.mjs";
19
19
  import "../chunk-KTCSRECK.mjs";
@@ -1,14 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkLNECIW4Kjs = require('../../chunk-LNECIW4K.js');
4
+ var _chunk246Z6L5Vjs = require('../../chunk-246Z6L5V.js');
5
5
  require('../../chunk-GQXYWBFK.js');
6
6
  require('../../chunk-JAQ5TPSZ.js');
7
7
  require('../../chunk-YHGWG3EQ.js');
8
- require('../../chunk-HMRRB4EX.js');
9
- require('../../chunk-EYZFHZR2.js');
10
- require('../../chunk-AK7OTIWA.js');
11
- require('../../chunk-T3FNDVE3.js');
8
+ require('../../chunk-4LMFZDL4.js');
9
+ require('../../chunk-5MQUI24U.js');
10
+ require('../../chunk-NIUQ34PY.js');
11
+ require('../../chunk-BKQE7DB5.js');
12
12
  require('../../chunk-UAXWZN5J.js');
13
13
  require('../../chunk-PCOIRDTO.js');
14
14
  require('../../chunk-DF24ZX4H.js');
@@ -16,5 +16,5 @@ require('../../chunk-IGY2S5BC.js');
16
16
 
17
17
 
18
18
 
19
- exports.default = _chunkLNECIW4Kjs.UserStorageController; exports.defaultState = _chunkLNECIW4Kjs.defaultState;
19
+ exports.default = _chunk246Z6L5Vjs.UserStorageController; exports.defaultState = _chunk246Z6L5Vjs.defaultState;
20
20
  //# sourceMappingURL=UserStorageController.js.map
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  UserStorageController,
3
3
  defaultState
4
- } from "../../chunk-M23ZCTKE.mjs";
4
+ } from "../../chunk-SZ6WMC6C.mjs";
5
5
  import "../../chunk-ZUPTMFEA.mjs";
6
6
  import "../../chunk-EHZFPUJH.mjs";
7
7
  import "../../chunk-NMIF3LSX.mjs";
8
- import "../../chunk-LYDHYB6I.mjs";
9
- import "../../chunk-NSSHFDIS.mjs";
10
- import "../../chunk-5TOWF6UW.mjs";
11
- import "../../chunk-K5UKU454.mjs";
8
+ import "../../chunk-76NMME23.mjs";
9
+ import "../../chunk-2VEMA6OE.mjs";
10
+ import "../../chunk-KHASG4H3.mjs";
11
+ import "../../chunk-COBJUBZE.mjs";
12
12
  import "../../chunk-H25EBXG5.mjs";
13
13
  import "../../chunk-76VRE4BI.mjs";
14
14
  import "../../chunk-KTCSRECK.mjs";
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkT3FNDVE3js = require('../../../chunk-T3FNDVE3.js');
4
+ var _chunkBKQE7DB5js = require('../../../chunk-BKQE7DB5.js');
5
5
  require('../../../chunk-UAXWZN5J.js');
6
6
  require('../../../chunk-PCOIRDTO.js');
7
7
  require('../../../chunk-IGY2S5BC.js');
8
8
 
9
9
 
10
10
 
11
- exports.createSHA256Hash = _chunkT3FNDVE3js.createSHA256Hash; exports.default = _chunkT3FNDVE3js.encryption_default;
11
+ exports.createSHA256Hash = _chunkBKQE7DB5js.createSHA256Hash; exports.default = _chunkBKQE7DB5js.encryption_default;
12
12
  //# sourceMappingURL=encryption.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createSHA256Hash,
3
3
  encryption_default
4
- } from "../../../chunk-K5UKU454.mjs";
4
+ } from "../../../chunk-COBJUBZE.mjs";
5
5
  import "../../../chunk-H25EBXG5.mjs";
6
6
  import "../../../chunk-76VRE4BI.mjs";
7
7
  import "../../../chunk-U5UIDVOO.mjs";
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkAK7OTIWAjs = require('../../../chunk-AK7OTIWA.js');
3
+ var _chunkNIUQ34PYjs = require('../../../chunk-NIUQ34PY.js');
4
4
 
5
5
 
6
6
 
7
- var _chunkT3FNDVE3js = require('../../../chunk-T3FNDVE3.js');
7
+ var _chunkBKQE7DB5js = require('../../../chunk-BKQE7DB5.js');
8
8
  require('../../../chunk-UAXWZN5J.js');
9
9
  require('../../../chunk-PCOIRDTO.js');
10
10
  require('../../../chunk-IGY2S5BC.js');
@@ -12,5 +12,5 @@ require('../../../chunk-IGY2S5BC.js');
12
12
 
13
13
 
14
14
 
15
- exports.Encryption = _chunkT3FNDVE3js.encryption_default; exports.createSHA256Hash = _chunkT3FNDVE3js.createSHA256Hash; exports.default = _chunkAK7OTIWAjs.encryption_default;
15
+ exports.Encryption = _chunkBKQE7DB5js.encryption_default; exports.createSHA256Hash = _chunkBKQE7DB5js.createSHA256Hash; exports.default = _chunkNIUQ34PYjs.encryption_default;
16
16
  //# sourceMappingURL=index.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  encryption_default as encryption_default2
3
- } from "../../../chunk-5TOWF6UW.mjs";
3
+ } from "../../../chunk-KHASG4H3.mjs";
4
4
  import {
5
5
  createSHA256Hash,
6
6
  encryption_default
7
- } from "../../../chunk-K5UKU454.mjs";
7
+ } from "../../../chunk-COBJUBZE.mjs";
8
8
  import "../../../chunk-H25EBXG5.mjs";
9
9
  import "../../../chunk-76VRE4BI.mjs";
10
10
  import "../../../chunk-U5UIDVOO.mjs";
@@ -1,21 +1,21 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkWAFY3R2Fjs = require('../../chunk-WAFY3R2F.js');
4
+ var _chunkCHUZGCDVjs = require('../../chunk-CHUZGCDV.js');
5
5
 
6
6
 
7
7
 
8
- var _chunkLNECIW4Kjs = require('../../chunk-LNECIW4K.js');
8
+ var _chunk246Z6L5Vjs = require('../../chunk-246Z6L5V.js');
9
9
  require('../../chunk-GQXYWBFK.js');
10
10
  require('../../chunk-JAQ5TPSZ.js');
11
11
  require('../../chunk-YHGWG3EQ.js');
12
- require('../../chunk-HMRRB4EX.js');
13
- require('../../chunk-EYZFHZR2.js');
14
- require('../../chunk-AK7OTIWA.js');
12
+ require('../../chunk-4LMFZDL4.js');
13
+ require('../../chunk-5MQUI24U.js');
14
+ require('../../chunk-NIUQ34PY.js');
15
15
 
16
16
 
17
17
 
18
- var _chunkT3FNDVE3js = require('../../chunk-T3FNDVE3.js');
18
+ var _chunkBKQE7DB5js = require('../../chunk-BKQE7DB5.js');
19
19
  require('../../chunk-UAXWZN5J.js');
20
20
  require('../../chunk-PCOIRDTO.js');
21
21
  require('../../chunk-DF24ZX4H.js');
@@ -27,5 +27,5 @@ require('../../chunk-IGY2S5BC.js');
27
27
 
28
28
 
29
29
 
30
- exports.Controller = _chunkLNECIW4Kjs.UserStorageController; exports.Encryption = _chunkT3FNDVE3js.encryption_default; exports.Mocks = _chunkWAFY3R2Fjs.fixtures_exports; exports.createSHA256Hash = _chunkT3FNDVE3js.createSHA256Hash; exports.default = _chunkWAFY3R2Fjs.user_storage_default; exports.defaultState = _chunkLNECIW4Kjs.defaultState;
30
+ exports.Controller = _chunk246Z6L5Vjs.UserStorageController; exports.Encryption = _chunkBKQE7DB5js.encryption_default; exports.Mocks = _chunkCHUZGCDVjs.fixtures_exports; exports.createSHA256Hash = _chunkBKQE7DB5js.createSHA256Hash; exports.default = _chunkCHUZGCDVjs.user_storage_default; exports.defaultState = _chunk246Z6L5Vjs.defaultState;
31
31
  //# sourceMappingURL=index.js.map
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  fixtures_exports,
3
3
  user_storage_default
4
- } from "../../chunk-ZYYAQJ56.mjs";
4
+ } from "../../chunk-2677XY6G.mjs";
5
5
  import {
6
6
  UserStorageController,
7
7
  defaultState
8
- } from "../../chunk-M23ZCTKE.mjs";
8
+ } from "../../chunk-SZ6WMC6C.mjs";
9
9
  import "../../chunk-ZUPTMFEA.mjs";
10
10
  import "../../chunk-EHZFPUJH.mjs";
11
11
  import "../../chunk-NMIF3LSX.mjs";
12
- import "../../chunk-LYDHYB6I.mjs";
13
- import "../../chunk-NSSHFDIS.mjs";
14
- import "../../chunk-5TOWF6UW.mjs";
12
+ import "../../chunk-76NMME23.mjs";
13
+ import "../../chunk-2VEMA6OE.mjs";
14
+ import "../../chunk-KHASG4H3.mjs";
15
15
  import {
16
16
  createSHA256Hash,
17
17
  encryption_default
18
- } from "../../chunk-K5UKU454.mjs";
18
+ } from "../../chunk-COBJUBZE.mjs";
19
19
  import "../../chunk-H25EBXG5.mjs";
20
20
  import "../../chunk-76VRE4BI.mjs";
21
21
  import "../../chunk-KTCSRECK.mjs";
@@ -3,9 +3,9 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkEYZFHZR2js = require('../../chunk-EYZFHZR2.js');
7
- require('../../chunk-AK7OTIWA.js');
8
- require('../../chunk-T3FNDVE3.js');
6
+ var _chunk5MQUI24Ujs = require('../../chunk-5MQUI24U.js');
7
+ require('../../chunk-NIUQ34PY.js');
8
+ require('../../chunk-BKQE7DB5.js');
9
9
  require('../../chunk-UAXWZN5J.js');
10
10
  require('../../chunk-PCOIRDTO.js');
11
11
  require('../../chunk-IGY2S5BC.js');
@@ -14,5 +14,5 @@ require('../../chunk-IGY2S5BC.js');
14
14
 
15
15
 
16
16
 
17
- exports.USER_STORAGE_SCHEMA = _chunkEYZFHZR2js.USER_STORAGE_SCHEMA; exports.createEntryPath = _chunkEYZFHZR2js.createEntryPath; exports.getFeatureAndKeyFromPath = _chunkEYZFHZR2js.getFeatureAndKeyFromPath; exports.isPathWithFeatureAndKey = _chunkEYZFHZR2js.isPathWithFeatureAndKey;
17
+ exports.USER_STORAGE_SCHEMA = _chunk5MQUI24Ujs.USER_STORAGE_SCHEMA; exports.createEntryPath = _chunk5MQUI24Ujs.createEntryPath; exports.getFeatureAndKeyFromPath = _chunk5MQUI24Ujs.getFeatureAndKeyFromPath; exports.isPathWithFeatureAndKey = _chunk5MQUI24Ujs.isPathWithFeatureAndKey;
18
18
  //# sourceMappingURL=schema.js.map
@@ -3,9 +3,9 @@ import {
3
3
  createEntryPath,
4
4
  getFeatureAndKeyFromPath,
5
5
  isPathWithFeatureAndKey
6
- } from "../../chunk-NSSHFDIS.mjs";
7
- import "../../chunk-5TOWF6UW.mjs";
8
- import "../../chunk-K5UKU454.mjs";
6
+ } from "../../chunk-2VEMA6OE.mjs";
7
+ import "../../chunk-KHASG4H3.mjs";
8
+ import "../../chunk-COBJUBZE.mjs";
9
9
  import "../../chunk-H25EBXG5.mjs";
10
10
  import "../../chunk-76VRE4BI.mjs";
11
11
  import "../../chunk-U5UIDVOO.mjs";
@@ -4,10 +4,10 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkHMRRB4EXjs = require('../../chunk-HMRRB4EX.js');
8
- require('../../chunk-EYZFHZR2.js');
9
- require('../../chunk-AK7OTIWA.js');
10
- require('../../chunk-T3FNDVE3.js');
7
+ var _chunk4LMFZDL4js = require('../../chunk-4LMFZDL4.js');
8
+ require('../../chunk-5MQUI24U.js');
9
+ require('../../chunk-NIUQ34PY.js');
10
+ require('../../chunk-BKQE7DB5.js');
11
11
  require('../../chunk-UAXWZN5J.js');
12
12
  require('../../chunk-PCOIRDTO.js');
13
13
  require('../../chunk-DF24ZX4H.js');
@@ -18,5 +18,5 @@ require('../../chunk-IGY2S5BC.js');
18
18
 
19
19
 
20
20
 
21
- exports.USER_STORAGE_API = _chunkHMRRB4EXjs.USER_STORAGE_API; exports.USER_STORAGE_ENDPOINT = _chunkHMRRB4EXjs.USER_STORAGE_ENDPOINT; exports.getUserStorage = _chunkHMRRB4EXjs.getUserStorage; exports.getUserStorageAllFeatureEntries = _chunkHMRRB4EXjs.getUserStorageAllFeatureEntries; exports.upsertUserStorage = _chunkHMRRB4EXjs.upsertUserStorage;
21
+ exports.USER_STORAGE_API = _chunk4LMFZDL4js.USER_STORAGE_API; exports.USER_STORAGE_ENDPOINT = _chunk4LMFZDL4js.USER_STORAGE_ENDPOINT; exports.getUserStorage = _chunk4LMFZDL4js.getUserStorage; exports.getUserStorageAllFeatureEntries = _chunk4LMFZDL4js.getUserStorageAllFeatureEntries; exports.upsertUserStorage = _chunk4LMFZDL4js.upsertUserStorage;
22
22
  //# sourceMappingURL=services.js.map
@@ -4,10 +4,10 @@ import {
4
4
  getUserStorage,
5
5
  getUserStorageAllFeatureEntries,
6
6
  upsertUserStorage
7
- } from "../../chunk-LYDHYB6I.mjs";
8
- import "../../chunk-NSSHFDIS.mjs";
9
- import "../../chunk-5TOWF6UW.mjs";
10
- import "../../chunk-K5UKU454.mjs";
7
+ } from "../../chunk-76NMME23.mjs";
8
+ import "../../chunk-2VEMA6OE.mjs";
9
+ import "../../chunk-KHASG4H3.mjs";
10
+ import "../../chunk-COBJUBZE.mjs";
11
11
  import "../../chunk-H25EBXG5.mjs";
12
12
  import "../../chunk-76VRE4BI.mjs";
13
13
  import "../../chunk-KTCSRECK.mjs";
package/dist/index.js CHANGED
@@ -5,15 +5,15 @@ require('./chunk-F6BAOSH2.js');
5
5
  require('./chunk-ZX2KHPXG.js');
6
6
 
7
7
 
8
- var _chunkWAFY3R2Fjs = require('./chunk-WAFY3R2F.js');
9
- require('./chunk-LNECIW4K.js');
8
+ var _chunkCHUZGCDVjs = require('./chunk-CHUZGCDV.js');
9
+ require('./chunk-246Z6L5V.js');
10
10
  require('./chunk-GQXYWBFK.js');
11
11
  require('./chunk-JAQ5TPSZ.js');
12
12
  require('./chunk-YHGWG3EQ.js');
13
- require('./chunk-HMRRB4EX.js');
13
+ require('./chunk-4LMFZDL4.js');
14
14
 
15
15
 
16
- var _chunkJJ5BDCKDjs = require('./chunk-JJ5BDCKD.js');
16
+ var _chunkT2YURW25js = require('./chunk-T2YURW25.js');
17
17
  require('./chunk-Q5KTSMRE.js');
18
18
  require('./chunk-KIVBL6OM.js');
19
19
  require('./chunk-4ZGRRVMI.js');
@@ -22,11 +22,11 @@ require('./chunk-PBRUOBEQ.js');
22
22
  require('./chunk-RG4II6WH.js');
23
23
  require('./chunk-PQ5T4GHY.js');
24
24
  require('./chunk-DRB2MN4T.js');
25
- require('./chunk-ZMQRPWJN.js');
26
- require('./chunk-EYZFHZR2.js');
27
- require('./chunk-AK7OTIWA.js');
28
- require('./chunk-LDYHGAP4.js');
29
- require('./chunk-T3FNDVE3.js');
25
+ require('./chunk-UIRAMHNM.js');
26
+ require('./chunk-5MQUI24U.js');
27
+ require('./chunk-NIUQ34PY.js');
28
+ require('./chunk-UHX7HJAI.js');
29
+ require('./chunk-BKQE7DB5.js');
30
30
  require('./chunk-UAXWZN5J.js');
31
31
  require('./chunk-PCOIRDTO.js');
32
32
  require('./chunk-DF24ZX4H.js');
@@ -36,5 +36,5 @@ require('./chunk-IGY2S5BC.js');
36
36
 
37
37
 
38
38
 
39
- exports.AuthenticationController = _chunkPRYLTXW4js.authentication_exports; exports.SDK = _chunkJJ5BDCKDjs.sdk_exports; exports.UserStorageController = _chunkWAFY3R2Fjs.user_storage_exports;
39
+ exports.AuthenticationController = _chunkPRYLTXW4js.authentication_exports; exports.SDK = _chunkT2YURW25js.sdk_exports; exports.UserStorageController = _chunkCHUZGCDVjs.user_storage_exports;
40
40
  //# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -5,15 +5,15 @@ import "./chunk-D4SNJOID.mjs";
5
5
  import "./chunk-LGXQBALM.mjs";
6
6
  import {
7
7
  user_storage_exports
8
- } from "./chunk-ZYYAQJ56.mjs";
9
- import "./chunk-M23ZCTKE.mjs";
8
+ } from "./chunk-2677XY6G.mjs";
9
+ import "./chunk-SZ6WMC6C.mjs";
10
10
  import "./chunk-ZUPTMFEA.mjs";
11
11
  import "./chunk-EHZFPUJH.mjs";
12
12
  import "./chunk-NMIF3LSX.mjs";
13
- import "./chunk-LYDHYB6I.mjs";
13
+ import "./chunk-76NMME23.mjs";
14
14
  import {
15
15
  sdk_exports
16
- } from "./chunk-4WXZXVLI.mjs";
16
+ } from "./chunk-7MSQV43P.mjs";
17
17
  import "./chunk-YKOMKXG4.mjs";
18
18
  import "./chunk-2CWF7ZTL.mjs";
19
19
  import "./chunk-J7NSK6BO.mjs";
@@ -22,11 +22,11 @@ import "./chunk-CAIIVJAO.mjs";
22
22
  import "./chunk-5XSXZTED.mjs";
23
23
  import "./chunk-5EBUFNAN.mjs";
24
24
  import "./chunk-QDGLIUUS.mjs";
25
- import "./chunk-E7Z5TCQT.mjs";
26
- import "./chunk-NSSHFDIS.mjs";
27
- import "./chunk-5TOWF6UW.mjs";
28
- import "./chunk-QU4EXKJO.mjs";
29
- import "./chunk-K5UKU454.mjs";
25
+ import "./chunk-MK7ABX2V.mjs";
26
+ import "./chunk-2VEMA6OE.mjs";
27
+ import "./chunk-KHASG4H3.mjs";
28
+ import "./chunk-6DAK2U35.mjs";
29
+ import "./chunk-COBJUBZE.mjs";
30
30
  import "./chunk-H25EBXG5.mjs";
31
31
  import "./chunk-76VRE4BI.mjs";
32
32
  import "./chunk-KTCSRECK.mjs";