@casual-simulation/aux-records 3.4.6-alpha.14668890889 → 3.5.0-alpha.15119114602

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 (211) hide show
  1. package/AIController.js +835 -890
  2. package/AIController.js.map +1 -1
  3. package/AIHumeInterface.js +43 -54
  4. package/AIHumeInterface.js.map +1 -1
  5. package/AIOpenAIRealtimeInterface.js +60 -71
  6. package/AIOpenAIRealtimeInterface.js.map +1 -1
  7. package/AnthropicAIChatInterface.js +96 -142
  8. package/AnthropicAIChatInterface.js.map +1 -1
  9. package/AuthController.d.ts +3 -2
  10. package/AuthController.js +1907 -1933
  11. package/AuthController.js.map +1 -1
  12. package/AuthStore.d.ts +1 -10
  13. package/BlockadeLabsGenerateSkyboxInterface.js +57 -72
  14. package/BlockadeLabsGenerateSkyboxInterface.js.map +1 -1
  15. package/CachingConfigStore.js +30 -45
  16. package/CachingConfigStore.js.map +1 -1
  17. package/CachingPolicyStore.d.ts +8 -2
  18. package/CachingPolicyStore.js +108 -135
  19. package/CachingPolicyStore.js.map +1 -1
  20. package/ComIdConfig.d.ts +18 -18
  21. package/ComIdConfig.js.map +1 -1
  22. package/ConsoleAuthMessenger.js +7 -20
  23. package/ConsoleAuthMessenger.js.map +1 -1
  24. package/DataRecordsController.d.ts +2 -2
  25. package/DataRecordsController.js +369 -377
  26. package/DataRecordsController.js.map +1 -1
  27. package/DataRecordsStore.d.ts +1 -1
  28. package/DataRecordsStore.js +1 -1
  29. package/DataRecordsStore.js.map +1 -1
  30. package/EventRecordsController.js +226 -240
  31. package/EventRecordsController.js.map +1 -1
  32. package/FileRecordsController.d.ts +13 -2
  33. package/FileRecordsController.js +458 -450
  34. package/FileRecordsController.js.map +1 -1
  35. package/GoogleAIChatInterface.js +133 -179
  36. package/GoogleAIChatInterface.js.map +1 -1
  37. package/LivekitController.js +43 -54
  38. package/LivekitController.js.map +1 -1
  39. package/LoomController.js +64 -75
  40. package/LoomController.js.map +1 -1
  41. package/MemoryAuthMessenger.js +10 -23
  42. package/MemoryAuthMessenger.js.map +1 -1
  43. package/MemoryCache.js +18 -35
  44. package/MemoryCache.js.map +1 -1
  45. package/MemoryFileRecordsLookup.js +105 -125
  46. package/MemoryFileRecordsLookup.js.map +1 -1
  47. package/MemoryModerationJobProvider.js +17 -30
  48. package/MemoryModerationJobProvider.js.map +1 -1
  49. package/MemoryRateLimiter.js +12 -27
  50. package/MemoryRateLimiter.js.map +1 -1
  51. package/MemoryStore.d.ts +18 -6
  52. package/MemoryStore.js +1879 -1997
  53. package/MemoryStore.js.map +1 -1
  54. package/MetricsStore.d.ts +2 -2
  55. package/ModerationController.js +186 -200
  56. package/ModerationController.js.map +1 -1
  57. package/OpenAIChatInterface.js +105 -135
  58. package/OpenAIChatInterface.js.map +1 -1
  59. package/OpenAIImageInterface.js +57 -51
  60. package/OpenAIImageInterface.js.map +1 -1
  61. package/PolicyController.d.ts +150 -10
  62. package/PolicyController.js +1546 -1299
  63. package/PolicyController.js.map +1 -1
  64. package/PolicyStore.d.ts +110 -2
  65. package/PolicyStore.js +36 -1
  66. package/PolicyStore.js.map +1 -1
  67. package/PrivoClient.js +398 -435
  68. package/PrivoClient.js.map +1 -1
  69. package/RateLimitController.js +25 -36
  70. package/RateLimitController.js.map +1 -1
  71. package/RecordsClient.js +51 -74
  72. package/RecordsClient.js.map +1 -1
  73. package/RecordsController.d.ts +2 -42
  74. package/RecordsController.js +1026 -1182
  75. package/RecordsController.js.map +1 -1
  76. package/RecordsServer.d.ts +196 -27
  77. package/RecordsServer.js +1701 -1343
  78. package/RecordsServer.js.map +1 -1
  79. package/RecordsStore.d.ts +1 -10
  80. package/RecordsStore.js.map +1 -1
  81. package/ServerConfig.d.ts +339 -195
  82. package/ServerConfig.js +13 -0
  83. package/ServerConfig.js.map +1 -1
  84. package/SloydInterface.js +62 -75
  85. package/SloydInterface.js.map +1 -1
  86. package/StabilityAIImageInterface.js +150 -167
  87. package/StabilityAIImageInterface.js.map +1 -1
  88. package/SubscriptionConfigBuilder.d.ts +6 -1
  89. package/SubscriptionConfigBuilder.js +22 -0
  90. package/SubscriptionConfigBuilder.js.map +1 -1
  91. package/SubscriptionConfiguration.d.ts +266 -169
  92. package/SubscriptionConfiguration.js +101 -79
  93. package/SubscriptionConfiguration.js.map +1 -1
  94. package/SubscriptionController.d.ts +2 -1
  95. package/SubscriptionController.js +643 -650
  96. package/SubscriptionController.js.map +1 -1
  97. package/SystemNotificationMessenger.d.ts +21 -4
  98. package/SystemNotificationMessenger.js +36 -30
  99. package/SystemNotificationMessenger.js.map +1 -1
  100. package/TestUtils.d.ts +9 -1
  101. package/TestUtils.js +105 -129
  102. package/TestUtils.js.map +1 -1
  103. package/Utils.d.ts +2 -16
  104. package/Utils.js +21 -22
  105. package/Utils.js.map +1 -1
  106. package/crud/CrudHelpers.js +17 -26
  107. package/crud/CrudHelpers.js.map +1 -1
  108. package/crud/CrudRecordsController.d.ts +1 -1
  109. package/crud/CrudRecordsController.js +259 -267
  110. package/crud/CrudRecordsController.js.map +1 -1
  111. package/crud/CrudRecordsControllerTests.js +174 -185
  112. package/crud/CrudRecordsControllerTests.js.map +1 -1
  113. package/crud/CrudRecordsStore.d.ts +7 -3
  114. package/crud/MemoryCrudRecordsStore.d.ts +4 -4
  115. package/crud/MemoryCrudRecordsStore.js +98 -118
  116. package/crud/MemoryCrudRecordsStore.js.map +1 -1
  117. package/crud/sub/MemorySubCrudRecordsStore.d.ts +24 -0
  118. package/crud/sub/MemorySubCrudRecordsStore.js +146 -0
  119. package/crud/sub/MemorySubCrudRecordsStore.js.map +1 -0
  120. package/crud/sub/SubCrudRecordsController.d.ts +182 -0
  121. package/crud/sub/SubCrudRecordsController.js +360 -0
  122. package/crud/sub/SubCrudRecordsController.js.map +1 -0
  123. package/crud/sub/SubCrudRecordsControllerTests.d.ts +39 -0
  124. package/crud/sub/SubCrudRecordsControllerTests.js +821 -0
  125. package/crud/sub/SubCrudRecordsControllerTests.js.map +1 -0
  126. package/crud/sub/SubCrudRecordsStore.d.ts +95 -0
  127. package/{forms/index.js → crud/sub/SubCrudRecordsStore.js} +2 -2
  128. package/crud/sub/SubCrudRecordsStore.js.map +1 -0
  129. package/crud/sub/index.d.ts +3 -0
  130. package/crud/sub/index.js +20 -0
  131. package/{forms → crud/sub}/index.js.map +1 -1
  132. package/index.d.ts +1 -1
  133. package/index.js +1 -1
  134. package/index.js.map +1 -1
  135. package/notifications/MemoryNotificationRecordsStore.js +189 -198
  136. package/notifications/MemoryNotificationRecordsStore.js.map +1 -1
  137. package/notifications/NotificationRecordsController.js +438 -460
  138. package/notifications/NotificationRecordsController.js.map +1 -1
  139. package/notifications/NotificationRecordsStore.d.ts +2 -1
  140. package/notifications/WebPushInterface.d.ts +0 -1
  141. package/notifications/WebPushInterface.js +0 -1
  142. package/notifications/WebPushInterface.js.map +1 -1
  143. package/package.json +6 -6
  144. package/packages/MemoryPackageRecordsStore.d.ts +10 -0
  145. package/packages/MemoryPackageRecordsStore.js +38 -0
  146. package/packages/MemoryPackageRecordsStore.js.map +1 -0
  147. package/packages/PackageRecordsController.d.ts +26 -0
  148. package/packages/PackageRecordsController.js +49 -0
  149. package/packages/PackageRecordsController.js.map +1 -0
  150. package/packages/PackageRecordsStore.d.ts +32 -0
  151. package/packages/PackageRecordsStore.js +19 -0
  152. package/packages/PackageRecordsStore.js.map +1 -0
  153. package/packages/index.d.ts +4 -0
  154. package/packages/index.js +21 -0
  155. package/packages/index.js.map +1 -0
  156. package/packages/version/MemoryPackageVersionRecordsStore.d.ts +21 -0
  157. package/packages/version/MemoryPackageVersionRecordsStore.js +177 -0
  158. package/packages/version/MemoryPackageVersionRecordsStore.js.map +1 -0
  159. package/packages/version/PackageVersionRecordsController.d.ts +144 -0
  160. package/packages/version/PackageVersionRecordsController.js +656 -0
  161. package/packages/version/PackageVersionRecordsController.js.map +1 -0
  162. package/packages/version/PackageVersionRecordsStore.d.ts +342 -0
  163. package/packages/version/PackageVersionRecordsStore.js +126 -0
  164. package/packages/version/PackageVersionRecordsStore.js.map +1 -0
  165. package/packages/version/index.d.ts +4 -0
  166. package/packages/version/index.js +21 -0
  167. package/packages/version/index.js.map +1 -0
  168. package/tracing/TracingDecorators.js +31 -40
  169. package/tracing/TracingDecorators.js.map +1 -1
  170. package/webhooks/MemoryWebhookRecordsStore.js +56 -72
  171. package/webhooks/MemoryWebhookRecordsStore.js.map +1 -1
  172. package/webhooks/WebhookEnvironment.d.ts +3 -3
  173. package/webhooks/WebhookRecordsController.d.ts +2 -1
  174. package/webhooks/WebhookRecordsController.js +389 -382
  175. package/webhooks/WebhookRecordsController.js.map +1 -1
  176. package/webhooks/WebhookRecordsStore.d.ts +2 -1
  177. package/websockets/InstRecordsStore.d.ts +50 -0
  178. package/websockets/InstRecordsStore.js +17 -0
  179. package/websockets/InstRecordsStore.js.map +1 -1
  180. package/websockets/MemoryTempInstRecordsStore.d.ts +5 -0
  181. package/websockets/MemoryTempInstRecordsStore.js +168 -179
  182. package/websockets/MemoryTempInstRecordsStore.js.map +1 -1
  183. package/websockets/MemoryWebsocketConnectionStore.js +98 -135
  184. package/websockets/MemoryWebsocketConnectionStore.js.map +1 -1
  185. package/websockets/MemoryWebsocketMessenger.js +29 -48
  186. package/websockets/MemoryWebsocketMessenger.js.map +1 -1
  187. package/websockets/SplitInstRecordsStore.d.ts +4 -1
  188. package/websockets/SplitInstRecordsStore.js +167 -185
  189. package/websockets/SplitInstRecordsStore.js.map +1 -1
  190. package/websockets/TemporaryInstRecordsStore.d.ts +19 -1
  191. package/websockets/TemporaryInstRecordsStore.js +17 -0
  192. package/websockets/TemporaryInstRecordsStore.js.map +1 -1
  193. package/websockets/WebsocketController.d.ts +147 -3
  194. package/websockets/WebsocketController.js +1735 -1391
  195. package/websockets/WebsocketController.js.map +1 -1
  196. package/websockets/index.d.ts +0 -1
  197. package/websockets/index.js +0 -1
  198. package/websockets/index.js.map +1 -1
  199. package/AAGUID.d.ts +0 -11
  200. package/AAGUID.js +0 -116
  201. package/AAGUID.js.map +0 -1
  202. package/AuthUtils.d.ts +0 -162
  203. package/AuthUtils.js +0 -327
  204. package/AuthUtils.js.map +0 -1
  205. package/forms/FormError.d.ts +0 -43
  206. package/forms/FormError.js +0 -56
  207. package/forms/FormError.js.map +0 -1
  208. package/forms/index.d.ts +0 -2
  209. package/websockets/Utils.d.ts +0 -33
  210. package/websockets/Utils.js +0 -82
  211. package/websockets/Utils.js.map +0 -1
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { createTestControllers, createTestRecordKey, createTestUser, } from '../TestUtils';
11
2
  import { PRIVATE_MARKER, PUBLIC_READ_MARKER, } from '@casual-simulation/aux-common';
