tinacms 0.66.8 → 0.67.0
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 +91 -0
- package/dist/client/index.d.ts +5 -1
- package/dist/edit-state.es.js +5 -1
- package/dist/edit-state.js +5 -1
- package/dist/hooks/formify/formify-utils.d.ts +89 -0
- package/dist/{types/index.d.ts → hooks/formify/formify.d.ts} +11 -6
- package/dist/hooks/formify/index.d.ts +11 -43
- package/dist/hooks/formify/reducer.d.ts +27 -0
- package/dist/hooks/formify/{test/to-be-similar-to.d.ts → spec/runner.d.ts} +1 -1
- package/dist/hooks/formify/spec/util.d.ts +25 -0
- package/dist/hooks/formify/types.d.ts +183 -0
- package/dist/hooks/formify/util.d.ts +117 -28
- package/dist/hooks/use-graphql-forms.d.ts +22 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.es.js +2517 -1182
- package/dist/index.js +2532 -1197
- package/dist/rich-text.d.ts +1 -0
- package/dist/rich-text.es.js +14 -11
- package/dist/rich-text.js +14 -11
- package/dist/tina-cms.d.ts +3 -1
- package/dist/utils/index.d.ts +3 -1
- package/package.json +6 -3
- package/dist/types/SchemaTypes.d.ts +0 -258
package/dist/rich-text.d.ts
CHANGED
package/dist/rich-text.es.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
2
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
3
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
4
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -16,7 +14,6 @@ var __spreadValues = (a, b) => {
|
|
|
16
14
|
}
|
|
17
15
|
return a;
|
|
18
16
|
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
17
|
var __objRest = (source, exclude) => {
|
|
21
18
|
var target = {};
|
|
22
19
|
for (var prop in source)
|
|
@@ -58,11 +55,9 @@ const TinaMarkdown = ({
|
|
|
58
55
|
case "li":
|
|
59
56
|
if (components[child.type]) {
|
|
60
57
|
const Component2 = components[child.type];
|
|
61
|
-
return /* @__PURE__ */ React.createElement(Component2,
|
|
58
|
+
return /* @__PURE__ */ React.createElement(Component2, __spreadValues({
|
|
62
59
|
key
|
|
63
|
-
}, props), {
|
|
64
|
-
childrenRaw: children
|
|
65
|
-
}), /* @__PURE__ */ React.createElement(TinaMarkdown, {
|
|
60
|
+
}, props), /* @__PURE__ */ React.createElement(TinaMarkdown, {
|
|
66
61
|
components,
|
|
67
62
|
content: children
|
|
68
63
|
}));
|
|
@@ -117,11 +112,9 @@ const TinaMarkdown = ({
|
|
|
117
112
|
}).join("\n");
|
|
118
113
|
if (components[child.type]) {
|
|
119
114
|
const Component2 = components[child.type];
|
|
120
|
-
return /* @__PURE__ */ React.createElement(Component2,
|
|
115
|
+
return /* @__PURE__ */ React.createElement(Component2, __spreadValues({
|
|
121
116
|
key
|
|
122
|
-
}, props),
|
|
123
|
-
childrenRaw: children
|
|
124
|
-
}), value);
|
|
117
|
+
}, props), value);
|
|
125
118
|
}
|
|
126
119
|
return /* @__PURE__ */ React.createElement("pre", {
|
|
127
120
|
key
|
|
@@ -136,6 +129,16 @@ const TinaMarkdown = ({
|
|
|
136
129
|
return /* @__PURE__ */ React.createElement("hr", {
|
|
137
130
|
key
|
|
138
131
|
});
|
|
132
|
+
case "break":
|
|
133
|
+
if (components[child.type]) {
|
|
134
|
+
const Component2 = components[child.type];
|
|
135
|
+
return /* @__PURE__ */ React.createElement(Component2, __spreadValues({
|
|
136
|
+
key
|
|
137
|
+
}, props));
|
|
138
|
+
}
|
|
139
|
+
return /* @__PURE__ */ React.createElement("br", {
|
|
140
|
+
key
|
|
141
|
+
});
|
|
139
142
|
case "text":
|
|
140
143
|
return /* @__PURE__ */ React.createElement(Leaf, __spreadValues({
|
|
141
144
|
key,
|
package/dist/rich-text.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
2
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
3
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
4
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -16,7 +14,6 @@ var __spreadValues = (a, b) => {
|
|
|
16
14
|
}
|
|
17
15
|
return a;
|
|
18
16
|
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
17
|
var __objRest = (source, exclude) => {
|
|
21
18
|
var target = {};
|
|
22
19
|
for (var prop in source)
|
|
@@ -65,11 +62,9 @@ var __objRest = (source, exclude) => {
|
|
|
65
62
|
case "li":
|
|
66
63
|
if (components[child.type]) {
|
|
67
64
|
const Component2 = components[child.type];
|
|
68
|
-
return /* @__PURE__ */ React__default["default"].createElement(Component2,
|
|
65
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component2, __spreadValues({
|
|
69
66
|
key
|
|
70
|
-
}, props), {
|
|
71
|
-
childrenRaw: children
|
|
72
|
-
}), /* @__PURE__ */ React__default["default"].createElement(TinaMarkdown, {
|
|
67
|
+
}, props), /* @__PURE__ */ React__default["default"].createElement(TinaMarkdown, {
|
|
73
68
|
components,
|
|
74
69
|
content: children
|
|
75
70
|
}));
|
|
@@ -124,11 +119,9 @@ var __objRest = (source, exclude) => {
|
|
|
124
119
|
}).join("\n");
|
|
125
120
|
if (components[child.type]) {
|
|
126
121
|
const Component2 = components[child.type];
|
|
127
|
-
return /* @__PURE__ */ React__default["default"].createElement(Component2,
|
|
122
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component2, __spreadValues({
|
|
128
123
|
key
|
|
129
|
-
}, props),
|
|
130
|
-
childrenRaw: children
|
|
131
|
-
}), value);
|
|
124
|
+
}, props), value);
|
|
132
125
|
}
|
|
133
126
|
return /* @__PURE__ */ React__default["default"].createElement("pre", {
|
|
134
127
|
key
|
|
@@ -143,6 +136,16 @@ var __objRest = (source, exclude) => {
|
|
|
143
136
|
return /* @__PURE__ */ React__default["default"].createElement("hr", {
|
|
144
137
|
key
|
|
145
138
|
});
|
|
139
|
+
case "break":
|
|
140
|
+
if (components[child.type]) {
|
|
141
|
+
const Component2 = components[child.type];
|
|
142
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component2, __spreadValues({
|
|
143
|
+
key
|
|
144
|
+
}, props));
|
|
145
|
+
}
|
|
146
|
+
return /* @__PURE__ */ React__default["default"].createElement("br", {
|
|
147
|
+
key
|
|
148
|
+
});
|
|
146
149
|
case "text":
|
|
147
150
|
return /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({
|
|
148
151
|
key,
|
package/dist/tina-cms.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { TinaCloudMediaStoreClass } from './auth';
|
|
|
16
16
|
import type { TinaIOConfig } from './client/index';
|
|
17
17
|
import type { TinaCMS } from '@tinacms/toolkit';
|
|
18
18
|
import type { formifyCallback } from './hooks/use-graphql-forms';
|
|
19
|
+
import type { TinaCloudSchema } from '@tinacms/schema-tools';
|
|
19
20
|
declare type APIProviderProps = {
|
|
20
21
|
/**
|
|
21
22
|
* Content API URL
|
|
@@ -77,6 +78,7 @@ interface BaseProviderProps {
|
|
|
77
78
|
/** TinaCMS media store instance */
|
|
78
79
|
mediaStore?: TinaCloudMediaStoreClass | (() => Promise<TinaCloudMediaStoreClass>);
|
|
79
80
|
tinaioConfig?: TinaIOConfig;
|
|
81
|
+
schema?: TinaCloudSchema<false>;
|
|
80
82
|
}
|
|
81
83
|
declare type QueryProviderProps = {
|
|
82
84
|
/** Your React page component */
|
|
@@ -98,7 +100,7 @@ declare type QueryProviderProps = {
|
|
|
98
100
|
data?: never;
|
|
99
101
|
};
|
|
100
102
|
export declare type TinaCMSProviderDefaultProps = QueryProviderProps & APIProviderProps & BaseProviderProps;
|
|
101
|
-
export declare const TinaCMSProvider2: ({ query, documentCreatorCallback, formifyCallback, ...props }: TinaCMSProviderDefaultProps) => JSX.Element;
|
|
103
|
+
export declare const TinaCMSProvider2: ({ query, documentCreatorCallback, formifyCallback, schema, ...props }: TinaCMSProviderDefaultProps) => JSX.Element;
|
|
102
104
|
export declare const TinaDataProvider: ({ children, formifyCallback, }: {
|
|
103
105
|
children: any;
|
|
104
106
|
formifyCallback: formifyCallback;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ limitations under the License.
|
|
|
13
13
|
import { Client } from '../client';
|
|
14
14
|
import type { TinaIOConfig } from '../client';
|
|
15
15
|
import * as yup from 'yup';
|
|
16
|
+
import { TinaCloudSchema } from '@tinacms/schema-tools';
|
|
16
17
|
export interface CreateClientProps {
|
|
17
18
|
clientId?: string;
|
|
18
19
|
isLocalClient?: boolean;
|
|
@@ -20,7 +21,8 @@ export interface CreateClientProps {
|
|
|
20
21
|
owner?: string;
|
|
21
22
|
repo?: string;
|
|
22
23
|
branch?: string;
|
|
24
|
+
schema?: TinaCloudSchema<false>;
|
|
23
25
|
}
|
|
24
|
-
export declare const createClient: ({ clientId, isLocalClient, branch, tinaioConfig, }: CreateClientProps) => Client;
|
|
26
|
+
export declare const createClient: ({ clientId, isLocalClient, branch, tinaioConfig, schema, }: CreateClientProps) => Client;
|
|
25
27
|
export declare function assertShape<T extends unknown>(value: unknown, yupSchema: (args: typeof yup) => yup.AnySchema, errorMessage?: string): asserts value is T;
|
|
26
28
|
export declare function safeAssertShape<T extends unknown>(value: unknown, yupSchema: (args: typeof yup) => yup.AnySchema): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.67.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
"@graphql-tools/relay-operation-optimizer": "^6.4.1",
|
|
25
25
|
"@headlessui/react": "^1.4.1",
|
|
26
26
|
"@heroicons/react": "^1.0.4",
|
|
27
|
-
"@tinacms/
|
|
28
|
-
"@tinacms/
|
|
27
|
+
"@tinacms/schema-tools": "0.0.2",
|
|
28
|
+
"@tinacms/sharedctx": "0.1.1",
|
|
29
|
+
"@tinacms/toolkit": "0.56.19",
|
|
29
30
|
"crypto-js": "^4.0.0",
|
|
30
31
|
"final-form": "4.20.1",
|
|
31
32
|
"graphql": "^15.1.0",
|
|
@@ -49,7 +50,9 @@
|
|
|
49
50
|
"@types/react": "^16.9.38",
|
|
50
51
|
"@types/yup": "^0.29.10",
|
|
51
52
|
"identity-obj-proxy": "^3.0.0",
|
|
53
|
+
"isomorphic-fetch": "^3.0.0",
|
|
52
54
|
"jest": "^27.0.6",
|
|
55
|
+
"jest-file-snapshot": "^0.5.0",
|
|
53
56
|
"next": "9.4.2",
|
|
54
57
|
"react": "16.14.0",
|
|
55
58
|
"react-dom": "16.14.0",
|
|
@@ -1,258 +0,0 @@
|
|
|
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
|
-
required?: false;
|
|
148
|
-
/**
|
|
149
|
-
* templates can either be an array of Tina templates or a reference to
|
|
150
|
-
* global template definition.
|
|
151
|
-
*
|
|
152
|
-
* You should use `templates` when your object can be any one of multiple shapes (polymorphic)
|
|
153
|
-
*
|
|
154
|
-
* You can only provide one of `fields` or `template`, but not both
|
|
155
|
-
*/
|
|
156
|
-
templates: (string | Template<WithNamespace>)[];
|
|
157
|
-
fields?: undefined;
|
|
158
|
-
}
|
|
159
|
-
interface ObjectTemplatesWithNamespace<WithNamespace extends boolean> extends TinaField {
|
|
160
|
-
type: 'object';
|
|
161
|
-
required?: false;
|
|
162
|
-
/**
|
|
163
|
-
* templates can either be an array of Tina templates or a reference to
|
|
164
|
-
* global template definition.
|
|
165
|
-
*
|
|
166
|
-
* You should use `templates` when your object can be any one of multiple shapes (polymorphic)
|
|
167
|
-
*
|
|
168
|
-
* You can only provide one of `fields` or `template`, but not both
|
|
169
|
-
*/
|
|
170
|
-
templates: (string | Template<WithNamespace>)[];
|
|
171
|
-
fields?: undefined;
|
|
172
|
-
namespace: WithNamespace extends true ? string[] : undefined;
|
|
173
|
-
}
|
|
174
|
-
declare type ObjectFields<WithNamespace extends boolean> = WithNamespace extends true ? InnerObjectFieldsWithNamespace<WithNamespace> : InnerObjectFields<WithNamespace>;
|
|
175
|
-
interface InnerObjectFields<WithNamespace extends boolean> extends TinaField {
|
|
176
|
-
type: 'object';
|
|
177
|
-
required?: false;
|
|
178
|
-
/**
|
|
179
|
-
* fields can either be an array of Tina fields, or a reference to the fields
|
|
180
|
-
* of a global template definition.
|
|
181
|
-
*
|
|
182
|
-
* You can only provide one of `fields` or `templates`, but not both.
|
|
183
|
-
*/
|
|
184
|
-
fields: string | TinaFieldInner<WithNamespace>[];
|
|
185
|
-
templates?: undefined;
|
|
186
|
-
}
|
|
187
|
-
interface InnerObjectFieldsWithNamespace<WithNamespace extends boolean> extends TinaField {
|
|
188
|
-
type: 'object';
|
|
189
|
-
required?: false;
|
|
190
|
-
/**
|
|
191
|
-
* fields can either be an array of Tina fields, or a reference to the fields
|
|
192
|
-
* of a global template definition.
|
|
193
|
-
*
|
|
194
|
-
* You can only provide one of `fields` or `templates`, but not both.
|
|
195
|
-
*/
|
|
196
|
-
fields: string | TinaFieldInner<WithNamespace>[];
|
|
197
|
-
templates?: undefined;
|
|
198
|
-
namespace: WithNamespace extends true ? string[] : undefined;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Global Templates are defined once, and can be used anywhere by referencing the 'name' of the template
|
|
202
|
-
*
|
|
203
|
-
* TODO: ensure we don't permit infite loop with self-references
|
|
204
|
-
*/
|
|
205
|
-
export declare type GlobalTemplate<WithNamespace extends boolean> = WithNamespace extends true ? {
|
|
206
|
-
label: string;
|
|
207
|
-
name: string;
|
|
208
|
-
ui?: object;
|
|
209
|
-
fields: TinaFieldInner<WithNamespace>[];
|
|
210
|
-
namespace: WithNamespace extends true ? string[] : undefined;
|
|
211
|
-
} : {
|
|
212
|
-
label: string;
|
|
213
|
-
name: string;
|
|
214
|
-
ui?: object;
|
|
215
|
-
fields: TinaFieldInner<WithNamespace>[];
|
|
216
|
-
};
|
|
217
|
-
export declare type TinaCloudTemplateBase = GlobalTemplate<false>;
|
|
218
|
-
export declare type TinaCloudTemplateEnriched = GlobalTemplate<true>;
|
|
219
|
-
/**
|
|
220
|
-
* Templates allow you to define an object as polymorphic
|
|
221
|
-
*/
|
|
222
|
-
export declare type Template<WithNamespace extends boolean> = WithNamespace extends true ? {
|
|
223
|
-
label: string;
|
|
224
|
-
name: string;
|
|
225
|
-
fields: TinaFieldInner<WithNamespace>[];
|
|
226
|
-
ui?: object;
|
|
227
|
-
namespace: WithNamespace extends true ? string[] : undefined;
|
|
228
|
-
} : {
|
|
229
|
-
label: string;
|
|
230
|
-
name: string;
|
|
231
|
-
ui?: object;
|
|
232
|
-
fields: TinaFieldInner<WithNamespace>[];
|
|
233
|
-
};
|
|
234
|
-
export declare type CollectionTemplateableUnion = {
|
|
235
|
-
namespace: string[];
|
|
236
|
-
type: 'union';
|
|
237
|
-
templates: Templateable[];
|
|
238
|
-
};
|
|
239
|
-
export declare type CollectionTemplateableObject = {
|
|
240
|
-
namespace: string[];
|
|
241
|
-
type: 'object';
|
|
242
|
-
required?: false;
|
|
243
|
-
template: Templateable;
|
|
244
|
-
};
|
|
245
|
-
export declare type CollectionTemplateable = CollectionTemplateableUnion | CollectionTemplateableObject;
|
|
246
|
-
export declare type Collectable = {
|
|
247
|
-
namespace: string[];
|
|
248
|
-
templates?: (string | Templateable)[];
|
|
249
|
-
fields?: string | TinaFieldEnriched[];
|
|
250
|
-
references?: ReferenceType<true>[];
|
|
251
|
-
};
|
|
252
|
-
export declare type Templateable = {
|
|
253
|
-
name: string;
|
|
254
|
-
namespace: string[];
|
|
255
|
-
fields: TinaFieldEnriched[];
|
|
256
|
-
ui?: object;
|
|
257
|
-
};
|
|
258
|
-
export {};
|