@tinacms/graphql 1.4.9 → 1.4.11
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/build.d.ts +7 -5
- package/dist/builder/index.d.ts +4 -6
- package/dist/database/bridge/filesystem.d.ts +0 -2
- package/dist/database/bridge/index.d.ts +0 -6
- package/dist/database/bridge/isomorphic.d.ts +0 -2
- package/dist/database/index.d.ts +0 -5
- package/dist/index.d.ts +6 -4
- package/dist/index.es.js +42 -106
- package/dist/index.js +43 -106
- package/dist/level/tinaLevel.d.ts +0 -21
- package/package.json +1 -1
package/dist/build.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
|
|
3
3
|
*/
|
|
4
|
-
import { DocumentNode } from 'graphql';
|
|
5
4
|
import { TinaSchema, Config } from '@tinacms/schema-tools';
|
|
6
|
-
import {
|
|
7
|
-
export declare const buildDotTinaFiles: ({
|
|
8
|
-
database: Database;
|
|
5
|
+
import { LookupMapType } from './database';
|
|
6
|
+
export declare const buildDotTinaFiles: ({ config, flags, buildSDK, }: {
|
|
9
7
|
config: Config;
|
|
10
8
|
flags?: string[];
|
|
11
9
|
buildSDK?: boolean;
|
|
12
10
|
}) => Promise<{
|
|
13
|
-
graphQLSchema:
|
|
11
|
+
graphQLSchema: {
|
|
12
|
+
kind: "Document";
|
|
13
|
+
definitions: import("graphql").TypeDefinitionNode[];
|
|
14
|
+
};
|
|
14
15
|
tinaSchema: TinaSchema;
|
|
16
|
+
lookup: Record<string, LookupMapType>;
|
|
15
17
|
fragDoc: string;
|
|
16
18
|
queryDoc: string;
|
|
17
19
|
}>;
|
package/dist/builder/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { LookupMapType } from '../database';
|
|
5
5
|
import type { ObjectTypeDefinitionNode, InlineFragmentNode, FieldDefinitionNode } from 'graphql';
|
|
6
6
|
import type { Collection, Template } from '@tinacms/schema-tools';
|
|
7
7
|
import { TinaSchema } from '@tinacms/schema-tools';
|
|
8
|
-
export declare const createBuilder: ({
|
|
9
|
-
database: Database;
|
|
8
|
+
export declare const createBuilder: ({ tinaSchema, }: {
|
|
10
9
|
tinaSchema: TinaSchema;
|
|
11
10
|
}) => Promise<Builder>;
|
|
12
11
|
/**
|
|
@@ -16,16 +15,15 @@ export declare const createBuilder: ({ database, tinaSchema, }: {
|
|
|
16
15
|
*/
|
|
17
16
|
export declare class Builder {
|
|
18
17
|
config: {
|
|
19
|
-
database: Database;
|
|
20
18
|
tinaSchema: TinaSchema;
|
|
21
19
|
};
|
|
22
20
|
private maxDepth;
|
|
23
21
|
tinaSchema: TinaSchema;
|
|
24
|
-
|
|
22
|
+
lookupMap: Record<string, LookupMapType>;
|
|
25
23
|
constructor(config: {
|
|
26
|
-
database: Database;
|
|
27
24
|
tinaSchema: TinaSchema;
|
|
28
25
|
});
|
|
26
|
+
private addToLookupMap;
|
|
29
27
|
/**
|
|
30
28
|
* ```graphql
|
|
31
29
|
* # ex.
|
|
@@ -9,10 +9,8 @@ export declare class FilesystemBridge implements Bridge {
|
|
|
9
9
|
outputPath?: string;
|
|
10
10
|
constructor(rootPath: string, outputPath?: string);
|
|
11
11
|
glob(pattern: string, extension: string): Promise<string[]>;
|
|
12
|
-
supportsBuilding(): boolean;
|
|
13
12
|
delete(filepath: string): Promise<void>;
|
|
14
13
|
get(filepath: string): Promise<string>;
|
|
15
|
-
putConfig(filepath: string, data: string): Promise<void>;
|
|
16
14
|
put(filepath: string, data: string, basePathOverride?: string): Promise<void>;
|
|
17
15
|
}
|
|
18
16
|
/**
|
|
@@ -4,15 +4,9 @@ export interface Bridge {
|
|
|
4
4
|
delete(filepath: string): Promise<void>;
|
|
5
5
|
get(filepath: string): Promise<string>;
|
|
6
6
|
put(filepath: string, data: string): Promise<void>;
|
|
7
|
-
/**
|
|
8
|
-
* Whether this bridge supports the ability to build the schema.
|
|
9
|
-
*/
|
|
10
|
-
supportsBuilding(): boolean;
|
|
11
|
-
putConfig(filepath: string, data: string): Promise<void>;
|
|
12
7
|
/**
|
|
13
8
|
* Optionally, the bridge can perform
|
|
14
9
|
* operations in a separate path.
|
|
15
10
|
*/
|
|
16
11
|
outputPath?: string;
|
|
17
|
-
addOutputPath?(outputPath: string): void;
|
|
18
12
|
}
|
|
@@ -86,11 +86,9 @@ export declare class IsomorphicBridge implements Bridge {
|
|
|
86
86
|
private commitTree;
|
|
87
87
|
private getRef;
|
|
88
88
|
glob(pattern: string, extension: string): Promise<string[]>;
|
|
89
|
-
supportsBuilding(): boolean;
|
|
90
89
|
delete(filepath: string): Promise<void>;
|
|
91
90
|
private qualifyPath;
|
|
92
91
|
private unqualifyPath;
|
|
93
92
|
get(filepath: string): Promise<string>;
|
|
94
|
-
putConfig(filepath: string, data: string): Promise<void>;
|
|
95
93
|
put(filepath: string, data: string): Promise<void>;
|
|
96
94
|
}
|
package/dist/database/index.d.ts
CHANGED
|
@@ -109,10 +109,6 @@ export declare class Database {
|
|
|
109
109
|
endCursor: string;
|
|
110
110
|
};
|
|
111
111
|
}>;
|
|
112
|
-
putConfigFiles: ({ graphQLSchema, tinaSchema, }: {
|
|
113
|
-
graphQLSchema: DocumentNode;
|
|
114
|
-
tinaSchema: TinaSchema;
|
|
115
|
-
}) => Promise<void>;
|
|
116
112
|
private indexStatusCallbackWrapper;
|
|
117
113
|
indexContent: ({ graphQLSchema, tinaSchema, lookup: lookupFromLockFile, }: {
|
|
118
114
|
graphQLSchema: DocumentNode;
|
|
@@ -127,7 +123,6 @@ export declare class Database {
|
|
|
127
123
|
_indexAllContent: (level: Level, schema?: Schema) => Promise<{
|
|
128
124
|
warnings: string[];
|
|
129
125
|
}>;
|
|
130
|
-
addToLookupMap: (lookup: LookupMapType) => Promise<void>;
|
|
131
126
|
}
|
|
132
127
|
export declare type LookupMapType = GlobalDocumentLookup | CollectionDocumentLookup | CollectionFolderLookup | MultiCollectionDocumentLookup | MultiCollectionDocumentListLookup | CollectionDocumentListLookup | UnionDataLookup | NodeDocument;
|
|
133
128
|
declare type NodeDocument = {
|
package/dist/index.d.ts
CHANGED
|
@@ -5,20 +5,22 @@ export * from './resolver/error';
|
|
|
5
5
|
export { createDatabase } from './database';
|
|
6
6
|
export { TinaLevelClient } from './level/tinaLevel';
|
|
7
7
|
export type { QueryOptions, Database, OnDeleteCallback, OnPutCallback, CreateDatabase, } from './database';
|
|
8
|
-
import type { Database } from './database';
|
|
9
8
|
import type { Config } from '@tinacms/schema-tools';
|
|
10
9
|
export { sequential, assertShape } from './util';
|
|
11
10
|
export { stringifyFile, parseFile } from './database/util';
|
|
12
11
|
export { createSchema } from './schema/createSchema';
|
|
13
12
|
export { buildDotTinaFiles };
|
|
14
13
|
export declare type DummyType = unknown;
|
|
15
|
-
export declare const buildSchema: (
|
|
16
|
-
graphQLSchema:
|
|
14
|
+
export declare const buildSchema: (config: Config, flags?: string[]) => Promise<{
|
|
15
|
+
graphQLSchema: {
|
|
16
|
+
kind: "Document";
|
|
17
|
+
definitions: import("graphql").TypeDefinitionNode[];
|
|
18
|
+
};
|
|
17
19
|
tinaSchema: import("@tinacms/schema-tools").TinaSchema;
|
|
20
|
+
lookup: Record<string, import("./database").LookupMapType>;
|
|
18
21
|
fragDoc: string;
|
|
19
22
|
queryDoc: string;
|
|
20
23
|
}>;
|
|
21
|
-
export declare const getASTSchema: (database: Database) => Promise<import("graphql").GraphQLSchema>;
|
|
22
24
|
export declare type TinaSchema = Schema;
|
|
23
25
|
export type { TinaTemplate, Schema, Collection };
|
|
24
26
|
export { FilesystemBridge, AuditFileSystemBridge, } from './database/bridge/filesystem';
|
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
|
-
import { buildASTSchema as buildASTSchema2 } from "graphql";
|
|
3
|
-
|
|
4
1
|
// src/build.ts
|
|
5
2
|
import _3 from "lodash";
|
|
6
3
|
import { print } from "graphql";
|
|
@@ -1273,14 +1270,16 @@ var staticDefinitions = [...scalarDefinitions, interfaceDefinitions];
|
|
|
1273
1270
|
|
|
1274
1271
|
// src/builder/index.ts
|
|
1275
1272
|
var createBuilder = async ({
|
|
1276
|
-
database,
|
|
1277
1273
|
tinaSchema
|
|
1278
1274
|
}) => {
|
|
1279
|
-
return new Builder({
|
|
1275
|
+
return new Builder({ tinaSchema });
|
|
1280
1276
|
};
|
|
1281
1277
|
var Builder = class {
|
|
1282
1278
|
constructor(config) {
|
|
1283
1279
|
this.config = config;
|
|
1280
|
+
this.addToLookupMap = (lookup) => {
|
|
1281
|
+
this.lookupMap[lookup.type] = lookup;
|
|
1282
|
+
};
|
|
1284
1283
|
this.buildCollectionDefinition = async (collections) => {
|
|
1285
1284
|
const name = "collection";
|
|
1286
1285
|
const typeName = "Collection";
|
|
@@ -1369,7 +1368,7 @@ var Builder = class {
|
|
|
1369
1368
|
type: astBuilder.TYPES.String
|
|
1370
1369
|
})
|
|
1371
1370
|
];
|
|
1372
|
-
await this.
|
|
1371
|
+
await this.addToLookupMap({
|
|
1373
1372
|
type: astBuilder.TYPES.Node,
|
|
1374
1373
|
resolveType: "nodeDocument"
|
|
1375
1374
|
});
|
|
@@ -1512,7 +1511,7 @@ var Builder = class {
|
|
|
1512
1511
|
type: astBuilder.TYPES.String
|
|
1513
1512
|
})
|
|
1514
1513
|
];
|
|
1515
|
-
await this.
|
|
1514
|
+
await this.addToLookupMap({
|
|
1516
1515
|
type: type.name.value,
|
|
1517
1516
|
resolveType: "collectionDocument",
|
|
1518
1517
|
collection: collection.name,
|
|
@@ -1691,7 +1690,7 @@ var Builder = class {
|
|
|
1691
1690
|
};
|
|
1692
1691
|
this.collectionDocumentList = async (collection) => {
|
|
1693
1692
|
const connectionName = NAMER.referenceConnectionType(collection.namespace);
|
|
1694
|
-
|
|
1693
|
+
this.addToLookupMap({
|
|
1695
1694
|
type: connectionName,
|
|
1696
1695
|
resolveType: "collectionDocumentList",
|
|
1697
1696
|
collection: collection.name
|
|
@@ -1848,7 +1847,7 @@ var Builder = class {
|
|
|
1848
1847
|
name: fieldName,
|
|
1849
1848
|
types
|
|
1850
1849
|
});
|
|
1851
|
-
|
|
1850
|
+
this.addToLookupMap({
|
|
1852
1851
|
type: type.name.value,
|
|
1853
1852
|
resolveType: "multiCollectionDocument",
|
|
1854
1853
|
createDocument: "create",
|
|
@@ -1865,7 +1864,7 @@ var Builder = class {
|
|
|
1865
1864
|
includeFolderFilter
|
|
1866
1865
|
}) => {
|
|
1867
1866
|
const connectionName = NAMER.referenceConnectionType(namespace);
|
|
1868
|
-
|
|
1867
|
+
this.addToLookupMap({
|
|
1869
1868
|
type: connectionName,
|
|
1870
1869
|
resolveType: "multiCollectionDocumentList",
|
|
1871
1870
|
collections: collections.map((collection) => collection.name)
|
|
@@ -2135,7 +2134,7 @@ var Builder = class {
|
|
|
2135
2134
|
return type;
|
|
2136
2135
|
}
|
|
2137
2136
|
);
|
|
2138
|
-
|
|
2137
|
+
this.addToLookupMap({
|
|
2139
2138
|
type: name,
|
|
2140
2139
|
resolveType: "unionData",
|
|
2141
2140
|
collection: collection?.name,
|
|
@@ -2326,7 +2325,7 @@ Visit https://tina.io/docs/errors/ui-not-supported/ for more information
|
|
|
2326
2325
|
};
|
|
2327
2326
|
this.maxDepth = config?.tinaSchema.schema?.config?.client?.referenceDepth ?? 2;
|
|
2328
2327
|
this.tinaSchema = config.tinaSchema;
|
|
2329
|
-
this.
|
|
2328
|
+
this.lookupMap = {};
|
|
2330
2329
|
}
|
|
2331
2330
|
async buildTemplateFragments(template, depth) {
|
|
2332
2331
|
const selections = [];
|
|
@@ -2526,7 +2525,7 @@ var validateField = async (field) => {
|
|
|
2526
2525
|
// package.json
|
|
2527
2526
|
var package_default = {
|
|
2528
2527
|
name: "@tinacms/graphql",
|
|
2529
|
-
version: "1.4.
|
|
2528
|
+
version: "1.4.11",
|
|
2530
2529
|
main: "dist/index.js",
|
|
2531
2530
|
module: "dist/index.es.js",
|
|
2532
2531
|
typings: "dist/index.d.ts",
|
|
@@ -2671,7 +2670,6 @@ var createSchema = async ({
|
|
|
2671
2670
|
|
|
2672
2671
|
// src/build.ts
|
|
2673
2672
|
var buildDotTinaFiles = async ({
|
|
2674
|
-
database,
|
|
2675
2673
|
config,
|
|
2676
2674
|
flags = [],
|
|
2677
2675
|
buildSDK = true
|
|
@@ -2685,35 +2683,24 @@ var buildDotTinaFiles = async ({
|
|
|
2685
2683
|
flags
|
|
2686
2684
|
});
|
|
2687
2685
|
const builder = await createBuilder({
|
|
2688
|
-
database,
|
|
2689
2686
|
tinaSchema
|
|
2690
2687
|
});
|
|
2691
|
-
|
|
2692
|
-
if (database.bridge.supportsBuilding()) {
|
|
2693
|
-
graphQLSchema = await _buildSchema(builder, tinaSchema);
|
|
2694
|
-
await database.putConfigFiles({ graphQLSchema, tinaSchema });
|
|
2695
|
-
} else {
|
|
2696
|
-
graphQLSchema = JSON.parse(
|
|
2697
|
-
await database.bridge.get(".tina/__generated__/_graphql.json")
|
|
2698
|
-
);
|
|
2699
|
-
}
|
|
2688
|
+
const graphQLSchema = await _buildSchema(builder, tinaSchema);
|
|
2700
2689
|
let fragDoc = "";
|
|
2701
2690
|
let queryDoc = "";
|
|
2702
2691
|
if (buildSDK) {
|
|
2703
|
-
fragDoc = await _buildFragments(
|
|
2704
|
-
|
|
2705
|
-
tinaSchema,
|
|
2706
|
-
database.bridge.rootPath
|
|
2707
|
-
);
|
|
2708
|
-
queryDoc = await _buildQueries(
|
|
2709
|
-
builder,
|
|
2710
|
-
tinaSchema,
|
|
2711
|
-
database.bridge.rootPath
|
|
2712
|
-
);
|
|
2692
|
+
fragDoc = await _buildFragments(builder, tinaSchema);
|
|
2693
|
+
queryDoc = await _buildQueries(builder, tinaSchema);
|
|
2713
2694
|
}
|
|
2714
|
-
return {
|
|
2695
|
+
return {
|
|
2696
|
+
graphQLSchema,
|
|
2697
|
+
tinaSchema,
|
|
2698
|
+
lookup: builder.lookupMap,
|
|
2699
|
+
fragDoc,
|
|
2700
|
+
queryDoc
|
|
2701
|
+
};
|
|
2715
2702
|
};
|
|
2716
|
-
var _buildFragments = async (builder, tinaSchema
|
|
2703
|
+
var _buildFragments = async (builder, tinaSchema) => {
|
|
2717
2704
|
const fragmentDefinitionsFields = [];
|
|
2718
2705
|
const collections = tinaSchema.getCollections();
|
|
2719
2706
|
await sequential(collections, async (collection) => {
|
|
@@ -2731,7 +2718,7 @@ var _buildFragments = async (builder, tinaSchema, rootPath) => {
|
|
|
2731
2718
|
};
|
|
2732
2719
|
return print(fragDoc);
|
|
2733
2720
|
};
|
|
2734
|
-
var _buildQueries = async (builder, tinaSchema
|
|
2721
|
+
var _buildQueries = async (builder, tinaSchema) => {
|
|
2735
2722
|
const operationsDefinitions = [];
|
|
2736
2723
|
const collections = tinaSchema.getCollections();
|
|
2737
2724
|
await sequential(collections, async (collection) => {
|
|
@@ -2764,7 +2751,7 @@ var _buildQueries = async (builder, tinaSchema, rootPath) => {
|
|
|
2764
2751
|
};
|
|
2765
2752
|
var _buildSchema = async (builder, tinaSchema) => {
|
|
2766
2753
|
const definitions = [];
|
|
2767
|
-
definitions.push(
|
|
2754
|
+
definitions.push(builder.buildStaticDefinitions());
|
|
2768
2755
|
const queryTypeDefinitionFields = [];
|
|
2769
2756
|
const mutationTypeDefinitionFields = [];
|
|
2770
2757
|
const collections = tinaSchema.getCollections();
|
|
@@ -2827,14 +2814,13 @@ var _buildSchema = async (builder, tinaSchema) => {
|
|
|
2827
2814
|
fields: mutationTypeDefinitionFields
|
|
2828
2815
|
})
|
|
2829
2816
|
);
|
|
2830
|
-
|
|
2817
|
+
return {
|
|
2831
2818
|
kind: "Document",
|
|
2832
2819
|
definitions: _3.uniqBy(
|
|
2833
2820
|
extractInlineTypes(definitions),
|
|
2834
2821
|
(node) => node.name.value
|
|
2835
2822
|
)
|
|
2836
2823
|
};
|
|
2837
|
-
return doc;
|
|
2838
2824
|
};
|
|
2839
2825
|
|
|
2840
2826
|
// src/resolve.ts
|
|
@@ -3086,10 +3072,11 @@ var cleanUpSlashes = (path5) => {
|
|
|
3086
3072
|
return "";
|
|
3087
3073
|
};
|
|
3088
3074
|
var hasTinaMediaConfig = (schema) => {
|
|
3089
|
-
if (schema.config?.media?.tina
|
|
3090
|
-
return
|
|
3091
|
-
|
|
3092
|
-
|
|
3075
|
+
if (!schema.config?.media?.tina)
|
|
3076
|
+
return false;
|
|
3077
|
+
if (typeof schema.config?.media?.tina?.publicFolder !== "string" && typeof schema.config?.media?.tina?.mediaRoot !== "string")
|
|
3078
|
+
return false;
|
|
3079
|
+
return true;
|
|
3093
3080
|
};
|
|
3094
3081
|
|
|
3095
3082
|
// src/resolver/index.ts
|
|
@@ -3530,6 +3517,9 @@ var FolderTreeBuilder = class {
|
|
|
3530
3517
|
}
|
|
3531
3518
|
update(documentPath, collectionPath) {
|
|
3532
3519
|
let folderPath = path.dirname(documentPath);
|
|
3520
|
+
if (folderPath === ".") {
|
|
3521
|
+
folderPath = "";
|
|
3522
|
+
}
|
|
3533
3523
|
if (collectionPath) {
|
|
3534
3524
|
folderPath = stripCollectionFromPath(collectionPath, folderPath);
|
|
3535
3525
|
}
|
|
@@ -5326,21 +5316,6 @@ var Database = class {
|
|
|
5326
5316
|
}
|
|
5327
5317
|
};
|
|
5328
5318
|
};
|
|
5329
|
-
this.putConfigFiles = async ({
|
|
5330
|
-
graphQLSchema,
|
|
5331
|
-
tinaSchema
|
|
5332
|
-
}) => {
|
|
5333
|
-
if (this.bridge && this.bridge.supportsBuilding()) {
|
|
5334
|
-
await this.bridge.putConfig(
|
|
5335
|
-
normalizePath(path3.join(this.getGeneratedFolder(), `_graphql.json`)),
|
|
5336
|
-
JSON.stringify(graphQLSchema)
|
|
5337
|
-
);
|
|
5338
|
-
await this.bridge.putConfig(
|
|
5339
|
-
normalizePath(path3.join(this.getGeneratedFolder(), `_schema.json`)),
|
|
5340
|
-
JSON.stringify(tinaSchema.schema)
|
|
5341
|
-
);
|
|
5342
|
-
}
|
|
5343
|
-
};
|
|
5344
5319
|
this.indexContent = async ({
|
|
5345
5320
|
graphQLSchema,
|
|
5346
5321
|
tinaSchema,
|
|
@@ -5550,26 +5525,6 @@ This will be an error in the future. See https://tina.io/docs/errors/file-in-mut
|
|
|
5550
5525
|
}
|
|
5551
5526
|
return { warnings };
|
|
5552
5527
|
};
|
|
5553
|
-
this.addToLookupMap = async (lookup) => {
|
|
5554
|
-
if (!this.bridge) {
|
|
5555
|
-
throw new Error("No bridge configured");
|
|
5556
|
-
}
|
|
5557
|
-
const lookupPath = path3.join(this.getGeneratedFolder(), `_lookup.json`);
|
|
5558
|
-
let lookupMap;
|
|
5559
|
-
try {
|
|
5560
|
-
lookupMap = JSON.parse(await this.bridge.get(normalizePath(lookupPath)));
|
|
5561
|
-
} catch (e) {
|
|
5562
|
-
lookupMap = {};
|
|
5563
|
-
}
|
|
5564
|
-
const updatedLookup = {
|
|
5565
|
-
...lookupMap,
|
|
5566
|
-
[lookup.type]: lookup
|
|
5567
|
-
};
|
|
5568
|
-
await this.bridge.putConfig(
|
|
5569
|
-
normalizePath(lookupPath),
|
|
5570
|
-
JSON.stringify(updatedLookup)
|
|
5571
|
-
);
|
|
5572
|
-
};
|
|
5573
5528
|
this.tinaDirectory = config.tinaDirectory || ".tina";
|
|
5574
5529
|
this.bridge = config.bridge;
|
|
5575
5530
|
this.rootLevel = config.level && new LevelProxy(config.level);
|
|
@@ -5883,9 +5838,10 @@ var FilesystemBridge = class {
|
|
|
5883
5838
|
async glob(pattern, extension) {
|
|
5884
5839
|
const basePath = path4.join(this.outputPath, ...pattern.split("/"));
|
|
5885
5840
|
const items = await fg(
|
|
5886
|
-
path4.join(basePath, "**",
|
|
5841
|
+
path4.join(basePath, "**", `/*.${extension}`).replace(/\\/g, "/"),
|
|
5887
5842
|
{
|
|
5888
|
-
dot: true
|
|
5843
|
+
dot: true,
|
|
5844
|
+
ignore: ["**/node_modules/**"]
|
|
5889
5845
|
}
|
|
5890
5846
|
);
|
|
5891
5847
|
const posixRootPath = normalize(this.outputPath);
|
|
@@ -5893,23 +5849,12 @@ var FilesystemBridge = class {
|
|
|
5893
5849
|
return item.replace(posixRootPath, "").replace(/^\/|\/$/g, "");
|
|
5894
5850
|
});
|
|
5895
5851
|
}
|
|
5896
|
-
supportsBuilding() {
|
|
5897
|
-
return true;
|
|
5898
|
-
}
|
|
5899
5852
|
async delete(filepath) {
|
|
5900
5853
|
await fs.remove(path4.join(this.outputPath, filepath));
|
|
5901
5854
|
}
|
|
5902
5855
|
async get(filepath) {
|
|
5903
5856
|
return fs.readFileSync(path4.join(this.outputPath, filepath)).toString();
|
|
5904
5857
|
}
|
|
5905
|
-
async putConfig(filepath, data) {
|
|
5906
|
-
if (this.rootPath !== this.outputPath) {
|
|
5907
|
-
await this.put(filepath, data);
|
|
5908
|
-
await this.put(filepath, data, this.rootPath);
|
|
5909
|
-
} else {
|
|
5910
|
-
await this.put(filepath, data);
|
|
5911
|
-
}
|
|
5912
|
-
}
|
|
5913
5858
|
async put(filepath, data, basePathOverride) {
|
|
5914
5859
|
const basePath = basePathOverride || this.outputPath;
|
|
5915
5860
|
await fs.outputFileSync(path4.join(basePath, filepath), data);
|
|
@@ -5920,7 +5865,10 @@ var AuditFileSystemBridge = class extends FilesystemBridge {
|
|
|
5920
5865
|
if ([
|
|
5921
5866
|
".tina/__generated__/_lookup.json",
|
|
5922
5867
|
".tina/__generated__/_schema.json",
|
|
5923
|
-
".tina/__generated__/_graphql.json"
|
|
5868
|
+
".tina/__generated__/_graphql.json",
|
|
5869
|
+
"tina/__generated__/_lookup.json",
|
|
5870
|
+
"tina/__generated__/_schema.json",
|
|
5871
|
+
"tina/__generated__/_graphql.json"
|
|
5924
5872
|
].includes(filepath)) {
|
|
5925
5873
|
return super.put(filepath, data);
|
|
5926
5874
|
}
|
|
@@ -6188,9 +6136,6 @@ var IsomorphicBridge = class {
|
|
|
6188
6136
|
});
|
|
6189
6137
|
return results.map((path5) => this.unqualifyPath(path5)).filter((path5) => path5.endsWith(extension));
|
|
6190
6138
|
}
|
|
6191
|
-
supportsBuilding() {
|
|
6192
|
-
return true;
|
|
6193
|
-
}
|
|
6194
6139
|
async delete(filepath) {
|
|
6195
6140
|
const ref = await this.getRef();
|
|
6196
6141
|
const { pathParts, pathEntries } = await this.resolvePathEntries(
|
|
@@ -6276,9 +6221,6 @@ var IsomorphicBridge = class {
|
|
|
6276
6221
|
});
|
|
6277
6222
|
return Buffer.from(blob).toString("utf8");
|
|
6278
6223
|
}
|
|
6279
|
-
async putConfig(filepath, data) {
|
|
6280
|
-
await this.put(filepath, data);
|
|
6281
|
-
}
|
|
6282
6224
|
async put(filepath, data) {
|
|
6283
6225
|
const ref = await this.getRef();
|
|
6284
6226
|
const { pathParts, pathEntries } = await this.resolvePathEntries(
|
|
@@ -6322,17 +6264,12 @@ var IsomorphicBridge = class {
|
|
|
6322
6264
|
};
|
|
6323
6265
|
|
|
6324
6266
|
// src/index.ts
|
|
6325
|
-
var buildSchema = async (
|
|
6267
|
+
var buildSchema = async (config, flags) => {
|
|
6326
6268
|
return buildDotTinaFiles({
|
|
6327
|
-
database,
|
|
6328
6269
|
config,
|
|
6329
6270
|
flags
|
|
6330
6271
|
});
|
|
6331
6272
|
};
|
|
6332
|
-
var getASTSchema = async (database) => {
|
|
6333
|
-
const gqlAst = await database.getGraphQLSchemaFromBridge();
|
|
6334
|
-
return buildASTSchema2(gqlAst);
|
|
6335
|
-
};
|
|
6336
6273
|
export {
|
|
6337
6274
|
AuditFileSystemBridge,
|
|
6338
6275
|
FilesystemBridge,
|
|
@@ -6347,7 +6284,6 @@ export {
|
|
|
6347
6284
|
buildSchema,
|
|
6348
6285
|
createDatabase,
|
|
6349
6286
|
createSchema,
|
|
6350
|
-
getASTSchema,
|
|
6351
6287
|
handleFetchErrorError,
|
|
6352
6288
|
parseFile,
|
|
6353
6289
|
resolve,
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,6 @@ __export(src_exports, {
|
|
|
38
38
|
buildSchema: () => buildSchema,
|
|
39
39
|
createDatabase: () => createDatabase,
|
|
40
40
|
createSchema: () => createSchema,
|
|
41
|
-
getASTSchema: () => getASTSchema,
|
|
42
41
|
handleFetchErrorError: () => handleFetchErrorError,
|
|
43
42
|
parseFile: () => parseFile,
|
|
44
43
|
resolve: () => resolve,
|
|
@@ -46,7 +45,6 @@ __export(src_exports, {
|
|
|
46
45
|
stringifyFile: () => stringifyFile
|
|
47
46
|
});
|
|
48
47
|
module.exports = __toCommonJS(src_exports);
|
|
49
|
-
var import_graphql7 = require("graphql");
|
|
50
48
|
|
|
51
49
|
// src/build.ts
|
|
52
50
|
var import_lodash3 = __toESM(require("lodash"));
|
|
@@ -1320,14 +1318,16 @@ var staticDefinitions = [...scalarDefinitions, interfaceDefinitions];
|
|
|
1320
1318
|
|
|
1321
1319
|
// src/builder/index.ts
|
|
1322
1320
|
var createBuilder = async ({
|
|
1323
|
-
database,
|
|
1324
1321
|
tinaSchema
|
|
1325
1322
|
}) => {
|
|
1326
|
-
return new Builder({
|
|
1323
|
+
return new Builder({ tinaSchema });
|
|
1327
1324
|
};
|
|
1328
1325
|
var Builder = class {
|
|
1329
1326
|
constructor(config) {
|
|
1330
1327
|
this.config = config;
|
|
1328
|
+
this.addToLookupMap = (lookup) => {
|
|
1329
|
+
this.lookupMap[lookup.type] = lookup;
|
|
1330
|
+
};
|
|
1331
1331
|
this.buildCollectionDefinition = async (collections) => {
|
|
1332
1332
|
const name = "collection";
|
|
1333
1333
|
const typeName = "Collection";
|
|
@@ -1416,7 +1416,7 @@ var Builder = class {
|
|
|
1416
1416
|
type: astBuilder.TYPES.String
|
|
1417
1417
|
})
|
|
1418
1418
|
];
|
|
1419
|
-
await this.
|
|
1419
|
+
await this.addToLookupMap({
|
|
1420
1420
|
type: astBuilder.TYPES.Node,
|
|
1421
1421
|
resolveType: "nodeDocument"
|
|
1422
1422
|
});
|
|
@@ -1559,7 +1559,7 @@ var Builder = class {
|
|
|
1559
1559
|
type: astBuilder.TYPES.String
|
|
1560
1560
|
})
|
|
1561
1561
|
];
|
|
1562
|
-
await this.
|
|
1562
|
+
await this.addToLookupMap({
|
|
1563
1563
|
type: type.name.value,
|
|
1564
1564
|
resolveType: "collectionDocument",
|
|
1565
1565
|
collection: collection.name,
|
|
@@ -1740,7 +1740,7 @@ var Builder = class {
|
|
|
1740
1740
|
};
|
|
1741
1741
|
this.collectionDocumentList = async (collection) => {
|
|
1742
1742
|
const connectionName = NAMER.referenceConnectionType(collection.namespace);
|
|
1743
|
-
|
|
1743
|
+
this.addToLookupMap({
|
|
1744
1744
|
type: connectionName,
|
|
1745
1745
|
resolveType: "collectionDocumentList",
|
|
1746
1746
|
collection: collection.name
|
|
@@ -1897,7 +1897,7 @@ var Builder = class {
|
|
|
1897
1897
|
name: fieldName,
|
|
1898
1898
|
types
|
|
1899
1899
|
});
|
|
1900
|
-
|
|
1900
|
+
this.addToLookupMap({
|
|
1901
1901
|
type: type.name.value,
|
|
1902
1902
|
resolveType: "multiCollectionDocument",
|
|
1903
1903
|
createDocument: "create",
|
|
@@ -1914,7 +1914,7 @@ var Builder = class {
|
|
|
1914
1914
|
includeFolderFilter
|
|
1915
1915
|
}) => {
|
|
1916
1916
|
const connectionName = NAMER.referenceConnectionType(namespace);
|
|
1917
|
-
|
|
1917
|
+
this.addToLookupMap({
|
|
1918
1918
|
type: connectionName,
|
|
1919
1919
|
resolveType: "multiCollectionDocumentList",
|
|
1920
1920
|
collections: collections.map((collection) => collection.name)
|
|
@@ -2184,7 +2184,7 @@ var Builder = class {
|
|
|
2184
2184
|
return type;
|
|
2185
2185
|
}
|
|
2186
2186
|
);
|
|
2187
|
-
|
|
2187
|
+
this.addToLookupMap({
|
|
2188
2188
|
type: name,
|
|
2189
2189
|
resolveType: "unionData",
|
|
2190
2190
|
collection: collection == null ? void 0 : collection.name,
|
|
@@ -2376,7 +2376,7 @@ Visit https://tina.io/docs/errors/ui-not-supported/ for more information
|
|
|
2376
2376
|
var _a, _b, _c, _d;
|
|
2377
2377
|
this.maxDepth = (_d = (_c = (_b = (_a = config == null ? void 0 : config.tinaSchema.schema) == null ? void 0 : _a.config) == null ? void 0 : _b.client) == null ? void 0 : _c.referenceDepth) != null ? _d : 2;
|
|
2378
2378
|
this.tinaSchema = config.tinaSchema;
|
|
2379
|
-
this.
|
|
2379
|
+
this.lookupMap = {};
|
|
2380
2380
|
}
|
|
2381
2381
|
async buildTemplateFragments(template, depth) {
|
|
2382
2382
|
const selections = [];
|
|
@@ -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.11",
|
|
2581
2581
|
main: "dist/index.js",
|
|
2582
2582
|
module: "dist/index.es.js",
|
|
2583
2583
|
typings: "dist/index.d.ts",
|
|
@@ -2722,7 +2722,6 @@ var createSchema = async ({
|
|
|
2722
2722
|
|
|
2723
2723
|
// src/build.ts
|
|
2724
2724
|
var buildDotTinaFiles = async ({
|
|
2725
|
-
database,
|
|
2726
2725
|
config,
|
|
2727
2726
|
flags = [],
|
|
2728
2727
|
buildSDK = true
|
|
@@ -2736,35 +2735,24 @@ var buildDotTinaFiles = async ({
|
|
|
2736
2735
|
flags
|
|
2737
2736
|
});
|
|
2738
2737
|
const builder = await createBuilder({
|
|
2739
|
-
database,
|
|
2740
2738
|
tinaSchema
|
|
2741
2739
|
});
|
|
2742
|
-
|
|
2743
|
-
if (database.bridge.supportsBuilding()) {
|
|
2744
|
-
graphQLSchema = await _buildSchema(builder, tinaSchema);
|
|
2745
|
-
await database.putConfigFiles({ graphQLSchema, tinaSchema });
|
|
2746
|
-
} else {
|
|
2747
|
-
graphQLSchema = JSON.parse(
|
|
2748
|
-
await database.bridge.get(".tina/__generated__/_graphql.json")
|
|
2749
|
-
);
|
|
2750
|
-
}
|
|
2740
|
+
const graphQLSchema = await _buildSchema(builder, tinaSchema);
|
|
2751
2741
|
let fragDoc = "";
|
|
2752
2742
|
let queryDoc = "";
|
|
2753
2743
|
if (buildSDK) {
|
|
2754
|
-
fragDoc = await _buildFragments(
|
|
2755
|
-
|
|
2756
|
-
tinaSchema,
|
|
2757
|
-
database.bridge.rootPath
|
|
2758
|
-
);
|
|
2759
|
-
queryDoc = await _buildQueries(
|
|
2760
|
-
builder,
|
|
2761
|
-
tinaSchema,
|
|
2762
|
-
database.bridge.rootPath
|
|
2763
|
-
);
|
|
2744
|
+
fragDoc = await _buildFragments(builder, tinaSchema);
|
|
2745
|
+
queryDoc = await _buildQueries(builder, tinaSchema);
|
|
2764
2746
|
}
|
|
2765
|
-
return {
|
|
2747
|
+
return {
|
|
2748
|
+
graphQLSchema,
|
|
2749
|
+
tinaSchema,
|
|
2750
|
+
lookup: builder.lookupMap,
|
|
2751
|
+
fragDoc,
|
|
2752
|
+
queryDoc
|
|
2753
|
+
};
|
|
2766
2754
|
};
|
|
2767
|
-
var _buildFragments = async (builder, tinaSchema
|
|
2755
|
+
var _buildFragments = async (builder, tinaSchema) => {
|
|
2768
2756
|
const fragmentDefinitionsFields = [];
|
|
2769
2757
|
const collections = tinaSchema.getCollections();
|
|
2770
2758
|
await sequential(collections, async (collection) => {
|
|
@@ -2782,7 +2770,7 @@ var _buildFragments = async (builder, tinaSchema, rootPath) => {
|
|
|
2782
2770
|
};
|
|
2783
2771
|
return (0, import_graphql2.print)(fragDoc);
|
|
2784
2772
|
};
|
|
2785
|
-
var _buildQueries = async (builder, tinaSchema
|
|
2773
|
+
var _buildQueries = async (builder, tinaSchema) => {
|
|
2786
2774
|
const operationsDefinitions = [];
|
|
2787
2775
|
const collections = tinaSchema.getCollections();
|
|
2788
2776
|
await sequential(collections, async (collection) => {
|
|
@@ -2816,7 +2804,7 @@ var _buildQueries = async (builder, tinaSchema, rootPath) => {
|
|
|
2816
2804
|
};
|
|
2817
2805
|
var _buildSchema = async (builder, tinaSchema) => {
|
|
2818
2806
|
const definitions = [];
|
|
2819
|
-
definitions.push(
|
|
2807
|
+
definitions.push(builder.buildStaticDefinitions());
|
|
2820
2808
|
const queryTypeDefinitionFields = [];
|
|
2821
2809
|
const mutationTypeDefinitionFields = [];
|
|
2822
2810
|
const collections = tinaSchema.getCollections();
|
|
@@ -2879,14 +2867,13 @@ var _buildSchema = async (builder, tinaSchema) => {
|
|
|
2879
2867
|
fields: mutationTypeDefinitionFields
|
|
2880
2868
|
})
|
|
2881
2869
|
);
|
|
2882
|
-
|
|
2870
|
+
return {
|
|
2883
2871
|
kind: "Document",
|
|
2884
2872
|
definitions: import_lodash3.default.uniqBy(
|
|
2885
2873
|
extractInlineTypes(definitions),
|
|
2886
2874
|
(node) => node.name.value
|
|
2887
2875
|
)
|
|
2888
2876
|
};
|
|
2889
|
-
return doc;
|
|
2890
2877
|
};
|
|
2891
2878
|
|
|
2892
2879
|
// src/resolve.ts
|
|
@@ -3131,11 +3118,12 @@ var cleanUpSlashes = (path5) => {
|
|
|
3131
3118
|
return "";
|
|
3132
3119
|
};
|
|
3133
3120
|
var hasTinaMediaConfig = (schema) => {
|
|
3134
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3135
|
-
if (((
|
|
3136
|
-
return
|
|
3137
|
-
|
|
3138
|
-
|
|
3121
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3122
|
+
if (!((_b = (_a = schema.config) == null ? void 0 : _a.media) == null ? void 0 : _b.tina))
|
|
3123
|
+
return false;
|
|
3124
|
+
if (typeof ((_e = (_d = (_c = schema.config) == null ? void 0 : _c.media) == null ? void 0 : _d.tina) == null ? void 0 : _e.publicFolder) !== "string" && typeof ((_h = (_g = (_f = schema.config) == null ? void 0 : _f.media) == null ? void 0 : _g.tina) == null ? void 0 : _h.mediaRoot) !== "string")
|
|
3125
|
+
return false;
|
|
3126
|
+
return true;
|
|
3139
3127
|
};
|
|
3140
3128
|
|
|
3141
3129
|
// src/resolver/index.ts
|
|
@@ -3576,6 +3564,9 @@ var FolderTreeBuilder = class {
|
|
|
3576
3564
|
}
|
|
3577
3565
|
update(documentPath, collectionPath) {
|
|
3578
3566
|
let folderPath = import_path.default.dirname(documentPath);
|
|
3567
|
+
if (folderPath === ".") {
|
|
3568
|
+
folderPath = "";
|
|
3569
|
+
}
|
|
3579
3570
|
if (collectionPath) {
|
|
3580
3571
|
folderPath = stripCollectionFromPath(collectionPath, folderPath);
|
|
3581
3572
|
}
|
|
@@ -5386,21 +5377,6 @@ var Database = class {
|
|
|
5386
5377
|
}
|
|
5387
5378
|
};
|
|
5388
5379
|
};
|
|
5389
|
-
this.putConfigFiles = async ({
|
|
5390
|
-
graphQLSchema,
|
|
5391
|
-
tinaSchema
|
|
5392
|
-
}) => {
|
|
5393
|
-
if (this.bridge && this.bridge.supportsBuilding()) {
|
|
5394
|
-
await this.bridge.putConfig(
|
|
5395
|
-
(0, import_schema_tools3.normalizePath)(import_path3.default.join(this.getGeneratedFolder(), `_graphql.json`)),
|
|
5396
|
-
JSON.stringify(graphQLSchema)
|
|
5397
|
-
);
|
|
5398
|
-
await this.bridge.putConfig(
|
|
5399
|
-
(0, import_schema_tools3.normalizePath)(import_path3.default.join(this.getGeneratedFolder(), `_schema.json`)),
|
|
5400
|
-
JSON.stringify(tinaSchema.schema)
|
|
5401
|
-
);
|
|
5402
|
-
}
|
|
5403
|
-
};
|
|
5404
5380
|
this.indexContent = async ({
|
|
5405
5381
|
graphQLSchema,
|
|
5406
5382
|
tinaSchema,
|
|
@@ -5610,26 +5586,6 @@ This will be an error in the future. See https://tina.io/docs/errors/file-in-mut
|
|
|
5610
5586
|
}
|
|
5611
5587
|
return { warnings };
|
|
5612
5588
|
};
|
|
5613
|
-
this.addToLookupMap = async (lookup) => {
|
|
5614
|
-
if (!this.bridge) {
|
|
5615
|
-
throw new Error("No bridge configured");
|
|
5616
|
-
}
|
|
5617
|
-
const lookupPath = import_path3.default.join(this.getGeneratedFolder(), `_lookup.json`);
|
|
5618
|
-
let lookupMap;
|
|
5619
|
-
try {
|
|
5620
|
-
lookupMap = JSON.parse(await this.bridge.get((0, import_schema_tools3.normalizePath)(lookupPath)));
|
|
5621
|
-
} catch (e) {
|
|
5622
|
-
lookupMap = {};
|
|
5623
|
-
}
|
|
5624
|
-
const updatedLookup = {
|
|
5625
|
-
...lookupMap,
|
|
5626
|
-
[lookup.type]: lookup
|
|
5627
|
-
};
|
|
5628
|
-
await this.bridge.putConfig(
|
|
5629
|
-
(0, import_schema_tools3.normalizePath)(lookupPath),
|
|
5630
|
-
JSON.stringify(updatedLookup)
|
|
5631
|
-
);
|
|
5632
|
-
};
|
|
5633
5589
|
this.tinaDirectory = config.tinaDirectory || ".tina";
|
|
5634
5590
|
this.bridge = config.bridge;
|
|
5635
5591
|
this.rootLevel = config.level && new LevelProxy(config.level);
|
|
@@ -5943,9 +5899,10 @@ var FilesystemBridge = class {
|
|
|
5943
5899
|
async glob(pattern, extension) {
|
|
5944
5900
|
const basePath = import_path4.default.join(this.outputPath, ...pattern.split("/"));
|
|
5945
5901
|
const items = await (0, import_fast_glob.default)(
|
|
5946
|
-
import_path4.default.join(basePath, "**",
|
|
5902
|
+
import_path4.default.join(basePath, "**", `/*.${extension}`).replace(/\\/g, "/"),
|
|
5947
5903
|
{
|
|
5948
|
-
dot: true
|
|
5904
|
+
dot: true,
|
|
5905
|
+
ignore: ["**/node_modules/**"]
|
|
5949
5906
|
}
|
|
5950
5907
|
);
|
|
5951
5908
|
const posixRootPath = (0, import_normalize_path.default)(this.outputPath);
|
|
@@ -5953,23 +5910,12 @@ var FilesystemBridge = class {
|
|
|
5953
5910
|
return item.replace(posixRootPath, "").replace(/^\/|\/$/g, "");
|
|
5954
5911
|
});
|
|
5955
5912
|
}
|
|
5956
|
-
supportsBuilding() {
|
|
5957
|
-
return true;
|
|
5958
|
-
}
|
|
5959
5913
|
async delete(filepath) {
|
|
5960
5914
|
await import_fs_extra.default.remove(import_path4.default.join(this.outputPath, filepath));
|
|
5961
5915
|
}
|
|
5962
5916
|
async get(filepath) {
|
|
5963
5917
|
return import_fs_extra.default.readFileSync(import_path4.default.join(this.outputPath, filepath)).toString();
|
|
5964
5918
|
}
|
|
5965
|
-
async putConfig(filepath, data) {
|
|
5966
|
-
if (this.rootPath !== this.outputPath) {
|
|
5967
|
-
await this.put(filepath, data);
|
|
5968
|
-
await this.put(filepath, data, this.rootPath);
|
|
5969
|
-
} else {
|
|
5970
|
-
await this.put(filepath, data);
|
|
5971
|
-
}
|
|
5972
|
-
}
|
|
5973
5919
|
async put(filepath, data, basePathOverride) {
|
|
5974
5920
|
const basePath = basePathOverride || this.outputPath;
|
|
5975
5921
|
await import_fs_extra.default.outputFileSync(import_path4.default.join(basePath, filepath), data);
|
|
@@ -5980,7 +5926,10 @@ var AuditFileSystemBridge = class extends FilesystemBridge {
|
|
|
5980
5926
|
if ([
|
|
5981
5927
|
".tina/__generated__/_lookup.json",
|
|
5982
5928
|
".tina/__generated__/_schema.json",
|
|
5983
|
-
".tina/__generated__/_graphql.json"
|
|
5929
|
+
".tina/__generated__/_graphql.json",
|
|
5930
|
+
"tina/__generated__/_lookup.json",
|
|
5931
|
+
"tina/__generated__/_schema.json",
|
|
5932
|
+
"tina/__generated__/_graphql.json"
|
|
5984
5933
|
].includes(filepath)) {
|
|
5985
5934
|
return super.put(filepath, data);
|
|
5986
5935
|
}
|
|
@@ -6248,9 +6197,6 @@ var IsomorphicBridge = class {
|
|
|
6248
6197
|
});
|
|
6249
6198
|
return results.map((path5) => this.unqualifyPath(path5)).filter((path5) => path5.endsWith(extension));
|
|
6250
6199
|
}
|
|
6251
|
-
supportsBuilding() {
|
|
6252
|
-
return true;
|
|
6253
|
-
}
|
|
6254
6200
|
async delete(filepath) {
|
|
6255
6201
|
const ref = await this.getRef();
|
|
6256
6202
|
const { pathParts, pathEntries } = await this.resolvePathEntries(
|
|
@@ -6336,9 +6282,6 @@ var IsomorphicBridge = class {
|
|
|
6336
6282
|
});
|
|
6337
6283
|
return Buffer.from(blob).toString("utf8");
|
|
6338
6284
|
}
|
|
6339
|
-
async putConfig(filepath, data) {
|
|
6340
|
-
await this.put(filepath, data);
|
|
6341
|
-
}
|
|
6342
6285
|
async put(filepath, data) {
|
|
6343
6286
|
const ref = await this.getRef();
|
|
6344
6287
|
const { pathParts, pathEntries } = await this.resolvePathEntries(
|
|
@@ -6382,17 +6325,12 @@ var IsomorphicBridge = class {
|
|
|
6382
6325
|
};
|
|
6383
6326
|
|
|
6384
6327
|
// src/index.ts
|
|
6385
|
-
var buildSchema = async (
|
|
6328
|
+
var buildSchema = async (config, flags) => {
|
|
6386
6329
|
return buildDotTinaFiles({
|
|
6387
|
-
database,
|
|
6388
6330
|
config,
|
|
6389
6331
|
flags
|
|
6390
6332
|
});
|
|
6391
6333
|
};
|
|
6392
|
-
var getASTSchema = async (database) => {
|
|
6393
|
-
const gqlAst = await database.getGraphQLSchemaFromBridge();
|
|
6394
|
-
return (0, import_graphql7.buildASTSchema)(gqlAst);
|
|
6395
|
-
};
|
|
6396
6334
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6397
6335
|
0 && (module.exports = {
|
|
6398
6336
|
AuditFileSystemBridge,
|
|
@@ -6408,7 +6346,6 @@ var getASTSchema = async (database) => {
|
|
|
6408
6346
|
buildSchema,
|
|
6409
6347
|
createDatabase,
|
|
6410
6348
|
createSchema,
|
|
6411
|
-
getASTSchema,
|
|
6412
6349
|
handleFetchErrorError,
|
|
6413
6350
|
parseFile,
|
|
6414
6351
|
resolve,
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
1
|
import { ManyLevelGuest } from 'many-level';
|
|
5
2
|
export declare class TinaLevelClient extends ManyLevelGuest<string, Record<string, any>> {
|
|
6
3
|
private port;
|
|
@@ -8,21 +5,3 @@ export declare class TinaLevelClient extends ManyLevelGuest<string, Record<strin
|
|
|
8
5
|
constructor(port?: number);
|
|
9
6
|
openConnection(): void;
|
|
10
7
|
}
|
|
11
|
-
export interface Bridge {
|
|
12
|
-
rootPath: string;
|
|
13
|
-
glob(pattern: string, extension: string): Promise<string[]>;
|
|
14
|
-
get(filepath: string): Promise<string>;
|
|
15
|
-
put(filepath: string, data: string): Promise<void>;
|
|
16
|
-
delete(filepath: string): Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Whether this bridge supports the ability to build the schema.
|
|
19
|
-
*/
|
|
20
|
-
supportsBuilding(): boolean;
|
|
21
|
-
putConfig(filepath: string, data: string): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Optionally, the bridge can perform
|
|
24
|
-
* operations in a separate path.
|
|
25
|
-
*/
|
|
26
|
-
outputPath?: string;
|
|
27
|
-
addOutputPath?(outputPath: string): void;
|
|
28
|
-
}
|