@metamask-previews/profile-sync-controller 8.1.0-preview-dbdf1da → 8.1.1-preview-30bb9023

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 (161) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/README.md +32 -0
  3. package/auth/mocks/package.json +2 -2
  4. package/dist/controllers/authentication/index.cjs +1 -1
  5. package/dist/controllers/authentication/index.cjs.map +1 -1
  6. package/dist/controllers/authentication/index.d.cts +1 -1
  7. package/dist/controllers/authentication/index.d.cts.map +1 -1
  8. package/dist/controllers/authentication/index.d.mts +1 -1
  9. package/dist/controllers/authentication/index.d.mts.map +1 -1
  10. package/dist/controllers/authentication/index.mjs +1 -1
  11. package/dist/controllers/authentication/index.mjs.map +1 -1
  12. package/dist/controllers/authentication/mocks/index.cjs.map +1 -0
  13. package/dist/controllers/authentication/mocks/index.d.cts.map +1 -0
  14. package/dist/controllers/authentication/mocks/index.d.mts.map +1 -0
  15. package/dist/controllers/authentication/mocks/index.mjs.map +1 -0
  16. package/dist/controllers/authentication/mocks/mockResponses.cjs.map +1 -0
  17. package/dist/controllers/authentication/mocks/mockResponses.d.cts.map +1 -0
  18. package/dist/controllers/authentication/mocks/mockResponses.d.mts.map +1 -0
  19. package/dist/controllers/authentication/mocks/mockResponses.mjs.map +1 -0
  20. package/dist/controllers/user-storage/index.cjs +1 -1
  21. package/dist/controllers/user-storage/index.cjs.map +1 -1
  22. package/dist/controllers/user-storage/index.d.cts +1 -1
  23. package/dist/controllers/user-storage/index.d.cts.map +1 -1
  24. package/dist/controllers/user-storage/index.d.mts +1 -1
  25. package/dist/controllers/user-storage/index.d.mts.map +1 -1
  26. package/dist/controllers/user-storage/index.mjs +1 -1
  27. package/dist/controllers/user-storage/index.mjs.map +1 -1
  28. package/dist/controllers/user-storage/mocks/index.cjs.map +1 -0
  29. package/dist/controllers/user-storage/mocks/index.d.cts.map +1 -0
  30. package/dist/controllers/user-storage/mocks/index.d.mts.map +1 -0
  31. package/dist/controllers/user-storage/mocks/index.mjs.map +1 -0
  32. package/dist/controllers/user-storage/mocks/mockResponses.cjs.map +1 -0
  33. package/dist/controllers/user-storage/mocks/mockResponses.d.cts.map +1 -0
  34. package/dist/controllers/user-storage/mocks/mockResponses.d.mts.map +1 -0
  35. package/dist/controllers/user-storage/mocks/mockResponses.mjs.map +1 -0
  36. package/dist/controllers/user-storage/mocks/mockStorage.cjs.map +1 -0
  37. package/dist/controllers/user-storage/mocks/mockStorage.d.cts.map +1 -0
  38. package/dist/controllers/user-storage/mocks/mockStorage.d.mts.map +1 -0
  39. package/dist/controllers/user-storage/mocks/mockStorage.mjs.map +1 -0
  40. package/package.json +11 -11
  41. package/user-storage/mocks/package.json +2 -2
  42. package/dist/controllers/authentication/__fixtures__/index.cjs.map +0 -1
  43. package/dist/controllers/authentication/__fixtures__/index.d.cts.map +0 -1
  44. package/dist/controllers/authentication/__fixtures__/index.d.mts.map +0 -1
  45. package/dist/controllers/authentication/__fixtures__/index.mjs.map +0 -1
  46. package/dist/controllers/authentication/__fixtures__/mockResponses.cjs.map +0 -1
  47. package/dist/controllers/authentication/__fixtures__/mockResponses.d.cts.map +0 -1
  48. package/dist/controllers/authentication/__fixtures__/mockResponses.d.mts.map +0 -1
  49. package/dist/controllers/authentication/__fixtures__/mockResponses.mjs.map +0 -1
  50. package/dist/controllers/authentication/__fixtures__/mockServices.cjs +0 -37
  51. package/dist/controllers/authentication/__fixtures__/mockServices.cjs.map +0 -1
  52. package/dist/controllers/authentication/__fixtures__/mockServices.d.cts +0 -10
  53. package/dist/controllers/authentication/__fixtures__/mockServices.d.cts.map +0 -1
  54. package/dist/controllers/authentication/__fixtures__/mockServices.d.mts +0 -10
  55. package/dist/controllers/authentication/__fixtures__/mockServices.d.mts.map +0 -1
  56. package/dist/controllers/authentication/__fixtures__/mockServices.mjs +0 -35
  57. package/dist/controllers/authentication/__fixtures__/mockServices.mjs.map +0 -1
  58. package/dist/controllers/user-storage/__fixtures__/index.cjs.map +0 -1
  59. package/dist/controllers/user-storage/__fixtures__/index.d.cts.map +0 -1
  60. package/dist/controllers/user-storage/__fixtures__/index.d.mts.map +0 -1
  61. package/dist/controllers/user-storage/__fixtures__/index.mjs.map +0 -1
  62. package/dist/controllers/user-storage/__fixtures__/mockMessenger.cjs +0 -167
  63. package/dist/controllers/user-storage/__fixtures__/mockMessenger.cjs.map +0 -1
  64. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.cts +0 -105
  65. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.cts.map +0 -1
  66. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.mts +0 -105
  67. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.mts.map +0 -1
  68. package/dist/controllers/user-storage/__fixtures__/mockMessenger.mjs +0 -162
  69. package/dist/controllers/user-storage/__fixtures__/mockMessenger.mjs.map +0 -1
  70. package/dist/controllers/user-storage/__fixtures__/mockResponses.cjs.map +0 -1
  71. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.cts.map +0 -1
  72. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.mts.map +0 -1
  73. package/dist/controllers/user-storage/__fixtures__/mockResponses.mjs.map +0 -1
  74. package/dist/controllers/user-storage/__fixtures__/mockServices.cjs +0 -82
  75. package/dist/controllers/user-storage/__fixtures__/mockServices.cjs.map +0 -1
  76. package/dist/controllers/user-storage/__fixtures__/mockServices.d.cts +0 -15
  77. package/dist/controllers/user-storage/__fixtures__/mockServices.d.cts.map +0 -1
  78. package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts +0 -15
  79. package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts.map +0 -1
  80. package/dist/controllers/user-storage/__fixtures__/mockServices.mjs +0 -76
  81. package/dist/controllers/user-storage/__fixtures__/mockServices.mjs.map +0 -1
  82. package/dist/controllers/user-storage/__fixtures__/mockStorage.cjs.map +0 -1
  83. package/dist/controllers/user-storage/__fixtures__/mockStorage.d.cts.map +0 -1
  84. package/dist/controllers/user-storage/__fixtures__/mockStorage.d.mts.map +0 -1
  85. package/dist/controllers/user-storage/__fixtures__/mockStorage.mjs.map +0 -1
  86. package/dist/controllers/user-storage/__fixtures__/test-utils.cjs +0 -78
  87. package/dist/controllers/user-storage/__fixtures__/test-utils.cjs.map +0 -1
  88. package/dist/controllers/user-storage/__fixtures__/test-utils.d.cts +0 -38
  89. package/dist/controllers/user-storage/__fixtures__/test-utils.d.cts.map +0 -1
  90. package/dist/controllers/user-storage/__fixtures__/test-utils.d.mts +0 -38
  91. package/dist/controllers/user-storage/__fixtures__/test-utils.d.mts.map +0 -1
  92. package/dist/controllers/user-storage/__fixtures__/test-utils.mjs +0 -68
  93. package/dist/controllers/user-storage/__fixtures__/test-utils.mjs.map +0 -1
  94. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.cjs +0 -178
  95. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.cjs.map +0 -1
  96. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.cts +0 -91
  97. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.cts.map +0 -1
  98. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.mts +0 -91
  99. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.mts.map +0 -1
  100. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.mjs +0 -174
  101. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.mjs.map +0 -1
  102. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.cjs +0 -58
  103. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.cjs.map +0 -1
  104. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.cts +0 -87
  105. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.cts.map +0 -1
  106. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.mts +0 -87
  107. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.mts.map +0 -1
  108. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.mjs +0 -52
  109. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.mjs.map +0 -1
  110. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.cjs +0 -43
  111. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.cjs.map +0 -1
  112. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.cts +0 -11
  113. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.cts.map +0 -1
  114. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.mts +0 -11
  115. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.mts.map +0 -1
  116. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.mjs +0 -36
  117. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.mjs.map +0 -1
  118. package/dist/sdk/__fixtures__/mock-auth.cjs +0 -124
  119. package/dist/sdk/__fixtures__/mock-auth.cjs.map +0 -1
  120. package/dist/sdk/__fixtures__/mock-auth.d.cts +0 -42
  121. package/dist/sdk/__fixtures__/mock-auth.d.cts.map +0 -1
  122. package/dist/sdk/__fixtures__/mock-auth.d.mts +0 -42
  123. package/dist/sdk/__fixtures__/mock-auth.d.mts.map +0 -1
  124. package/dist/sdk/__fixtures__/mock-auth.mjs +0 -119
  125. package/dist/sdk/__fixtures__/mock-auth.mjs.map +0 -1
  126. package/dist/sdk/__fixtures__/mock-userstorage.cjs +0 -111
  127. package/dist/sdk/__fixtures__/mock-userstorage.cjs.map +0 -1
  128. package/dist/sdk/__fixtures__/mock-userstorage.d.cts +0 -20
  129. package/dist/sdk/__fixtures__/mock-userstorage.d.cts.map +0 -1
  130. package/dist/sdk/__fixtures__/mock-userstorage.d.mts +0 -20
  131. package/dist/sdk/__fixtures__/mock-userstorage.d.mts.map +0 -1
  132. package/dist/sdk/__fixtures__/mock-userstorage.mjs +0 -81
  133. package/dist/sdk/__fixtures__/mock-userstorage.mjs.map +0 -1
  134. package/dist/sdk/__fixtures__/test-utils.cjs +0 -90
  135. package/dist/sdk/__fixtures__/test-utils.cjs.map +0 -1
  136. package/dist/sdk/__fixtures__/test-utils.d.cts +0 -37
  137. package/dist/sdk/__fixtures__/test-utils.d.cts.map +0 -1
  138. package/dist/sdk/__fixtures__/test-utils.d.mts +0 -37
  139. package/dist/sdk/__fixtures__/test-utils.d.mts.map +0 -1
  140. package/dist/sdk/__fixtures__/test-utils.mjs +0 -84
  141. package/dist/sdk/__fixtures__/test-utils.mjs.map +0 -1
  142. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.cjs +0 -0
  143. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.d.cts +0 -0
  144. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.d.mts +0 -0
  145. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.mjs +0 -0
  146. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.cjs +0 -0
  147. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.d.cts +0 -0
  148. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.d.mts +0 -0
  149. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.mjs +0 -0
  150. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.cjs +0 -0
  151. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.d.cts +0 -0
  152. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.d.mts +0 -0
  153. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.mjs +0 -0
  154. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.cjs +0 -0
  155. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.d.cts +0 -0
  156. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.d.mts +0 -0
  157. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.mjs +0 -0
  158. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.cjs +0 -0
  159. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.d.cts +0 -0
  160. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.d.mts +0 -0
  161. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.mjs +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockResponses.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockResponses.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,gCAAgC,EAChC,8BAA8B,EAC/B,2CAAuC;AAKxC,OAAO,KAAK,EACV,uCAAuC,EACvC,sBAAsB,EACvB,wBAAoB;AASrB,eAAO,MAAM,0BAA0B,SAC/B,gCAAgC,GAAG,8BAA8B,WAUxE,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,sBAAsB,CAAC,CAKjC;AAED;;;;;GAKG;AACH,wBAAsB,mCAAmC,CACvD,OAAO,GAAE,MAAM,EAAwB,GACtC,OAAO,CAAC,uCAAuC,CAAC,CAWlD;AAED;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,GAAE,gCAAsG;;;;GAO7G;AAED;;;;;;GAMG;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 +0,0 @@
