pinia-orm-edge 1.9.0-28580847.34348a5 → 1.9.0-28580890.9c8ee0d

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/dist/index.cjs CHANGED
@@ -1307,16 +1307,16 @@ class Query {
1307
1307
  const record = elements[id];
1308
1308
  const existing = currentData[id];
1309
1309
  let model = existing ? this.hydrate({ ...existing, ...record }, { operation: "set", action: "update" }) : this.hydrate(record, { operation: "set", action: "save" });
1310
- const isSaving = model.$self().saving(model, record);
1311
- const isUpdatingOrCreating = existing ? model.$self().updating(model, record) : model.$self().creating(model, record);
1310
+ const isSaving = model.$self().saving(model, existing ?? {});
1311
+ const isUpdatingOrCreating = existing ? model.$self().updating(model, existing ?? {}) : model.$self().creating(model, existing ?? {});
1312
1312
  if (isSaving === false || isUpdatingOrCreating === false) {
1313
1313
  continue;
1314
1314
  }
1315
1315
  if (model.$isDirty()) {
1316
1316
  model = this.hydrate(model.$getAttributes(), { operation: "set", action: existing ? "update" : "save" });
1317
1317
  }
1318
- afterSavingHooks.push(() => model.$self().saved(model, record));
1319
- afterSavingHooks.push(() => existing ? model.$self().updated(model, record) : model.$self().created(model, record));
1318
+ afterSavingHooks.push(() => model.$self().saved(model, existing ?? {}));
1319
+ afterSavingHooks.push(() => existing ? model.$self().updated(model, existing ?? {}) : model.$self().created(model, existing ?? {}));
1320
1320
  newData[id] = model.$getAttributes();
1321
1321
  if (Object.values(model.$types()).length > 0 && !newData[id][model.$typeKey()]) {
1322
1322
  newData[id][model.$typeKey()] = record[model.$typeKey()];
package/dist/index.mjs CHANGED
@@ -1305,16 +1305,16 @@ class Query {
1305
1305
  const record = elements[id];
1306
1306
  const existing = currentData[id];
1307
1307
  let model = existing ? this.hydrate({ ...existing, ...record }, { operation: "set", action: "update" }) : this.hydrate(record, { operation: "set", action: "save" });
1308
- const isSaving = model.$self().saving(model, record);
1309
- const isUpdatingOrCreating = existing ? model.$self().updating(model, record) : model.$self().creating(model, record);
1308
+ const isSaving = model.$self().saving(model, existing ?? {});
1309
+ const isUpdatingOrCreating = existing ? model.$self().updating(model, existing ?? {}) : model.$self().creating(model, existing ?? {});
1310
1310
  if (isSaving === false || isUpdatingOrCreating === false) {
1311
1311
  continue;
1312
1312
  }
1313
1313
  if (model.$isDirty()) {
1314
1314
  model = this.hydrate(model.$getAttributes(), { operation: "set", action: existing ? "update" : "save" });
1315
1315
  }
1316
- afterSavingHooks.push(() => model.$self().saved(model, record));
1317
- afterSavingHooks.push(() => existing ? model.$self().updated(model, record) : model.$self().created(model, record));
1316
+ afterSavingHooks.push(() => model.$self().saved(model, existing ?? {}));
1317
+ afterSavingHooks.push(() => existing ? model.$self().updated(model, existing ?? {}) : model.$self().created(model, existing ?? {}));
1318
1318
  newData[id] = model.$getAttributes();
1319
1319
  if (Object.values(model.$types()).length > 0 && !newData[id][model.$typeKey()]) {
1320
1320
  newData[id][model.$typeKey()] = record[model.$typeKey()];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinia-orm-edge",
3
- "version": "1.9.0-28580847.34348a5",
3
+ "version": "1.9.0-28580890.9c8ee0d",
4
4
  "description": "The Pinia plugin to enable Object-Relational Mapping access to the Pinia Store.",
5
5
  "keywords": [
6
6
  "vue",
@@ -46,7 +46,7 @@
46
46
  "pinia": "^2.1.7"
47
47
  },
48
48
  "dependencies": {
49
- "@pinia-orm/normalizr": "npm:@pinia-orm/normalizr-edge@1.9.0-28580847.34348a5"
49
+ "@pinia-orm/normalizr": "npm:@pinia-orm/normalizr-edge@1.9.0-28580890.9c8ee0d"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@nuxt/eslint-config": "^0.3.10",