@metamask-previews/profile-sync-controller 16.0.0-preview-39fa8d37 → 16.0.0-preview-510657d5
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.
- package/CHANGELOG.md +7 -0
- package/dist/controllers/authentication/AuthenticationController.cjs +60 -24
- package/dist/controllers/authentication/AuthenticationController.cjs.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.d.cts +6 -4
- package/dist/controllers/authentication/AuthenticationController.d.cts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.d.mts +6 -4
- package/dist/controllers/authentication/AuthenticationController.d.mts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.mjs +61 -25
- package/dist/controllers/authentication/AuthenticationController.mjs.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.cjs +25 -4
- package/dist/controllers/authentication/auth-snap-requests.cjs.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.d.cts +12 -2
- package/dist/controllers/authentication/auth-snap-requests.d.cts.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.d.mts +12 -2
- package/dist/controllers/authentication/auth-snap-requests.d.mts.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.mjs +23 -3
- package/dist/controllers/authentication/auth-snap-requests.mjs.map +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.cjs +36 -3
- package/dist/controllers/authentication/mocks/mockResponses.cjs.map +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.d.cts +7 -5
- package/dist/controllers/authentication/mocks/mockResponses.d.cts.map +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.d.mts +7 -5
- package/dist/controllers/authentication/mocks/mockResponses.d.mts.map +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.mjs +36 -3
- package/dist/controllers/authentication/mocks/mockResponses.mjs.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.cjs +133 -30
- package/dist/controllers/user-storage/UserStorageController.cjs.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.d.cts +62 -10
- package/dist/controllers/user-storage/UserStorageController.d.cts.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.d.mts +62 -10
- package/dist/controllers/user-storage/UserStorageController.d.mts.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.mjs +130 -27
- package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/controller-integration.cjs +22 -26
- package/dist/controllers/user-storage/account-syncing/controller-integration.cjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/controller-integration.d.cts +5 -2
- package/dist/controllers/user-storage/account-syncing/controller-integration.d.cts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/controller-integration.d.mts +5 -2
- package/dist/controllers/user-storage/account-syncing/controller-integration.d.mts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/controller-integration.mjs +23 -27
- package/dist/controllers/user-storage/account-syncing/controller-integration.mjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/setup-subscriptions.cjs +3 -13
- package/dist/controllers/user-storage/account-syncing/setup-subscriptions.cjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/setup-subscriptions.d.cts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/setup-subscriptions.d.mts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/setup-subscriptions.mjs +3 -13
- package/dist/controllers/user-storage/account-syncing/setup-subscriptions.mjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/sync-utils.cjs +16 -7
- package/dist/controllers/user-storage/account-syncing/sync-utils.cjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/sync-utils.d.cts +6 -2
- package/dist/controllers/user-storage/account-syncing/sync-utils.d.cts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/sync-utils.d.mts +6 -2
- package/dist/controllers/user-storage/account-syncing/sync-utils.d.mts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/sync-utils.mjs +16 -7
- package/dist/controllers/user-storage/account-syncing/sync-utils.mjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/utils.cjs +1 -42
- package/dist/controllers/user-storage/account-syncing/utils.cjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/utils.d.cts +1 -18
- package/dist/controllers/user-storage/account-syncing/utils.d.cts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/utils.d.mts +1 -18
- package/dist/controllers/user-storage/account-syncing/utils.d.mts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/utils.mjs +0 -39
- package/dist/controllers/user-storage/account-syncing/utils.mjs.map +1 -1
- package/dist/controllers/user-storage/constants.cjs +1 -0
- package/dist/controllers/user-storage/constants.cjs.map +1 -1
- package/dist/controllers/user-storage/constants.d.cts +1 -0
- package/dist/controllers/user-storage/constants.d.cts.map +1 -1
- package/dist/controllers/user-storage/constants.d.mts +1 -0
- package/dist/controllers/user-storage/constants.d.mts.map +1 -1
- package/dist/controllers/user-storage/constants.mjs +1 -0
- package/dist/controllers/user-storage/constants.mjs.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/constants.cjs +12 -0
- package/dist/controllers/user-storage/contact-syncing/constants.cjs.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/constants.d.cts +9 -0
- package/dist/controllers/user-storage/contact-syncing/constants.d.cts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/constants.d.mts +9 -0
- package/dist/controllers/user-storage/contact-syncing/constants.d.mts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/constants.mjs +9 -0
- package/dist/controllers/user-storage/contact-syncing/constants.mjs.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs +299 -0
- package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/controller-integration.d.cts +44 -0
- package/dist/controllers/user-storage/contact-syncing/controller-integration.d.cts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts +44 -0
- package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/controller-integration.mjs +293 -0
- package/dist/controllers/user-storage/contact-syncing/controller-integration.mjs.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs +50 -0
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.cts +8 -0
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.cts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts +8 -0
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.mjs +46 -0
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.mjs.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs +23 -0
- package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/sync-utils.d.cts +9 -0
- package/dist/controllers/user-storage/contact-syncing/sync-utils.d.cts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts +9 -0
- package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/sync-utils.mjs +19 -0
- package/dist/controllers/user-storage/contact-syncing/sync-utils.mjs.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/types.cjs +3 -0
- package/dist/controllers/user-storage/contact-syncing/types.cjs.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/types.d.cts +35 -0
- package/dist/controllers/user-storage/contact-syncing/types.d.cts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/types.d.mts +35 -0
- package/dist/controllers/user-storage/contact-syncing/types.d.mts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/types.mjs +2 -0
- package/dist/controllers/user-storage/contact-syncing/types.mjs.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/utils.cjs +66 -0
- package/dist/controllers/user-storage/contact-syncing/utils.cjs.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/utils.d.cts +37 -0
- package/dist/controllers/user-storage/contact-syncing/utils.d.cts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/utils.d.mts +37 -0
- package/dist/controllers/user-storage/contact-syncing/utils.d.mts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/utils.mjs +60 -0
- package/dist/controllers/user-storage/contact-syncing/utils.mjs.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +22 -22
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts +4 -4
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts +4 -4
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs +22 -22
- package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.cts +8 -8
- package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.mts +8 -8
- package/dist/sdk/authentication-jwt-bearer/types.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.mjs.map +1 -1
- package/dist/sdk/authentication.cjs +8 -11
- package/dist/sdk/authentication.cjs.map +1 -1
- package/dist/sdk/authentication.d.cts +4 -4
- package/dist/sdk/authentication.d.cts.map +1 -1
- package/dist/sdk/authentication.d.mts +4 -4
- package/dist/sdk/authentication.d.mts.map +1 -1
- package/dist/sdk/authentication.mjs +8 -11
- package/dist/sdk/authentication.mjs.map +1 -1
- package/dist/sdk/user-storage.cjs +38 -32
- package/dist/sdk/user-storage.cjs.map +1 -1
- package/dist/sdk/user-storage.d.cts +4 -3
- package/dist/sdk/user-storage.d.cts.map +1 -1
- package/dist/sdk/user-storage.d.mts +4 -3
- package/dist/sdk/user-storage.d.mts.map +1 -1
- package/dist/sdk/user-storage.mjs +38 -32
- package/dist/sdk/user-storage.mjs.map +1 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.cjs +16 -4
- package/dist/sdk/utils/messaging-signing-snap-requests.cjs.map +1 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.d.cts +2 -2
- package/dist/sdk/utils/messaging-signing-snap-requests.d.cts.map +1 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.d.mts +2 -2
- package/dist/sdk/utils/messaging-signing-snap-requests.d.mts.map +1 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.mjs +16 -4
- package/dist/sdk/utils/messaging-signing-snap-requests.mjs.map +1 -1
- package/dist/shared/storage-schema.cjs +4 -7
- package/dist/shared/storage-schema.cjs.map +1 -1
- package/dist/shared/storage-schema.d.cts +2 -1
- package/dist/shared/storage-schema.d.cts.map +1 -1
- package/dist/shared/storage-schema.d.mts +2 -1
- package/dist/shared/storage-schema.d.mts.map +1 -1
- package/dist/shared/storage-schema.mjs +3 -5
- package/dist/shared/storage-schema.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { AccountsControllerListAccountsAction, AccountsControllerUpdateAccountMetadataAction, AccountsControllerAccountRenamedEvent,
|
|
1
|
+
import type { AccountsControllerListAccountsAction, AccountsControllerUpdateAccountMetadataAction, AccountsControllerAccountRenamedEvent, AccountsControllerUpdateAccountsAction } from "@metamask/accounts-controller";
|
|
2
|
+
import type { AddressBookControllerContactUpdatedEvent, AddressBookControllerContactDeletedEvent, AddressBookControllerActions, AddressBookControllerListAction, AddressBookControllerSetAction, AddressBookControllerDeleteAction } from "@metamask/address-book-controller";
|
|
2
3
|
import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedMessenger } from "@metamask/base-controller";
|
|
3
4
|
import { BaseController } from "@metamask/base-controller";
|
|
4
5
|
import { type KeyringControllerGetStateAction, type KeyringControllerLockEvent, type KeyringControllerUnlockEvent, type KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
|
|
@@ -24,6 +25,14 @@ export type UserStorageControllerState = {
|
|
|
24
25
|
* Condition used by UI to determine if account syncing is enabled.
|
|
25
26
|
*/
|
|
26
27
|
isAccountSyncingEnabled: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Condition used by UI to determine if contact syncing is enabled.
|
|
30
|
+
*/
|
|
31
|
+
isContactSyncingEnabled: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Condition used by UI to determine if contact syncing is in progress.
|
|
34
|
+
*/
|
|
35
|
+
isContactSyncingInProgress: boolean;
|
|
27
36
|
/**
|
|
28
37
|
* Condition used to determine if account syncing has been dispatched at least once.
|
|
29
38
|
* This is used for event listeners to determine if they should be triggered.
|
|
@@ -63,6 +72,23 @@ type ControllerConfig = {
|
|
|
63
72
|
*/
|
|
64
73
|
onAccountSyncErroneousSituation?: (profileId: string, situationMessage: string, sentryContext?: Record<string, unknown>) => void;
|
|
65
74
|
};
|
|
75
|
+
contactSyncing?: {
|
|
76
|
+
/**
|
|
77
|
+
* Callback that fires when contact sync updates a contact.
|
|
78
|
+
* This is used for analytics.
|
|
79
|
+
*/
|
|
80
|
+
onContactUpdated?: (profileId: string) => void;
|
|
81
|
+
/**
|
|
82
|
+
* Callback that fires when contact sync deletes a contact.
|
|
83
|
+
* This is used for analytics.
|
|
84
|
+
*/
|
|
85
|
+
onContactDeleted?: (profileId: string) => void;
|
|
86
|
+
/**
|
|
87
|
+
* Callback that fires when an erroneous situation happens during contact sync.
|
|
88
|
+
* This is used for analytics.
|
|
89
|
+
*/
|
|
90
|
+
onContactSyncErroneousSituation?: (profileId: string, situationMessage: string, sentryContext?: Record<string, unknown>) => void;
|
|
91
|
+
};
|
|
66
92
|
networkSyncing?: {
|
|
67
93
|
maxNumberOfNetworksToAdd?: number;
|
|
68
94
|
/**
|
|
@@ -107,10 +133,10 @@ export type UserStorageControllerPerformBatchSetStorage = ActionsObj['performBat
|
|
|
107
133
|
export type UserStorageControllerPerformDeleteStorage = ActionsObj['performDeleteStorage'];
|
|
108
134
|
export type UserStorageControllerPerformBatchDeleteStorage = ActionsObj['performBatchDeleteStorage'];
|
|
109
135
|
export type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey'];
|
|
110
|
-
export type AllowedActions = KeyringControllerGetStateAction | HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AccountsControllerListAccountsAction | AccountsControllerUpdateAccountMetadataAction | KeyringControllerWithKeyringAction | NetworkControllerGetStateAction | NetworkControllerAddNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerUpdateNetworkAction;
|
|
136
|
+
export type AllowedActions = KeyringControllerGetStateAction | HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AccountsControllerListAccountsAction | AccountsControllerUpdateAccountMetadataAction | AccountsControllerUpdateAccountsAction | KeyringControllerWithKeyringAction | NetworkControllerGetStateAction | NetworkControllerAddNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerUpdateNetworkAction | AddressBookControllerListAction | AddressBookControllerSetAction | AddressBookControllerDeleteAction | AddressBookControllerActions;
|
|
111
137
|
export type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, UserStorageControllerState>;
|
|
112
138
|
export type Events = UserStorageControllerStateChangeEvent;
|
|
113
|
-
export type AllowedEvents = UserStorageControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent |
|
|
139
|
+
export type AllowedEvents = UserStorageControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | AccountsControllerAccountRenamedEvent | NetworkControllerNetworkRemovedEvent | AddressBookControllerContactUpdatedEvent | AddressBookControllerContactDeletedEvent;
|
|
114
140
|
export type UserStorageControllerMessenger = RestrictedMessenger<typeof controllerName, Actions | AllowedActions, Events | AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
|
|
115
141
|
/**
|
|
116
142
|
* Reusable controller that allows any team to store synchronized data for a given user.
|
|
@@ -136,59 +162,66 @@ export default class UserStorageController extends BaseController<typeof control
|
|
|
136
162
|
* Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
137
163
|
*
|
|
138
164
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
165
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
139
166
|
* @returns the decrypted string contents found from user storage (or null if not found)
|
|
140
167
|
*/
|
|
141
|
-
performGetStorage(path: UserStoragePathWithFeatureAndKey): Promise<string | null>;
|
|
168
|
+
performGetStorage(path: UserStoragePathWithFeatureAndKey, entropySourceId?: string): Promise<string | null>;
|
|
142
169
|
/**
|
|
143
170
|
* Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings.
|
|
144
171
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
145
172
|
*
|
|
146
173
|
* @param path - string in the form of `${feature}` that matches schema
|
|
174
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
147
175
|
* @returns the array of decrypted string contents found from user storage (or null if not found)
|
|
148
176
|
*/
|
|
149
|
-
performGetStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly): Promise<string[] | null>;
|
|
177
|
+
performGetStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly, entropySourceId?: string): Promise<string[] | null>;
|
|
150
178
|
/**
|
|
151
179
|
* Allows storage of user data. Data stored must be string formatted.
|
|
152
180
|
* Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
153
181
|
*
|
|
154
182
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
155
183
|
* @param value - The string data you want to store.
|
|
184
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
156
185
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
157
186
|
*/
|
|
158
|
-
performSetStorage(path: UserStoragePathWithFeatureAndKey, value: string): Promise<void>;
|
|
187
|
+
performSetStorage(path: UserStoragePathWithFeatureAndKey, value: string, entropySourceId?: string): Promise<void>;
|
|
159
188
|
/**
|
|
160
189
|
* Allows storage of multiple user data entries for one specific feature. Data stored must be string formatted.
|
|
161
190
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
162
191
|
*
|
|
163
192
|
* @param path - string in the form of `${feature}` that matches schema
|
|
164
193
|
* @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs
|
|
194
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
165
195
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
166
196
|
*/
|
|
167
|
-
performBatchSetStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: [UserStorageFeatureKeys<FeatureName>, string][]): Promise<void>;
|
|
197
|
+
performBatchSetStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: [UserStorageFeatureKeys<FeatureName>, string][], entropySourceId?: string): Promise<void>;
|
|
168
198
|
/**
|
|
169
199
|
* Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
170
200
|
*
|
|
171
201
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
202
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
172
203
|
* @returns nothing. NOTE that an error is thrown if fails to delete data.
|
|
173
204
|
*/
|
|
174
|
-
performDeleteStorage(path: UserStoragePathWithFeatureAndKey): Promise<void>;
|
|
205
|
+
performDeleteStorage(path: UserStoragePathWithFeatureAndKey, entropySourceId?: string): Promise<void>;
|
|
175
206
|
/**
|
|
176
207
|
* Allows deletion of all user data entries for a specific feature.
|
|
177
208
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
178
209
|
*
|
|
179
210
|
* @param path - string in the form of `${feature}` that matches schema
|
|
211
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
180
212
|
* @returns nothing. NOTE that an error is thrown if fails to delete data.
|
|
181
213
|
*/
|
|
182
|
-
performDeleteStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly): Promise<void>;
|
|
214
|
+
performDeleteStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly, entropySourceId?: string): Promise<void>;
|
|
183
215
|
/**
|
|
184
216
|
* Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted.
|
|
185
217
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
186
218
|
*
|
|
187
219
|
* @param path - string in the form of `${feature}` that matches schema
|
|
188
220
|
* @param values - data to store, in the form of an array of entryKey[]
|
|
221
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
189
222
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
190
223
|
*/
|
|
191
|
-
performBatchDeleteStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: UserStorageFeatureKeys<FeatureName>[]): Promise<void>;
|
|
224
|
+
performBatchDeleteStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: UserStorageFeatureKeys<FeatureName>[], entropySourceId?: string): Promise<void>;
|
|
192
225
|
/**
|
|
193
226
|
* Retrieves the storage key, for internal use only!
|
|
194
227
|
*
|
|
@@ -201,10 +234,23 @@ export default class UserStorageController extends BaseController<typeof control
|
|
|
201
234
|
* It should not be used in production code.
|
|
202
235
|
*/
|
|
203
236
|
flushStorageKeyCache(): void;
|
|
237
|
+
/**
|
|
238
|
+
* Lists all the available HD keyring metadata IDs.
|
|
239
|
+
* These IDs can be used in a multi-SRP context to segregate data specific to different SRPs.
|
|
240
|
+
*
|
|
241
|
+
* @returns A promise that resolves to an array of HD keyring metadata IDs.
|
|
242
|
+
*/
|
|
243
|
+
listEntropySources(): Promise<string[]>;
|
|
204
244
|
setIsBackupAndSyncFeatureEnabled(feature: keyof typeof BACKUPANDSYNC_FEATURES, enabled: boolean): Promise<void>;
|
|
205
245
|
setHasAccountSyncingSyncedAtLeastOnce(hasAccountSyncingSyncedAtLeastOnce: boolean): Promise<void>;
|
|
206
246
|
setIsAccountSyncingReadyToBeDispatched(isAccountSyncingReadyToBeDispatched: boolean): Promise<void>;
|
|
207
247
|
setIsAccountSyncingInProgress(isAccountSyncingInProgress: boolean): Promise<void>;
|
|
248
|
+
/**
|
|
249
|
+
* Sets the isContactSyncingInProgress flag to prevent infinite loops during contact synchronization
|
|
250
|
+
*
|
|
251
|
+
* @param isContactSyncingInProgress - Whether contact syncing is in progress
|
|
252
|
+
*/
|
|
253
|
+
setIsContactSyncingInProgress(isContactSyncingInProgress: boolean): Promise<void>;
|
|
208
254
|
/**
|
|
209
255
|
* Syncs the internal accounts list with the user storage accounts list.
|
|
210
256
|
* 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.
|
|
@@ -218,6 +264,12 @@ export default class UserStorageController extends BaseController<typeof control
|
|
|
218
264
|
*/
|
|
219
265
|
saveInternalAccountToUserStorage(internalAccount: InternalAccount): Promise<void>;
|
|
220
266
|
syncNetworks(): Promise<void>;
|
|
267
|
+
/**
|
|
268
|
+
* Syncs the address book list with the user storage address book list.
|
|
269
|
+
* This method is used to make sure that the address book list is up-to-date with the user storage address book list and vice-versa.
|
|
270
|
+
* It will add new contacts to the address book list, update/merge conflicting contacts and re-upload the results in some cases to the user storage.
|
|
271
|
+
*/
|
|
272
|
+
syncContactsWithUserStorage(): Promise<void>;
|
|
221
273
|
}
|
|
222
274
|
export {};
|
|
223
275
|
//# sourceMappingURL=UserStorageController.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserStorageController.d.cts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,6CAA6C,EAC7C,qCAAqC,EACrC,
|
|
1
|
+
{"version":3,"file":"UserStorageController.d.cts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,6CAA6C,EAC7C,qCAAqC,EACrC,sCAAsC,EACvC,sCAAsC;AACvC,OAAO,KAAK,EACV,wCAAwC,EACxC,wCAAwC,EACxC,4BAA4B,EAC5B,+BAA+B,EAC/B,8BAA8B,EAC9B,iCAAiC,EAClC,0CAA0C;AAC3C,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EAEpB,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EACjC,KAAK,kCAAkC,EACxC,qCAAqC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AACtE,OAAO,KAAK,EACV,iCAAiC,EACjC,+BAA+B,EAC/B,oCAAoC,EACpC,oCAAoC,EACpC,oCAAoC,EACrC,qCAAqC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,oCAAoC;AAOrE,OAAO,EAAE,sBAAsB,EAAE,wBAAoB;AAQrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAoC;AAC1E,OAAO,EACL,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACpC,wCAAoC;AACrC,OAAO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;;;;;;OAQG;IACU,yBAAyB,CACpC,WAAW,SAAS,8BAA8B,EAElD,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,sBAAsB,CAAC,WAAW,CAAC,EAAE,EAC7C,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;IAOhB;;;;OAIG;IACU,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAI7C;;;;OAIG;IACI,oBAAoB,IAAI,IAAI;IAInC;;;;;OAKG;IACG,kBAAkB;IAkDX,gCAAgC,CAC3C,OAAO,EAAE,MAAM,OAAO,sBAAsB,EAC5C,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC;IA6CV,qCAAqC,CACzC,kCAAkC,EAAE,OAAO,GAC1C,OAAO,CAAC,IAAI,CAAC;IAOV,sCAAsC,CAC1C,mCAAmC,EAAE,OAAO,GAC3C,OAAO,CAAC,IAAI,CAAC;IAOV,6BAA6B,CACjC,0BAA0B,EAAE,OAAO,GAClC,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;OAIG;IACG,6BAA6B,CACjC,0BAA0B,EAAE,OAAO,GAClC,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;OAIG;IACG,mCAAmC,IAAI,OAAO,CAAC,IAAI,CAAC;IA2C1D;;;;OAIG;IACG,gCAAgC,CACpC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,IAAI,CAAC;IAOV,YAAY;IAwBlB;;;;OAIG;IACG,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC;CA2BnD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { AccountsControllerListAccountsAction, AccountsControllerUpdateAccountMetadataAction, AccountsControllerAccountRenamedEvent,
|
|
1
|
+
import type { AccountsControllerListAccountsAction, AccountsControllerUpdateAccountMetadataAction, AccountsControllerAccountRenamedEvent, AccountsControllerUpdateAccountsAction } from "@metamask/accounts-controller";
|
|
2
|
+
import type { AddressBookControllerContactUpdatedEvent, AddressBookControllerContactDeletedEvent, AddressBookControllerActions, AddressBookControllerListAction, AddressBookControllerSetAction, AddressBookControllerDeleteAction } from "@metamask/address-book-controller";
|
|
2
3
|
import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedMessenger } from "@metamask/base-controller";
|
|
3
4
|
import { BaseController } from "@metamask/base-controller";
|
|
4
5
|
import { type KeyringControllerGetStateAction, type KeyringControllerLockEvent, type KeyringControllerUnlockEvent, type KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
|
|
@@ -24,6 +25,14 @@ export type UserStorageControllerState = {
|
|
|
24
25
|
* Condition used by UI to determine if account syncing is enabled.
|
|
25
26
|
*/
|
|
26
27
|
isAccountSyncingEnabled: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Condition used by UI to determine if contact syncing is enabled.
|
|
30
|
+
*/
|
|
31
|
+
isContactSyncingEnabled: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Condition used by UI to determine if contact syncing is in progress.
|
|
34
|
+
*/
|
|
35
|
+
isContactSyncingInProgress: boolean;
|
|
27
36
|
/**
|
|
28
37
|
* Condition used to determine if account syncing has been dispatched at least once.
|
|
29
38
|
* This is used for event listeners to determine if they should be triggered.
|
|
@@ -63,6 +72,23 @@ type ControllerConfig = {
|
|
|
63
72
|
*/
|
|
64
73
|
onAccountSyncErroneousSituation?: (profileId: string, situationMessage: string, sentryContext?: Record<string, unknown>) => void;
|
|
65
74
|
};
|
|
75
|
+
contactSyncing?: {
|
|
76
|
+
/**
|
|
77
|
+
* Callback that fires when contact sync updates a contact.
|
|
78
|
+
* This is used for analytics.
|
|
79
|
+
*/
|
|
80
|
+
onContactUpdated?: (profileId: string) => void;
|
|
81
|
+
/**
|
|
82
|
+
* Callback that fires when contact sync deletes a contact.
|
|
83
|
+
* This is used for analytics.
|
|
84
|
+
*/
|
|
85
|
+
onContactDeleted?: (profileId: string) => void;
|
|
86
|
+
/**
|
|
87
|
+
* Callback that fires when an erroneous situation happens during contact sync.
|
|
88
|
+
* This is used for analytics.
|
|
89
|
+
*/
|
|
90
|
+
onContactSyncErroneousSituation?: (profileId: string, situationMessage: string, sentryContext?: Record<string, unknown>) => void;
|
|
91
|
+
};
|
|
66
92
|
networkSyncing?: {
|
|
67
93
|
maxNumberOfNetworksToAdd?: number;
|
|
68
94
|
/**
|
|
@@ -107,10 +133,10 @@ export type UserStorageControllerPerformBatchSetStorage = ActionsObj['performBat
|
|
|
107
133
|
export type UserStorageControllerPerformDeleteStorage = ActionsObj['performDeleteStorage'];
|
|
108
134
|
export type UserStorageControllerPerformBatchDeleteStorage = ActionsObj['performBatchDeleteStorage'];
|
|
109
135
|
export type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey'];
|
|
110
|
-
export type AllowedActions = KeyringControllerGetStateAction | HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AccountsControllerListAccountsAction | AccountsControllerUpdateAccountMetadataAction | KeyringControllerWithKeyringAction | NetworkControllerGetStateAction | NetworkControllerAddNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerUpdateNetworkAction;
|
|
136
|
+
export type AllowedActions = KeyringControllerGetStateAction | HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AccountsControllerListAccountsAction | AccountsControllerUpdateAccountMetadataAction | AccountsControllerUpdateAccountsAction | KeyringControllerWithKeyringAction | NetworkControllerGetStateAction | NetworkControllerAddNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerUpdateNetworkAction | AddressBookControllerListAction | AddressBookControllerSetAction | AddressBookControllerDeleteAction | AddressBookControllerActions;
|
|
111
137
|
export type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, UserStorageControllerState>;
|
|
112
138
|
export type Events = UserStorageControllerStateChangeEvent;
|
|
113
|
-
export type AllowedEvents = UserStorageControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent |
|
|
139
|
+
export type AllowedEvents = UserStorageControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | AccountsControllerAccountRenamedEvent | NetworkControllerNetworkRemovedEvent | AddressBookControllerContactUpdatedEvent | AddressBookControllerContactDeletedEvent;
|
|
114
140
|
export type UserStorageControllerMessenger = RestrictedMessenger<typeof controllerName, Actions | AllowedActions, Events | AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
|
|
115
141
|
/**
|
|
116
142
|
* Reusable controller that allows any team to store synchronized data for a given user.
|
|
@@ -136,59 +162,66 @@ export default class UserStorageController extends BaseController<typeof control
|
|
|
136
162
|
* Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
137
163
|
*
|
|
138
164
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
165
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
139
166
|
* @returns the decrypted string contents found from user storage (or null if not found)
|
|
140
167
|
*/
|
|
141
|
-
performGetStorage(path: UserStoragePathWithFeatureAndKey): Promise<string | null>;
|
|
168
|
+
performGetStorage(path: UserStoragePathWithFeatureAndKey, entropySourceId?: string): Promise<string | null>;
|
|
142
169
|
/**
|
|
143
170
|
* Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings.
|
|
144
171
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
145
172
|
*
|
|
146
173
|
* @param path - string in the form of `${feature}` that matches schema
|
|
174
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
147
175
|
* @returns the array of decrypted string contents found from user storage (or null if not found)
|
|
148
176
|
*/
|
|
149
|
-
performGetStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly): Promise<string[] | null>;
|
|
177
|
+
performGetStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly, entropySourceId?: string): Promise<string[] | null>;
|
|
150
178
|
/**
|
|
151
179
|
* Allows storage of user data. Data stored must be string formatted.
|
|
152
180
|
* Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
153
181
|
*
|
|
154
182
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
155
183
|
* @param value - The string data you want to store.
|
|
184
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
156
185
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
157
186
|
*/
|
|
158
|
-
performSetStorage(path: UserStoragePathWithFeatureAndKey, value: string): Promise<void>;
|
|
187
|
+
performSetStorage(path: UserStoragePathWithFeatureAndKey, value: string, entropySourceId?: string): Promise<void>;
|
|
159
188
|
/**
|
|
160
189
|
* Allows storage of multiple user data entries for one specific feature. Data stored must be string formatted.
|
|
161
190
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
162
191
|
*
|
|
163
192
|
* @param path - string in the form of `${feature}` that matches schema
|
|
164
193
|
* @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs
|
|
194
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
165
195
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
166
196
|
*/
|
|
167
|
-
performBatchSetStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: [UserStorageFeatureKeys<FeatureName>, string][]): Promise<void>;
|
|
197
|
+
performBatchSetStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: [UserStorageFeatureKeys<FeatureName>, string][], entropySourceId?: string): Promise<void>;
|
|
168
198
|
/**
|
|
169
199
|
* Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
170
200
|
*
|
|
171
201
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
202
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
172
203
|
* @returns nothing. NOTE that an error is thrown if fails to delete data.
|
|
173
204
|
*/
|
|
174
|
-
performDeleteStorage(path: UserStoragePathWithFeatureAndKey): Promise<void>;
|
|
205
|
+
performDeleteStorage(path: UserStoragePathWithFeatureAndKey, entropySourceId?: string): Promise<void>;
|
|
175
206
|
/**
|
|
176
207
|
* Allows deletion of all user data entries for a specific feature.
|
|
177
208
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
178
209
|
*
|
|
179
210
|
* @param path - string in the form of `${feature}` that matches schema
|
|
211
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
180
212
|
* @returns nothing. NOTE that an error is thrown if fails to delete data.
|
|
181
213
|
*/
|
|
182
|
-
performDeleteStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly): Promise<void>;
|
|
214
|
+
performDeleteStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly, entropySourceId?: string): Promise<void>;
|
|
183
215
|
/**
|
|
184
216
|
* Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted.
|
|
185
217
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
186
218
|
*
|
|
187
219
|
* @param path - string in the form of `${feature}` that matches schema
|
|
188
220
|
* @param values - data to store, in the form of an array of entryKey[]
|
|
221
|
+
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
189
222
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
190
223
|
*/
|
|
191
|
-
performBatchDeleteStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: UserStorageFeatureKeys<FeatureName>[]): Promise<void>;
|
|
224
|
+
performBatchDeleteStorage<FeatureName extends UserStoragePathWithFeatureOnly>(path: FeatureName, values: UserStorageFeatureKeys<FeatureName>[], entropySourceId?: string): Promise<void>;
|
|
192
225
|
/**
|
|
193
226
|
* Retrieves the storage key, for internal use only!
|
|
194
227
|
*
|
|
@@ -201,10 +234,23 @@ export default class UserStorageController extends BaseController<typeof control
|
|
|
201
234
|
* It should not be used in production code.
|
|
202
235
|
*/
|
|
203
236
|
flushStorageKeyCache(): void;
|
|
237
|
+
/**
|
|
238
|
+
* Lists all the available HD keyring metadata IDs.
|
|
239
|
+
* These IDs can be used in a multi-SRP context to segregate data specific to different SRPs.
|
|
240
|
+
*
|
|
241
|
+
* @returns A promise that resolves to an array of HD keyring metadata IDs.
|
|
242
|
+
*/
|
|
243
|
+
listEntropySources(): Promise<string[]>;
|
|
204
244
|
setIsBackupAndSyncFeatureEnabled(feature: keyof typeof BACKUPANDSYNC_FEATURES, enabled: boolean): Promise<void>;
|
|
205
245
|
setHasAccountSyncingSyncedAtLeastOnce(hasAccountSyncingSyncedAtLeastOnce: boolean): Promise<void>;
|
|
206
246
|
setIsAccountSyncingReadyToBeDispatched(isAccountSyncingReadyToBeDispatched: boolean): Promise<void>;
|
|
207
247
|
setIsAccountSyncingInProgress(isAccountSyncingInProgress: boolean): Promise<void>;
|
|
248
|
+
/**
|
|
249
|
+
* Sets the isContactSyncingInProgress flag to prevent infinite loops during contact synchronization
|
|
250
|
+
*
|
|
251
|
+
* @param isContactSyncingInProgress - Whether contact syncing is in progress
|
|
252
|
+
*/
|
|
253
|
+
setIsContactSyncingInProgress(isContactSyncingInProgress: boolean): Promise<void>;
|
|
208
254
|
/**
|
|
209
255
|
* Syncs the internal accounts list with the user storage accounts list.
|
|
210
256
|
* 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.
|
|
@@ -218,6 +264,12 @@ export default class UserStorageController extends BaseController<typeof control
|
|
|
218
264
|
*/
|
|
219
265
|
saveInternalAccountToUserStorage(internalAccount: InternalAccount): Promise<void>;
|
|
220
266
|
syncNetworks(): Promise<void>;
|
|
267
|
+
/**
|
|
268
|
+
* Syncs the address book list with the user storage address book list.
|
|
269
|
+
* This method is used to make sure that the address book list is up-to-date with the user storage address book list and vice-versa.
|
|
270
|
+
* It will add new contacts to the address book list, update/merge conflicting contacts and re-upload the results in some cases to the user storage.
|
|
271
|
+
*/
|
|
272
|
+
syncContactsWithUserStorage(): Promise<void>;
|
|
221
273
|
}
|
|
222
274
|
export {};
|
|
223
275
|
//# sourceMappingURL=UserStorageController.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserStorageController.d.mts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,6CAA6C,EAC7C,qCAAqC,EACrC,
|
|
1
|
+
{"version":3,"file":"UserStorageController.d.mts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,6CAA6C,EAC7C,qCAAqC,EACrC,sCAAsC,EACvC,sCAAsC;AACvC,OAAO,KAAK,EACV,wCAAwC,EACxC,wCAAwC,EACxC,4BAA4B,EAC5B,+BAA+B,EAC/B,8BAA8B,EAC9B,iCAAiC,EAClC,0CAA0C;AAC3C,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EAEpB,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EACjC,KAAK,kCAAkC,EACxC,qCAAqC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AACtE,OAAO,KAAK,EACV,iCAAiC,EACjC,+BAA+B,EAC/B,oCAAoC,EACpC,oCAAoC,EACpC,oCAAoC,EACrC,qCAAqC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,oCAAoC;AAOrE,OAAO,EAAE,sBAAsB,EAAE,wBAAoB;AAQrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAoC;AAC1E,OAAO,EACL,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACpC,wCAAoC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,0CAAsC;AAElE,OAAO,KAAK,EACV,sCAAsC,EACtC,yCAAyC,EACzC,kCAAkC,EAClC,qCAAqC,EACtC,uDAAmD;AAEpD,QAAA,MAAM,cAAc,0BAA0B,CAAC;AAG/C,MAAM,M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