@tinacms/graphql 0.55.1 → 0.57.0-hotfix

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.
@@ -0,0 +1,279 @@
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 { TinaSchema } from '../schema';
14
+ import { Database, CollectionDocumentListLookup } from '../database';
15
+ import type { Collectable, TinaCloudCollection } from '../types';
16
+ interface ResolverConfig {
17
+ database: Database;
18
+ tinaSchema: TinaSchema;
19
+ }
20
+ export declare const createResolver: (args: ResolverConfig) => Resolver;
21
+ /**
22
+ * The resolver provides functions for all possible types of lookup
23
+ * values and retrieves them from the database
24
+ */
25
+ export declare class Resolver {
26
+ init: ResolverConfig;
27
+ database: Database;
28
+ tinaSchema: TinaSchema;
29
+ constructor(init: ResolverConfig);
30
+ resolveCollection: (collectionName: string) => Promise<{
31
+ fields: string | import("../types").TinaFieldInner<true>[];
32
+ templates?: undefined;
33
+ references?: import("../types").ReferenceTypeWithNamespace[];
34
+ namespace: string[];
35
+ label: string;
36
+ name: string;
37
+ path: string;
38
+ format?: "json" | "md" | "markdown" | "mdx";
39
+ match?: string;
40
+ documents: string[];
41
+ } | {
42
+ templates: (string | {
43
+ label: string;
44
+ name: string;
45
+ fields: import("../types").TinaFieldInner<true>[];
46
+ ui?: object;
47
+ namespace: string[];
48
+ })[];
49
+ fields?: undefined;
50
+ references?: import("../types").ReferenceTypeWithNamespace[];
51
+ namespace: string[];
52
+ label: string;
53
+ name: string;
54
+ path: string;
55
+ format?: "json" | "md" | "markdown" | "mdx";
56
+ match?: string;
57
+ documents: string[];
58
+ }>;
59
+ getDocument: (fullPath: unknown) => Promise<{
60
+ __typename: string;
61
+ id: string;
62
+ sys: {
63
+ basename: string;
64
+ filename: string;
65
+ extension: string;
66
+ path: string;
67
+ relativePath: string;
68
+ breadcrumbs: string[];
69
+ collection: TinaCloudCollection<true>;
70
+ template: string | number;
71
+ };
72
+ data: {
73
+ _collection: string;
74
+ _template: string;
75
+ };
76
+ values: {
77
+ _collection: string;
78
+ _template: string;
79
+ };
80
+ dataJSON: {
81
+ _collection: string;
82
+ _template: string;
83
+ };
84
+ form: {
85
+ label: string;
86
+ name: string;
87
+ fields: unknown[];
88
+ };
89
+ }>;
90
+ getDocumentFields: () => Promise<{}>;
91
+ buildObjectMutations: (fieldValue: any, field: Collectable) => {
92
+ [key: string]: unknown;
93
+ } | {
94
+ [key: string]: unknown;
95
+ }[];
96
+ createResolveDocument: ({ collection, realPath, args, isAddPendingDocument, }: {
97
+ collection: TinaCloudCollection<true>;
98
+ realPath: string;
99
+ args: unknown;
100
+ isAddPendingDocument: boolean;
101
+ }) => Promise<{
102
+ __typename: string;
103
+ id: string;
104
+ sys: {
105
+ basename: string;
106
+ filename: string;
107
+ extension: string;
108
+ path: string;
109
+ relativePath: string;
110
+ breadcrumbs: string[];
111
+ collection: TinaCloudCollection<true>;
112
+ template: string | number;
113
+ };
114
+ data: {
115
+ _collection: string;
116
+ _template: string;
117
+ };
118
+ values: {
119
+ _collection: string;
120
+ _template: string;
121
+ };
122
+ dataJSON: {
123
+ _collection: string;
124
+ _template: string;
125
+ };
126
+ form: {
127
+ label: string;
128
+ name: string;
129
+ fields: unknown[];
130
+ };
131
+ }>;
132
+ updateResolveDocument: ({ collection, realPath, args, isAddPendingDocument, isCollectionSpecific, }: {
133
+ collection: TinaCloudCollection<true>;
134
+ realPath: string;
135
+ args: unknown;
136
+ isAddPendingDocument: boolean;
137
+ isCollectionSpecific: boolean;
138
+ }) => Promise<{
139
+ __typename: string;
140
+ id: string;
141
+ sys: {
142
+ basename: string;
143
+ filename: string;
144
+ extension: string;
145
+ path: string;
146
+ relativePath: string;
147
+ breadcrumbs: string[];
148
+ collection: TinaCloudCollection<true>;
149
+ template: string | number;
150
+ };
151
+ data: {
152
+ _collection: string;
153
+ _template: string;
154
+ };
155
+ values: {
156
+ _collection: string;
157
+ _template: string;
158
+ };
159
+ dataJSON: {
160
+ _collection: string;
161
+ _template: string;
162
+ };
163
+ form: {
164
+ label: string;
165
+ name: string;
166
+ fields: unknown[];
167
+ };
168
+ }>;
169
+ resolveDocument: ({ args, collection: collectionName, isMutation, isCreation, isAddPendingDocument, isCollectionSpecific, }: {
170
+ args: unknown;
171
+ collection?: string;
172
+ isMutation: boolean;
173
+ isCreation?: boolean;
174
+ isAddPendingDocument?: boolean;
175
+ isCollectionSpecific?: boolean;
176
+ }) => Promise<{
177
+ __typename: string;
178
+ id: string;
179
+ sys: {
180
+ basename: string;
181
+ filename: string;
182
+ extension: string;
183
+ path: string;
184
+ relativePath: string;
185
+ breadcrumbs: string[];
186
+ collection: TinaCloudCollection<true>;
187
+ template: string | number;
188
+ };
189
+ data: {
190
+ _collection: string;
191
+ _template: string;
192
+ };
193
+ values: {
194
+ _collection: string;
195
+ _template: string;
196
+ };
197
+ dataJSON: {
198
+ _collection: string;
199
+ _template: string;
200
+ };
201
+ form: {
202
+ label: string;
203
+ name: string;
204
+ fields: unknown[];
205
+ };
206
+ }>;
207
+ resolveCollectionConnections: ({ ids }: {
208
+ ids: string[];
209
+ }) => Promise<{
210
+ totalCount: number;
211
+ edges: {
212
+ node: {
213
+ __typename: string;
214
+ id: string;
215
+ sys: {
216
+ basename: string;
217
+ filename: string;
218
+ extension: string;
219
+ path: string;
220
+ relativePath: string;
221
+ breadcrumbs: string[];
222
+ collection: TinaCloudCollection<true>;
223
+ template: string | number;
224
+ };
225
+ data: {
226
+ _collection: string;
227
+ _template: string;
228
+ };
229
+ values: {
230
+ _collection: string;
231
+ _template: string;
232
+ };
233
+ dataJSON: {
234
+ _collection: string;
235
+ _template: string;
236
+ };
237
+ form: {
238
+ label: string;
239
+ name: string;
240
+ fields: unknown[];
241
+ };
242
+ };
243
+ }[];
244
+ }>;
245
+ getDocumentsForCollection: (collectionName: string) => Promise<string[]>;
246
+ resolveCollectionConnection: ({ args, lookup, }: {
247
+ args: Record<string, Record<string, object>>;
248
+ lookup: CollectionDocumentListLookup;
249
+ }) => Promise<{
250
+ totalCount: any;
251
+ edges: any;
252
+ }>;
253
+ private buildFieldMutations;
254
+ private resolveFieldData;
255
+ /**
256
+ * A mutation looks nearly identical between updateDocument:
257
+ * ```graphql
258
+ * updateDocument(collection: $collection,relativePath: $path, params: {
259
+ * post: {
260
+ * title: "Hello, World"
261
+ * }
262
+ * })`
263
+ * ```
264
+ * and `updatePostDocument`:
265
+ * ```graphql
266
+ * updatePostDocument(relativePath: $path, params: {
267
+ * title: "Hello, World"
268
+ * })
269
+ * ```
270
+ * The problem here is that we don't know whether the payload came from `updateDocument`
271
+ * or `updatePostDocument` (we could, but for now it's easier not to pipe those details through),
272
+ * But we do know that when given a `args.collection` value, we can assume that
273
+ * this was a `updateDocument` request, and thus - should grab the data
274
+ * from the corresponding field name in the key
275
+ */
276
+ private buildParams;
277
+ private resolveField;
278
+ }
279
+ export {};
@@ -0,0 +1,78 @@
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 { CollectionTemplateable, Collectable, TinaCloudSchemaEnriched, TinaCloudSchemaBase, Templateable, TinaCloudCollection } from '../types';
14
+ export declare const createSchema: ({ schema, flags, }: {
15
+ schema: TinaCloudSchemaBase;
16
+ flags?: string[];
17
+ }) => Promise<TinaSchema>;
18
+ declare type Version = {
19
+ fullVersion: string;
20
+ major: string;
21
+ minor: string;
22
+ patch: string;
23
+ };
24
+ /**
25
+ * Metadata about how the schema was built
26
+ */
27
+ declare type Meta = {
28
+ flags?: string[];
29
+ };
30
+ /**
31
+ * TinaSchema is responsible for allowing you to look up certain
32
+ * properties of the user-provided schema with ease.
33
+ */
34
+ export declare class TinaSchema {
35
+ config: {
36
+ version?: Version;
37
+ meta?: Meta;
38
+ } & TinaCloudSchemaBase;
39
+ schema: TinaCloudSchemaEnriched;
40
+ constructor(config: {
41
+ version?: Version;
42
+ meta?: Meta;
43
+ } & TinaCloudSchemaBase);
44
+ getCollectionsByName: (collectionNames: string[]) => TinaCloudCollection<true>[];
45
+ getAllCollectionPaths: () => string[];
46
+ getCollection: (collectionName: string) => TinaCloudCollection<true>;
47
+ getCollections: () => TinaCloudCollection<true>[];
48
+ getGlobalTemplate: (templateName: string) => {
49
+ label: string;
50
+ name: string;
51
+ ui?: object;
52
+ fields: import("../types").TinaFieldInner<true>[];
53
+ namespace: string[];
54
+ };
55
+ getCollectionByFullPath: (filepath: string) => Promise<TinaCloudCollection<true>>;
56
+ getCollectionAndTemplateByFullPath: (filepath: string, templateName?: string) => Promise<{
57
+ collection: TinaCloudCollection<true>;
58
+ template: Templateable;
59
+ }>;
60
+ getTemplateForData: ({ data, collection, }: {
61
+ data?: unknown;
62
+ collection: Collectable;
63
+ }) => Promise<Templateable>;
64
+ isMarkdownCollection: (collectionName: string) => boolean;
65
+ /**
66
+ * Gets the template or templates from the item.
67
+ * Both `object` fields and collections support
68
+ * the ability for an object to be polymorphic,
69
+ * and if it is, we need to build unions, which
70
+ * are more of a headache for non-polymorphic
71
+ * needs, so we also need the ability to just
72
+ * build object types
73
+ *
74
+ *
75
+ */
76
+ getTemplatesForCollectable: (collection: Collectable) => CollectionTemplateable;
77
+ }
78
+ export {};
@@ -0,0 +1,14 @@
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 { TinaCloudSchemaBase } from '../types';
14
+ export declare const validateSchema: (schema: TinaCloudSchemaBase) => Promise<TinaCloudSchemaBase>;
@@ -0,0 +1,14 @@
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 '../primitives/schema';
14
+ export declare const buildSKD: (tinaSchema: TinaSchema) => string;
@@ -0,0 +1,41 @@
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 { Store } from '../database/store';
15
+ import type { TinaCloudSchema } from '../types';
16
+ export declare const setup: (rootPath: string, schema: TinaCloudSchema<false>, store: Store) => Promise<{
17
+ database: Database;
18
+ }>;
19
+ export declare const print: (fixture: Fixture) => string;
20
+ export declare type Fixture = {
21
+ description?: string;
22
+ name: string;
23
+ assert: 'output';
24
+ message?: string;
25
+ expectError?: boolean;
26
+ } | {
27
+ description?: string;
28
+ name: string;
29
+ assert: 'file';
30
+ filename: string;
31
+ message?: string;
32
+ expectError?: boolean;
33
+ };
34
+ export declare const setupFixture: (rootPath: string, schema: TinaCloudSchema<false>, store: Store, fixture: Fixture, suffix?: string, queryName?: string, folder?: string) => Promise<{
35
+ responses: string[];
36
+ expectedResponsePaths: string[];
37
+ }>;
38
+ export declare const setupFixture2: (rootPath: string, schema: TinaCloudSchema<false>, store: Store, fixture: Fixture, suffix?: string, queryName?: string, folder?: string) => Promise<{
39
+ responses: string[];
40
+ expectedResponsePaths: string[];
41
+ }>;
@@ -0,0 +1,253 @@
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 TinaCloudSchema<WithNamespace extends boolean> {
14
+ templates?: GlobalTemplate<WithNamespace>[];
15
+ collections: TinaCloudCollection<WithNamespace>[];
16
+ }
17
+ export declare type TinaCloudSchemaBase = TinaCloudSchema<false>;
18
+ export declare type TinaCloudSchemaEnriched = TinaCloudSchema<true>;
19
+ /**
20
+ * As part of the build process, each node is given a `path: string[]` key
21
+ * to help with namespacing type names, this is added as part of the
22
+ * createTinaSchema step
23
+ */
24
+ export interface TinaCloudSchemaWithNamespace {
25
+ templates?: GlobalTemplate<true>[];
26
+ collections: TinaCloudCollection<true>[];
27
+ namespace: string[];
28
+ }
29
+ export declare type TinaCloudCollection<WithNamespace extends boolean> = CollectionFields<WithNamespace> | CollectionTemplates<WithNamespace>;
30
+ export declare type TinaCloudCollectionBase = TinaCloudCollection<false>;
31
+ export declare type TinaCloudCollectionEnriched = TinaCloudCollection<true>;
32
+ declare type FormatType = 'json' | 'md' | 'markdown' | 'mdx';
33
+ interface BaseCollection {
34
+ label: string;
35
+ name: string;
36
+ path: string;
37
+ format?: FormatType;
38
+ match?: string;
39
+ }
40
+ declare type CollectionTemplates<WithNamespace extends boolean> = WithNamespace extends true ? CollectionTemplatesWithNamespace<WithNamespace> : CollectionTemplatesInner<WithNamespace>;
41
+ interface CollectionTemplatesInner<WithNamespace extends boolean> extends BaseCollection {
42
+ templates: (string | Template<WithNamespace>)[];
43
+ fields?: undefined;
44
+ }
45
+ export interface CollectionTemplatesWithNamespace<WithNamespace extends boolean> extends BaseCollection {
46
+ templates: (string | Template<WithNamespace>)[];
47
+ fields?: undefined;
48
+ references?: ReferenceType<WithNamespace>[];
49
+ namespace: WithNamespace extends true ? string[] : undefined;
50
+ }
51
+ declare type CollectionFields<WithNamespace extends boolean> = WithNamespace extends true ? CollectionFieldsWithNamespace<WithNamespace> : CollectionFieldsInner<WithNamespace>;
52
+ export interface CollectionFieldsWithNamespace<WithNamespace extends boolean> extends BaseCollection {
53
+ fields: string | TinaFieldInner<WithNamespace>[];
54
+ templates?: undefined;
55
+ references?: ReferenceType<WithNamespace>[];
56
+ namespace: string[];
57
+ }
58
+ interface CollectionFieldsInner<WithNamespace extends boolean> extends BaseCollection {
59
+ fields: string | TinaFieldInner<WithNamespace>[];
60
+ templates?: undefined;
61
+ }
62
+ export declare type TinaFieldInner<WithNamespace extends boolean> = ScalarType<WithNamespace> | ObjectType<WithNamespace> | ReferenceType<WithNamespace> | RichType<WithNamespace>;
63
+ export declare type TinaFieldBase = TinaFieldInner<false>;
64
+ export declare type TinaFieldEnriched = TinaFieldInner<true>;
65
+ interface TinaField {
66
+ name: string;
67
+ label: string;
68
+ description?: string;
69
+ required?: boolean;
70
+ list?: boolean;
71
+ /**
72
+ * Any items passed to the UI field will be passed to the underlying field.
73
+ * NOTE: only serializable values are supported, so functions like `validate`
74
+ * will be ignored.
75
+ */
76
+ ui?: object;
77
+ }
78
+ declare type ScalarType<WithNamespace extends boolean> = WithNamespace extends true ? ScalarTypeWithNamespace : ScalarTypeInner;
79
+ declare type Option = string | {
80
+ label: string;
81
+ value: string;
82
+ };
83
+ declare type ScalarTypeInner = TinaField & TinaScalarField & {
84
+ options?: Option[];
85
+ };
86
+ declare type ScalarTypeWithNamespace = TinaField & TinaScalarField & {
87
+ options?: Option[];
88
+ namespace: string[];
89
+ };
90
+ declare type TinaScalarField = StringField | BooleanField | DateTimeField | NumberField | ImageField;
91
+ declare type StringField = {
92
+ type: 'string';
93
+ isBody?: boolean;
94
+ };
95
+ declare type BooleanField = {
96
+ type: 'boolean';
97
+ };
98
+ declare type NumberField = {
99
+ type: 'number';
100
+ };
101
+ declare type DateTimeField = {
102
+ type: 'datetime';
103
+ dateFormat?: string;
104
+ timeFormat?: string;
105
+ };
106
+ declare type ImageField = {
107
+ type: 'image';
108
+ };
109
+ export declare type ReferenceType<WithNamespace extends boolean> = WithNamespace extends true ? ReferenceTypeWithNamespace : ReferenceTypeInner;
110
+ export declare type RichType<WithNamespace extends boolean> = WithNamespace extends true ? RichTypeWithNamespace : RichTypeInner;
111
+ export interface ReferenceTypeInner extends TinaField {
112
+ type: 'reference';
113
+ reverseLookup?: {
114
+ label: string;
115
+ name: string;
116
+ };
117
+ collections: string[];
118
+ }
119
+ export interface ReferenceTypeWithNamespace extends TinaField {
120
+ type: 'reference';
121
+ collections: string[];
122
+ reverseLookup?: {
123
+ label: string;
124
+ name: string;
125
+ };
126
+ namespace: string[];
127
+ }
128
+ export interface RichTypeWithNamespace extends TinaField {
129
+ type: 'rich-text';
130
+ namespace: string[];
131
+ isBody?: boolean;
132
+ templates?: (string | (Template<true> & {
133
+ inline?: boolean;
134
+ }))[];
135
+ }
136
+ export interface RichTypeInner extends TinaField {
137
+ type: 'rich-text';
138
+ isBody?: boolean;
139
+ templates?: (string | (Template<false> & {
140
+ inline?: boolean;
141
+ }))[];
142
+ }
143
+ export declare type ObjectType<WithNamespace extends boolean> = ObjectTemplates<WithNamespace> | ObjectFields<WithNamespace>;
144
+ declare type ObjectTemplates<WithNamespace extends boolean> = WithNamespace extends true ? ObjectTemplatesWithNamespace<WithNamespace> : ObjectTemplatesInner<WithNamespace>;
145
+ interface ObjectTemplatesInner<WithNamespace extends boolean> extends TinaField {
146
+ type: 'object';
147
+ /**
148
+ * templates can either be an array of Tina templates or a reference to
149
+ * global template definition.
150
+ *
151
+ * You should use `templates` when your object can be any one of multiple shapes (polymorphic)
152
+ *
153
+ * You can only provide one of `fields` or `template`, but not both
154
+ */
155
+ templates: (string | Template<WithNamespace>)[];
156
+ fields?: undefined;
157
+ }
158
+ interface ObjectTemplatesWithNamespace<WithNamespace extends boolean> extends TinaField {
159
+ type: 'object';
160
+ /**
161
+ * templates can either be an array of Tina templates or a reference to
162
+ * global template definition.
163
+ *
164
+ * You should use `templates` when your object can be any one of multiple shapes (polymorphic)
165
+ *
166
+ * You can only provide one of `fields` or `template`, but not both
167
+ */
168
+ templates: (string | Template<WithNamespace>)[];
169
+ fields?: undefined;
170
+ namespace: WithNamespace extends true ? string[] : undefined;
171
+ }
172
+ declare type ObjectFields<WithNamespace extends boolean> = WithNamespace extends true ? InnerObjectFieldsWithNamespace<WithNamespace> : InnerObjectFields<WithNamespace>;
173
+ interface InnerObjectFields<WithNamespace extends boolean> extends TinaField {
174
+ type: 'object';
175
+ /**
176
+ * fields can either be an array of Tina fields, or a reference to the fields
177
+ * of a global template definition.
178
+ *
179
+ * You can only provide one of `fields` or `templates`, but not both.
180
+ */
181
+ fields: string | TinaFieldInner<WithNamespace>[];
182
+ templates?: undefined;
183
+ }
184
+ interface InnerObjectFieldsWithNamespace<WithNamespace extends boolean> extends TinaField {
185
+ type: 'object';
186
+ /**
187
+ * fields can either be an array of Tina fields, or a reference to the fields
188
+ * of a global template definition.
189
+ *
190
+ * You can only provide one of `fields` or `templates`, but not both.
191
+ */
192
+ fields: string | TinaFieldInner<WithNamespace>[];
193
+ templates?: undefined;
194
+ namespace: WithNamespace extends true ? string[] : undefined;
195
+ }
196
+ /**
197
+ * Global Templates are defined once, and can be used anywhere by referencing the 'name' of the template
198
+ *
199
+ * TODO: ensure we don't permit infite loop with self-references
200
+ */
201
+ export declare type GlobalTemplate<WithNamespace extends boolean> = WithNamespace extends true ? {
202
+ label: string;
203
+ name: string;
204
+ ui?: object;
205
+ fields: TinaFieldInner<WithNamespace>[];
206
+ namespace: WithNamespace extends true ? string[] : undefined;
207
+ } : {
208
+ label: string;
209
+ name: string;
210
+ ui?: object;
211
+ fields: TinaFieldInner<WithNamespace>[];
212
+ };
213
+ export declare type TinaCloudTemplateBase = GlobalTemplate<false>;
214
+ export declare type TinaCloudTemplateEnriched = GlobalTemplate<true>;
215
+ /**
216
+ * Templates allow you to define an object as polymorphic
217
+ */
218
+ export declare type Template<WithNamespace extends boolean> = WithNamespace extends true ? {
219
+ label: string;
220
+ name: string;
221
+ fields: TinaFieldInner<WithNamespace>[];
222
+ ui?: object;
223
+ namespace: WithNamespace extends true ? string[] : undefined;
224
+ } : {
225
+ label: string;
226
+ name: string;
227
+ ui?: object;
228
+ fields: TinaFieldInner<WithNamespace>[];
229
+ };
230
+ export declare type CollectionTemplateableUnion = {
231
+ namespace: string[];
232
+ type: 'union';
233
+ templates: Templateable[];
234
+ };
235
+ export declare type CollectionTemplateableObject = {
236
+ namespace: string[];
237
+ type: 'object';
238
+ template: Templateable;
239
+ };
240
+ export declare type CollectionTemplateable = CollectionTemplateableUnion | CollectionTemplateableObject;
241
+ export declare type Collectable = {
242
+ namespace: string[];
243
+ templates?: (string | Templateable)[];
244
+ fields?: string | TinaFieldEnriched[];
245
+ references?: ReferenceType<true>[];
246
+ };
247
+ export declare type Templateable = {
248
+ name: string;
249
+ namespace: string[];
250
+ fields: TinaFieldEnriched[];
251
+ ui?: object;
252
+ };
253
+ export {};