@tinacms/schema-tools 0.0.0-202222115457

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 ADDED
@@ -0,0 +1,31 @@
1
+ # @tinacms/schema-tools
2
+
3
+ ## 0.0.0-202222115457
4
+ ### Patch Changes
5
+
6
+ - abf25c673: The schema can now to used on the frontend (optional for now but will be the main path moving forward).
7
+
8
+ ### How to migrate.
9
+
10
+ If you gone though the `tinacms init` process there should be a file called `.tina/components/TinaProvider`. In that file you can import the schema from `schema.ts` and add it to the TinaCMS wrapper component.
11
+
12
+ ```tsx
13
+ import TinaCMS from 'tinacms'
14
+ import schema, { tinaConfig } from '../schema.ts'
15
+
16
+ // Importing the TinaProvider directly into your page will cause Tina to be added to the production bundle.
17
+ // Instead, import the tina/provider/index default export to have it dynamially imported in edit-moode
18
+ /**
19
+ *
20
+ * @private Do not import this directly, please import the dynamic provider instead
21
+ */
22
+ const TinaProvider = ({ children }) => {
23
+ return (
24
+ <TinaCMS {...tinaConfig} schema={schema}>
25
+ {children}
26
+ </TinaCMS>
27
+ )
28
+ }
29
+
30
+ export default TinaProvider
31
+ ```
@@ -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
+ export * from './schema';
14
+ export * from './types';
package/dist/index.js ADDED
@@ -0,0 +1,453 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ var __export = (target, all) => {
38
+ __markAsModule(target);
39
+ for (var name in all)
40
+ __defProp(target, name, { get: all[name], enumerable: true });
41
+ };
42
+ var __reExport = (target, module2, desc) => {
43
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
44
+ for (let key of __getOwnPropNames(module2))
45
+ if (!__hasOwnProp.call(target, key) && key !== "default")
46
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
47
+ }
48
+ return target;
49
+ };
50
+ var __toModule = (module2) => {
51
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
52
+ };
53
+
54
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/index.ts
55
+ __export(exports, {
56
+ TinaSchema: () => TinaSchema,
57
+ addNamespaceToSchema: () => addNamespaceToSchema,
58
+ resolveField: () => resolveField,
59
+ resolveForm: () => resolveForm
60
+ });
61
+
62
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/schema/addNamespaceToSchema.ts
63
+ function addNamespaceToSchema(maybeNode, namespace = []) {
64
+ if (typeof maybeNode === "string") {
65
+ return maybeNode;
66
+ }
67
+ if (typeof maybeNode === "boolean") {
68
+ return maybeNode;
69
+ }
70
+ const newNode = maybeNode;
71
+ const keys = Object.keys(maybeNode);
72
+ Object.values(maybeNode).map((m, index) => {
73
+ const key = keys[index];
74
+ if (Array.isArray(m)) {
75
+ newNode[key] = m.map((element) => {
76
+ if (!element) {
77
+ return;
78
+ }
79
+ if (!element.hasOwnProperty("name")) {
80
+ return element;
81
+ }
82
+ const value = element.name || element.value;
83
+ return addNamespaceToSchema(element, [...namespace, value]);
84
+ });
85
+ } else {
86
+ if (!m) {
87
+ return;
88
+ }
89
+ if (!m.hasOwnProperty("name")) {
90
+ newNode[key] = m;
91
+ } else {
92
+ newNode[key] = addNamespaceToSchema(m, [...namespace, m.name]);
93
+ }
94
+ }
95
+ });
96
+ return __spreadProps(__spreadValues({}, newNode), { namespace });
97
+ }
98
+
99
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/util/validate.ts
100
+ var yup = __toModule(require("yup"));
101
+ function assertShape(value, yupSchema, errorMessage) {
102
+ const shape = yupSchema(yup);
103
+ try {
104
+ shape.validateSync(value);
105
+ } catch (e) {
106
+ const message = errorMessage || `Failed to assertShape - ${e.message}`;
107
+ throw new Error(message);
108
+ }
109
+ }
110
+
111
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/util/lastItem.ts
112
+ var lastItem = (arr) => {
113
+ if (typeof arr === "undefined") {
114
+ throw new Error("Can not call lastItem when arr is undefined");
115
+ }
116
+ return arr[arr.length - 1];
117
+ };
118
+
119
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/util/namer.ts
120
+ var capitalize = (s) => {
121
+ if (typeof s !== "string")
122
+ return "";
123
+ return s.charAt(0).toUpperCase() + s.slice(1);
124
+ };
125
+ var generateNamespacedFieldName = (names, suffix = "") => {
126
+ return (suffix ? [...names, suffix] : names).map(capitalize).join("");
127
+ };
128
+ var NAMER = {
129
+ dataFilterTypeNameOn: (namespace) => {
130
+ return generateNamespacedFieldName(namespace, "_FilterOn");
131
+ },
132
+ dataFilterTypeName: (namespace) => {
133
+ return generateNamespacedFieldName(namespace, "Filter");
134
+ },
135
+ dataMutationTypeNameOn: (namespace) => {
136
+ return generateNamespacedFieldName(namespace, "_MutationOn");
137
+ },
138
+ dataMutationTypeName: (namespace) => {
139
+ return generateNamespacedFieldName(namespace, "Mutation");
140
+ },
141
+ updateName: (namespace) => {
142
+ return "update" + generateNamespacedFieldName(namespace, "Document");
143
+ },
144
+ createName: (namespace) => {
145
+ return "create" + generateNamespacedFieldName(namespace, "Document");
146
+ },
147
+ queryName: (namespace) => {
148
+ return "get" + generateNamespacedFieldName(namespace, "Document");
149
+ },
150
+ generateQueryListName: (namespace) => {
151
+ return "get" + generateNamespacedFieldName(namespace, "List");
152
+ },
153
+ fragmentName: (namespace) => {
154
+ return generateNamespacedFieldName(namespace, "") + "Parts";
155
+ },
156
+ collectionTypeName: (namespace) => {
157
+ return generateNamespacedFieldName(namespace, "Collection");
158
+ },
159
+ documentTypeName: (namespace) => {
160
+ return generateNamespacedFieldName(namespace, "Document");
161
+ },
162
+ dataTypeName: (namespace) => {
163
+ return generateNamespacedFieldName(namespace, "");
164
+ },
165
+ referenceConnectionType: (namespace) => {
166
+ return generateNamespacedFieldName(namespace, "Connection");
167
+ },
168
+ referenceConnectionEdgesTypeName: (namespace) => {
169
+ return generateNamespacedFieldName(namespace, "ConnectionEdges");
170
+ }
171
+ };
172
+
173
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/schema/TinaSchema.ts
174
+ var TinaSchema = class {
175
+ constructor(config) {
176
+ this.config = config;
177
+ this.getCollectionsByName = (collectionNames) => {
178
+ return this.schema.collections.filter((collection) => collectionNames.includes(collection.name));
179
+ };
180
+ this.getAllCollectionPaths = () => {
181
+ const paths = this.getCollections().map((collection) => `${collection.path}${collection.match || ""}`);
182
+ return paths;
183
+ };
184
+ this.getCollection = (collectionName) => {
185
+ const collection = this.schema.collections.find((collection2) => collection2.name === collectionName);
186
+ if (!collection) {
187
+ throw new Error(`Expected to find collection named ${collectionName}`);
188
+ }
189
+ const extraFields = {};
190
+ const templateInfo = this.getTemplatesForCollectable(collection);
191
+ switch (templateInfo.type) {
192
+ case "object":
193
+ extraFields["fields"] = templateInfo.template.fields;
194
+ break;
195
+ case "union":
196
+ extraFields["templates"] = templateInfo.templates;
197
+ break;
198
+ }
199
+ return __spreadProps(__spreadValues(__spreadValues({
200
+ slug: collection.name
201
+ }, extraFields), collection), {
202
+ format: collection.format || "md"
203
+ });
204
+ };
205
+ this.getCollections = () => {
206
+ return this.schema.collections.map((collection) => this.getCollection(collection.name)) || [];
207
+ };
208
+ this.getGlobalTemplate = (templateName) => {
209
+ var _a;
210
+ const globalTemplate = (_a = this.schema.templates) == null ? void 0 : _a.find((template) => template.name === templateName);
211
+ if (!globalTemplate) {
212
+ throw new Error(`Expected to find global template of name ${templateName}`);
213
+ }
214
+ return globalTemplate;
215
+ };
216
+ this.getCollectionByFullPath = async (filepath) => {
217
+ const collection = this.getCollections().find((collection2) => {
218
+ return filepath.replace("\\", "/").startsWith(collection2.path);
219
+ });
220
+ if (!collection) {
221
+ throw new Error(`Unable to find collection for file at ${filepath}`);
222
+ }
223
+ return collection;
224
+ };
225
+ this.getCollectionAndTemplateByFullPath = (filepath, templateName) => {
226
+ let template;
227
+ const collection = this.getCollections().find((collection2) => {
228
+ return filepath.replace("\\", "/").startsWith(collection2.path);
229
+ });
230
+ if (!collection) {
231
+ throw new Error(`Unable to find collection for file at ${filepath}`);
232
+ }
233
+ const templates = this.getTemplatesForCollectable(collection);
234
+ if (templates.type === "union") {
235
+ if (templateName) {
236
+ template = templates.templates.find((template2) => lastItem(template2.namespace) === templateName);
237
+ if (!template) {
238
+ throw new Error(`Unable to determine template for item at ${filepath}`);
239
+ }
240
+ } else {
241
+ throw new Error(`Unable to determine template for item at ${filepath}, no template name provided for collection with multiple templates`);
242
+ }
243
+ }
244
+ if (templates.type === "object") {
245
+ template = templates.template;
246
+ }
247
+ if (!template) {
248
+ throw new Error(`Something went wrong while trying to determine template for ${filepath}`);
249
+ }
250
+ return { collection, template };
251
+ };
252
+ this.getTemplateForData = ({
253
+ data,
254
+ collection
255
+ }) => {
256
+ const templateInfo = this.getTemplatesForCollectable(collection);
257
+ switch (templateInfo.type) {
258
+ case "object":
259
+ return templateInfo.template;
260
+ case "union":
261
+ assertShape(data, (yup2) => yup2.object({ _template: yup2.string().required() }));
262
+ const template = templateInfo.templates.find((template2) => template2.namespace[template2.namespace.length - 1] === data._template);
263
+ if (!template) {
264
+ throw new Error(`Expected to find template named '${data._template}' for collection '${lastItem(collection.namespace)}'`);
265
+ }
266
+ return template;
267
+ }
268
+ };
269
+ this.isMarkdownCollection = (collectionName) => {
270
+ const collection = this.getCollection(collectionName);
271
+ const format = collection.format;
272
+ if (!format) {
273
+ return true;
274
+ }
275
+ if (["markdown", "md"].includes(format)) {
276
+ return true;
277
+ }
278
+ return false;
279
+ };
280
+ this.getTemplatesForCollectable = (collection) => {
281
+ let extraFields = [];
282
+ if (collection.references) {
283
+ extraFields = collection.references;
284
+ }
285
+ if (collection.fields) {
286
+ const template = typeof collection.fields === "string" ? this.getGlobalTemplate(collection.fields) : collection;
287
+ if (typeof template.fields === "string" || typeof template.fields === "undefined") {
288
+ throw new Error("Exptected template to have fields but none were found");
289
+ }
290
+ return {
291
+ namespace: collection.namespace,
292
+ type: "object",
293
+ template: __spreadProps(__spreadValues({}, template), {
294
+ fields: [...template.fields, ...extraFields]
295
+ })
296
+ };
297
+ } else {
298
+ if (collection.templates) {
299
+ return {
300
+ namespace: collection.namespace,
301
+ type: "union",
302
+ templates: collection.templates.map((templateOrTemplateString) => {
303
+ const template = typeof templateOrTemplateString === "string" ? this.getGlobalTemplate(templateOrTemplateString) : templateOrTemplateString;
304
+ return __spreadProps(__spreadValues({}, template), {
305
+ fields: [...template.fields, ...extraFields]
306
+ });
307
+ })
308
+ };
309
+ } else {
310
+ throw new Error(`Expected either fields or templates array to be defined on collection ${collection.namespace.join("_")}`);
311
+ }
312
+ }
313
+ };
314
+ this.schema = config;
315
+ }
316
+ };
317
+
318
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/schema/resolveField.ts
319
+ var resolveField = (_a, schema) => {
320
+ var _b = _a, { namespace } = _b, field = __objRest(_b, ["namespace"]);
321
+ var _a2;
322
+ const extraFields = field.ui || {};
323
+ switch (field.type) {
324
+ case "number":
325
+ return __spreadValues(__spreadValues({
326
+ component: "number"
327
+ }, field), extraFields);
328
+ case "datetime":
329
+ return __spreadValues(__spreadValues({
330
+ component: "date"
331
+ }, field), extraFields);
332
+ case "boolean":
333
+ return __spreadValues(__spreadValues({
334
+ component: "toggle"
335
+ }, field), extraFields);
336
+ case "image":
337
+ return __spreadValues(__spreadValues({
338
+ component: "image",
339
+ clearable: true
340
+ }, field), extraFields);
341
+ case "string":
342
+ if (field.options) {
343
+ if (field.list) {
344
+ return __spreadProps(__spreadValues(__spreadValues({
345
+ component: "checkbox-group"
346
+ }, field), extraFields), {
347
+ options: field.options
348
+ });
349
+ }
350
+ return __spreadProps(__spreadValues(__spreadValues({
351
+ component: "select"
352
+ }, field), extraFields), {
353
+ options: [{ label: `Choose an option`, value: "" }, ...field.options]
354
+ });
355
+ }
356
+ if (field.list) {
357
+ return __spreadValues(__spreadValues({
358
+ component: "list",
359
+ field: {
360
+ component: "text"
361
+ }
362
+ }, field), extraFields);
363
+ }
364
+ return __spreadValues(__spreadValues({
365
+ component: "text"
366
+ }, field), extraFields);
367
+ case "object":
368
+ const templateInfo = schema.getTemplatesForCollectable(__spreadProps(__spreadValues({}, field), {
369
+ namespace
370
+ }));
371
+ if (templateInfo.type === "object") {
372
+ return __spreadValues(__spreadProps(__spreadValues({}, field), {
373
+ component: field.list ? "group-list" : "group",
374
+ fields: templateInfo.template.fields.map((field2) => resolveField(field2, schema))
375
+ }), extraFields);
376
+ } else if (templateInfo.type === "union") {
377
+ const templates2 = {};
378
+ const typeMap2 = {};
379
+ templateInfo.templates.forEach((template) => {
380
+ const extraFields2 = template.ui || {};
381
+ const templateName = lastItem(template.namespace);
382
+ typeMap2[templateName] = NAMER.dataTypeName(template.namespace);
383
+ templates2[lastItem(template.namespace)] = __spreadValues({
384
+ label: template.label || templateName,
385
+ key: templateName,
386
+ fields: template.fields.map((field2) => resolveField(field2, schema))
387
+ }, extraFields2);
388
+ return true;
389
+ });
390
+ return __spreadValues(__spreadProps(__spreadValues({}, field), {
391
+ typeMap: typeMap2,
392
+ component: field.list ? "blocks" : "not-implemented",
393
+ templates: templates2
394
+ }), extraFields);
395
+ } else {
396
+ throw new Error(`Unknown object for resolveField function`);
397
+ }
398
+ case "rich-text":
399
+ const templates = {};
400
+ const typeMap = {};
401
+ (_a2 = field.templates) == null ? void 0 : _a2.forEach((template) => {
402
+ if (typeof template === "string") {
403
+ throw new Error(`Global templates not yet supported for rich-text`);
404
+ } else {
405
+ const extraFields2 = template.ui || {};
406
+ const templateName = lastItem(template.namespace);
407
+ typeMap[templateName] = NAMER.dataTypeName(template.namespace);
408
+ templates[lastItem(template.namespace)] = __spreadValues({
409
+ label: template.label || templateName,
410
+ key: templateName,
411
+ inline: template.inline,
412
+ name: templateName,
413
+ fields: template.fields.map((field2) => resolveField(field2, schema))
414
+ }, extraFields2);
415
+ return true;
416
+ }
417
+ });
418
+ return __spreadValues(__spreadProps(__spreadValues({}, field), {
419
+ templates: Object.values(templates),
420
+ component: "rich-text"
421
+ }), extraFields);
422
+ case "reference":
423
+ return __spreadValues(__spreadProps(__spreadValues({}, field), {
424
+ component: "reference"
425
+ }), extraFields);
426
+ default:
427
+ throw new Error(`Unknown field type ${field.type}`);
428
+ }
429
+ };
430
+
431
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/schema/resolveForm.ts
432
+ var resolveForm = ({
433
+ collection,
434
+ basename,
435
+ template,
436
+ schema
437
+ }) => {
438
+ return {
439
+ id: basename,
440
+ label: collection.label,
441
+ name: basename,
442
+ fields: template.fields.map((field) => {
443
+ return resolveField(field, schema);
444
+ })
445
+ };
446
+ };
447
+ // Annotate the CommonJS export names for ESM import in node:
448
+ 0 && (module.exports = {
449
+ TinaSchema,
450
+ addNamespaceToSchema,
451
+ resolveField,
452
+ resolveForm
453
+ });
@@ -0,0 +1,80 @@
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 { TinaCloudSchemaEnriched, TinaCloudSchemaBase, TinaCloudCollection, Templateable, Collectable, CollectionTemplateable } from '../types';
14
+ declare type Version = {
15
+ fullVersion: string;
16
+ major: string;
17
+ minor: string;
18
+ patch: string;
19
+ };
20
+ declare type Meta = {
21
+ flags?: string[];
22
+ };
23
+ /**
24
+ * TinaSchema is responsible for allowing you to look up certain
25
+ * properties of the user-provided schema with ease.
26
+ *
27
+ */
28
+ export declare class TinaSchema {
29
+ config: {
30
+ version?: Version;
31
+ meta?: Meta;
32
+ } & TinaCloudSchemaBase;
33
+ schema: TinaCloudSchemaEnriched;
34
+ /**
35
+ *
36
+ * Create a schema class from a user defined schema object
37
+ *
38
+ * @param {{version?:Version;meta?:Meta}&TinaCloudSchemaBase} config
39
+ */
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 | (import("../types").UIField<any, any> & {
52
+ previewSrc: string;
53
+ });
54
+ fields: import("../types").TinaFieldInner<true>[];
55
+ namespace: string[];
56
+ };
57
+ getCollectionByFullPath: (filepath: string) => Promise<TinaCloudCollection<true>>;
58
+ getCollectionAndTemplateByFullPath: (filepath: string, templateName?: string) => {
59
+ collection: TinaCloudCollection<true>;
60
+ template: Templateable;
61
+ };
62
+ getTemplateForData: ({ data, collection, }: {
63
+ data?: unknown;
64
+ collection: Collectable;
65
+ }) => Templateable;
66
+ isMarkdownCollection: (collectionName: string) => boolean;
67
+ /**
68
+ * Gets the template or templates from the item.
69
+ * Both `object` fields and collections support
70
+ * the ability for an object to be polymorphic,
71
+ * and if it is, we need to build unions, which
72
+ * are more of a headache for non-polymorphic
73
+ * needs, so we also need the ability to just
74
+ * build object types
75
+ *
76
+ *
77
+ */
78
+ getTemplatesForCollectable: (collection: Collectable) => CollectionTemplateable;
79
+ }
80
+ export {};
@@ -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 function addNamespaceToSchema<T extends object | string>(maybeNode: T, namespace?: string[]): T;
@@ -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
+ export * from './addNamespaceToSchema';
14
+ export * from './TinaSchema';
15
+ export * from './resolveField';
16
+ export * from './resolveForm';
@@ -0,0 +1,24 @@
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 { TinaFieldEnriched } from '../types';
14
+ import { TinaSchema } from './TinaSchema';
15
+ /**
16
+ *
17
+ * Turns a field the schema (schema.{js,ts} file) into a valid front end FieldConfig
18
+ *
19
+ *
20
+ * @param {TinaFieldEnriched} field. The field that will be transformed
21
+ * @param {TinaSchema} schema the entireT Tina Schema
22
+ * @returns unknown
23
+ */
24
+ export declare const resolveField: ({ namespace, ...field }: TinaFieldEnriched, schema: TinaSchema) => unknown;
@@ -0,0 +1,22 @@
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 { ResolveFormArgs } from '../types';
14
+ /**
15
+ * Given a collection, basename, template and schema. This will transform the given information into a valid frontend form config
16
+ */
17
+ export declare const resolveForm: ({ collection, basename, template, schema, }: ResolveFormArgs) => {
18
+ id: string;
19
+ label: string;
20
+ name: string;
21
+ fields: unknown[];
22
+ };
@@ -0,0 +1,342 @@
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 type { FC } from 'react';
15
+ export declare type UIField<F extends UIField = any, Shape = any> = {
16
+ label?: string;
17
+ description?: string;
18
+ component?: FC<any> | string | null;
19
+ parse?: (value: Shape, name: string, field: F) => any;
20
+ format?: (value: Shape, name: string, field: F) => any;
21
+ validate?(value: Shape, allValues: any, meta: any, field: UIField<F, Shape>): string | object | undefined | void;
22
+ defaultValue?: Shape;
23
+ };
24
+ export interface TinaCloudSchema<WithNamespace extends boolean> {
25
+ templates?: GlobalTemplate<WithNamespace>[];
26
+ collections: TinaCloudCollection<WithNamespace>[];
27
+ }
28
+ export declare type TinaCloudSchemaBase = TinaCloudSchema<false>;
29
+ export declare type TinaCloudSchemaEnriched = TinaCloudSchema<true>;
30
+ /**
31
+ * As part of the build process, each node is given a `path: string[]` key
32
+ * to help with namespacing type names, this is added as part of the
33
+ * createTinaSchema step
34
+ */
35
+ export interface TinaCloudSchemaWithNamespace {
36
+ templates?: GlobalTemplate<true>[];
37
+ collections: TinaCloudCollection<true>[];
38
+ namespace: string[];
39
+ }
40
+ export declare type TinaCloudCollection<WithNamespace extends boolean> = CollectionFields<WithNamespace> | CollectionTemplates<WithNamespace>;
41
+ export declare type TinaCloudCollectionBase = TinaCloudCollection<false>;
42
+ export declare type TinaCloudCollectionEnriched = TinaCloudCollection<true>;
43
+ declare type FormatType = 'json' | 'md' | 'markdown' | 'mdx';
44
+ interface BaseCollection {
45
+ label?: string;
46
+ name: string;
47
+ path: string;
48
+ format?: FormatType;
49
+ match?: string;
50
+ }
51
+ declare type CollectionTemplates<WithNamespace extends boolean> = WithNamespace extends true ? CollectionTemplatesWithNamespace<WithNamespace> : CollectionTemplatesInner<WithNamespace>;
52
+ interface CollectionTemplatesInner<WithNamespace extends boolean> extends BaseCollection {
53
+ templates: (string | Template<WithNamespace>)[];
54
+ fields?: undefined;
55
+ }
56
+ export interface CollectionTemplatesWithNamespace<WithNamespace extends boolean> extends BaseCollection {
57
+ templates: (string | Template<WithNamespace>)[];
58
+ fields?: undefined;
59
+ references?: ReferenceType<WithNamespace>[];
60
+ namespace: WithNamespace extends true ? string[] : undefined;
61
+ }
62
+ declare type CollectionFields<WithNamespace extends boolean> = WithNamespace extends true ? CollectionFieldsWithNamespace<WithNamespace> : CollectionFieldsInner<WithNamespace>;
63
+ export interface CollectionFieldsWithNamespace<WithNamespace extends boolean> extends BaseCollection {
64
+ fields: string | TinaFieldInner<WithNamespace>[];
65
+ templates?: undefined;
66
+ references?: ReferenceType<WithNamespace>[];
67
+ namespace: string[];
68
+ }
69
+ interface CollectionFieldsInner<WithNamespace extends boolean> extends BaseCollection {
70
+ fields: string | TinaFieldInner<WithNamespace>[];
71
+ templates?: undefined;
72
+ }
73
+ export declare type TinaFieldInner<WithNamespace extends boolean> = ScalarType<WithNamespace> | ObjectType<WithNamespace> | ReferenceType<WithNamespace> | RichType<WithNamespace>;
74
+ export declare type TinaFieldBase = TinaFieldInner<false>;
75
+ export declare type TinaFieldEnriched = TinaFieldInner<true>;
76
+ interface TinaField {
77
+ name: string;
78
+ label?: string;
79
+ description?: string;
80
+ required?: boolean;
81
+ /**
82
+ * Any items passed to the UI field will be passed to the underlying field.
83
+ * NOTE: only serializable values are supported, so functions like `validate`
84
+ * will be ignored.
85
+ */
86
+ ui?: object;
87
+ }
88
+ declare type ScalarType<WithNamespace extends boolean> = WithNamespace extends true ? ScalarTypeWithNamespace : ScalarTypeInner;
89
+ declare type Option = string | {
90
+ label: string;
91
+ value: string;
92
+ };
93
+ declare type ScalarTypeInner = TinaField & TinaScalarField & {
94
+ options?: Option[];
95
+ };
96
+ declare type ScalarTypeWithNamespace = TinaField & TinaScalarField & {
97
+ options?: Option[];
98
+ namespace: string[];
99
+ };
100
+ declare type TinaScalarField = StringField | BooleanField | DateTimeField | NumberField | ImageField;
101
+ declare type StringField = {
102
+ type: 'string';
103
+ isBody?: boolean;
104
+ list?: false;
105
+ ui?: UIField<any, string>;
106
+ } | {
107
+ type: 'string';
108
+ isBody?: boolean;
109
+ list: true;
110
+ ui?: UIField<any, string[]>;
111
+ };
112
+ declare type BooleanField = {
113
+ type: 'boolean';
114
+ list?: false;
115
+ ui?: object | UIField<any, boolean>;
116
+ } | {
117
+ type: 'boolean';
118
+ list: true;
119
+ ui?: object | UIField<any, boolean[]>;
120
+ };
121
+ declare type NumberField = {
122
+ type: 'number';
123
+ list?: false;
124
+ ui?: object | UIField<any, number>;
125
+ } | {
126
+ type: 'number';
127
+ list: true;
128
+ ui?: object | UIField<any, number[]>;
129
+ };
130
+ declare type DateTimeField = {
131
+ type: 'datetime';
132
+ dateFormat?: string;
133
+ timeFormat?: string;
134
+ list?: false;
135
+ ui?: object | UIField<any, string>;
136
+ } | {
137
+ type: 'datetime';
138
+ dateFormat?: string;
139
+ timeFormat?: string;
140
+ list: true;
141
+ ui?: object | UIField<any, string[]>;
142
+ };
143
+ declare type ImageField = {
144
+ type: 'image';
145
+ list?: false;
146
+ ui?: object | UIField<any, string>;
147
+ } | {
148
+ type: 'image';
149
+ list: true;
150
+ ui?: object | UIField<any, string[]>;
151
+ };
152
+ export declare type ReferenceType<WithNamespace extends boolean> = WithNamespace extends true ? ReferenceTypeWithNamespace : ReferenceTypeInner;
153
+ export declare type RichType<WithNamespace extends boolean> = WithNamespace extends true ? RichTypeWithNamespace : RichTypeInner;
154
+ export interface ReferenceTypeInner extends TinaField {
155
+ type: 'reference';
156
+ list?: boolean;
157
+ reverseLookup?: {
158
+ label: string;
159
+ name: string;
160
+ };
161
+ collections: string[];
162
+ }
163
+ export interface ReferenceTypeWithNamespace extends TinaField {
164
+ type: 'reference';
165
+ list?: boolean;
166
+ collections: string[];
167
+ reverseLookup?: {
168
+ label: string;
169
+ name: string;
170
+ };
171
+ namespace: string[];
172
+ }
173
+ export interface RichTypeWithNamespace extends TinaField {
174
+ type: 'rich-text';
175
+ namespace: string[];
176
+ isBody?: boolean;
177
+ list?: boolean;
178
+ templates?: (string | (Template<true> & {
179
+ inline?: boolean;
180
+ }))[];
181
+ }
182
+ export interface RichTypeInner extends TinaField {
183
+ type: 'rich-text';
184
+ isBody?: boolean;
185
+ list?: boolean;
186
+ templates?: (string | (Template<false> & {
187
+ inline?: boolean;
188
+ }))[];
189
+ }
190
+ export declare type ObjectType<WithNamespace extends boolean> = ObjectTemplates<WithNamespace> | ObjectFields<WithNamespace>;
191
+ declare type ObjectTemplates<WithNamespace extends boolean> = WithNamespace extends true ? ObjectTemplatesWithNamespace<WithNamespace> : ObjectTemplatesInner<WithNamespace>;
192
+ declare type ObjectTemplatesInner<WithNamespace extends boolean> = ObjectTemplatesInnerWithList<WithNamespace> | ObjectTemplatesInnerWithoutList<WithNamespace>;
193
+ interface ObjectTemplatesInnerWithList<WithNamespace extends boolean> extends ObjectTemplatesInnerBase<WithNamespace> {
194
+ list?: true;
195
+ ui?: object | ({
196
+ itemProps?(item: Record<string, any>): {
197
+ key?: string;
198
+ label?: string;
199
+ };
200
+ } & UIField<any, string>);
201
+ }
202
+ interface ObjectTemplatesInnerWithoutList<WithNamespace extends boolean> extends ObjectTemplatesInnerBase<WithNamespace> {
203
+ list?: false;
204
+ ui?: object | UIField<any, string>;
205
+ }
206
+ interface ObjectTemplatesInnerBase<WithNamespace extends boolean> extends TinaField {
207
+ type: 'object';
208
+ visualSelector?: boolean;
209
+ required?: false;
210
+ list?: boolean;
211
+ /**
212
+ * templates can either be an array of Tina templates or a reference to
213
+ * global template definition.
214
+ *
215
+ * You should use `templates` when your object can be any one of multiple shapes (polymorphic)
216
+ *
217
+ * You can only provide one of `fields` or `template`, but not both
218
+ */
219
+ templates: (string | Template<WithNamespace>)[];
220
+ fields?: undefined;
221
+ }
222
+ interface ObjectTemplatesWithNamespace<WithNamespace extends boolean> extends TinaField {
223
+ type: 'object';
224
+ visualSelector?: boolean;
225
+ required?: false;
226
+ list?: boolean;
227
+ /**
228
+ * templates can either be an array of Tina templates or a reference to
229
+ * global template definition.
230
+ *
231
+ * You should use `templates` when your object can be any one of multiple shapes (polymorphic)
232
+ *
233
+ * You can only provide one of `fields` or `template`, but not both
234
+ */
235
+ templates: (string | Template<WithNamespace>)[];
236
+ fields?: undefined;
237
+ namespace: WithNamespace extends true ? string[] : undefined;
238
+ }
239
+ declare type ObjectFields<WithNamespace extends boolean> = WithNamespace extends true ? InnerObjectFieldsWithNamespace<WithNamespace> : InnerObjectFields<WithNamespace>;
240
+ interface InnerObjectFields<WithNamespace extends boolean> extends TinaField {
241
+ type: 'object';
242
+ visualSelector?: boolean;
243
+ required?: false;
244
+ /**
245
+ * fields can either be an array of Tina fields, or a reference to the fields
246
+ * of a global template definition.
247
+ *
248
+ * You can only provide one of `fields` or `templates`, but not both.
249
+ */
250
+ fields: string | TinaFieldInner<WithNamespace>[];
251
+ templates?: undefined;
252
+ list?: boolean;
253
+ }
254
+ interface InnerObjectFieldsWithNamespace<WithNamespace extends boolean> extends TinaField {
255
+ type: 'object';
256
+ visualSelector?: boolean;
257
+ required?: false;
258
+ /**
259
+ * fields can either be an array of Tina fields, or a reference to the fields
260
+ * of a global template definition.
261
+ *
262
+ * You can only provide one of `fields` or `templates`, but not both.
263
+ */
264
+ fields: string | TinaFieldInner<WithNamespace>[];
265
+ templates?: undefined;
266
+ namespace: WithNamespace extends true ? string[] : undefined;
267
+ list?: boolean;
268
+ }
269
+ /**
270
+ * Global Templates are defined once, and can be used anywhere by referencing the 'name' of the template
271
+ *
272
+ * TODO: ensure we don't permit infite loop with self-references
273
+ */
274
+ export declare type GlobalTemplate<WithNamespace extends boolean> = WithNamespace extends true ? {
275
+ label: string;
276
+ name: string;
277
+ ui?: object | (UIField<any, any> & {
278
+ previewSrc: string;
279
+ });
280
+ fields: TinaFieldInner<WithNamespace>[];
281
+ namespace: WithNamespace extends true ? string[] : undefined;
282
+ } : {
283
+ label: string;
284
+ name: string;
285
+ ui?: object | (UIField<any, any> & {
286
+ previewSrc: string;
287
+ });
288
+ fields: TinaFieldInner<WithNamespace>[];
289
+ };
290
+ export declare type TinaCloudTemplateBase = GlobalTemplate<false>;
291
+ export declare type TinaCloudTemplateEnriched = GlobalTemplate<true>;
292
+ /**
293
+ * Templates allow you to define an object as polymorphic
294
+ */
295
+ export declare type Template<WithNamespace extends boolean> = WithNamespace extends true ? {
296
+ label: string;
297
+ name: string;
298
+ fields: TinaFieldInner<WithNamespace>[];
299
+ ui?: object | (UIField<any, any> & {
300
+ previewSrc: string;
301
+ });
302
+ namespace: WithNamespace extends true ? string[] : undefined;
303
+ } : {
304
+ label: string;
305
+ name: string;
306
+ ui?: object | (UIField<any, any> & {
307
+ previewSrc: string;
308
+ });
309
+ fields: TinaFieldInner<WithNamespace>[];
310
+ };
311
+ export declare type CollectionTemplateableUnion = {
312
+ namespace: string[];
313
+ type: 'union';
314
+ templates: Templateable[];
315
+ };
316
+ export declare type CollectionTemplateableObject = {
317
+ namespace: string[];
318
+ type: 'object';
319
+ visualSelector?: boolean;
320
+ required?: false;
321
+ template: Templateable;
322
+ };
323
+ export declare type CollectionTemplateable = CollectionTemplateableUnion | CollectionTemplateableObject;
324
+ export declare type Collectable = {
325
+ namespace: string[];
326
+ templates?: (string | Templateable)[];
327
+ fields?: string | TinaFieldEnriched[];
328
+ references?: ReferenceType<true>[];
329
+ };
330
+ export declare type Templateable = {
331
+ name: string;
332
+ namespace: string[];
333
+ fields: TinaFieldEnriched[];
334
+ ui?: object;
335
+ };
336
+ export declare type ResolveFormArgs = {
337
+ collection: TinaCloudCollection<true>;
338
+ basename: string;
339
+ template: Templateable;
340
+ schema: TinaSchema;
341
+ };
342
+ 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';
@@ -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
+ export * from './validate';
14
+ export * from './lastItem';
15
+ export * from './namer';
16
+ export * from './sequential';
@@ -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 lastItem: (arr: (number | string)[]) => string | number;
@@ -0,0 +1,28 @@
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 NAMER: {
14
+ dataFilterTypeNameOn: (namespace: string[]) => string;
15
+ dataFilterTypeName: (namespace: string[]) => string;
16
+ dataMutationTypeNameOn: (namespace: string[]) => string;
17
+ dataMutationTypeName: (namespace: string[]) => string;
18
+ updateName: (namespace: string[]) => string;
19
+ createName: (namespace: string[]) => string;
20
+ queryName: (namespace: string[]) => string;
21
+ generateQueryListName: (namespace: string[]) => string;
22
+ fragmentName: (namespace: string[]) => string;
23
+ collectionTypeName: (namespace: string[]) => string;
24
+ documentTypeName: (namespace: string[]) => string;
25
+ dataTypeName: (namespace: string[]) => string;
26
+ referenceConnectionType: (namespace: string[]) => string;
27
+ referenceConnectionEdgesTypeName: (namespace: string[]) => string;
28
+ };
@@ -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
+ /**
14
+ * Iterate through an array of promises sequentially, ensuring the order
15
+ * is preserved.
16
+ *
17
+ * ```js
18
+ * await sequential(templates, async (template) => {
19
+ * await doSomething(template)
20
+ * })
21
+ * ```
22
+ */
23
+ export declare const sequential: <A, B>(items: A[], callback: (args: A, idx: number) => Promise<B>) => Promise<B[]>;
@@ -0,0 +1,15 @@
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
+ import type { Schema } from 'yup';
15
+ export declare function assertShape<T extends unknown>(value: unknown, yupSchema: (args: typeof yup) => Schema<any, any>, errorMessage?: string): asserts value is T;
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@tinacms/schema-tools",
3
+ "version": "0.0.0-202222115457",
4
+ "main": "dist/index.js",
5
+ "typings": "dist/index.d.ts",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "license": "Apache-2.0",
10
+ "buildConfig": {
11
+ "entryPoints": [
12
+ {
13
+ "name": "src/index.ts",
14
+ "target": "node"
15
+ }
16
+ ]
17
+ },
18
+ "devDependencies": {
19
+ "@tinacms/scripts": "0.50.7",
20
+ "@types/yup": "^0.29.10",
21
+ "jest": "^27.0.6",
22
+ "react": "16.14.0",
23
+ "typescript": "^4.3.5"
24
+ },
25
+ "peerDependencies": {
26
+ "react": ">=16.14.0",
27
+ "yup": "^0.32.0"
28
+ },
29
+ "scripts": {
30
+ "build": "echo \"Run `yarn build` from the root of the repository instead\"",
31
+ "test": "jest --passWithNoTests",
32
+ "types": "yarn tsc",
33
+ "test-watch": "jest --passWithNoTests --watch",
34
+ "generate:schema": "yarn node scripts/generateSchema.js"
35
+ },
36
+ "publishConfig": {
37
+ "registry": "https://registry.npmjs.org"
38
+ },
39
+ "repository": {
40
+ "url": "https://github.com/tinacms/tinacms.git",
41
+ "directory": "packages/@tinacms/cli"
42
+ }
43
+ }