@openstax/ts-utils 1.43.1 → 1.44.0

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 (202) hide show
  1. package/dist/cjs/aws/ssmService.js +2 -2
  2. package/dist/cjs/config/awsParameterConfig.d.ts +1 -1
  3. package/dist/cjs/config/awsParameterConfig.js +3 -3
  4. package/dist/cjs/config/envConfig.d.ts +1 -1
  5. package/dist/cjs/config/lambdaParameterConfig.d.ts +1 -1
  6. package/dist/cjs/config/lambdaParameterConfig.js +6 -6
  7. package/dist/cjs/config/replaceConfig.d.ts +1 -1
  8. package/dist/cjs/config/resolveConfigValue.d.ts +1 -1
  9. package/dist/cjs/errors/index.d.ts +1 -1
  10. package/dist/cjs/fetch/fetchStatusRetry.d.ts +1 -1
  11. package/dist/cjs/fetch/index.d.ts +1 -1
  12. package/dist/cjs/index.d.ts +3 -2
  13. package/dist/cjs/index.js +3 -2
  14. package/dist/cjs/middleware/apiErrorHandler.d.ts +3 -3
  15. package/dist/cjs/middleware/apiErrorHandler.js +12 -12
  16. package/dist/cjs/middleware/apiSlowResponseMiddleware.d.ts +3 -3
  17. package/dist/cjs/middleware/apiSlowResponseMiddleware.js +5 -5
  18. package/dist/cjs/middleware/lambdaCorsResponseMiddleware.d.ts +2 -2
  19. package/dist/cjs/middleware/lambdaCorsResponseMiddleware.js +2 -2
  20. package/dist/cjs/middleware/throwNotFoundMiddleware.js +2 -2
  21. package/dist/cjs/misc/helpers.d.ts +1 -1
  22. package/dist/cjs/misc/merge.js +2 -2
  23. package/dist/cjs/misc/timingSafeCompareStrings.d.ts +5 -0
  24. package/dist/cjs/misc/timingSafeCompareStrings.js +15 -0
  25. package/dist/cjs/pagination/index.d.ts +1 -1
  26. package/dist/cjs/pagination/index.js +10 -10
  27. package/dist/cjs/routing/helpers.d.ts +1 -1
  28. package/dist/cjs/routing/helpers.js +7 -7
  29. package/dist/cjs/routing/index.d.ts +1 -1
  30. package/dist/cjs/routing/lambdaBatchRequestHandler.d.ts +2 -2
  31. package/dist/cjs/routing/lambdaBatchRequestHandler.js +2 -2
  32. package/dist/cjs/routing/validators/zod.js +2 -2
  33. package/dist/cjs/services/accountsGateway/index.d.ts +5 -5
  34. package/dist/cjs/services/accountsGateway/index.js +17 -17
  35. package/dist/cjs/services/apiGateway/index.d.ts +4 -4
  36. package/dist/cjs/services/apiGateway/index.js +10 -10
  37. package/dist/cjs/services/authProvider/browser.d.ts +3 -3
  38. package/dist/cjs/services/authProvider/browser.js +9 -9
  39. package/dist/cjs/services/authProvider/decryption.d.ts +3 -3
  40. package/dist/cjs/services/authProvider/decryption.js +7 -7
  41. package/dist/cjs/services/authProvider/index.d.ts +3 -3
  42. package/dist/cjs/services/authProvider/launchToken.d.ts +3 -3
  43. package/dist/cjs/services/authProvider/launchToken.js +3 -3
  44. package/dist/cjs/services/authProvider/subrequest.d.ts +3 -3
  45. package/dist/cjs/services/authProvider/subrequest.js +10 -10
  46. package/dist/cjs/services/authProvider/utils/decryptAndVerify.d.ts +1 -1
  47. package/dist/cjs/services/authProvider/utils/decryptAndVerify.js +3 -3
  48. package/dist/cjs/services/authProvider/utils/embeddedAuthProvider.d.ts +1 -1
  49. package/dist/cjs/services/authProvider/utils/userRoleValidator.d.ts +3 -3
  50. package/dist/cjs/services/authProvider/utils/userRoleValidator.js +4 -4
  51. package/dist/cjs/services/authProvider/utils/userSubrequest.d.ts +2 -2
  52. package/dist/cjs/services/documentStore/dynamoEncoding.d.ts +1 -1
  53. package/dist/cjs/services/documentStore/dynamoEncoding.js +2 -2
  54. package/dist/cjs/services/documentStore/unversioned/dynamodb.d.ts +2 -2
  55. package/dist/cjs/services/documentStore/unversioned/dynamodb.js +14 -14
  56. package/dist/cjs/services/documentStore/unversioned/file-system.d.ts +2 -2
  57. package/dist/cjs/services/documentStore/unversioned/file-system.js +13 -13
  58. package/dist/cjs/services/documentStore/versioned/dynamodb.d.ts +3 -3
  59. package/dist/cjs/services/documentStore/versioned/dynamodb.js +6 -6
  60. package/dist/cjs/services/documentStore/versioned/file-system.d.ts +3 -3
  61. package/dist/cjs/services/documentStore/versioned/index.d.ts +1 -1
  62. package/dist/cjs/services/exercisesGateway/index.d.ts +2 -2
  63. package/dist/cjs/services/exercisesGateway/index.js +14 -14
  64. package/dist/cjs/services/fileServer/index.js +3 -3
  65. package/dist/cjs/services/fileServer/localFileServer.d.ts +2 -2
  66. package/dist/cjs/services/fileServer/localFileServer.js +9 -9
  67. package/dist/cjs/services/fileServer/s3FileServer.d.ts +2 -2
  68. package/dist/cjs/services/fileServer/s3FileServer.js +13 -13
  69. package/dist/cjs/services/httpMessageVerifier/index.d.ts +1 -1
  70. package/dist/cjs/services/httpMessageVerifier/index.js +16 -16
  71. package/dist/cjs/services/launchParams/signer.d.ts +2 -2
  72. package/dist/cjs/services/launchParams/signer.js +9 -9
  73. package/dist/cjs/services/launchParams/verifier.d.ts +1 -1
  74. package/dist/cjs/services/launchParams/verifier.js +8 -8
  75. package/dist/cjs/services/logger/console.d.ts +1 -1
  76. package/dist/cjs/services/logger/console.js +2 -2
  77. package/dist/cjs/services/logger/index.d.ts +1 -1
  78. package/dist/cjs/services/lrsGateway/addStatementDefaultFields.d.ts +1 -1
  79. package/dist/cjs/services/lrsGateway/attempt-utils.d.ts +7 -7
  80. package/dist/cjs/services/lrsGateway/batching.d.ts +2 -2
  81. package/dist/cjs/services/lrsGateway/batching.js +2 -2
  82. package/dist/cjs/services/lrsGateway/file-system.d.ts +3 -3
  83. package/dist/cjs/services/lrsGateway/file-system.js +8 -8
  84. package/dist/cjs/services/lrsGateway/index.d.ts +4 -4
  85. package/dist/cjs/services/lrsGateway/index.js +15 -15
  86. package/dist/cjs/services/lrsGateway/xapiUtils.d.ts +3 -3
  87. package/dist/cjs/services/lrsGateway/xapiUtils.js +2 -2
  88. package/dist/cjs/services/postgresConnection/index.d.ts +2 -2
  89. package/dist/cjs/services/postgresConnection/index.js +10 -10
  90. package/dist/cjs/services/queueProvider/local.d.ts +2 -2
  91. package/dist/cjs/services/queueProvider/local.js +5 -5
  92. package/dist/cjs/services/queueProvider/sqs.d.ts +2 -2
  93. package/dist/cjs/services/queueProvider/sqs.js +5 -5
  94. package/dist/cjs/services/searchProvider/memorySearchTheBadWay.d.ts +1 -1
  95. package/dist/cjs/services/searchProvider/memorySearchTheBadWay.js +9 -9
  96. package/dist/cjs/services/searchProvider/openSearch.d.ts +2 -2
  97. package/dist/cjs/services/searchProvider/openSearch.js +6 -6
  98. package/dist/cjs/services/searchProvider/streamIndexer.d.ts +2 -2
  99. package/dist/cjs/services/searchProvider/streamIndexer.js +3 -3
  100. package/dist/cjs/tsconfig.without-specs.cjs.tsbuildinfo +1 -1
  101. package/dist/esm/aws/ssmService.js +1 -1
  102. package/dist/esm/config/awsParameterConfig.d.ts +1 -1
  103. package/dist/esm/config/awsParameterConfig.js +1 -1
  104. package/dist/esm/config/envConfig.d.ts +1 -1
  105. package/dist/esm/config/lambdaParameterConfig.d.ts +1 -1
  106. package/dist/esm/config/lambdaParameterConfig.js +2 -2
  107. package/dist/esm/config/replaceConfig.d.ts +1 -1
  108. package/dist/esm/config/resolveConfigValue.d.ts +1 -1
  109. package/dist/esm/errors/index.d.ts +1 -1
  110. package/dist/esm/fetch/fetchStatusRetry.d.ts +1 -1
  111. package/dist/esm/fetch/index.d.ts +1 -1
  112. package/dist/esm/index.d.ts +3 -2
  113. package/dist/esm/index.js +3 -2
  114. package/dist/esm/middleware/apiErrorHandler.d.ts +3 -3
  115. package/dist/esm/middleware/apiErrorHandler.js +3 -3
  116. package/dist/esm/middleware/apiSlowResponseMiddleware.d.ts +3 -3
  117. package/dist/esm/middleware/apiSlowResponseMiddleware.js +2 -2
  118. package/dist/esm/middleware/lambdaCorsResponseMiddleware.d.ts +2 -2
  119. package/dist/esm/middleware/lambdaCorsResponseMiddleware.js +1 -1
  120. package/dist/esm/middleware/throwNotFoundMiddleware.js +1 -1
  121. package/dist/esm/misc/helpers.d.ts +1 -1
  122. package/dist/esm/misc/merge.js +1 -1
  123. package/dist/esm/misc/timingSafeCompareStrings.d.ts +5 -0
  124. package/dist/esm/misc/timingSafeCompareStrings.js +11 -0
  125. package/dist/esm/pagination/index.d.ts +1 -1
  126. package/dist/esm/pagination/index.js +3 -3
  127. package/dist/esm/routing/helpers.d.ts +1 -1
  128. package/dist/esm/routing/helpers.js +3 -3
  129. package/dist/esm/routing/index.d.ts +1 -1
  130. package/dist/esm/routing/lambdaBatchRequestHandler.d.ts +2 -2
  131. package/dist/esm/routing/lambdaBatchRequestHandler.js +1 -1
  132. package/dist/esm/routing/validators/zod.js +1 -1
  133. package/dist/esm/services/accountsGateway/index.d.ts +5 -5
  134. package/dist/esm/services/accountsGateway/index.js +4 -4
  135. package/dist/esm/services/apiGateway/index.d.ts +4 -4
  136. package/dist/esm/services/apiGateway/index.js +4 -4
  137. package/dist/esm/services/authProvider/browser.d.ts +3 -3
  138. package/dist/esm/services/authProvider/browser.js +4 -4
  139. package/dist/esm/services/authProvider/decryption.d.ts +3 -3
  140. package/dist/esm/services/authProvider/decryption.js +3 -3
  141. package/dist/esm/services/authProvider/index.d.ts +3 -3
  142. package/dist/esm/services/authProvider/launchToken.d.ts +3 -3
  143. package/dist/esm/services/authProvider/launchToken.js +1 -1
  144. package/dist/esm/services/authProvider/subrequest.d.ts +3 -3
  145. package/dist/esm/services/authProvider/subrequest.js +4 -4
  146. package/dist/esm/services/authProvider/utils/decryptAndVerify.d.ts +1 -1
  147. package/dist/esm/services/authProvider/utils/decryptAndVerify.js +1 -1
  148. package/dist/esm/services/authProvider/utils/embeddedAuthProvider.d.ts +1 -1
  149. package/dist/esm/services/authProvider/utils/userRoleValidator.d.ts +3 -3
  150. package/dist/esm/services/authProvider/utils/userRoleValidator.js +2 -2
  151. package/dist/esm/services/authProvider/utils/userSubrequest.d.ts +2 -2
  152. package/dist/esm/services/documentStore/dynamoEncoding.d.ts +1 -1
  153. package/dist/esm/services/documentStore/dynamoEncoding.js +1 -1
  154. package/dist/esm/services/documentStore/unversioned/dynamodb.d.ts +2 -2
  155. package/dist/esm/services/documentStore/unversioned/dynamodb.js +4 -4
  156. package/dist/esm/services/documentStore/unversioned/file-system.d.ts +2 -2
  157. package/dist/esm/services/documentStore/unversioned/file-system.js +4 -4
  158. package/dist/esm/services/documentStore/versioned/dynamodb.d.ts +3 -3
  159. package/dist/esm/services/documentStore/versioned/dynamodb.js +3 -3
  160. package/dist/esm/services/documentStore/versioned/file-system.d.ts +3 -3
  161. package/dist/esm/services/documentStore/versioned/index.d.ts +1 -1
  162. package/dist/esm/services/exercisesGateway/index.d.ts +2 -2
  163. package/dist/esm/services/exercisesGateway/index.js +5 -5
  164. package/dist/esm/services/fileServer/index.js +1 -1
  165. package/dist/esm/services/fileServer/localFileServer.d.ts +2 -2
  166. package/dist/esm/services/fileServer/localFileServer.js +3 -3
  167. package/dist/esm/services/fileServer/s3FileServer.d.ts +2 -2
  168. package/dist/esm/services/fileServer/s3FileServer.js +4 -4
  169. package/dist/esm/services/httpMessageVerifier/index.d.ts +1 -1
  170. package/dist/esm/services/httpMessageVerifier/index.js +3 -3
  171. package/dist/esm/services/launchParams/signer.d.ts +2 -2
  172. package/dist/esm/services/launchParams/signer.js +3 -3
  173. package/dist/esm/services/launchParams/verifier.d.ts +1 -1
  174. package/dist/esm/services/launchParams/verifier.js +3 -3
  175. package/dist/esm/services/logger/console.d.ts +1 -1
  176. package/dist/esm/services/logger/console.js +1 -1
  177. package/dist/esm/services/logger/index.d.ts +1 -1
  178. package/dist/esm/services/lrsGateway/addStatementDefaultFields.d.ts +1 -1
  179. package/dist/esm/services/lrsGateway/attempt-utils.d.ts +7 -7
  180. package/dist/esm/services/lrsGateway/batching.d.ts +2 -2
  181. package/dist/esm/services/lrsGateway/batching.js +1 -1
  182. package/dist/esm/services/lrsGateway/file-system.d.ts +3 -3
  183. package/dist/esm/services/lrsGateway/file-system.js +4 -4
  184. package/dist/esm/services/lrsGateway/index.d.ts +4 -4
  185. package/dist/esm/services/lrsGateway/index.js +6 -6
  186. package/dist/esm/services/lrsGateway/xapiUtils.d.ts +3 -3
  187. package/dist/esm/services/lrsGateway/xapiUtils.js +1 -1
  188. package/dist/esm/services/postgresConnection/index.d.ts +2 -2
  189. package/dist/esm/services/postgresConnection/index.js +3 -3
  190. package/dist/esm/services/queueProvider/local.d.ts +2 -2
  191. package/dist/esm/services/queueProvider/local.js +2 -2
  192. package/dist/esm/services/queueProvider/sqs.d.ts +2 -2
  193. package/dist/esm/services/queueProvider/sqs.js +2 -2
  194. package/dist/esm/services/searchProvider/memorySearchTheBadWay.d.ts +1 -1
  195. package/dist/esm/services/searchProvider/memorySearchTheBadWay.js +3 -3
  196. package/dist/esm/services/searchProvider/openSearch.d.ts +2 -2
  197. package/dist/esm/services/searchProvider/openSearch.js +2 -2
  198. package/dist/esm/services/searchProvider/streamIndexer.d.ts +2 -2
  199. package/dist/esm/services/searchProvider/streamIndexer.js +1 -1
  200. package/dist/esm/tsconfig.without-specs.esm.tsbuildinfo +1 -1
  201. package/package.json +1 -1
  202. package/script/bin/.init-params-script.bash.swp +0 -0
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.accountsGateway = void 0;
7
7
  const lodash_1 = require("lodash");
