@tinacms/graphql 0.0.0-2022230155428 → 0.0.0-2022230211331

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 CHANGED
@@ -1,9 +1,10 @@
1
1
  # tina-graphql
2
2
 
3
- ## 0.0.0-2022230155428
3
+ ## 0.0.0-2022230211331
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - 82174ff50: Modify Database.indexContentByPaths to not require collection parameter
7
8
  - a87e1e6fa: Enable query filtering, pagination, sorting
8
9
  - abf25c673: The schema can now to used on the frontend (optional for now but will be the main path moving forward).
9
10
 
@@ -39,7 +40,7 @@
39
40
  - e8b0de1f7: Add `parentTypename` to fields to allow us to disambiguate between fields which have the same field names but different types. Example, an event from field name of `blocks.0.title` could belong to a `Cta` block or a `Hero` block, both of which have a `title` field.
40
41
  - Updated dependencies [a87e1e6fa]
41
42
  - Updated dependencies [b01f2e382]
42
- - @tinacms/datalayer@0.0.0-2022230155428
43
+ - @tinacms/datalayer@0.0.0-2022230211331
43
44
 
44
45
  ## 0.59.8
45
46
 
@@ -0,0 +1,159 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ import { FieldDefinitionNode, ScalarTypeDefinitionNode, InputValueDefinitionNode, ObjectTypeDefinitionNode, InterfaceTypeDefinitionNode, NamedTypeNode, UnionTypeDefinitionNode, TypeDefinitionNode, DirectiveNode, EnumTypeDefinitionNode, InputObjectTypeDefinitionNode, DocumentNode, FragmentDefinitionNode, SelectionNode, FieldNode, InlineFragmentNode, OperationDefinitionNode } from 'graphql';
14
+ /**
15
+ * the `gql` module provides functions and types which can be
16
+ * used to build up the GraphQL AST. The primary reason for us using
17
+ * this instead of the [builders provided by the graphql package](https://graphql.org/graphql-js/type/#examples)
18
+ * is due to the dynamic and asynchronous nature of our needs.
19
+ *
20
+ * The tradeoff is a low-level API that's often more verbose, and it's
21
+ * not a complete match of the GraphQL spec, so additional properties will likely
22
+ * be needed as our needs grow.
23
+ */
24
+ export declare const astBuilder: {
25
+ /**
26
+ * `FormFieldBuilder` acts as a shortcut to building an entire `ObjectTypeDefinition`, we use this
27
+ * because all Tina field objects share a common set of fields ('name', 'label', 'component')
28
+ */
29
+ FormFieldBuilder: ({ name, additionalFields, }: {
30
+ name: string;
31
+ additionalFields?: FieldDefinitionNode[];
32
+ }) => ObjectTypeDefinitionNode;
33
+ ScalarTypeDefinition: ({ name, description, }: {
34
+ name: string;
35
+ description?: string;
36
+ }) => ScalarTypeDefinitionNode;
37
+ InputValueDefinition: ({ name, type, list, required, }: {
38
+ name: string;
39
+ type: string | InputObjectTypeDefinitionNode | EnumTypeDefinitionNode;
40
+ list?: boolean;
41
+ required?: boolean;
42
+ }) => InputValueDefinitionNode;
43
+ EnumDefinition: (props: {
44
+ name: string;
45
+ required?: boolean;
46
+ values: string[];
47
+ }) => EnumTypeDefinitionNode;
48
+ FieldNodeDefinition: ({ name, type, args, list, required, }: {
49
+ name: string;
50
+ type: string | TypeDefinitionNode;
51
+ required?: boolean;
52
+ list?: boolean;
53
+ args?: InputValueDefinitionNode[];
54
+ }) => FieldNode;
55
+ FieldDefinition: ({ name, type, args, list, required, }: {
56
+ name: string;
57
+ type: string | TypeDefinitionNode;
58
+ required?: boolean;
59
+ list?: boolean;
60
+ args?: InputValueDefinitionNode[];
61
+ }) => FieldDefinitionNode;
62
+ InterfaceTypeDefinition: ({ name, fields, description, }: {
63
+ name: string;
64
+ description?: string;
65
+ fields: FieldDefinitionNode[];
66
+ }) => InterfaceTypeDefinitionNode;
67
+ InputObjectTypeDefinition: ({ name, fields, }: {
68
+ name: string;
69
+ fields: InputValueDefinitionNode[] | ObjectTypeDefinitionNode[];
70
+ }) => InputObjectTypeDefinitionNode;
71
+ UnionTypeDefinition: ({ name, types, }: {
72
+ name: string;
73
+ types: (string | TypeDefinitionNode)[];
74
+ }) => UnionTypeDefinitionNode;
75
+ NamedType: ({ name }: {
76
+ name: string;
77
+ }) => NamedTypeNode;
78
+ ObjectTypeDefinition: ({ name, fields, interfaces, directives, args, }: {
79
+ name: string;
80
+ fields: FieldDefinitionNode[];
81
+ interfaces?: NamedTypeNode[];
82
+ directives?: DirectiveNode[];
83
+ args?: NamedTypeNode[];
84
+ }) => ObjectTypeDefinitionNode;
85
+ FieldWithSelectionSetDefinition: ({ name, selections, }: {
86
+ name: string;
87
+ selections: SelectionNode[];
88
+ }) => {
89
+ name: {
90
+ kind: "Name";
91
+ value: string;
92
+ };
93
+ kind: "Field";
94
+ selectionSet: {
95
+ kind: "SelectionSet";
96
+ selections: SelectionNode[];
97
+ };
98
+ };
99
+ InlineFragmentDefinition: ({ name, selections, }: {
100
+ name: string;
101
+ selections: SelectionNode[];
102
+ }) => InlineFragmentNode;
103
+ FragmentDefinition: ({ name, fragmentName, selections, }: {
104
+ name: string;
105
+ fragmentName: string;
106
+ selections: SelectionNode[];
107
+ }) => FragmentDefinitionNode;
108
+ TYPES: {
109
+ Scalar: (type: scalarNames) => string;
110
+ MultiCollectionDocument: string;
111
+ CollectionDocumentUnion: string;
112
+ String: string;
113
+ Reference: string;
114
+ Collection: string;
115
+ ID: string;
116
+ SystemInfo: string;
117
+ Boolean: string;
118
+ JSON: string;
119
+ Node: string;
120
+ PageInfo: string;
121
+ Connection: string;
122
+ Number: string;
123
+ Document: string;
124
+ };
125
+ QueryOperationDefinition: ({ queryName, fragName, }: {
126
+ queryName: string;
127
+ fragName: string;
128
+ }) => OperationDefinitionNode;
129
+ ListQueryOperationDefinition: ({ queryName, fragName, }: {
130
+ queryName: string;
131
+ fragName: string;
132
+ }) => OperationDefinitionNode;
133
+ toGraphQLAst: (ast: {
134
+ globalTemplates: TypeDefinitionNode[];
135
+ query: TypeDefinitionNode;
136
+ definitions: TypeDefinitionNode[];
137
+ }) => DocumentNode;
138
+ };
139
+ declare type scalarNames = 'string' | 'boolean' | 'datetime' | 'image' | 'text' | 'number';
140
+ export declare const extractInlineTypes: (item: TypeDefinitionNode | TypeDefinitionNode[]) => TypeDefinitionNode[];
141
+ export declare function walk(maybeNode: TypeDefinitionNode, visited?: WeakSet<object>): IterableIterator<TypeDefinitionNode>;
142
+ export declare function addNamespaceToSchema<T extends object | string>(maybeNode: T, namespace?: string[]): T;
143
+ export declare const NAMER: {
144
+ dataFilterTypeNameOn: (namespace: string[]) => string;
145
+ dataFilterTypeName: (namespace: string[]) => string;
146
+ dataMutationTypeNameOn: (namespace: string[]) => string;
147
+ dataMutationTypeName: (namespace: string[]) => string;
148
+ updateName: (namespace: string[]) => string;
149
+ createName: (namespace: string[]) => string;
150
+ queryName: (namespace: string[]) => string;
151
+ generateQueryListName: (namespace: string[]) => string;
152
+ fragmentName: (namespace: string[]) => string;
153
+ collectionTypeName: (namespace: string[]) => string;
154
+ documentTypeName: (namespace: string[]) => string;
155
+ dataTypeName: (namespace: string[]) => string;
156
+ referenceConnectionType: (namespace: string[]) => string;
157
+ referenceConnectionEdgesTypeName: (namespace: string[]) => string;
158
+ };
159
+ export {};
@@ -0,0 +1,19 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ import type { TinaSchema } from './schema';
14
+ import { Database } from './database';
15
+ export declare const indexDB: ({ database, config, buildSDK, }: {
16
+ database: Database;
17
+ config: TinaSchema['config'];
18
+ buildSDK?: boolean;
19
+ }) => Promise<void>;
@@ -0,0 +1,254 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ import { Database } from '../database';
14
+ import type { ObjectTypeDefinitionNode, InlineFragmentNode } from 'graphql';
15
+ import type { TinaCloudCollectionEnriched, Template } from '../types';
16
+ import { TinaSchema } from '../schema';
17
+ export declare const createBuilder: ({ database, tinaSchema, }: {
18
+ database: Database;
19
+ tinaSchema: TinaSchema;
20
+ }) => Promise<Builder>;
21
+ /**
22
+ * The builder class is responsible for creating GraphQL AST definitions
23
+ * for a given portion of the Tina schema. In some cases that will also mean
24
+ * storing a reference to how we can resolve that type when we come across it.
25
+ */
26
+ export declare class Builder {
27
+ config: {
28
+ database: Database;
29
+ tinaSchema: TinaSchema;
30
+ };
31
+ tinaSchema: TinaSchema;
32
+ database: Database;
33
+ constructor(config: {
34
+ database: Database;
35
+ tinaSchema: TinaSchema;
36
+ });
37
+ /**
38
+ * ```graphql
39
+ * # ex.
40
+ * {
41
+ * getCollection(collection: $collection) {
42
+ * name
43
+ * documents {...}
44
+ * }
45
+ * }
46
+ * ```
47
+ *
48
+ * @param collections
49
+ */
50
+ buildCollectionDefinition: (collections: TinaCloudCollectionEnriched[]) => Promise<import("graphql").FieldDefinitionNode>;
51
+ /**
52
+ * ```graphql
53
+ * # ex.
54
+ * {
55
+ * getCollections {
56
+ * name
57
+ * documents {...}
58
+ * }
59
+ * }
60
+ * ```
61
+ *
62
+ * @param collections
63
+ */
64
+ buildMultiCollectionDefinition: (collections: TinaCloudCollectionEnriched[]) => Promise<import("graphql").FieldDefinitionNode>;
65
+ /**
66
+ * ```graphql
67
+ * # ex.
68
+ * {
69
+ * node(id: $id) {
70
+ * id
71
+ * data {...}
72
+ * }
73
+ * }
74
+ * ```
75
+ */
76
+ multiNodeDocument: () => Promise<import("graphql").FieldDefinitionNode>;
77
+ /**
78
+ * ```graphql
79
+ * # ex.
80
+ * {
81
+ * getDocument(collection: $collection, relativePath: $relativePath) {
82
+ * id
83
+ * data {...}
84
+ * }
85
+ * }
86
+ * ```
87
+ *
88
+ * @param collections
89
+ */
90
+ multiCollectionDocument: (collections: TinaCloudCollectionEnriched[]) => Promise<import("graphql").FieldDefinitionNode>;
91
+ /**
92
+ * ```graphql
93
+ * {
94
+ * getDocumentFields()
95
+ * }
96
+ * ```
97
+ */
98
+ multiCollectionDocumentFields: () => Promise<import("graphql").FieldDefinitionNode>;
99
+ /**
100
+ * ```graphql
101
+ * # ex.
102
+ * {
103
+ * addPendingDocument(collection: $collection, relativePath: $relativePath, params: $params) {
104
+ * id
105
+ * data {...}
106
+ * }
107
+ * }
108
+ * ```
109
+ *
110
+ * @param collections
111
+ */
112
+ addMultiCollectionDocumentMutation: () => Promise<import("graphql").FieldDefinitionNode>;
113
+ /**
114
+ * ```graphql
115
+ * # ex.
116
+ * {
117
+ * createDocument(relativePath: $relativePath, params: $params) {
118
+ * id
119
+ * data {...}
120
+ * }
121
+ * }
122
+ * ```
123
+ *
124
+ * @param collections
125
+ */
126
+ buildCreateCollectionDocumentMutation: (collections: TinaCloudCollectionEnriched[]) => Promise<import("graphql").FieldDefinitionNode>;
127
+ /**
128
+ * ```graphql
129
+ * # ex.
130
+ * {
131
+ * updateDocument(relativePath: $relativePath, params: $params) {
132
+ * id
133
+ * data {...}
134
+ * }
135
+ * }
136
+ * ```
137
+ *
138
+ * @param collections
139
+ */
140
+ buildUpdateCollectionDocumentMutation: (collections: TinaCloudCollectionEnriched[]) => Promise<import("graphql").FieldDefinitionNode>;
141
+ /**
142
+ * ```graphql
143
+ * # ex.
144
+ * {
145
+ * getDocumentList(first: 10) {
146
+ * edges {
147
+ * node {
148
+ * id
149
+ * }
150
+ * }
151
+ * }
152
+ * }
153
+ * ```
154
+ *
155
+ * @param collections
156
+ */
157
+ multiCollectionDocumentList: (collections: TinaCloudCollectionEnriched[]) => Promise<import("graphql").FieldDefinitionNode>;
158
+ /**
159
+ * ```graphql
160
+ * # ex.
161
+ * {
162
+ * getPostDocument(relativePath: $relativePath) {
163
+ * id
164
+ * data {...}
165
+ * }
166
+ * }
167
+ * ```
168
+ *
169
+ * @param collection
170
+ */
171
+ collectionDocument: (collection: TinaCloudCollectionEnriched) => Promise<import("graphql").FieldDefinitionNode>;
172
+ /**
173
+ * Turns a collection into a fragment that gets updated on build. This fragment does not resolve references
174
+ * ```graphql
175
+ * # ex.
176
+ * fragment AuthorsParts on Authors {
177
+ * name
178
+ * avatar
179
+ * ...
180
+ * }
181
+ * ```
182
+ *
183
+ * @public
184
+ * @param collection a Tina Cloud collection
185
+ */
186
+ collectionFragment: (collection: TinaCloudCollectionEnriched) => Promise<import("graphql").FragmentDefinitionNode>;
187
+ private _buildFieldNodeForFragments;
188
+ buildTemplateFragments(template: Template<true>): Promise<InlineFragmentNode>;
189
+ /**
190
+ * ```graphql
191
+ * # ex.
192
+ * mutation {
193
+ * updatePostDocument(relativePath: $relativePath, params: $params) {
194
+ * id
195
+ * data {...}
196
+ * }
197
+ * }
198
+ * ```
199
+ *
200
+ * @param collection
201
+ */
202
+ updateCollectionDocumentMutation: (collection: TinaCloudCollectionEnriched) => Promise<import("graphql").FieldDefinitionNode>;
203
+ /**
204
+ * ```graphql
205
+ * # ex.
206
+ * mutation {
207
+ * createPostDocument(relativePath: $relativePath, params: $params) {
208
+ * id
209
+ * data {...}
210
+ * }
211
+ * }
212
+ * ```
213
+ *
214
+ * @param collection
215
+ */
216
+ createCollectionDocumentMutation: (collection: TinaCloudCollectionEnriched) => Promise<import("graphql").FieldDefinitionNode>;
217
+ /**
218
+ * ```graphql
219
+ * # ex.
220
+ * {
221
+ * getPostList(first: 10) {
222
+ * edges {
223
+ * node {
224
+ * id
225
+ * }
226
+ * }
227
+ * }
228
+ * }
229
+ * ```
230
+ *
231
+ * @param collection
232
+ */
233
+ collectionDocumentList: (collection: TinaCloudCollectionEnriched) => Promise<import("graphql").FieldDefinitionNode>;
234
+ /**
235
+ * GraphQL type definitions which remain unchanged regardless
236
+ * of the supplied Tina schema. Ex. "node" interface
237
+ */
238
+ buildStaticDefinitions: () => (import("graphql").ScalarTypeDefinitionNode | ObjectTypeDefinitionNode | import("graphql").InterfaceTypeDefinitionNode[])[];
239
+ private _buildCollectionDocumentType;
240
+ private _filterCollectionDocumentType;
241
+ private _buildTemplateFilter;
242
+ private _updateCollectionDocumentMutationType;
243
+ private _buildTemplateMutation;
244
+ private _buildMultiCollectionDocumentDefinition;
245
+ private _buildMultiCollectionDocumentListDefinition;
246
+ private _buildFieldFilter;
247
+ private _buildFieldMutation;
248
+ private _buildReferenceMutation;
249
+ private _buildObjectOrUnionData;
250
+ private _connectionFilterBuilder;
251
+ private _connectionFieldBuilder;
252
+ private _buildDataField;
253
+ private _buildTemplateData;
254
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ export declare const staticDefinitions: (import("graphql").ScalarTypeDefinitionNode | import("graphql").ObjectTypeDefinitionNode | import("graphql").InterfaceTypeDefinitionNode[])[];
@@ -0,0 +1,23 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ export interface Bridge {
14
+ rootPath: string;
15
+ glob(pattern: string): Promise<string[]>;
16
+ get(filepath: string): Promise<string>;
17
+ put(filepath: string, data: string): Promise<void>;
18
+ /**
19
+ * Whether this bridge supports the ability to build the schema.
20
+ */
21
+ supportsBuilding(): boolean;
22
+ putConfig(filepath: string, data: string): Promise<void>;
23
+ }
@@ -0,0 +1,129 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ import type { BinaryFilter, IndexDefinition, Store, TernaryFilter } from '@tinacms/datalayer';
14
+ import type { DocumentNode } from 'graphql';
15
+ import type { TinaSchema } from '../schema';
16
+ import type { TinaCloudSchemaBase } from '../types';
17
+ import type { Bridge } from './bridge';
18
+ declare type CreateDatabase = {
19
+ bridge: Bridge;
20
+ store: Store;
21
+ };
22
+ export declare const createDatabase: (config: CreateDatabase) => Promise<Database>;
23
+ /** Options for {@link Database.query} **/
24
+ export declare type QueryOptions = {
25
+ collection: string;
26
+ filterChain?: (BinaryFilter | TernaryFilter)[];
27
+ sort?: string;
28
+ first?: number;
29
+ last?: number;
30
+ after?: string;
31
+ before?: string;
32
+ };
33
+ export declare class Database {
34
+ config: CreateDatabase;
35
+ bridge: Bridge;
36
+ store: Store;
37
+ private tinaSchema;
38
+ private collectionIndexDefinitions;
39
+ private _lookup;
40
+ private _graphql;
41
+ private _tinaSchema;
42
+ constructor(config: CreateDatabase);
43
+ get: <T extends object>(filepath: string) => Promise<T>;
44
+ addPendingDocument: (filepath: string, data: {
45
+ [key: string]: unknown;
46
+ }) => Promise<void>;
47
+ put: (filepath: string, data: {
48
+ [key: string]: unknown;
49
+ }) => Promise<boolean>;
50
+ stringifyFile: (filepath: string, data: {
51
+ [key: string]: unknown;
52
+ }) => Promise<{
53
+ stringifiedFile: string;
54
+ payload: {
55
+ [key: string]: unknown;
56
+ };
57
+ keepTemplateKey: boolean;
58
+ }>;
59
+ flush: (filepath: string) => Promise<string>;
60
+ getLookup: (returnType: string) => Promise<LookupMapType>;
61
+ getGraphQLSchema: () => Promise<DocumentNode>;
62
+ getGraphQLSchemaFromBridge: () => Promise<DocumentNode>;
63
+ getTinaSchema: () => Promise<TinaCloudSchemaBase>;
64
+ getSchema: () => Promise<TinaSchema>;
65
+ getIndexDefinitions: () => Promise<Record<string, Record<string, IndexDefinition>>>;
66
+ documentExists: (fullpath: unknown) => Promise<boolean>;
67
+ query: (queryOptions: QueryOptions, hydrator: any) => Promise<{
68
+ edges: {
69
+ node: any;
70
+ cursor: string;
71
+ }[];
72
+ pageInfo: {
73
+ hasPreviousPage: boolean;
74
+ hasNextPage: boolean;
75
+ startCursor: string;
76
+ endCursor: string;
77
+ };
78
+ }>;
79
+ putConfigFiles: ({ graphQLSchema, tinaSchema, }: {
80
+ graphQLSchema: DocumentNode;
81
+ tinaSchema: TinaSchema;
82
+ }) => Promise<void>;
83
+ indexContent: ({ graphQLSchema, tinaSchema, }: {
84
+ graphQLSchema: DocumentNode;
85
+ tinaSchema: TinaSchema;
86
+ }) => Promise<void>;
87
+ indexContentByPaths: (documentPaths: string[]) => Promise<void>;
88
+ _indexAllContent: () => Promise<void>;
89
+ addToLookupMap: (lookup: LookupMapType) => Promise<void>;
90
+ }
91
+ export declare type LookupMapType = GlobalDocumentLookup | CollectionDocumentLookup | MultiCollectionDocumentLookup | MultiCollectionDocumentListLookup | CollectionDocumentListLookup | UnionDataLookup | NodeDocument;
92
+ declare type NodeDocument = {
93
+ type: string;
94
+ resolveType: 'nodeDocument';
95
+ };
96
+ declare type GlobalDocumentLookup = {
97
+ type: string;
98
+ resolveType: 'globalDocument';
99
+ collection: string;
100
+ };
101
+ declare type CollectionDocumentLookup = {
102
+ type: string;
103
+ resolveType: 'collectionDocument';
104
+ collection: string;
105
+ };
106
+ declare type MultiCollectionDocumentLookup = {
107
+ type: string;
108
+ resolveType: 'multiCollectionDocument';
109
+ createDocument: 'create';
110
+ updateDocument: 'update';
111
+ };
112
+ declare type MultiCollectionDocumentListLookup = {
113
+ type: string;
114
+ resolveType: 'multiCollectionDocumentList';
115
+ collections: string[];
116
+ };
117
+ export declare type CollectionDocumentListLookup = {
118
+ type: string;
119
+ resolveType: 'collectionDocumentList';
120
+ collection: string;
121
+ };
122
+ declare type UnionDataLookup = {
123
+ type: string;
124
+ resolveType: 'unionData';
125
+ typeMap: {
126
+ [templateName: string]: string;
127
+ };
128
+ };
129
+ export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ import * as yup from 'yup';
14
+ export declare const stringifyFile: (content: object, format: FormatType | string, keepTemplateKey: boolean) => string;
15
+ export declare const parseFile: <T extends object>(content: string, format: FormatType | string, yupSchema: (args: typeof yup) => yup.ObjectSchema<any>) => T;
16
+ export declare type FormatType = 'json' | 'md' | 'mdx' | 'markdown';
package/dist/index.d.ts CHANGED
@@ -1 +1,30 @@
1
- export * from "../src/index"
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ export { indexDB } from './build';
14
+ export { resolve } from './resolve';
15
+ export { createDatabase } from './database';
16
+ export type { QueryOptions } from './database';
17
+ import type { Database } from './database';
18
+ export type { Database } from './database';
19
+ export type { Store } from '@tinacms/datalayer';
20
+ export type { Bridge } from './database/bridge';
21
+ export { sequential, assertShape } from './util';
22
+ export { stringifyFile, parseFile } from './database/util';
23
+ export declare const buildSchema: (rootPath: string, database: Database) => Promise<import("graphql").GraphQLSchema>;
24
+ import type { TinaCloudSchema as TinaCloudSchemaBase, TinaCloudCollection as TinaCloudCollectionBase, TinaCloudTemplateBase as TinaTemplate, TinaFieldBase } from './types';
25
+ export declare type TinaCloudSchema = TinaCloudSchemaBase<false>;
26
+ export declare type TinaSchema = TinaCloudSchema;
27
+ export declare type TinaCloudCollection = TinaCloudCollectionBase<false>;
28
+ export declare type TinaCollection = TinaCloudCollectionBase<false>;
29
+ export declare type TinaField = TinaFieldBase;
30
+ export type { TinaTemplate };