@tinacms/graphql 1.4.8 → 1.4.10
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.es.js +20 -6
- package/dist/index.js +20 -6
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -2526,7 +2526,7 @@ var validateField = async (field) => {
|
|
|
2526
2526
|
// package.json
|
|
2527
2527
|
var package_default = {
|
|
2528
2528
|
name: "@tinacms/graphql",
|
|
2529
|
-
version: "1.4.
|
|
2529
|
+
version: "1.4.10",
|
|
2530
2530
|
main: "dist/index.js",
|
|
2531
2531
|
module: "dist/index.es.js",
|
|
2532
2532
|
typings: "dist/index.d.ts",
|
|
@@ -3530,6 +3530,9 @@ var FolderTreeBuilder = class {
|
|
|
3530
3530
|
}
|
|
3531
3531
|
update(documentPath, collectionPath) {
|
|
3532
3532
|
let folderPath = path.dirname(documentPath);
|
|
3533
|
+
if (folderPath === ".") {
|
|
3534
|
+
folderPath = "";
|
|
3535
|
+
}
|
|
3533
3536
|
if (collectionPath) {
|
|
3534
3537
|
folderPath = stripCollectionFromPath(collectionPath, folderPath);
|
|
3535
3538
|
}
|
|
@@ -3600,6 +3603,7 @@ var makeFolderOpsForCollection = (folderTree, collection, indexDefinitions, opTy
|
|
|
3600
3603
|
type: "put",
|
|
3601
3604
|
key: `${collection.path}/${parentFolderKey}.${collection.format}`,
|
|
3602
3605
|
value: {
|
|
3606
|
+
__collection: collection.name,
|
|
3603
3607
|
__folderBasename: path.basename(folderName),
|
|
3604
3608
|
__folderPath: folderName
|
|
3605
3609
|
},
|
|
@@ -4827,8 +4831,16 @@ var Database = class {
|
|
|
4827
4831
|
throw new GraphQLError4(`Unable to find record ${filepath}`);
|
|
4828
4832
|
}
|
|
4829
4833
|
const templateName = hasOwnProperty(contentObject, "_template") && typeof contentObject._template === "string" ? contentObject._template : void 0;
|
|
4830
|
-
const { collection, template } =
|
|
4831
|
-
|
|
4834
|
+
const { collection, template } = hasOwnProperty(
|
|
4835
|
+
contentObject,
|
|
4836
|
+
"__collection"
|
|
4837
|
+
) ? {
|
|
4838
|
+
collection: tinaSchema.getCollection(
|
|
4839
|
+
contentObject["__collection"]
|
|
4840
|
+
),
|
|
4841
|
+
template: void 0
|
|
4842
|
+
} : tinaSchema.getCollectionAndTemplateByFullPath(filepath, templateName);
|
|
4843
|
+
const field = template?.fields.find((field2) => {
|
|
4832
4844
|
if (field2.type === "string" || field2.type === "rich-text") {
|
|
4833
4845
|
if (field2.isBody) {
|
|
4834
4846
|
return true;
|
|
@@ -4848,7 +4860,7 @@ var Database = class {
|
|
|
4848
4860
|
...data,
|
|
4849
4861
|
_collection: collection.name,
|
|
4850
4862
|
_keepTemplateKey: !!collection.templates,
|
|
4851
|
-
_template: lastItem(template
|
|
4863
|
+
_template: template?.namespace ? lastItem(template?.namespace) : void 0,
|
|
4852
4864
|
_relativePath: filepath.replace(collection.path, "").replace(/^\/|\/$/g, ""),
|
|
4853
4865
|
_id: filepath
|
|
4854
4866
|
};
|
|
@@ -5296,6 +5308,7 @@ var Database = class {
|
|
|
5296
5308
|
cursor: btoa(edge.cursor)
|
|
5297
5309
|
};
|
|
5298
5310
|
} catch (error) {
|
|
5311
|
+
console.log(error);
|
|
5299
5312
|
if (error instanceof Error && (!edge.path.includes(".tina/__generated__/_graphql.json") || !edge.path.includes("tina/__generated__/_graphql.json"))) {
|
|
5300
5313
|
throw new TinaQueryError({
|
|
5301
5314
|
originalError: error,
|
|
@@ -5873,9 +5886,10 @@ var FilesystemBridge = class {
|
|
|
5873
5886
|
async glob(pattern, extension) {
|
|
5874
5887
|
const basePath = path4.join(this.outputPath, ...pattern.split("/"));
|
|
5875
5888
|
const items = await fg(
|
|
5876
|
-
path4.join(basePath, "**",
|
|
5889
|
+
path4.join(basePath, "**", `/*.${extension}`).replace(/\\/g, "/"),
|
|
5877
5890
|
{
|
|
5878
|
-
dot: true
|
|
5891
|
+
dot: true,
|
|
5892
|
+
ignore: ["**/node_modules/**"]
|
|
5879
5893
|
}
|
|
5880
5894
|
);
|
|
5881
5895
|
const posixRootPath = normalize(this.outputPath);
|
package/dist/index.js
CHANGED
|
@@ -2577,7 +2577,7 @@ var validateField = async (field) => {
|
|
|
2577
2577
|
// package.json
|
|
2578
2578
|
var package_default = {
|
|
2579
2579
|
name: "@tinacms/graphql",
|
|
2580
|
-
version: "1.4.
|
|
2580
|
+
version: "1.4.10",
|
|
2581
2581
|
main: "dist/index.js",
|
|
2582
2582
|
module: "dist/index.es.js",
|
|
2583
2583
|
typings: "dist/index.d.ts",
|
|
@@ -3576,6 +3576,9 @@ var FolderTreeBuilder = class {
|
|
|
3576
3576
|
}
|
|
3577
3577
|
update(documentPath, collectionPath) {
|
|
3578
3578
|
let folderPath = import_path.default.dirname(documentPath);
|
|
3579
|
+
if (folderPath === ".") {
|
|
3580
|
+
folderPath = "";
|
|
3581
|
+
}
|
|
3579
3582
|
if (collectionPath) {
|
|
3580
3583
|
folderPath = stripCollectionFromPath(collectionPath, folderPath);
|
|
3581
3584
|
}
|
|
@@ -3646,6 +3649,7 @@ var makeFolderOpsForCollection = (folderTree, collection, indexDefinitions, opTy
|
|
|
3646
3649
|
type: "put",
|
|
3647
3650
|
key: `${collection.path}/${parentFolderKey}.${collection.format}`,
|
|
3648
3651
|
value: {
|
|
3652
|
+
__collection: collection.name,
|
|
3649
3653
|
__folderBasename: import_path.default.basename(folderName),
|
|
3650
3654
|
__folderPath: folderName
|
|
3651
3655
|
},
|
|
@@ -4882,8 +4886,16 @@ var Database = class {
|
|
|
4882
4886
|
throw new import_graphql5.GraphQLError(`Unable to find record ${filepath}`);
|
|
4883
4887
|
}
|
|
4884
4888
|
const templateName = hasOwnProperty(contentObject, "_template") && typeof contentObject._template === "string" ? contentObject._template : void 0;
|
|
4885
|
-
const { collection, template } =
|
|
4886
|
-
|
|
4889
|
+
const { collection, template } = hasOwnProperty(
|
|
4890
|
+
contentObject,
|
|
4891
|
+
"__collection"
|
|
4892
|
+
) ? {
|
|
4893
|
+
collection: tinaSchema.getCollection(
|
|
4894
|
+
contentObject["__collection"]
|
|
4895
|
+
),
|
|
4896
|
+
template: void 0
|
|
4897
|
+
} : tinaSchema.getCollectionAndTemplateByFullPath(filepath, templateName);
|
|
4898
|
+
const field = template == null ? void 0 : template.fields.find((field2) => {
|
|
4887
4899
|
if (field2.type === "string" || field2.type === "rich-text") {
|
|
4888
4900
|
if (field2.isBody) {
|
|
4889
4901
|
return true;
|
|
@@ -4903,7 +4915,7 @@ var Database = class {
|
|
|
4903
4915
|
...data,
|
|
4904
4916
|
_collection: collection.name,
|
|
4905
4917
|
_keepTemplateKey: !!collection.templates,
|
|
4906
|
-
_template: lastItem(template.namespace),
|
|
4918
|
+
_template: (template == null ? void 0 : template.namespace) ? lastItem(template == null ? void 0 : template.namespace) : void 0,
|
|
4907
4919
|
_relativePath: filepath.replace(collection.path, "").replace(/^\/|\/$/g, ""),
|
|
4908
4920
|
_id: filepath
|
|
4909
4921
|
};
|
|
@@ -5356,6 +5368,7 @@ var Database = class {
|
|
|
5356
5368
|
cursor: btoa(edge.cursor)
|
|
5357
5369
|
};
|
|
5358
5370
|
} catch (error) {
|
|
5371
|
+
console.log(error);
|
|
5359
5372
|
if (error instanceof Error && (!edge.path.includes(".tina/__generated__/_graphql.json") || !edge.path.includes("tina/__generated__/_graphql.json"))) {
|
|
5360
5373
|
throw new TinaQueryError({
|
|
5361
5374
|
originalError: error,
|
|
@@ -5933,9 +5946,10 @@ var FilesystemBridge = class {
|
|
|
5933
5946
|
async glob(pattern, extension) {
|
|
5934
5947
|
const basePath = import_path4.default.join(this.outputPath, ...pattern.split("/"));
|
|
5935
5948
|
const items = await (0, import_fast_glob.default)(
|
|
5936
|
-
import_path4.default.join(basePath, "**",
|
|
5949
|
+
import_path4.default.join(basePath, "**", `/*.${extension}`).replace(/\\/g, "/"),
|
|
5937
5950
|
{
|
|
5938
|
-
dot: true
|
|
5951
|
+
dot: true,
|
|
5952
|
+
ignore: ["**/node_modules/**"]
|
|
5939
5953
|
}
|
|
5940
5954
|
);
|
|
5941
5955
|
const posixRootPath = (0, import_normalize_path.default)(this.outputPath);
|