@acodeninja/persist 3.0.0 → 3.0.1-next.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acodeninja/persist",
3
- "version": "3.0.0",
3
+ "version": "3.0.1-next.1",
4
4
  "description": "A JSON based data modelling and persistence module with alternate storage mechanisms.",
5
5
  "type": "module",
6
6
  "scripts": {
package/src/Connection.js CHANGED
@@ -421,11 +421,11 @@ export default class Connection {
421
421
  for (const indexName of searchIndexesToUpdate) {
422
422
  const index = await state.getSearchIndex(this.#models.get(indexName));
423
423
 
424
- for (const model of [...modelsToUpdate].filter(i => i.startsWith(indexName))) {
424
+ for (const model of [...modelsToUpdate].filter(m => this.#getModelConstructorFromId(m)?.name === indexName)) {
425
425
  index[model] = state.modelCache.get(model).toSearchData();
426
426
  }
427
427
 
428
- for (const model of [...modelsToDelete].filter(i => i.startsWith(indexName))) {
428
+ for (const model of [...modelsToDelete].filter(m => this.#getModelConstructorFromId(m)?.name === indexName)) {
429
429
  delete index[model];
430
430
  }
431
431
 
@@ -435,11 +435,11 @@ export default class Connection {
435
435
  for (const indexName of indexesToUpdate) {
436
436
  const index = await state.getIndex(this.#models.get(indexName));
437
437
 
438
- for (const model of [...modelsToUpdate].filter(i => i.startsWith(indexName))) {
438
+ for (const model of [...modelsToUpdate].filter(m => this.#getModelConstructorFromId(m)?.name === indexName)) {
439
439
  index[model] = state.modelCache.get(model).toIndexData();
440
440
  }
441
441
 
442
- for (const model of [...modelsToDelete].filter(i => i.startsWith(indexName))) {
442
+ for (const model of [...modelsToDelete].filter(m => this.#getModelConstructorFromId(m)?.name === indexName)) {
443
443
  delete index[model];
444
444
  }
445
445