@tinacms/graphql 0.0.0-d9672bc-20250218033222 → 0.0.0-dced6ab-20250611061422
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/README.md +144 -0
- package/dist/builder/index.d.ts +2 -2
- package/dist/database/bridge/filesystem.d.ts +1 -1
- package/dist/database/util.d.ts +5 -8
- package/dist/index.js +360 -264
- package/dist/index.mjs +237 -115
- package/dist/resolver/index.d.ts +15 -4
- package/dist/resolver/media-utils.d.ts +3 -3
- package/dist/schema/createSchema.d.ts +0 -3
- package/dist/schema/validate.d.ts +0 -3
- package/package.json +14 -16
- package/readme.md +0 -194
package/dist/index.mjs
CHANGED
|
@@ -1847,7 +1847,7 @@ var Builder = class {
|
|
|
1847
1847
|
* ```
|
|
1848
1848
|
*
|
|
1849
1849
|
* @public
|
|
1850
|
-
* @param collection a
|
|
1850
|
+
* @param collection a TinaCloud collection
|
|
1851
1851
|
*/
|
|
1852
1852
|
this.collectionFragment = async (collection) => {
|
|
1853
1853
|
const name = NAMER.dataTypeName(collection.namespace);
|
|
@@ -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.18",
|
|
3023
3023
|
main: "dist/index.js",
|
|
3024
3024
|
module: "dist/index.mjs",
|
|
3025
3025
|
typings: "dist/index.d.ts",
|
|
@@ -3045,33 +3045,32 @@ var package_default = {
|
|
|
3045
3045
|
types: "pnpm tsc",
|
|
3046
3046
|
build: "tinacms-scripts build",
|
|
3047
3047
|
docs: "pnpm typedoc",
|
|
3048
|
-
serve: "pnpm nodemon dist/server.js",
|
|
3049
3048
|
test: "vitest run",
|
|
3050
3049
|
"test-watch": "vitest"
|
|
3051
3050
|
},
|
|
3052
3051
|
dependencies: {
|
|
3053
|
-
"@iarna/toml": "
|
|
3052
|
+
"@iarna/toml": "catalog:",
|
|
3054
3053
|
"@tinacms/mdx": "workspace:*",
|
|
3055
3054
|
"@tinacms/schema-tools": "workspace:*",
|
|
3056
|
-
"abstract-level": "
|
|
3055
|
+
"abstract-level": "catalog:",
|
|
3057
3056
|
"date-fns": "^2.30.0",
|
|
3058
|
-
"fast-glob": "
|
|
3059
|
-
"fs-extra": "
|
|
3060
|
-
"glob-parent": "
|
|
3057
|
+
"fast-glob": "catalog:",
|
|
3058
|
+
"fs-extra": "catalog:",
|
|
3059
|
+
"glob-parent": "catalog:",
|
|
3061
3060
|
graphql: "15.8.0",
|
|
3062
|
-
"gray-matter": "
|
|
3063
|
-
"isomorphic-git": "
|
|
3064
|
-
"js-sha1": "
|
|
3061
|
+
"gray-matter": "catalog:",
|
|
3062
|
+
"isomorphic-git": "catalog:",
|
|
3063
|
+
"js-sha1": "catalog:",
|
|
3065
3064
|
"js-yaml": "^3.14.1",
|
|
3066
|
-
"jsonpath-plus": "
|
|
3067
|
-
"lodash.clonedeep": "
|
|
3068
|
-
"lodash.set": "
|
|
3069
|
-
"lodash.uniqby": "
|
|
3070
|
-
"many-level": "
|
|
3071
|
-
micromatch: "
|
|
3072
|
-
"normalize-path": "
|
|
3073
|
-
"readable-stream": "
|
|
3074
|
-
scmp: "
|
|
3065
|
+
"jsonpath-plus": "catalog:",
|
|
3066
|
+
"lodash.clonedeep": "catalog:",
|
|
3067
|
+
"lodash.set": "catalog:",
|
|
3068
|
+
"lodash.uniqby": "catalog:",
|
|
3069
|
+
"many-level": "catalog:",
|
|
3070
|
+
micromatch: "catalog:",
|
|
3071
|
+
"normalize-path": "catalog:",
|
|
3072
|
+
"readable-stream": "catalog:",
|
|
3073
|
+
scmp: "catalog:",
|
|
3075
3074
|
yup: "^0.32.11"
|
|
3076
3075
|
},
|
|
3077
3076
|
publishConfig: {
|
|
@@ -3086,25 +3085,24 @@ var package_default = {
|
|
|
3086
3085
|
"@tinacms/scripts": "workspace:*",
|
|
3087
3086
|
"@types/cors": "^2.8.17",
|
|
3088
3087
|
"@types/estree": "^0.0.50",
|
|
3089
|
-
"@types/express": "
|
|
3088
|
+
"@types/express": "catalog:",
|
|
3090
3089
|
"@types/fs-extra": "^9.0.13",
|
|
3091
3090
|
"@types/js-yaml": "^3.12.10",
|
|
3092
|
-
"@types/lodash.camelcase": "
|
|
3093
|
-
"@types/lodash.upperfirst": "
|
|
3094
|
-
"@types/lru-cache": "
|
|
3095
|
-
"@types/mdast": "
|
|
3096
|
-
"@types/micromatch": "
|
|
3097
|
-
"@types/node": "^22.
|
|
3098
|
-
"@types/normalize-path": "
|
|
3099
|
-
"@types/ws": "
|
|
3091
|
+
"@types/lodash.camelcase": "catalog:",
|
|
3092
|
+
"@types/lodash.upperfirst": "catalog:",
|
|
3093
|
+
"@types/lru-cache": "catalog:",
|
|
3094
|
+
"@types/mdast": "catalog:",
|
|
3095
|
+
"@types/micromatch": "catalog:",
|
|
3096
|
+
"@types/node": "^22.13.1",
|
|
3097
|
+
"@types/normalize-path": "catalog:",
|
|
3098
|
+
"@types/ws": "catalog:",
|
|
3100
3099
|
"@types/yup": "^0.29.14",
|
|
3101
3100
|
"jest-file-snapshot": "^0.5.0",
|
|
3102
|
-
"memory-level": "
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
zod: "^3.23.8"
|
|
3101
|
+
"memory-level": "catalog:",
|
|
3102
|
+
typescript: "^5.7.3",
|
|
3103
|
+
vite: "^4.5.9",
|
|
3104
|
+
vitest: "^0.32.4",
|
|
3105
|
+
zod: "^3.24.2"
|
|
3108
3106
|
}
|
|
3109
3107
|
};
|
|
3110
3108
|
|
|
@@ -3260,7 +3258,9 @@ var _buildSchema = async (builder, tinaSchema) => {
|
|
|
3260
3258
|
await builder.buildCreateCollectionFolderMutation()
|
|
3261
3259
|
);
|
|
3262
3260
|
await sequential(collections, async (collection) => {
|
|
3263
|
-
queryTypeDefinitionFields.push(
|
|
3261
|
+
queryTypeDefinitionFields.push(
|
|
3262
|
+
await builder.collectionDocument(collection)
|
|
3263
|
+
);
|
|
3264
3264
|
if (collection.isAuthCollection) {
|
|
3265
3265
|
queryTypeDefinitionFields.push(
|
|
3266
3266
|
await builder.authenticationCollectionDocument(collection)
|
|
@@ -3575,7 +3575,9 @@ var LevelProxyHandler = {
|
|
|
3575
3575
|
throw new Error(`The property, ${property.toString()}, doesn't exist`);
|
|
3576
3576
|
}
|
|
3577
3577
|
if (typeof target[property] !== "function") {
|
|
3578
|
-
throw new Error(
|
|
3578
|
+
throw new Error(
|
|
3579
|
+
`The property, ${property.toString()}, is not a function`
|
|
3580
|
+
);
|
|
3579
3581
|
}
|
|
3580
3582
|
if (property === "get") {
|
|
3581
3583
|
return async (...args) => {
|
|
@@ -4551,10 +4553,26 @@ var makeRefOpsForDocument = (filepath, collection, references, data, opType, lev
|
|
|
4551
4553
|
const references2 = {};
|
|
4552
4554
|
for (const path7 of referencePaths) {
|
|
4553
4555
|
const ref = JSONPath({ path: path7, json: data });
|
|
4554
|
-
if (
|
|
4555
|
-
|
|
4556
|
+
if (!ref) {
|
|
4557
|
+
continue;
|
|
4558
|
+
}
|
|
4559
|
+
if (Array.isArray(ref)) {
|
|
4560
|
+
for (const r of ref) {
|
|
4561
|
+
if (!r) {
|
|
4562
|
+
continue;
|
|
4563
|
+
}
|
|
4564
|
+
if (references2[r]) {
|
|
4565
|
+
references2[r].push(path7);
|
|
4566
|
+
} else {
|
|
4567
|
+
references2[r] = [path7];
|
|
4568
|
+
}
|
|
4569
|
+
}
|
|
4556
4570
|
} else {
|
|
4557
|
-
references2[ref]
|
|
4571
|
+
if (references2[ref]) {
|
|
4572
|
+
references2[ref].push(path7);
|
|
4573
|
+
} else {
|
|
4574
|
+
references2[ref] = [path7];
|
|
4575
|
+
}
|
|
4558
4576
|
}
|
|
4559
4577
|
}
|
|
4560
4578
|
for (const ref of Object.keys(references2)) {
|
|
@@ -4791,24 +4809,33 @@ var transformDocumentIntoPayload = async (fullPath, rawData, tinaSchema, config,
|
|
|
4791
4809
|
throw e;
|
|
4792
4810
|
}
|
|
4793
4811
|
};
|
|
4794
|
-
var updateObjectWithJsonPath = (obj, path7, newValue) => {
|
|
4812
|
+
var updateObjectWithJsonPath = (obj, path7, oldValue, newValue) => {
|
|
4813
|
+
let updated = false;
|
|
4795
4814
|
if (!path7.includes(".") && !path7.includes("[")) {
|
|
4796
|
-
if (path7 in obj) {
|
|
4815
|
+
if (path7 in obj && obj[path7] === oldValue) {
|
|
4797
4816
|
obj[path7] = newValue;
|
|
4817
|
+
updated = true;
|
|
4798
4818
|
}
|
|
4799
|
-
return obj;
|
|
4800
|
-
}
|
|
4801
|
-
const parentPath = path7.replace(/\.[
|
|
4802
|
-
const keyToUpdate = path7.match(/[
|
|
4803
|
-
const parents = JSONPath2({
|
|
4819
|
+
return { object: obj, updated };
|
|
4820
|
+
}
|
|
4821
|
+
const parentPath = path7.replace(/\.[^.\[\]]+$/, "");
|
|
4822
|
+
const keyToUpdate = path7.match(/[^.\[\]]+$/)[0];
|
|
4823
|
+
const parents = JSONPath2({
|
|
4824
|
+
path: parentPath,
|
|
4825
|
+
json: obj,
|
|
4826
|
+
resultType: "value"
|
|
4827
|
+
});
|
|
4804
4828
|
if (parents.length > 0) {
|
|
4805
4829
|
parents.forEach((parent) => {
|
|
4806
4830
|
if (parent && typeof parent === "object" && keyToUpdate in parent) {
|
|
4807
|
-
parent[keyToUpdate]
|
|
4831
|
+
if (parent[keyToUpdate] === oldValue) {
|
|
4832
|
+
parent[keyToUpdate] = newValue;
|
|
4833
|
+
updated = true;
|
|
4834
|
+
}
|
|
4808
4835
|
}
|
|
4809
4836
|
});
|
|
4810
4837
|
}
|
|
4811
|
-
return obj;
|
|
4838
|
+
return { object: obj, updated };
|
|
4812
4839
|
};
|
|
4813
4840
|
var Resolver = class {
|
|
4814
4841
|
constructor(init) {
|
|
@@ -4825,7 +4852,9 @@ var Resolver = class {
|
|
|
4825
4852
|
};
|
|
4826
4853
|
this.getRaw = async (fullPath) => {
|
|
4827
4854
|
if (typeof fullPath !== "string") {
|
|
4828
|
-
throw new Error(
|
|
4855
|
+
throw new Error(
|
|
4856
|
+
`fullPath must be of type string for getDocument request`
|
|
4857
|
+
);
|
|
4829
4858
|
}
|
|
4830
4859
|
return this.database.get(fullPath);
|
|
4831
4860
|
};
|
|
@@ -4854,7 +4883,9 @@ var Resolver = class {
|
|
|
4854
4883
|
};
|
|
4855
4884
|
this.getDocument = async (fullPath, opts = {}) => {
|
|
4856
4885
|
if (typeof fullPath !== "string") {
|
|
4857
|
-
throw new Error(
|
|
4886
|
+
throw new Error(
|
|
4887
|
+
`fullPath must be of type string for getDocument request`
|
|
4888
|
+
);
|
|
4858
4889
|
}
|
|
4859
4890
|
const rawData = await this.getRaw(fullPath);
|
|
4860
4891
|
const hasReferences = opts?.checkReferences ? await this.hasReferences(fullPath, opts.collection) : void 0;
|
|
@@ -4869,7 +4900,9 @@ var Resolver = class {
|
|
|
4869
4900
|
};
|
|
4870
4901
|
this.deleteDocument = async (fullPath) => {
|
|
4871
4902
|
if (typeof fullPath !== "string") {
|
|
4872
|
-
throw new Error(
|
|
4903
|
+
throw new Error(
|
|
4904
|
+
`fullPath must be of type string for getDocument request`
|
|
4905
|
+
);
|
|
4873
4906
|
}
|
|
4874
4907
|
await this.database.delete(fullPath);
|
|
4875
4908
|
};
|
|
@@ -5073,7 +5106,11 @@ var Resolver = class {
|
|
|
5073
5106
|
collection,
|
|
5074
5107
|
doc?._rawData
|
|
5075
5108
|
);
|
|
5076
|
-
await this.database.put(
|
|
5109
|
+
await this.database.put(
|
|
5110
|
+
realPath,
|
|
5111
|
+
{ ...oldDoc, ...params },
|
|
5112
|
+
collection.name
|
|
5113
|
+
);
|
|
5077
5114
|
return this.getDocument(realPath);
|
|
5078
5115
|
};
|
|
5079
5116
|
/**
|
|
@@ -5191,10 +5228,30 @@ var Resolver = class {
|
|
|
5191
5228
|
docsWithRefs
|
|
5192
5229
|
)) {
|
|
5193
5230
|
let refDoc = await this.getRaw(pathToDocWithRef);
|
|
5231
|
+
let hasUpdate = false;
|
|
5194
5232
|
for (const path7 of referencePaths) {
|
|
5195
|
-
|
|
5233
|
+
const { object: object2, updated } = updateObjectWithJsonPath(
|
|
5234
|
+
refDoc,
|
|
5235
|
+
path7,
|
|
5236
|
+
realPath,
|
|
5237
|
+
null
|
|
5238
|
+
);
|
|
5239
|
+
refDoc = object2;
|
|
5240
|
+
hasUpdate = updated || hasUpdate;
|
|
5241
|
+
}
|
|
5242
|
+
if (hasUpdate) {
|
|
5243
|
+
const collectionWithRef = this.tinaSchema.getCollectionByFullPath(pathToDocWithRef);
|
|
5244
|
+
if (!collectionWithRef) {
|
|
5245
|
+
throw new Error(
|
|
5246
|
+
`Unable to find collection for ${pathToDocWithRef}`
|
|
5247
|
+
);
|
|
5248
|
+
}
|
|
5249
|
+
await this.database.put(
|
|
5250
|
+
pathToDocWithRef,
|
|
5251
|
+
refDoc,
|
|
5252
|
+
collectionWithRef.name
|
|
5253
|
+
);
|
|
5196
5254
|
}
|
|
5197
|
-
await this.database.put(pathToDocWithRef, refDoc, collection2);
|
|
5198
5255
|
}
|
|
5199
5256
|
}
|
|
5200
5257
|
}
|
|
@@ -5214,6 +5271,9 @@ var Resolver = class {
|
|
|
5214
5271
|
collection?.path,
|
|
5215
5272
|
args.params.relativePath
|
|
5216
5273
|
);
|
|
5274
|
+
if (newRealPath === realPath) {
|
|
5275
|
+
return doc;
|
|
5276
|
+
}
|
|
5217
5277
|
await this.database.put(newRealPath, doc._rawData, collection.name);
|
|
5218
5278
|
await this.deleteDocument(realPath);
|
|
5219
5279
|
const collRefs = await this.findReferences(realPath, collection);
|
|
@@ -5222,20 +5282,38 @@ var Resolver = class {
|
|
|
5222
5282
|
docsWithRefs
|
|
5223
5283
|
)) {
|
|
5224
5284
|
let docWithRef = await this.getRaw(pathToDocWithRef);
|
|
5285
|
+
let hasUpdate = false;
|
|
5225
5286
|
for (const path7 of referencePaths) {
|
|
5226
|
-
|
|
5287
|
+
const { object: object2, updated } = updateObjectWithJsonPath(
|
|
5227
5288
|
docWithRef,
|
|
5228
5289
|
path7,
|
|
5290
|
+
realPath,
|
|
5229
5291
|
newRealPath
|
|
5230
5292
|
);
|
|
5293
|
+
docWithRef = object2;
|
|
5294
|
+
hasUpdate = updated || hasUpdate;
|
|
5295
|
+
}
|
|
5296
|
+
if (hasUpdate) {
|
|
5297
|
+
const collectionWithRef = this.tinaSchema.getCollectionByFullPath(pathToDocWithRef);
|
|
5298
|
+
if (!collectionWithRef) {
|
|
5299
|
+
throw new Error(
|
|
5300
|
+
`Unable to find collection for ${pathToDocWithRef}`
|
|
5301
|
+
);
|
|
5302
|
+
}
|
|
5303
|
+
await this.database.put(
|
|
5304
|
+
pathToDocWithRef,
|
|
5305
|
+
docWithRef,
|
|
5306
|
+
collectionWithRef.name
|
|
5307
|
+
);
|
|
5231
5308
|
}
|
|
5232
|
-
await this.database.put(pathToDocWithRef, docWithRef, collection2);
|
|
5233
5309
|
}
|
|
5234
5310
|
}
|
|
5235
5311
|
return this.getDocument(newRealPath);
|
|
5236
5312
|
}
|
|
5237
5313
|
if (alreadyExists === false) {
|
|
5238
|
-
throw new Error(
|
|
5314
|
+
throw new Error(
|
|
5315
|
+
`Unable to update document, ${realPath} does not exist`
|
|
5316
|
+
);
|
|
5239
5317
|
}
|
|
5240
5318
|
return this.updateResolveDocument({
|
|
5241
5319
|
collection,
|
|
@@ -6577,8 +6655,35 @@ var Database = class {
|
|
|
6577
6655
|
]
|
|
6578
6656
|
}
|
|
6579
6657
|
};
|
|
6580
|
-
|
|
6581
|
-
|
|
6658
|
+
let fields = [];
|
|
6659
|
+
if (collection.templates) {
|
|
6660
|
+
const templateFieldMap = {};
|
|
6661
|
+
const conflictedFields = /* @__PURE__ */ new Set();
|
|
6662
|
+
for (const template of collection.templates) {
|
|
6663
|
+
for (const field of template.fields) {
|
|
6664
|
+
if (!templateFieldMap[field.name]) {
|
|
6665
|
+
templateFieldMap[field.name] = field;
|
|
6666
|
+
} else {
|
|
6667
|
+
if (templateFieldMap[field.name].type !== field.type) {
|
|
6668
|
+
console.warn(
|
|
6669
|
+
`Field ${field.name} has conflicting types in templates - skipping index`
|
|
6670
|
+
);
|
|
6671
|
+
conflictedFields.add(field.name);
|
|
6672
|
+
}
|
|
6673
|
+
}
|
|
6674
|
+
}
|
|
6675
|
+
}
|
|
6676
|
+
for (const conflictedField in conflictedFields) {
|
|
6677
|
+
delete templateFieldMap[conflictedField];
|
|
6678
|
+
}
|
|
6679
|
+
for (const field of Object.values(templateFieldMap)) {
|
|
6680
|
+
fields.push(field);
|
|
6681
|
+
}
|
|
6682
|
+
} else if (collection.fields) {
|
|
6683
|
+
fields = collection.fields;
|
|
6684
|
+
}
|
|
6685
|
+
if (fields) {
|
|
6686
|
+
for (const field of fields) {
|
|
6582
6687
|
if (field.indexed !== void 0 && field.indexed === false || field.type === "object") {
|
|
6583
6688
|
continue;
|
|
6584
6689
|
}
|
|
@@ -6879,13 +6984,14 @@ var Database = class {
|
|
|
6879
6984
|
documentPaths,
|
|
6880
6985
|
async (collection, documentPaths2) => {
|
|
6881
6986
|
if (collection && !collection.isDetached) {
|
|
6882
|
-
await _indexContent(
|
|
6883
|
-
this,
|
|
6884
|
-
this.contentLevel,
|
|
6885
|
-
documentPaths2,
|
|
6987
|
+
await _indexContent({
|
|
6988
|
+
database: this,
|
|
6989
|
+
level: this.contentLevel,
|
|
6990
|
+
documentPaths: documentPaths2,
|
|
6886
6991
|
enqueueOps,
|
|
6887
|
-
collection
|
|
6888
|
-
|
|
6992
|
+
collection,
|
|
6993
|
+
isPartialReindex: true
|
|
6994
|
+
});
|
|
6889
6995
|
}
|
|
6890
6996
|
}
|
|
6891
6997
|
);
|
|
@@ -6992,20 +7098,26 @@ var Database = class {
|
|
|
6992
7098
|
);
|
|
6993
7099
|
const doc = await level2.keys({ limit: 1 }).next();
|
|
6994
7100
|
if (!doc) {
|
|
6995
|
-
await _indexContent(
|
|
6996
|
-
this,
|
|
6997
|
-
level2,
|
|
6998
|
-
contentPaths,
|
|
7101
|
+
await _indexContent({
|
|
7102
|
+
database: this,
|
|
7103
|
+
level: level2,
|
|
7104
|
+
documentPaths: contentPaths,
|
|
6999
7105
|
enqueueOps,
|
|
7000
7106
|
collection,
|
|
7001
|
-
userFields.map((field) => [
|
|
7107
|
+
passwordFields: userFields.map((field) => [
|
|
7002
7108
|
...field.path,
|
|
7003
7109
|
field.passwordFieldName
|
|
7004
7110
|
])
|
|
7005
|
-
);
|
|
7111
|
+
});
|
|
7006
7112
|
}
|
|
7007
7113
|
} else {
|
|
7008
|
-
await _indexContent(
|
|
7114
|
+
await _indexContent({
|
|
7115
|
+
database: this,
|
|
7116
|
+
level,
|
|
7117
|
+
documentPaths: contentPaths,
|
|
7118
|
+
enqueueOps,
|
|
7119
|
+
collection
|
|
7120
|
+
});
|
|
7009
7121
|
}
|
|
7010
7122
|
}
|
|
7011
7123
|
);
|
|
@@ -7144,7 +7256,15 @@ var hashPasswordValues = async (data, passwordFields) => Promise.all(
|
|
|
7144
7256
|
)
|
|
7145
7257
|
);
|
|
7146
7258
|
var isGitKeep = (filepath, collection) => filepath.endsWith(`.gitkeep.${collection?.format || "md"}`);
|
|
7147
|
-
var _indexContent = async (
|
|
7259
|
+
var _indexContent = async ({
|
|
7260
|
+
database,
|
|
7261
|
+
level,
|
|
7262
|
+
documentPaths,
|
|
7263
|
+
enqueueOps,
|
|
7264
|
+
collection,
|
|
7265
|
+
passwordFields,
|
|
7266
|
+
isPartialReindex
|
|
7267
|
+
}) => {
|
|
7148
7268
|
let collectionIndexDefinitions;
|
|
7149
7269
|
let collectionPath;
|
|
7150
7270
|
if (collection) {
|
|
@@ -7185,40 +7305,42 @@ var _indexContent = async (database, level, documentPaths, enqueueOps, collectio
|
|
|
7185
7305
|
normalizedPath,
|
|
7186
7306
|
collectionPath || ""
|
|
7187
7307
|
);
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7308
|
+
if (isPartialReindex) {
|
|
7309
|
+
const item = await rootSublevel.get(normalizedPath);
|
|
7310
|
+
if (item) {
|
|
7311
|
+
await database.contentLevel.batch([
|
|
7312
|
+
...makeRefOpsForDocument(
|
|
7313
|
+
normalizedPath,
|
|
7314
|
+
collection?.name,
|
|
7315
|
+
collectionReferences,
|
|
7316
|
+
item,
|
|
7317
|
+
"del",
|
|
7318
|
+
level
|
|
7319
|
+
),
|
|
7320
|
+
...makeIndexOpsForDocument(
|
|
7321
|
+
normalizedPath,
|
|
7322
|
+
collection.name,
|
|
7323
|
+
collectionIndexDefinitions,
|
|
7324
|
+
item,
|
|
7325
|
+
"del",
|
|
7326
|
+
level
|
|
7327
|
+
),
|
|
7328
|
+
// folder indices
|
|
7329
|
+
...makeIndexOpsForDocument(
|
|
7330
|
+
normalizedPath,
|
|
7331
|
+
`${collection.name}_${folderKey}`,
|
|
7332
|
+
collectionIndexDefinitions,
|
|
7333
|
+
item,
|
|
7334
|
+
"del",
|
|
7335
|
+
level
|
|
7336
|
+
),
|
|
7337
|
+
{
|
|
7338
|
+
type: "del",
|
|
7339
|
+
key: normalizedPath,
|
|
7340
|
+
sublevel: rootSublevel
|
|
7341
|
+
}
|
|
7342
|
+
]);
|
|
7343
|
+
}
|
|
7222
7344
|
}
|
|
7223
7345
|
if (!isGitKeep(filepath, collection)) {
|
|
7224
7346
|
await enqueueOps([
|
|
@@ -7454,8 +7576,8 @@ import path6 from "path";
|
|
|
7454
7576
|
import normalize from "normalize-path";
|
|
7455
7577
|
var FilesystemBridge = class {
|
|
7456
7578
|
constructor(rootPath, outputPath) {
|
|
7457
|
-
this.rootPath = rootPath
|
|
7458
|
-
this.outputPath = outputPath
|
|
7579
|
+
this.rootPath = path6.resolve(rootPath);
|
|
7580
|
+
this.outputPath = outputPath ? path6.resolve(outputPath) : this.rootPath;
|
|
7459
7581
|
}
|
|
7460
7582
|
async glob(pattern, extension) {
|
|
7461
7583
|
const basePath = path6.join(this.outputPath, ...pattern.split("/"));
|
|
@@ -7467,19 +7589,19 @@ var FilesystemBridge = class {
|
|
|
7467
7589
|
}
|
|
7468
7590
|
);
|
|
7469
7591
|
const posixRootPath = normalize(this.outputPath);
|
|
7470
|
-
return items.map(
|
|
7471
|
-
|
|
7472
|
-
|
|
7592
|
+
return items.map(
|
|
7593
|
+
(item) => item.substring(posixRootPath.length).replace(/^\/|\/$/g, "")
|
|
7594
|
+
);
|
|
7473
7595
|
}
|
|
7474
7596
|
async delete(filepath) {
|
|
7475
7597
|
await fs2.remove(path6.join(this.outputPath, filepath));
|
|
7476
7598
|
}
|
|
7477
7599
|
async get(filepath) {
|
|
7478
|
-
return fs2.
|
|
7600
|
+
return (await fs2.readFile(path6.join(this.outputPath, filepath))).toString();
|
|
7479
7601
|
}
|
|
7480
7602
|
async put(filepath, data, basePathOverride) {
|
|
7481
7603
|
const basePath = basePathOverride || this.outputPath;
|
|
7482
|
-
await fs2.
|
|
7604
|
+
await fs2.outputFile(path6.join(basePath, filepath), data);
|
|
7483
7605
|
}
|
|
7484
7606
|
};
|
|
7485
7607
|
var AuditFileSystemBridge = class extends FilesystemBridge {
|
package/dist/resolver/index.d.ts
CHANGED
|
@@ -40,6 +40,17 @@ 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) => {
|
|
51
|
+
object: any;
|
|
52
|
+
updated: boolean;
|
|
53
|
+
};
|
|
43
54
|
/**
|
|
44
55
|
* The resolver provides functions for all possible types of lookup
|
|
45
56
|
* values and retrieves them from the database
|
|
@@ -63,10 +74,10 @@ export declare class Resolver {
|
|
|
63
74
|
name: string;
|
|
64
75
|
}[];
|
|
65
76
|
}[];
|
|
66
|
-
format?: "
|
|
77
|
+
format?: import("@tinacms/schema-tools").ContentFormat;
|
|
67
78
|
ui?: import("@tinacms/schema-tools").UICollection;
|
|
68
79
|
defaultItem?: import("@tinacms/schema-tools").DefaultItem<Record<string, any>>;
|
|
69
|
-
frontmatterFormat?: "
|
|
80
|
+
frontmatterFormat?: import("@tinacms/schema-tools").ContentFrontmatterFormat;
|
|
70
81
|
frontmatterDelimiters?: [string, string] | string;
|
|
71
82
|
match?: {
|
|
72
83
|
include?: string;
|
|
@@ -91,10 +102,10 @@ export declare class Resolver {
|
|
|
91
102
|
name: string;
|
|
92
103
|
}[];
|
|
93
104
|
}[];
|
|
94
|
-
format?: "
|
|
105
|
+
format?: import("@tinacms/schema-tools").ContentFormat;
|
|
95
106
|
ui?: import("@tinacms/schema-tools").UICollection;
|
|
96
107
|
defaultItem?: import("@tinacms/schema-tools").DefaultItem<Record<string, any>>;
|
|
97
|
-
frontmatterFormat?: "
|
|
108
|
+
frontmatterFormat?: import("@tinacms/schema-tools").ContentFrontmatterFormat;
|
|
98
109
|
frontmatterDelimiters?: [string, string] | string;
|
|
99
110
|
match?: {
|
|
100
111
|
include?: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
|
|
3
3
|
*/
|
|
4
|
-
import type { GraphQLConfig } from '../types';
|
|
5
4
|
import type { Schema } from '@tinacms/schema-tools';
|
|
5
|
+
import type { GraphQLConfig } from '../types';
|
|
6
6
|
/**
|
|
7
|
-
* Strips away the
|
|
7
|
+
* Strips away the TinaCloud Asset URL from an `image` value
|
|
8
8
|
*
|
|
9
9
|
* @param {string | string[]} value
|
|
10
10
|
* @param {GraphQLConfig} config
|
|
@@ -12,7 +12,7 @@ import type { Schema } from '@tinacms/schema-tools';
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const resolveMediaCloudToRelative: (value: string | string[], config: GraphQLConfig, schema: Schema<true>) => string | string[];
|
|
14
14
|
/**
|
|
15
|
-
* Adds
|
|
15
|
+
* Adds TinaCloud Asset URL to an `image` value
|
|
16
16
|
*
|
|
17
17
|
* @param {string | string[]} value
|
|
18
18
|
* @param {GraphQLConfig} config
|