@tinacms/graphql 0.0.0-20220908164137 → 0.0.0-20220908190606
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 +5 -10
- package/dist/schema/index.d.ts +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -2668,9 +2668,9 @@ var TinaSchema = class {
|
|
|
2668
2668
|
}
|
|
2669
2669
|
return globalTemplate;
|
|
2670
2670
|
};
|
|
2671
|
-
this.getCollectionByFullPath =
|
|
2671
|
+
this.getCollectionByFullPath = (filepath) => {
|
|
2672
2672
|
const collection = this.getCollections().find((collection2) => {
|
|
2673
|
-
return filepath.replace("\\", "/").startsWith(collection2.path);
|
|
2673
|
+
return filepath.replace("\\", "/").startsWith(collection2.path.replace(/\/?$/, "/"));
|
|
2674
2674
|
});
|
|
2675
2675
|
if (!collection) {
|
|
2676
2676
|
throw new Error(`Unable to find collection for file at ${filepath}`);
|
|
@@ -2679,12 +2679,7 @@ var TinaSchema = class {
|
|
|
2679
2679
|
};
|
|
2680
2680
|
this.getCollectionAndTemplateByFullPath = (filepath, templateName) => {
|
|
2681
2681
|
let template;
|
|
2682
|
-
const collection = this.
|
|
2683
|
-
return filepath.replace("\\", "/").startsWith(collection2.path);
|
|
2684
|
-
});
|
|
2685
|
-
if (!collection) {
|
|
2686
|
-
throw new Error(`Unable to find collection for file at ${filepath}`);
|
|
2687
|
-
}
|
|
2682
|
+
const collection = this.getCollectionByFullPath(filepath);
|
|
2688
2683
|
const templates = this.getTemplatesForCollectable(collection);
|
|
2689
2684
|
if (templates.type === "union") {
|
|
2690
2685
|
if (templateName) {
|
|
@@ -3849,7 +3844,7 @@ var Database = class {
|
|
|
3849
3844
|
this.config = config;
|
|
3850
3845
|
this.collectionForPath = async (filepath) => {
|
|
3851
3846
|
const tinaSchema = await this.getSchema();
|
|
3852
|
-
const collection =
|
|
3847
|
+
const collection = tinaSchema.getCollectionByFullPath(filepath);
|
|
3853
3848
|
return collection;
|
|
3854
3849
|
};
|
|
3855
3850
|
this.get = async (filepath) => {
|
|
@@ -3941,7 +3936,7 @@ var Database = class {
|
|
|
3941
3936
|
throw new Error(`Unexpected put for config file ${filepath}`);
|
|
3942
3937
|
} else {
|
|
3943
3938
|
const tinaSchema = await this.getSchema();
|
|
3944
|
-
const collection =
|
|
3939
|
+
const collection = tinaSchema.getCollectionByFullPath(filepath);
|
|
3945
3940
|
const templateInfo = await tinaSchema.getTemplatesForCollectable(collection);
|
|
3946
3941
|
let template;
|
|
3947
3942
|
if (templateInfo.type === "object") {
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export declare class TinaSchema {
|
|
|
52
52
|
fields: import("../types").TinaFieldInner<true>[];
|
|
53
53
|
namespace: string[];
|
|
54
54
|
};
|
|
55
|
-
getCollectionByFullPath: (filepath: string) =>
|
|
55
|
+
getCollectionByFullPath: (filepath: string) => TinaCloudCollection<true>;
|
|
56
56
|
getCollectionAndTemplateByFullPath: (filepath: string, templateName?: string) => {
|
|
57
57
|
collection: TinaCloudCollection<true>;
|
|
58
58
|
template: Templateable;
|
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-20220908190606",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@graphql-tools/relay-operation-optimizer": "^6.4.1",
|
|
22
22
|
"@tinacms/datalayer": "0.2.3",
|
|
23
|
-
"@tinacms/schema-tools": "0.0.0-
|
|
24
|
-
"@tinacms/mdx": "0.0.0-
|
|
23
|
+
"@tinacms/schema-tools": "0.0.0-20220908190606",
|
|
24
|
+
"@tinacms/mdx": "0.0.0-20220908190606",
|
|
25
25
|
"body-parser": "^1.19.0",
|
|
26
26
|
"cors": "^2.8.5",
|
|
27
27
|
"dataloader": "^2.0.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@tinacms/datalayer": "0.2.3",
|
|
75
|
-
"@tinacms/schema-tools": "0.0.0-
|
|
75
|
+
"@tinacms/schema-tools": "0.0.0-20220908190606",
|
|
76
76
|
"@tinacms/scripts": "0.51.1",
|
|
77
77
|
"@types/cors": "^2.8.7",
|
|
78
78
|
"@types/estree": "^0.0.50",
|