8
8
  const query_string_1 = __importDefault(require("query-string"));
9
- const index_1 = require("../../config/index");
10
- const index_2 = require("../../guards/index");
9
+ const config_1 = require("../../config");
10
+ const guards_1 = require("../../guards");
11
11
  const helpers_1 = require("../../misc/helpers");
12
- const index_3 = require("../../routing/index");
13
- const index_4 = require("../logger/index");
12
+ const routing_1 = require("../../routing");
13
+ const logger_1 = require("../logger");
14
14
  class ApiError extends Error {
15
15
  constructor(message, status) {
16
16
  super(message);
@@ -18,9 +18,9 @@ class ApiError extends Error {
18
18
  }
19
19
  }
20
20
  const accountsGateway = (initializer) => (configProvider) => {
21
- const config = configProvider[(0, index_2.ifDefined)(initializer.configSpace, 'accounts')];
22
- const accountsBase = (0, helpers_1.once)(() => (0, index_1.resolveConfigValue)(config.accountsBase));
23
- const accountsAuthToken = (0, helpers_1.once)(() => (0, index_1.resolveConfigValue)(config.accountsAuthToken));
21
+ const config = configProvider[(0, guards_1.ifDefined)(initializer.configSpace, 'accounts')];
22
+ const accountsBase = (0, helpers_1.once)(() => (0, config_1.resolveConfigValue)(config.accountsBase));
23
+ const accountsAuthToken = (0, helpers_1.once)(() => (0, config_1.resolveConfigValue)(config.accountsAuthToken));
24
24
  return ({ logger }) => {
25
25
  const request = async (method, path, options, statuses = [200, 201]) => {
26
26
  const host = (await accountsBase()).replace(/\/+$/, '');
@@ -40,10 +40,10 @@ const accountsGateway = (initializer) => (configProvider) => {
40
40
  }
41
41
  return response.json();
42
42
  };
43
- const findOrCreateUser = async (body) => request(index_3.METHOD.POST, 'user/find-or-create', { body });
43
+ const findOrCreateUser = async (body) => request(routing_1.METHOD.POST, 'user/find-or-create', { body });
44
44
  const findUser = async (body) => {
45
45
  try {
46
- return await request(index_3.METHOD.POST, 'user/find', { body });
46
+ return await request(routing_1.METHOD.POST, 'user/find', { body });
47
47
  }
48
48
  catch (error) {
49
49
  if (error instanceof ApiError && error.status === 404) {
@@ -54,16 +54,16 @@ const accountsGateway = (initializer) => (configProvider) => {
54
54
  }
55
55
  }
56
56
  };
57
- const getUser = async (token) => request(index_3.METHOD.GET, 'user', { token });
58
- const linkUser = async (body) => request(index_3.METHOD.POST, 'user/external-ids', {
57
+ const getUser = async (token) => request(routing_1.METHOD.GET, 'user', { token });
58
+ const linkUser = async (body) => request(routing_1.METHOD.POST, 'user/external-ids', {
59
59
  body: {
60
60
  external_id: body.externalId,
61
61
  user_id: body.userId,
62
62
  ...(body.role && { role: body.role }),
63
63
  }
64
64
  });
65
- const searchUsers = async (payload) => request(index_3.METHOD.GET, `users?${query_string_1.default.stringify(payload)}`, {});
66
- const updateUser = async (token, body) => request(index_3.METHOD.PUT, 'user', { body, token });
65
+ const searchUsers = async (payload) => request(routing_1.METHOD.GET, `users?${query_string_1.default.stringify(payload)}`, {});
66
+ const updateUser = async (token, body) => request(routing_1.METHOD.PUT, 'user', { body, token });
67
67
  const getPlatformUserId = (externalIds, platformId) => {
68
68
  for (const externalId of externalIds) {
69
69
  const [userPlatformId, userId] = externalId.split('/', 2);
@@ -86,21 +86,21 @@ const accountsGateway = (initializer) => (configProvider) => {
86
86
  return undefined;
87
87
  const platformUserId = platformId ? getPlatformUserId(user.external_ids, platformId) : undefined;
88
88
  if (platformId && !platformUserId) {
89
- logger.logEvent(index_4.Level.Warn, {
89
+ logger.logEvent(logger_1.Level.Warn, {
90
90
  message: 'Accounts user has no external_id matching the given platformId',
91
91
  accountsUuid: user.uuid,
92
92
  platformId,
93
93
  });
94
94
  }
95
95
  if (!user.full_name) {
96
- logger.logEvent(index_4.Level.Warn, {
96
+ logger.logEvent(logger_1.Level.Warn, {
97
97
  message: 'Accounts user has no full_name',
98
98
  accountsUuid: user.uuid,
99
99
  });
100
100
  }
101
101
  return { data, fullName: user.full_name, platformUserId, uuid: user.uuid };
102
102
  });
103
- return results.filter(index_2.isDefined);
103
+ return results.filter(guards_1.isDefined);
104
104
  };
105
105
  const getUserMap = async (userUuids, mapper) => {
106
106
  if (userUuids.size === 0)
@@ -111,7 +111,7 @@ const accountsGateway = (initializer) => (configProvider) => {
111
111
  });
112
112
  const accountsUuids = items.map((user) => user.uuid);
113
113
  if (!(0, lodash_1.isEqual)(accountsUuids.sort(), inputChunk.sort())) {
114
- logger.logEvent(index_4.Level.Warn, {
114
+ logger.logEvent(logger_1.Level.Warn, {
115
115
  message: 'Unexpected Accounts user search results',
116
116
  uuids: inputChunk,
117
117
  accountsUuids,
@@ -1,9 +1,9 @@
1
1
  import { Headers } from 'node-fetch';
2
- import { ConfigProviderForConfig } from '../../config/index';
3
- import { ConfigForFetch, GenericFetch, Response } from '../../fetch/index';
4
- import { AnyRoute, ApiResponse, OutputForRoute, ParamsForRoute, PayloadForRoute, QueryParams } from '../../routing/index';
2
+ import { ConfigProviderForConfig } from '../../config';
3
+ import { ConfigForFetch, GenericFetch, Response } from '../../fetch';
4
+ import { AnyRoute, ApiResponse, OutputForRoute, ParamsForRoute, PayloadForRoute, QueryParams } from '../../routing';
5
5
  import { UnwrapPromise } from '../../types';
6
- import { Logger } from '../logger/index';
6
+ import { Logger } from '../logger';
7
7
  export type TResponsePayload<R> = R extends ApiResponse<any, infer P> ? P : never;
8
8
  export type TResponseStatus<R> = R extends ApiResponse<infer S, any> ? S : never;
9
9
  export type RouteClient<R> = {
@@ -40,11 +40,11 @@ exports.createApiGateway = exports.loadResponse = void 0;
40
40
  const pathToRegexp = __importStar(require("path-to-regexp"));
41
41
  const query_string_1 = __importDefault(require("query-string"));
42
42
  const uuid_1 = require("uuid");
43
- const index_1 = require("../../index");
44
- const index_2 = require("../../config/index");
45
- const index_3 = require("../../errors/index");
43
+ const __1 = require("../..");
44
+ const config_1 = require("../../config");
45
+ const errors_1 = require("../../errors");
46
46
  const fetchStatusRetry_1 = require("../../fetch/fetchStatusRetry");
47
- const index_4 = require("../logger/index");
47
+ const logger_1 = require("../logger");
48
48
  /** Pulls the content out of a response based on the content type */
49
49
  const loadResponse = (response) => () => {
50
50
  const [contentType] = (response.headers.get('content-type') || '').split(';');
@@ -61,7 +61,7 @@ exports.loadResponse = loadResponse;
61
61
  const makeRouteClient = (initializer, config, route, app) => {
62
62
  /* TODO this duplicates code with makeRenderRouteUrl, reuse that */
63
63
  const renderUrl = async ({ params, query }) => {
64
- const apiBase = await (0, index_2.resolveConfigValue)(config.apiBase);
64
+ const apiBase = await (0, config_1.resolveConfigValue)(config.apiBase);
65
65
  const getPathForParams = pathToRegexp.compile(route.path, { encode: encodeURIComponent });
66
66
  const search = query && query_string_1.default.stringify(query);
67
67
  return apiBase.replace(/\/+$/, '') + getPathForParams(params || {}) + (search ? `?${search}` : '');
@@ -71,13 +71,13 @@ const makeRouteClient = (initializer, config, route, app) => {
71
71
  const { fetch } = initializer;
72
72
  const url = await renderUrl({ params, query });
73
73
  const body = payload ? JSON.stringify(payload) : undefined;
74
- const baseOptions = (0, index_1.merge)((await ((_a = app === null || app === void 0 ? void 0 : app.authProvider) === null || _a === void 0 ? void 0 : _a.getAuthorizedFetchConfig())) || {}, fetchConfig || {});
74
+ const baseOptions = (0, __1.merge)((await ((_a = app === null || app === void 0 ? void 0 : app.authProvider) === null || _a === void 0 ? void 0 : _a.getAuthorizedFetchConfig())) || {}, fetchConfig || {});
75
75
  const requestId = (0, uuid_1.v4)();
76
76
  const requestLogger = (_b = app === null || app === void 0 ? void 0 : app.logger) === null || _b === void 0 ? void 0 : _b.createSubContext();
77
77
  requestLogger === null || requestLogger === void 0 ? void 0 : requestLogger.setContext({ requestId, url, timeStamp: new Date().getTime() });
78
78
  const fetcher = (0, fetchStatusRetry_1.fetchStatusRetry)(fetch, { retries: 1, status: [502], logger: requestLogger });
79
- requestLogger === null || requestLogger === void 0 ? void 0 : requestLogger.log('Request Initiated', index_4.Level.Info);
80
- return fetcher(url, (0, index_1.merge)(baseOptions, {
79
+ requestLogger === null || requestLogger === void 0 ? void 0 : requestLogger.log('Request Initiated', logger_1.Level.Info);
80
+ return fetcher(url, (0, __1.merge)(baseOptions, {
81
81
  method: route.method,
82
82
  body,
83
83
  headers: {
@@ -90,10 +90,10 @@ const makeRouteClient = (initializer, config, route, app) => {
90
90
  }
91
91
  })).then(response => {
92
92
  if (response.status === 401) {
93
- throw new index_3.UnauthorizedError();
93
+ throw new errors_1.UnauthorizedError();
94
94
  }
95
95
  if (response.status === 440) {
96
- throw new index_3.SessionExpiredError();
96
+ throw new errors_1.SessionExpiredError();
97
97
  }
98
98
  return {
99
99
  status: response.status,
@@ -1,7 +1,7 @@
1
- import { ConfigProviderForConfig } from '../../config/index';
2
- import { GenericFetch } from '../../fetch/index';
1
+ import { ConfigProviderForConfig } from '../../config';
2
+ import { GenericFetch } from '../../fetch';
3
3
  import { UserData } from './utils/embeddedAuthProvider';
4
- import { ApiUser, AuthProvider } from './index';
4
+ import { ApiUser, AuthProvider } from '.';
5
5
  type Config = {
6
6
  accountsBase: string;
7
7
  };
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.browserAuthProvider = void 0;
4
- const index_1 = require("../../index");
5
- const index_2 = require("../../config/index");
6
- const index_3 = require("../../guards/index");
7
- const index_4 = require("../../routing/index");
4
+ const __1 = require("../..");
5
+ const config_1 = require("../../config");
6
+ const guards_1 = require("../../guards");
7
+ const routing_1 = require("../../routing");
8
8
  const embeddedAuthProvider_1 = require("./utils/embeddedAuthProvider");
9
- const isUserData = (0, index_4.unsafePayloadValidator)();
9
+ const isUserData = (0, routing_1.unsafePayloadValidator)();
10
10
  const browserAuthProvider = ({ window, configSpace }) => (configProvider) => {
11
- const config = configProvider[(0, index_3.ifDefined)(configSpace, 'auth')];
12
- const accountsBase = (0, index_1.once)(() => (0, index_2.resolveConfigValue)(config.accountsBase));
11
+ const config = configProvider[(0, guards_1.ifDefined)(configSpace, 'auth')];
12
+ const accountsBase = (0, __1.once)(() => (0, config_1.resolveConfigValue)(config.accountsBase));
13
13
  const queryString = window.location.search;
14
14
  const queryKey = 'auth';
15
15
  const urlSearchParams = new URLSearchParams(queryString);
@@ -91,7 +91,7 @@ const browserAuthProvider = ({ window, configSpace }) => (configProvider) => {
91
91
  const message = await response.text();
92
92
  throw new Error(`Error response from Accounts ${response.status}: ${message}`);
93
93
  };
94
- const getUserData = (0, index_1.once)(async () => {
94
+ const getUserData = (0, __1.once)(async () => {
95
95
  // For backwards compatibility
96
96
  if (authQuery === 'embedded') {
97
97
  return getParentWindowUser();
@@ -103,7 +103,7 @@ const browserAuthProvider = ({ window, configSpace }) => (configProvider) => {
103
103
  return (await getUserData()).user;
104
104
  };
105
105
  const updateUser = async (updates) => {
106
- const response = await window.fetch((await accountsBase()).replace(/\/+$/, '') + '/api/user', { ...getAuthorizedFetchConfigFromData(userData), method: index_4.METHOD.PUT, body: JSON.stringify(updates) });
106
+ const response = await window.fetch((await accountsBase()).replace(/\/+$/, '') + '/api/user', { ...getAuthorizedFetchConfigFromData(userData), method: routing_1.METHOD.PUT, body: JSON.stringify(updates) });
107
107
  if (response.status === 200) {
108
108
  const user = await response.json();
109
109
  if (isUserData(user)) {
@@ -1,6 +1,6 @@
1
- import type { ConfigProviderForConfig } from '../../config/index';
2
- import { GenericFetch } from '../../fetch/index';
3
- import { ApiUser, AuthProvider, CookieAuthProvider } from './index';
1
+ import type { ConfigProviderForConfig } from '../../config';
2
+ import { GenericFetch } from '../../fetch';
3
+ import { ApiUser, AuthProvider, CookieAuthProvider } from '.';
4
4
  type Config = {
5
5
  accountsBase: string;
6
6
  cookieName: string;
@@ -2,14 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.decryptionAuthProvider = void 0;
4
4
  const resolveConfigValue_1 = require("../../config/resolveConfigValue");
5
- const index_1 = require("../../errors/index");
6
- const index_2 = require("../../guards/index");
5
+ const errors_1 = require("../../errors");
6
+ const guards_1 = require("../../guards");
7
7
  const helpers_1 = require("../../misc/helpers");
8
8
  const decryptAndVerify_1 = require("./utils/decryptAndVerify");
9
9
  const userSubrequest_1 = require("./utils/userSubrequest");
10
- const index_3 = require("./index");
10
+ const _1 = require(".");
11
11
  const decryptionAuthProvider = (initializer) => (configProvider) => {
12
- const config = configProvider[(0, index_2.ifDefined)(initializer.configSpace, 'decryption')];
12
+ const config = configProvider[(0, guards_1.ifDefined)(initializer.configSpace, 'decryption')];
13
13
  const accountsBase = (0, helpers_1.once)(() => (0, resolveConfigValue_1.resolveConfigValue)(config.accountsBase));
14
14
  const cookieName = (0, helpers_1.once)(() => (0, resolveConfigValue_1.resolveConfigValue)(config.cookieName));
15
15
  const encryptionPrivateKey = (0, helpers_1.once)(() => (0, resolveConfigValue_1.resolveConfigValue)(config.encryptionPrivateKey));
@@ -17,9 +17,9 @@ const decryptionAuthProvider = (initializer) => (configProvider) => {
17
17
  return ({ request, logger }) => {
18
18
  let user;
19
19
  let userData;
20
- const getAuthToken = async () => (0, index_3.getAuthTokenOrCookie)(request, await cookieName())[0];
20
+ const getAuthToken = async () => (0, _1.getAuthTokenOrCookie)(request, await cookieName())[0];
21
21
  const getAuthorizedFetchConfig = async () => {
22
- const [token, headers] = (0, index_3.getAuthTokenOrCookie)(request, await cookieName());
22
+ const [token, headers] = (0, _1.getAuthTokenOrCookie)(request, await cookieName());
23
23
  if (!token) {
24
24
  return {};
25
25
  }
@@ -39,7 +39,7 @@ const decryptionAuthProvider = (initializer) => (configProvider) => {
39
39
  return undefined;
40
40
  }
41
41
  if ('error' in result && result.error == 'expired token') {
42
- throw new index_1.SessionExpiredError();
42
+ throw new errors_1.SessionExpiredError();
43
43
  }
44
44
  if ('user' in result) {
45
45
  logger.setContext({ user: result.user.uuid });
@@ -1,6 +1,6 @@
1
- import type { FetchConfig } from '../../fetch/index';
2
- import type { HttpHeaders, QueryParams } from '../../routing/index';
3
- import type { Logger } from '../logger/index';
1
+ import type { FetchConfig } from '../../fetch';
2
+ import type { HttpHeaders, QueryParams } from '../../routing';
3
+ import type { Logger } from '../logger';
4
4
  export type ConsentPreferences = {
5
5
  consent_preferences: {
6
6
  accepted: string[];
@@ -1,7 +1,7 @@
1
- import { AccountsGateway } from '../accountsGateway/index';
1
+ import { AccountsGateway } from '../accountsGateway';
2
2
  import { LaunchVerifier } from '../launchParams/verifier';
3
- import type { Logger } from '../logger/index';
4
- import { AuthProvider } from './index';
3
+ import type { Logger } from '../logger';
4
+ import { AuthProvider } from '.';
5
5
  export declare const launchTokenAuthMiddleware: () => <M extends {
6
6
  logger: Logger;
7
7
  accountsGateway: AccountsGateway;
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.launchTokenAuthMiddleware = void 0;
4
- const index_1 = require("../../assertions/index");
4
+ const assertions_1 = require("../../assertions");
5
5
  const helpers_1 = require("../../misc/helpers");
6
6
  const stubAuthProvider = (services) => {
7
7
  const getUserUuid = (0, helpers_1.once)(async () => {
8
8
  const token = await services.launchVerifier.verify();
9
- return (0, index_1.assertDefined)(token.sub, new Error('Launch token does not contain a user UUID'));
9
+ return (0, assertions_1.assertDefined)(token.sub, new Error('Launch token does not contain a user UUID'));
10
10
  });
11
11
  const getUser = (0, helpers_1.once)(async () => {
12
12
  const uuid = await getUserUuid();
13
13
  const { items } = await services.accountsGateway.searchUsers({ q: `uuid:${uuid}` });
14
- return (0, index_1.assertDefined)(items[0], new Error(`User with UUID ${uuid} not found`));
14
+ return (0, assertions_1.assertDefined)(items[0], new Error(`User with UUID ${uuid} not found`));
15
15
  });
16
16
  return {
17
17
  getAuthToken: () => {
@@ -1,6 +1,6 @@
1
- import { ConfigProviderForConfig } from '../../config/index';
2
- import { GenericFetch } from '../../fetch/index';
3
- import { CookieAuthProvider } from './index';
1
+ import { ConfigProviderForConfig } from '../../config';
2
+ import { GenericFetch } from '../../fetch';
3
+ import { CookieAuthProvider } from '.';
4
4
  type Config = {
5
5
  accountsBase: string;
6
6
  cookieName: string;
@@ -1,20 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.subrequestAuthProvider = void 0;
4
- const index_1 = require("../../index");
5
- const index_2 = require("../../config/index");
6
- const index_3 = require("../../guards/index");
4
+ const __1 = require("../..");
5
+ const config_1 = require("../../config");
6
+ const guards_1 = require("../../guards");
7
7
  const userSubrequest_1 = require("./utils/userSubrequest");
8
- const index_4 = require("./index");
8
+ const _1 = require(".");
9
9
  const subrequestAuthProvider = (initializer) => (configProvider) => {
10
- const config = configProvider[(0, index_3.ifDefined)(initializer.configSpace, 'subrequest')];
11
- const cookieName = (0, index_1.once)(() => (0, index_2.resolveConfigValue)(config.cookieName));
12
- const accountsBase = (0, index_1.once)(() => (0, index_2.resolveConfigValue)(config.accountsBase));
10
+ const config = configProvider[(0, guards_1.ifDefined)(initializer.configSpace, 'subrequest')];
11
+ const cookieName = (0, __1.once)(() => (0, config_1.resolveConfigValue)(config.cookieName));
12
+ const accountsBase = (0, __1.once)(() => (0, config_1.resolveConfigValue)(config.accountsBase));
13
13
  return ({ request, logger }) => {
14
14
  let user;
15
- const getAuthToken = async () => (0, index_4.getAuthTokenOrCookie)(request, await cookieName())[0];
15
+ const getAuthToken = async () => (0, _1.getAuthTokenOrCookie)(request, await cookieName())[0];
16
16
  const getAuthorizedFetchConfig = async () => {
17
- const [token, headers] = (0, index_4.getAuthTokenOrCookie)(request, await cookieName());
17
+ const [token, headers] = (0, _1.getAuthTokenOrCookie)(request, await cookieName());
18
18
  if (!token) {
19
19
  return {};
20
20
  }
@@ -22,7 +22,7 @@ const subrequestAuthProvider = (initializer) => (configProvider) => {
22
22
  };
23
23
  const loadUser = async () => {
24
24
  const resolvedCookieName = await cookieName();
25
- const [token] = (0, index_4.getAuthTokenOrCookie)(request, resolvedCookieName);
25
+ const [token] = (0, _1.getAuthTokenOrCookie)(request, resolvedCookieName);
26
26
  if (!token) {
27
27
  return undefined;
28
28
  }
@@ -1,4 +1,4 @@
1
- import type { User } from '../index';
1
+ import type { User } from '..';
2
2
  export declare const decryptJwe: (jwe: string, encryptionPrivateKey: Buffer | string) => string | undefined;
3
3
  type MaybeAccountsSSOToken = {
4
4
  iss?: string;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.decryptAndVerify = exports.verifyJws = exports.decryptJwe = void 0;
4
4
  const crypto_1 = require("crypto");
5
- const index_1 = require("../../../guards/index");
5
+ const guards_1 = require("../../../guards");
6
6
  const decryptJwe = (jwe, encryptionPrivateKey) => {
7
7
  const jweParts = jwe.split('.', 6);
8
8
  if (jweParts.length !== 5 || jweParts[1]) {
@@ -73,8 +73,8 @@ const decryptAndVerify = (token, encryptionPrivateKey, signaturePublicKey) => {
73
73
  const payload = (0, exports.verifyJws)(jws, signaturePublicKey);
74
74
  // Ensure payload contains all the claims we expect
75
75
  // Normally "sub" would be a string but Accounts uses an object for it instead
76
- if (!(0, index_1.isPlainObject)(payload) ||
77
- !(0, index_1.isPlainObject)(payload.sub) || !payload.sub.uuid ||
76
+ if (!(0, guards_1.isPlainObject)(payload) ||
77
+ !(0, guards_1.isPlainObject)(payload.sub) || !payload.sub.uuid ||
78
78
  payload.iss !== issuer ||
79
79
  payload.aud !== audience ||
80
80
  !payload.exp ||
@@ -1,4 +1,4 @@
1
- import { User } from '../index';
1
+ import { User } from '..';
2
2
  import { Window } from '../browser';
3
3
  export type UserData<T = User> = {
4
4
  user?: T;
@@ -1,6 +1,6 @@
1
- import { AuthProvider } from '../index';
2
- import { AssertionFailed } from '../../../assertions/index';
3
- import { ConfigProviderForConfig } from '../../../config/index';
1
+ import { AuthProvider } from '..';
2
+ import { AssertionFailed } from '../../../assertions';
3
+ import { ConfigProviderForConfig } from '../../../config';
4
4
  type Config = {
5
5
  application: string;
6
6
  };
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createUserRoleValidator = void 0;
4
- const index_1 = require("../../../assertions/index");
4
+ const assertions_1 = require("../../../assertions");
5
5
  const resolveConfigValue_1 = require("../../../config/resolveConfigValue");
6
- const index_2 = require("../../../errors/index");
6
+ const errors_1 = require("../../../errors");
7
7
  const helpers_1 = require("../../../misc/helpers");
8
8
  const createUserRoleValidator = (auth, config) => {
9
9
  const application = (0, helpers_1.once)(() => (0, resolveConfigValue_1.resolveConfigValue)(config.application));
@@ -23,9 +23,9 @@ const createUserRoleValidator = (auth, config) => {
23
23
  }
24
24
  return true;
25
25
  };
26
- const assertUserRole = async (role, fail = new index_2.UnauthorizedError()) => {
26
+ const assertUserRole = async (role, fail = new errors_1.UnauthorizedError()) => {
27
27
  if (!await userHasRole(role)) {
28
- return (0, index_1.doThrow)(fail);
28
+ return (0, assertions_1.doThrow)(fail);
29
29
  }
30
30
  };
31
31
  return {
@@ -1,3 +1,3 @@
1
- import { ApiUser } from '../index';
2
- import { GenericFetch } from '../../../fetch/index';
1
+ import { ApiUser } from '..';
2
+ import { GenericFetch } from '../../../fetch';
3
3
  export declare const loadUserData: (fetch: GenericFetch, accountsBase: string, cookieName: string, token: string) => Promise<ApiUser | undefined>;
@@ -1,5 +1,5 @@
1
1
  import { AttributeValue } from '@aws-sdk/client-dynamodb';
2
- import { DocumentBaseType, DocumentBaseValueTypes } from './index';
2
+ import { DocumentBaseType, DocumentBaseValueTypes } from '.';
3
3
  export declare const encodeDynamoAttribute: (value: DocumentBaseValueTypes) => AttributeValue;
4
4
  export declare const encodeDynamoDocument: (base: DocumentBaseType) => {
5
5
  [k: string]: AttributeValue;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.decodeDynamoDocument = exports.decodeDynamoAttribute = exports.encodeDynamoDocument = exports.encodeDynamoAttribute = void 0;
4
- const index_1 = require("../../guards/index");
4
+ const guards_1 = require("../../guards");
5
5
  const encodeDynamoAttribute = (value) => {
6
6
  if (typeof value === 'string') {
7
7
  return { S: value };
@@ -18,7 +18,7 @@ const encodeDynamoAttribute = (value) => {
18
18
  if (Array.isArray(value)) {
19
19
  return { L: value.map(exports.encodeDynamoAttribute) };
20
20
  }
21
- if ((0, index_1.isPlainObject)(value)) {
21
+ if ((0, guards_1.isPlainObject)(value)) {
22
22
  return { M: (0, exports.encodeDynamoDocument)(value) };
23
23
  }
24
24
  throw new Error(`unknown attribute type ${typeof value} with value ${value}.`);
@@ -1,6 +1,6 @@
1
1
  import { DynamoDB } from '@aws-sdk/client-dynamodb';
2
- import { Config, TDocument } from '../index';
3
- import { ConfigProviderForConfig } from '../../../config/index';
2
+ import { Config, TDocument } from '..';
3
+ import { ConfigProviderForConfig } from '../../../config';
4
4
  interface Initializer<C> {
5
5
  configSpace?: C;
6
6
  dynamoClient?: DynamoDB;
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.dynamoUnversionedDocumentStore = void 0;
7
7
  const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
8
8
  const tiny_async_pool_1 = __importDefault(require("tiny-async-pool"));
9
- const index_1 = require("../../../index");
10
- const index_2 = require("../../../config/index");
11
- const index_3 = require("../../../errors/index");
12
- const index_4 = require("../../../guards/index");
9
+ const __1 = require("../../..");
10
+ const config_1 = require("../../../config");
11
+ const errors_1 = require("../../../errors");
12
+ const guards_1 = require("../../../guards");
13
13
  const dynamoEncoding_1 = require("../dynamoEncoding");
14
14
  const dynamoUnversionedDocumentStore = (initializer) => {
15
- const init = (0, index_4.ifDefined)(initializer, {});
16
- const dynamodb = (0, index_1.once)(() => { var _a; return (_a = init.dynamoClient) !== null && _a !== void 0 ? _a : new client_dynamodb_1.DynamoDB({ apiVersion: '2012-08-10' }); });
15
+ const init = (0, guards_1.ifDefined)(initializer, {});
16
+ const dynamodb = (0, __1.once)(() => { var _a; return (_a = init.dynamoClient) !== null && _a !== void 0 ? _a : new client_dynamodb_1.DynamoDB({ apiVersion: '2012-08-10' }); });
17
17
  return () => (configProvider) => (_, hashKey, options) => {
18
- const tableName = (0, index_1.once)(() => (0, index_2.resolveConfigValue)(configProvider[(0, index_4.ifDefined)(init.configSpace, 'dynamodb')].tableName));
18
+ const tableName = (0, __1.once)(() => (0, config_1.resolveConfigValue)(configProvider[(0, guards_1.ifDefined)(init.configSpace, 'dynamodb')].tableName));
19
19
  return {
20
20
  loadAllDocumentsTheBadWay: async () => {
21
21
  const loadAllResults = async (ExclusiveStartKey) => {
@@ -99,17 +99,17 @@ const dynamoUnversionedDocumentStore = (initializer) => {
99
99
  var _a, _b, _c;
100
100
  const result = (_b = (_a = item.Attributes) === null || _a === void 0 ? void 0 : _a[field]) === null || _b === void 0 ? void 0 : _b['N'];
101
101
  if (!item.Attributes) {
102
- throw new index_3.NotFoundError(`Item with ${key} "${id}" does not exist`);
102
+ throw new errors_1.NotFoundError(`Item with ${key} "${id}" does not exist`);
103
103
  }
104
104
  if (!result) {
105
- throw new index_3.NotFoundError(`Item with ${key} "${id}" did not produce field "${field}"`);
105
+ throw new errors_1.NotFoundError(`Item with ${key} "${id}" did not produce field "${field}"`);
106
106
  }
107
107
  const updatedDoc = (0, dynamoEncoding_1.decodeDynamoDocument)(item.Attributes);
108
108
  await ((_c = options === null || options === void 0 ? void 0 : options.afterWrite) === null || _c === void 0 ? void 0 : _c.call(options, updatedDoc));
109
109
  return parseFloat(result);
110
110
  }).catch((error) => {
111
111
  throw error.name === 'ConditionalCheckFailedException' ?
112
- new index_3.NotFoundError(`Item with ${key} "${id}" does not exist`) : error;
112
+ new errors_1.NotFoundError(`Item with ${key} "${id}" does not exist`) : error;
113
113
  });
114
114
  },
115
115
  /* replaces only specified attributes with the given data */
@@ -143,14 +143,14 @@ const dynamoUnversionedDocumentStore = (initializer) => {
143
143
  return dynamodb().send(cmd).then(async (item) => {
144
144
  var _a;
145
145
  if (!item.Attributes) {
146
- throw new index_3.NotFoundError(`Item with ${key} "${id}" does not exist`);
146
+ throw new errors_1.NotFoundError(`Item with ${key} "${id}" does not exist`);
147
147
  }
148
148
  const updatedDoc = (0, dynamoEncoding_1.decodeDynamoDocument)(item.Attributes);
149
149
  await ((_a = options === null || options === void 0 ? void 0 : options.afterWrite) === null || _a === void 0 ? void 0 : _a.call(options, updatedDoc));
150
150
  return updatedDoc;
151
151
  }).catch((error) => {
152
152
  throw error.name === 'ConditionalCheckFailedException' ?
153
- new index_3.NotFoundError(`Item with ${key} "${id}" does not exist`) : error;
153
+ new errors_1.NotFoundError(`Item with ${key} "${id}" does not exist`) : error;
154
154
  });
155
155
  },
156
156
  /* replaces the entire document with the given data */
@@ -176,7 +176,7 @@ const dynamoUnversionedDocumentStore = (initializer) => {
176
176
  });
177
177
  return await dynamodb().send(cmd).then(() => item).catch((error) => {
178
178
  throw error.name === 'ConditionalCheckFailedException' ?
179
- new index_3.ConflictError(`Item with ${String(hashKey)} "${item[hashKey]}" already exists`) : error;
179
+ new errors_1.ConflictError(`Item with ${String(hashKey)} "${item[hashKey]}" already exists`) : error;
180
180
  }).then(async (createdDoc) => {
181
181
  var _a;
182
182
  await ((_a = options === null || options === void 0 ? void 0 : options.afterWrite) === null || _a === void 0 ? void 0 : _a.call(options, createdDoc));
@@ -210,7 +210,7 @@ const dynamoUnversionedDocumentStore = (initializer) => {
210
210
  }
211
211
  catch (error) {
212
212
  const processedError = error.name === 'ConditionalCheckFailedException' ?
213
- new index_3.ConflictError(`Item with ${String(hashKey)} "${item[hashKey]}" already exists`) : error;
213
+ new errors_1.ConflictError(`Item with ${String(hashKey)} "${item[hashKey]}" already exists`) : error;
214
214
  return { success: false, item, error: processedError };
215
215
  }
216
216
  })) {
@@ -1,5 +1,5 @@
1
- import { Config, TDocument } from '../index';
2
- import { ConfigProviderForConfig } from '../../../config/index';
1
+ import { Config, TDocument } from '..';
2
+ import { ConfigProviderForConfig } from '../../../config';
3
3
  interface Initializer<C> {
4
4
  dataDir: string;
5
5
  fs?: Pick<typeof import('fs'), 'mkdir' | 'readdir' | 'readFile' | 'writeFile'>;