@tinacms/graphql 1.4.6 → 1.4.7
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/database/index.d.ts +2 -2
- package/dist/index.es.js +21 -11
- package/dist/index.js +23 -11
- package/package.json +1 -1
package/dist/database/index.d.ts
CHANGED
|
@@ -93,7 +93,7 @@ export declare class Database {
|
|
|
93
93
|
getGraphQLSchema: () => Promise<DocumentNode>;
|
|
94
94
|
getGraphQLSchemaFromBridge: () => Promise<DocumentNode>;
|
|
95
95
|
getTinaSchema: (level?: Level) => Promise<Schema>;
|
|
96
|
-
getSchema: (level?: Level) => Promise<TinaSchema>;
|
|
96
|
+
getSchema: (level?: Level, existingSchema?: Schema) => Promise<TinaSchema>;
|
|
97
97
|
getIndexDefinitions: (level?: Level) => Promise<Record<string, Record<string, IndexDefinition>>>;
|
|
98
98
|
documentExists: (fullpath: unknown) => Promise<boolean>;
|
|
99
99
|
query: (queryOptions: QueryOptions, hydrator: any) => Promise<{
|
|
@@ -123,7 +123,7 @@ export declare class Database {
|
|
|
123
123
|
deleteContentByPaths: (documentPaths: string[]) => Promise<void>;
|
|
124
124
|
indexContentByPaths: (documentPaths: string[]) => Promise<void>;
|
|
125
125
|
delete: (filepath: string) => Promise<void>;
|
|
126
|
-
_indexAllContent: (level: Level) => Promise<{
|
|
126
|
+
_indexAllContent: (level: Level, schema?: Schema) => Promise<{
|
|
127
127
|
warnings: string[];
|
|
128
128
|
}>;
|
|
129
129
|
addToLookupMap: (lookup: LookupMapType) => Promise<void>;
|
package/dist/index.es.js
CHANGED
|
@@ -2491,7 +2491,7 @@ var validateField = async (field) => {
|
|
|
2491
2491
|
// package.json
|
|
2492
2492
|
var package_default = {
|
|
2493
2493
|
name: "@tinacms/graphql",
|
|
2494
|
-
version: "1.4.
|
|
2494
|
+
version: "1.4.7",
|
|
2495
2495
|
main: "dist/index.js",
|
|
2496
2496
|
module: "dist/index.es.js",
|
|
2497
2497
|
typings: "dist/index.d.ts",
|
|
@@ -4176,7 +4176,7 @@ var resolveDateInput = (value) => {
|
|
|
4176
4176
|
if (!isValid(date)) {
|
|
4177
4177
|
throw "Invalid Date";
|
|
4178
4178
|
}
|
|
4179
|
-
return date
|
|
4179
|
+
return date;
|
|
4180
4180
|
};
|
|
4181
4181
|
|
|
4182
4182
|
// src/resolve.ts
|
|
@@ -4460,9 +4460,9 @@ var stringifyFile = (content, format, keepTemplateKey, markdownParseConfig) => {
|
|
|
4460
4460
|
${$_body}`,
|
|
4461
4461
|
strippedContent,
|
|
4462
4462
|
{
|
|
4463
|
-
language: markdownParseConfig?.frontmatterFormat
|
|
4463
|
+
language: markdownParseConfig?.frontmatterFormat ?? "yaml",
|
|
4464
4464
|
engines: matterEngines,
|
|
4465
|
-
delimiters: markdownParseConfig?.frontmatterDelimiters
|
|
4465
|
+
delimiters: markdownParseConfig?.frontmatterDelimiters ?? "---"
|
|
4466
4466
|
}
|
|
4467
4467
|
);
|
|
4468
4468
|
return ok;
|
|
@@ -4483,8 +4483,8 @@ var parseFile = (content, format, yupSchema, markdownParseConfig) => {
|
|
|
4483
4483
|
case ".mdx":
|
|
4484
4484
|
case ".md":
|
|
4485
4485
|
const contentJSON = matter(content || "", {
|
|
4486
|
-
language: markdownParseConfig?.frontmatterFormat
|
|
4487
|
-
delimiters: markdownParseConfig?.frontmatterDelimiters
|
|
4486
|
+
language: markdownParseConfig?.frontmatterFormat ?? "yaml",
|
|
4487
|
+
delimiters: markdownParseConfig?.frontmatterDelimiters ?? "---",
|
|
4488
4488
|
engines: matterEngines
|
|
4489
4489
|
});
|
|
4490
4490
|
const markdownData = {
|
|
@@ -4920,12 +4920,19 @@ var Database = class {
|
|
|
4920
4920
|
SUBLEVEL_OPTIONS
|
|
4921
4921
|
).get(schemaPath);
|
|
4922
4922
|
};
|
|
4923
|
-
this.getSchema = async (level) => {
|
|
4923
|
+
this.getSchema = async (level, existingSchema) => {
|
|
4924
4924
|
if (this.tinaSchema) {
|
|
4925
4925
|
return this.tinaSchema;
|
|
4926
4926
|
}
|
|
4927
4927
|
await this.initLevel();
|
|
4928
|
-
const schema = await this.getTinaSchema(level || this.level);
|
|
4928
|
+
const schema = existingSchema || await this.getTinaSchema(level || this.level);
|
|
4929
|
+
if (!schema) {
|
|
4930
|
+
throw new Error(
|
|
4931
|
+
`Unable to get schema from level db: ${normalizePath(
|
|
4932
|
+
path2.join(this.getGeneratedFolder(), `_schema.json`)
|
|
4933
|
+
)}`
|
|
4934
|
+
);
|
|
4935
|
+
}
|
|
4929
4936
|
this.tinaSchema = await createSchema({ schema });
|
|
4930
4937
|
return this.tinaSchema;
|
|
4931
4938
|
};
|
|
@@ -5148,7 +5155,10 @@ var Database = class {
|
|
|
5148
5155
|
normalizePath(path2.join(this.getGeneratedFolder(), "_lookup.json")),
|
|
5149
5156
|
lookup
|
|
5150
5157
|
);
|
|
5151
|
-
const result = await this._indexAllContent(
|
|
5158
|
+
const result = await this._indexAllContent(
|
|
5159
|
+
nextLevel,
|
|
5160
|
+
tinaSchema.schema
|
|
5161
|
+
);
|
|
5152
5162
|
if (this.config.version) {
|
|
5153
5163
|
await this.updateDatabaseVersion(nextVersion);
|
|
5154
5164
|
}
|
|
@@ -5255,9 +5265,9 @@ var Database = class {
|
|
|
5255
5265
|
}
|
|
5256
5266
|
await this.onDelete(normalizePath(filepath));
|
|
5257
5267
|
};
|
|
5258
|
-
this._indexAllContent = async (level) => {
|
|
5268
|
+
this._indexAllContent = async (level, schema) => {
|
|
5259
5269
|
const warnings = [];
|
|
5260
|
-
const tinaSchema = await this.getSchema(level);
|
|
5270
|
+
const tinaSchema = await this.getSchema(level, schema);
|
|
5261
5271
|
const operations = [];
|
|
5262
5272
|
const enqueueOps = async (ops) => {
|
|
5263
5273
|
operations.push(...ops);
|
package/dist/index.js
CHANGED
|
@@ -2542,7 +2542,7 @@ var validateField = async (field) => {
|
|
|
2542
2542
|
// package.json
|
|
2543
2543
|
var package_default = {
|
|
2544
2544
|
name: "@tinacms/graphql",
|
|
2545
|
-
version: "1.4.
|
|
2545
|
+
version: "1.4.7",
|
|
2546
2546
|
main: "dist/index.js",
|
|
2547
2547
|
module: "dist/index.es.js",
|
|
2548
2548
|
typings: "dist/index.d.ts",
|
|
@@ -4223,7 +4223,7 @@ var resolveDateInput = (value) => {
|
|
|
4223
4223
|
if (!(0, import_isValid.default)(date)) {
|
|
4224
4224
|
throw "Invalid Date";
|
|
4225
4225
|
}
|
|
4226
|
-
return date
|
|
4226
|
+
return date;
|
|
4227
4227
|
};
|
|
4228
4228
|
|
|
4229
4229
|
// src/resolve.ts
|
|
@@ -4488,6 +4488,7 @@ var matterEngines = {
|
|
|
4488
4488
|
}
|
|
4489
4489
|
};
|
|
4490
4490
|
var stringifyFile = (content, format, keepTemplateKey, markdownParseConfig) => {
|
|
4491
|
+
var _a, _b;
|
|
4491
4492
|
const {
|
|
4492
4493
|
_relativePath,
|
|
4493
4494
|
_keepTemplateKey,
|
|
@@ -4511,9 +4512,9 @@ var stringifyFile = (content, format, keepTemplateKey, markdownParseConfig) => {
|
|
|
4511
4512
|
${$_body}`,
|
|
4512
4513
|
strippedContent,
|
|
4513
4514
|
{
|
|
4514
|
-
language: (markdownParseConfig == null ? void 0 : markdownParseConfig.frontmatterFormat)
|
|
4515
|
+
language: (_a = markdownParseConfig == null ? void 0 : markdownParseConfig.frontmatterFormat) != null ? _a : "yaml",
|
|
4515
4516
|
engines: matterEngines,
|
|
4516
|
-
delimiters: (markdownParseConfig == null ? void 0 : markdownParseConfig.frontmatterDelimiters)
|
|
4517
|
+
delimiters: (_b = markdownParseConfig == null ? void 0 : markdownParseConfig.frontmatterDelimiters) != null ? _b : "---"
|
|
4517
4518
|
}
|
|
4518
4519
|
);
|
|
4519
4520
|
return ok;
|
|
@@ -4529,13 +4530,14 @@ ${$_body}`,
|
|
|
4529
4530
|
}
|
|
4530
4531
|
};
|
|
4531
4532
|
var parseFile = (content, format, yupSchema, markdownParseConfig) => {
|
|
4533
|
+
var _a, _b;
|
|
4532
4534
|
switch (format) {
|
|
4533
4535
|
case ".markdown":
|
|
4534
4536
|
case ".mdx":
|
|
4535
4537
|
case ".md":
|
|
4536
4538
|
const contentJSON = (0, import_gray_matter.default)(content || "", {
|
|
4537
|
-
language: (markdownParseConfig == null ? void 0 : markdownParseConfig.frontmatterFormat)
|
|
4538
|
-
delimiters: (markdownParseConfig == null ? void 0 : markdownParseConfig.frontmatterDelimiters)
|
|
4539
|
+
language: (_a = markdownParseConfig == null ? void 0 : markdownParseConfig.frontmatterFormat) != null ? _a : "yaml",
|
|
4540
|
+
delimiters: (_b = markdownParseConfig == null ? void 0 : markdownParseConfig.frontmatterDelimiters) != null ? _b : "---",
|
|
4539
4541
|
engines: matterEngines
|
|
4540
4542
|
});
|
|
4541
4543
|
const markdownData = {
|
|
@@ -4974,12 +4976,19 @@ var Database = class {
|
|
|
4974
4976
|
SUBLEVEL_OPTIONS
|
|
4975
4977
|
).get(schemaPath);
|
|
4976
4978
|
};
|
|
4977
|
-
this.getSchema = async (level) => {
|
|
4979
|
+
this.getSchema = async (level, existingSchema) => {
|
|
4978
4980
|
if (this.tinaSchema) {
|
|
4979
4981
|
return this.tinaSchema;
|
|
4980
4982
|
}
|
|
4981
4983
|
await this.initLevel();
|
|
4982
|
-
const schema = await this.getTinaSchema(level || this.level);
|
|
4984
|
+
const schema = existingSchema || await this.getTinaSchema(level || this.level);
|
|
4985
|
+
if (!schema) {
|
|
4986
|
+
throw new Error(
|
|
4987
|
+
`Unable to get schema from level db: ${(0, import_schema_tools3.normalizePath)(
|
|
4988
|
+
import_path2.default.join(this.getGeneratedFolder(), `_schema.json`)
|
|
4989
|
+
)}`
|
|
4990
|
+
);
|
|
4991
|
+
}
|
|
4983
4992
|
this.tinaSchema = await createSchema({ schema });
|
|
4984
4993
|
return this.tinaSchema;
|
|
4985
4994
|
};
|
|
@@ -5206,7 +5215,10 @@ var Database = class {
|
|
|
5206
5215
|
(0, import_schema_tools3.normalizePath)(import_path2.default.join(this.getGeneratedFolder(), "_lookup.json")),
|
|
5207
5216
|
lookup
|
|
5208
5217
|
);
|
|
5209
|
-
const result = await this._indexAllContent(
|
|
5218
|
+
const result = await this._indexAllContent(
|
|
5219
|
+
nextLevel,
|
|
5220
|
+
tinaSchema.schema
|
|
5221
|
+
);
|
|
5210
5222
|
if (this.config.version) {
|
|
5211
5223
|
await this.updateDatabaseVersion(nextVersion);
|
|
5212
5224
|
}
|
|
@@ -5313,9 +5325,9 @@ var Database = class {
|
|
|
5313
5325
|
}
|
|
5314
5326
|
await this.onDelete((0, import_schema_tools3.normalizePath)(filepath));
|
|
5315
5327
|
};
|
|
5316
|
-
this._indexAllContent = async (level) => {
|
|
5328
|
+
this._indexAllContent = async (level, schema) => {
|
|
5317
5329
|
const warnings = [];
|
|
5318
|
-
const tinaSchema = await this.getSchema(level);
|
|
5330
|
+
const tinaSchema = await this.getSchema(level, schema);
|
|
5319
5331
|
const operations = [];
|
|
5320
5332
|
const enqueueOps = async (ops) => {
|
|
5321
5333
|
operations.push(...ops);
|