12
3
  /**
@@ -14,48 +5,46 @@ import { PRIVATE_MARKER, PUBLIC_READ_MARKER, } from '@casual-simulation/aux-comm
14
5
  * @param storeFactory The factory function that creates the store.
15
6
  * @param controllerFactory The factory function that creates the controller.
16
7
  */
17
- export function setupTestContext(storeFactory, controllerFactory) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- const services = createTestControllers();
20
- const store = services.store;
21
- const itemsStore = storeFactory(services);
22
- const policies = services.policies;
23
- const recordName = 'testRecord';
24
- const manager = controllerFactory({
25
- policies,
26
- store: itemsStore,
27
- config: store,
28
- }, services);
29
- const user = yield createTestUser(services, 'test@example.com');
30
- const userId = user.userId;
31
- const sessionKey = user.sessionKey;
32
- const connectionKey = user.connectionKey;
33
- const testRecordKey = yield createTestRecordKey(services, userId, recordName, 'subjectfull');
34
- const key = testRecordKey.recordKey;
35
- const subjectlessRecordKey = yield createTestRecordKey(services, userId, recordName, 'subjectless');
36
- const subjectlessKey = subjectlessRecordKey.recordKey;
37
- const otherUserId = 'otherUserId';
38
- yield store.saveUser({
39
- id: otherUserId,
40
- allSessionRevokeTimeMs: null,
41
- currentLoginRequestId: null,
42
- email: 'other@example.com',
43
- phoneNumber: null,
44
- });
45
- return {
46
- services,
47
- key,
48
- manager,
49
- otherUserId,
50
- sessionKey,
51
- store,
52
- itemsStore,
53
- subjectlessKey,
54
- userId,
55
- recordName,
56
- connectionKey,
57
- };
8
+ export async function setupTestContext(storeFactory, controllerFactory) {
9
+ const services = createTestControllers();
10
+ const store = services.store;
11
+ const itemsStore = storeFactory(services);
12
+ const policies = services.policies;
13
+ const recordName = 'testRecord';
14
+ const manager = controllerFactory({
15
+ policies,
16
+ store: itemsStore,
17
+ config: store,
18
+ }, services);
19
+ const user = await createTestUser(services, 'test@example.com');
20
+ const userId = user.userId;
21
+ const sessionKey = user.sessionKey;
22
+ const connectionKey = user.connectionKey;
23
+ const testRecordKey = await createTestRecordKey(services, userId, recordName, 'subjectfull');
24
+ const key = testRecordKey.recordKey;
25
+ const subjectlessRecordKey = await createTestRecordKey(services, userId, recordName, 'subjectless');
26
+ const subjectlessKey = subjectlessRecordKey.recordKey;
27
+ const otherUserId = 'otherUserId';
28
+ await store.saveUser({
29
+ id: otherUserId,
30
+ allSessionRevokeTimeMs: null,
31
+ currentLoginRequestId: null,
32
+ email: 'other@example.com',
33
+ phoneNumber: null,
58
34
  });
35
+ return {
36
+ services,
37
+ key,
38
+ manager,
39
+ otherUserId,
40
+ sessionKey,
41
+ store,
42
+ itemsStore,
43
+ subjectlessKey,
44
+ userId,
45
+ recordName,
46
+ connectionKey,
47
+ };
59
48
  }
