@tinacms/graphql 0.0.0-2022420135214 → 0.0.0-20224201864
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/CHANGELOG.md +3 -1
- package/dist/database/util.d.ts +1 -0
- package/dist/index.js +71 -37
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# tina-graphql
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20224201864
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- 79d112d79: Update cli to accept tinaCloudMediaStore flag and add to metadata during schema compilation
|
|
8
|
+
- 3f46c6706: Fixed issue where generated SDK would not work with templates
|
|
9
|
+
- 91d6e6758: Fix issues with experimentalData on windows related to path separator inconsistency and interference with the .tina/**generated** folder
|
|
8
10
|
|
|
9
11
|
## 0.60.2
|
|
10
12
|
|
package/dist/database/util.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ import * as yup from 'yup';
|
|
|
14
14
|
export declare const stringifyFile: (content: object, format: FormatType | string, keepTemplateKey: boolean) => string;
|
|
15
15
|
export declare const parseFile: <T extends object>(content: string, format: FormatType | string, yupSchema: (args: typeof yup) => yup.ObjectSchema<any>) => T;
|
|
16
16
|
export declare type FormatType = 'json' | 'md' | 'mdx' | 'markdown';
|
|
17
|
+
export declare const normalizePath: (filepath: string) => string;
|
package/dist/index.js
CHANGED
|
@@ -10911,15 +10911,31 @@ var astBuilder = {
|
|
|
10911
10911
|
selectionSet: {
|
|
10912
10912
|
kind: "SelectionSet",
|
|
10913
10913
|
selections: [
|
|
10914
|
-
SysFieldDefinition,
|
|
10915
10914
|
{
|
|
10916
|
-
kind: "
|
|
10917
|
-
|
|
10918
|
-
kind: "
|
|
10919
|
-
|
|
10915
|
+
kind: "InlineFragment",
|
|
10916
|
+
typeCondition: {
|
|
10917
|
+
kind: "NamedType",
|
|
10918
|
+
name: {
|
|
10919
|
+
kind: "Name",
|
|
10920
|
+
value: "Document"
|
|
10921
|
+
}
|
|
10920
10922
|
},
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
+
directives: [],
|
|
10924
|
+
selectionSet: {
|
|
10925
|
+
kind: "SelectionSet",
|
|
10926
|
+
selections: [
|
|
10927
|
+
SysFieldDefinition,
|
|
10928
|
+
{
|
|
10929
|
+
kind: "Field",
|
|
10930
|
+
name: {
|
|
10931
|
+
kind: "Name",
|
|
10932
|
+
value: "id"
|
|
10933
|
+
},
|
|
10934
|
+
arguments: [],
|
|
10935
|
+
directives: []
|
|
10936
|
+
}
|
|
10937
|
+
]
|
|
10938
|
+
}
|
|
10923
10939
|
},
|
|
10924
10940
|
{
|
|
10925
10941
|
kind: "FragmentSpread",
|
|
@@ -10995,15 +11011,31 @@ var astBuilder = {
|
|
|
10995
11011
|
kind: "SelectionSet",
|
|
10996
11012
|
selections: [
|
|
10997
11013
|
{
|
|
10998
|
-
kind: "
|
|
10999
|
-
|
|
11000
|
-
kind: "
|
|
11001
|
-
|
|
11014
|
+
kind: "InlineFragment",
|
|
11015
|
+
typeCondition: {
|
|
11016
|
+
kind: "NamedType",
|
|
11017
|
+
name: {
|
|
11018
|
+
kind: "Name",
|
|
11019
|
+
value: "Document"
|
|
11020
|
+
}
|
|
11002
11021
|
},
|
|
11003
|
-
|
|
11004
|
-
|
|
11022
|
+
directives: [],
|
|
11023
|
+
selectionSet: {
|
|
11024
|
+
kind: "SelectionSet",
|
|
11025
|
+
selections: [
|
|
11026
|
+
SysFieldDefinition,
|
|
11027
|
+
{
|
|
11028
|
+
kind: "Field",
|
|
11029
|
+
name: {
|
|
11030
|
+
kind: "Name",
|
|
11031
|
+
value: "id"
|
|
11032
|
+
},
|
|
11033
|
+
arguments: [],
|
|
11034
|
+
directives: []
|
|
11035
|
+
}
|
|
11036
|
+
]
|
|
11037
|
+
}
|
|
11005
11038
|
},
|
|
11006
|
-
SysFieldDefinition,
|
|
11007
11039
|
{
|
|
11008
11040
|
kind: "FragmentSpread",
|
|
11009
11041
|
name: {
|
|
@@ -12490,7 +12522,8 @@ var scripts = {
|
|
|
12490
12522
|
build: 'echo "Run `yarn build` from the root of the repository instead"',
|
|
12491
12523
|
docs: "yarn typedoc",
|
|
12492
12524
|
serve: "yarn nodemon dist/server.js",
|
|
12493
|
-
test: "jest"
|
|
12525
|
+
test: "jest",
|
|
12526
|
+
"test-watch": "jest --watch"
|
|
12494
12527
|
};
|
|
12495
12528
|
var dependencies = {
|
|
12496
12529
|
"@graphql-tools/relay-operation-optimizer": "^6.4.1",
|
|
@@ -23210,6 +23243,7 @@ var parseFile = (content3, format, yupSchema) => {
|
|
|
23210
23243
|
throw new Error(`Must specify a valid format, got ${format}`);
|
|
23211
23244
|
}
|
|
23212
23245
|
};
|
|
23246
|
+
var normalizePath = (filepath) => filepath.replace(/\\/g, "/");
|
|
23213
23247
|
|
|
23214
23248
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/src/database/index.ts
|
|
23215
23249
|
var import_datalayer2 = __toModule(require("@tinacms/datalayer"));
|
|
@@ -23236,7 +23270,7 @@ var Database = class {
|
|
|
23236
23270
|
} else {
|
|
23237
23271
|
const tinaSchema = await this.getSchema();
|
|
23238
23272
|
const extension2 = import_path4.default.extname(filepath);
|
|
23239
|
-
const contentObject = await this.store.get(filepath);
|
|
23273
|
+
const contentObject = await this.store.get(normalizePath(filepath));
|
|
23240
23274
|
if (!contentObject) {
|
|
23241
23275
|
throw new import_graphql4.GraphQLError(`Unable to find record ${filepath}`);
|
|
23242
23276
|
}
|
|
@@ -23276,9 +23310,9 @@ var Database = class {
|
|
|
23276
23310
|
collectionIndexDefinitions = indexDefinitions == null ? void 0 : indexDefinitions[collection.name];
|
|
23277
23311
|
}
|
|
23278
23312
|
if (this.store.supportsSeeding()) {
|
|
23279
|
-
await this.bridge.put(filepath, stringifiedFile);
|
|
23313
|
+
await this.bridge.put(normalizePath(filepath), stringifiedFile);
|
|
23280
23314
|
}
|
|
23281
|
-
await this.store.put(filepath, payload, {
|
|
23315
|
+
await this.store.put(normalizePath(filepath), payload, {
|
|
23282
23316
|
keepTemplateKey,
|
|
23283
23317
|
collection: collection == null ? void 0 : collection.name,
|
|
23284
23318
|
indexDefinitions: collectionIndexDefinitions
|
|
@@ -23295,9 +23329,9 @@ var Database = class {
|
|
|
23295
23329
|
}
|
|
23296
23330
|
const { stringifiedFile, payload, keepTemplateKey } = await this.stringifyFile(filepath, data);
|
|
23297
23331
|
if (this.store.supportsSeeding()) {
|
|
23298
|
-
await this.bridge.put(filepath, stringifiedFile);
|
|
23332
|
+
await this.bridge.put(normalizePath(filepath), stringifiedFile);
|
|
23299
23333
|
}
|
|
23300
|
-
await this.store.put(filepath, payload, {
|
|
23334
|
+
await this.store.put(normalizePath(filepath), payload, {
|
|
23301
23335
|
keepTemplateKey,
|
|
23302
23336
|
collection,
|
|
23303
23337
|
indexDefinitions: collectionIndexDefinitions
|
|
@@ -23362,23 +23396,23 @@ var Database = class {
|
|
|
23362
23396
|
this.getLookup = async (returnType) => {
|
|
23363
23397
|
const lookupPath = import_path4.default.join(GENERATED_FOLDER, `_lookup.json`);
|
|
23364
23398
|
if (!this._lookup) {
|
|
23365
|
-
const _lookup = await this.store.get(lookupPath);
|
|
23399
|
+
const _lookup = await this.store.get(normalizePath(lookupPath));
|
|
23366
23400
|
this._lookup = _lookup;
|
|
23367
23401
|
}
|
|
23368
23402
|
return this._lookup[returnType];
|
|
23369
23403
|
};
|
|
23370
23404
|
this.getGraphQLSchema = async () => {
|
|
23371
23405
|
const graphqlPath = import_path4.default.join(GENERATED_FOLDER, `_graphql.json`);
|
|
23372
|
-
return this.store.get(graphqlPath);
|
|
23406
|
+
return this.store.get(normalizePath(graphqlPath));
|
|
23373
23407
|
};
|
|
23374
23408
|
this.getGraphQLSchemaFromBridge = async () => {
|
|
23375
23409
|
const graphqlPath = import_path4.default.join(GENERATED_FOLDER, `_graphql.json`);
|
|
23376
|
-
const _graphql = await this.bridge.get(graphqlPath);
|
|
23410
|
+
const _graphql = await this.bridge.get(normalizePath(graphqlPath));
|
|
23377
23411
|
return JSON.parse(_graphql);
|
|
23378
23412
|
};
|
|
23379
23413
|
this.getTinaSchema = async () => {
|
|
23380
23414
|
const schemaPath = import_path4.default.join(GENERATED_FOLDER, `_schema.json`);
|
|
23381
|
-
return this.store.get(schemaPath);
|
|
23415
|
+
return this.store.get(normalizePath(schemaPath));
|
|
23382
23416
|
};
|
|
23383
23417
|
this.getSchema = async () => {
|
|
23384
23418
|
if (this.tinaSchema) {
|
|
@@ -23498,8 +23532,8 @@ var Database = class {
|
|
|
23498
23532
|
tinaSchema
|
|
23499
23533
|
}) => {
|
|
23500
23534
|
if (this.bridge.supportsBuilding()) {
|
|
23501
|
-
await this.bridge.putConfig(import_path4.default.join(GENERATED_FOLDER, `_graphql.json`), JSON.stringify(graphQLSchema));
|
|
23502
|
-
await this.bridge.putConfig(import_path4.default.join(GENERATED_FOLDER, `_schema.json`), JSON.stringify(tinaSchema.schema));
|
|
23535
|
+
await this.bridge.putConfig(normalizePath(import_path4.default.join(GENERATED_FOLDER, `_graphql.json`)), JSON.stringify(graphQLSchema));
|
|
23536
|
+
await this.bridge.putConfig(normalizePath(import_path4.default.join(GENERATED_FOLDER, `_schema.json`)), JSON.stringify(tinaSchema.schema));
|
|
23503
23537
|
}
|
|
23504
23538
|
};
|
|
23505
23539
|
this.indexContent = async ({
|
|
@@ -23507,12 +23541,12 @@ var Database = class {
|
|
|
23507
23541
|
tinaSchema
|
|
23508
23542
|
}) => {
|
|
23509
23543
|
await this.indexStatusCallbackWrapper(async () => {
|
|
23510
|
-
const lookup = JSON.parse(await this.bridge.get(import_path4.default.join(GENERATED_FOLDER, "_lookup.json")));
|
|
23544
|
+
const lookup = JSON.parse(await this.bridge.get(normalizePath(import_path4.default.join(GENERATED_FOLDER, "_lookup.json"))));
|
|
23511
23545
|
if (this.store.supportsSeeding()) {
|
|
23512
23546
|
await this.store.clear();
|
|
23513
|
-
await this.store.seed(import_path4.default.join(GENERATED_FOLDER, "_graphql.json"), graphQLSchema);
|
|
23514
|
-
await this.store.seed(import_path4.default.join(GENERATED_FOLDER, "_schema.json"), tinaSchema.schema);
|
|
23515
|
-
await this.store.seed(import_path4.default.join(GENERATED_FOLDER, "_lookup.json"), lookup);
|
|
23547
|
+
await this.store.seed(normalizePath(import_path4.default.join(GENERATED_FOLDER, "_graphql.json")), graphQLSchema);
|
|
23548
|
+
await this.store.seed(normalizePath(import_path4.default.join(GENERATED_FOLDER, "_schema.json")), tinaSchema.schema);
|
|
23549
|
+
await this.store.seed(normalizePath(import_path4.default.join(GENERATED_FOLDER, "_lookup.json")), lookup);
|
|
23516
23550
|
await this._indexAllContent();
|
|
23517
23551
|
} else {
|
|
23518
23552
|
if (this.store.supportsIndexing()) {
|
|
@@ -23546,16 +23580,16 @@ var Database = class {
|
|
|
23546
23580
|
const indexDefinitions = await this.getIndexDefinitions();
|
|
23547
23581
|
collectionIndexDefinitions = indexDefinitions == null ? void 0 : indexDefinitions[collection.name];
|
|
23548
23582
|
}
|
|
23549
|
-
await this.store.delete(filepath, {
|
|
23583
|
+
await this.store.delete(normalizePath(filepath), {
|
|
23550
23584
|
collection: collection.name,
|
|
23551
23585
|
indexDefinitions: collectionIndexDefinitions
|
|
23552
23586
|
});
|
|
23553
|
-
await this.bridge.delete(filepath);
|
|
23587
|
+
await this.bridge.delete(normalizePath(filepath));
|
|
23554
23588
|
};
|
|
23555
23589
|
this._indexAllContent = async () => {
|
|
23556
23590
|
const tinaSchema = await this.getSchema();
|
|
23557
23591
|
await sequential(tinaSchema.getCollections(), async (collection) => {
|
|
23558
|
-
const documentPaths = await this.bridge.glob(collection.path);
|
|
23592
|
+
const documentPaths = await this.bridge.glob(normalizePath(collection.path));
|
|
23559
23593
|
await _indexContent(this, documentPaths, collection);
|
|
23560
23594
|
});
|
|
23561
23595
|
};
|
|
@@ -23563,14 +23597,14 @@ var Database = class {
|
|
|
23563
23597
|
const lookupPath = import_path4.default.join(GENERATED_FOLDER, `_lookup.json`);
|
|
23564
23598
|
let lookupMap;
|
|
23565
23599
|
try {
|
|
23566
|
-
lookupMap = JSON.parse(await this.bridge.get(lookupPath));
|
|
23600
|
+
lookupMap = JSON.parse(await this.bridge.get(normalizePath(lookupPath)));
|
|
23567
23601
|
} catch (e) {
|
|
23568
23602
|
lookupMap = {};
|
|
23569
23603
|
}
|
|
23570
23604
|
const updatedLookup = __spreadProps(__spreadValues({}, lookupMap), {
|
|
23571
23605
|
[lookup.type]: lookup
|
|
23572
23606
|
});
|
|
23573
|
-
await this.bridge.putConfig(lookupPath, JSON.stringify(updatedLookup));
|
|
23607
|
+
await this.bridge.putConfig(normalizePath(lookupPath), JSON.stringify(updatedLookup));
|
|
23574
23608
|
};
|
|
23575
23609
|
this.bridge = config.bridge;
|
|
23576
23610
|
this.store = config.store;
|
|
@@ -23626,10 +23660,10 @@ var _indexContent = async (database, documentPaths, collection) => {
|
|
|
23626
23660
|
};
|
|
23627
23661
|
}
|
|
23628
23662
|
await sequential(documentPaths, async (filepath) => {
|
|
23629
|
-
const dataString = await database.bridge.get(filepath);
|
|
23663
|
+
const dataString = await database.bridge.get(normalizePath(filepath));
|
|
23630
23664
|
const data = parseFile(dataString, import_path4.default.extname(filepath), (yup3) => yup3.object({}));
|
|
23631
23665
|
if (database.store.supportsSeeding()) {
|
|
23632
|
-
await database.store.seed(filepath, data, seedOptions);
|
|
23666
|
+
await database.store.seed(normalizePath(filepath), data, seedOptions);
|
|
23633
23667
|
}
|
|
23634
23668
|
});
|
|
23635
23669
|
};
|
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-20224201864",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"build": "echo \"Run `yarn build` from the root of the repository instead\"",
|
|
43
43
|
"docs": "yarn typedoc",
|
|
44
44
|
"serve": "yarn nodemon dist/server.js",
|
|
45
|
-
"test": "jest"
|
|
45
|
+
"test": "jest",
|
|
46
|
+
"test-watch": "jest --watch"
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
49
|
"@graphql-tools/relay-operation-optimizer": "^6.4.1",
|