@metamask-previews/profile-sync-controller 17.1.0-preview-ca9d0265 → 17.1.0-preview-e149187d

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 (74) hide show
  1. package/CHANGELOG.md +0 -5
  2. package/dist/controllers/user-storage/UserStorageController.cjs +3 -56
  3. package/dist/controllers/user-storage/UserStorageController.cjs.map +1 -1
  4. package/dist/controllers/user-storage/UserStorageController.d.cts +2 -40
  5. package/dist/controllers/user-storage/UserStorageController.d.cts.map +1 -1
  6. package/dist/controllers/user-storage/UserStorageController.d.mts +2 -40
  7. package/dist/controllers/user-storage/UserStorageController.d.mts.map +1 -1
  8. package/dist/controllers/user-storage/UserStorageController.mjs +0 -53
  9. package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -1
  10. package/dist/controllers/user-storage/constants.cjs +0 -1
  11. package/dist/controllers/user-storage/constants.cjs.map +1 -1
  12. package/dist/controllers/user-storage/constants.d.cts +0 -1
  13. package/dist/controllers/user-storage/constants.d.cts.map +1 -1
  14. package/dist/controllers/user-storage/constants.d.mts +0 -1
  15. package/dist/controllers/user-storage/constants.d.mts.map +1 -1
  16. package/dist/controllers/user-storage/constants.mjs +0 -1
  17. package/dist/controllers/user-storage/constants.mjs.map +1 -1
  18. package/dist/shared/storage-schema.cjs +1 -3
  19. package/dist/shared/storage-schema.cjs.map +1 -1
  20. package/dist/shared/storage-schema.d.cts +0 -2
  21. package/dist/shared/storage-schema.d.cts.map +1 -1
  22. package/dist/shared/storage-schema.d.mts +0 -2
  23. package/dist/shared/storage-schema.d.mts.map +1 -1
  24. package/dist/shared/storage-schema.mjs +1 -3
  25. package/dist/shared/storage-schema.mjs.map +1 -1
  26. package/package.json +1 -1
  27. package/dist/controllers/user-storage/contact-syncing/constants.cjs +0 -12
  28. package/dist/controllers/user-storage/contact-syncing/constants.cjs.map +0 -1
  29. package/dist/controllers/user-storage/contact-syncing/constants.d.cts +0 -9
  30. package/dist/controllers/user-storage/contact-syncing/constants.d.cts.map +0 -1
  31. package/dist/controllers/user-storage/contact-syncing/constants.d.mts +0 -9
  32. package/dist/controllers/user-storage/contact-syncing/constants.d.mts.map +0 -1
  33. package/dist/controllers/user-storage/contact-syncing/constants.mjs +0 -9
  34. package/dist/controllers/user-storage/contact-syncing/constants.mjs.map +0 -1
  35. package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs +0 -281
  36. package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs.map +0 -1
  37. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.cts +0 -44
  38. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.cts.map +0 -1
  39. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts +0 -44
  40. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts.map +0 -1
  41. package/dist/controllers/user-storage/contact-syncing/controller-integration.mjs +0 -275
  42. package/dist/controllers/user-storage/contact-syncing/controller-integration.mjs.map +0 -1
  43. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs +0 -50
  44. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs.map +0 -1
  45. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.cts +0 -8
  46. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.cts.map +0 -1
  47. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts +0 -8
  48. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts.map +0 -1
  49. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.mjs +0 -46
  50. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.mjs.map +0 -1
  51. package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs +0 -23
  52. package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs.map +0 -1
  53. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.cts +0 -9
  54. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.cts.map +0 -1
  55. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts +0 -9
  56. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts.map +0 -1
  57. package/dist/controllers/user-storage/contact-syncing/sync-utils.mjs +0 -19
  58. package/dist/controllers/user-storage/contact-syncing/sync-utils.mjs.map +0 -1
  59. package/dist/controllers/user-storage/contact-syncing/types.cjs +0 -3
  60. package/dist/controllers/user-storage/contact-syncing/types.cjs.map +0 -1
  61. package/dist/controllers/user-storage/contact-syncing/types.d.cts +0 -35
  62. package/dist/controllers/user-storage/contact-syncing/types.d.cts.map +0 -1
  63. package/dist/controllers/user-storage/contact-syncing/types.d.mts +0 -35
  64. package/dist/controllers/user-storage/contact-syncing/types.d.mts.map +0 -1
  65. package/dist/controllers/user-storage/contact-syncing/types.mjs +0 -2
  66. package/dist/controllers/user-storage/contact-syncing/types.mjs.map +0 -1
  67. package/dist/controllers/user-storage/contact-syncing/utils.cjs +0 -64
  68. package/dist/controllers/user-storage/contact-syncing/utils.cjs.map +0 -1
  69. package/dist/controllers/user-storage/contact-syncing/utils.d.cts +0 -36
  70. package/dist/controllers/user-storage/contact-syncing/utils.d.cts.map +0 -1
  71. package/dist/controllers/user-storage/contact-syncing/utils.d.mts +0 -36
  72. package/dist/controllers/user-storage/contact-syncing/utils.d.mts.map +0 -1
  73. package/dist/controllers/user-storage/contact-syncing/utils.mjs +0 -58
  74. package/dist/controllers/user-storage/contact-syncing/utils.mjs.map +0 -1
