@openstax/ts-utils 1.43.0 → 1.43.1

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 (194) 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/middleware/apiErrorHandler.d.ts +3 -3
  13. package/dist/cjs/middleware/apiErrorHandler.js +12 -12
  14. package/dist/cjs/middleware/apiSlowResponseMiddleware.d.ts +3 -3
  15. package/dist/cjs/middleware/apiSlowResponseMiddleware.js +5 -5
  16. package/dist/cjs/middleware/lambdaCorsResponseMiddleware.d.ts +2 -2
  17. package/dist/cjs/middleware/lambdaCorsResponseMiddleware.js +2 -2
  18. package/dist/cjs/middleware/throwNotFoundMiddleware.js +2 -2
  19. package/dist/cjs/misc/helpers.d.ts +1 -1
  20. package/dist/cjs/misc/merge.js +2 -2
  21. package/dist/cjs/pagination/index.d.ts +1 -1
  22. package/dist/cjs/pagination/index.js +10 -10
  23. package/dist/cjs/routing/helpers.d.ts +1 -1
  24. package/dist/cjs/routing/helpers.js +7 -7
  25. package/dist/cjs/routing/index.d.ts +1 -1
  26. package/dist/cjs/routing/lambdaBatchRequestHandler.d.ts +2 -2
  27. package/dist/cjs/routing/lambdaBatchRequestHandler.js +2 -2
  28. package/dist/cjs/routing/validators/zod.js +2 -2
  29. package/dist/cjs/services/accountsGateway/index.d.ts +5 -5
  30. package/dist/cjs/services/accountsGateway/index.js +17 -17
  31. package/dist/cjs/services/apiGateway/index.d.ts +4 -4
  32. package/dist/cjs/services/apiGateway/index.js +10 -10
  33. package/dist/cjs/services/authProvider/browser.d.ts +3 -3
  34. package/dist/cjs/services/authProvider/browser.js +9 -9
  35. package/dist/cjs/services/authProvider/decryption.d.ts +3 -3
  36. package/dist/cjs/services/authProvider/decryption.js +7 -7
  37. package/dist/cjs/services/authProvider/index.d.ts +3 -3
  38. package/dist/cjs/services/authProvider/launchToken.d.ts +3 -3
  39. package/dist/cjs/services/authProvider/launchToken.js +3 -3
  40. package/dist/cjs/services/authProvider/subrequest.d.ts +3 -3
  41. package/dist/cjs/services/authProvider/subrequest.js +10 -10
  42. package/dist/cjs/services/authProvider/utils/decryptAndVerify.d.ts +1 -1
  43. package/dist/cjs/services/authProvider/utils/decryptAndVerify.js +3 -3
  44. package/dist/cjs/services/authProvider/utils/embeddedAuthProvider.d.ts +1 -1
  45. package/dist/cjs/services/authProvider/utils/userRoleValidator.d.ts +3 -3
  46. package/dist/cjs/services/authProvider/utils/userRoleValidator.js +4 -4
  47. package/dist/cjs/services/authProvider/utils/userSubrequest.d.ts +2 -2
  48. package/dist/cjs/services/documentStore/dynamoEncoding.d.ts +1 -1
  49. package/dist/cjs/services/documentStore/dynamoEncoding.js +2 -2
  50. package/dist/cjs/services/documentStore/unversioned/dynamodb.d.ts +2 -2
  51. package/dist/cjs/services/documentStore/unversioned/dynamodb.js +14 -14
  52. package/dist/cjs/services/documentStore/unversioned/file-system.d.ts +2 -2
  53. package/dist/cjs/services/documentStore/unversioned/file-system.js +13 -13
  54. package/dist/cjs/services/documentStore/versioned/dynamodb.d.ts +3 -3
  55. package/dist/cjs/services/documentStore/versioned/dynamodb.js +6 -6
  56. package/dist/cjs/services/documentStore/versioned/file-system.d.ts +3 -3
  57. package/dist/cjs/services/documentStore/versioned/index.d.ts +1 -1
  58. package/dist/cjs/services/exercisesGateway/index.d.ts +2 -2
  59. package/dist/cjs/services/exercisesGateway/index.js +14 -14
  60. package/dist/cjs/services/fileServer/index.js +3 -3
  61. package/dist/cjs/services/fileServer/localFileServer.d.ts +2 -2
  62. package/dist/cjs/services/fileServer/localFileServer.js +9 -9
  63. package/dist/cjs/services/fileServer/s3FileServer.d.ts +2 -2
  64. package/dist/cjs/services/fileServer/s3FileServer.js +13 -13
  65. package/dist/cjs/services/httpMessageVerifier/index.d.ts +1 -1
  66. package/dist/cjs/services/httpMessageVerifier/index.js +16 -16
  67. package/dist/cjs/services/launchParams/signer.d.ts +2 -2
  68. package/dist/cjs/services/launchParams/signer.js +9 -9
  69. package/dist/cjs/services/launchParams/verifier.d.ts +1 -1
  70. package/dist/cjs/services/launchParams/verifier.js +8 -8
  71. package/dist/cjs/services/logger/console.d.ts +1 -1
  72. package/dist/cjs/services/logger/console.js +2 -2
  73. package/dist/cjs/services/logger/index.d.ts +1 -1
  74. package/dist/cjs/services/lrsGateway/addStatementDefaultFields.d.ts +1 -1
  75. package/dist/cjs/services/lrsGateway/attempt-utils.d.ts +7 -7
  76. package/dist/cjs/services/lrsGateway/batching.d.ts +2 -2
  77. package/dist/cjs/services/lrsGateway/batching.js +2 -2
  78. package/dist/cjs/services/lrsGateway/file-system.d.ts +3 -3
  79. package/dist/cjs/services/lrsGateway/file-system.js +8 -8
  80. package/dist/cjs/services/lrsGateway/index.d.ts +4 -4
  81. package/dist/cjs/services/lrsGateway/index.js +15 -15
  82. package/dist/cjs/services/lrsGateway/xapiUtils.d.ts +3 -3
  83. package/dist/cjs/services/lrsGateway/xapiUtils.js +2 -2
  84. package/dist/cjs/services/postgresConnection/index.d.ts +2 -2
  85. package/dist/cjs/services/postgresConnection/index.js +10 -10
  86. package/dist/cjs/services/queueProvider/local.d.ts +2 -2
  87. package/dist/cjs/services/queueProvider/local.js +5 -5
  88. package/dist/cjs/services/queueProvider/sqs.d.ts +2 -2
  89. package/dist/cjs/services/queueProvider/sqs.js +5 -5
  90. package/dist/cjs/services/searchProvider/memorySearchTheBadWay.d.ts +1 -1
  91. package/dist/cjs/services/searchProvider/memorySearchTheBadWay.js +9 -9
  92. package/dist/cjs/services/searchProvider/openSearch.d.ts +2 -2
  93. package/dist/cjs/services/searchProvider/openSearch.js +6 -6
  94. package/dist/cjs/services/searchProvider/streamIndexer.d.ts +2 -2
  95. package/dist/cjs/services/searchProvider/streamIndexer.js +3 -3
  96. package/dist/cjs/tsconfig.without-specs.cjs.tsbuildinfo +1 -1
  97. package/dist/esm/aws/ssmService.js +1 -1
  98. package/dist/esm/config/awsParameterConfig.d.ts +1 -1
  99. package/dist/esm/config/awsParameterConfig.js +1 -1
  100. package/dist/esm/config/envConfig.d.ts +1 -1
  101. package/dist/esm/config/lambdaParameterConfig.d.ts +1 -1
  102. package/dist/esm/config/lambdaParameterConfig.js +2 -2
  103. package/dist/esm/config/replaceConfig.d.ts +1 -1
  104. package/dist/esm/config/resolveConfigValue.d.ts +1 -1
  105. package/dist/esm/errors/index.d.ts +1 -1
  106. package/dist/esm/fetch/fetchStatusRetry.d.ts +1 -1
  107. package/dist/esm/fetch/index.d.ts +1 -1
  108. package/dist/esm/middleware/apiErrorHandler.d.ts +3 -3
  109. package/dist/esm/middleware/apiErrorHandler.js +3 -3
  110. package/dist/esm/middleware/apiSlowResponseMiddleware.d.ts +3 -3
  111. package/dist/esm/middleware/apiSlowResponseMiddleware.js +2 -2
  112. package/dist/esm/middleware/lambdaCorsResponseMiddleware.d.ts +2 -2
  113. package/dist/esm/middleware/lambdaCorsResponseMiddleware.js +1 -1
  114. package/dist/esm/middleware/throwNotFoundMiddleware.js +1 -1
  115. package/dist/esm/misc/helpers.d.ts +1 -1
  116. package/dist/esm/misc/merge.js +1 -1
  117. package/dist/esm/pagination/index.d.ts +1 -1
  118. package/dist/esm/pagination/index.js +3 -3
  119. package/dist/esm/routing/helpers.d.ts +1 -1
  120. package/dist/esm/routing/helpers.js +3 -3
  121. package/dist/esm/routing/index.d.ts +1 -1
  122. package/dist/esm/routing/lambdaBatchRequestHandler.d.ts +2 -2
  123. package/dist/esm/routing/lambdaBatchRequestHandler.js +1 -1
  124. package/dist/esm/routing/validators/zod.js +1 -1
  125. package/dist/esm/services/accountsGateway/index.d.ts +5 -5
  126. package/dist/esm/services/accountsGateway/index.js +4 -4
  127. package/dist/esm/services/apiGateway/index.d.ts +4 -4
  128. package/dist/esm/services/apiGateway/index.js +4 -4
  129. package/dist/esm/services/authProvider/browser.d.ts +3 -3
  130. package/dist/esm/services/authProvider/browser.js +4 -4
  131. package/dist/esm/services/authProvider/decryption.d.ts +3 -3
  132. package/dist/esm/services/authProvider/decryption.js +3 -3
  133. package/dist/esm/services/authProvider/index.d.ts +3 -3
  134. package/dist/esm/services/authProvider/launchToken.d.ts +3 -3
  135. package/dist/esm/services/authProvider/launchToken.js +1 -1
  136. package/dist/esm/services/authProvider/subrequest.d.ts +3 -3
  137. package/dist/esm/services/authProvider/subrequest.js +4 -4
  138. package/dist/esm/services/authProvider/utils/decryptAndVerify.d.ts +1 -1
  139. package/dist/esm/services/authProvider/utils/decryptAndVerify.js +1 -1
  140. package/dist/esm/services/authProvider/utils/embeddedAuthProvider.d.ts +1 -1
  141. package/dist/esm/services/authProvider/utils/userRoleValidator.d.ts +3 -3
  142. package/dist/esm/services/authProvider/utils/userRoleValidator.js +2 -2
  143. package/dist/esm/services/authProvider/utils/userSubrequest.d.ts +2 -2
  144. package/dist/esm/services/documentStore/dynamoEncoding.d.ts +1 -1
  145. package/dist/esm/services/documentStore/dynamoEncoding.js +1 -1
  146. package/dist/esm/services/documentStore/unversioned/dynamodb.d.ts +2 -2
  147. package/dist/esm/services/documentStore/unversioned/dynamodb.js +4 -4
  148. package/dist/esm/services/documentStore/unversioned/file-system.d.ts +2 -2
  149. package/dist/esm/services/documentStore/unversioned/file-system.js +4 -4
  150. package/dist/esm/services/documentStore/versioned/dynamodb.d.ts +3 -3
  151. package/dist/esm/services/documentStore/versioned/dynamodb.js +3 -3
  152. package/dist/esm/services/documentStore/versioned/file-system.d.ts +3 -3
  153. package/dist/esm/services/documentStore/versioned/index.d.ts +1 -1
  154. package/dist/esm/services/exercisesGateway/index.d.ts +2 -2
  155. package/dist/esm/services/exercisesGateway/index.js +5 -5
  156. package/dist/esm/services/fileServer/index.js +1 -1
  157. package/dist/esm/services/fileServer/localFileServer.d.ts +2 -2
  158. package/dist/esm/services/fileServer/localFileServer.js +3 -3
  159. package/dist/esm/services/fileServer/s3FileServer.d.ts +2 -2
  160. package/dist/esm/services/fileServer/s3FileServer.js +4 -4
  161. package/dist/esm/services/httpMessageVerifier/index.d.ts +1 -1
  162. package/dist/esm/services/httpMessageVerifier/index.js +3 -3
  163. package/dist/esm/services/launchParams/signer.d.ts +2 -2
  164. package/dist/esm/services/launchParams/signer.js +3 -3
  165. package/dist/esm/services/launchParams/verifier.d.ts +1 -1
  166. package/dist/esm/services/launchParams/verifier.js +3 -3
  167. package/dist/esm/services/logger/console.d.ts +1 -1
  168. package/dist/esm/services/logger/console.js +1 -1
  169. package/dist/esm/services/logger/index.d.ts +1 -1
  170. package/dist/esm/services/lrsGateway/addStatementDefaultFields.d.ts +1 -1
  171. package/dist/esm/services/lrsGateway/attempt-utils.d.ts +7 -7
  172. package/dist/esm/services/lrsGateway/batching.d.ts +2 -2
  173. package/dist/esm/services/lrsGateway/batching.js +1 -1
  174. package/dist/esm/services/lrsGateway/file-system.d.ts +3 -3
  175. package/dist/esm/services/lrsGateway/file-system.js +4 -4
  176. package/dist/esm/services/lrsGateway/index.d.ts +4 -4
  177. package/dist/esm/services/lrsGateway/index.js +6 -6
  178. package/dist/esm/services/lrsGateway/xapiUtils.d.ts +3 -3
  179. package/dist/esm/services/lrsGateway/xapiUtils.js +1 -1
  180. package/dist/esm/services/postgresConnection/index.d.ts +2 -2
  181. package/dist/esm/services/postgresConnection/index.js +3 -3
  182. package/dist/esm/services/queueProvider/local.d.ts +2 -2
  183. package/dist/esm/services/queueProvider/local.js +2 -2
  184. package/dist/esm/services/queueProvider/sqs.d.ts +2 -2
  185. package/dist/esm/services/queueProvider/sqs.js +2 -2
  186. package/dist/esm/services/searchProvider/memorySearchTheBadWay.d.ts +1 -1
  187. package/dist/esm/services/searchProvider/memorySearchTheBadWay.js +3 -3
  188. package/dist/esm/services/searchProvider/openSearch.d.ts +2 -2
  189. package/dist/esm/services/searchProvider/openSearch.js +2 -2
  190. package/dist/esm/services/searchProvider/streamIndexer.d.ts +2 -2
  191. package/dist/esm/services/searchProvider/streamIndexer.js +1 -1
  192. package/dist/esm/tsconfig.without-specs.esm.tsbuildinfo +1 -1
  193. package/package.json +1 -1
  194. package/script/bin/.init-params-script.bash.swp +0 -0
