@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.
- package/{declarations → dist}/index.d.ts.map +1 -1
- package/dist/index.js +6 -13
- package/dist/index.js.map +1 -1
- package/dist/unpkg/dev/index.js +7 -14
- package/dist/unpkg/dev/index.js.map +1 -1
- package/dist/unpkg/dev-deprecated/index.js +7 -14
- package/dist/unpkg/dev-deprecated/index.js.map +1 -1
- package/dist/unpkg/prod/index.js +6 -13
- package/dist/unpkg/prod/index.js.map +1 -1
- package/dist/unpkg/prod-deprecated/index.js +6 -13
- package/dist/unpkg/prod-deprecated/index.js.map +1 -1
- package/package.json +16 -20
- /package/{declarations → dist}/index.d.ts +0 -0
|
@@ -681,7 +681,7 @@ var JSONAPICache = class {
|
|
|
681
681
|
delete cached.changes[currentAttr];
|
|
682
682
|
}
|
|
683
683
|
if (cached.defaultAttrs && currentAttr in cached.defaultAttrs) delete cached.defaultAttrs[currentAttr];
|
|
684
|
-
this._capabilities.notifyChange(identifier, "attributes", currentAttr);
|
|
684
|
+
this._capabilities.notifyChange(identifier, "attributes", currentAttr, "local");
|
|
685
685
|
return;
|
|
686
686
|
}
|
|
687
687
|
const path = attr;
|
|
@@ -709,7 +709,7 @@ var JSONAPICache = class {
|
|
|
709
709
|
delete cached.changes[basePath];
|
|
710
710
|
}
|
|
711
711
|
} catch {}
|
|
712
|
-
this._capabilities.notifyChange(identifier, "attributes", basePath);
|
|
712
|
+
this._capabilities.notifyChange(identifier, "attributes", basePath, "local");
|
|
713
713
|
}
|
|
714
714
|
/**
|
|
715
715
|
* Query the cache for the changed attributes of a resource.
|
|
@@ -764,7 +764,7 @@ var JSONAPICache = class {
|
|
|
764
764
|
this._capabilities.notifyChange(identifier, "errors", null);
|
|
765
765
|
}
|
|
766
766
|
this._capabilities.notifyChange(identifier, "state", null);
|
|
767
|
-
if (dirtyKeys && dirtyKeys.length)
|
|
767
|
+
if (dirtyKeys && dirtyKeys.length) this._capabilities.notifyChange(identifier, "attributes", new Set(dirtyKeys));
|
|
768
768
|
return dirtyKeys || [];
|
|
769
769
|
}
|
|
770
770
|
/**
|
|
@@ -940,7 +940,7 @@ var JSONAPICache = class {
|
|
|
940
940
|
function addResourceToDocument(cache, op) {
|
|
941
941
|
const { content } = cache.__documents.get(op.record.lid);
|
|
942
942
|
if (op.field === "data") {
|
|
943
|
-
let shouldNotify
|
|
943
|
+
let shouldNotify;
|
|
944
944
|
if (!Array.isArray(content.data)) {
|
|
945
945
|
shouldNotify = content.data !== op.value;
|
|
946
946
|
if (shouldNotify) content.data = op.value;
|
|
@@ -1035,13 +1035,6 @@ function getDefaultValue(schema, identifier, store) {
|
|
|
1035
1035
|
if (transform?.defaultValue) return transform.defaultValue(options || null, identifier);
|
|
1036
1036
|
}
|
|
1037
1037
|
}
|
|
1038
|
-
function notifyAttributes(storeWrapper, identifier, keys) {
|
|
1039
|
-
if (!keys) {
|
|
1040
|
-
storeWrapper.notifyChange(identifier, "attributes", null);
|
|
1041
|
-
return;
|
|
1042
|
-
}
|
|
1043
|
-
storeWrapper.notifyChange(identifier, "attributes", keys);
|
|
1044
|
-
}
|
|
1045
1038
|
function calculateChangedKeys(cached, updates, fields) {
|
|
1046
1039
|
const changedKeys = /* @__PURE__ */ new Set();
|
|
1047
1040
|
const keys = Object.keys(updates);
|
|
@@ -1220,7 +1213,7 @@ function cacheUpsert(cache, identifier, data, calculateChanges) {
|
|
|
1220
1213
|
if (!isUpdate) cache._capabilities.notifyChange(identifier, "added", null);
|
|
1221
1214
|
if (data.id) cached.id = data.id;
|
|
1222
1215
|
if (data.relationships) setupRelationships(cache.__graph, fields, identifier, data);
|
|
1223
|
-
if (changedKeys?.size)
|
|
1216
|
+
if (changedKeys?.size) cache._capabilities.notifyChange(identifier, "attributes", changedKeys);
|
|
1224
1217
|
return changedKeys?.size ? Array.from(changedKeys) : void 0;
|
|
1225
1218
|
}
|
|
1226
1219
|
function patchCache(Cache, op) {
|
|
@@ -1324,7 +1317,7 @@ function didCommit(cache, committedIdentifier, data, op) {
|
|
|
1324
1317
|
cached.errors = null;
|
|
1325
1318
|
cache._capabilities.notifyChange(identifier, "errors", null);
|
|
1326
1319
|
}
|
|
1327
|
-
if (changedKeys?.size)
|
|
1320
|
+
if (changedKeys?.size) cache._capabilities.notifyChange(identifier, "attributes", changedKeys);
|
|
1328
1321
|
cache._capabilities.notifyChange(identifier, "state", null);
|
|
1329
1322
|
}
|
|
1330
1323
|
function willCommit(cache, identifier) {
|