60
49
  /**
61
50
  * Runs all of the common tests for a CRUD records controller.
@@ -80,8 +69,8 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
80
69
  let sessionKey;
81
70
  let otherUserId;
82
71
  let recordName;
83
- beforeEach(() => __awaiter(this, void 0, void 0, function* () {
84
- context = yield setupTestContext(storeFactory, controllerFactory);
72
+ beforeEach(async () => {
73
+ context = await setupTestContext(storeFactory, controllerFactory);
85
74
  services = context.services;
86
75
  store = context.store;
87
76
  itemsStore = context.itemsStore;
@@ -95,17 +84,17 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
95
84
  otherUserId = context.otherUserId;
96
85
  recordName = context.recordName;
97
86
  if (configureEnvironment) {
98
- yield configureEnvironment(context);
87
+ await configureEnvironment(context);
99
88
  }
100
- }));
89
+ });
101
90
  describe('recordItem()', () => {
102
91
  describe('create', () => {
103
- it('should store the item in the store', () => __awaiter(this, void 0, void 0, function* () {
92
+ it('should store the item in the store', async () => {
104
93
  const item = createTestItem({
105
94
  address: 'address',
106
95
  markers: [PUBLIC_READ_MARKER],
107
96
  });
108
- const result = (yield manager.recordItem({
97
+ const result = (await manager.recordItem({
109
98
  recordKeyOrRecordName: recordName,
110
99
  userId,
111
100
  item,
@@ -116,10 +105,10 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
116
105
  recordName: recordName,
117
106
  address: 'address',
118
107
  });
119
- yield expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toMatchObject(item);
120
- }));
121
- it('should reject the request if given an invalid key', () => __awaiter(this, void 0, void 0, function* () {
122
- const result = (yield manager.recordItem({
108
+ await expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toMatchObject(item);
109
+ });
110
+ it('should reject the request if given an invalid key', async () => {
111
+ const result = (await manager.recordItem({
123
112
  recordKeyOrRecordName: 'not_a_key',
124
113
  userId,
125
114
  item: createTestItem({
@@ -133,11 +122,11 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
133
122
  errorCode: 'record_not_found',
134
123
  errorMessage: expect.any(String),
135
124
  });
136
- yield expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toBeFalsy();
137
- }));
125
+ await expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toBeFalsy();
126
+ });
138
127
  if (allowRecordKeys) {
139
- it('should support using a record key', () => __awaiter(this, void 0, void 0, function* () {
140
- const result = (yield manager.recordItem({
128
+ it('should support using a record key', async () => {
129
+ const result = (await manager.recordItem({
141
130
  recordKeyOrRecordName: key,
142
131
  userId: otherUserId,
143
132
  item: createTestItem({
@@ -151,13 +140,13 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
151
140
  recordName: recordName,
152
141
  address: 'address',
153
142
  });
154
- yield expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toEqual({
143
+ await expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toEqual({
155
144
  address: 'address',
156
145
  markers: [PUBLIC_READ_MARKER],
157
146
  });
158
- }));
159
- it('should be able to use subjectless keys', () => __awaiter(this, void 0, void 0, function* () {
160
- const result = (yield manager.recordItem({
147
+ });
148
+ it('should be able to use subjectless keys', async () => {
149
+ const result = (await manager.recordItem({
161
150
  recordKeyOrRecordName: subjectlessKey,
162
151
  userId: otherUserId,
163
152
  item: createTestItem({
@@ -171,15 +160,15 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
171
160
  recordName: recordName,
172
161
  address: 'address',
173
162
  });
174
- yield expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toEqual({
163
+ await expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toEqual({
175
164
  address: 'address',
176
165
  markers: [PUBLIC_READ_MARKER],
177
166
  });
178
- }));
167
+ });
179
168
  }
180
169
  else {
181
- it('should reject the request if record keys are not allowed', () => __awaiter(this, void 0, void 0, function* () {
182
- const result = (yield manager.recordItem({
170
+ it('should reject the request if record keys are not allowed', async () => {
171
+ const result = (await manager.recordItem({
183
172
  recordKeyOrRecordName: key,
184
173
  userId: otherUserId,
185
174
  item: createTestItem({
@@ -202,10 +191,10 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
202
191
  subjectId: otherUserId,
203
192
  },
204
193
  });
205
- yield expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toBeFalsy();
206
- }));
207
- it('should reject the request if subjectless keys are not allowed', () => __awaiter(this, void 0, void 0, function* () {
208
- const result = (yield manager.recordItem({
194
+ await expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toBeFalsy();
195
+ });
196
+ it('should reject the request if subjectless keys are not allowed', async () => {
197
+ const result = (await manager.recordItem({
209
198
  recordKeyOrRecordName: subjectlessKey,
210
199
  userId: otherUserId,
211
200
  item: createTestItem({
@@ -228,23 +217,23 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
228
217
  subjectId: otherUserId,
229
218
  },
230
219
  });
231
- yield expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toBeFalsy();
232
- }));
220
+ await expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toBeFalsy();
221
+ });
233
222
  }
234
223
  });
235
224
  describe('update', () => {
236
- beforeEach(() => __awaiter(this, void 0, void 0, function* () {
237
- yield itemsStore.createItem(recordName, createTestItem({
225
+ beforeEach(async () => {
226
+ await itemsStore.createItem(recordName, createTestItem({
238
227
  address: 'address',
239
228
  markers: [PUBLIC_READ_MARKER],
240
229
  }));
241
- }));
242
- it('should update the markers in the store', () => __awaiter(this, void 0, void 0, function* () {
230
+ });
231
+ it('should update the markers in the store', async () => {
243
232
  const item = createTestItem({
244
233
  address: 'address',
245
234
  markers: [PRIVATE_MARKER],
246
235
  });
247
- const result = (yield manager.recordItem({
236
+ const result = (await manager.recordItem({
248
237
  recordKeyOrRecordName: recordName,
249
238
  userId,
250
239
  item,
@@ -255,14 +244,14 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
255
244
  recordName: recordName,
256
245
  address: 'address',
257
246
  });
258
- yield expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toMatchObject(item);
259
- }));
260
- it('should reject the request if given an invalid key', () => __awaiter(this, void 0, void 0, function* () {
247
+ await expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toMatchObject(item);
248
+ });
249
+ it('should reject the request if given an invalid key', async () => {
261
250
  const item = createTestItem({
262
251
  address: 'address',
263
252
  markers: [PUBLIC_READ_MARKER],
264
253
  });
265
- const result = (yield manager.recordItem({
254
+ const result = (await manager.recordItem({
266
255
  recordKeyOrRecordName: 'not_a_key',
267
256
  userId,
268
257
  item,
@@ -273,15 +262,15 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
273
262
  errorCode: 'record_not_found',
274
263
  errorMessage: expect.any(String),
275
264
  });
276
- yield expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toMatchObject(item);
277
- }));
265
+ await expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toMatchObject(item);
266
+ });
278
267
  if (allowRecordKeys) {
279
- it('should support using a record key', () => __awaiter(this, void 0, void 0, function* () {
268
+ it('should support using a record key', async () => {
280
269
  const item = createTestItem({
281
270
  address: 'address',
282
271
  markers: [PRIVATE_MARKER],
283
272
  });
284
- const result = (yield manager.recordItem({
273
+ const result = (await manager.recordItem({
285
274
  recordKeyOrRecordName: key,
286
275
  userId,
287
276
  item,
@@ -292,14 +281,14 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
292
281
  recordName: recordName,
293
282
  address: 'address',
294
283
  });
295
- yield expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toMatchObject(item);
296
- }));
297
- it('should be able to use subjectless keys', () => __awaiter(this, void 0, void 0, function* () {
284
+ await expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toMatchObject(item);
285
+ });
286
+ it('should be able to use subjectless keys', async () => {
298
287
  const item = createTestItem({
299
288
  address: 'address',
300
289
  markers: [PRIVATE_MARKER],
301
290
  });
302
- const result = (yield manager.recordItem({
291
+ const result = (await manager.recordItem({
303
292
  recordKeyOrRecordName: subjectlessKey,
304
293
  userId,
305
294
  item,
@@ -310,16 +299,16 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
310
299
  recordName: recordName,
311
300
  address: 'address',
312
301
  });
313
- yield expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toMatchObject(item);
314
- }));
302
+ await expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toMatchObject(item);
303
+ });
315
304
  }
316
305
  else {
317
- it('should reject the request if record keys are not allowed', () => __awaiter(this, void 0, void 0, function* () {
306
+ it('should reject the request if record keys are not allowed', async () => {
318
307
  const item = createTestItem({
319
308
  address: 'address',
320
309
  markers: [PRIVATE_MARKER],
321
310
  });
322
- const result = (yield manager.recordItem({
311
+ const result = (await manager.recordItem({
323
312
  recordKeyOrRecordName: key,
324
313
  userId: otherUserId,
325
314
  item,
@@ -339,17 +328,17 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
339
328
  subjectId: otherUserId,
340
329
  },
341
330
  });
342
- yield expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toMatchObject(createTestItem({
331
+ await expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toMatchObject(createTestItem({
343
332
  address: 'address',
344
333
  markers: [PUBLIC_READ_MARKER],
345
334
  }));
346
- }));
347
- it('should reject the request if subjectless keys are not allowed', () => __awaiter(this, void 0, void 0, function* () {
335
+ });
336
+ it('should reject the request if subjectless keys are not allowed', async () => {
348
337
  const item = createTestItem({
349
338
  address: 'address',
350
339
  markers: [PRIVATE_MARKER],
351
340
  });
352
- const result = (yield manager.recordItem({
341
+ const result = (await manager.recordItem({
353
342
  recordKeyOrRecordName: subjectlessKey,
354
343
  userId: otherUserId,
355
344
  item,
@@ -369,31 +358,31 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
369
358
  subjectId: otherUserId,
370
359
  },
371
360
  });
372
- yield expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toMatchObject(createTestItem({
361
+ await expect(itemsStore.getItemByAddress(recordName, 'address')).resolves.toMatchObject(createTestItem({
373
362
  address: 'address',
374
363
  markers: [PUBLIC_READ_MARKER],
375
364
  }));
376
- }));
365
+ });
377
366
  }
378
367
  });
379
368
  });
380
369
  describe('getItem()', () => {
381
- beforeEach(() => __awaiter(this, void 0, void 0, function* () {
382
- yield itemsStore.createItem(recordName, createTestItem({
370
+ beforeEach(async () => {
371
+ await itemsStore.createItem(recordName, createTestItem({
383
372
  address: 'address',
384
373
  markers: [PUBLIC_READ_MARKER],
385
374
  }));
386
- yield itemsStore.createItem(recordName, createTestItem({
375
+ await itemsStore.createItem(recordName, createTestItem({
387
376
  address: 'address2',
388
377
  markers: [PRIVATE_MARKER],
389
378
  }));
390
- yield itemsStore.createItem(recordName, createTestItem({
379
+ await itemsStore.createItem(recordName, createTestItem({
391
380
  address: 'address3',
392
381
  markers: [PUBLIC_READ_MARKER],
393
382
  }));
394
- }));
395
- it('should return the item if the user has access', () => __awaiter(this, void 0, void 0, function* () {
396
- const result = yield manager.getItem({
383
+ });
384
+ it('should return the item if the user has access', async () => {
385
+ const result = await manager.getItem({
397
386
  recordName: recordName,
398
387
  userId,
399
388
  address: 'address2',
@@ -406,9 +395,9 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
406
395
  markers: [PRIVATE_MARKER],
407
396
  }),
408
397
  });
409
- }));
410
- it('should return data_not_found if the item was not found', () => __awaiter(this, void 0, void 0, function* () {
411
- const result = yield manager.getItem({
398
+ });
399
+ it('should return data_not_found if the item was not found', async () => {
400
+ const result = await manager.getItem({
412
401
  recordName: recordName,
413
402
  userId,
414
403
  address: 'missing',
@@ -419,9 +408,9 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
419
408
  errorCode: 'data_not_found',
420
409
  errorMessage: expect.any(String),
421
410
  });
422
- }));
423
- it('should return record_not_found if the record doesnt exist', () => __awaiter(this, void 0, void 0, function* () {
424
- const result = yield manager.getItem({
411
+ });
412
+ it('should return record_not_found if the record doesnt exist', async () => {
413
+ const result = await manager.getItem({
425
414
  recordName: 'missing',
426
415
  userId,
427
416
  address: 'address',
@@ -432,10 +421,10 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
432
421
  errorCode: 'record_not_found',
433
422
  errorMessage: expect.any(String),
434
423
  });
435
- }));
424
+ });
436
425
  if (allowRecordKeys) {
437
- it('should be able to use a record key to access the item', () => __awaiter(this, void 0, void 0, function* () {
438
- const result = yield manager.getItem({
426
+ it('should be able to use a record key to access the item', async () => {
427
+ const result = await manager.getItem({
439
428
  recordName: key,
440
429
  userId,
441
430
  address: 'address2',
@@ -448,11 +437,11 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
448
437
  markers: [PRIVATE_MARKER],
449
438
  }),
450
439
  });
451
- }));
440
+ });
452
441
  }
453
442
  else {
454
- it('should return not_authorized if record keys are not allowed', () => __awaiter(this, void 0, void 0, function* () {
455
- const result = yield manager.getItem({
443
+ it('should return not_authorized if record keys are not allowed', async () => {
444
+ const result = await manager.getItem({
456
445
  recordName: key,
457
446
  userId: otherUserId,
458
447
  address: 'address2',
@@ -472,26 +461,26 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
472
461
  subjectId: otherUserId,
473
462
  },
474
463
  });
475
- }));
464
+ });
476
465
  }
477
466
  });
478
467
  describe('eraseItem()', () => {
479
- beforeEach(() => __awaiter(this, void 0, void 0, function* () {
480
- yield itemsStore.createItem(recordName, createTestItem({
468
+ beforeEach(async () => {
469
+ await itemsStore.createItem(recordName, createTestItem({
481
470
  address: 'address',
482
471
  markers: [PUBLIC_READ_MARKER],
483
472
  }));
484
- yield itemsStore.createItem(recordName, createTestItem({
473
+ await itemsStore.createItem(recordName, createTestItem({
485
474
  address: 'address2',
486
475
  markers: [PRIVATE_MARKER],
487
476
  }));
488
- yield itemsStore.createItem(recordName, createTestItem({
477
+ await itemsStore.createItem(recordName, createTestItem({
489
478
  address: 'address3',
490
479
  markers: [PUBLIC_READ_MARKER],
491
480
  }));
492
- }));
493
- it('should erase the item if the user has access', () => __awaiter(this, void 0, void 0, function* () {
494
- const result = yield manager.eraseItem({
481
+ });
482
+ it('should erase the item if the user has access', async () => {
483
+ const result = await manager.eraseItem({
495
484
  recordName: recordName,
496
485
  userId,
497
486
  address: 'address2',
@@ -500,10 +489,10 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
500
489
  expect(result).toEqual({
501
490
  success: true,
502
491
  });
503
- yield expect(itemsStore.getItemByAddress(recordName, 'address2')).resolves.toBeFalsy();
504
- }));
505
- it('should return data_not_found if the item doesnt exist', () => __awaiter(this, void 0, void 0, function* () {
506
- const result = yield manager.eraseItem({
492
+ await expect(itemsStore.getItemByAddress(recordName, 'address2')).resolves.toBeFalsy();
493
+ });
494
+ it('should return data_not_found if the item doesnt exist', async () => {
495
+ const result = await manager.eraseItem({
507
496
  recordName: recordName,
508
497
  userId,
509
498
  address: 'missing',
@@ -514,10 +503,10 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
514
503
  errorCode: 'data_not_found',
515
504
  errorMessage: 'The item was not found.',
516
505
  });
517
- }));
506
+ });
518
507
  if (allowRecordKeys) {
519
- it('should erase the item if the record key has access', () => __awaiter(this, void 0, void 0, function* () {
520
- const result = yield manager.eraseItem({
508
+ it('should erase the item if the record key has access', async () => {
509
+ const result = await manager.eraseItem({
521
510
  recordName: key,
522
511
  userId: otherUserId,
523
512
  address: 'address2',
@@ -526,12 +515,12 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
526
515
  expect(result).toEqual({
527
516
  success: true,
528
517
  });
529
- yield expect(itemsStore.getItemByAddress(recordName, 'address2')).resolves.toBeFalsy();
530
- }));
518
+ await expect(itemsStore.getItemByAddress(recordName, 'address2')).resolves.toBeFalsy();
519
+ });
531
520
  }
532
521
  else {
533
- it('should return not_authorized if the controller doesnt allow record keys', () => __awaiter(this, void 0, void 0, function* () {
534
- const result = yield manager.eraseItem({
522
+ it('should return not_authorized if the controller doesnt allow record keys', async () => {
523
+ const result = await manager.eraseItem({
535
524
  recordName: key,
536
525
  userId: otherUserId,
537
526
  address: 'address2',
@@ -551,11 +540,11 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
551
540
  subjectId: otherUserId,
552
541
  },
553
542
  });
554
- yield expect(itemsStore.getItemByAddress(recordName, 'address2')).resolves.toBeTruthy();
555
- }));
543
+ await expect(itemsStore.getItemByAddress(recordName, 'address2')).resolves.toBeTruthy();
544
+ });
556
545
  }
557
- it('should return record_not_found if the record doesnt exist', () => __awaiter(this, void 0, void 0, function* () {
558
- const result = yield manager.eraseItem({
546
+ it('should return record_not_found if the record doesnt exist', async () => {
547
+ const result = await manager.eraseItem({
559
548
  recordName: 'missing',
560
549
  userId,
561
550
  address: 'address2',
@@ -566,24 +555,24 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
566
555
  errorCode: 'record_not_found',
567
556
  errorMessage: expect.any(String),
568
557
  });
569
- yield expect(itemsStore.getItemByAddress(recordName, 'address2')).resolves.toBeTruthy();
570
- }));
558
+ await expect(itemsStore.getItemByAddress(recordName, 'address2')).resolves.toBeTruthy();
559
+ });
571
560
  });
572
561
  describe('listItems()', () => {
573
562
  let items;
574
- beforeEach(() => __awaiter(this, void 0, void 0, function* () {
563
+ beforeEach(async () => {
575
564
  items = [];
576
565
  for (let i = 0; i < 20; i++) {
577
566
  const item = createTestItem({
578
567
  address: 'address' + i,
579
568
  markers: [PRIVATE_MARKER],
580
569
  });
581
- yield itemsStore.createItem(recordName, item);
570
+ await itemsStore.createItem(recordName, item);
582
571
  items.push(item);
583
572
  }
584
- }));
585
- it('should return a list of items', () => __awaiter(this, void 0, void 0, function* () {
586
- const result = yield manager.listItems({
573
+ });
574
+ it('should return a list of items', async () => {
575
+ const result = await manager.listItems({
587
576
  recordName: recordName,
588
577
  userId,
589
578
  startingAddress: null,
@@ -595,10 +584,10 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
595
584
  items: items.slice(0, 10),
596
585
  totalCount: 20,
597
586
  });
598
- }));
587
+ });
599
588
  if (allowRecordKeys) {
600
- it('should be able to use a record key', () => __awaiter(this, void 0, void 0, function* () {
601
- const result = yield manager.listItems({
589
+ it('should be able to use a record key', async () => {
590
+ const result = await manager.listItems({
602
591
  recordName: key,
603
592
  userId: otherUserId,
604
593
  startingAddress: null,
@@ -610,11 +599,11 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
610
599
  items: items.slice(0, 10),
611
600
  totalCount: 20,
612
601
  });
613
- }));
602
+ });
614
603
  }
615
604
  else {
616
- it('should return not_authorized if record keys are not allowed', () => __awaiter(this, void 0, void 0, function* () {
617
- const result = yield manager.listItems({
605
+ it('should return not_authorized if record keys are not allowed', async () => {
606
+ const result = await manager.listItems({
618
607
  recordName: key,
619
608
  userId: otherUserId,
620
609
  startingAddress: null,
@@ -633,10 +622,10 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
633
622
  subjectId: otherUserId,
634
623
  },
635
624
  });
636
- }));
625
+ });
637
626
  }
638
- it('should return items after the given starting address', () => __awaiter(this, void 0, void 0, function* () {
639
- const result = yield manager.listItems({
627
+ it('should return items after the given starting address', async () => {
628
+ const result = await manager.listItems({
640
629
  recordName: recordName,
641
630
  userId,
642
631
  startingAddress: 'address3',
@@ -648,9 +637,9 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
648
637
  items: items.slice(4, 10),
649
638
  totalCount: 20,
650
639
  });
651
- }));
652
- it('should return not_authorized if the user does not have access to the account marker', () => __awaiter(this, void 0, void 0, function* () {
653
- const result = yield manager.listItems({
640
+ });
641
+ it('should return not_authorized if the user does not have access to the account marker', async () => {
642
+ const result = await manager.listItems({
654
643
  recordName: recordName,
655
644
  userId: otherUserId,
656
645
  startingAddress: 'address3',
@@ -670,11 +659,11 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
670
659
  type: 'missing_permission',
671
660
  },
672
661
  });
673
- }));
662
+ });
674
663
  });
675
664
  describe('listItemsByMarker()', () => {
676
665
  let items;
677
- beforeEach(() => __awaiter(this, void 0, void 0, function* () {
666
+ beforeEach(async () => {
678
667
  items = [];
679
668
  for (let i = 0; i < 40; i++) {
680
669
  const item = createTestItem({
@@ -683,12 +672,12 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
683
672
  i % 2 === 0 ? PRIVATE_MARKER : PUBLIC_READ_MARKER,
684
673
  ],
685
674
  });
686
- yield itemsStore.createItem(recordName, item);
675
+ await itemsStore.createItem(recordName, item);
687
676
  items.push(item);
688
677
  }
689
- }));
690
- it('should return a list of items that have the given marker', () => __awaiter(this, void 0, void 0, function* () {
691
- const result = yield manager.listItemsByMarker({
678
+ });
679
+ it('should return a list of items that have the given marker', async () => {
680
+ const result = await manager.listItemsByMarker({
692
681
  recordName: recordName,
693
682
  userId,
694
683
  marker: PRIVATE_MARKER,
@@ -703,9 +692,9 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
703
692
  .slice(0, 10),
704
693
  totalCount: 20,
705
694
  });
706
- }));
707
- it('should return a list of items that are after the starting address', () => __awaiter(this, void 0, void 0, function* () {
708
- const result = yield manager.listItemsByMarker({
695
+ });
696
+ it('should return a list of items that are after the starting address', async () => {
697
+ const result = await manager.listItemsByMarker({
709
698
  recordName: recordName,
710
699
  userId,
711
700
  marker: PRIVATE_MARKER,
@@ -720,10 +709,10 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
720
709
  .slice(1, 11),
721
710
  totalCount: 20,
722
711
  });
723
- }));
712
+ });
724
713
  if (allowRecordKeys) {
725
- it('should be able to use a record key', () => __awaiter(this, void 0, void 0, function* () {
726
- const result = yield manager.listItemsByMarker({
714
+ it('should be able to use a record key', async () => {
715
+ const result = await manager.listItemsByMarker({
727
716
  recordName: key,
728
717
  userId: otherUserId,
729
718
  marker: PRIVATE_MARKER,
@@ -738,11 +727,11 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
738
727
  .slice(0, 10),
739
728
  totalCount: 20,
740
729
  });
741
- }));
730
+ });
742
731
  }
743
732
  else {
744
- it('should return not_authorized if record keys are not allowed', () => __awaiter(this, void 0, void 0, function* () {
745
- const result = yield manager.listItemsByMarker({
733
+ it('should return not_authorized if record keys are not allowed', async () => {
734
+ const result = await manager.listItemsByMarker({
746
735
  recordName: key,
747
736
  userId: otherUserId,
748
737
  marker: PRIVATE_MARKER,
@@ -762,10 +751,10 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
762
751
  subjectId: otherUserId,
763
752
  },
764
753
  });
765
- }));
754
+ });
766
755
  }
767
- it('should return not_authorized if the user does not have access to the marker', () => __awaiter(this, void 0, void 0, function* () {
768
- const result = yield manager.listItemsByMarker({
756
+ it('should return not_authorized if the user does not have access to the marker', async () => {
757
+ const result = await manager.listItemsByMarker({
769
758
  recordName: recordName,
770
759
  userId: otherUserId,
771
760
  marker: PRIVATE_MARKER,
@@ -786,7 +775,7 @@ export function testCrudRecordsController(allowRecordKeys, resourceKind, storeFa
786
775
  type: 'missing_permission',
787
776
  },
788
777
  });
789
- }));
778
+ });
790
779
  });
791
780
  }
792
781
  //# sourceMappingURL=CrudRecordsControllerTests.js.map