@warp-drive-mirror/json-api 5.8.0-alpha.18 → 5.8.0-alpha.20

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -4
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -196,7 +196,10 @@ class Reporter {
196
196
  const allFields = this.schema.fields({
197
197
  type
198
198
  });
199
- const attrs = Array.from(allFields.values()).filter(isRemoteField).map(v => v.name);
199
+ const allCacheFields = this.schema.cacheFields?.({
200
+ type
201
+ }) ?? allFields;
202
+ const attrs = Array.from(allCacheFields.values()).filter(isRemoteField).map(v => v.name);
200
203
  this._fieldFilters.set(type, new Fuse(attrs));
201
204
  }
202
205
  const result = this._fieldFilters.get(type).search(field);
@@ -786,12 +789,15 @@ function validateTopLevelResourceShape(reporter, resource, path) {
786
789
  }
787
790
  }
788
791
  function validateResourceAttributes(reporter, type, resource, path) {
789
- const schema = reporter.schema.fields({
792
+ const fields = reporter.schema.fields({
790
793
  type
791
794
  });
795
+ const cacheFields = reporter.schema.cacheFields?.({
796
+ type
797
+ }) ?? fields;
792
798
  for (const [key] of Object.entries(resource)) {
793
- const field = getRemoteField(schema, key);
794
- const actualField = schema.get(key);
799
+ const field = getRemoteField(cacheFields, key);
800
+ const actualField = cacheFields.get(key);
795
801
  if (!field && actualField) {
796
802
  reporter.warn([...path, key], `Expected the ${actualField.kind} field "${key}" to not have its own data in the ResourceObject's attributes. Likely this field should either not be returned in this payload or the field definition should be updated in the schema.`);
797
803
  } else if (!field) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warp-drive-mirror/json-api",
3
- "version": "5.8.0-alpha.18",
3
+ "version": "5.8.0-alpha.20",
4
4
  "description": "A {json:api} Cache Implementation for WarpDrive",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -32,7 +32,7 @@
32
32
  }
33
33
  },
34
34
  "peerDependencies": {
35
- "@warp-drive-mirror/core": "5.8.0-alpha.18"
35
+ "@warp-drive-mirror/core": "5.8.0-alpha.20"
36
36
  },
37
37
  "dependencies": {
38
38
  "@embroider/macros": "^1.18.1",
@@ -44,8 +44,8 @@
44
44
  "@babel/plugin-transform-typescript": "^7.28.0",
45
45
  "@babel/preset-typescript": "^7.27.1",
46
46
  "@types/json-to-ast": "^2.1.4",
47
- "@warp-drive/internal-config": "5.8.0-alpha.18",
48
- "@warp-drive-mirror/core": "5.8.0-alpha.18",
47
+ "@warp-drive/internal-config": "5.8.0-alpha.20",
48
+ "@warp-drive-mirror/core": "5.8.0-alpha.20",
49
49
  "decorator-transforms": "^2.3.0",
50
50
  "expect-type": "^1.2.2",
51
51
  "typescript": "^5.9.2",