@metamask/profile-sync-controller 1.0.0 → 1.0.2

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 (88) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/dist/controllers/user-storage/UserStorageController.cjs +81 -15
  3. package/dist/controllers/user-storage/UserStorageController.cjs.map +1 -1
  4. package/dist/controllers/user-storage/UserStorageController.d.cts +27 -2
  5. package/dist/controllers/user-storage/UserStorageController.d.cts.map +1 -1
  6. package/dist/controllers/user-storage/UserStorageController.d.mts +27 -2
  7. package/dist/controllers/user-storage/UserStorageController.d.mts.map +1 -1
  8. package/dist/controllers/user-storage/UserStorageController.mjs +82 -16
  9. package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -1
  10. package/dist/controllers/user-storage/__fixtures__/mockAccounts.cjs +11 -0
  11. package/dist/controllers/user-storage/__fixtures__/mockAccounts.cjs.map +1 -1
  12. package/dist/controllers/user-storage/__fixtures__/mockAccounts.d.cts +1 -0
  13. package/dist/controllers/user-storage/__fixtures__/mockAccounts.d.cts.map +1 -1
  14. package/dist/controllers/user-storage/__fixtures__/mockAccounts.d.mts +1 -0
  15. package/dist/controllers/user-storage/__fixtures__/mockAccounts.d.mts.map +1 -1
  16. package/dist/controllers/user-storage/__fixtures__/mockAccounts.mjs +11 -0
  17. package/dist/controllers/user-storage/__fixtures__/mockAccounts.mjs.map +1 -1
  18. package/dist/controllers/user-storage/__fixtures__/mockResponses.cjs +15 -7
  19. package/dist/controllers/user-storage/__fixtures__/mockResponses.cjs.map +1 -1
  20. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.cts +5 -0
  21. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.cts.map +1 -1
  22. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.mts +5 -0
  23. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.mts.map +1 -1
  24. package/dist/controllers/user-storage/__fixtures__/mockResponses.mjs +14 -7
  25. package/dist/controllers/user-storage/__fixtures__/mockResponses.mjs.map +1 -1
  26. package/dist/controllers/user-storage/__fixtures__/mockServices.cjs +18 -7
  27. package/dist/controllers/user-storage/__fixtures__/mockServices.cjs.map +1 -1
  28. package/dist/controllers/user-storage/__fixtures__/mockServices.d.cts +2 -1
  29. package/dist/controllers/user-storage/__fixtures__/mockServices.d.cts.map +1 -1
  30. package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts +2 -1
  31. package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts.map +1 -1
  32. package/dist/controllers/user-storage/__fixtures__/mockServices.mjs +17 -7
  33. package/dist/controllers/user-storage/__fixtures__/mockServices.mjs.map +1 -1
  34. package/dist/controllers/user-storage/index.cjs +1 -0
  35. package/dist/controllers/user-storage/index.cjs.map +1 -1
  36. package/dist/controllers/user-storage/index.d.cts +1 -0
  37. package/dist/controllers/user-storage/index.d.cts.map +1 -1
  38. package/dist/controllers/user-storage/index.d.mts +1 -0
  39. package/dist/controllers/user-storage/index.d.mts.map +1 -1
  40. package/dist/controllers/user-storage/index.mjs +1 -0
  41. package/dist/controllers/user-storage/index.mjs.map +1 -1
  42. package/dist/controllers/user-storage/network-syncing/services.cjs +2 -1
  43. package/dist/controllers/user-storage/network-syncing/services.cjs.map +1 -1
  44. package/dist/controllers/user-storage/network-syncing/services.d.cts.map +1 -1
  45. package/dist/controllers/user-storage/network-syncing/services.d.mts.map +1 -1
  46. package/dist/controllers/user-storage/network-syncing/services.mjs +2 -1
  47. package/dist/controllers/user-storage/network-syncing/services.mjs.map +1 -1
  48. package/dist/controllers/user-storage/services.cjs +32 -1
  49. package/dist/controllers/user-storage/services.cjs.map +1 -1
  50. package/dist/controllers/user-storage/services.d.cts +10 -2
  51. package/dist/controllers/user-storage/services.d.cts.map +1 -1
  52. package/dist/controllers/user-storage/services.d.mts +10 -2
  53. package/dist/controllers/user-storage/services.d.mts.map +1 -1
  54. package/dist/controllers/user-storage/services.mjs +30 -0
  55. package/dist/controllers/user-storage/services.mjs.map +1 -1
  56. package/dist/sdk/__fixtures__/mock-userstorage.cjs +15 -3
  57. package/dist/sdk/__fixtures__/mock-userstorage.cjs.map +1 -1
  58. package/dist/sdk/__fixtures__/mock-userstorage.d.cts +1 -0
  59. package/dist/sdk/__fixtures__/mock-userstorage.d.cts.map +1 -1
  60. package/dist/sdk/__fixtures__/mock-userstorage.d.mts +1 -0
  61. package/dist/sdk/__fixtures__/mock-userstorage.d.mts.map +1 -1
  62. package/dist/sdk/__fixtures__/mock-userstorage.mjs +13 -2
  63. package/dist/sdk/__fixtures__/mock-userstorage.mjs.map +1 -1
  64. package/dist/sdk/index.cjs +1 -0
  65. package/dist/sdk/index.cjs.map +1 -1
  66. package/dist/sdk/index.d.cts +1 -0
  67. package/dist/sdk/index.d.cts.map +1 -1
  68. package/dist/sdk/index.d.mts +1 -0
  69. package/dist/sdk/index.d.mts.map +1 -1
  70. package/dist/sdk/index.mjs +1 -0
  71. package/dist/sdk/index.mjs.map +1 -1
  72. package/dist/sdk/user-storage.cjs +35 -1
  73. package/dist/sdk/user-storage.cjs.map +1 -1
  74. package/dist/sdk/user-storage.d.cts +3 -2
  75. package/dist/sdk/user-storage.d.cts.map +1 -1
  76. package/dist/sdk/user-storage.d.mts +3 -2
  77. package/dist/sdk/user-storage.d.mts.map +1 -1
  78. package/dist/sdk/user-storage.mjs +35 -1
  79. package/dist/sdk/user-storage.mjs.map +1 -1
  80. package/dist/shared/storage-schema.cjs +9 -4
  81. package/dist/shared/storage-schema.cjs.map +1 -1
  82. package/dist/shared/storage-schema.d.cts +12 -10
  83. package/dist/shared/storage-schema.d.cts.map +1 -1
  84. package/dist/shared/storage-schema.d.mts +12 -10
  85. package/dist/shared/storage-schema.d.mts.map +1 -1
  86. package/dist/shared/storage-schema.mjs +8 -3
  87. package/dist/shared/storage-schema.mjs.map +1 -1
  88. package/package.json +1 -1