@@ -1,35 +0,0 @@
1
- import type { Hex } from "@metamask/utils";
2
- import type { USER_STORAGE_VERSION_KEY, USER_STORAGE_VERSION } from "./constants.mjs";
3
- import type { UserStorageControllerMessenger } from "../UserStorageController.mjs";
4
- import type UserStorageController from "../UserStorageController.mjs";
5
- export type UserStorageContactEntry = {
6
- /**
7
- * The Version 'v' of the User Storage.
8
- * NOTE - will allow us to support upgrade/downgrades in the future
9
- */
10
- [USER_STORAGE_VERSION_KEY]: typeof USER_STORAGE_VERSION;
11
- /** the address 'a' of the contact */
12
- a: string;
13
- /** the name 'n' of the contact */
14
- n: string;
15
- /** the chainId 'c' of the contact */
16
- c: Hex;
17
- /** the memo 'm' of the contact (optional) */
18
- m?: string;
19
- /** the addressType 't' of the contact (optional) */
20
- t?: string;
21
- /** the isEns flag 'e' of the contact (optional) */
22
- e?: boolean;
23
- /** the lastUpdatedAt timestamp 'lu' of the contact */
24
- lu?: number;
25
- /** the deletedAt timestamp 'dt' of the contact (optional) */
26
- dt?: number;
27
- };
28
- /**
29
- * Options for contact syncing operations
30
- */
31
- export type ContactSyncingOptions = {
32
- getUserStorageControllerInstance: () => UserStorageController;
33
- getMessenger: () => UserStorageControllerMessenger;
34
- };
35
- //# sourceMappingURL=types.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE3C,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACrB,wBAAoB;AACrB,OAAO,KAAK,EAAE,8BAA8B,EAAE,qCAAiC;AAC/E,OAAO,KAAK,qBAAqB,qCAAiC;AAElE,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,CAAC,wBAAwB,CAAC,EAAE,OAAO,oBAAoB,CAAC;IACxD,qCAAqC;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,kCAAkC;IAClC,CAAC,EAAE,MAAM,CAAC;IACV,qCAAqC;IACrC,CAAC,EAAE,GAAG,CAAC;IACP,6CAA6C;IAC7C,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,mDAAmD;IACnD,CAAC,CAAC,EAAE,OAAO,CAAC;IACZ,sDAAsD;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6DAA6D;IAC7D,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;IAC9D,YAAY,EAAE,MAAM,8BAA8B,CAAC;CACpD,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Hex } from '@metamask/utils';\n\nimport type {\n USER_STORAGE_VERSION_KEY,\n USER_STORAGE_VERSION,\n} from './constants';\nimport type { UserStorageControllerMessenger } from '../UserStorageController';\nimport type UserStorageController from '../UserStorageController';\n\nexport type UserStorageContactEntry = {\n /**\n * The Version 'v' of the User Storage.\n * NOTE - will allow us to support upgrade/downgrades in the future\n */\n [USER_STORAGE_VERSION_KEY]: typeof USER_STORAGE_VERSION;\n /** the address 'a' of the contact */\n a: string;\n /** the name 'n' of the contact */\n n: string;\n /** the chainId 'c' of the contact */\n c: Hex;\n /** the memo 'm' of the contact (optional) */\n m?: string;\n /** the addressType 't' of the contact (optional) */\n t?: string;\n /** the isEns flag 'e' of the contact (optional) */\n e?: boolean;\n /** the lastUpdatedAt timestamp 'lu' of the contact */\n lu?: number;\n /** the deletedAt timestamp 'dt' of the contact (optional) */\n dt?: number;\n};\n\n/**\n * Options for contact syncing operations\n */\nexport type ContactSyncingOptions = {\n getUserStorageControllerInstance: () => UserStorageController;\n getMessenger: () => UserStorageControllerMessenger;\n};\n"]}
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isContactBridgedFromAccounts = exports.mapUserStorageEntryToAddressBookEntry = exports.mapAddressBookEntryToUserStorageEntry = void 0;
4
- const constants_1 = require("./constants.cjs");
5
- /**
6
- * Map an address book entry to a user storage address book entry
7
- * Always sets a current timestamp for entries going to remote storage
8
- *
9
- * @param addressBookEntry - An address book entry
10
- * @returns A user storage address book entry
11
- */
12
- const mapAddressBookEntryToUserStorageEntry = (addressBookEntry) => {
13
- const { address, name, chainId, memo, addressType, isEns, lastUpdatedAt, deletedAt, } = addressBookEntry;
14
- const now = Date.now();
15
- return {
16
- [constants_1.USER_STORAGE_VERSION_KEY]: constants_1.USER_STORAGE_VERSION,
17
- a: address,
18
- n: name,
19
- c: chainId,
20
- ...(memo ? { m: memo } : {}),
21
- ...(addressType ? { t: addressType } : {}),
22
- ...(isEns ? { e: isEns } : {}),
23
- lu: lastUpdatedAt || now,
24
- ...(deletedAt ? { dt: deletedAt } : {}),
25
- };
26
- };
27
- exports.mapAddressBookEntryToUserStorageEntry = mapAddressBookEntryToUserStorageEntry;
28
- /**
29
- * Map a user storage address book entry to an address book entry
30
- * Preserves sync metadata from remote storage while keeping the
31
- * entry compatible with AddressBookController
32
- *
33
- * @param userStorageEntry - A user storage address book entry
34
- * @returns An address book entry with sync metadata for internal use
35
- */
36
- const mapUserStorageEntryToAddressBookEntry = (userStorageEntry) => {
37
- const addressBookEntry = {
38
- address: userStorageEntry.a,
39
- name: userStorageEntry.n,
40
- chainId: userStorageEntry.c,
41
- memo: userStorageEntry.m || '',
42
- isEns: userStorageEntry.e || false,
43
- ...(userStorageEntry.t
44
- ? { addressType: userStorageEntry.t }
45
- : {}),
46
- // Include remote metadata for sync operation only (not stored in AddressBookController)
47
- ...(userStorageEntry.dt ? { deletedAt: userStorageEntry.dt } : {}),
48
- ...(userStorageEntry.lu ? { lastUpdatedAt: userStorageEntry.lu } : {}),
49
- };
50
- return addressBookEntry;
51
- };
52
- exports.mapUserStorageEntryToAddressBookEntry = mapUserStorageEntryToAddressBookEntry;
53
- /**
54
- * Check if a contact entry is bridged from accounts
55
- * Contacts with chainId "*" are global accounts bridged from the accounts system
56
- *
57
- * @param contactEntry - The contact entry to check
58
- * @returns True if the contact is bridged from accounts
59
- */
60
- const isContactBridgedFromAccounts = (contactEntry) => {
61
- return String(contactEntry.chainId) === '*';
62
- };
63
- exports.isContactBridgedFromAccounts = isContactBridgedFromAccounts;
64
- //# sourceMappingURL=utils.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/utils.ts"],"names":[],"mappings":";;;AAKA,+CAA6E;AAY7E;;;;;;GAMG;AACI,MAAM,qCAAqC,GAAG,CACnD,gBAAkC,EACT,EAAE;IAC3B,MAAM,EACJ,OAAO,EACP,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,WAAW,EACX,KAAK,EACL,aAAa,EACb,SAAS,GACV,GAAG,gBAAwC,CAAC;IAE7C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEvB,OAAO;QACL,CAAC,oCAAwB,CAAC,EAAE,gCAAoB;QAChD,CAAC,EAAE,OAAO;QACV,CAAC,EAAE,IAAI;QACP,CAAC,EAAE,OAAO;QACV,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5B,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1C,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9B,EAAE,EAAE,aAAa,IAAI,GAAG;QACxB,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxC,CAAC;AACJ,CAAC,CAAC;AA3BW,QAAA,qCAAqC,yCA2BhD;AAEF;;;;;;;GAOG;AACI,MAAM,qCAAqC,GAAG,CACnD,gBAAyC,EACnB,EAAE;IACxB,MAAM,gBAAgB,GAAyB;QAC7C,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAC3B,IAAI,EAAE,gBAAgB,CAAC,CAAC;QACxB,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAC3B,IAAI,EAAE,gBAAgB,CAAC,CAAC,IAAI,EAAE;QAC9B,KAAK,EAAE,gBAAgB,CAAC,CAAC,IAAI,KAAK;QAClC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YACpB,CAAC,CAAC,EAAE,WAAW,EAAE,gBAAgB,CAAC,CAAgB,EAAE;YACpD,CAAC,CAAC,EAAE,CAAC;QACP,wFAAwF;QACxF,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,gBAAgB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,gBAAgB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvE,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAlBW,QAAA,qCAAqC,yCAkBhD;AAEF;;;;;;GAMG;AACI,MAAM,4BAA4B,GAAG,CAC1C,YAA8B,EACrB,EAAE;IACX,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC;AAC9C,CAAC,CAAC;AAJW,QAAA,4BAA4B,gCAIvC","sourcesContent":["import type {\n AddressBookEntry,\n AddressType,\n} from '@metamask/address-book-controller';\n\nimport { USER_STORAGE_VERSION_KEY, USER_STORAGE_VERSION } from './constants';\nimport type { UserStorageContactEntry } from './types';\n\n/**\n * Extends AddressBookEntry with sync metadata\n * This is only used internally during the sync process and is not stored in AddressBookController\n */\nexport type SyncAddressBookEntry = AddressBookEntry & {\n lastUpdatedAt?: number;\n deletedAt?: number;\n};\n\n/**\n * Map an address book entry to a user storage address book entry\n * Always sets a current timestamp for entries going to remote storage\n *\n * @param addressBookEntry - An address book entry\n * @returns A user storage address book entry\n */\nexport const mapAddressBookEntryToUserStorageEntry = (\n addressBookEntry: AddressBookEntry,\n): UserStorageContactEntry => {\n const {\n address,\n name,\n chainId,\n memo,\n addressType,\n isEns,\n lastUpdatedAt,\n deletedAt,\n } = addressBookEntry as SyncAddressBookEntry;\n\n const now = Date.now();\n\n return {\n [USER_STORAGE_VERSION_KEY]: USER_STORAGE_VERSION,\n a: address,\n n: name,\n c: chainId,\n ...(memo ? { m: memo } : {}),\n ...(addressType ? { t: addressType } : {}),\n ...(isEns ? { e: isEns } : {}),\n lu: lastUpdatedAt || now,\n ...(deletedAt ? { dt: deletedAt } : {}),\n };\n};\n\n/**\n * Map a user storage address book entry to an address book entry\n * Preserves sync metadata from remote storage while keeping the\n * entry compatible with AddressBookController\n *\n * @param userStorageEntry - A user storage address book entry\n * @returns An address book entry with sync metadata for internal use\n */\nexport const mapUserStorageEntryToAddressBookEntry = (\n userStorageEntry: UserStorageContactEntry,\n): SyncAddressBookEntry => {\n const addressBookEntry: SyncAddressBookEntry = {\n address: userStorageEntry.a,\n name: userStorageEntry.n,\n chainId: userStorageEntry.c,\n memo: userStorageEntry.m || '',\n isEns: userStorageEntry.e || false,\n ...(userStorageEntry.t\n ? { addressType: userStorageEntry.t as AddressType }\n : {}),\n // Include remote metadata for sync operation only (not stored in AddressBookController)\n ...(userStorageEntry.dt ? { deletedAt: userStorageEntry.dt } : {}),\n ...(userStorageEntry.lu ? { lastUpdatedAt: userStorageEntry.lu } : {}),\n };\n\n return addressBookEntry;\n};\n\n/**\n * Check if a contact entry is bridged from accounts\n * Contacts with chainId \"*\" are global accounts bridged from the accounts system\n *\n * @param contactEntry - The contact entry to check\n * @returns True if the contact is bridged from accounts\n */\nexport const isContactBridgedFromAccounts = (\n contactEntry: AddressBookEntry,\n): boolean => {\n return String(contactEntry.chainId) === '*';\n};\n"]}
@@ -1,36 +0,0 @@
1
- import type { AddressBookEntry } from "@metamask/address-book-controller";
2
- import type { UserStorageContactEntry } from "./types.cjs";
3
- /**
4
- * Extends AddressBookEntry with sync metadata
5
- * This is only used internally during the sync process and is not stored in AddressBookController
6
- */
7
- export type SyncAddressBookEntry = AddressBookEntry & {
8
- lastUpdatedAt?: number;
9
- deletedAt?: number;
10
- };
11
- /**
12
- * Map an address book entry to a user storage address book entry
13
- * Always sets a current timestamp for entries going to remote storage
14
- *
15
- * @param addressBookEntry - An address book entry
16
- * @returns A user storage address book entry
17
- */
18
- export declare const mapAddressBookEntryToUserStorageEntry: (addressBookEntry: AddressBookEntry) => UserStorageContactEntry;
19
- /**
20
- * Map a user storage address book entry to an address book entry
21
- * Preserves sync metadata from remote storage while keeping the
22
- * entry compatible with AddressBookController
23
- *
24
- * @param userStorageEntry - A user storage address book entry
25
- * @returns An address book entry with sync metadata for internal use
26
- */
27
- export declare const mapUserStorageEntryToAddressBookEntry: (userStorageEntry: UserStorageContactEntry) => SyncAddressBookEntry;
28
- /**
29
- * Check if a contact entry is bridged from accounts
30
- * Contacts with chainId "*" are global accounts bridged from the accounts system
31
- *
32
- * @param contactEntry - The contact entry to check
33
- * @returns True if the contact is bridged from accounts
34
- */
35
- export declare const isContactBridgedFromAccounts: (contactEntry: AddressBookEntry) => boolean;
36
- //# sourceMappingURL=utils.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEjB,0CAA0C;AAG3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,oBAAgB;AAEvD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IACpD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC,qBAC9B,gBAAgB,KACjC,uBAyBF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qCAAqC,qBAC9B,uBAAuB,KACxC,oBAgBF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,iBACzB,gBAAgB,KAC7B,OAEF,CAAC"}
@@ -1,36 +0,0 @@
1
- import type { AddressBookEntry } from "@metamask/address-book-controller";
2
- import type { UserStorageContactEntry } from "./types.mjs";
3
- /**
4
- * Extends AddressBookEntry with sync metadata
5
- * This is only used internally during the sync process and is not stored in AddressBookController
6
- */
7
- export type SyncAddressBookEntry = AddressBookEntry & {
8
- lastUpdatedAt?: number;
9
- deletedAt?: number;
10
- };
11
- /**
12
- * Map an address book entry to a user storage address book entry
13
- * Always sets a current timestamp for entries going to remote storage
14
- *
15
- * @param addressBookEntry - An address book entry
16
- * @returns A user storage address book entry
17
- */
18
- export declare const mapAddressBookEntryToUserStorageEntry: (addressBookEntry: AddressBookEntry) => UserStorageContactEntry;
19
- /**
20
- * Map a user storage address book entry to an address book entry
21
- * Preserves sync metadata from remote storage while keeping the
22
- * entry compatible with AddressBookController
23
- *
24
- * @param userStorageEntry - A user storage address book entry
25
- * @returns An address book entry with sync metadata for internal use
26
- */
27
- export declare const mapUserStorageEntryToAddressBookEntry: (userStorageEntry: UserStorageContactEntry) => SyncAddressBookEntry;
28
- /**
29
- * Check if a contact entry is bridged from accounts
30
- * Contacts with chainId "*" are global accounts bridged from the accounts system
31
- *
32
- * @param contactEntry - The contact entry to check
33
- * @returns True if the contact is bridged from accounts
34
- */
35
- export declare const isContactBridgedFromAccounts: (contactEntry: AddressBookEntry) => boolean;
36
- //# sourceMappingURL=utils.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEjB,0CAA0C;AAG3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,oBAAgB;AAEvD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IACpD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC,qBAC9B,gBAAgB,KACjC,uBAyBF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qCAAqC,qBAC9B,uBAAuB,KACxC,oBAgBF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,iBACzB,gBAAgB,KAC7B,OAEF,CAAC"}
@@ -1,58 +0,0 @@
1
- import { USER_STORAGE_VERSION_KEY, USER_STORAGE_VERSION } from "./constants.mjs";
2
- /**
3
- * Map an address book entry to a user storage address book entry
4
- * Always sets a current timestamp for entries going to remote storage
5
- *
6
- * @param addressBookEntry - An address book entry
7
- * @returns A user storage address book entry
8
- */
9
- export const mapAddressBookEntryToUserStorageEntry = (addressBookEntry) => {
10
- const { address, name, chainId, memo, addressType, isEns, lastUpdatedAt, deletedAt, } = addressBookEntry;
11
- const now = Date.now();
12
- return {
13
- [USER_STORAGE_VERSION_KEY]: USER_STORAGE_VERSION,
14
- a: address,
15
- n: name,
16
- c: chainId,
17
- ...(memo ? { m: memo } : {}),
18
- ...(addressType ? { t: addressType } : {}),
19
- ...(isEns ? { e: isEns } : {}),
20
- lu: lastUpdatedAt || now,
21
- ...(deletedAt ? { dt: deletedAt } : {}),
22
- };
23
- };
24
- /**
25
- * Map a user storage address book entry to an address book entry
26
- * Preserves sync metadata from remote storage while keeping the
27
- * entry compatible with AddressBookController
28
- *
29
- * @param userStorageEntry - A user storage address book entry
30
- * @returns An address book entry with sync metadata for internal use
31
- */
32
- export const mapUserStorageEntryToAddressBookEntry = (userStorageEntry) => {
33
- const addressBookEntry = {
34
- address: userStorageEntry.a,
35
- name: userStorageEntry.n,
36
- chainId: userStorageEntry.c,
37
- memo: userStorageEntry.m || '',
38
- isEns: userStorageEntry.e || false,
39
- ...(userStorageEntry.t
40
- ? { addressType: userStorageEntry.t }
41
- : {}),
42
- // Include remote metadata for sync operation only (not stored in AddressBookController)
43
- ...(userStorageEntry.dt ? { deletedAt: userStorageEntry.dt } : {}),
44
- ...(userStorageEntry.lu ? { lastUpdatedAt: userStorageEntry.lu } : {}),
45
- };
46
- return addressBookEntry;
47
- };
48
- /**
49
- * Check if a contact entry is bridged from accounts
50
- * Contacts with chainId "*" are global accounts bridged from the accounts system
51
- *
52
- * @param contactEntry - The contact entry to check
53
- * @returns True if the contact is bridged from accounts
54
- */
55
- export const isContactBridgedFromAccounts = (contactEntry) => {
56
- return String(contactEntry.chainId) === '*';
57
- };
58
- //# sourceMappingURL=utils.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,wBAAoB;AAY7E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,gBAAkC,EACT,EAAE;IAC3B,MAAM,EACJ,OAAO,EACP,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,WAAW,EACX,KAAK,EACL,aAAa,EACb,SAAS,GACV,GAAG,gBAAwC,CAAC;IAE7C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEvB,OAAO;QACL,CAAC,wBAAwB,CAAC,EAAE,oBAAoB;QAChD,CAAC,EAAE,OAAO;QACV,CAAC,EAAE,IAAI;QACP,CAAC,EAAE,OAAO;QACV,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5B,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1C,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9B,EAAE,EAAE,aAAa,IAAI,GAAG;QACxB,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxC,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,gBAAyC,EACnB,EAAE;IACxB,MAAM,gBAAgB,GAAyB;QAC7C,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAC3B,IAAI,EAAE,gBAAgB,CAAC,CAAC;QACxB,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAC3B,IAAI,EAAE,gBAAgB,CAAC,CAAC,IAAI,EAAE;QAC9B,KAAK,EAAE,gBAAgB,CAAC,CAAC,IAAI,KAAK;QAClC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YACpB,CAAC,CAAC,EAAE,WAAW,EAAE,gBAAgB,CAAC,CAAgB,EAAE;YACpD,CAAC,CAAC,EAAE,CAAC;QACP,wFAAwF;QACxF,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,gBAAgB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,gBAAgB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvE,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,YAA8B,EACrB,EAAE;IACX,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["import type {\n AddressBookEntry,\n AddressType,\n} from '@metamask/address-book-controller';\n\nimport { USER_STORAGE_VERSION_KEY, USER_STORAGE_VERSION } from './constants';\nimport type { UserStorageContactEntry } from './types';\n\n/**\n * Extends AddressBookEntry with sync metadata\n * This is only used internally during the sync process and is not stored in AddressBookController\n */\nexport type SyncAddressBookEntry = AddressBookEntry & {\n lastUpdatedAt?: number;\n deletedAt?: number;\n};\n\n/**\n * Map an address book entry to a user storage address book entry\n * Always sets a current timestamp for entries going to remote storage\n *\n * @param addressBookEntry - An address book entry\n * @returns A user storage address book entry\n */\nexport const mapAddressBookEntryToUserStorageEntry = (\n addressBookEntry: AddressBookEntry,\n): UserStorageContactEntry => {\n const {\n address,\n name,\n chainId,\n memo,\n addressType,\n isEns,\n lastUpdatedAt,\n deletedAt,\n } = addressBookEntry as SyncAddressBookEntry;\n\n const now = Date.now();\n\n return {\n [USER_STORAGE_VERSION_KEY]: USER_STORAGE_VERSION,\n a: address,\n n: name,\n c: chainId,\n ...(memo ? { m: memo } : {}),\n ...(addressType ? { t: addressType } : {}),\n ...(isEns ? { e: isEns } : {}),\n lu: lastUpdatedAt || now,\n ...(deletedAt ? { dt: deletedAt } : {}),\n };\n};\n\n/**\n * Map a user storage address book entry to an address book entry\n * Preserves sync metadata from remote storage while keeping the\n * entry compatible with AddressBookController\n *\n * @param userStorageEntry - A user storage address book entry\n * @returns An address book entry with sync metadata for internal use\n */\nexport const mapUserStorageEntryToAddressBookEntry = (\n userStorageEntry: UserStorageContactEntry,\n): SyncAddressBookEntry => {\n const addressBookEntry: SyncAddressBookEntry = {\n address: userStorageEntry.a,\n name: userStorageEntry.n,\n chainId: userStorageEntry.c,\n memo: userStorageEntry.m || '',\n isEns: userStorageEntry.e || false,\n ...(userStorageEntry.t\n ? { addressType: userStorageEntry.t as AddressType }\n : {}),\n // Include remote metadata for sync operation only (not stored in AddressBookController)\n ...(userStorageEntry.dt ? { deletedAt: userStorageEntry.dt } : {}),\n ...(userStorageEntry.lu ? { lastUpdatedAt: userStorageEntry.lu } : {}),\n };\n\n return addressBookEntry;\n};\n\n/**\n * Check if a contact entry is bridged from accounts\n * Contacts with chainId \"*\" are global accounts bridged from the accounts system\n *\n * @param contactEntry - The contact entry to check\n * @returns True if the contact is bridged from accounts\n */\nexport const isContactBridgedFromAccounts = (\n contactEntry: AddressBookEntry,\n): boolean => {\n return String(contactEntry.chainId) === '*';\n};\n"]}