@openstax/ts-utils 1.32.6 → 1.33.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.
@@ -7,7 +7,7 @@ const PAGE_LIMIT = 5;
7
7
  const fileSystemVersionedDocumentStore = (initializer) => () => (configProvider) => (_, hashKey, options) => {
8
8
  var _a;
9
9
  const skipAssert = (_a = options === null || options === void 0 ? void 0 : options.skipAssert) !== null && _a !== void 0 ? _a : false;
10
- const unversionedDocuments = (0, file_system_1.fileSystemUnversionedDocumentStore)(initializer)()(configProvider)({ skipAssert: skipAssert }, 'id');
10
+ const unversionedDocuments = (0, file_system_1.fileSystemUnversionedDocumentStore)(initializer)()(configProvider)({}, 'id', { skipAssert });
11
11
  return {
12
12
  loadAllDocumentsTheBadWay: () => {
13
13
  return unversionedDocuments.loadAllDocumentsTheBadWay().then(documents => documents.map(document => {
@@ -24,4 +24,5 @@ export declare const openSearchService: <C extends string = "deployed">(initiali
24
24
  totalItems: number;
25
25
  totalPages: number;
26
26
  }>;
27
+ updateMappings: () => Promise<void>;
27
28
  };
@@ -136,7 +136,19 @@ const openSearchService = (initializer = {}) => (configProvider) => {
136
136
  const totalPages = Math.ceil(totalItems / pageSize) || 1;
137
137
  return { items, pageSize, currentPage, totalItems, totalPages };
138
138
  };
139
- return { ensureIndexCreated, deleteIndexIfExists, index, bulkIndex, search };
139
+ const updateMappings = async () => {
140
+ const { indices } = await client();
141
+ await indices.putMapping({
142
+ index: indexConfig.name,
143
+ body: {
144
+ properties: indexConfig.mappings
145
+ }
146
+ }, {
147
+ requestTimeout: 10000,
148
+ maxRetries: 1,
149
+ });
150
+ };
151
+ return { ensureIndexCreated, deleteIndexIfExists, index, bulkIndex, search, updateMappings };
140
152
  };
141
153
  };
142
154
  exports.openSearchService = openSearchService;