@tinacms/graphql 0.0.0-d9672bc-20250218033222 → 0.0.0-db8aa8e-20250228034006
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 +38 -22
- package/dist/index.mjs +35 -19
- package/dist/resolver/index.d.ts +8 -0
- package/package.json +14 -14
package/dist/index.js
CHANGED
|
@@ -27,8 +27,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
|
|
29
29
|
// src/index.ts
|
|
30
|
-
var
|
|
31
|
-
__export(
|
|
30
|
+
var index_exports = {};
|
|
31
|
+
__export(index_exports, {
|
|
32
32
|
AuditFileSystemBridge: () => AuditFileSystemBridge,
|
|
33
33
|
Database: () => Database,
|
|
34
34
|
FilesystemBridge: () => FilesystemBridge,
|
|
@@ -62,7 +62,7 @@ __export(src_exports, {
|
|
|
62
62
|
transformDocument: () => transformDocument,
|
|
63
63
|
transformDocumentIntoPayload: () => transformDocumentIntoPayload
|
|
64
64
|
});
|
|
65
|
-
module.exports = __toCommonJS(
|
|
65
|
+
module.exports = __toCommonJS(index_exports);
|
|
66
66
|
|
|
67
67
|
// src/build.ts
|
|
68
68
|
var import_graphql2 = require("graphql");
|
|
@@ -3090,7 +3090,7 @@ var validateField = async (field) => {
|
|
|
3090
3090
|
// package.json
|
|
3091
3091
|
var package_default = {
|
|
3092
3092
|
name: "@tinacms/graphql",
|
|
3093
|
-
version: "1.5.
|
|
3093
|
+
version: "1.5.13",
|
|
3094
3094
|
main: "dist/index.js",
|
|
3095
3095
|
module: "dist/index.mjs",
|
|
3096
3096
|
typings: "dist/index.d.ts",
|
|
@@ -3126,12 +3126,12 @@ var package_default = {
|
|
|
3126
3126
|
"@tinacms/schema-tools": "workspace:*",
|
|
3127
3127
|
"abstract-level": "^1.0.4",
|
|
3128
3128
|
"date-fns": "^2.30.0",
|
|
3129
|
-
"fast-glob": "^3.3.
|
|
3130
|
-
"fs-extra": "^11.
|
|
3129
|
+
"fast-glob": "^3.3.3",
|
|
3130
|
+
"fs-extra": "^11.3.0",
|
|
3131
3131
|
"glob-parent": "^6.0.2",
|
|
3132
3132
|
graphql: "15.8.0",
|
|
3133
3133
|
"gray-matter": "^4.0.3",
|
|
3134
|
-
"isomorphic-git": "^1.
|
|
3134
|
+
"isomorphic-git": "^1.29.0",
|
|
3135
3135
|
"js-sha1": "^0.6.0",
|
|
3136
3136
|
"js-yaml": "^3.14.1",
|
|
3137
3137
|
"jsonpath-plus": "10.1.0",
|
|
@@ -3141,7 +3141,7 @@ var package_default = {
|
|
|
3141
3141
|
"many-level": "^2.0.0",
|
|
3142
3142
|
micromatch: "4.0.8",
|
|
3143
3143
|
"normalize-path": "^3.0.0",
|
|
3144
|
-
"readable-stream": "^4.
|
|
3144
|
+
"readable-stream": "^4.7.0",
|
|
3145
3145
|
scmp: "^2.1.0",
|
|
3146
3146
|
yup: "^0.32.11"
|
|
3147
3147
|
},
|
|
@@ -3165,17 +3165,17 @@ var package_default = {
|
|
|
3165
3165
|
"@types/lru-cache": "^5.1.1",
|
|
3166
3166
|
"@types/mdast": "^3.0.15",
|
|
3167
3167
|
"@types/micromatch": "^4.0.9",
|
|
3168
|
-
"@types/node": "^22.
|
|
3168
|
+
"@types/node": "^22.13.1",
|
|
3169
3169
|
"@types/normalize-path": "^3.0.2",
|
|
3170
3170
|
"@types/ws": "^7.4.7",
|
|
3171
3171
|
"@types/yup": "^0.29.14",
|
|
3172
3172
|
"jest-file-snapshot": "^0.5.0",
|
|
3173
3173
|
"memory-level": "^1.0.0",
|
|
3174
3174
|
nodemon: "3.1.4",
|
|
3175
|
-
typescript: "^5.
|
|
3176
|
-
vite: "^4.
|
|
3177
|
-
vitest: "^0.32.
|
|
3178
|
-
zod: "^3.
|
|
3175
|
+
typescript: "^5.7.3",
|
|
3176
|
+
vite: "^4.5.9",
|
|
3177
|
+
vitest: "^0.32.4",
|
|
3178
|
+
zod: "^3.24.2"
|
|
3179
3179
|
}
|
|
3180
3180
|
};
|
|
3181
3181
|
|
|
@@ -4626,10 +4626,20 @@ var makeRefOpsForDocument = (filepath, collection, references, data, opType, lev
|
|
|
4626
4626
|
const references2 = {};
|
|
4627
4627
|
for (const path7 of referencePaths) {
|
|
4628
4628
|
const ref = (0, import_jsonpath_plus.JSONPath)({ path: path7, json: data });
|
|
4629
|
-
if (
|
|
4630
|
-
|
|
4629
|
+
if (Array.isArray(ref)) {
|
|
4630
|
+
for (const r of ref) {
|
|
4631
|
+
if (references2[r]) {
|
|
4632
|
+
references2[r].push(path7);
|
|
4633
|
+
} else {
|
|
4634
|
+
references2[r] = [path7];
|
|
4635
|
+
}
|
|
4636
|
+
}
|
|
4631
4637
|
} else {
|
|
4632
|
-
references2[ref]
|
|
4638
|
+
if (references2[ref]) {
|
|
4639
|
+
references2[ref].push(path7);
|
|
4640
|
+
} else {
|
|
4641
|
+
references2[ref] = [path7];
|
|
4642
|
+
}
|
|
4633
4643
|
}
|
|
4634
4644
|
}
|
|
4635
4645
|
for (const ref of Object.keys(references2)) {
|
|
@@ -4867,20 +4877,22 @@ var transformDocumentIntoPayload = async (fullPath, rawData, tinaSchema, config,
|
|
|
4867
4877
|
throw e;
|
|
4868
4878
|
}
|
|
4869
4879
|
};
|
|
4870
|
-
var updateObjectWithJsonPath = (obj, path7, newValue) => {
|
|
4880
|
+
var updateObjectWithJsonPath = (obj, path7, oldValue, newValue) => {
|
|
4871
4881
|
if (!path7.includes(".") && !path7.includes("[")) {
|
|
4872
|
-
if (path7 in obj) {
|
|
4882
|
+
if (path7 in obj && obj[path7] === oldValue) {
|
|
4873
4883
|
obj[path7] = newValue;
|
|
4874
4884
|
}
|
|
4875
4885
|
return obj;
|
|
4876
4886
|
}
|
|
4877
|
-
const parentPath = path7.replace(/\.[
|
|
4878
|
-
const keyToUpdate = path7.match(/[
|
|
4887
|
+
const parentPath = path7.replace(/\.[^.\[\]]+$/, "");
|
|
4888
|
+
const keyToUpdate = path7.match(/[^.\[\]]+$/)[0];
|
|
4879
4889
|
const parents = (0, import_jsonpath_plus2.JSONPath)({ path: parentPath, json: obj, resultType: "value" });
|
|
4880
4890
|
if (parents.length > 0) {
|
|
4881
4891
|
parents.forEach((parent) => {
|
|
4882
4892
|
if (parent && typeof parent === "object" && keyToUpdate in parent) {
|
|
4883
|
-
parent[keyToUpdate]
|
|
4893
|
+
if (parent[keyToUpdate] === oldValue) {
|
|
4894
|
+
parent[keyToUpdate] = newValue;
|
|
4895
|
+
}
|
|
4884
4896
|
}
|
|
4885
4897
|
});
|
|
4886
4898
|
}
|
|
@@ -5269,7 +5281,7 @@ var Resolver = class {
|
|
|
5269
5281
|
)) {
|
|
5270
5282
|
let refDoc = await this.getRaw(pathToDocWithRef);
|
|
5271
5283
|
for (const path7 of referencePaths) {
|
|
5272
|
-
refDoc = updateObjectWithJsonPath(refDoc, path7, null);
|
|
5284
|
+
refDoc = updateObjectWithJsonPath(refDoc, path7, realPath, null);
|
|
5273
5285
|
}
|
|
5274
5286
|
await this.database.put(pathToDocWithRef, refDoc, collection2);
|
|
5275
5287
|
}
|
|
@@ -5291,6 +5303,9 @@ var Resolver = class {
|
|
|
5291
5303
|
collection == null ? void 0 : collection.path,
|
|
5292
5304
|
args.params.relativePath
|
|
5293
5305
|
);
|
|
5306
|
+
if (newRealPath === realPath) {
|
|
5307
|
+
return doc;
|
|
5308
|
+
}
|
|
5294
5309
|
await this.database.put(newRealPath, doc._rawData, collection.name);
|
|
5295
5310
|
await this.deleteDocument(realPath);
|
|
5296
5311
|
const collRefs = await this.findReferences(realPath, collection);
|
|
@@ -5303,6 +5318,7 @@ var Resolver = class {
|
|
|
5303
5318
|
docWithRef = updateObjectWithJsonPath(
|
|
5304
5319
|
docWithRef,
|
|
5305
5320
|
path7,
|
|
5321
|
+
realPath,
|
|
5306
5322
|
newRealPath
|
|
5307
5323
|
);
|
|
5308
5324
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -3019,7 +3019,7 @@ var validateField = async (field) => {
|
|
|
3019
3019
|
// package.json
|
|
3020
3020
|
var package_default = {
|
|
3021
3021
|
name: "@tinacms/graphql",
|
|
3022
|
-
version: "1.5.
|
|
3022
|
+
version: "1.5.13",
|
|
3023
3023
|
main: "dist/index.js",
|
|
3024
3024
|
module: "dist/index.mjs",
|
|
3025
3025
|
typings: "dist/index.d.ts",
|
|
@@ -3055,12 +3055,12 @@ var package_default = {
|
|
|
3055
3055
|
"@tinacms/schema-tools": "workspace:*",
|
|
3056
3056
|
"abstract-level": "^1.0.4",
|
|
3057
3057
|
"date-fns": "^2.30.0",
|
|
3058
|
-
"fast-glob": "^3.3.
|
|
3059
|
-
"fs-extra": "^11.
|
|
3058
|
+
"fast-glob": "^3.3.3",
|
|
3059
|
+
"fs-extra": "^11.3.0",
|
|
3060
3060
|
"glob-parent": "^6.0.2",
|
|
3061
3061
|
graphql: "15.8.0",
|
|
3062
3062
|
"gray-matter": "^4.0.3",
|
|
3063
|
-
"isomorphic-git": "^1.
|
|
3063
|
+
"isomorphic-git": "^1.29.0",
|
|
3064
3064
|
"js-sha1": "^0.6.0",
|
|
3065
3065
|
"js-yaml": "^3.14.1",
|
|
3066
3066
|
"jsonpath-plus": "10.1.0",
|
|
@@ -3070,7 +3070,7 @@ var package_default = {
|
|
|
3070
3070
|
"many-level": "^2.0.0",
|
|
3071
3071
|
micromatch: "4.0.8",
|
|
3072
3072
|
"normalize-path": "^3.0.0",
|
|
3073
|
-
"readable-stream": "^4.
|
|
3073
|
+
"readable-stream": "^4.7.0",
|
|
3074
3074
|
scmp: "^2.1.0",
|
|
3075
3075
|
yup: "^0.32.11"
|
|
3076
3076
|
},
|
|
@@ -3094,17 +3094,17 @@ var package_default = {
|
|
|
3094
3094
|
"@types/lru-cache": "^5.1.1",
|
|
3095
3095
|
"@types/mdast": "^3.0.15",
|
|
3096
3096
|
"@types/micromatch": "^4.0.9",
|
|
3097
|
-
"@types/node": "^22.
|
|
3097
|
+
"@types/node": "^22.13.1",
|
|
3098
3098
|
"@types/normalize-path": "^3.0.2",
|
|
3099
3099
|
"@types/ws": "^7.4.7",
|
|
3100
3100
|
"@types/yup": "^0.29.14",
|
|
3101
3101
|
"jest-file-snapshot": "^0.5.0",
|
|
3102
3102
|
"memory-level": "^1.0.0",
|
|
3103
3103
|
nodemon: "3.1.4",
|
|
3104
|
-
typescript: "^5.
|
|
3105
|
-
vite: "^4.
|
|
3106
|
-
vitest: "^0.32.
|
|
3107
|
-
zod: "^3.
|
|
3104
|
+
typescript: "^5.7.3",
|
|
3105
|
+
vite: "^4.5.9",
|
|
3106
|
+
vitest: "^0.32.4",
|
|
3107
|
+
zod: "^3.24.2"
|
|
3108
3108
|
}
|
|
3109
3109
|
};
|
|
3110
3110
|
|
|
@@ -4551,10 +4551,20 @@ var makeRefOpsForDocument = (filepath, collection, references, data, opType, lev
|
|
|
4551
4551
|
const references2 = {};
|
|
4552
4552
|
for (const path7 of referencePaths) {
|
|
4553
4553
|
const ref = JSONPath({ path: path7, json: data });
|
|
4554
|
-
if (
|
|
4555
|
-
|
|
4554
|
+
if (Array.isArray(ref)) {
|
|
4555
|
+
for (const r of ref) {
|
|
4556
|
+
if (references2[r]) {
|
|
4557
|
+
references2[r].push(path7);
|
|
4558
|
+
} else {
|
|
4559
|
+
references2[r] = [path7];
|
|
4560
|
+
}
|
|
4561
|
+
}
|
|
4556
4562
|
} else {
|
|
4557
|
-
references2[ref]
|
|
4563
|
+
if (references2[ref]) {
|
|
4564
|
+
references2[ref].push(path7);
|
|
4565
|
+
} else {
|
|
4566
|
+
references2[ref] = [path7];
|
|
4567
|
+
}
|
|
4558
4568
|
}
|
|
4559
4569
|
}
|
|
4560
4570
|
for (const ref of Object.keys(references2)) {
|
|
@@ -4791,20 +4801,22 @@ var transformDocumentIntoPayload = async (fullPath, rawData, tinaSchema, config,
|
|
|
4791
4801
|
throw e;
|
|
4792
4802
|
}
|
|
4793
4803
|
};
|
|
4794
|
-
var updateObjectWithJsonPath = (obj, path7, newValue) => {
|
|
4804
|
+
var updateObjectWithJsonPath = (obj, path7, oldValue, newValue) => {
|
|
4795
4805
|
if (!path7.includes(".") && !path7.includes("[")) {
|
|
4796
|
-
if (path7 in obj) {
|
|
4806
|
+
if (path7 in obj && obj[path7] === oldValue) {
|
|
4797
4807
|
obj[path7] = newValue;
|
|
4798
4808
|
}
|
|
4799
4809
|
return obj;
|
|
4800
4810
|
}
|
|
4801
|
-
const parentPath = path7.replace(/\.[
|
|
4802
|
-
const keyToUpdate = path7.match(/[
|
|
4811
|
+
const parentPath = path7.replace(/\.[^.\[\]]+$/, "");
|
|
4812
|
+
const keyToUpdate = path7.match(/[^.\[\]]+$/)[0];
|
|
4803
4813
|
const parents = JSONPath2({ path: parentPath, json: obj, resultType: "value" });
|
|
4804
4814
|
if (parents.length > 0) {
|
|
4805
4815
|
parents.forEach((parent) => {
|
|
4806
4816
|
if (parent && typeof parent === "object" && keyToUpdate in parent) {
|
|
4807
|
-
parent[keyToUpdate]
|
|
4817
|
+
if (parent[keyToUpdate] === oldValue) {
|
|
4818
|
+
parent[keyToUpdate] = newValue;
|
|
4819
|
+
}
|
|
4808
4820
|
}
|
|
4809
4821
|
});
|
|
4810
4822
|
}
|
|
@@ -5192,7 +5204,7 @@ var Resolver = class {
|
|
|
5192
5204
|
)) {
|
|
5193
5205
|
let refDoc = await this.getRaw(pathToDocWithRef);
|
|
5194
5206
|
for (const path7 of referencePaths) {
|
|
5195
|
-
refDoc = updateObjectWithJsonPath(refDoc, path7, null);
|
|
5207
|
+
refDoc = updateObjectWithJsonPath(refDoc, path7, realPath, null);
|
|
5196
5208
|
}
|
|
5197
5209
|
await this.database.put(pathToDocWithRef, refDoc, collection2);
|
|
5198
5210
|
}
|
|
@@ -5214,6 +5226,9 @@ var Resolver = class {
|
|
|
5214
5226
|
collection?.path,
|
|
5215
5227
|
args.params.relativePath
|
|
5216
5228
|
);
|
|
5229
|
+
if (newRealPath === realPath) {
|
|
5230
|
+
return doc;
|
|
5231
|
+
}
|
|
5217
5232
|
await this.database.put(newRealPath, doc._rawData, collection.name);
|
|
5218
5233
|
await this.deleteDocument(realPath);
|
|
5219
5234
|
const collRefs = await this.findReferences(realPath, collection);
|
|
@@ -5226,6 +5241,7 @@ var Resolver = class {
|
|
|
5226
5241
|
docWithRef = updateObjectWithJsonPath(
|
|
5227
5242
|
docWithRef,
|
|
5228
5243
|
path7,
|
|
5244
|
+
realPath,
|
|
5229
5245
|
newRealPath
|
|
5230
5246
|
);
|
|
5231
5247
|
}
|
package/dist/resolver/index.d.ts
CHANGED
|
@@ -40,6 +40,14 @@ export declare const transformDocumentIntoPayload: (fullPath: string, rawData: {
|
|
|
40
40
|
__typename: string;
|
|
41
41
|
id: string;
|
|
42
42
|
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Updates a property in an object using a JSONPath.
|
|
45
|
+
* @param obj - The object to update.
|
|
46
|
+
* @param path - The JSONPath string.
|
|
47
|
+
* @param newValue - The new value to set at the specified path.
|
|
48
|
+
* @returns the updated object.
|
|
49
|
+
*/
|
|
50
|
+
export declare const updateObjectWithJsonPath: (obj: any, path: string, oldValue: any, newValue: any) => any;
|
|
43
51
|
/**
|
|
44
52
|
* The resolver provides functions for all possible types of lookup
|
|
45
53
|
* values and retrieves them from the database
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/graphql",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-db8aa8e-20250228034006",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"@iarna/toml": "^2.2.5",
|
|
27
27
|
"abstract-level": "^1.0.4",
|
|
28
28
|
"date-fns": "^2.30.0",
|
|
29
|
-
"fast-glob": "^3.3.
|
|
30
|
-
"fs-extra": "^11.
|
|
29
|
+
"fast-glob": "^3.3.3",
|
|
30
|
+
"fs-extra": "^11.3.0",
|
|
31
31
|
"glob-parent": "^6.0.2",
|
|
32
32
|
"graphql": "15.8.0",
|
|
33
33
|
"gray-matter": "^4.0.3",
|
|
34
|
-
"isomorphic-git": "^1.
|
|
34
|
+
"isomorphic-git": "^1.29.0",
|
|
35
35
|
"js-sha1": "^0.6.0",
|
|
36
36
|
"js-yaml": "^3.14.1",
|
|
37
37
|
"jsonpath-plus": "10.1.0",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"many-level": "^2.0.0",
|
|
42
42
|
"micromatch": "4.0.8",
|
|
43
43
|
"normalize-path": "^3.0.0",
|
|
44
|
-
"readable-stream": "^4.
|
|
44
|
+
"readable-stream": "^4.7.0",
|
|
45
45
|
"scmp": "^2.1.0",
|
|
46
46
|
"yup": "^0.32.11",
|
|
47
|
-
"@tinacms/mdx": "0.0.0-
|
|
48
|
-
"@tinacms/schema-tools": "0.0.0-
|
|
47
|
+
"@tinacms/mdx": "0.0.0-db8aa8e-20250228034006",
|
|
48
|
+
"@tinacms/schema-tools": "0.0.0-db8aa8e-20250228034006"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"registry": "https://registry.npmjs.org"
|
|
@@ -65,19 +65,19 @@
|
|
|
65
65
|
"@types/lru-cache": "^5.1.1",
|
|
66
66
|
"@types/mdast": "^3.0.15",
|
|
67
67
|
"@types/micromatch": "^4.0.9",
|
|
68
|
-
"@types/node": "^22.
|
|
68
|
+
"@types/node": "^22.13.1",
|
|
69
69
|
"@types/normalize-path": "^3.0.2",
|
|
70
70
|
"@types/ws": "^7.4.7",
|
|
71
71
|
"@types/yup": "^0.29.14",
|
|
72
72
|
"jest-file-snapshot": "^0.5.0",
|
|
73
73
|
"memory-level": "^1.0.0",
|
|
74
74
|
"nodemon": "3.1.4",
|
|
75
|
-
"typescript": "^5.
|
|
76
|
-
"vite": "^4.
|
|
77
|
-
"vitest": "^0.32.
|
|
78
|
-
"zod": "^3.
|
|
79
|
-
"@tinacms/schema-tools": "0.0.0-
|
|
80
|
-
"@tinacms/scripts": "
|
|
75
|
+
"typescript": "^5.7.3",
|
|
76
|
+
"vite": "^4.5.9",
|
|
77
|
+
"vitest": "^0.32.4",
|
|
78
|
+
"zod": "^3.24.2",
|
|
79
|
+
"@tinacms/schema-tools": "0.0.0-db8aa8e-20250228034006",
|
|
80
|
+
"@tinacms/scripts": "0.0.0-db8aa8e-20250228034006"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
83
83
|
"types": "pnpm tsc",
|