@@ -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 __1 = require("../..");
44
- const config_1 = require("../../config");
45
- const errors_1 = require("../../errors");
43
+ const index_1 = require("../../index");
44
+ const index_2 = require("../../config/index");
45
+ const index_3 = require("../../errors/index");
46
46
  const fetchStatusRetry_1 = require("../../fetch/fetchStatusRetry");
47
- const logger_1 = require("../logger");
47
+ const index_4 = require("../logger/index");
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, config_1.resolveConfigValue)(config.apiBase);
64
+ const apiBase = await (0, index_2.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, __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, index_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', logger_1.Level.Info);
80
- return fetcher(url, (0, __1.merge)(baseOptions, {
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, {
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 errors_1.UnauthorizedError();
93
+ throw new index_3.UnauthorizedError();
94
94
  }
95
95
  if (response.status === 440) {
96
- throw new errors_1.SessionExpiredError();
96
+ throw new index_3.SessionExpiredError();
97
97
  }
98
98
  return {
99
99
  status: response.status,
@@ -1,7 +1,7 @@
1
- import { ConfigProviderForConfig } from '../../config';
2
- import { GenericFetch } from '../../fetch';
1
+ import { ConfigProviderForConfig } from '../../config/index';
2
+ import { GenericFetch } from '../../fetch/index';
3
3
  import { UserData } from './utils/embeddedAuthProvider';
4
- import { ApiUser, AuthProvider } from '.';
4
+ import { ApiUser, AuthProvider } from './index';
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 __1 = require("../..");
5
- const config_1 = require("../../config");
6
- const guards_1 = require("../../guards");
7
- const routing_1 = require("../../routing");
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");
8
8
  const embeddedAuthProvider_1 = require("./utils/embeddedAuthProvider");
9
- const isUserData = (0, routing_1.unsafePayloadValidator)();
9
+ const isUserData = (0, index_4.unsafePayloadValidator)();
10
10
  const browserAuthProvider = ({ window, configSpace }) => (configProvider) => {
11
- const config = configProvider[(0, guards_1.ifDefined)(configSpace, 'auth')];
12
- const accountsBase = (0, __1.once)(() => (0, config_1.resolveConfigValue)(config.accountsBase));
11
+ const config = configProvider[(0, index_3.ifDefined)(configSpace, 'auth')];
12
+ const accountsBase = (0, index_1.once)(() => (0, index_2.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, __1.once)(async () => {
94
+ const getUserData = (0, index_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: routing_1.METHOD.PUT, body: JSON.stringify(updates) });
106
+ const response = await window.fetch((await accountsBase()).replace(/\/+$/, '') + '/api/user', { ...getAuthorizedFetchConfigFromData(userData), method: index_4.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';
2
- import { GenericFetch } from '../../fetch';
3
- import { ApiUser, AuthProvider, CookieAuthProvider } from '.';
1
+ import type { ConfigProviderForConfig } from '../../config/index';
2
+ import { GenericFetch } from '../../fetch/index';
3
+ import { ApiUser, AuthProvider, CookieAuthProvider } from './index';
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 errors_1 = require("../../errors");
6
- const guards_1 = require("../../guards");
5
+ const index_1 = require("../../errors/index");
6
+ const index_2 = require("../../guards/index");
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 _1 = require(".");
10
+ const index_3 = require("./index");
11
11
  const decryptionAuthProvider = (initializer) => (configProvider) => {
12
- const config = configProvider[(0, guards_1.ifDefined)(initializer.configSpace, 'decryption')];
12
+ const config = configProvider[(0, index_2.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, _1.getAuthTokenOrCookie)(request, await cookieName())[0];
20
+ const getAuthToken = async () => (0, index_3.getAuthTokenOrCookie)(request, await cookieName())[0];
21
21
  const getAuthorizedFetchConfig = async () => {
22
- const [token, headers] = (0, _1.getAuthTokenOrCookie)(request, await cookieName());
22
+ const [token, headers] = (0, index_3.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 errors_1.SessionExpiredError();
42
+ throw new index_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';
2
- import type { HttpHeaders, QueryParams } from '../../routing';
3
- import type { Logger } from '../logger';
1
+ import type { FetchConfig } from '../../fetch/index';
2
+ import type { HttpHeaders, QueryParams } from '../../routing/index';
3
+ import type { Logger } from '../logger/index';
4
4
  export type ConsentPreferences = {
5
5
  consent_preferences: {
6
6
  accepted: string[];
@@ -1,7 +1,7 @@
1
- import { AccountsGateway } from '../accountsGateway';
1
+ import { AccountsGateway } from '../accountsGateway/index';
2
2
  import { LaunchVerifier } from '../launchParams/verifier';
3
- import type { Logger } from '../logger';
4
- import { AuthProvider } from '.';
3
+ import type { Logger } from '../logger/index';
4
+ import { AuthProvider } from './index';
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 assertions_1 = require("../../assertions");
4
+ const index_1 = require("../../assertions/index");
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, assertions_1.assertDefined)(token.sub, new Error('Launch token does not contain a user UUID'));
9
+ return (0, index_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, assertions_1.assertDefined)(items[0], new Error(`User with UUID ${uuid} not found`));
14
+ return (0, index_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';
2
- import { GenericFetch } from '../../fetch';
3
- import { CookieAuthProvider } from '.';
1
+ import { ConfigProviderForConfig } from '../../config/index';
2
+ import { GenericFetch } from '../../fetch/index';
3
+ import { CookieAuthProvider } from './index';
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 __1 = require("../..");
5
- const config_1 = require("../../config");
6
- const guards_1 = require("../../guards");
4
+ const index_1 = require("../../index");
5
+ const index_2 = require("../../config/index");
6
+ const index_3 = require("../../guards/index");
7
7
  const userSubrequest_1 = require("./utils/userSubrequest");
8
- const _1 = require(".");
8
+ const index_4 = require("./index");
9
9
  const subrequestAuthProvider = (initializer) => (configProvider) => {
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));
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));
13
13
  return ({ request, logger }) => {
14
14
  let user;
15
- const getAuthToken = async () => (0, _1.getAuthTokenOrCookie)(request, await cookieName())[0];
15
+ const getAuthToken = async () => (0, index_4.getAuthTokenOrCookie)(request, await cookieName())[0];
16
16
  const getAuthorizedFetchConfig = async () => {
17
- const [token, headers] = (0, _1.getAuthTokenOrCookie)(request, await cookieName());
17
+ const [token, headers] = (0, index_4.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, _1.getAuthTokenOrCookie)(request, resolvedCookieName);
25
+ const [token] = (0, index_4.getAuthTokenOrCookie)(request, resolvedCookieName);
26
26
  if (!token) {
27
27
  return undefined;
28
28
  }
@@ -1,4 +1,4 @@
1
- import type { User } from '..';
1
+ import type { User } from '../index';
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 guards_1 = require("../../../guards");
5
+ const index_1 = require("../../../guards/index");
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, guards_1.isPlainObject)(payload) ||
77
- !(0, guards_1.isPlainObject)(payload.sub) || !payload.sub.uuid ||
76
+ if (!(0, index_1.isPlainObject)(payload) ||
77
+ !(0, index_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 '..';
1
+ import { User } from '../index';
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 '..';
2
- import { AssertionFailed } from '../../../assertions';
3
- import { ConfigProviderForConfig } from '../../../config';
1
+ import { AuthProvider } from '../index';
2
+ import { AssertionFailed } from '../../../assertions/index';
3
+ import { ConfigProviderForConfig } from '../../../config/index';
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 assertions_1 = require("../../../assertions");
4
+ const index_1 = require("../../../assertions/index");
5
5
  const resolveConfigValue_1 = require("../../../config/resolveConfigValue");
6
- const errors_1 = require("../../../errors");
6
+ const index_2 = require("../../../errors/index");
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 errors_1.UnauthorizedError()) => {
26
+ const assertUserRole = async (role, fail = new index_2.UnauthorizedError()) => {
27
27
  if (!await userHasRole(role)) {
28
- return (0, assertions_1.doThrow)(fail);
28
+ return (0, index_1.doThrow)(fail);
29
29
  }
30
30
  };
31
31
  return {
@@ -1,3 +1,3 @@
1
- import { ApiUser } from '..';
2
- import { GenericFetch } from '../../../fetch';
1
+ import { ApiUser } from '../index';
2
+ import { GenericFetch } from '../../../fetch/index';
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 '.';
2
+ import { DocumentBaseType, DocumentBaseValueTypes } from './index';
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 guards_1 = require("../../guards");
4
+ const index_1 = require("../../guards/index");
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, guards_1.isPlainObject)(value)) {
21
+ if ((0, index_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 '..';
3
- import { ConfigProviderForConfig } from '../../../config';
2
+ import { Config, TDocument } from '../index';
3
+ import { ConfigProviderForConfig } from '../../../config/index';
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 __1 = require("../../..");
10
- const config_1 = require("../../../config");
11
- const errors_1 = require("../../../errors");
12
- const guards_1 = require("../../../guards");
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");
13
13
  const dynamoEncoding_1 = require("../dynamoEncoding");
14
14
  const dynamoUnversionedDocumentStore = (initializer) => {
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' }); });
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' }); });
17
17
  return () => (configProvider) => (_, hashKey, options) => {
18
- const tableName = (0, __1.once)(() => (0, config_1.resolveConfigValue)(configProvider[(0, guards_1.ifDefined)(init.configSpace, 'dynamodb')].tableName));
18
+ const tableName = (0, index_1.once)(() => (0, index_2.resolveConfigValue)(configProvider[(0, index_4.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 errors_1.NotFoundError(`Item with ${key} "${id}" does not exist`);
102
+ throw new index_3.NotFoundError(`Item with ${key} "${id}" does not exist`);
103
103
  }
104
104
  if (!result) {
105
- throw new errors_1.NotFoundError(`Item with ${key} "${id}" did not produce field "${field}"`);
105
+ throw new index_3.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 errors_1.NotFoundError(`Item with ${key} "${id}" does not exist`) : error;
112
+ new index_3.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 errors_1.NotFoundError(`Item with ${key} "${id}" does not exist`);
146
+ throw new index_3.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 errors_1.NotFoundError(`Item with ${key} "${id}" does not exist`) : error;
153
+ new index_3.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 errors_1.ConflictError(`Item with ${String(hashKey)} "${item[hashKey]}" already exists`) : error;
179
+ new index_3.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 errors_1.ConflictError(`Item with ${String(hashKey)} "${item[hashKey]}" already exists`) : error;
213
+ new index_3.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 '..';
2
- import { ConfigProviderForConfig } from '../../../config';
1
+ import { Config, TDocument } from '../index';
2
+ import { ConfigProviderForConfig } from '../../../config/index';
3
3
  interface Initializer<C> {
4
4
  dataDir: string;
5
5
  fs?: Pick<typeof import('fs'), 'mkdir' | 'readdir' | 'readFile' | 'writeFile'>;
@@ -39,16 +39,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.fileSystemUnversionedDocumentStore = void 0;
40
40
  const fsModule = __importStar(require("fs"));
41
41
  const path_1 = __importDefault(require("path"));
42
- const __1 = require("../../..");
43
- const config_1 = require("../../../config");
44
- const errors_1 = require("../../../errors");
45
- const guards_1 = require("../../../guards");
42
+ const index_1 = require("../../../index");
43
+ const index_2 = require("../../../config/index");
44
+ const index_3 = require("../../../errors/index");
45
+ const index_4 = require("../../../guards/index");
46
46
  const fileSystemUnversionedDocumentStore = (initializer) => () => (configProvider) => (_, hashKey, options) => {
47
- const tableName = (0, config_1.resolveConfigValue)(configProvider[initializer.configSpace || 'fileSystem'].tableName);
47
+ const tableName = (0, index_2.resolveConfigValue)(configProvider[initializer.configSpace || 'fileSystem'].tableName);
48
48
  const tablePath = tableName.then((table) => path_1.default.join(initializer.dataDir, table));
49
- const { mkdir, readdir, readFile, writeFile } = (0, guards_1.ifDefined)(initializer.fs, fsModule);
49
+ const { mkdir, readdir, readFile, writeFile } = (0, index_4.ifDefined)(initializer.fs, fsModule);
50
50
  const mkTableDir = new Promise((resolve, reject) => tablePath.then((path) => mkdir(path, { recursive: true }, (err) => err && err.code !== 'EEXIST' ? reject(err) : resolve())));
51
- const hashFilename = (value) => `${(0, __1.hashValue)(value)}.json`;
51
+ const hashFilename = (value) => `${(0, index_1.hashValue)(value)}.json`;
52
52
  const filePath = async (filename) => path_1.default.join(await tablePath, filename);
53
53
  const load = async (filename) => {
54
54
  const path = await filePath(filename);
@@ -76,7 +76,7 @@ const fileSystemUnversionedDocumentStore = (initializer) => () => (configProvide
76
76
  return new Promise((resolve, reject) => readdir(path, (err, files) => err ?
77
77
  reject(err) :
78
78
  Promise.all(files.map((file) => load(file)))
79
- .then((allData) => resolve(allData.filter(guards_1.isDefined)), (err) => reject(err))));
79
+ .then((allData) => resolve(allData.filter(index_4.isDefined)), (err) => reject(err))));
80
80
  };
81
81
  return {
82
82
  loadAllDocumentsTheBadWay,
@@ -95,7 +95,7 @@ const fileSystemUnversionedDocumentStore = (initializer) => () => (configProvide
95
95
  const items = await Promise.all(ids.map((id) => {
96
96
  return load(hashFilename(id));
97
97
  }));
98
- return items.filter(guards_1.isDefined);
98
+ return items.filter(index_4.isDefined);
99
99
  },
100
100
  getItem: (id) => {
101
101
  return load(hashFilename(id));
@@ -106,7 +106,7 @@ const fileSystemUnversionedDocumentStore = (initializer) => () => (configProvide
106
106
  await mkTableDir;
107
107
  const data = await load(filename);
108
108
  if (!data) {
109
- throw new errors_1.NotFoundError(`Item with ${hashKey.toString()} "${id}" does not exist`);
109
+ throw new index_3.NotFoundError(`Item with ${hashKey.toString()} "${id}" does not exist`);
110
110
  }
111
111
  const newValue = typeof data[attribute] === 'number' ? data[attribute] + 1 : 1;
112
112
  const newItem = { ...data, [hashKey]: id, [attribute]: newValue };
@@ -128,7 +128,7 @@ const fileSystemUnversionedDocumentStore = (initializer) => () => (configProvide
128
128
  await mkTableDir;
129
129
  const data = await load(filename);
130
130
  if (!data) {
131
- throw new errors_1.NotFoundError(`Item with ${hashKey.toString()} "${id}" does not exist`);
131
+ throw new index_3.NotFoundError(`Item with ${hashKey.toString()} "${id}" does not exist`);
132
132
  }
133
133
  const newItem = { ...data, ...item };
134
134
  return new Promise((resolve, reject) => {
@@ -146,7 +146,7 @@ const fileSystemUnversionedDocumentStore = (initializer) => () => (configProvide
146
146
  const hashed = hashFilename(item[hashKey]);
147
147
  const existingItem = await load(hashed);
148
148
  if (existingItem) {
149
- throw new errors_1.ConflictError(`Item with ${String(hashKey)} "${item[hashKey]}" already exists`);
149
+ throw new index_3.ConflictError(`Item with ${String(hashKey)} "${item[hashKey]}" already exists`);
150
150
  }
151
151
  const path = await filePath(hashed);
152
152
  await mkTableDir;
@@ -167,7 +167,7 @@ const fileSystemUnversionedDocumentStore = (initializer) => () => (configProvide
167
167
  const hashed = hashFilename(item[hashKey]);
168
168
  const existingItem = await load(hashed);
169
169
  if (existingItem) {
170
- throw new errors_1.ConflictError(`Item with ${String(hashKey)} "${item[hashKey]}" already exists`);
170
+ throw new index_3.ConflictError(`Item with ${String(hashKey)} "${item[hashKey]}" already exists`);
171
171
  }
172
172
  const path = await filePath(hashed);
173
173
  await mkTableDir;
@@ -1,7 +1,7 @@
1
1
  import { DynamoDB } from '@aws-sdk/client-dynamodb';
2
- import { Config } from '..';
3
- import { ConfigProviderForConfig } from '../../../config';
4
- import { VersionedDocumentAuthor, VersionedTDocument } from '.';
2
+ import { Config } from '../index';
3
+ import { ConfigProviderForConfig } from '../../../config/index';
4
+ import { VersionedDocumentAuthor, VersionedTDocument } from './index';
5
5
  interface Initializer<C> {
6
6
  configSpace?: C;
7
7
  dynamoClient?: DynamoDB;
@@ -2,16 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dynamoVersionedDocumentStore = void 0;
4
4
  const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
5
- const __1 = require("../../..");
6
- const config_1 = require("../../../config");
7
- const guards_1 = require("../../../guards");
5
+ const index_1 = require("../../../index");
6
+ const index_2 = require("../../../config/index");
7
+ const index_3 = require("../../../guards/index");
8
8
  const dynamoEncoding_1 = require("../dynamoEncoding");
9
9
  // i'm not really excited about getAuthor being required, but ts is getting confused about the type when unspecified
10
10
  const dynamoVersionedDocumentStore = (initializer) => {
11
- const init = (0, guards_1.ifDefined)(initializer, {});
12
- 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' }); });
11
+ const init = (0, index_3.ifDefined)(initializer, {});
12
+ 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' }); });
13
13
  return () => (configProvider) => (_, hashKey, options) => {
14
- const tableName = (0, __1.once)(() => (0, config_1.resolveConfigValue)(configProvider[(0, guards_1.ifDefined)(init.configSpace, 'dynamodb')].tableName));
14
+ const tableName = (0, index_1.once)(() => (0, index_2.resolveConfigValue)(configProvider[(0, index_3.ifDefined)(init.configSpace, 'dynamodb')].tableName));
15
15
  return {
16
16
  loadAllDocumentsTheBadWay: async () => {
17
17
  const loadAllResults = async (ExclusiveStartKey) => {
@@ -1,6 +1,6 @@
1
- import { Config } from '..';
2
- import { ConfigProviderForConfig } from '../../../config';
3
- import { VersionedDocumentAuthor, VersionedTDocument } from '.';
1
+ import { Config } from '../index';
2
+ import { ConfigProviderForConfig } from '../../../config/index';
3
+ import { VersionedDocumentAuthor, VersionedTDocument } from './index';
4
4
  interface Initializer<C> {
5
5
  dataDir: string;
6
6
  fs?: Pick<typeof import('fs'), 'mkdir' | 'readdir' | 'readFile' | 'writeFile'>;
@@ -1,4 +1,4 @@
1
- import { TDocument } from '..';
1
+ import { TDocument } from '../index';
2
2
  import { dynamoVersionedDocumentStore } from './dynamodb';
3
3
  export type VersionedDocumentAuthor = {
4
4
  type: 'user';
@@ -1,5 +1,5 @@
1
- import { ConfigProviderForConfig } from '../../config';
2
- import { GenericFetch } from '../../fetch';
1
+ import { ConfigProviderForConfig } from '../../config/index';
2
+ import { GenericFetch } from '../../fetch/index';
3
3
  export type Config = {
4
4
  defaultCorrectness?: string;
5
5
  exercisesHost: string;