@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.
@@ -4,7 +4,7 @@ const PAGE_LIMIT = 5;
4
4
  export const fileSystemVersionedDocumentStore = (initializer) => () => (configProvider) => (_, hashKey, options) => {
5
5
  var _a;
6
6
  const skipAssert = (_a = options === null || options === void 0 ? void 0 : options.skipAssert) !== null && _a !== void 0 ? _a : false;
7
- const unversionedDocuments = fileSystemUnversionedDocumentStore(initializer)()(configProvider)({ skipAssert: skipAssert }, 'id');
7
+ const unversionedDocuments = fileSystemUnversionedDocumentStore(initializer)()(configProvider)({}, 'id', { skipAssert });
8
8
  return {
9
9
  loadAllDocumentsTheBadWay: () => {
10
10
  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
  };
@@ -133,6 +133,18 @@ export const openSearchService = (initializer = {}) => (configProvider) => {
133
133
  const totalPages = Math.ceil(totalItems / pageSize) || 1;
134
134
  return { items, pageSize, currentPage, totalItems, totalPages };
135
135
  };
136
- return { ensureIndexCreated, deleteIndexIfExists, index, bulkIndex, search };
136
+ const updateMappings = async () => {
137
+ const { indices } = await client();
138
+ await indices.putMapping({
139
+ index: indexConfig.name,
140
+ body: {
141
+ properties: indexConfig.mappings
142
+ }
143
+ }, {
144
+ requestTimeout: 10000,
145
+ maxRetries: 1,
146
+ });
147
+ };
148
+ return { ensureIndexCreated, deleteIndexIfExists, index, bulkIndex, search, updateMappings };
137
149
  };
138
150
  };