@metamask-previews/notification-services-controller 10.0.0-preview-e11fb169 → 10.0.0-preview-7dcef379

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 (144) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/NotificationServicesController/NotificationServicesController.cjs +76 -188
  3. package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -1
  4. package/dist/NotificationServicesController/NotificationServicesController.d.cts +10 -16
  5. package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -1
  6. package/dist/NotificationServicesController/NotificationServicesController.d.mts +10 -16
  7. package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -1
  8. package/dist/NotificationServicesController/NotificationServicesController.mjs +77 -189
  9. package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -1
  10. package/dist/NotificationServicesController/constants/index.cjs +0 -1
  11. package/dist/NotificationServicesController/constants/index.cjs.map +1 -1
  12. package/dist/NotificationServicesController/constants/index.d.cts +0 -1
  13. package/dist/NotificationServicesController/constants/index.d.cts.map +1 -1
  14. package/dist/NotificationServicesController/constants/index.d.mts +0 -1
  15. package/dist/NotificationServicesController/constants/index.d.mts.map +1 -1
  16. package/dist/NotificationServicesController/constants/index.mjs +0 -1
  17. package/dist/NotificationServicesController/constants/index.mjs.map +1 -1
  18. package/dist/NotificationServicesController/mocks/index.cjs +0 -2
  19. package/dist/NotificationServicesController/mocks/index.cjs.map +1 -1
  20. package/dist/NotificationServicesController/mocks/index.d.cts +0 -2
  21. package/dist/NotificationServicesController/mocks/index.d.cts.map +1 -1
  22. package/dist/NotificationServicesController/mocks/index.d.mts +0 -2
  23. package/dist/NotificationServicesController/mocks/index.d.mts.map +1 -1
  24. package/dist/NotificationServicesController/mocks/index.mjs +0 -2
  25. package/dist/NotificationServicesController/mocks/index.mjs.map +1 -1
  26. package/dist/NotificationServicesController/mocks/mockResponses.cjs +9 -9
  27. package/dist/NotificationServicesController/mocks/mockResponses.cjs.map +1 -1
  28. package/dist/NotificationServicesController/mocks/mockResponses.d.cts +7 -4
  29. package/dist/NotificationServicesController/mocks/mockResponses.d.cts.map +1 -1
  30. package/dist/NotificationServicesController/mocks/mockResponses.d.mts +7 -4
  31. package/dist/NotificationServicesController/mocks/mockResponses.d.mts.map +1 -1
  32. package/dist/NotificationServicesController/mocks/mockResponses.mjs +7 -7
  33. package/dist/NotificationServicesController/mocks/mockResponses.mjs.map +1 -1
  34. package/dist/NotificationServicesController/processors/process-notifications.cjs +4 -1
  35. package/dist/NotificationServicesController/processors/process-notifications.cjs.map +1 -1
  36. package/dist/NotificationServicesController/processors/process-notifications.d.cts +623 -0
  37. package/dist/NotificationServicesController/processors/process-notifications.d.cts.map +1 -1
  38. package/dist/NotificationServicesController/processors/process-notifications.d.mts +623 -0
  39. package/dist/NotificationServicesController/processors/process-notifications.d.mts.map +1 -1
  40. package/dist/NotificationServicesController/processors/process-notifications.mjs +2 -0
  41. package/dist/NotificationServicesController/processors/process-notifications.mjs.map +1 -1
  42. package/dist/NotificationServicesController/services/notification-config-cache.cjs +72 -0
  43. package/dist/NotificationServicesController/services/notification-config-cache.cjs.map +1 -0
  44. package/dist/NotificationServicesController/services/notification-config-cache.d.cts +19 -0
  45. package/dist/NotificationServicesController/services/notification-config-cache.d.cts.map +1 -0
  46. package/dist/NotificationServicesController/services/notification-config-cache.d.mts +19 -0
  47. package/dist/NotificationServicesController/services/notification-config-cache.d.mts.map +1 -0
  48. package/dist/NotificationServicesController/services/notification-config-cache.mjs +68 -0
  49. package/dist/NotificationServicesController/services/notification-config-cache.mjs.map +1 -0
  50. package/dist/NotificationServicesController/services/onchain-notifications.cjs +67 -140
  51. package/dist/NotificationServicesController/services/onchain-notifications.cjs.map +1 -1
  52. package/dist/NotificationServicesController/services/onchain-notifications.d.cts +25 -31
  53. package/dist/NotificationServicesController/services/onchain-notifications.d.cts.map +1 -1
  54. package/dist/NotificationServicesController/services/onchain-notifications.d.mts +25 -31
  55. package/dist/NotificationServicesController/services/onchain-notifications.d.mts.map +1 -1
  56. package/dist/NotificationServicesController/services/onchain-notifications.mjs +65 -137
  57. package/dist/NotificationServicesController/services/onchain-notifications.mjs.map +1 -1
  58. package/dist/NotificationServicesController/types/index.cjs.map +1 -1
  59. package/dist/NotificationServicesController/types/index.d.cts +0 -1
  60. package/dist/NotificationServicesController/types/index.d.cts.map +1 -1
  61. package/dist/NotificationServicesController/types/index.d.mts +0 -1
  62. package/dist/NotificationServicesController/types/index.d.mts.map +1 -1
  63. package/dist/NotificationServicesController/types/index.mjs.map +1 -1
  64. package/dist/NotificationServicesController/utils/utils.cjs +1 -350
  65. package/dist/NotificationServicesController/utils/utils.cjs.map +1 -1
  66. package/dist/NotificationServicesController/utils/utils.d.cts +0 -141
  67. package/dist/NotificationServicesController/utils/utils.d.cts.map +1 -1
  68. package/dist/NotificationServicesController/utils/utils.d.mts +0 -141
  69. package/dist/NotificationServicesController/utils/utils.d.mts.map +1 -1
  70. package/dist/NotificationServicesController/utils/utils.mjs +0 -337
  71. package/dist/NotificationServicesController/utils/utils.mjs.map +1 -1
  72. package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +22 -15
  73. package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -1
  74. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts +6 -5
  75. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -1
  76. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +6 -5
  77. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -1
  78. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +23 -16
  79. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
  80. package/dist/NotificationServicesPushController/mocks/mockResponse.cjs +1 -16
  81. package/dist/NotificationServicesPushController/mocks/mockResponse.cjs.map +1 -1
  82. package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts +0 -7
  83. package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts.map +1 -1
  84. package/dist/NotificationServicesPushController/mocks/mockResponse.d.mts +0 -7
  85. package/dist/NotificationServicesPushController/mocks/mockResponse.d.mts.map +1 -1
  86. package/dist/NotificationServicesPushController/mocks/mockResponse.mjs +0 -14
  87. package/dist/NotificationServicesPushController/mocks/mockResponse.mjs.map +1 -1
  88. package/dist/NotificationServicesPushController/services/endpoints.cjs +1 -1
  89. package/dist/NotificationServicesPushController/services/endpoints.cjs.map +1 -1
  90. package/dist/NotificationServicesPushController/services/endpoints.d.cts +1 -1
  91. package/dist/NotificationServicesPushController/services/endpoints.d.cts.map +1 -1
  92. package/dist/NotificationServicesPushController/services/endpoints.d.mts +1 -1
  93. package/dist/NotificationServicesPushController/services/endpoints.d.mts.map +1 -1
  94. package/dist/NotificationServicesPushController/services/endpoints.mjs +1 -1
  95. package/dist/NotificationServicesPushController/services/endpoints.mjs.map +1 -1
  96. package/dist/NotificationServicesPushController/services/services.cjs +18 -41
  97. package/dist/NotificationServicesPushController/services/services.cjs.map +1 -1
  98. package/dist/NotificationServicesPushController/services/services.d.cts +19 -33
  99. package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -1
  100. package/dist/NotificationServicesPushController/services/services.d.mts +19 -33
  101. package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -1
  102. package/dist/NotificationServicesPushController/services/services.mjs +17 -39
  103. package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
  104. package/package.json +2 -2
  105. package/dist/NotificationServicesController/constants/constants.cjs +0 -7
  106. package/dist/NotificationServicesController/constants/constants.cjs.map +0 -1
  107. package/dist/NotificationServicesController/constants/constants.d.cts +0 -3
  108. package/dist/NotificationServicesController/constants/constants.d.cts.map +0 -1
  109. package/dist/NotificationServicesController/constants/constants.d.mts +0 -3
  110. package/dist/NotificationServicesController/constants/constants.d.mts.map +0 -1
  111. package/dist/NotificationServicesController/constants/constants.mjs +0 -4
  112. package/dist/NotificationServicesController/constants/constants.mjs.map +0 -1
  113. package/dist/NotificationServicesController/mocks/mock-notification-trigger.cjs +0 -22
  114. package/dist/NotificationServicesController/mocks/mock-notification-trigger.cjs.map +0 -1
  115. package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.cts +0 -9
  116. package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.cts.map +0 -1
  117. package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.mts +0 -9
  118. package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.mts.map +0 -1
  119. package/dist/NotificationServicesController/mocks/mock-notification-trigger.mjs +0 -18
  120. package/dist/NotificationServicesController/mocks/mock-notification-trigger.mjs.map +0 -1
  121. package/dist/NotificationServicesController/mocks/mock-notification-user-storage.cjs +0 -82
  122. package/dist/NotificationServicesController/mocks/mock-notification-user-storage.cjs.map +0 -1
  123. package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.cts +0 -35
  124. package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.cts.map +0 -1
  125. package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.mts +0 -35
  126. package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.mts.map +0 -1
  127. package/dist/NotificationServicesController/mocks/mock-notification-user-storage.mjs +0 -76
  128. package/dist/NotificationServicesController/mocks/mock-notification-user-storage.mjs.map +0 -1
  129. package/dist/NotificationServicesController/types/user-storage/index.cjs +0 -3
  130. package/dist/NotificationServicesController/types/user-storage/index.cjs.map +0 -1
  131. package/dist/NotificationServicesController/types/user-storage/index.d.cts +0 -2
  132. package/dist/NotificationServicesController/types/user-storage/index.d.cts.map +0 -1
  133. package/dist/NotificationServicesController/types/user-storage/index.d.mts +0 -2
  134. package/dist/NotificationServicesController/types/user-storage/index.d.mts.map +0 -1
  135. package/dist/NotificationServicesController/types/user-storage/index.mjs +0 -2
  136. package/dist/NotificationServicesController/types/user-storage/index.mjs.map +0 -1
  137. package/dist/NotificationServicesController/types/user-storage/user-storage.cjs +0 -3
  138. package/dist/NotificationServicesController/types/user-storage/user-storage.cjs.map +0 -1
  139. package/dist/NotificationServicesController/types/user-storage/user-storage.d.cts +0 -26
  140. package/dist/NotificationServicesController/types/user-storage/user-storage.d.cts.map +0 -1
  141. package/dist/NotificationServicesController/types/user-storage/user-storage.d.mts +0 -26
  142. package/dist/NotificationServicesController/types/user-storage/user-storage.d.mts.map +0 -1
  143. package/dist/NotificationServicesController/types/user-storage/user-storage.mjs +0 -2
  144. package/dist/NotificationServicesController/types/user-storage/user-storage.mjs.map +0 -1
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createMockFullUserStorage = exports.createMockUserStorageWithTriggers = exports.createMockUserStorage = exports.MOCK_USER_STORAGE_CHAIN = exports.MOCK_USER_STORAGE_ACCOUNT = void 0;
4
- const constants_1 = require("../constants/constants.cjs");
5
- const notification_schema_1 = require("../constants/notification-schema.cjs");
6
- const utils_1 = require("../utils/utils.cjs");
7
- exports.MOCK_USER_STORAGE_ACCOUNT = '0x0000000000000000000000000000000000000000';
8
- exports.MOCK_USER_STORAGE_CHAIN = '1';
9
- /**
10
- * Mocking Utility - create a mock notification user storage object
11
- *
12
- * @param override - provide any override configuration for the mock
13
- * @returns a mock notification user storage object
14
- */
15
- function createMockUserStorage(override) {
16
- return {
17
- [constants_1.USER_STORAGE_VERSION_KEY]: '1',
18
- [exports.MOCK_USER_STORAGE_ACCOUNT]: {
19
- [exports.MOCK_USER_STORAGE_CHAIN]: {
20
- '111-111-111-111': {
21
- k: notification_schema_1.TRIGGER_TYPES.ERC20_RECEIVED,
22
- e: true,
23
- },
24
- '222-222-222-222': {
25
- k: notification_schema_1.TRIGGER_TYPES.ERC20_SENT,
26
- e: true,
27
- },
28
- },
29
- },
30
- ...override,
31
- };
32
- }
33
- exports.createMockUserStorage = createMockUserStorage;
34
- /**
35
- * Mocking Utility - create a mock notification user storage object with triggers
36
- *
37
- * @param triggers - provide any override configuration for the mock
38
- * @returns a mock notification user storage object with triggers
39
- */
40
- function createMockUserStorageWithTriggers(triggers) {
41
- const userStorage = {
42
- [constants_1.USER_STORAGE_VERSION_KEY]: '1',
43
- [exports.MOCK_USER_STORAGE_ACCOUNT]: {
44
- [exports.MOCK_USER_STORAGE_CHAIN]: {},
45
- },
46
- };
47
- // insert triggerIds
48
- triggers.forEach((t) => {
49
- let tId;
50
- let e;
51
- let k;
52
- if (typeof t === 'string') {
53
- tId = t;
54
- e = true;
55
- k = notification_schema_1.TRIGGER_TYPES.ERC20_RECEIVED;
56
- }
57
- else {
58
- tId = t.id;
59
- e = t.e;
60
- k = t.k ?? notification_schema_1.TRIGGER_TYPES.ERC20_RECEIVED;
61
- }
62
- userStorage[exports.MOCK_USER_STORAGE_ACCOUNT][exports.MOCK_USER_STORAGE_CHAIN][tId] = {
63
- k,
64
- e,
65
- };
66
- });
67
- return userStorage;
68
- }
69
- exports.createMockUserStorageWithTriggers = createMockUserStorageWithTriggers;
70
- /**
71
- * Mocking Utility - create a mock notification user storage object (full/realistic object)
72
- *
73
- * @param props - provide any override configuration for the mock
74
- * @param props.triggersEnabled - choose if all triggers created are enabled/disabled
75
- * @param props.address - choose a specific address for triggers to be assigned to
76
- * @returns a mock full notification user storage object
77
- */
78
- function createMockFullUserStorage(props = {}) {
79
- return (0, utils_1.initializeUserStorage)([{ address: props.address ?? exports.MOCK_USER_STORAGE_ACCOUNT }], props.triggersEnabled ?? true, false);
80
- }
81
- exports.createMockFullUserStorage = createMockFullUserStorage;
82
- //# sourceMappingURL=mock-notification-user-storage.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mock-notification-user-storage.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/mocks/mock-notification-user-storage.ts"],"names":[],"mappings":";;;AAAA,0DAAkE;AAClE,8EAAiE;AAEjE,8CAAuD;AAE1C,QAAA,yBAAyB,GACpC,4CAA4C,CAAC;AAClC,QAAA,uBAAuB,GAAG,GAAG,CAAC;AAE3C;;;;;GAKG;AACH,SAAgB,qBAAqB,CACnC,QAA+B;IAE/B,OAAO;QACL,CAAC,oCAAwB,CAAC,EAAE,GAAG;QAC/B,CAAC,iCAAyB,CAAC,EAAE;YAC3B,CAAC,+BAAuB,CAAC,EAAE;gBACzB,iBAAiB,EAAE;oBACjB,CAAC,EAAE,mCAAa,CAAC,cAAc;oBAC/B,CAAC,EAAE,IAAI;iBACR;gBACD,iBAAiB,EAAE;oBACjB,CAAC,EAAE,mCAAa,CAAC,UAAU;oBAC3B,CAAC,EAAE,IAAI;iBACR;aACF;SACF;QACD,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC;AAnBD,sDAmBC;AAED;;;;;GAKG;AACH,SAAgB,iCAAiC,CAC/C,QAAoE;IAEpE,MAAM,WAAW,GAAgB;QAC/B,CAAC,oCAAwB,CAAC,EAAE,GAAG;QAC/B,CAAC,iCAAyB,CAAC,EAAE;YAC3B,CAAC,+BAAuB,CAAC,EAAE,EAAE;SAC9B;KACF,CAAC;IAEF,oBAAoB;IACpB,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACrB,IAAI,GAAW,CAAC;QAChB,IAAI,CAAU,CAAC;QACf,IAAI,CAAgB,CAAC;QACrB,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;YACzB,GAAG,GAAG,CAAC,CAAC;YACR,CAAC,GAAG,IAAI,CAAC;YACT,CAAC,GAAG,mCAAa,CAAC,cAAc,CAAC;SAClC;aAAM;YACL,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC;YACX,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACR,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,mCAAa,CAAC,cAAc,CAAC;SACzC;QAED,WAAW,CAAC,iCAAyB,CAAC,CAAC,+BAAuB,CAAC,CAAC,GAAG,CAAC,GAAG;YACrE,CAAC;YACD,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC;AAhCD,8EAgCC;AAED;;;;;;;GAOG;AACH,SAAgB,yBAAyB,CACvC,QAAyD,EAAE;IAE3D,OAAO,IAAA,6BAAqB,EAC1B,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,iCAAyB,EAAE,CAAC,EACzD,KAAK,CAAC,eAAe,IAAI,IAAI,EAC7B,KAAK,CACN,CAAC;AACJ,CAAC;AARD,8DAQC","sourcesContent":["import { USER_STORAGE_VERSION_KEY } from '../constants/constants';\nimport { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { UserStorage } from '../types/user-storage/user-storage';\nimport { initializeUserStorage } from '../utils/utils';\n\nexport const MOCK_USER_STORAGE_ACCOUNT =\n '0x0000000000000000000000000000000000000000';\nexport const MOCK_USER_STORAGE_CHAIN = '1';\n\n/**\n * Mocking Utility - create a mock notification user storage object\n *\n * @param override - provide any override configuration for the mock\n * @returns a mock notification user storage object\n */\nexport function createMockUserStorage(\n override?: Partial<UserStorage>,\n): UserStorage {\n return {\n [USER_STORAGE_VERSION_KEY]: '1',\n [MOCK_USER_STORAGE_ACCOUNT]: {\n [MOCK_USER_STORAGE_CHAIN]: {\n '111-111-111-111': {\n k: TRIGGER_TYPES.ERC20_RECEIVED,\n e: true,\n },\n '222-222-222-222': {\n k: TRIGGER_TYPES.ERC20_SENT,\n e: true,\n },\n },\n },\n ...override,\n };\n}\n\n/**\n * Mocking Utility - create a mock notification user storage object with triggers\n *\n * @param triggers - provide any override configuration for the mock\n * @returns a mock notification user storage object with triggers\n */\nexport function createMockUserStorageWithTriggers(\n triggers: string[] | { id: string; e: boolean; k?: TRIGGER_TYPES }[],\n): UserStorage {\n const userStorage: UserStorage = {\n [USER_STORAGE_VERSION_KEY]: '1',\n [MOCK_USER_STORAGE_ACCOUNT]: {\n [MOCK_USER_STORAGE_CHAIN]: {},\n },\n };\n\n // insert triggerIds\n triggers.forEach((t) => {\n let tId: string;\n let e: boolean;\n let k: TRIGGER_TYPES;\n if (typeof t === 'string') {\n tId = t;\n e = true;\n k = TRIGGER_TYPES.ERC20_RECEIVED;\n } else {\n tId = t.id;\n e = t.e;\n k = t.k ?? TRIGGER_TYPES.ERC20_RECEIVED;\n }\n\n userStorage[MOCK_USER_STORAGE_ACCOUNT][MOCK_USER_STORAGE_CHAIN][tId] = {\n k,\n e,\n };\n });\n\n return userStorage;\n}\n\n/**\n * Mocking Utility - create a mock notification user storage object (full/realistic object)\n *\n * @param props - provide any override configuration for the mock\n * @param props.triggersEnabled - choose if all triggers created are enabled/disabled\n * @param props.address - choose a specific address for triggers to be assigned to\n * @returns a mock full notification user storage object\n */\nexport function createMockFullUserStorage(\n props: { triggersEnabled?: boolean; address?: string } = {},\n): UserStorage {\n return initializeUserStorage(\n [{ address: props.address ?? MOCK_USER_STORAGE_ACCOUNT }],\n props.triggersEnabled ?? true,\n false,\n );\n}\n"]}
@@ -1,35 +0,0 @@
1
- import { TRIGGER_TYPES } from "../constants/notification-schema.cjs";
2
- import type { UserStorage } from "../types/user-storage/user-storage.cjs";
3
- export declare const MOCK_USER_STORAGE_ACCOUNT = "0x0000000000000000000000000000000000000000";
4
- export declare const MOCK_USER_STORAGE_CHAIN = "1";
5
- /**
6
- * Mocking Utility - create a mock notification user storage object
7
- *
8
- * @param override - provide any override configuration for the mock
9
- * @returns a mock notification user storage object
10
- */
11
- export declare function createMockUserStorage(override?: Partial<UserStorage>): UserStorage;
12
- /**
13
- * Mocking Utility - create a mock notification user storage object with triggers
14
- *
15
- * @param triggers - provide any override configuration for the mock
16
- * @returns a mock notification user storage object with triggers
17
- */
18
- export declare function createMockUserStorageWithTriggers(triggers: string[] | {
19
- id: string;
20
- e: boolean;
21
- k?: TRIGGER_TYPES;
22
- }[]): UserStorage;
23
- /**
24
- * Mocking Utility - create a mock notification user storage object (full/realistic object)
25
- *
26
- * @param props - provide any override configuration for the mock
27
- * @param props.triggersEnabled - choose if all triggers created are enabled/disabled
28
- * @param props.address - choose a specific address for triggers to be assigned to
29
- * @returns a mock full notification user storage object
30
- */
31
- export declare function createMockFullUserStorage(props?: {
32
- triggersEnabled?: boolean;
33
- address?: string;
34
- }): UserStorage;
35
- //# sourceMappingURL=mock-notification-user-storage.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mock-notification-user-storage.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/mocks/mock-notification-user-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,6CAAyC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,+CAA2C;AAGtE,eAAO,MAAM,yBAAyB,+CACQ,CAAC;AAC/C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAC9B,WAAW,CAiBb;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,MAAM,EAAE,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,OAAO,CAAC;IAAC,CAAC,CAAC,EAAE,aAAa,CAAA;CAAE,EAAE,GACnE,WAAW,CA8Bb;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,GAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAC1D,WAAW,CAMb"}
@@ -1,35 +0,0 @@
1
- import { TRIGGER_TYPES } from "../constants/notification-schema.mjs";
2
- import type { UserStorage } from "../types/user-storage/user-storage.mjs";
3
- export declare const MOCK_USER_STORAGE_ACCOUNT = "0x0000000000000000000000000000000000000000";
4
- export declare const MOCK_USER_STORAGE_CHAIN = "1";
5
- /**
6
- * Mocking Utility - create a mock notification user storage object
7
- *
8
- * @param override - provide any override configuration for the mock
9
- * @returns a mock notification user storage object
10
- */
11
- export declare function createMockUserStorage(override?: Partial<UserStorage>): UserStorage;
12
- /**
13
- * Mocking Utility - create a mock notification user storage object with triggers
14
- *
15
- * @param triggers - provide any override configuration for the mock
16
- * @returns a mock notification user storage object with triggers
17
- */
18
- export declare function createMockUserStorageWithTriggers(triggers: string[] | {
19
- id: string;
20
- e: boolean;
21
- k?: TRIGGER_TYPES;
22
- }[]): UserStorage;
23
- /**
24
- * Mocking Utility - create a mock notification user storage object (full/realistic object)
25
- *
26
- * @param props - provide any override configuration for the mock
27
- * @param props.triggersEnabled - choose if all triggers created are enabled/disabled
28
- * @param props.address - choose a specific address for triggers to be assigned to
29
- * @returns a mock full notification user storage object
30
- */
31
- export declare function createMockFullUserStorage(props?: {
32
- triggersEnabled?: boolean;
33
- address?: string;
34
- }): UserStorage;
35
- //# sourceMappingURL=mock-notification-user-storage.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mock-notification-user-storage.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/mocks/mock-notification-user-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,6CAAyC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,+CAA2C;AAGtE,eAAO,MAAM,yBAAyB,+CACQ,CAAC;AAC/C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAC9B,WAAW,CAiBb;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,MAAM,EAAE,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,OAAO,CAAC;IAAC,CAAC,CAAC,EAAE,aAAa,CAAA;CAAE,EAAE,GACnE,WAAW,CA8Bb;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,GAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAC1D,WAAW,CAMb"}
@@ -1,76 +0,0 @@
1
- import { USER_STORAGE_VERSION_KEY } from "../constants/constants.mjs";
2
- import { TRIGGER_TYPES } from "../constants/notification-schema.mjs";
3
- import { initializeUserStorage } from "../utils/utils.mjs";
4
- export const MOCK_USER_STORAGE_ACCOUNT = '0x0000000000000000000000000000000000000000';
5
- export const MOCK_USER_STORAGE_CHAIN = '1';
6
- /**
7
- * Mocking Utility - create a mock notification user storage object
8
- *
9
- * @param override - provide any override configuration for the mock
10
- * @returns a mock notification user storage object
11
- */
12
- export function createMockUserStorage(override) {
13
- return {
14
- [USER_STORAGE_VERSION_KEY]: '1',
15
- [MOCK_USER_STORAGE_ACCOUNT]: {
16
- [MOCK_USER_STORAGE_CHAIN]: {
17
- '111-111-111-111': {
18
- k: TRIGGER_TYPES.ERC20_RECEIVED,
19
- e: true,
20
- },
21
- '222-222-222-222': {
22
- k: TRIGGER_TYPES.ERC20_SENT,
23
- e: true,
24
- },
25
- },
26
- },
27
- ...override,
28
- };
29
- }
30
- /**
31
- * Mocking Utility - create a mock notification user storage object with triggers
32
- *
33
- * @param triggers - provide any override configuration for the mock
34
- * @returns a mock notification user storage object with triggers
35
- */
36
- export function createMockUserStorageWithTriggers(triggers) {
37
- const userStorage = {
38
- [USER_STORAGE_VERSION_KEY]: '1',
39
- [MOCK_USER_STORAGE_ACCOUNT]: {
40
- [MOCK_USER_STORAGE_CHAIN]: {},
41
- },
42
- };
43
- // insert triggerIds
44
- triggers.forEach((t) => {
45
- let tId;
46
- let e;
47
- let k;
48
- if (typeof t === 'string') {
49
- tId = t;
50
- e = true;
51
- k = TRIGGER_TYPES.ERC20_RECEIVED;
52
- }
53
- else {
54
- tId = t.id;
55
- e = t.e;
56
- k = t.k ?? TRIGGER_TYPES.ERC20_RECEIVED;
57
- }
58
- userStorage[MOCK_USER_STORAGE_ACCOUNT][MOCK_USER_STORAGE_CHAIN][tId] = {
59
- k,
60
- e,
61
- };
62
- });
63
- return userStorage;
64
- }
65
- /**
66
- * Mocking Utility - create a mock notification user storage object (full/realistic object)
67
- *
68
- * @param props - provide any override configuration for the mock
69
- * @param props.triggersEnabled - choose if all triggers created are enabled/disabled
70
- * @param props.address - choose a specific address for triggers to be assigned to
71
- * @returns a mock full notification user storage object
72
- */
73
- export function createMockFullUserStorage(props = {}) {
74
- return initializeUserStorage([{ address: props.address ?? MOCK_USER_STORAGE_ACCOUNT }], props.triggersEnabled ?? true, false);
75
- }
76
- //# sourceMappingURL=mock-notification-user-storage.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mock-notification-user-storage.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/mocks/mock-notification-user-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,mCAA+B;AAClE,OAAO,EAAE,aAAa,EAAE,6CAAyC;AAEjE,OAAO,EAAE,qBAAqB,EAAE,2BAAuB;AAEvD,MAAM,CAAC,MAAM,yBAAyB,GACpC,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAA+B;IAE/B,OAAO;QACL,CAAC,wBAAwB,CAAC,EAAE,GAAG;QAC/B,CAAC,yBAAyB,CAAC,EAAE;YAC3B,CAAC,uBAAuB,CAAC,EAAE;gBACzB,iBAAiB,EAAE;oBACjB,CAAC,EAAE,aAAa,CAAC,cAAc;oBAC/B,CAAC,EAAE,IAAI;iBACR;gBACD,iBAAiB,EAAE;oBACjB,CAAC,EAAE,aAAa,CAAC,UAAU;oBAC3B,CAAC,EAAE,IAAI;iBACR;aACF;SACF;QACD,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAC/C,QAAoE;IAEpE,MAAM,WAAW,GAAgB;QAC/B,CAAC,wBAAwB,CAAC,EAAE,GAAG;QAC/B,CAAC,yBAAyB,CAAC,EAAE;YAC3B,CAAC,uBAAuB,CAAC,EAAE,EAAE;SAC9B;KACF,CAAC;IAEF,oBAAoB;IACpB,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACrB,IAAI,GAAW,CAAC;QAChB,IAAI,CAAU,CAAC;QACf,IAAI,CAAgB,CAAC;QACrB,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;YACzB,GAAG,GAAG,CAAC,CAAC;YACR,CAAC,GAAG,IAAI,CAAC;YACT,CAAC,GAAG,aAAa,CAAC,cAAc,CAAC;SAClC;aAAM;YACL,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC;YACX,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACR,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,cAAc,CAAC;SACzC;QAED,WAAW,CAAC,yBAAyB,CAAC,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,GAAG;YACrE,CAAC;YACD,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAAyD,EAAE;IAE3D,OAAO,qBAAqB,CAC1B,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,yBAAyB,EAAE,CAAC,EACzD,KAAK,CAAC,eAAe,IAAI,IAAI,EAC7B,KAAK,CACN,CAAC;AACJ,CAAC","sourcesContent":["import { USER_STORAGE_VERSION_KEY } from '../constants/constants';\nimport { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { UserStorage } from '../types/user-storage/user-storage';\nimport { initializeUserStorage } from '../utils/utils';\n\nexport const MOCK_USER_STORAGE_ACCOUNT =\n '0x0000000000000000000000000000000000000000';\nexport const MOCK_USER_STORAGE_CHAIN = '1';\n\n/**\n * Mocking Utility - create a mock notification user storage object\n *\n * @param override - provide any override configuration for the mock\n * @returns a mock notification user storage object\n */\nexport function createMockUserStorage(\n override?: Partial<UserStorage>,\n): UserStorage {\n return {\n [USER_STORAGE_VERSION_KEY]: '1',\n [MOCK_USER_STORAGE_ACCOUNT]: {\n [MOCK_USER_STORAGE_CHAIN]: {\n '111-111-111-111': {\n k: TRIGGER_TYPES.ERC20_RECEIVED,\n e: true,\n },\n '222-222-222-222': {\n k: TRIGGER_TYPES.ERC20_SENT,\n e: true,\n },\n },\n },\n ...override,\n };\n}\n\n/**\n * Mocking Utility - create a mock notification user storage object with triggers\n *\n * @param triggers - provide any override configuration for the mock\n * @returns a mock notification user storage object with triggers\n */\nexport function createMockUserStorageWithTriggers(\n triggers: string[] | { id: string; e: boolean; k?: TRIGGER_TYPES }[],\n): UserStorage {\n const userStorage: UserStorage = {\n [USER_STORAGE_VERSION_KEY]: '1',\n [MOCK_USER_STORAGE_ACCOUNT]: {\n [MOCK_USER_STORAGE_CHAIN]: {},\n },\n };\n\n // insert triggerIds\n triggers.forEach((t) => {\n let tId: string;\n let e: boolean;\n let k: TRIGGER_TYPES;\n if (typeof t === 'string') {\n tId = t;\n e = true;\n k = TRIGGER_TYPES.ERC20_RECEIVED;\n } else {\n tId = t.id;\n e = t.e;\n k = t.k ?? TRIGGER_TYPES.ERC20_RECEIVED;\n }\n\n userStorage[MOCK_USER_STORAGE_ACCOUNT][MOCK_USER_STORAGE_CHAIN][tId] = {\n k,\n e,\n };\n });\n\n return userStorage;\n}\n\n/**\n * Mocking Utility - create a mock notification user storage object (full/realistic object)\n *\n * @param props - provide any override configuration for the mock\n * @param props.triggersEnabled - choose if all triggers created are enabled/disabled\n * @param props.address - choose a specific address for triggers to be assigned to\n * @returns a mock full notification user storage object\n */\nexport function createMockFullUserStorage(\n props: { triggersEnabled?: boolean; address?: string } = {},\n): UserStorage {\n return initializeUserStorage(\n [{ address: props.address ?? MOCK_USER_STORAGE_ACCOUNT }],\n props.triggersEnabled ?? true,\n false,\n );\n}\n"]}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/user-storage/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './user-storage';\n"]}
@@ -1,2 +0,0 @@
1
- export type * from "./user-storage.cjs";
2
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/user-storage/index.ts"],"names":[],"mappings":"AAAA,wCAAoC"}
@@ -1,2 +0,0 @@
1
- export type * from "./user-storage.mjs";
2
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/user-storage/index.ts"],"names":[],"mappings":"AAAA,wCAAoC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/user-storage/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './user-storage';\n"]}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=user-storage.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-storage.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/user-storage/user-storage.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n USER_STORAGE_VERSION_KEY,\n USER_STORAGE_VERSION,\n} from '../../constants/constants';\nimport type {\n SUPPORTED_CHAINS,\n TRIGGER_TYPES,\n} from '../../constants/notification-schema';\n\nexport type UserStorage = {\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 [address: string]: {\n [chain in (typeof SUPPORTED_CHAINS)[number]]: {\n [uuid: string]: {\n /** Trigger Kind 'k' */\n k: TRIGGER_TYPES;\n /**\n * Trigger Enabled 'e'\n * This is mostly an 'acknowledgement' to determine if a trigger has been made\n * For example if we fail to create a trigger, we can set to false & retry (on re-log in, or elsewhere)\n *\n * Most of the time this is 'true', as triggers when deleted are also removed from User Storage\n */\n e: boolean;\n };\n };\n };\n};\n"]}
@@ -1,26 +0,0 @@
1
- import type { USER_STORAGE_VERSION_KEY, USER_STORAGE_VERSION } from "../../constants/constants.cjs";
2
- import type { SUPPORTED_CHAINS, TRIGGER_TYPES } from "../../constants/notification-schema.cjs";
3
- export type UserStorage = {
4
- /**
5
- * The Version 'v' of the User Storage.
6
- * NOTE - will allow us to support upgrade/downgrades in the future
7
- */
8
- [USER_STORAGE_VERSION_KEY]: typeof USER_STORAGE_VERSION;
9
- [address: string]: {
10
- [chain in (typeof SUPPORTED_CHAINS)[number]]: {
11
- [uuid: string]: {
12
- /** Trigger Kind 'k' */
13
- k: TRIGGER_TYPES;
14
- /**
15
- * Trigger Enabled 'e'
16
- * This is mostly an 'acknowledgement' to determine if a trigger has been made
17
- * For example if we fail to create a trigger, we can set to false & retry (on re-log in, or elsewhere)
18
- *
19
- * Most of the time this is 'true', as triggers when deleted are also removed from User Storage
20
- */
21
- e: boolean;
22
- };
23
- };
24
- };
25
- };
26
- //# sourceMappingURL=user-storage.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-storage.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/user-storage/user-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACrB,sCAAkC;AACnC,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACd,gDAA4C;AAE7C,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,CAAC,wBAAwB,CAAC,EAAE,OAAO,oBAAoB,CAAC;IACxD,CAAC,OAAO,EAAE,MAAM,GAAG;SAChB,KAAK,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,GAAG;YAC5C,CAAC,IAAI,EAAE,MAAM,GAAG;gBACd,uBAAuB;gBACvB,CAAC,EAAE,aAAa,CAAC;gBACjB;;;;;;mBAMG;gBACH,CAAC,EAAE,OAAO,CAAC;aACZ,CAAC;SACH;KACF,CAAC;CACH,CAAC"}
@@ -1,26 +0,0 @@
1
- import type { USER_STORAGE_VERSION_KEY, USER_STORAGE_VERSION } from "../../constants/constants.mjs";
2
- import type { SUPPORTED_CHAINS, TRIGGER_TYPES } from "../../constants/notification-schema.mjs";
3
- export type UserStorage = {
4
- /**
5
- * The Version 'v' of the User Storage.
6
- * NOTE - will allow us to support upgrade/downgrades in the future
7
- */
8
- [USER_STORAGE_VERSION_KEY]: typeof USER_STORAGE_VERSION;
9
- [address: string]: {
10
- [chain in (typeof SUPPORTED_CHAINS)[number]]: {
11
- [uuid: string]: {
12
- /** Trigger Kind 'k' */
13
- k: TRIGGER_TYPES;
14
- /**
15
- * Trigger Enabled 'e'
16
- * This is mostly an 'acknowledgement' to determine if a trigger has been made
17
- * For example if we fail to create a trigger, we can set to false & retry (on re-log in, or elsewhere)
18
- *
19
- * Most of the time this is 'true', as triggers when deleted are also removed from User Storage
20
- */
21
- e: boolean;
22
- };
23
- };
24
- };
25
- };
26
- //# sourceMappingURL=user-storage.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-storage.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/user-storage/user-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACrB,sCAAkC;AACnC,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACd,gDAA4C;AAE7C,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,CAAC,wBAAwB,CAAC,EAAE,OAAO,oBAAoB,CAAC;IACxD,CAAC,OAAO,EAAE,MAAM,GAAG;SAChB,KAAK,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,GAAG;YAC5C,CAAC,IAAI,EAAE,MAAM,GAAG;gBACd,uBAAuB;gBACvB,CAAC,EAAE,aAAa,CAAC;gBACjB;;;;;;mBAMG;gBACH,CAAC,EAAE,OAAO,CAAC;aACZ,CAAC;SACH;KACF,CAAC;CACH,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=user-storage.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-storage.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/user-storage/user-storage.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n USER_STORAGE_VERSION_KEY,\n USER_STORAGE_VERSION,\n} from '../../constants/constants';\nimport type {\n SUPPORTED_CHAINS,\n TRIGGER_TYPES,\n} from '../../constants/notification-schema';\n\nexport type UserStorage = {\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 [address: string]: {\n [chain in (typeof SUPPORTED_CHAINS)[number]]: {\n [uuid: string]: {\n /** Trigger Kind 'k' */\n k: TRIGGER_TYPES;\n /**\n * Trigger Enabled 'e'\n * This is mostly an 'acknowledgement' to determine if a trigger has been made\n * For example if we fail to create a trigger, we can set to false & retry (on re-log in, or elsewhere)\n *\n * Most of the time this is 'true', as triggers when deleted are also removed from User Storage\n */\n e: boolean;\n };\n };\n };\n};\n"]}