@warp-drive/json-api 5.9.0-beta.1 → 5.9.0-beta.2

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.
@@ -912,7 +912,7 @@ function validateResourceDocument(reporter, doc) {
912
912
  }
913
913
 
914
914
  //#endregion
915
- //#region ../../node_modules/.pnpm/@embroi_8c5bde00dfb478e637d05be822ff1428/node_modules/@embroider/macros/src/addon/runtime.js
915
+ //#region ../../node_modules/.pnpm/@embroider+macros@1.20.6/node_modules/@embroider/macros/src/addon/runtime.js
916
916
  function config(packageRoot) {
917
917
  return runtimeConfig.packages[packageRoot];
918
918
  }
@@ -1774,7 +1774,7 @@ var JSONAPICache = class {
1774
1774
  delete cached.changes[currentAttr];
1775
1775
  }
1776
1776
  if (cached.defaultAttrs && currentAttr in cached.defaultAttrs) delete cached.defaultAttrs[currentAttr];
1777
- this._capabilities.notifyChange(identifier, "attributes", currentAttr);
1777
+ this._capabilities.notifyChange(identifier, "attributes", currentAttr, "local");
1778
1778
  return;
1779
1779
  }
1780
1780
  const path = attr;
@@ -1802,7 +1802,7 @@ var JSONAPICache = class {
1802
1802
  delete cached.changes[basePath];
1803
1803
  }
1804
1804
  } catch {}
1805
- this._capabilities.notifyChange(identifier, "attributes", basePath);
1805
+ this._capabilities.notifyChange(identifier, "attributes", basePath, "local");
1806
1806
  }
1807
1807
  /**
1808
1808
  * Query the cache for the changed attributes of a resource.
@@ -1863,7 +1863,7 @@ var JSONAPICache = class {
1863
1863
  this._capabilities.notifyChange(identifier, "errors", null);
1864
1864
  }
1865
1865
  this._capabilities.notifyChange(identifier, "state", null);
1866
- if (dirtyKeys && dirtyKeys.length) notifyAttributes(this._capabilities, identifier, new Set(dirtyKeys));
1866
+ if (dirtyKeys && dirtyKeys.length) this._capabilities.notifyChange(identifier, "attributes", new Set(dirtyKeys));
1867
1867
  return dirtyKeys || [];
1868
1868
  }
1869
1869
  /**
@@ -2056,7 +2056,7 @@ function addResourceToDocument(cache, op) {
2056
2056
  })(doc.content);
2057
2057
  const { content } = doc;
2058
2058
  if (op.field === "data") {
2059
- let shouldNotify = false;
2059
+ let shouldNotify;
2060
2060
  ((test) => {
2061
2061
  if (!test) throw new Error(`Expected to have a data property on the document`);
2062
2062
  })("data" in content);
@@ -2216,13 +2216,6 @@ function getDefaultValue(schema, identifier, store) {
2216
2216
  if (transform?.defaultValue) return transform.defaultValue(options || null, identifier);
2217
2217
  }
2218
2218
  }
2219
- function notifyAttributes(storeWrapper, identifier, keys) {
2220
- if (!keys) {
2221
- storeWrapper.notifyChange(identifier, "attributes", null);
2222
- return;
2223
- }
2224
- storeWrapper.notifyChange(identifier, "attributes", keys);
2225
- }
2226
2219
  function calculateChangedKeys(cached, updates, fields) {
2227
2220
  const changedKeys = /* @__PURE__ */ new Set();
2228
2221
  const keys = Object.keys(updates);
@@ -2416,7 +2409,7 @@ function cacheUpsert(cache, identifier, data, calculateChanges) {
2416
2409
  if (!isUpdate) cache._capabilities.notifyChange(identifier, "added", null);
2417
2410
  if (data.id) cached.id = data.id;
2418
2411
  if (data.relationships) setupRelationships(cache.__graph, fields, identifier, data);
2419
- if (changedKeys?.size) notifyAttributes(cache._capabilities, identifier, changedKeys);
2412
+ if (changedKeys?.size) cache._capabilities.notifyChange(identifier, "attributes", changedKeys);
2420
2413
  if (getGlobalConfig().WarpDrive.debug.LOG_CACHE || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE) console.groupEnd();
2421
2414
  return changedKeys?.size ? Array.from(changedKeys) : void 0;
2422
2415
  }
@@ -2568,7 +2561,7 @@ function didCommit(cache, committedIdentifier, data, op) {
2568
2561
  cached.errors = null;
2569
2562
  cache._capabilities.notifyChange(identifier, "errors", null);
2570
2563
  }
2571
- if (changedKeys?.size) notifyAttributes(cache._capabilities, identifier, changedKeys);
2564
+ if (changedKeys?.size) cache._capabilities.notifyChange(identifier, "attributes", changedKeys);
2572
2565
  cache._capabilities.notifyChange(identifier, "state", null);
2573
2566
  }
2574
2567
  function willCommit(cache, identifier) {