tinacms 0.66.4 → 0.66.7

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.
@@ -97,7 +97,8 @@ declare type QueryProviderProps = {
97
97
  /** The `data` from getStaticProps */
98
98
  data?: never;
99
99
  };
100
- export declare const TinaCMSProvider2: ({ query, documentCreatorCallback, formifyCallback, ...props }: QueryProviderProps & APIProviderProps & BaseProviderProps) => JSX.Element;
100
+ export declare type TinaCMSProviderDefaultProps = QueryProviderProps & APIProviderProps & BaseProviderProps;
101
+ export declare const TinaCMSProvider2: ({ query, documentCreatorCallback, formifyCallback, ...props }: TinaCMSProviderDefaultProps) => JSX.Element;
101
102
  export declare const TinaDataProvider: ({ children, formifyCallback, }: {
102
103
  children: any;
103
104
  formifyCallback: formifyCallback;
@@ -0,0 +1,258 @@
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 {};
@@ -0,0 +1,18 @@
1
+ /**
2
+
3
+ Copyright 2021 Forestry.io Holdings, Inc.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+
17
+ */
18
+ export * from './SchemaTypes';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "0.66.4",
3
+ "version": "0.66.7",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist"
@@ -21,10 +21,11 @@
21
21
  "test-watch": "jest --env=jsdom --passWithNoTests --watch"
22
22
  },
23
23
  "dependencies": {
24
+ "@graphql-tools/relay-operation-optimizer": "^6.4.1",
24
25
  "@headlessui/react": "^1.4.1",
25
26
  "@heroicons/react": "^1.0.4",
26
27
  "@tinacms/sharedctx": "0.1.0",
27
- "@tinacms/toolkit": "0.56.14",
28
+ "@tinacms/toolkit": "0.56.16",
28
29
  "crypto-js": "^4.0.0",
29
30
  "final-form": "4.20.1",
30
31
  "graphql": "^15.1.0",
@@ -36,10 +37,12 @@
36
37
  "yup": "^0.32.0"
37
38
  },
38
39
  "devDependencies": {
40
+ "@graphql-tools/utils": "^8.6.1",
39
41
  "@testing-library/jest-dom": "^5.11.9",
40
42
  "@testing-library/react": "^12.0.0",
43
+ "@testing-library/react-hooks": "^7.0.2",
41
44
  "@testing-library/user-event": "^12.7.0",
42
- "@tinacms/scripts": "0.50.6",
45
+ "@tinacms/scripts": "0.50.7",
43
46
  "@types/jest": "^27.0.1",
44
47
  "@types/lodash": "^4.14.169",
45
48
  "@types/node": "^14.0.13",