@@ -82,6 +82,7 @@ export declare const MOCK_INTERNAL_ACCOUNTS: {
82
82
  export declare const MOCK_USER_STORAGE_ACCOUNTS: {
83
83
  SAME_AS_INTERNAL_ALL: import("../accounts/user-storage.cjs").UserStorageAccount[];
84
84
  ONE: import("../accounts/user-storage.cjs").UserStorageAccount[];
85
+ TWO_DEFAULT_NAMES_WITH_ONE_BOGUS: import("../accounts/user-storage.cjs").UserStorageAccount[];
85
86
  ONE_DEFAULT_NAME: import("../accounts/user-storage.cjs").UserStorageAccount[];
86
87
  ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: import("../accounts/user-storage.cjs").UserStorageAccount[];
87
88
  ONE_CUSTOM_NAME_WITH_LAST_UPDATED: import("../accounts/user-storage.cjs").UserStorageAccount[];
@@ -1 +1 @@
1
- {"version":3,"file":"mockAccounts.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAwB,8BAA8B;AAC7E,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAe5D;;;GAGG;AACH,eAAO,MAAM,+BAA+B,mbAGzC,CAAC;AAEJ,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyHlC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;CA6BtC,CAAC"}
1
+ {"version":3,"file":"mockAccounts.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAwB,8BAA8B;AAC7E,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAe5D;;;GAGG;AACH,eAAO,MAAM,+BAA+B,mbAGzC,CAAC;AAEJ,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyHlC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;CAyCtC,CAAC"}
@@ -82,6 +82,7 @@ export declare const MOCK_INTERNAL_ACCOUNTS: {
82
82
  export declare const MOCK_USER_STORAGE_ACCOUNTS: {
83
83
  SAME_AS_INTERNAL_ALL: import("../accounts/user-storage.mjs").UserStorageAccount[];
84
84
  ONE: import("../accounts/user-storage.mjs").UserStorageAccount[];
85
+ TWO_DEFAULT_NAMES_WITH_ONE_BOGUS: import("../accounts/user-storage.mjs").UserStorageAccount[];
85
86
  ONE_DEFAULT_NAME: import("../accounts/user-storage.mjs").UserStorageAccount[];
86
87
  ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: import("../accounts/user-storage.mjs").UserStorageAccount[];
87
88
  ONE_CUSTOM_NAME_WITH_LAST_UPDATED: import("../accounts/user-storage.mjs").UserStorageAccount[];
@@ -1 +1 @@
1
- {"version":3,"file":"mockAccounts.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAwB,8BAA8B;AAC7E,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAe5D;;;GAGG;AACH,eAAO,MAAM,+BAA+B,mbAGzC,CAAC;AAEJ,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyHlC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;CA6BtC,CAAC"}
1
+ {"version":3,"file":"mockAccounts.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAwB,8BAA8B;AAC7E,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAe5D;;;GAGG;AACH,eAAO,MAAM,+BAA+B,mbAGzC,CAAC;AAEJ,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyHlC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;CAyCtC,CAAC"}
@@ -140,6 +140,17 @@ export const MOCK_INTERNAL_ACCOUNTS = {
140
140
  export const MOCK_USER_STORAGE_ACCOUNTS = {
141
141
  SAME_AS_INTERNAL_ALL: mapInternalAccountsListToUserStorageAccountsList(MOCK_INTERNAL_ACCOUNTS.ALL),
142
142
  ONE: mapInternalAccountsListToUserStorageAccountsList(MOCK_INTERNAL_ACCOUNTS.ONE),
143
+ TWO_DEFAULT_NAMES_WITH_ONE_BOGUS: mapInternalAccountsListToUserStorageAccountsList([
144
+ ...MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME,
145
+ {
146
+ ...MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME[0],
147
+ address: '0x000000',
148
+ metadata: {
149
+ name: `${getMockRandomDefaultAccountName()} 1`,
150
+ nameLastUpdatedAt: 2,
151
+ },
152
+ },
153
+ ]),
143
154
  ONE_DEFAULT_NAME: mapInternalAccountsListToUserStorageAccountsList(MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME),
144
155
  ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: mapInternalAccountsListToUserStorageAccountsList([
145
156
  {
@@ -1 +1 @@
1
- {"version":3,"file":"mockAccounts.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockAccounts.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAE5D,OAAO,EAAE,+BAA+B,EAAE,kCAA8B;AACxE,OAAO,EAAE,sCAAsC,EAAE,qCAAiC;AAElF;;;;;GAKG;AACH,MAAM,gDAAgD,GAAG,CACvD,gBAAmC,EACnC,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;AAElE;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,EAAE,CAClD,+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gD,CACpE,sBAAsB,CAAC,GAAwB,CAChD;IACD,GAAG,EAAE,gDAAgD,CACnD,sBAAsB,CAAC,GAAwB,CAChD;IACD,gBAAgB,EAAE,gDAAgD,CAChE,sBAAsB,CAAC,gBAAqC,CAC7D;IACD,oCAAoC,EAClC,gDAAgD,CAAC;QAC/C;YACE,GAAG,sBAAsB,CAAC,oCAAoC,CAAC,CAAC,CAAC;YACjE,QAAQ,EAAE;gBACR,IAAI,EAAE,4DAA4D;aACnE;SACF;KACmB,CAAC;IACzB,iCAAiC,EAC/B,gDAAgD,CAAC;QAC/C;YACE,GAAG,sBAAsB,CAAC,oCAAoC,CAAC,CAAC,CAAC;YACjE,QAAQ,EAAE;gBACR,IAAI,EAAE,yDAAyD;gBAC/D,iBAAiB,EAAE,CAAC;aACrB;SACF;KACmB,CAAC;CAC1B,CAAC","sourcesContent":["import { EthAccountType, type InternalAccount } from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\n\nimport { LOCALIZED_DEFAULT_ACCOUNT_NAMES } from '../accounts/constants';\nimport { mapInternalAccountToUserStorageAccount } from '../accounts/user-storage';\n\n/**\n * Map an array of internal accounts to an array of user storage accounts\n * Only used for testing purposes\n * @param internalAccounts - An array of internal accounts\n * @returns An array of user storage accounts\n */\nconst mapInternalAccountsListToUserStorageAccountsList = (\n internalAccounts: InternalAccount[],\n) => internalAccounts.map(mapInternalAccountToUserStorageAccount);\n\n/**\n * Get a random default account name from the list of localized default account names\n * @returns A random default account name\n */\nexport const getMockRandomDefaultAccountName = () =>\n LOCALIZED_DEFAULT_ACCOUNT_NAMES[\n Math.floor(Math.random() * LOCALIZED_DEFAULT_ACCOUNT_NAMES.length)\n ];\n\nexport const MOCK_INTERNAL_ACCOUNTS = {\n EMPTY: [],\n ONE: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'test',\n nameLastUpdatedAt: 1,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ONE_DEFAULT_NAME: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: `${getMockRandomDefaultAccountName()} 1`,\n nameLastUpdatedAt: 1,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Internal account custom name without nameLastUpdatedAt',\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ONE_CUSTOM_NAME_WITH_LAST_UPDATED: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Internal account custom name with nameLastUpdatedAt',\n nameLastUpdatedAt: 1,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ONE_CUSTOM_NAME_WITH_LAST_UPDATED_MOST_RECENT: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Internal account custom name with nameLastUpdatedAt',\n nameLastUpdatedAt: 9999,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ALL: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'test',\n nameLastUpdatedAt: 1,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n {\n address: '0x456',\n id: '2',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Account 2',\n nameLastUpdatedAt: 2,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n {\n address: '0x789',\n id: '3',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Účet 2',\n nameLastUpdatedAt: 3,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n {\n address: '0xabc',\n id: '4',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'My Account 4',\n nameLastUpdatedAt: 4,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n};\n\nexport const MOCK_USER_STORAGE_ACCOUNTS = {\n SAME_AS_INTERNAL_ALL: mapInternalAccountsListToUserStorageAccountsList(\n MOCK_INTERNAL_ACCOUNTS.ALL as InternalAccount[],\n ),\n ONE: mapInternalAccountsListToUserStorageAccountsList(\n MOCK_INTERNAL_ACCOUNTS.ONE as InternalAccount[],\n ),\n ONE_DEFAULT_NAME: mapInternalAccountsListToUserStorageAccountsList(\n MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME as InternalAccount[],\n ),\n ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED:\n mapInternalAccountsListToUserStorageAccountsList([\n {\n ...MOCK_INTERNAL_ACCOUNTS.ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED[0],\n metadata: {\n name: 'User storage account custom name without nameLastUpdatedAt',\n },\n },\n ] as InternalAccount[]),\n ONE_CUSTOM_NAME_WITH_LAST_UPDATED:\n mapInternalAccountsListToUserStorageAccountsList([\n {\n ...MOCK_INTERNAL_ACCOUNTS.ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED[0],\n metadata: {\n name: 'User storage account custom name with nameLastUpdatedAt',\n nameLastUpdatedAt: 3,\n },\n },\n ] as InternalAccount[]),\n};\n"]}
1
+ {"version":3,"file":"mockAccounts.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockAccounts.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAE5D,OAAO,EAAE,+BAA+B,EAAE,kCAA8B;AACxE,OAAO,EAAE,sCAAsC,EAAE,qCAAiC;AAElF;;;;;GAKG;AACH,MAAM,gDAAgD,GAAG,CACvD,gBAAmC,EACnC,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;AAElE;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,EAAE,CAClD,+BAA+B,CAC7B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,+B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AAsB,CAAC,GAAwB,CAChD;IACD,gCAAgC,EAC9B,gDAAgD,CAAC;QAC/C,GAAG,sBAAsB,CAAC,gBAAgB;QAC1C;YACE,GAAG,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,CAAC;YAC7C,OAAO,EAAE,UAAU;YACnB,QAAQ,EAAE;gBACR,IAAI,EAAE,GAAG,+BAA+B,EAAE,IAAI;gBAC9C,iBAAiB,EAAE,CAAC;aACrB;SACF;KACmB,CAAC;IACzB,gBAAgB,EAAE,gDAAgD,CAChE,sBAAsB,CAAC,gBAAqC,CAC7D;IACD,oCAAoC,EAClC,gDAAgD,CAAC;QAC/C;YACE,GAAG,sBAAsB,CAAC,oCAAoC,CAAC,CAAC,CAAC;YACjE,QAAQ,EAAE;gBACR,IAAI,EAAE,4DAA4D;aACnE;SACF;KACmB,CAAC;IACzB,iCAAiC,EAC/B,gDAAgD,CAAC;QAC/C;YACE,GAAG,sBAAsB,CAAC,oCAAoC,CAAC,CAAC,CAAC;YACjE,QAAQ,EAAE;gBACR,IAAI,EAAE,yDAAyD;gBAC/D,iBAAiB,EAAE,CAAC;aACrB;SACF;KACmB,CAAC;CAC1B,CAAC","sourcesContent":["import { EthAccountType, type InternalAccount } from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\n\nimport { LOCALIZED_DEFAULT_ACCOUNT_NAMES } from '../accounts/constants';\nimport { mapInternalAccountToUserStorageAccount } from '../accounts/user-storage';\n\n/**\n * Map an array of internal accounts to an array of user storage accounts\n * Only used for testing purposes\n * @param internalAccounts - An array of internal accounts\n * @returns An array of user storage accounts\n */\nconst mapInternalAccountsListToUserStorageAccountsList = (\n internalAccounts: InternalAccount[],\n) => internalAccounts.map(mapInternalAccountToUserStorageAccount);\n\n/**\n * Get a random default account name from the list of localized default account names\n * @returns A random default account name\n */\nexport const getMockRandomDefaultAccountName = () =>\n LOCALIZED_DEFAULT_ACCOUNT_NAMES[\n Math.floor(Math.random() * LOCALIZED_DEFAULT_ACCOUNT_NAMES.length)\n ];\n\nexport const MOCK_INTERNAL_ACCOUNTS = {\n EMPTY: [],\n ONE: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'test',\n nameLastUpdatedAt: 1,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ONE_DEFAULT_NAME: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: `${getMockRandomDefaultAccountName()} 1`,\n nameLastUpdatedAt: 1,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Internal account custom name without nameLastUpdatedAt',\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ONE_CUSTOM_NAME_WITH_LAST_UPDATED: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Internal account custom name with nameLastUpdatedAt',\n nameLastUpdatedAt: 1,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ONE_CUSTOM_NAME_WITH_LAST_UPDATED_MOST_RECENT: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Internal account custom name with nameLastUpdatedAt',\n nameLastUpdatedAt: 9999,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ALL: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'test',\n nameLastUpdatedAt: 1,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n {\n address: '0x456',\n id: '2',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Account 2',\n nameLastUpdatedAt: 2,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n {\n address: '0x789',\n id: '3',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Účet 2',\n nameLastUpdatedAt: 3,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n {\n address: '0xabc',\n id: '4',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'My Account 4',\n nameLastUpdatedAt: 4,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n};\n\nexport const MOCK_USER_STORAGE_ACCOUNTS = {\n SAME_AS_INTERNAL_ALL: mapInternalAccountsListToUserStorageAccountsList(\n MOCK_INTERNAL_ACCOUNTS.ALL as InternalAccount[],\n ),\n ONE: mapInternalAccountsListToUserStorageAccountsList(\n MOCK_INTERNAL_ACCOUNTS.ONE as InternalAccount[],\n ),\n TWO_DEFAULT_NAMES_WITH_ONE_BOGUS:\n mapInternalAccountsListToUserStorageAccountsList([\n ...MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME,\n {\n ...MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME[0],\n address: '0x000000',\n metadata: {\n name: `${getMockRandomDefaultAccountName()} 1`,\n nameLastUpdatedAt: 2,\n },\n },\n ] as InternalAccount[]),\n ONE_DEFAULT_NAME: mapInternalAccountsListToUserStorageAccountsList(\n MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME as InternalAccount[],\n ),\n ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED:\n mapInternalAccountsListToUserStorageAccountsList([\n {\n ...MOCK_INTERNAL_ACCOUNTS.ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED[0],\n metadata: {\n name: 'User storage account custom name without nameLastUpdatedAt',\n },\n },\n ] as InternalAccount[]),\n ONE_CUSTOM_NAME_WITH_LAST_UPDATED:\n mapInternalAccountsListToUserStorageAccountsList([\n {\n ...MOCK_INTERNAL_ACCOUNTS.ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED[0],\n metadata: {\n name: 'User storage account custom name with nameLastUpdatedAt',\n nameLastUpdatedAt: 3,\n },\n },\n ] as InternalAccount[]),\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteMockUserStorageAllFeatureEntriesResponse = exports.deleteMockUserStorageResponse = exports.getMockUserStorageBatchPutResponse = exports.getMockUserStoragePutResponse = exports.getMockUserStorageAllFeatureEntriesResponse = exports.getMockUserStorageGetResponse = exports.createMockAllFeatureEntriesResponse = exports.createMockGetStorageResponse = exports.getMockUserStorageEndpoint = void 0;
3
+ exports.deleteMockUserStorageAllFeatureEntriesResponse = exports.deleteMockUserStorageResponse = exports.getMockUserStorageBatchDeleteResponse = exports.getMockUserStorageBatchPutResponse = exports.getMockUserStoragePutResponse = exports.getMockUserStorageAllFeatureEntriesResponse = exports.getMockUserStorageGetResponse = exports.createMockAllFeatureEntriesResponse = exports.createMockGetStorageResponse = exports.getMockUserStorageEndpoint = void 0;
4
4
  const storage_schema_1 = require("../../../shared/storage-schema.cjs");
5
5
  const services_1 = require("../services.cjs");
6
6
  const mockStorage_1 = require("./mockStorage.cjs");
@@ -43,7 +43,7 @@ exports.createMockAllFeatureEntriesResponse = createMockAllFeatureEntriesRespons
43
43
  * @param path - path of the GET Url
44
44
  * @returns mock GET API request. Can be used by e2e or unit mock servers
45
45
  */
46
- async function getMockUserStorageGetResponse(path = 'notifications.notification_settings') {
46
+ async function getMockUserStorageGetResponse(path = `${storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`) {
47
47
  return {
48
48
  url: (0, exports.getMockUserStorageEndpoint)(path),
49
49
  requestMethod: 'GET',
@@ -57,7 +57,7 @@ exports.getMockUserStorageGetResponse = getMockUserStorageGetResponse;
57
57
  * @param dataArr - data to encrypt
58
58
  * @returns mock GET ALL API request. Can be used by e2e or unit mock servers
59
59
  */
60
- async function getMockUserStorageAllFeatureEntriesResponse(path = 'notifications', dataArr) {
60
+ async function getMockUserStorageAllFeatureEntriesResponse(path = storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications, dataArr) {
61
61
  return {
62
62
  url: (0, exports.getMockUserStorageEndpoint)(path),
63
63
  requestMethod: 'GET',
@@ -65,7 +65,7 @@ async function getMockUserStorageAllFeatureEntriesResponse(path = 'notifications
65
65
  };
66
66
  }
67
67
  exports.getMockUserStorageAllFeatureEntriesResponse = getMockUserStorageAllFeatureEntriesResponse;
68
- const getMockUserStoragePutResponse = (path = 'notifications.notification_settings') => {
68
+ const getMockUserStoragePutResponse = (path = `${storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`) => {
69
69
  return {
70
70
  url: (0, exports.getMockUserStorageEndpoint)(path),
71
71
  requestMethod: 'PUT',
@@ -73,7 +73,7 @@ const getMockUserStoragePutResponse = (path = 'notifications.notification_settin
73
73
  };
74
74
  };
75
75
  exports.getMockUserStoragePutResponse = getMockUserStoragePutResponse;
76
- const getMockUserStorageBatchPutResponse = (path = 'notifications') => {
76
+ const getMockUserStorageBatchPutResponse = (path = storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications) => {
77
77
  return {
78
78
  url: (0, exports.getMockUserStorageEndpoint)(path),
79
79
  requestMethod: 'PUT',
@@ -81,7 +81,15 @@ const getMockUserStorageBatchPutResponse = (path = 'notifications') => {
81
81
  };
82
82
  };
83
83
  exports.getMockUserStorageBatchPutResponse = getMockUserStorageBatchPutResponse;
84
- const deleteMockUserStorageResponse = (path = 'notifications.notification_settings') => {
84
+ const getMockUserStorageBatchDeleteResponse = (path = 'notifications') => {
85
+ return {
86
+ url: (0, exports.getMockUserStorageEndpoint)(path),
87
+ requestMethod: 'PUT',
88
+ response: null,
89
+ };
90
+ };
91
+ exports.getMockUserStorageBatchDeleteResponse = getMockUserStorageBatchDeleteResponse;
92
+ const deleteMockUserStorageResponse = (path = `${storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`) => {
85
93
  return {
86
94
  url: (0, exports.getMockUserStorageEndpoint)(path),
87
95
  requestMethod: 'DELETE',
@@ -89,7 +97,7 @@ const deleteMockUserStorageResponse = (path = 'notifications.notification_settin
89
97
  };
90
98
  };
91
99
  exports.deleteMockUserStorageResponse = deleteMockUserStorageResponse;
92
- const deleteMockUserStorageAllFeatureEntriesResponse = (path = 'notifications') => {
100
+ const deleteMockUserStorageAllFeatureEntriesResponse = (path = storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications) => {
93
101
  return {
94
102
  url: (0, exports.getMockUserStorageEndpoint)(path),
95
103
  requestMethod: 'DELETE',
@@ -1 +1 @@
1
- {"version":3,"file":"mockResponses.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockResponses.ts"],"names":[],"mappings":";;;AAIA,uEAAiE;AAKjE,8CAAoD;AACpD,mDAIuB;AAQhB,MAAM,0BAA0B,GAAG,CACxC,IAAuE,EACvE,EAAE;IACF,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QAChC,OAAO,GAAG,gCAAqB,IAAI,IAAI,EAAE,CAAC;KAC3C;IAED,OAAO,GAAG,gCAAqB,IAAI,IAAA,gCAAe,EAChD,IAAwC,EACxC,8BAAgB,CACjB,EAAE,CAAC;AACN,CAAC,CAAC;AAXW,QAAA,0BAA0B,8BAWrC;AAEF;;;;GAIG;AACI,KAAK,UAAU,4BAA4B,CAChD,IAAa;IAEb,OAAO;QACL,SAAS,EAAE,YAAY;QACvB,IAAI,EAAE,MAAM,IAAA,yCAA2B,EAAC,IAAI,CAAC;KAC9C,CAAC;AACJ,CAAC;AAPD,oEAOC;AAED;;;;GAIG;AACI,KAAK,UAAU,mCAAmC,CACvD,UAAoB,CAAC,+BAAiB,CAAC;IAEvC,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,OAAO,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC;QAC3B,MAAM,aAAa,GAAG,MAAM,IAAA,yCAA2B,EAAC,CAAC,CAAC,CAAC;QAC3D,OAAO;YACL,SAAS,EAAE,YAAY;YACvB,IAAI,EAAE,aAAa;SACpB,CAAC;IACJ,CA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AG,CAC5D,OAAuC,eAAe,EACtD,EAAE;IACF,OAAO;QACL,GAAG,EAAE,IAAA,kCAA0B,EAAC,IAAI,CAAC;QACrC,aAAa,EAAE,QAAQ;QACvB,QAAQ,EAAE,IAAI;KACQ,CAAC;AAC3B,CAAC,CAAC;AARW,QAAA,8CAA8C,kDAQzD","sourcesContent":["import type {\n UserStoragePathWithFeatureAndKey,\n UserStoragePathWithFeatureOnly,\n} from '../../../shared/storage-schema';\nimport { createEntryPath } from '../../../shared/storage-schema';\nimport type {\n GetUserStorageAllFeatureEntriesResponse,\n GetUserStorageResponse,\n} from '../services';\nimport { USER_STORAGE_ENDPOINT } from '../services';\nimport {\n MOCK_ENCRYPTED_STORAGE_DATA,\n MOCK_STORAGE_DATA,\n MOCK_STORAGE_KEY,\n} from './mockStorage';\n\ntype MockResponse = {\n url: string;\n requestMethod: 'GET' | 'POST' | 'PUT' | 'DELETE';\n response: unknown;\n};\n\nexport const getMockUserStorageEndpoint = (\n path: UserStoragePathWithFeatureAndKey | UserStoragePathWithFeatureOnly,\n) => {\n if (path.split('.').length === 1) {\n return `${USER_STORAGE_ENDPOINT}/${path}`;\n }\n\n return `${USER_STORAGE_ENDPOINT}/${createEntryPath(\n path as UserStoragePathWithFeatureAndKey,\n MOCK_STORAGE_KEY,\n )}`;\n};\n\n/**\n * Creates a mock GET user-storage response\n * @param data - data to encrypt\n * @returns a realistic GET Response Body\n */\nexport async function createMockGetStorageResponse(\n data?: string,\n): Promise<GetUserStorageResponse> {\n return {\n HashedKey: 'HASHED_KEY',\n Data: await MOCK_ENCRYPTED_STORAGE_DATA(data),\n };\n}\n\n/**\n * Creates a mock GET ALL user-storage response\n * @param dataArr - array of data to encrypt\n * @returns a realistic GET ALL Response Body\n */\nexport async function createMockAllFeatureEntriesResponse(\n dataArr: string[] = [MOCK_STORAGE_DATA],\n): Promise<GetUserStorageAllFeatureEntriesResponse> {\n return await Promise.all(\n dataArr.map(async function (d) {\n const encryptedData = await MOCK_ENCRYPTED_STORAGE_DATA(d);\n return {\n HashedKey: 'HASHED_KEY',\n Data: encryptedData,\n };\n }),\n );\n}\n\n/**\n * Creates a mock user-storage api GET request\n * @param path - path of the GET Url\n * @returns mock GET API request. Can be used by e2e or unit mock servers\n */\nexport async function getMockUserStorageGetResponse(\n path: UserStoragePathWithFeatureAndKey = 'notifications.notification_settings',\n) {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'GET',\n response: await createMockGetStorageResponse(),\n } satisfies MockResponse;\n}\n\n/**\n * Creates a mock user-storage api GET ALL request\n * @param path - path of the GET url\n * @param dataArr - data to encrypt\n * @returns mock GET ALL API request. Can be used by e2e or unit mock servers\n */\nexport async function getMockUserStorageAllFeatureEntriesResponse(\n path: UserStoragePathWithFeatureOnly = 'notifications',\n dataArr?: string[],\n) {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'GET',\n response: await createMockAllFeatureEntriesResponse(dataArr),\n } satisfies MockResponse;\n}\n\nexport const getMockUserStoragePutResponse = (\n path: UserStoragePathWithFeatureAndKey = 'notifications.notification_settings',\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const getMockUserStorageBatchPutResponse = (\n path: UserStoragePathWithFeatureOnly = 'notifications',\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const deleteMockUserStorageResponse = (\n path: UserStoragePathWithFeatureAndKey = 'notifications.notification_settings',\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'DELETE',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const deleteMockUserStorageAllFeatureEntriesResponse = (\n path: UserStoragePathWithFeatureOnly = 'notifications',\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'DELETE',\n response: null,\n } satisfies MockResponse;\n};\n"]}
1
+ {"version":3,"file":"mockResponses.cjs","sourceRoot":"","sources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AEK,MAAM,8CAA8C,GAAG,CAC5D,OAAuC,2CAA0B,CAAC,aAAa,EAC/E,EAAE;IACF,OAAO;QACL,GAAG,EAAE,IAAA,kCAA0B,EAAC,IAAI,CAAC;QACrC,aAAa,EAAE,QAAQ;QACvB,QAAQ,EAAE,IAAI;KACQ,CAAC;AAC3B,CAAC,CAAC;AARW,QAAA,8CAA8C,kDAQzD","sourcesContent":["import type {\n UserStoragePathWithFeatureAndKey,\n UserStoragePathWithFeatureOnly,\n} from '../../../shared/storage-schema';\nimport {\n createEntryPath,\n USER_STORAGE_FEATURE_NAMES,\n} from '../../../shared/storage-schema';\nimport type {\n GetUserStorageAllFeatureEntriesResponse,\n GetUserStorageResponse,\n} from '../services';\nimport { USER_STORAGE_ENDPOINT } from '../services';\nimport {\n MOCK_ENCRYPTED_STORAGE_DATA,\n MOCK_STORAGE_DATA,\n MOCK_STORAGE_KEY,\n} from './mockStorage';\n\ntype MockResponse = {\n url: string;\n requestMethod: 'GET' | 'POST' | 'PUT' | 'DELETE';\n response: unknown;\n};\n\nexport const getMockUserStorageEndpoint = (\n path: UserStoragePathWithFeatureAndKey | UserStoragePathWithFeatureOnly,\n) => {\n if (path.split('.').length === 1) {\n return `${USER_STORAGE_ENDPOINT}/${path}`;\n }\n\n return `${USER_STORAGE_ENDPOINT}/${createEntryPath(\n path as UserStoragePathWithFeatureAndKey,\n MOCK_STORAGE_KEY,\n )}`;\n};\n\n/**\n * Creates a mock GET user-storage response\n * @param data - data to encrypt\n * @returns a realistic GET Response Body\n */\nexport async function createMockGetStorageResponse(\n data?: string,\n): Promise<GetUserStorageResponse> {\n return {\n HashedKey: 'HASHED_KEY',\n Data: await MOCK_ENCRYPTED_STORAGE_DATA(data),\n };\n}\n\n/**\n * Creates a mock GET ALL user-storage response\n * @param dataArr - array of data to encrypt\n * @returns a realistic GET ALL Response Body\n */\nexport async function createMockAllFeatureEntriesResponse(\n dataArr: string[] = [MOCK_STORAGE_DATA],\n): Promise<GetUserStorageAllFeatureEntriesResponse> {\n return await Promise.all(\n dataArr.map(async function (d) {\n const encryptedData = await MOCK_ENCRYPTED_STORAGE_DATA(d);\n return {\n HashedKey: 'HASHED_KEY',\n Data: encryptedData,\n };\n }),\n );\n}\n\n/**\n * Creates a mock user-storage api GET request\n * @param path - path of the GET Url\n * @returns mock GET API request. Can be used by e2e or unit mock servers\n */\nexport async function getMockUserStorageGetResponse(\n path: UserStoragePathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n) {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'GET',\n response: await createMockGetStorageResponse(),\n } satisfies MockResponse;\n}\n\n/**\n * Creates a mock user-storage api GET ALL request\n * @param path - path of the GET url\n * @param dataArr - data to encrypt\n * @returns mock GET ALL API request. Can be used by e2e or unit mock servers\n */\nexport async function getMockUserStorageAllFeatureEntriesResponse(\n path: UserStoragePathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n dataArr?: string[],\n) {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'GET',\n response: await createMockAllFeatureEntriesResponse(dataArr),\n } satisfies MockResponse;\n}\n\nexport const getMockUserStoragePutResponse = (\n path: UserStoragePathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const getMockUserStorageBatchPutResponse = (\n path: UserStoragePathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const getMockUserStorageBatchDeleteResponse = (\n path: UserStoragePathWithFeatureOnly = 'notifications',\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const deleteMockUserStorageResponse = (\n path: UserStoragePathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'DELETE',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const deleteMockUserStorageAllFeatureEntriesResponse = (\n path: UserStoragePathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'DELETE',\n response: null,\n } satisfies MockResponse;\n};\n"]}
@@ -44,6 +44,11 @@ export declare const getMockUserStorageBatchPutResponse: (path?: UserStoragePath
44
44
  requestMethod: "PUT";
45
45
  response: null;
46
46
  };
47
+ export declare const getMockUserStorageBatchDeleteResponse: (path?: UserStoragePathWithFeatureOnly) => {
48
+ url: string;
49
+ requestMethod: "PUT";
50
+ response: null;
51
+ };
47
52
  export declare const deleteMockUserStorageResponse: (path?: UserStoragePathWithFeatureAndKey) => {
48
53
  url: string;
49
54
  requestMethod: "DELETE";
@@ -1 +1 @@
1
- {"version":3,"file":"mockResponses.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockResponses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,8BAA8B,EAC/B,2CAAuC;AAExC,OAAO,KAAK,EACV,uCAAuC,EACvC,sBAAsB,EACvB,wBAAoB;AAcrB,eAAO,MAAM,0BAA0B,SAC/B,gCAAgC,GAAG,8BAA8B,WAUxE,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,sBAAsB,CAAC,CAKjC;AAED;;;;GAIG;AACH,wBAAsB,mCAAmC,CACvD,OAAO,GAAE,MAAM,EAAwB,GACtC,OAAO,CAAC,uCAAuC,CAAC,CAUlD;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,GAAE,gCAAwE;;;;GAO/E;AAED;;;;;GAKG;AACH,wBAAsB,2CAA2C,CAC/D,IAAI,GAAE,8BAAgD,EACtD,OAAO,CAAC,EAAE,MAAM,EAAE;;;;GAOnB;AAED,eAAO,MAAM,6BAA6B,UAClC,gCAAgC;;;;CAOvC,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACvC,8BAA8B;;;;CAOrC,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC;;;;CAOvC,CAAC;AAEF,eAAO,MAAM,8CAA8C,UACnD,8BAA8B;;;;CAOrC,CAAC"}
1
+ {"version":3,"file":"mockResponses.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockResponses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,8BAA8B,EAC/B,2CAAuC;AAKxC,OAAO,KAAK,EACV,uCAAuC,EACvC,sBAAsB,EACvB,wBAAoB;AAcrB,eAAO,MAAM,0BAA0B,SAC/B,gCAAgC,GAAG,8BAA8B,WAUxE,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,sBAAsB,CAAC,CAKjC;AAED;;;;GAIG;AACH,wBAAsB,mCAAmC,CACvD,OAAO,GAAE,MAAM,EAAwB,GACtC,OAAO,CAAC,uCAAuC,CAAC,CAUlD;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,GAAE,gCAAsG;;;;GAO7G;AAED;;;;;GAKG;AACH,wBAAsB,2CAA2C,CAC/D,IAAI,GAAE,8BAAyE,EAC/E,OAAO,CAAC,EAAE,MAAM,EAAE;;;;GAOnB;AAED,eAAO,MAAM,6BAA6B,UAClC,gCAAgC;;;;CAOvC,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACvC,8BAA8B;;;;CAOrC,CAAC;AAEF,eAAO,MAAM,qCAAqC,UAC1C,8BAA8B;;;;CAOrC,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC;;;;CAOvC,CAAC;AAEF,eAAO,MAAM,8CAA8C,UACnD,8BAA8B;;;;CAOrC,CAAC"}
@@ -44,6 +44,11 @@ export declare const getMockUserStorageBatchPutResponse: (path?: UserStoragePath
44
44
  requestMethod: "PUT";
45
45
  response: null;
46
46
  };
47
+ export declare const getMockUserStorageBatchDeleteResponse: (path?: UserStoragePathWithFeatureOnly) => {
48
+ url: string;
49
+ requestMethod: "PUT";
50
+ response: null;
51
+ };
47
52
  export declare const deleteMockUserStorageResponse: (path?: UserStoragePathWithFeatureAndKey) => {
48
53
  url: string;
49
54
  requestMethod: "DELETE";
@@ -1 +1 @@
1
- {"version":3,"file":"mockResponses.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockResponses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,8BAA8B,EAC/B,2CAAuC;AAExC,OAAO,KAAK,EACV,uCAAuC,EACvC,sBAAsB,EACvB,wBAAoB;AAcrB,eAAO,MAAM,0BAA0B,SAC/B,gCAAgC,GAAG,8BAA8B,WAUxE,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,sBAAsB,CAAC,CAKjC;AAED;;;;GAIG;AACH,wBAAsB,mCAAmC,CACvD,OAAO,GAAE,MAAM,EAAwB,GACtC,OAAO,CAAC,uCAAuC,CAAC,CAUlD;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,GAAE,gCAAwE;;;;GAO/E;AAED;;;;;GAKG;AACH,wBAAsB,2CAA2C,CAC/D,IAAI,GAAE,8BAAgD,EACtD,OAAO,CAAC,EAAE,MAAM,EAAE;;;;GAOnB;AAED,eAAO,MAAM,6BAA6B,UAClC,gCAAgC;;;;CAOvC,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACvC,8BAA8B;;;;CAOrC,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC;;;;CAOvC,CAAC;AAEF,eAAO,MAAM,8CAA8C,UACnD,8BAA8B;;;;CAOrC,CAAC"}
1
+ {"version":3,"file":"mockResponses.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockResponses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,8BAA8B,EAC/B,2CAAuC;AAKxC,OAAO,KAAK,EACV,uCAAuC,EACvC,sBAAsB,EACvB,wBAAoB;AAcrB,eAAO,MAAM,0BAA0B,SAC/B,gCAAgC,GAAG,8BAA8B,WAUxE,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,sBAAsB,CAAC,CAKjC;AAED;;;;GAIG;AACH,wBAAsB,mCAAmC,CACvD,OAAO,GAAE,MAAM,EAAwB,GACtC,OAAO,CAAC,uCAAuC,CAAC,CAUlD;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,GAAE,gCAAsG;;;;GAO7G;AAED;;;;;GAKG;AACH,wBAAsB,2CAA2C,CAC/D,IAAI,GAAE,8BAAyE,EAC/E,OAAO,CAAC,EAAE,MAAM,EAAE;;;;GAOnB;AAED,eAAO,MAAM,6BAA6B,UAClC,gCAAgC;;;;CAOvC,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACvC,8BAA8B;;;;CAOrC,CAAC;AAEF,eAAO,MAAM,qCAAqC,UAC1C,8BAA8B;;;;CAOrC,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC;;;;CAOvC,CAAC;AAEF,eAAO,MAAM,8CAA8C,UACnD,8BAA8B;;;;CAOrC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { createEntryPath } from "../../../shared/storage-schema.mjs";
1
+ import { createEntryPath, USER_STORAGE_FEATURE_NAMES } from "../../../shared/storage-schema.mjs";
2
2
  import { USER_STORAGE_ENDPOINT } from "../services.mjs";
3
3
  import { MOCK_ENCRYPTED_STORAGE_DATA, MOCK_STORAGE_DATA, MOCK_STORAGE_KEY } from "./mockStorage.mjs";
4
4
  export const getMockUserStorageEndpoint = (path) => {
@@ -37,7 +37,7 @@ export async function createMockAllFeatureEntriesResponse(dataArr = [MOCK_STORAG
37
37
  * @param path - path of the GET Url
38
38
  * @returns mock GET API request. Can be used by e2e or unit mock servers
39
39
  */
40
- export async function getMockUserStorageGetResponse(path = 'notifications.notification_settings') {
40
+ export async function getMockUserStorageGetResponse(path = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`) {
41
41
  return {
42
42
  url: getMockUserStorageEndpoint(path),
43
43
  requestMethod: 'GET',
@@ -50,35 +50,42 @@ export async function getMockUserStorageGetResponse(path = 'notifications.notifi
50
50
  * @param dataArr - data to encrypt
51
51
  * @returns mock GET ALL API request. Can be used by e2e or unit mock servers
52
52
  */
53
- export async function getMockUserStorageAllFeatureEntriesResponse(path = 'notifications', dataArr) {
53
+ export async function getMockUserStorageAllFeatureEntriesResponse(path = USER_STORAGE_FEATURE_NAMES.notifications, dataArr) {
54
54
  return {
55
55
  url: getMockUserStorageEndpoint(path),
56
56
  requestMethod: 'GET',
57
57
  response: await createMockAllFeatureEntriesResponse(dataArr),
58
58
  };
59
59
  }
60
- export const getMockUserStoragePutResponse = (path = 'notifications.notification_settings') => {
60
+ export const getMockUserStoragePutResponse = (path = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`) => {
61
61
  return {
62
62
  url: getMockUserStorageEndpoint(path),
63
63
  requestMethod: 'PUT',
64
64
  response: null,
65
65
  };
66
66
  };
67
- export const getMockUserStorageBatchPutResponse = (path = 'notifications') => {
67
+ export const getMockUserStorageBatchPutResponse = (path = USER_STORAGE_FEATURE_NAMES.notifications) => {
68
68
  return {
69
69
  url: getMockUserStorageEndpoint(path),
70
70
  requestMethod: 'PUT',
71
71
  response: null,
72
72
  };
73
73
  };
74
- export const deleteMockUserStorageResponse = (path = 'notifications.notification_settings') => {
74
+ export const getMockUserStorageBatchDeleteResponse = (path = 'notifications') => {
75
+ return {
76
+ url: getMockUserStorageEndpoint(path),
77
+ requestMethod: 'PUT',
78
+ response: null,
79
+ };
80
+ };
81
+ export const deleteMockUserStorageResponse = (path = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`) => {
75
82
  return {
76
83
  url: getMockUserStorageEndpoint(path),
77
84
  requestMethod: 'DELETE',
78
85
  response: null,
79
86
  };
80
87
  };
81
- export const deleteMockUserStorageAllFeatureEntriesResponse = (path = 'notifications') => {
88
+ export const deleteMockUserStorageAllFeatureEntriesResponse = (path = USER_STORAGE_FEATURE_NAMES.notifications) => {
82
89
  return {
83
90
  url: getMockUserStorageEndpoint(path),
84
91
  requestMethod: 'DELETE',
@@ -1 +1 @@
1
- {"version":3,"file":"mockResponses.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockResponses.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,2CAAuC;AAKjE,OAAO,EAAE,qBAAqB,EAAE,wBAAoB;AACpD,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,gBAAgB,EACjB,0BAAsB;AAQvB,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,IAAuE,EACvE,EAAE;IACF,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QAChC,OAAO,GAAG,qBAAqB,IAAI,IAAI,EAAE,CAAC;KAC3C;IAED,OAAO,GAAG,qBAAqB,IAAI,eAAe,CAChD,IAAwC,EACxC,gBAAgB,CACjB,EAAE,CAAC;AACN,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,IAAa;IAEb,OAAO;QACL,SAAS,EAAE,YAAY;QACvB,IAAI,EAAE,MAAM,2BAA2B,CAAC,IAAI,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KA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C,OAAyC,qCAAqC,EAC9E,EAAE;IACF,OAAO;QACL,GAAG,EAAE,0BAA0B,CAAC,IAAI,CAAC;QACrC,aAAa,EAAE,QAAQ;QACvB,QAAQ,EAAE,IAAI;KACQ,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8CAA8C,GAAG,CAC5D,OAAuC,eAAe,EACtD,EAAE;IACF,OAAO;QACL,GAAG,EAAE,0BAA0B,CAAC,IAAI,CAAC;QACrC,aAAa,EAAE,QAAQ;QACvB,QAAQ,EAAE,IAAI;KACQ,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import type {\n UserStoragePathWithFeatureAndKey,\n UserStoragePathWithFeatureOnly,\n} from '../../../shared/storage-schema';\nimport { createEntryPath } from '../../../shared/storage-schema';\nimport type {\n GetUserStorageAllFeatureEntriesResponse,\n GetUserStorageResponse,\n} from '../services';\nimport { USER_STORAGE_ENDPOINT } from '../services';\nimport {\n MOCK_ENCRYPTED_STORAGE_DATA,\n MOCK_STORAGE_DATA,\n MOCK_STORAGE_KEY,\n} from './mockStorage';\n\ntype MockResponse = {\n url: string;\n requestMethod: 'GET' | 'POST' | 'PUT' | 'DELETE';\n response: unknown;\n};\n\nexport const getMockUserStorageEndpoint = (\n path: UserStoragePathWithFeatureAndKey | UserStoragePathWithFeatureOnly,\n) => {\n if (path.split('.').length === 1) {\n return `${USER_STORAGE_ENDPOINT}/${path}`;\n }\n\n return `${USER_STORAGE_ENDPOINT}/${createEntryPath(\n path as UserStoragePathWithFeatureAndKey,\n MOCK_STORAGE_KEY,\n )}`;\n};\n\n/**\n * Creates a mock GET user-storage response\n * @param data - data to encrypt\n * @returns a realistic GET Response Body\n */\nexport async function createMockGetStorageResponse(\n data?: string,\n): Promise<GetUserStorageResponse> {\n return {\n HashedKey: 'HASHED_KEY',\n Data: await MOCK_ENCRYPTED_STORAGE_DATA(data),\n };\n}\n\n/**\n * Creates a mock GET ALL user-storage response\n * @param dataArr - array of data to encrypt\n * @returns a realistic GET ALL Response Body\n */\nexport async function createMockAllFeatureEntriesResponse(\n dataArr: string[] = [MOCK_STORAGE_DATA],\n): Promise<GetUserStorageAllFeatureEntriesResponse> {\n return await Promise.all(\n dataArr.map(async function (d) {\n const encryptedData = await MOCK_ENCRYPTED_STORAGE_DATA(d);\n return {\n HashedKey: 'HASHED_KEY',\n Data: encryptedData,\n };\n }),\n );\n}\n\n/**\n * Creates a mock user-storage api GET request\n * @param path - path of the GET Url\n * @returns mock GET API request. Can be used by e2e or unit mock servers\n */\nexport async function getMockUserStorageGetResponse(\n path: UserStoragePathWithFeatureAndKey = 'notifications.notification_settings',\n) {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'GET',\n response: await createMockGetStorageResponse(),\n } satisfies MockResponse;\n}\n\n/**\n * Creates a mock user-storage api GET ALL request\n * @param path - path of the GET url\n * @param dataArr - data to encrypt\n * @returns mock GET ALL API request. Can be used by e2e or unit mock servers\n */\nexport async function getMockUserStorageAllFeatureEntriesResponse(\n path: UserStoragePathWithFeatureOnly = 'notifications',\n dataArr?: string[],\n) {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'GET',\n response: await createMockAllFeatureEntriesResponse(dataArr),\n } satisfies MockResponse;\n}\n\nexport const getMockUserStoragePutResponse = (\n path: UserStoragePathWithFeatureAndKey = 'notifications.notification_settings',\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const getMockUserStorageBatchPutResponse = (\n path: UserStoragePathWithFeatureOnly = 'notifications',\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const deleteMockUserStorageResponse = (\n path: UserStoragePathWithFeatureAndKey = 'notifications.notification_settings',\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'DELETE',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const deleteMockUserStorageAllFeatureEntriesResponse = (\n path: UserStoragePathWithFeatureOnly = 'notifications',\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'DELETE',\n response: null,\n } satisfies MockResponse;\n};\n"]}
1
+ {"version":3,"file":"mockResponses.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockResponses.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,eAAe,EACf,0BAA0B,EAC3B,2CAAuC;AAKxC,OAAO,EAAE,qBAAqB,EAAE,wBAAoB;AACpD,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,gBAAgB,EACjB,0BAAsB;AAQvB,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,IAAuE,EACvE,EAAE;IACF,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QAChC,OAAO,GAAG,qBAAqB,IAAI,IAAI,EAAE,CAAC;KAC3C;IAED,OAAO,GAAG,qBAAqB,IAAI,eAAe,CAChD,IAAwC,EACxC,gBAAgB,CACjB,EAAE,CAAC;AACN,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,IAAa;IAEb,OAAO;QACL,SAAS,EAAE,YAAY;QACvB,IAAI,EAAE,MAAM,2BAA2B,CAAC,IAAI,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mCAAmC,CACvD,UAAoB,CAAC,iBAAiB,CAAC;IAEvC,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,OAAO,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC;QAC3B,MAAM,aAAa,GAAG,MAAM,2BAA2B,CAAC,CAAC,CAAC,CAAC;QAC3D,OAAO;YACL,SAAS,EAAE,YAAY;YACvB,IAAI,EAAE,aAAa;SACpB,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAA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5G,EAAE;IACF,OAAO;QACL,GAAG,EAAE,0BAA0B,CAAC,IAAI,CAAC;QACrC,aAAa,EAAE,QAAQ;QACvB,QAAQ,EAAE,IAAI;KACQ,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8CAA8C,GAAG,CAC5D,OAAuC,0BAA0B,CAAC,aAAa,EAC/E,EAAE;IACF,OAAO;QACL,GAAG,EAAE,0BAA0B,CAAC,IAAI,CAAC;QACrC,aAAa,EAAE,QAAQ;QACvB,QAAQ,EAAE,IAAI;KACQ,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import type {\n UserStoragePathWithFeatureAndKey,\n UserStoragePathWithFeatureOnly,\n} from '../../../shared/storage-schema';\nimport {\n createEntryPath,\n USER_STORAGE_FEATURE_NAMES,\n} from '../../../shared/storage-schema';\nimport type {\n GetUserStorageAllFeatureEntriesResponse,\n GetUserStorageResponse,\n} from '../services';\nimport { USER_STORAGE_ENDPOINT } from '../services';\nimport {\n MOCK_ENCRYPTED_STORAGE_DATA,\n MOCK_STORAGE_DATA,\n MOCK_STORAGE_KEY,\n} from './mockStorage';\n\ntype MockResponse = {\n url: string;\n requestMethod: 'GET' | 'POST' | 'PUT' | 'DELETE';\n response: unknown;\n};\n\nexport const getMockUserStorageEndpoint = (\n path: UserStoragePathWithFeatureAndKey | UserStoragePathWithFeatureOnly,\n) => {\n if (path.split('.').length === 1) {\n return `${USER_STORAGE_ENDPOINT}/${path}`;\n }\n\n return `${USER_STORAGE_ENDPOINT}/${createEntryPath(\n path as UserStoragePathWithFeatureAndKey,\n MOCK_STORAGE_KEY,\n )}`;\n};\n\n/**\n * Creates a mock GET user-storage response\n * @param data - data to encrypt\n * @returns a realistic GET Response Body\n */\nexport async function createMockGetStorageResponse(\n data?: string,\n): Promise<GetUserStorageResponse> {\n return {\n HashedKey: 'HASHED_KEY',\n Data: await MOCK_ENCRYPTED_STORAGE_DATA(data),\n };\n}\n\n/**\n * Creates a mock GET ALL user-storage response\n * @param dataArr - array of data to encrypt\n * @returns a realistic GET ALL Response Body\n */\nexport async function createMockAllFeatureEntriesResponse(\n dataArr: string[] = [MOCK_STORAGE_DATA],\n): Promise<GetUserStorageAllFeatureEntriesResponse> {\n return await Promise.all(\n dataArr.map(async function (d) {\n const encryptedData = await MOCK_ENCRYPTED_STORAGE_DATA(d);\n return {\n HashedKey: 'HASHED_KEY',\n Data: encryptedData,\n };\n }),\n );\n}\n\n/**\n * Creates a mock user-storage api GET request\n * @param path - path of the GET Url\n * @returns mock GET API request. Can be used by e2e or unit mock servers\n */\nexport async function getMockUserStorageGetResponse(\n path: UserStoragePathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n) {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'GET',\n response: await createMockGetStorageResponse(),\n } satisfies MockResponse;\n}\n\n/**\n * Creates a mock user-storage api GET ALL request\n * @param path - path of the GET url\n * @param dataArr - data to encrypt\n * @returns mock GET ALL API request. Can be used by e2e or unit mock servers\n */\nexport async function getMockUserStorageAllFeatureEntriesResponse(\n path: UserStoragePathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n dataArr?: string[],\n) {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'GET',\n response: await createMockAllFeatureEntriesResponse(dataArr),\n } satisfies MockResponse;\n}\n\nexport const getMockUserStoragePutResponse = (\n path: UserStoragePathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const getMockUserStorageBatchPutResponse = (\n path: UserStoragePathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const getMockUserStorageBatchDeleteResponse = (\n path: UserStoragePathWithFeatureOnly = 'notifications',\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const deleteMockUserStorageResponse = (\n path: UserStoragePathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'DELETE',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const deleteMockUserStorageAllFeatureEntriesResponse = (\n path: UserStoragePathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'DELETE',\n response: null,\n } satisfies MockResponse;\n};\n"]}
@@ -3,10 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.mockEndpointDeleteUserStorageAllFeatureEntries = exports.mockEndpointDeleteUserStorage = exports.mockEndpointBatchUpsertUserStorage = exports.mockEndpointUpsertUserStorage = exports.mockEndpointGetUserStorage = exports.mockEndpointGetUserStorageAllFeatureEntries = void 0;
6
+ exports.mockEndpointBatchDeleteUserStorage = exports.mockEndpointDeleteUserStorageAllFeatureEntries = exports.mockEndpointDeleteUserStorage = exports.mockEndpointBatchUpsertUserStorage = exports.mockEndpointUpsertUserStorage = exports.mockEndpointGetUserStorage = exports.mockEndpointGetUserStorageAllFeatureEntries = void 0;
7
7
  const nock_1 = __importDefault(require("nock"));
8
+ const storage_schema_1 = require("../../../shared/storage-schema.cjs");
8
9
  const mockResponses_1 = require("./mockResponses.cjs");
9
- const mockEndpointGetUserStorageAllFeatureEntries = async (path = 'notifications', mockReply) => {
10
+ const mockEndpointGetUserStorageAllFeatureEntries = async (path = storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications, mockReply) => {
10
11
  const mockResponse = await (0, mockResponses_1.getMockUserStorageAllFeatureEntriesResponse)(path);
11
12
  const reply = mockReply ?? {
12
13
  status: 200,
@@ -18,7 +19,7 @@ const mockEndpointGetUserStorageAllFeatureEntries = async (path = 'notifications
18
19
  return mockEndpoint;
19
20
  };
20
21
  exports.mockEndpointGetUserStorageAllFeatureEntries = mockEndpointGetUserStorageAllFeatureEntries;
21
- const mockEndpointGetUserStorage = async (path = 'notifications.notification_settings', mockReply) => {
22
+ const mockEndpointGetUserStorage = async (path = `${storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`, mockReply) => {
22
23
  const mockResponse = await (0, mockResponses_1.getMockUserStorageGetResponse)(path);
23
24
  const reply = mockReply ?? {
24
25
  status: 200,
@@ -30,7 +31,7 @@ const mockEndpointGetUserStorage = async (path = 'notifications.notification_set
30
31
  return mockEndpoint;
31
32
  };
32
33
  exports.mockEndpointGetUserStorage = mockEndpointGetUserStorage;
33
- const mockEndpointUpsertUserStorage = (path = 'notifications.notification_settings', mockReply, expectCallback) => {
34
+ const mockEndpointUpsertUserStorage = (path = `${storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`, mockReply, expectCallback) => {
34
35
  const mockResponse = (0, mockResponses_1.getMockUserStoragePutResponse)(path);
35
36
  const mockEndpoint = (0, nock_1.default)(mockResponse.url)
36
37
  .put('')
@@ -40,7 +41,7 @@ const mockEndpointUpsertUserStorage = (path = 'notifications.notification_settin
40
41
  return mockEndpoint;
41
42
  };
42
43
  exports.mockEndpointUpsertUserStorage = mockEndpointUpsertUserStorage;
43
- const mockEndpointBatchUpsertUserStorage = (path = 'notifications', mockReply, callback) => {
44
+ const mockEndpointBatchUpsertUserStorage = (path = storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications, mockReply, callback) => {
44
45
  const mockResponse = (0, mockResponses_1.getMockUserStorageBatchPutResponse)(path);
45
46
  const mockEndpoint = (0, nock_1.default)(mockResponse.url)
46
47
  .put('')
@@ -50,7 +51,7 @@ const mockEndpointBatchUpsertUserStorage = (path = 'notifications', mockReply, c
50
51
  return mockEndpoint;
51
52
  };
52
53
  exports.mockEndpointBatchUpsertUserStorage = mockEndpointBatchUpsertUserStorage;
53
- const mockEndpointDeleteUserStorage = (path = 'notifications.notification_settings', mockReply) => {
54
+ const mockEndpointDeleteUserStorage = (path = `${storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`, mockReply) => {
54
55
  const mockResponse = (0, mockResponses_1.deleteMockUserStorageResponse)(path);
55
56
  const reply = mockReply ?? {
56
57
  status: 200,
@@ -59,7 +60,7 @@ const mockEndpointDeleteUserStorage = (path = 'notifications.notification_settin
59
60
  return mockEndpoint;
60
61
  };
61
62
  exports.mockEndpointDeleteUserStorage = mockEndpointDeleteUserStorage;
62
- const mockEndpointDeleteUserStorageAllFeatureEntries = (path = 'notifications', mockReply) => {
63
+ const mockEndpointDeleteUserStorageAllFeatureEntries = (path = storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications, mockReply) => {
63
64
  const mockResponse = (0, mockResponses_1.deleteMockUserStorageAllFeatureEntriesResponse)(path);
64
65
  const reply = mockReply ?? {
65
66
  status: 200,
@@ -68,4 +69,14 @@ const mockEndpointDeleteUserStorageAllFeatureEntries = (path = 'notifications',
68
69
  return mockEndpoint;
69
70
  };
70
71
  exports.mockEndpointDeleteUserStorageAllFeatureEntries = mockEndpointDeleteUserStorageAllFeatureEntries;
72
+ const mockEndpointBatchDeleteUserStorage = (path = 'notifications', mockReply, callback) => {
73
+ const mockResponse = (0, mockResponses_1.getMockUserStorageBatchDeleteResponse)(path);
74
+ const mockEndpoint = (0, nock_1.default)(mockResponse.url)
75
+ .put('')
76
+ .reply(mockReply?.status ?? 204, async (uri, requestBody) => {
77
+ return await callback?.(uri, requestBody);
78
+ });
79
+ return mockEndpoint;
80
+ };
81
+ exports.mockEndpointBatchDeleteUserStorage = mockEndpointBatchDeleteUserStorage;
71
82
  //# sourceMappingURL=mockServices.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mockServices.cjs","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tB,CAAC,CAAC;AAZW,QAAA,6BAA6B,iCAYxC;AAEK,MAAM,8CAA8C,GAAG,CAC5D,OAAuC,eAAe,EACtD,SAAqB,EACrB,EAAE;IACF,MAAM,YAAY,GAAG,IAAA,8DAA8C,EAAC,IAAI,CAAC,CAAC;IAC1E,MAAM,KAAK,GAAG,SAAS,IAAI;QACzB,MAAM,EAAE,GAAG;KACZ,CAAC;IAEF,MAAM,YAAY,GAAG,IAAA,cAAI,EAAC,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3E,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAZW,QAAA,8CAA8C,kDAYzD","sourcesContent":["import nock from 'nock';\n\nimport type {\n UserStoragePathWithFeatureAndKey,\n UserStoragePathWithFeatureOnly,\n} from '../../../shared/storage-schema';\nimport {\n getMockUserStorageGetResponse,\n getMockUserStoragePutResponse,\n getMockUserStorageAllFeatureEntriesResponse,\n getMockUserStorageBatchPutResponse,\n deleteMockUserStorageAllFeatureEntriesResponse,\n deleteMockUserStorageResponse,\n} from './mockResponses';\n\ntype MockReply = {\n status: nock.StatusCode;\n body?: nock.Body;\n};\n\nexport const mockEndpointGetUserStorageAllFeatureEntries = async (\n path: UserStoragePathWithFeatureOnly = 'notifications',\n mockReply?: MockReply,\n) => {\n const mockResponse = await getMockUserStorageAllFeatureEntriesResponse(path);\n const reply = mockReply ?? {\n status: 200,\n body: mockResponse.response,\n };\n\n const mockEndpoint = nock(mockResponse.url)\n .get('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointGetUserStorage = async (\n path: UserStoragePathWithFeatureAndKey = 'notifications.notification_settings',\n mockReply?: MockReply,\n) => {\n const mockResponse = await getMockUserStorageGetResponse(path);\n const reply = mockReply ?? {\n status: 200,\n body: mockResponse.response,\n };\n\n const mockEndpoint = nock(mockResponse.url)\n .get('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointUpsertUserStorage = (\n path: UserStoragePathWithFeatureAndKey = 'notifications.notification_settings',\n mockReply?: Pick<MockReply, 'status'>,\n expectCallback?: (requestBody: nock.Body) => Promise<void>,\n) => {\n const mockResponse = getMockUserStoragePutResponse(path);\n const mockEndpoint = nock(mockResponse.url)\n .put('')\n .reply(mockReply?.status ?? 204, async (_, requestBody) => {\n await expectCallback?.(requestBody);\n });\n return mockEndpoint;\n};\n\nexport const mockEndpointBatchUpsertUserStorage = (\n path: UserStoragePathWithFeatureOnly = 'notifications',\n mockReply?: Pick<MockReply, 'status'>,\n callback?: (uri: string, requestBody: nock.Body) => Promise<void>,\n) => {\n const mockResponse = getMockUserStorageBatchPutResponse(path);\n const mockEndpoint = nock(mockResponse.url)\n .put('')\n .reply(mockReply?.status ?? 204, async (uri, requestBody) => {\n return await callback?.(uri, requestBody);\n });\n return mockEndpoint;\n};\n\nexport const mockEndpointDeleteUserStorage = (\n path: UserStoragePathWithFeatureAndKey = 'notifications.notification_settings',\n mockReply?: MockReply,\n) => {\n const mockResponse = deleteMockUserStorageResponse(path);\n const reply = mockReply ?? {\n status: 200,\n };\n\n const mockEndpoint = nock(mockResponse.url).delete('').reply(reply.status);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointDeleteUserStorageAllFeatureEntries = (\n path: UserStoragePathWithFeatureOnly = 'notifications',\n mockReply?: MockReply,\n) => {\n const mockResponse = deleteMockUserStorageAllFeatureEntriesResponse(path);\n const reply = mockReply ?? {\n status: 200,\n };\n\n const mockEndpoint = nock(mockResponse.url).delete('').reply(reply.status);\n\n return mockEndpoint;\n};\n"]}
1
+ {"version":3,"file":"mockServices.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockServices.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uEAIwC;AACxC,uDAQyB;AAOlB,MAAM,2CAA2C,GAAG,KAAK,EAC9D,OAAuC,2C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C;AAEK,MAAM,8CAA8C,GAAG,CAC5D,OAAuC,2CAA0B,CAAC,aAAa,EAC/E,SAAqB,EACrB,EAAE;IACF,MAAM,YAAY,GAAG,IAAA,8DAA8C,EAAC,IAAI,CAAC,CAAC;IAC1E,MAAM,KAAK,GAAG,SAAS,IAAI;QACzB,MAAM,EAAE,GAAG;KACZ,CAAC;IAEF,MAAM,YAAY,GAAG,IAAA,cAAI,EAAC,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3E,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAZW,QAAA,8CAA8C,kDAYzD;AAEK,MAAM,kCAAkC,GAAG,CAChD,OAAuC,eAAe,EACtD,SAAqC,EACrC,QAAiE,EACjE,EAAE;IACF,MAAM,YAAY,GAAG,IAAA,qDAAqC,EAAC,IAAI,CAAC,CAAC;IACjE,MAAM,YAAY,GAAG,IAAA,cAAI,EAAC,YAAY,CAAC,GAAG,CAAC;SACxC,GAAG,CAAC,EAAE,CAAC;SACP,KAAK,CAAC,SAAS,EAAE,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,EAAE;QAC1D,OAAO,MAAM,QAAQ,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IACL,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAZW,QAAA,kCAAkC,sCAY7C","sourcesContent":["import nock from 'nock';\n\nimport {\n USER_STORAGE_FEATURE_NAMES,\n type UserStoragePathWithFeatureAndKey,\n type UserStoragePathWithFeatureOnly,\n} from '../../../shared/storage-schema';\nimport {\n getMockUserStorageGetResponse,\n getMockUserStoragePutResponse,\n getMockUserStorageAllFeatureEntriesResponse,\n getMockUserStorageBatchPutResponse,\n getMockUserStorageBatchDeleteResponse,\n deleteMockUserStorageAllFeatureEntriesResponse,\n deleteMockUserStorageResponse,\n} from './mockResponses';\n\ntype MockReply = {\n status: nock.StatusCode;\n body?: nock.Body;\n};\n\nexport const mockEndpointGetUserStorageAllFeatureEntries = async (\n path: UserStoragePathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n mockReply?: MockReply,\n) => {\n const mockResponse = await getMockUserStorageAllFeatureEntriesResponse(path);\n const reply = mockReply ?? {\n status: 200,\n body: mockResponse.response,\n };\n\n const mockEndpoint = nock(mockResponse.url)\n .get('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointGetUserStorage = async (\n path: UserStoragePathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n mockReply?: MockReply,\n) => {\n const mockResponse = await getMockUserStorageGetResponse(path);\n const reply = mockReply ?? {\n status: 200,\n body: mockResponse.response,\n };\n\n const mockEndpoint = nock(mockResponse.url)\n .get('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointUpsertUserStorage = (\n path: UserStoragePathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n mockReply?: Pick<MockReply, 'status'>,\n expectCallback?: (requestBody: nock.Body) => Promise<void>,\n) => {\n const mockResponse = getMockUserStoragePutResponse(path);\n const mockEndpoint = nock(mockResponse.url)\n .put('')\n .reply(mockReply?.status ?? 204, async (_, requestBody) => {\n await expectCallback?.(requestBody);\n });\n return mockEndpoint;\n};\n\nexport const mockEndpointBatchUpsertUserStorage = (\n path: UserStoragePathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n mockReply?: Pick<MockReply, 'status'>,\n callback?: (uri: string, requestBody: nock.Body) => Promise<void>,\n) => {\n const mockResponse = getMockUserStorageBatchPutResponse(path);\n const mockEndpoint = nock(mockResponse.url)\n .put('')\n .reply(mockReply?.status ?? 204, async (uri, requestBody) => {\n return await callback?.(uri, requestBody);\n });\n return mockEndpoint;\n};\n\nexport const mockEndpointDeleteUserStorage = (\n path: UserStoragePathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n mockReply?: MockReply,\n) => {\n const mockResponse = deleteMockUserStorageResponse(path);\n const reply = mockReply ?? {\n status: 200,\n };\n\n const mockEndpoint = nock(mockResponse.url).delete('').reply(reply.status);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointDeleteUserStorageAllFeatureEntries = (\n path: UserStoragePathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n mockReply?: MockReply,\n) => {\n const mockResponse = deleteMockUserStorageAllFeatureEntriesResponse(path);\n const reply = mockReply ?? {\n status: 200,\n };\n\n const mockEndpoint = nock(mockResponse.url).delete('').reply(reply.status);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointBatchDeleteUserStorage = (\n path: UserStoragePathWithFeatureOnly = 'notifications',\n mockReply?: Pick<MockReply, 'status'>,\n callback?: (uri: string, requestBody: nock.Body) => Promise<void>,\n) => {\n const mockResponse = getMockUserStorageBatchDeleteResponse(path);\n const mockEndpoint = nock(mockResponse.url)\n .put('')\n .reply(mockReply?.status ?? 204, async (uri, requestBody) => {\n return await callback?.(uri, requestBody);\n });\n return mockEndpoint;\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import nock from "nock";
2
- import type { UserStoragePathWithFeatureAndKey, UserStoragePathWithFeatureOnly } from "../../../shared/storage-schema.cjs";
2
+ import { type UserStoragePathWithFeatureAndKey, type UserStoragePathWithFeatureOnly } from "../../../shared/storage-schema.cjs";
3
3
  type MockReply = {
4
4
  status: nock.StatusCode;
5
5
  body?: nock.Body;
@@ -10,5 +10,6 @@ export declare const mockEndpointUpsertUserStorage: (path?: UserStoragePathWithF
10
10
  export declare const mockEndpointBatchUpsertUserStorage: (path?: UserStoragePathWithFeatureOnly, mockReply?: Pick<MockReply, 'status'>, callback?: ((uri: string, requestBody: nock.Body) => Promise<void>) | undefined) => nock.Scope;
11
11
  export declare const mockEndpointDeleteUserStorage: (path?: UserStoragePathWithFeatureAndKey, mockReply?: MockReply) => nock.Scope;
12
12
  export declare const mockEndpointDeleteUserStorageAllFeatureEntries: (path?: UserStoragePathWithFeatureOnly, mockReply?: MockReply) => nock.Scope;
13
+ export declare const mockEndpointBatchDeleteUserStorage: (path?: UserStoragePathWithFeatureOnly, mockReply?: Pick<MockReply, 'status'>, callback?: ((uri: string, requestBody: nock.Body) => Promise<void>) | undefined) => nock.Scope;
13
14
  export {};
14
15
  //# sourceMappingURL=mockServices.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mockServices.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockServices.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,aAAa;AAExB,OAAO,KAAK,EACV,gCAAgC,EAChC,8BAA8B,EAC/B,2CAAuC;AAUxC,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,2CAA2C,UAChD,8BAA8B,cACxB,SAAS,wBAatB,CAAC;AAEF,eAAO,MAAM,0BAA0B,UAC/B,gCAAgC,cAC1B,SAAS,wBAatB,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC,cAC1B,KAAK,SAAS,EAAE,QAAQ,CAAC,kCACN,SAAS,KAAK,QAAQ,IAAI,CAAC,4BAS3D,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACvC,8BAA8B,cACxB,KAAK,SAAS,EAAE,QAAQ,CAAC,oBACpB,MAAM,eAAe,SAAS,KAAK,QAAQ,IAAI,CAAC,4BASlE,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC,cAC1B,SAAS,eAUtB,CAAC;AAEF,eAAO,MAAM,8CAA8C,UACnD,8BAA8B,cACxB,SAAS,eAUtB,CAAC"}
1
+ {"version":3,"file":"mockServices.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockServices.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,aAAa;AAExB,OAAO,EAEL,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACpC,2CAAuC;AAWxC,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,2CAA2C,UAChD,8BAA8B,cACxB,SAAS,wBAatB,CAAC;AAEF,eAAO,MAAM,0BAA0B,UAC/B,gCAAgC,cAC1B,SAAS,wBAatB,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC,cAC1B,KAAK,SAAS,EAAE,QAAQ,CAAC,kCACN,SAAS,KAAK,QAAQ,IAAI,CAAC,4BAS3D,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACvC,8BAA8B,cACxB,KAAK,SAAS,EAAE,QAAQ,CAAC,oBACpB,MAAM,eAAe,SAAS,KAAK,QAAQ,IAAI,CAAC,4BASlE,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC,cAC1B,SAAS,eAUtB,CAAC;AAEF,eAAO,MAAM,8CAA8C,UACnD,8BAA8B,cACxB,SAAS,eAUtB,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACvC,8BAA8B,cACxB,KAAK,SAAS,EAAE,QAAQ,CAAC,oBACpB,MAAM,eAAe,SAAS,KAAK,QAAQ,IAAI,CAAC,4BASlE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import nock from "nock";
2
- import type { UserStoragePathWithFeatureAndKey, UserStoragePathWithFeatureOnly } from "../../../shared/storage-schema.mjs";
2
+ import { type UserStoragePathWithFeatureAndKey, type UserStoragePathWithFeatureOnly } from "../../../shared/storage-schema.mjs";
3
3
  type MockReply = {
4
4
  status: nock.StatusCode;
5
5
  body?: nock.Body;
@@ -10,5 +10,6 @@ export declare const mockEndpointUpsertUserStorage: (path?: UserStoragePathWithF
10
10
  export declare const mockEndpointBatchUpsertUserStorage: (path?: UserStoragePathWithFeatureOnly, mockReply?: Pick<MockReply, 'status'>, callback?: ((uri: string, requestBody: nock.Body) => Promise<void>) | undefined) => nock.Scope;
11
11
  export declare const mockEndpointDeleteUserStorage: (path?: UserStoragePathWithFeatureAndKey, mockReply?: MockReply) => nock.Scope;
12
12
  export declare const mockEndpointDeleteUserStorageAllFeatureEntries: (path?: UserStoragePathWithFeatureOnly, mockReply?: MockReply) => nock.Scope;
13
+ export declare const mockEndpointBatchDeleteUserStorage: (path?: UserStoragePathWithFeatureOnly, mockReply?: Pick<MockReply, 'status'>, callback?: ((uri: string, requestBody: nock.Body) => Promise<void>) | undefined) => nock.Scope;
13
14
  export {};
14
15
  //# sourceMappingURL=mockServices.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mockServices.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockServices.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,aAAa;AAExB,OAAO,KAAK,EACV,gCAAgC,EAChC,8BAA8B,EAC/B,2CAAuC;AAUxC,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,2CAA2C,UAChD,8BAA8B,cACxB,SAAS,wBAatB,CAAC;AAEF,eAAO,MAAM,0BAA0B,UAC/B,gCAAgC,cAC1B,SAAS,wBAatB,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC,cAC1B,KAAK,SAAS,EAAE,QAAQ,CAAC,kCACN,SAAS,KAAK,QAAQ,IAAI,CAAC,4BAS3D,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACvC,8BAA8B,cACxB,KAAK,SAAS,EAAE,QAAQ,CAAC,oBACpB,MAAM,eAAe,SAAS,KAAK,QAAQ,IAAI,CAAC,4BASlE,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC,cAC1B,SAAS,eAUtB,CAAC;AAEF,eAAO,MAAM,8CAA8C,UACnD,8BAA8B,cACxB,SAAS,eAUtB,CAAC"}
1
+ {"version":3,"file":"mockServices.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockServices.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,aAAa;AAExB,OAAO,EAEL,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACpC,2CAAuC;AAWxC,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,2CAA2C,UAChD,8BAA8B,cACxB,SAAS,wBAatB,CAAC;AAEF,eAAO,MAAM,0BAA0B,UAC/B,gCAAgC,cAC1B,SAAS,wBAatB,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC,cAC1B,KAAK,SAAS,EAAE,QAAQ,CAAC,kCACN,SAAS,KAAK,QAAQ,IAAI,CAAC,4BAS3D,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACvC,8BAA8B,cACxB,KAAK,SAAS,EAAE,QAAQ,CAAC,oBACpB,MAAM,eAAe,SAAS,KAAK,QAAQ,IAAI,CAAC,4BASlE,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC,cAC1B,SAAS,eAUtB,CAAC;AAEF,eAAO,MAAM,8CAA8C,UACnD,8BAA8B,cACxB,SAAS,eAUtB,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACvC,8BAA8B,cACxB,KAAK,SAAS,EAAE,QAAQ,CAAC,oBACpB,MAAM,eAAe,SAAS,KAAK,QAAQ,IAAI,CAAC,4BASlE,CAAC"}
@@ -6,8 +6,9 @@ function $importDefault(module) {
6
6
  }
7
7
  import $nock from "nock";
8
8
  const nock = $importDefault($nock);
9
- import { getMockUserStorageGetResponse, getMockUserStoragePutResponse, getMockUserStorageAllFeatureEntriesResponse, getMockUserStorageBatchPutResponse, deleteMockUserStorageAllFeatureEntriesResponse, deleteMockUserStorageResponse } from "./mockResponses.mjs";
10
- export const mockEndpointGetUserStorageAllFeatureEntries = async (path = 'notifications', mockReply) => {
9
+ import { USER_STORAGE_FEATURE_NAMES } from "../../../shared/storage-schema.mjs";
10
+ import { getMockUserStorageGetResponse, getMockUserStoragePutResponse, getMockUserStorageAllFeatureEntriesResponse, getMockUserStorageBatchPutResponse, getMockUserStorageBatchDeleteResponse, deleteMockUserStorageAllFeatureEntriesResponse, deleteMockUserStorageResponse } from "./mockResponses.mjs";
11
+ export const mockEndpointGetUserStorageAllFeatureEntries = async (path = USER_STORAGE_FEATURE_NAMES.notifications, mockReply) => {
11
12
  const mockResponse = await getMockUserStorageAllFeatureEntriesResponse(path);
12
13
  const reply = mockReply ?? {
13
14
  status: 200,
@@ -18,7 +19,7 @@ export const mockEndpointGetUserStorageAllFeatureEntries = async (path = 'notifi
18
19
  .reply(reply.status, reply.body);
19
20
  return mockEndpoint;
20
21
  };
21
- export const mockEndpointGetUserStorage = async (path = 'notifications.notification_settings', mockReply) => {
22
+ export const mockEndpointGetUserStorage = async (path = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`, mockReply) => {
22
23
  const mockResponse = await getMockUserStorageGetResponse(path);
23
24
  const reply = mockReply ?? {
24
25
  status: 200,
@@ -29,7 +30,7 @@ export const mockEndpointGetUserStorage = async (path = 'notifications.notificat
29
30
  .reply(reply.status, reply.body);
30
31
  return mockEndpoint;
31
32
  };
32
- export const mockEndpointUpsertUserStorage = (path = 'notifications.notification_settings', mockReply, expectCallback) => {
33
+ export const mockEndpointUpsertUserStorage = (path = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`, mockReply, expectCallback) => {
33
34
  const mockResponse = getMockUserStoragePutResponse(path);
34
35
  const mockEndpoint = nock(mockResponse.url)
35
36
  .put('')
@@ -38,7 +39,7 @@ export const mockEndpointUpsertUserStorage = (path = 'notifications.notification
38
39
  });
39
40
  return mockEndpoint;
40
41
  };
41
- export const mockEndpointBatchUpsertUserStorage = (path = 'notifications', mockReply, callback) => {
42
+ export const mockEndpointBatchUpsertUserStorage = (path = USER_STORAGE_FEATURE_NAMES.notifications, mockReply, callback) => {
42
43
  const mockResponse = getMockUserStorageBatchPutResponse(path);
43
44
  const mockEndpoint = nock(mockResponse.url)
44
45
  .put('')
@@ -47,7 +48,7 @@ export const mockEndpointBatchUpsertUserStorage = (path = 'notifications', mockR
47
48
  });
48
49
  return mockEndpoint;
49
50
  };
50
- export const mockEndpointDeleteUserStorage = (path = 'notifications.notification_settings', mockReply) => {
51
+ export const mockEndpointDeleteUserStorage = (path = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`, mockReply) => {
51
52
  const mockResponse = deleteMockUserStorageResponse(path);
52
53
  const reply = mockReply ?? {
53
54
  status: 200,
@@ -55,7 +56,7 @@ export const mockEndpointDeleteUserStorage = (path = 'notifications.notification
55
56
  const mockEndpoint = nock(mockResponse.url).delete('').reply(reply.status);
56
57
  return mockEndpoint;
57
58
  };
58
- export const mockEndpointDeleteUserStorageAllFeatureEntries = (path = 'notifications', mockReply) => {
59
+ export const mockEndpointDeleteUserStorageAllFeatureEntries = (path = USER_STORAGE_FEATURE_NAMES.notifications, mockReply) => {
59
60
  const mockResponse = deleteMockUserStorageAllFeatureEntriesResponse(path);
60
61
  const reply = mockReply ?? {
61
62
  status: 200,
@@ -63,4 +64,13 @@ export const mockEndpointDeleteUserStorageAllFeatureEntries = (path = 'notificat
63
64
  const mockEndpoint = nock(mockResponse.url).delete('').reply(reply.status);
64
65
  return mockEndpoint;
65
66
  };
67
+ export const mockEndpointBatchDeleteUserStorage = (path = 'notifications', mockReply, callback) => {
68
+ const mockResponse = getMockUserStorageBatchDeleteResponse(path);
69
+ const mockEndpoint = nock(mockResponse.url)
70
+ .put('')
71
+ .reply(mockReply?.status ?? 204, async (uri, requestBody) => {
72
+ return await callback?.(uri, requestBody);
73
+ });
74
+ return mockEndpoint;
75
+ };
66
76
  //# sourceMappingURL=mockServices.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mockServices.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockServices.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,KAAI,aAAa;;AAMxB,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,2CAA2C,EAC3C,kCAAkC,EAClC,8CAA8C,EAC9C,6BAA6B,EAC9B,4BAAwB;AAOzB,MAAM,CAAC,MAAM,2CAA2C,GAAG,KAAK,EAC9D,OAAuC,eAAe,EACtD,SAAqB,EACrB,EAAE;IACF,MAAM,YAAY,GAAG,MAAM,2CAA2C,CAAC,IAAI,CAAC,CAAC;IAC7E,MAAM,KAAK,GAAG,SAAS,IAAI;QACzB,MAAM,EAAE,GAAG;QACX,IAAI,EAAE,YAAY,CAAC,QAAQ;KAC5B,CAAC;IAEF,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC;SACxC,GAAG,CAAC,EAAE,CAAC;SACP,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAEnC,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,EAC7C,OAAyC,qCAAqC,EAC9E,SAAqB,EACrB,EAAE;IACF,MAAM,YAAY,GAAG,MAAM,6BAA6B,CAAC,IAAI,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,SAAS,IAAI;QACzB,MAAM,EAAE,GAAG;QACX,IAAI,EAAE,YAAY,CAAC,QAAQ;KAC5B,CAAC;IAEF,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC;SACxC,GAAG,CAAC,EAAE,CAAC;SACP,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,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AI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3E,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8CAA8C,GAAG,CAC5D,OAAuC,eAAe,EACtD,SAAqB,EACrB,EAAE;IACF,MAAM,YAAY,GAAG,8CAA8C,CAAC,IAAI,CAAC,CAAC;IAC1E,MAAM,KAAK,GAAG,SAAS,IAAI;QACzB,MAAM,EAAE,GAAG;KACZ,CAAC;IAEF,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3E,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC","sourcesContent":["import nock from 'nock';\n\nimport type {\n UserStoragePathWithFeatureAndKey,\n UserStoragePathWithFeatureOnly,\n} from '../../../shared/storage-schema';\nimport {\n getMockUserStorageGetResponse,\n getMockUserStoragePutResponse,\n getMockUserStorageAllFeatureEntriesResponse,\n getMockUserStorageBatchPutResponse,\n deleteMockUserStorageAllFeatureEntriesResponse,\n deleteMockUserStorageResponse,\n} from './mockResponses';\n\ntype MockReply = {\n status: nock.StatusCode;\n body?: nock.Body;\n};\n\nexport const mockEndpointGetUserStorageAllFeatureEntries = async (\n path: UserStoragePathWithFeatureOnly = 'notifications',\n mockReply?: MockReply,\n) => {\n const mockResponse = await getMockUserStorageAllFeatureEntriesResponse(path);\n const reply = mockReply ?? {\n status: 200,\n body: mockResponse.response,\n };\n\n const mockEndpoint = nock(mockResponse.url)\n .get('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointGetUserStorage = async (\n path: UserStoragePathWithFeatureAndKey = 'notifications.notification_settings',\n mockReply?: MockReply,\n) => {\n const mockResponse = await getMockUserStorageGetResponse(path);\n const reply = mockReply ?? {\n status: 200,\n body: mockResponse.response,\n };\n\n const mockEndpoint = nock(mockResponse.url)\n .get('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointUpsertUserStorage = (\n path: UserStoragePathWithFeatureAndKey = 'notifications.notification_settings',\n mockReply?: Pick<MockReply, 'status'>,\n expectCallback?: (requestBody: nock.Body) => Promise<void>,\n) => {\n const mockResponse = getMockUserStoragePutResponse(path);\n const mockEndpoint = nock(mockResponse.url)\n .put('')\n .reply(mockReply?.status ?? 204, async (_, requestBody) => {\n await expectCallback?.(requestBody);\n });\n return mockEndpoint;\n};\n\nexport const mockEndpointBatchUpsertUserStorage = (\n path: UserStoragePathWithFeatureOnly = 'notifications',\n mockReply?: Pick<MockReply, 'status'>,\n callback?: (uri: string, requestBody: nock.Body) => Promise<void>,\n) => {\n const mockResponse = getMockUserStorageBatchPutResponse(path);\n const mockEndpoint = nock(mockResponse.url)\n .put('')\n .reply(mockReply?.status ?? 204, async (uri, requestBody) => {\n return await callback?.(uri, requestBody);\n });\n return mockEndpoint;\n};\n\nexport const mockEndpointDeleteUserStorage = (\n path: UserStoragePathWithFeatureAndKey = 'notifications.notification_settings',\n mockReply?: MockReply,\n) => {\n const mockResponse = deleteMockUserStorageResponse(path);\n const reply = mockReply ?? {\n status: 200,\n };\n\n const mockEndpoint = nock(mockResponse.url).delete('').reply(reply.status);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointDeleteUserStorageAllFeatureEntries = (\n path: UserStoragePathWithFeatureOnly = 'notifications',\n mockReply?: MockReply,\n) => {\n const mockResponse = deleteMockUserStorageAllFeatureEntriesResponse(path);\n const reply = mockReply ?? {\n status: 200,\n };\n\n const mockEndpoint = nock(mockResponse.url).delete('').reply(reply.status);\n\n return mockEndpoint;\n};\n"]}
1
+ {"version":3,"file":"mockServices.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockServices.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,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CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3E,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8CAA8C,GAAG,CAC5D,OAAuC,0BAA0B,CAAC,aAAa,EAC/E,SAAqB,EACrB,EAAE;IACF,MAAM,YAAY,GAAG,8CAA8C,CAAC,IAAI,CAAC,CAAC;IAC1E,MAAM,KAAK,GAAG,SAAS,IAAI;QACzB,MAAM,EAAE,GAAG;KACZ,CAAC;IAEF,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3E,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAChD,OAAuC,eAAe,EACtD,SAAqC,EACrC,QAAiE,EACjE,EAAE;IACF,MAAM,YAAY,GAAG,qCAAqC,CAAC,IAAI,CAAC,CAAC;IACjE,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC;SACxC,GAAG,CAAC,EAAE,CAAC;SACP,KAAK,CAAC,SAAS,EAAE,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,EAAE;QAC1D,OAAO,MAAM,QAAQ,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IACL,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC","sourcesContent":["import nock from 'nock';\n\nimport {\n USER_STORAGE_FEATURE_NAMES,\n type UserStoragePathWithFeatureAndKey,\n type UserStoragePathWithFeatureOnly,\n} from '../../../shared/storage-schema';\nimport {\n getMockUserStorageGetResponse,\n getMockUserStoragePutResponse,\n getMockUserStorageAllFeatureEntriesResponse,\n getMockUserStorageBatchPutResponse,\n getMockUserStorageBatchDeleteResponse,\n deleteMockUserStorageAllFeatureEntriesResponse,\n deleteMockUserStorageResponse,\n} from './mockResponses';\n\ntype MockReply = {\n status: nock.StatusCode;\n body?: nock.Body;\n};\n\nexport const mockEndpointGetUserStorageAllFeatureEntries = async (\n path: UserStoragePathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n mockReply?: MockReply,\n) => {\n const mockResponse = await getMockUserStorageAllFeatureEntriesResponse(path);\n const reply = mockReply ?? {\n status: 200,\n body: mockResponse.response,\n };\n\n const mockEndpoint = nock(mockResponse.url)\n .get('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointGetUserStorage = async (\n path: UserStoragePathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n mockReply?: MockReply,\n) => {\n const mockResponse = await getMockUserStorageGetResponse(path);\n const reply = mockReply ?? {\n status: 200,\n body: mockResponse.response,\n };\n\n const mockEndpoint = nock(mockResponse.url)\n .get('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointUpsertUserStorage = (\n path: UserStoragePathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n mockReply?: Pick<MockReply, 'status'>,\n expectCallback?: (requestBody: nock.Body) => Promise<void>,\n) => {\n const mockResponse = getMockUserStoragePutResponse(path);\n const mockEndpoint = nock(mockResponse.url)\n .put('')\n .reply(mockReply?.status ?? 204, async (_, requestBody) => {\n await expectCallback?.(requestBody);\n });\n return mockEndpoint;\n};\n\nexport const mockEndpointBatchUpsertUserStorage = (\n path: UserStoragePathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n mockReply?: Pick<MockReply, 'status'>,\n callback?: (uri: string, requestBody: nock.Body) => Promise<void>,\n) => {\n const mockResponse = getMockUserStorageBatchPutResponse(path);\n const mockEndpoint = nock(mockResponse.url)\n .put('')\n .reply(mockReply?.status ?? 204, async (uri, requestBody) => {\n return await callback?.(uri, requestBody);\n });\n return mockEndpoint;\n};\n\nexport const mockEndpointDeleteUserStorage = (\n path: UserStoragePathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n mockReply?: MockReply,\n) => {\n const mockResponse = deleteMockUserStorageResponse(path);\n const reply = mockReply ?? {\n status: 200,\n };\n\n const mockEndpoint = nock(mockResponse.url).delete('').reply(reply.status);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointDeleteUserStorageAllFeatureEntries = (\n path: UserStoragePathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n mockReply?: MockReply,\n) => {\n const mockResponse = deleteMockUserStorageAllFeatureEntriesResponse(path);\n const reply = mockReply ?? {\n status: 200,\n };\n\n const mockEndpoint = nock(mockResponse.url).delete('').reply(reply.status);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointBatchDeleteUserStorage = (\n path: UserStoragePathWithFeatureOnly = 'notifications',\n mockReply?: Pick<MockReply, 'status'>,\n callback?: (uri: string, requestBody: nock.Body) => Promise<void>,\n) => {\n const mockResponse = getMockUserStorageBatchDeleteResponse(path);\n const mockEndpoint = nock(mockResponse.url)\n .put('')\n .reply(mockReply?.status ?? 204, async (uri, requestBody) => {\n return await callback?.(uri, requestBody);\n });\n return mockEndpoint;\n};\n"]}