@warp-drive-mirror/json-api 5.6.0-alpha.11 → 5.6.0-alpha.12
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.js +11 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { logGroup, isStableIdentifier, isDocumentIdentifier } from '@warp-drive-
|
|
|
3
3
|
import Fuse from 'fuse.js';
|
|
4
4
|
import jsonToAst from 'json-to-ast';
|
|
5
5
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
6
|
+
|
|
6
7
|
function validateDocumentFields(schema, jsonApiDoc) {
|
|
7
8
|
const {
|
|
8
9
|
data,
|
|
@@ -97,6 +98,7 @@ function validateHasManyToLinksMode(resourceType, field, _relationshipDoc, _opti
|
|
|
97
98
|
throw new Error(`Cannot fetch ${resourceType}.${field.name} because the field is in linksMode but async hasMany is not yet supported`);
|
|
98
99
|
}
|
|
99
100
|
}
|
|
101
|
+
|
|
100
102
|
function inspectType(obj) {
|
|
101
103
|
if (obj === null) {
|
|
102
104
|
return 'null';
|
|
@@ -424,6 +426,7 @@ function getRemoteField(fields, key) {
|
|
|
424
426
|
}
|
|
425
427
|
return field;
|
|
426
428
|
}
|
|
429
|
+
|
|
427
430
|
const VALID_TOP_LEVEL_MEMBERS = ['data', 'included', 'meta', 'jsonapi', 'links'];
|
|
428
431
|
|
|
429
432
|
/**
|
|
@@ -534,6 +537,7 @@ function validateTopLevelDocumentMembers(reporter, doc) {
|
|
|
534
537
|
}
|
|
535
538
|
}
|
|
536
539
|
}
|
|
540
|
+
|
|
537
541
|
const VALID_COLLECTION_LINKS = ['self', 'related', 'first', 'last', 'prev', 'next'];
|
|
538
542
|
const VALID_RESOURCE_RELATIONSHIP_LINKS = ['self', 'related'];
|
|
539
543
|
const VALID_RESOURCE_LINKS = ['self'];
|
|
@@ -575,7 +579,7 @@ function validateLinks(reporter, doc, type, path = ['links']) {
|
|
|
575
579
|
reporter.warn([...path, key], `Unrecognized top-level link. The data it provides may be ignored as it is not a valid {JSON:API} link for a ${type}`);
|
|
576
580
|
}
|
|
577
581
|
// links may be either a string or an object with an href property or null
|
|
578
|
-
if (links[key] === null) ;else if (typeof links[key] === 'string') {
|
|
582
|
+
if (links[key] === null) ; else if (typeof links[key] === 'string') {
|
|
579
583
|
if (links[key].length === 0) {
|
|
580
584
|
reporter.warn([...path, key], `Expected a non-empty string, but received an empty string`);
|
|
581
585
|
}
|
|
@@ -608,6 +612,7 @@ function validateLinks(reporter, doc, type, path = ['links']) {
|
|
|
608
612
|
}
|
|
609
613
|
}
|
|
610
614
|
}
|
|
615
|
+
|
|
611
616
|
const SINGULAR_OPS = ['createRecord', 'updateRecord', 'deleteRecord', 'findRecord', 'queryRecord'];
|
|
612
617
|
|
|
613
618
|
/**
|
|
@@ -850,6 +855,7 @@ function validateResourceRelationships(reporter, type, resource, path) {
|
|
|
850
855
|
// TODO @runspired we should warn if the discovered resource-type in a relationship is the abstract
|
|
851
856
|
// type instead of the concrete type.
|
|
852
857
|
}
|
|
858
|
+
|
|
853
859
|
function validateDocument(capabilities, doc) {
|
|
854
860
|
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
855
861
|
if (!test) {
|
|
@@ -917,6 +923,7 @@ function validateResourceDocument(reporter, doc) {
|
|
|
917
923
|
|
|
918
924
|
reporter.report();
|
|
919
925
|
}
|
|
926
|
+
|
|
920
927
|
function isImplicit(relationship) {
|
|
921
928
|
return relationship.definition.isImplicit;
|
|
922
929
|
}
|
|
@@ -3154,4 +3161,6 @@ function patchCache(Cache, op) {
|
|
|
3154
3161
|
}
|
|
3155
3162
|
}
|
|
3156
3163
|
}
|
|
3157
|
-
|
|
3164
|
+
|
|
3165
|
+
export { JSONAPICache };
|
|
3166
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive-mirror/json-api",
|
|
3
|
-
"version": "5.6.0-alpha.
|
|
3
|
+
"version": "5.6.0-alpha.12",
|
|
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.6.0-alpha.
|
|
35
|
+
"@warp-drive-mirror/core": "5.6.0-alpha.12"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@embroider/macros": "^1.16.12",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@babel/plugin-transform-typescript": "^7.27.0",
|
|
45
45
|
"@babel/preset-typescript": "^7.27.0",
|
|
46
46
|
"@types/json-to-ast": "^2.1.4",
|
|
47
|
-
"@warp-drive/internal-config": "5.6.0-alpha.
|
|
48
|
-
"@warp-drive-mirror/core": "5.6.0-alpha.
|
|
47
|
+
"@warp-drive/internal-config": "5.6.0-alpha.12",
|
|
48
|
+
"@warp-drive-mirror/core": "5.6.0-alpha.12",
|
|
49
49
|
"decorator-transforms": "^2.3.0",
|
|
50
50
|
"expect-type": "^1.2.1",
|
|
51
51
|
"typescript": "^5.8.3",
|