1
- {"version":3,"file":"mockResponses.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockResponses.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,gCAAgC,EAChC,8BAA8B,EAC/B,2CAAuC;AAKxC,OAAO,KAAK,EACV,uCAAuC,EACvC,sBAAsB,EACvB,wBAAoB;AASrB,eAAO,MAAM,0BAA0B,SAC/B,gCAAgC,GAAG,8BAA8B,WAUxE,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,sBAAsB,CAAC,CAKjC;AAED;;;;;GAKG;AACH,wBAAsB,mCAAmC,CACvD,OAAO,GAAE,MAAM,EAAwB,GACtC,OAAO,CAAC,uCAAuC,CAAC,CAWlD;AAED;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,GAAE,gCAAsG;;;;GAO7G;AAED;;;;;;GAMG;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 +0,0 @@
1
- {"version":3,"file":"mockResponses.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockResponses.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,gBAAgB,EACjB,0BAAsB;AAKv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AQ;QACvB,QAAQ,EAAE,IAAI;KACQ,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import {\n MOCK_ENCRYPTED_STORAGE_DATA,\n MOCK_STORAGE_DATA,\n MOCK_STORAGE_KEY,\n} from './mockStorage';\nimport 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';\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 *\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 *\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 const decryptedData = [];\n\n for (const data of dataArr) {\n decryptedData.push({\n HashedKey: 'HASHED_KEY',\n Data: await MOCK_ENCRYPTED_STORAGE_DATA(data),\n });\n }\n\n return decryptedData;\n}\n\n/**\n * Creates a mock user-storage api GET request\n *\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 *\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"]}
@@ -1,82 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.mockEndpointBatchDeleteUserStorage = exports.mockEndpointDeleteUserStorageAllFeatureEntries = exports.mockEndpointDeleteUserStorage = exports.mockEndpointBatchUpsertUserStorage = exports.mockEndpointUpsertUserStorage = exports.mockEndpointGetUserStorage = exports.mockEndpointGetUserStorageAllFeatureEntries = void 0;
7
- const nock_1 = __importDefault(require("nock"));
8
- const mockResponses_1 = require("./mockResponses.cjs");
9
- const storage_schema_1 = require("../../../shared/storage-schema.cjs");
10
- const mockEndpointGetUserStorageAllFeatureEntries = async (path = storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications, mockReply) => {
11
- const mockResponse = await (0, mockResponses_1.getMockUserStorageAllFeatureEntriesResponse)(path);
12
- const reply = mockReply ?? {
13
- status: 200,
14
- body: mockResponse.response,
15
- };
16
- const mockEndpoint = (0, nock_1.default)(mockResponse.url)
17
- .get('')
18
- .reply(reply.status, reply.body);
19
- return mockEndpoint;
20
- };
21
- exports.mockEndpointGetUserStorageAllFeatureEntries = mockEndpointGetUserStorageAllFeatureEntries;
22
- const mockEndpointGetUserStorage = async (path = `${storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`, mockReply) => {
23
- const mockResponse = await (0, mockResponses_1.getMockUserStorageGetResponse)(path);
24
- const reply = mockReply ?? {
25
- status: 200,
26
- body: mockResponse.response,
27
- };
28
- const mockEndpoint = (0, nock_1.default)(mockResponse.url)
29
- .get('')
30
- .reply(reply.status, reply.body);
31
- return mockEndpoint;
32
- };
33
- exports.mockEndpointGetUserStorage = mockEndpointGetUserStorage;
34
- const mockEndpointUpsertUserStorage = (path = `${storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`, mockReply, expectCallback) => {
35
- const mockResponse = (0, mockResponses_1.getMockUserStoragePutResponse)(path);
36
- const mockEndpoint = (0, nock_1.default)(mockResponse.url)
37
- .put('')
38
- .reply(mockReply?.status ?? 204, async (_, requestBody) => {
39
- await expectCallback?.(requestBody);
40
- });
41
- return mockEndpoint;
42
- };
43
- exports.mockEndpointUpsertUserStorage = mockEndpointUpsertUserStorage;
44
- const mockEndpointBatchUpsertUserStorage = (path = storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications, mockReply, callback) => {
45
- const mockResponse = (0, mockResponses_1.getMockUserStorageBatchPutResponse)(path);
46
- const mockEndpoint = (0, nock_1.default)(mockResponse.url)
47
- .put('')
48
- .reply(mockReply?.status ?? 204, async (uri, requestBody) => {
49
- return await callback?.(uri, requestBody);
50
- });
51
- return mockEndpoint;
52
- };
53
- exports.mockEndpointBatchUpsertUserStorage = mockEndpointBatchUpsertUserStorage;
54
- const mockEndpointDeleteUserStorage = (path = `${storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`, mockReply) => {
55
- const mockResponse = (0, mockResponses_1.deleteMockUserStorageResponse)(path);
56
- const reply = mockReply ?? {
57
- status: 200,
58
- };
59
- const mockEndpoint = (0, nock_1.default)(mockResponse.url).delete('').reply(reply.status);
60
- return mockEndpoint;
61
- };
62
- exports.mockEndpointDeleteUserStorage = mockEndpointDeleteUserStorage;
63
- const mockEndpointDeleteUserStorageAllFeatureEntries = (path = storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications, mockReply) => {
64
- const mockResponse = (0, mockResponses_1.deleteMockUserStorageAllFeatureEntriesResponse)(path);
65
- const reply = mockReply ?? {
66
- status: 200,
67
- };
68
- const mockEndpoint = (0, nock_1.default)(mockResponse.url).delete('').reply(reply.status);
69
- return mockEndpoint;
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;
82
- //# sourceMappingURL=mockServices.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockServices.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockServices.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAQyB;AACzB,uEAIwC;AAOjC,MAAM,2CAA2C,GAAG,KAAK,EAC9D,OAAuC,2CAA0B,CAAC,aAAa,EAC/E,SAAqB,EACrB,EAAE;IACF,MAAM,YAAY,GAAG,MAAM,IAAA,2DAA2C,EAAC,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,IAAA,cAAI,EAAC,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;AAfW,QAAA,2CAA2C,+CAetD;AAEK,MAAM,0BAA0B,GAAG,KAAK,EAC7C,OAAyC,GAAG,2CAA0B,CAAC,aAAa,wBAAwB,EAC5G,SAAqB,EACrB,EAAE;IACF,MAAM,YAAY,GAAG,MAAM,IAAA,6CAA6B,EAAC,IAAI,CAAC,CAAC;IAC/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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 getMockUserStorageGetResponse,\n getMockUserStoragePutResponse,\n getMockUserStorageAllFeatureEntriesResponse,\n getMockUserStorageBatchPutResponse,\n getMockUserStorageBatchDeleteResponse,\n deleteMockUserStorageAllFeatureEntriesResponse,\n deleteMockUserStorageResponse,\n} from './mockResponses';\nimport {\n USER_STORAGE_FEATURE_NAMES,\n type UserStoragePathWithFeatureAndKey,\n type UserStoragePathWithFeatureOnly,\n} from '../../../shared/storage-schema';\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,15 +0,0 @@
1
- import nock from "nock";
2
- import { type UserStoragePathWithFeatureAndKey, type UserStoragePathWithFeatureOnly } from "../../../shared/storage-schema.cjs";
3
- type MockReply = {
4
- status: nock.StatusCode;
5
- body?: nock.Body;
6
- };
7
- export declare const mockEndpointGetUserStorageAllFeatureEntries: (path?: UserStoragePathWithFeatureOnly, mockReply?: MockReply) => Promise<nock.Scope>;
8
- export declare const mockEndpointGetUserStorage: (path?: UserStoragePathWithFeatureAndKey, mockReply?: MockReply) => Promise<nock.Scope>;
9
- export declare const mockEndpointUpsertUserStorage: (path?: UserStoragePathWithFeatureAndKey, mockReply?: Pick<MockReply, 'status'>, expectCallback?: ((requestBody: nock.Body) => Promise<void>) | undefined) => nock.Scope;
10
- export declare const mockEndpointBatchUpsertUserStorage: (path?: UserStoragePathWithFeatureOnly, mockReply?: Pick<MockReply, 'status'>, callback?: ((uri: string, requestBody: nock.Body) => Promise<void>) | undefined) => nock.Scope;
11
- export declare const mockEndpointDeleteUserStorage: (path?: UserStoragePathWithFeatureAndKey, mockReply?: MockReply) => nock.Scope;
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;
14
- export {};
15
- //# sourceMappingURL=mockServices.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockServices.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockServices.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,aAAa;AAWxB,OAAO,EAEL,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACpC,2CAAuC;AAExC,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,15 +0,0 @@
1
- import nock from "nock";
2
- import { type UserStoragePathWithFeatureAndKey, type UserStoragePathWithFeatureOnly } from "../../../shared/storage-schema.mjs";
3
- type MockReply = {
4
- status: nock.StatusCode;
5
- body?: nock.Body;
6
- };
7
- export declare const mockEndpointGetUserStorageAllFeatureEntries: (path?: UserStoragePathWithFeatureOnly, mockReply?: MockReply) => Promise<nock.Scope>;
8
- export declare const mockEndpointGetUserStorage: (path?: UserStoragePathWithFeatureAndKey, mockReply?: MockReply) => Promise<nock.Scope>;
9
- export declare const mockEndpointUpsertUserStorage: (path?: UserStoragePathWithFeatureAndKey, mockReply?: Pick<MockReply, 'status'>, expectCallback?: ((requestBody: nock.Body) => Promise<void>) | undefined) => nock.Scope;
10
- export declare const mockEndpointBatchUpsertUserStorage: (path?: UserStoragePathWithFeatureOnly, mockReply?: Pick<MockReply, 'status'>, callback?: ((uri: string, requestBody: nock.Body) => Promise<void>) | undefined) => nock.Scope;
11
- export declare const mockEndpointDeleteUserStorage: (path?: UserStoragePathWithFeatureAndKey, mockReply?: MockReply) => nock.Scope;
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;
14
- export {};
15
- //# sourceMappingURL=mockServices.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockServices.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockServices.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,aAAa;AAWxB,OAAO,EAEL,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACpC,2CAAuC;AAExC,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,76 +0,0 @@
1
- function $importDefault(module) {
2
- if (module?.__esModule) {
3
- return module.default;
4
- }
5
- return module;
6
- }
7
- import $nock from "nock";
8
- const nock = $importDefault($nock);
9
- import { getMockUserStorageGetResponse, getMockUserStoragePutResponse, getMockUserStorageAllFeatureEntriesResponse, getMockUserStorageBatchPutResponse, getMockUserStorageBatchDeleteResponse, deleteMockUserStorageAllFeatureEntriesResponse, deleteMockUserStorageResponse } from "./mockResponses.mjs";
10
- import { USER_STORAGE_FEATURE_NAMES } from "../../../shared/storage-schema.mjs";
11
- export const mockEndpointGetUserStorageAllFeatureEntries = async (path = USER_STORAGE_FEATURE_NAMES.notifications, mockReply) => {
12
- const mockResponse = await getMockUserStorageAllFeatureEntriesResponse(path);
13
- const reply = mockReply ?? {
14
- status: 200,
15
- body: mockResponse.response,
16
- };
17
- const mockEndpoint = nock(mockResponse.url)
18
- .get('')
19
- .reply(reply.status, reply.body);
20
- return mockEndpoint;
21
- };
22
- export const mockEndpointGetUserStorage = async (path = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`, mockReply) => {
23
- const mockResponse = await getMockUserStorageGetResponse(path);
24
- const reply = mockReply ?? {
25
- status: 200,
26
- body: mockResponse.response,
27
- };
28
- const mockEndpoint = nock(mockResponse.url)
29
- .get('')
30
- .reply(reply.status, reply.body);
31
- return mockEndpoint;
32
- };
33
- export const mockEndpointUpsertUserStorage = (path = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`, mockReply, expectCallback) => {
34
- const mockResponse = getMockUserStoragePutResponse(path);
35
- const mockEndpoint = nock(mockResponse.url)
36
- .put('')
37
- .reply(mockReply?.status ?? 204, async (_, requestBody) => {
38
- await expectCallback?.(requestBody);
39
- });
40
- return mockEndpoint;
41
- };
42
- export const mockEndpointBatchUpsertUserStorage = (path = USER_STORAGE_FEATURE_NAMES.notifications, mockReply, callback) => {
43
- const mockResponse = getMockUserStorageBatchPutResponse(path);
44
- const mockEndpoint = nock(mockResponse.url)
45
- .put('')
46
- .reply(mockReply?.status ?? 204, async (uri, requestBody) => {
47
- return await callback?.(uri, requestBody);
48
- });
49
- return mockEndpoint;
50
- };
51
- export const mockEndpointDeleteUserStorage = (path = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`, mockReply) => {
52
- const mockResponse = deleteMockUserStorageResponse(path);
53
- const reply = mockReply ?? {
54
- status: 200,
55
- };
56
- const mockEndpoint = nock(mockResponse.url).delete('').reply(reply.status);
57
- return mockEndpoint;
58
- };
59
- export const mockEndpointDeleteUserStorageAllFeatureEntries = (path = USER_STORAGE_FEATURE_NAMES.notifications, mockReply) => {
60
- const mockResponse = deleteMockUserStorageAllFeatureEntriesResponse(path);
61
- const reply = mockReply ?? {
62
- status: 200,
63
- };
64
- const mockEndpoint = nock(mockResponse.url).delete('').reply(reply.status);
65
- return mockEndpoint;
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
- };
76
- //# sourceMappingURL=mockServices.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockServices.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockServices.ts"],"names":[],"mappings":";;;;;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,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,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 getMockUserStorageGetResponse,\n getMockUserStoragePutResponse,\n getMockUserStorageAllFeatureEntriesResponse,\n getMockUserStorageBatchPutResponse,\n getMockUserStorageBatchDeleteResponse,\n deleteMockUserStorageAllFeatureEntriesResponse,\n deleteMockUserStorageResponse,\n} from './mockResponses';\nimport {\n USER_STORAGE_FEATURE_NAMES,\n type UserStoragePathWithFeatureAndKey,\n type UserStoragePathWithFeatureOnly,\n} from '../../../shared/storage-schema';\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 +0,0 @@
1
- {"version":3,"file":"mockStorage.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mFAA0E;AAE7D,QAAA,0BAA0B,GAAG,gBAAgB,CAAC;AAC9C,QAAA,gBAAgB,GAAG,IAAA,6BAAgB,EAAC,kCAA0B,CAAC,CAAC;AAChE,QAAA,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;AAEpE,sFAAsF;AACtF,kHAAkH;AAClH,IAAI,uBAA+B,CAAC;AAC7B,MAAM,2BAA2B,GAAG,KAAK,EAAE,IAAa,EAAE,EAAE,CACjE,CAAC,uBAAuB,KAAvB,uBAAuB,GAAK,MAAM,oBAAU,CAAC,aAAa,CACzD,IAAI,IAAI,yBAAiB,EACzB,wBAAgB,CACjB,EAAC,CAAC;AAJQ,QAAA,2BAA2B,+BAInC","sourcesContent":["import encryption, { createSHA256Hash } from '../../../shared/encryption';\n\nexport const MOCK_STORAGE_KEY_SIGNATURE = 'mockStorageKey';\nexport const MOCK_STORAGE_KEY = createSHA256Hash(MOCK_STORAGE_KEY_SIGNATURE);\nexport const MOCK_STORAGE_DATA = JSON.stringify({ hello: 'world' });\n\n// NOTE - using encryption.encryptString directly in fixtures causes issues on mobile.\n// This is because this fixture is getting added in at run time. Will be improved once we support multiple exports\nlet cachedMockEncryptedData: string;\nexport const MOCK_ENCRYPTED_STORAGE_DATA = async (data?: string) =>\n (cachedMockEncryptedData ??= await encryption.encryptString(\n data ?? MOCK_STORAGE_DATA,\n MOCK_STORAGE_KEY,\n ));\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockStorage.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockStorage.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAC3D,eAAO,MAAM,gBAAgB,QAA+C,CAAC;AAC7E,eAAO,MAAM,iBAAiB,QAAqC,CAAC;AAKpE,eAAO,MAAM,2BAA2B,UAAiB,MAAM,oBAI3D,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockStorage.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockStorage.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAC3D,eAAO,MAAM,gBAAgB,QAA+C,CAAC;AAC7E,eAAO,MAAM,iBAAiB,QAAqC,CAAC;AAKpE,eAAO,MAAM,2BAA2B,UAAiB,MAAM,oBAI3D,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockStorage.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/mockStorage.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAE,gBAAgB,EAAE,6CAAmC;AAE1E,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AAC3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,0BAA0B,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;AAEpE,sFAAsF;AACtF,kHAAkH;AAClH,IAAI,uBAA+B,CAAC;AACpC,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,EAAE,IAAa,EAAE,EAAE,CACjE,CAAC,uBAAuB,KAAvB,uBAAuB,GAAK,MAAM,UAAU,CAAC,aAAa,CACzD,IAAI,IAAI,iBAAiB,EACzB,gBAAgB,CACjB,EAAC,CAAC","sourcesContent":["import encryption, { createSHA256Hash } from '../../../shared/encryption';\n\nexport const MOCK_STORAGE_KEY_SIGNATURE = 'mockStorageKey';\nexport const MOCK_STORAGE_KEY = createSHA256Hash(MOCK_STORAGE_KEY_SIGNATURE);\nexport const MOCK_STORAGE_DATA = JSON.stringify({ hello: 'world' });\n\n// NOTE - using encryption.encryptString directly in fixtures causes issues on mobile.\n// This is because this fixture is getting added in at run time. Will be improved once we support multiple exports\nlet cachedMockEncryptedData: string;\nexport const MOCK_ENCRYPTED_STORAGE_DATA = async (data?: string) =>\n (cachedMockEncryptedData ??= await encryption.encryptString(\n data ?? MOCK_STORAGE_DATA,\n MOCK_STORAGE_KEY,\n ));\n"]}
@@ -1,78 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.waitFor = exports.decryptBatchUpsertBody = exports.createMockUserStorageEntries = exports.createMockUserStorageEntry = void 0;
7
- const mockStorage_1 = require("./mockStorage.cjs");
8
- const encryption_1 = __importDefault(require("../../../shared/encryption/encryption.cjs"));
9
- /**
10
- * Test Utility - creates a realistic mock user-storage entry
11
- *
12
- * @param data - data to encrypt
13
- * @returns user storage entry
14
- */
15
- async function createMockUserStorageEntry(data) {
16
- return {
17
- HashedKey: 'HASHED_KEY',
18
- Data: await encryption_1.default.encryptString(JSON.stringify(data), mockStorage_1.MOCK_STORAGE_KEY),
19
- };
20
- }
21
- exports.createMockUserStorageEntry = createMockUserStorageEntry;
22
- /**
23
- * Test Utility - creates a realistic mock user-storage get-all entry
24
- *
25
- * @param data - data array to encrypt
26
- * @returns user storage entry
27
- */
28
- async function createMockUserStorageEntries(data) {
29
- return await Promise.all(data.map((d) => createMockUserStorageEntry(d)));
30
- }
31
- exports.createMockUserStorageEntries = createMockUserStorageEntries;
32
- /**
33
- * Test Utility - decrypts a realistic batch upsert payload
34
- *
35
- * @param requestBody - nock body
36
- * @param storageKey - storage key
37
- * @returns decrypted body
38
- */
39
- async function decryptBatchUpsertBody(requestBody, storageKey) {
40
- if (typeof requestBody === 'string') {
41
- return requestBody;
42
- }
43
- return await Promise.all(Object.entries(requestBody.data).map(async ([entryKey, entryValue]) => {
44
- return [
45
- entryKey,
46
- await encryption_1.default.decryptString(entryValue, storageKey),
47
- ];
48
- }));
49
- }
50
- exports.decryptBatchUpsertBody = decryptBatchUpsertBody;
51
- /**
52
- * Testing Utility - waitFor. Waits for and checks (at an interval) if assertion is reached.
53
- *
54
- * @param assertionFn - assertion function
55
- * @param options - set wait for options
56
- * @returns promise that you need to await in tests
57
- */
58
- const waitFor = async (assertionFn, options = {}) => {
59
- const { intervalMs = 50, timeoutMs = 2000 } = options;
60
- const startTime = Date.now();
61
- return new Promise((resolve, reject) => {
62
- const intervalId = setInterval(() => {
63
- try {
64
- assertionFn();
65
- clearInterval(intervalId);
66
- resolve();
67
- }
68
- catch {
69
- if (Date.now() - startTime >= timeoutMs) {
70
- clearInterval(intervalId);
71
- reject(new Error(`waitFor: timeout reached after ${timeoutMs}ms`));
72
- }
73
- }
74
- }, intervalMs);
75
- });
76
- };
77
- exports.waitFor = waitFor;
78
- //# sourceMappingURL=test-utils.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-utils.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/test-utils.ts"],"names":[],"mappings":";;;;;;AAEA,mDAAiD;AACjD,2FAA+D;AAM/D;;;;;GAKG;AACI,KAAK,UAAU,0BAA0B,CAC9C,IAAa;IAEb,OAAO;QACL,SAAS,EAAE,YAAY;QACvB,IAAI,EAAE,MAAM,oBAAU,CAAC,aAAa,CAClC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EACpB,8BAAgB,CACjB;KACF,CAAC;AACJ,CAAC;AAVD,gEAUC;AAED;;;;;GAKG;AACI,KAAK,UAAU,4BAA4B,CAChD,IAAe;IAEf,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3E,CAAC;AAJD,oEAIC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,sBAAsB,CAC1C,WAAsB,EACtB,UAAkB;IAElB,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACnC,OAAO,WAAW,CAAC;KACpB;IACD,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,MAAM,CAAC,OAAO,CAAS,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,CAC1C,KAAK,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,EAAE;QAC/B,OAAO;YACL,QAAQ;YACR,MAAM,oBAAU,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,CAAC;SACvD,CAAC;IACJ,CAAC,CACF,CACF,CAAC;AACJ,CAAC;AAjBD,wDAiBC;AAOD;;;;;;GAMG;AACI,MAAM,OAAO,GAAG,KAAK,EAC1B,WAAuB,EACvB,UAA0B,EAAE,EACb,EAAE;IACjB,MAAM,EAAE,UAAU,GAAG,EAAE,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAEtD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;YAClC,IAAI;gBACF,WAAW,EAAE,CAAC;gBACd,aAAa,CAAC,UAAU,CAAC,CAAC;gBAC1B,OAAO,EAAE,CAAC;aACX;YAAC,MAAM;gBACN,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,IAAI,SAAS,EAAE;oBACvC,aAAa,CAAC,UAAU,CAAC,CAAC;oBAC1B,MAAM,CAAC,IAAI,KAAK,CAAC,kCAAkC,SAAS,IAAI,CAAC,CAAC,CAAC;iBACpE;aACF;QACH,CAAC,EAAE,UAAU,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAtBW,QAAA,OAAO,WAsBlB","sourcesContent":["import type nock from 'nock';\n\nimport { MOCK_STORAGE_KEY } from './mockStorage';\nimport encryption from '../../../shared/encryption/encryption';\nimport type {\n GetUserStorageAllFeatureEntriesResponse,\n GetUserStorageResponse,\n} from '../services';\n\n/**\n * Test Utility - creates a realistic mock user-storage entry\n *\n * @param data - data to encrypt\n * @returns user storage entry\n */\nexport async function createMockUserStorageEntry(\n data: unknown,\n): Promise<GetUserStorageResponse> {\n return {\n HashedKey: 'HASHED_KEY',\n Data: await encryption.encryptString(\n JSON.stringify(data),\n MOCK_STORAGE_KEY,\n ),\n };\n}\n\n/**\n * Test Utility - creates a realistic mock user-storage get-all entry\n *\n * @param data - data array to encrypt\n * @returns user storage entry\n */\nexport async function createMockUserStorageEntries(\n data: unknown[],\n): Promise<GetUserStorageAllFeatureEntriesResponse> {\n return await Promise.all(data.map((d) => createMockUserStorageEntry(d)));\n}\n\n/**\n * Test Utility - decrypts a realistic batch upsert payload\n *\n * @param requestBody - nock body\n * @param storageKey - storage key\n * @returns decrypted body\n */\nexport async function decryptBatchUpsertBody(\n requestBody: nock.Body,\n storageKey: string,\n) {\n if (typeof requestBody === 'string') {\n return requestBody;\n }\n return await Promise.all(\n Object.entries<string>(requestBody.data).map(\n async ([entryKey, entryValue]) => {\n return [\n entryKey,\n await encryption.decryptString(entryValue, storageKey),\n ];\n },\n ),\n );\n}\n\ntype WaitForOptions = {\n intervalMs?: number;\n timeoutMs?: number;\n};\n\n/**\n * Testing Utility - waitFor. Waits for and checks (at an interval) if assertion is reached.\n *\n * @param assertionFn - assertion function\n * @param options - set wait for options\n * @returns promise that you need to await in tests\n */\nexport const waitFor = async (\n assertionFn: () => void,\n options: WaitForOptions = {},\n): Promise<void> => {\n const { intervalMs = 50, timeoutMs = 2000 } = options;\n\n const startTime = Date.now();\n\n return new Promise<void>((resolve, reject) => {\n const intervalId = setInterval(() => {\n try {\n assertionFn();\n clearInterval(intervalId);\n resolve();\n } catch {\n if (Date.now() - startTime >= timeoutMs) {\n clearInterval(intervalId);\n reject(new Error(`waitFor: timeout reached after ${timeoutMs}ms`));\n }\n }\n }, intervalMs);\n });\n};\n"]}
@@ -1,38 +0,0 @@
1
- import type nock from "nock";
2
- import type { GetUserStorageAllFeatureEntriesResponse, GetUserStorageResponse } from "../services.cjs";
3
- /**
4
- * Test Utility - creates a realistic mock user-storage entry
5
- *
6
- * @param data - data to encrypt
7
- * @returns user storage entry
8
- */
9
- export declare function createMockUserStorageEntry(data: unknown): Promise<GetUserStorageResponse>;
10
- /**
11
- * Test Utility - creates a realistic mock user-storage get-all entry
12
- *
13
- * @param data - data array to encrypt
14
- * @returns user storage entry
15
- */
16
- export declare function createMockUserStorageEntries(data: unknown[]): Promise<GetUserStorageAllFeatureEntriesResponse>;
17
- /**
18
- * Test Utility - decrypts a realistic batch upsert payload
19
- *
20
- * @param requestBody - nock body
21
- * @param storageKey - storage key
22
- * @returns decrypted body
23
- */
24
- export declare function decryptBatchUpsertBody(requestBody: nock.Body, storageKey: string): Promise<string | string[][]>;
25
- type WaitForOptions = {
26
- intervalMs?: number;
27
- timeoutMs?: number;
28
- };
29
- /**
30
- * Testing Utility - waitFor. Waits for and checks (at an interval) if assertion is reached.
31
- *
32
- * @param assertionFn - assertion function
33
- * @param options - set wait for options
34
- * @returns promise that you need to await in tests
35
- */
36
- export declare const waitFor: (assertionFn: () => void, options?: WaitForOptions) => Promise<void>;
37
- export {};
38
- //# sourceMappingURL=test-utils.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-utils.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,aAAa;AAI7B,OAAO,KAAK,EACV,uCAAuC,EACvC,sBAAsB,EACvB,wBAAoB;AAErB;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,sBAAsB,CAAC,CAQjC;AAED;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,OAAO,EAAE,GACd,OAAO,CAAC,uCAAuC,CAAC,CAElD;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,IAAI,CAAC,IAAI,EACtB,UAAU,EAAE,MAAM,gCAenB;AAED,KAAK,cAAc,GAAG;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,gBACL,MAAM,IAAI,YACd,cAAc,KACtB,QAAQ,IAAI,CAmBd,CAAC"}
@@ -1,38 +0,0 @@
1
- import type nock from "nock";
2
- import type { GetUserStorageAllFeatureEntriesResponse, GetUserStorageResponse } from "../services.mjs";
3
- /**
4
- * Test Utility - creates a realistic mock user-storage entry
5
- *
6
- * @param data - data to encrypt
7
- * @returns user storage entry
8
- */
9
- export declare function createMockUserStorageEntry(data: unknown): Promise<GetUserStorageResponse>;
10
- /**
11
- * Test Utility - creates a realistic mock user-storage get-all entry
12
- *
13
- * @param data - data array to encrypt
14
- * @returns user storage entry
15
- */
16
- export declare function createMockUserStorageEntries(data: unknown[]): Promise<GetUserStorageAllFeatureEntriesResponse>;
17
- /**
18
- * Test Utility - decrypts a realistic batch upsert payload
19
- *
20
- * @param requestBody - nock body
21
- * @param storageKey - storage key
22
- * @returns decrypted body
23
- */
24
- export declare function decryptBatchUpsertBody(requestBody: nock.Body, storageKey: string): Promise<string | string[][]>;
25
- type WaitForOptions = {
26
- intervalMs?: number;
27
- timeoutMs?: number;
28
- };
29
- /**
30
- * Testing Utility - waitFor. Waits for and checks (at an interval) if assertion is reached.
31
- *
32
- * @param assertionFn - assertion function
33
- * @param options - set wait for options
34
- * @returns promise that you need to await in tests
35
- */
36
- export declare const waitFor: (assertionFn: () => void, options?: WaitForOptions) => Promise<void>;
37
- export {};
38
- //# sourceMappingURL=test-utils.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-utils.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,aAAa;AAI7B,OAAO,KAAK,EACV,uCAAuC,EACvC,sBAAsB,EACvB,wBAAoB;AAErB;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,sBAAsB,CAAC,CAQjC;AAED;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,OAAO,EAAE,GACd,OAAO,CAAC,uCAAuC,CAAC,CAElD;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,IAAI,CAAC,IAAI,EACtB,UAAU,EAAE,MAAM,gCAenB;AAED,KAAK,cAAc,GAAG;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,gBACL,MAAM,IAAI,YACd,cAAc,KACtB,QAAQ,IAAI,CAmBd,CAAC"}
@@ -1,68 +0,0 @@
1
- import { MOCK_STORAGE_KEY } from "./mockStorage.mjs";
2
- import encryption from "../../../shared/encryption/encryption.mjs";
3
- /**
4
- * Test Utility - creates a realistic mock user-storage entry
5
- *
6
- * @param data - data to encrypt
7
- * @returns user storage entry
8
- */
9
- export async function createMockUserStorageEntry(data) {
10
- return {
11
- HashedKey: 'HASHED_KEY',
12
- Data: await encryption.encryptString(JSON.stringify(data), MOCK_STORAGE_KEY),
13
- };
14
- }
15
- /**
16
- * Test Utility - creates a realistic mock user-storage get-all entry
17
- *
18
- * @param data - data array to encrypt
19
- * @returns user storage entry
20
- */
21
- export async function createMockUserStorageEntries(data) {
22
- return await Promise.all(data.map((d) => createMockUserStorageEntry(d)));
23
- }
24
- /**
25
- * Test Utility - decrypts a realistic batch upsert payload
26
- *
27
- * @param requestBody - nock body
28
- * @param storageKey - storage key
29
- * @returns decrypted body
30
- */
31
- export async function decryptBatchUpsertBody(requestBody, storageKey) {
32
- if (typeof requestBody === 'string') {
33
- return requestBody;
34
- }
35
- return await Promise.all(Object.entries(requestBody.data).map(async ([entryKey, entryValue]) => {
36
- return [
37
- entryKey,
38
- await encryption.decryptString(entryValue, storageKey),
39
- ];
40
- }));
41
- }
42
- /**
43
- * Testing Utility - waitFor. Waits for and checks (at an interval) if assertion is reached.
44
- *
45
- * @param assertionFn - assertion function
46
- * @param options - set wait for options
47
- * @returns promise that you need to await in tests
48
- */
49
- export const waitFor = async (assertionFn, options = {}) => {
50
- const { intervalMs = 50, timeoutMs = 2000 } = options;
51
- const startTime = Date.now();
52
- return new Promise((resolve, reject) => {
53
- const intervalId = setInterval(() => {
54
- try {
55
- assertionFn();
56
- clearInterval(intervalId);
57
- resolve();
58
- }
59
- catch {
60
- if (Date.now() - startTime >= timeoutMs) {
61
- clearInterval(intervalId);
62
- reject(new Error(`waitFor: timeout reached after ${timeoutMs}ms`));
63
- }
64
- }
65
- }, intervalMs);
66
- });
67
- };
68
- //# sourceMappingURL=test-utils.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-utils.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/__fixtures__/test-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,0BAAsB;AACjD,OAAO,UAAU,kDAA8C;AAM/D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,IAAa;IAEb,OAAO;QACL,SAAS,EAAE,YAAY;QACvB,IAAI,EAAE,MAAM,UAAU,CAAC,aAAa,CAClC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EACpB,gBAAgB,CACjB;KACF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,IAAe;IAEf,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,WAAsB,EACtB,UAAkB;IAElB,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACnC,OAAO,WAAW,CAAC;KACpB;IACD,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,MAAM,CAAC,OAAO,CAAS,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,CAC1C,KAAK,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,EAAE;QAC/B,OAAO;YACL,QAAQ;YACR,MAAM,UAAU,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,CAAC;SACvD,CAAC;IACJ,CAAC,CACF,CACF,CAAC;AACJ,CAAC;AAOD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAC1B,WAAuB,EACvB,UAA0B,EAAE,EACb,EAAE;IACjB,MAAM,EAAE,UAAU,GAAG,EAAE,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAEtD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;YAClC,IAAI;gBACF,WAAW,EAAE,CAAC;gBACd,aAAa,CAAC,UAAU,CAAC,CAAC;gBAC1B,OAAO,EAAE,CAAC;aACX;YAAC,MAAM;gBACN,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,IAAI,SAAS,EAAE;oBACvC,aAAa,CAAC,UAAU,CAAC,CAAC;oBAC1B,MAAM,CAAC,IAAI,KAAK,CAAC,kCAAkC,SAAS,IAAI,CAAC,CAAC,CAAC;iBACpE;aACF;QACH,CAAC,EAAE,UAAU,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type nock from 'nock';\n\nimport { MOCK_STORAGE_KEY } from './mockStorage';\nimport encryption from '../../../shared/encryption/encryption';\nimport type {\n GetUserStorageAllFeatureEntriesResponse,\n GetUserStorageResponse,\n} from '../services';\n\n/**\n * Test Utility - creates a realistic mock user-storage entry\n *\n * @param data - data to encrypt\n * @returns user storage entry\n */\nexport async function createMockUserStorageEntry(\n data: unknown,\n): Promise<GetUserStorageResponse> {\n return {\n HashedKey: 'HASHED_KEY',\n Data: await encryption.encryptString(\n JSON.stringify(data),\n MOCK_STORAGE_KEY,\n ),\n };\n}\n\n/**\n * Test Utility - creates a realistic mock user-storage get-all entry\n *\n * @param data - data array to encrypt\n * @returns user storage entry\n */\nexport async function createMockUserStorageEntries(\n data: unknown[],\n): Promise<GetUserStorageAllFeatureEntriesResponse> {\n return await Promise.all(data.map((d) => createMockUserStorageEntry(d)));\n}\n\n/**\n * Test Utility - decrypts a realistic batch upsert payload\n *\n * @param requestBody - nock body\n * @param storageKey - storage key\n * @returns decrypted body\n */\nexport async function decryptBatchUpsertBody(\n requestBody: nock.Body,\n storageKey: string,\n) {\n if (typeof requestBody === 'string') {\n return requestBody;\n }\n return await Promise.all(\n Object.entries<string>(requestBody.data).map(\n async ([entryKey, entryValue]) => {\n return [\n entryKey,\n await encryption.decryptString(entryValue, storageKey),\n ];\n },\n ),\n );\n}\n\ntype WaitForOptions = {\n intervalMs?: number;\n timeoutMs?: number;\n};\n\n/**\n * Testing Utility - waitFor. Waits for and checks (at an interval) if assertion is reached.\n *\n * @param assertionFn - assertion function\n * @param options - set wait for options\n * @returns promise that you need to await in tests\n */\nexport const waitFor = async (\n assertionFn: () => void,\n options: WaitForOptions = {},\n): Promise<void> => {\n const { intervalMs = 50, timeoutMs = 2000 } = options;\n\n const startTime = Date.now();\n\n return new Promise<void>((resolve, reject) => {\n const intervalId = setInterval(() => {\n try {\n assertionFn();\n clearInterval(intervalId);\n resolve();\n } catch {\n if (Date.now() - startTime >= timeoutMs) {\n clearInterval(intervalId);\n reject(new Error(`waitFor: timeout reached after ${timeoutMs}ms`));\n }\n }\n }, intervalMs);\n });\n};\n"]}