@tinacms/schema-tools 1.2.1 → 1.3.1

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/LICENSE CHANGED
@@ -1,3 +1,11 @@
1
+ Copyright (c) 2023-present Forestry.io Holdings Inc.
2
+
3
+ Portions of the TinaCMS software are licensed as follows:
4
+
5
+ * All software that resides under the "packages/@tinacms/datalayer/" and the "packages/@tinacms/graphql/" directories (the "Tina Data Layer"), is licensed under the license defined in "packages/@tinacms/datalayer/LICENSE".
6
+
7
+ * All software outside of the above-mentioned directories is available under the "Apache 2.0" license as set forth below.
8
+
1
9
  Apache License
2
10
  Version 2.0, January 2004
3
11
  http://www.apache.org/licenses/
package/dist/index.d.ts CHANGED
@@ -1,16 +1,8 @@
1
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.
2
+
12
3
  */
13
4
  export * from './schema';
14
5
  export * from './types/index';
15
6
  export * from './validate';
16
7
  export * from './util/namer';
8
+ export * from './util/parseURL';
package/dist/index.es.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as yup from "yup";
2
+ import UrlPattern from "url-pattern";
2
3
  import z$1, { z, ZodError } from "zod";
3
4
  function addNamespaceToSchema(maybeNode, namespace = []) {
4
5
  if (typeof maybeNode === "string") {
@@ -114,6 +115,50 @@ function findDuplicates(array = []) {
114
115
  } else
115
116
  return void 0;
116
117
  }
118
+ const TINA_HOST = "content.tinajs.io";
119
+ const parseURL = (url) => {
120
+ if (url.startsWith("/")) {
121
+ return {
122
+ branch: null,
123
+ isLocalClient: false,
124
+ clientId: null,
125
+ host: null
126
+ };
127
+ }
128
+ if (url.includes("localhost")) {
129
+ return {
130
+ branch: null,
131
+ isLocalClient: true,
132
+ clientId: null,
133
+ host: "localhost"
134
+ };
135
+ }
136
+ const params = new URL(url);
137
+ const isTinaCloud = params.host.includes("tinajs.dev") || params.host.includes("tina.io") || params.host.includes("tinajs.io");
138
+ if (!isTinaCloud) {
139
+ return {
140
+ branch: null,
141
+ isLocalClient: true,
142
+ clientId: null,
143
+ host: params.host
144
+ };
145
+ }
146
+ const pattern = new UrlPattern("/content/:clientId/github/*", {
147
+ escapeChar: " "
148
+ });
149
+ const result = pattern.match(params.pathname);
150
+ const branch = result == null ? void 0 : result._;
151
+ const clientId = result == null ? void 0 : result.clientId;
152
+ if (!branch || !clientId) {
153
+ throw new Error(`Invalid URL format provided. Expected: https://content.tinajs.io/content/<ClientID>/github/<Branch> but but received ${url}`);
154
+ }
155
+ return {
156
+ host: params.host,
157
+ branch,
158
+ clientId,
159
+ isLocalClient: false
160
+ };
161
+ };
117
162
  class TinaSchema {
118
163
  constructor(config) {
119
164
  this.config = config;
@@ -765,7 +810,15 @@ const validateTinaCloudSchemaConfig = (config) => {
765
810
  const newConfig = tinaConfigZod.parse(config);
766
811
  return newConfig;
767
812
  };
768
- const FORMATS = ["json", "md", "markdown", "mdx", "toml", "yaml"];
813
+ const FORMATS = [
814
+ "json",
815
+ "md",
816
+ "markdown",
817
+ "mdx",
818
+ "toml",
819
+ "yaml",
820
+ "yml"
821
+ ];
769
822
  const Template = z.object({
770
823
  label: z.string({
771
824
  invalid_type_error: "label must be a string",
@@ -871,4 +924,4 @@ const validateSchema = ({
871
924
  }
872
925
  }
873
926
  };
874
- export { NAMER, TinaSchema, TinaSchemaValidationError, addNamespaceToSchema, resolveField, resolveForm, validateSchema, validateTinaCloudSchemaConfig };
927
+ export { NAMER, TINA_HOST, TinaSchema, TinaSchemaValidationError, addNamespaceToSchema, parseURL, resolveField, resolveForm, validateSchema, validateTinaCloudSchemaConfig };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("yup"), require("zod")) : typeof define === "function" && define.amd ? define(["exports", "yup", "zod"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@tinacms/schema-tools"] = {}, global.NOOP, global.NOOP));
3
- })(this, function(exports2, yup, z) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("yup"), require("url-pattern"), require("zod")) : typeof define === "function" && define.amd ? define(["exports", "yup", "url-pattern", "zod"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@tinacms/schema-tools"] = {}, global.NOOP, global.NOOP, global.NOOP));
3
+ })(this, function(exports2, yup, UrlPattern, z) {
4
4
  "use strict";
5
5
  function _interopDefaultLegacy(e) {
6
6
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
@@ -26,6 +26,7 @@
26
26
  return Object.freeze(n);
27
27
  }
28
28
  var yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
29
+ var UrlPattern__default = /* @__PURE__ */ _interopDefaultLegacy(UrlPattern);
29
30
  var z__default = /* @__PURE__ */ _interopDefaultLegacy(z);
30
31
  function addNamespaceToSchema(maybeNode, namespace = []) {
31
32
  if (typeof maybeNode === "string") {
@@ -141,6 +142,50 @@
141
142
  } else
142
143
  return void 0;
143
144
  }
145
+ const TINA_HOST = "content.tinajs.io";
146
+ const parseURL = (url) => {
147
+ if (url.startsWith("/")) {
148
+ return {
149
+ branch: null,
150
+ isLocalClient: false,
151
+ clientId: null,
152
+ host: null
153
+ };
154
+ }
155
+ if (url.includes("localhost")) {
156
+ return {
157
+ branch: null,
158
+ isLocalClient: true,
159
+ clientId: null,
160
+ host: "localhost"
161
+ };
162
+ }
163
+ const params = new URL(url);
164
+ const isTinaCloud = params.host.includes("tinajs.dev") || params.host.includes("tina.io") || params.host.includes("tinajs.io");
165
+ if (!isTinaCloud) {
166
+ return {
167
+ branch: null,
168
+ isLocalClient: true,
169
+ clientId: null,
170
+ host: params.host
171
+ };
172
+ }
173
+ const pattern = new UrlPattern__default["default"]("/content/:clientId/github/*", {
174
+ escapeChar: " "
175
+ });
176
+ const result = pattern.match(params.pathname);
177
+ const branch = result == null ? void 0 : result._;
178
+ const clientId = result == null ? void 0 : result.clientId;
179
+ if (!branch || !clientId) {
180
+ throw new Error(`Invalid URL format provided. Expected: https://content.tinajs.io/content/<ClientID>/github/<Branch> but but received ${url}`);
181
+ }
182
+ return {
183
+ host: params.host,
184
+ branch,
185
+ clientId,
186
+ isLocalClient: false
187
+ };
188
+ };
144
189
  class TinaSchema {
145
190
  constructor(config) {
146
191
  this.config = config;
@@ -792,7 +837,15 @@ ${JSON.stringify(val, null, 2)}
792
837
  const newConfig = tinaConfigZod.parse(config);
793
838
  return newConfig;
794
839
  };
795
- const FORMATS = ["json", "md", "markdown", "mdx", "toml", "yaml"];
840
+ const FORMATS = [
841
+ "json",
842
+ "md",
843
+ "markdown",
844
+ "mdx",
845
+ "toml",
846
+ "yaml",
847
+ "yml"
848
+ ];
796
849
  const Template = z.z.object({
797
850
  label: z.z.string({
798
851
  invalid_type_error: "label must be a string",
@@ -899,9 +952,11 @@ ${JSON.stringify(val, null, 2)}
899
952
  }
900
953
  };
901
954
  exports2.NAMER = NAMER;
955
+ exports2.TINA_HOST = TINA_HOST;
902
956
  exports2.TinaSchema = TinaSchema;
903
957
  exports2.TinaSchemaValidationError = TinaSchemaValidationError;
904
958
  exports2.addNamespaceToSchema = addNamespaceToSchema;
959
+ exports2.parseURL = parseURL;
905
960
  exports2.resolveField = resolveField;
906
961
  exports2.resolveForm = resolveForm;
907
962
  exports2.validateSchema = validateSchema;
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  import { TinaCloudSchemaEnriched, TinaCloudSchemaBase, TinaCloudCollection, Templateable, Collectable, CollectionTemplateable } from '../types/index';
14
5
  declare type Version = {
@@ -1,13 +1,4 @@
1
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.
2
+
12
3
  */
13
4
  export declare function addNamespaceToSchema<T extends object | string>(maybeNode: T, namespace?: string[]): T;
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  export * from './addNamespaceToSchema';
14
5
  export * from './TinaSchema';
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  import { TinaFieldEnriched } from '../types/index';
14
5
  import { TinaSchema } from './TinaSchema';
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  import type { ResolveFormArgs } from '../types/index';
14
5
  /**
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  import type { FC } from 'react';
14
5
  import { TinaSchema } from '../schema';
@@ -284,6 +275,12 @@ export interface RichTypeInner extends TinaField {
284
275
  type: 'rich-text';
285
276
  isBody?: boolean;
286
277
  list?: boolean;
278
+ parser?: {
279
+ type: 'markdown';
280
+ skipEscaping?: 'all' | 'html' | 'none';
281
+ } | {
282
+ type: 'mdx';
283
+ };
287
284
  templates?: (string | (Template<false> & {
288
285
  inline?: boolean;
289
286
  }))[];
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  export interface TinaCloudSchemaConfig<Store = any> {
14
5
  client?: {
@@ -1,18 +1,6 @@
1
1
  /**
2
2
 
3
- Copyright 2021 Forestry.io Holdings, Inc.
4
3
 
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
4
 
17
5
  */
18
6
  export * from './SchemaTypes';
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  import { Option, UICollection } from './SchemaTypes';
14
5
  /**
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  /**
14
5
  *
package/dist/types.d.ts CHANGED
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  declare type Doc = {
14
5
  _sys: {
@@ -278,6 +269,22 @@ export declare type RichTextField = (FieldGeneric<RichTextAst, undefined> | Fiel
278
269
  name?: string;
279
270
  };
280
271
  })[];
272
+ /**
273
+ * By default, Tina parses markdown with MDX, this is a more strict parser
274
+ * that allows you to use structured content inside markdown (via `templates`).
275
+ *
276
+ * Specify `"markdown"` if you're having problems with Tina parsing your content.
277
+ */
278
+ parser?: {
279
+ type: 'markdown';
280
+ /**
281
+ * Tina will escape entities like `<` and `[` by default. You can choose to turn
282
+ * off all escaping, or specify HTML, so `<div>` will not be turned into `\<div>`
283
+ */
284
+ skipEscaping?: 'all' | 'html' | 'none';
285
+ } | {
286
+ type: 'mdx';
287
+ };
281
288
  };
282
289
  declare type DefaultItem<ReturnType> = ReturnType | (() => ReturnType);
283
290
  declare type ObjectUiProps = {
@@ -333,7 +340,7 @@ export interface FieldCollection {
333
340
  label?: string;
334
341
  name: string;
335
342
  path: string;
336
- format?: 'json' | 'md' | 'markdown' | 'mdx' | 'yaml' | 'toml';
343
+ format?: 'json' | 'md' | 'markdown' | 'mdx' | 'yaml' | 'yml' | 'toml';
337
344
  /**
338
345
  * This format will be used to parse the markdown frontmatter
339
346
  */
@@ -361,7 +368,7 @@ export interface TemplateCollection {
361
368
  label?: string;
362
369
  name: string;
363
370
  path: string;
364
- format?: 'json' | 'md' | 'markdown' | 'mdx' | 'yaml' | 'toml';
371
+ format?: 'json' | 'md' | 'markdown' | 'mdx' | 'yaml' | 'yml' | 'toml';
365
372
  ui?: UICollection;
366
373
  /**
367
374
  * @deprecated - use `ui.defaultItem` on the each `template` instead
@@ -386,12 +393,47 @@ export interface Schema {
386
393
  }
387
394
  export declare type TokenObject = {
388
395
  id_token: string;
389
- access_token: string;
390
- refresh_token: string;
396
+ access_token?: string;
397
+ refresh_token?: string;
391
398
  };
392
399
  export interface Config<CMSCallback = undefined, FormifyCallback = undefined, DocumentCreatorCallback = undefined, Store = undefined> {
400
+ contentApiUrlOverride?: string;
393
401
  admin?: {
394
402
  auth?: {
403
+ /**
404
+ * If you wish to use the local auth provider, set this to true
405
+ *
406
+ * This will take precedence over the customAuth option (if set to true)
407
+ *
408
+ **/
409
+ useLocalAuth?: boolean;
410
+ /**
411
+ * If you are using a custom auth provider, set this to true
412
+ **/
413
+ customAuth?: boolean;
414
+ /**
415
+ * Used for getting the token from the custom auth provider
416
+ *
417
+ * @returns {Promise<TokenObject | null>}
418
+ **/
419
+ getToken?: () => Promise<TokenObject | null>;
420
+ /**
421
+ * Used to logout from the custom auth provider
422
+ *
423
+ **/
424
+ logout?: () => Promise<void>;
425
+ /**
426
+ * Used for getting the user from the custom auth provider. If this returns a truthy value, the user will be logged in and the CMS will be enabled.
427
+ *
428
+ * If this returns a falsy value, the user will be logged out and the CMS will be disabled.
429
+ *
430
+ **/
431
+ getUser?: () => Promise<any | null>;
432
+ /**
433
+ * Used to authenticate the user with the custom auth provider. This is called when the user clicks the login button.
434
+ *
435
+ **/
436
+ authenticate?: () => Promise<any | null>;
395
437
  onLogin?: (args: {
396
438
  token: TokenObject;
397
439
  }) => Promise<void>;
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  export declare function hasDuplicates<T = any>(array?: T[]): boolean;
14
5
  /**
@@ -1,17 +1,9 @@
1
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.
2
+
12
3
  */
13
4
  export * from './validate';
14
5
  export * from './lastItem';
15
6
  export * from './namer';
16
7
  export * from './sequential';
17
8
  export * from './hasDuplicates';
9
+ export * from './parseURL';
@@ -1,13 +1,4 @@
1
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.
2
+
12
3
  */
13
4
  export declare const lastItem: (arr: (number | string)[]) => string | number;
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  export declare const NAMER: {
14
5
  dataFilterTypeNameOn: (namespace: string[]) => string;
@@ -0,0 +1,10 @@
1
+ /**
2
+
3
+ */
4
+ export declare const TINA_HOST = "content.tinajs.io";
5
+ export declare const parseURL: (url: string) => {
6
+ branch: string | null;
7
+ isLocalClient: boolean;
8
+ clientId: string | null;
9
+ host: string | null;
10
+ };
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  import type { ZodError } from 'zod';
14
5
  export declare const parseZodError: ({ zodError }: {
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  /**
14
5
  * Iterate through an array of promises sequentially, ensuring the order
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  import * as yup from 'yup';
14
5
  import type { AnySchema } from 'yup';
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  import { z } from 'zod';
14
5
  import { TinaFieldInner } from '../types/SchemaTypes';
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  import { Schema } from '../types';
14
5
  import { TinaCloudSchema } from '../types/index';
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  import { z } from 'zod';
14
5
  export declare const name: z.ZodEffects<z.ZodString, string, string>;
@@ -1,21 +1,12 @@
1
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.
2
+
12
3
  */
13
4
  import { z } from 'zod';
14
5
  export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
15
6
  collections: z.ZodArray<z.ZodEffects<z.ZodObject<z.extendShape<{
16
7
  label: z.ZodOptional<z.ZodString>;
17
8
  name: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
18
- format: z.ZodOptional<z.ZodEnum<["json", "md", "markdown", "mdx", "toml", "yaml"]>>;
9
+ format: z.ZodOptional<z.ZodEnum<["json", "md", "markdown", "mdx", "toml", "yaml", "yml"]>>;
19
10
  }, {
20
11
  fields: z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodType<import("..").TinaFieldInner<false>, z.ZodTypeDef, import("..").TinaFieldInner<false>>, "many">>, import("..").TinaFieldInner<false>[], import("..").TinaFieldInner<false>[]>, import("..").TinaFieldInner<false>[], import("..").TinaFieldInner<false>[]>;
21
12
  templates: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
@@ -55,7 +46,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
55
46
  fields?: import("..").TinaFieldInner<false>[];
56
47
  label?: string;
57
48
  }[];
58
- format?: "json" | "md" | "markdown" | "mdx" | "yaml" | "toml";
49
+ format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
59
50
  label?: string;
60
51
  }, {
61
52
  name?: string;
@@ -65,7 +56,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
65
56
  fields?: import("..").TinaFieldInner<false>[];
66
57
  label?: string;
67
58
  }[];
68
- format?: "json" | "md" | "markdown" | "mdx" | "yaml" | "toml";
59
+ format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
69
60
  label?: string;
70
61
  }>, {
71
62
  name?: string;
@@ -75,7 +66,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
75
66
  fields?: import("..").TinaFieldInner<false>[];
76
67
  label?: string;
77
68
  }[];
78
- format?: "json" | "md" | "markdown" | "mdx" | "yaml" | "toml";
69
+ format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
79
70
  label?: string;
80
71
  }, {
81
72
  name?: string;
@@ -85,7 +76,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
85
76
  fields?: import("..").TinaFieldInner<false>[];
86
77
  label?: string;
87
78
  }[];
88
- format?: "json" | "md" | "markdown" | "mdx" | "yaml" | "toml";
79
+ format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
89
80
  label?: string;
90
81
  }>, "many">;
91
82
  config: z.ZodOptional<z.ZodObject<{
@@ -153,7 +144,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
153
144
  fields?: import("..").TinaFieldInner<false>[];
154
145
  label?: string;
155
146
  }[];
156
- format?: "json" | "md" | "markdown" | "mdx" | "yaml" | "toml";
147
+ format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
157
148
  label?: string;
158
149
  }[];
159
150
  config?: {
@@ -177,7 +168,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
177
168
  fields?: import("..").TinaFieldInner<false>[];
178
169
  label?: string;
179
170
  }[];
180
- format?: "json" | "md" | "markdown" | "mdx" | "yaml" | "toml";
171
+ format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
181
172
  label?: string;
182
173
  }[];
183
174
  config?: {
@@ -201,7 +192,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
201
192
  fields?: import("..").TinaFieldInner<false>[];
202
193
  label?: string;
203
194
  }[];
204
- format?: "json" | "md" | "markdown" | "mdx" | "yaml" | "toml";
195
+ format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
205
196
  label?: string;
206
197
  }[];
207
198
  config?: {
@@ -225,7 +216,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
225
216
  fields?: import("..").TinaFieldInner<false>[];
226
217
  label?: string;
227
218
  }[];
228
- format?: "json" | "md" | "markdown" | "mdx" | "yaml" | "toml";
219
+ format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
229
220
  label?: string;
230
221
  }[];
231
222
  config?: {
@@ -1,14 +1,5 @@
1
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.
2
+
12
3
  */
13
4
  import { TinaCloudSchemaConfig } from '../types/index';
14
5
  import z from 'zod';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/schema-tools",
3
- "version": "1.2.1",
3
+ "version": "1.3.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "exports": {
@@ -31,7 +31,7 @@
31
31
  ]
32
32
  },
33
33
  "devDependencies": {
34
- "@tinacms/scripts": "1.0.1",
34
+ "@tinacms/scripts": "1.0.2",
35
35
  "@types/yup": "^0.29.10",
36
36
  "jest": "^27.0.6",
37
37
  "react": "17.0.2",
@@ -50,6 +50,7 @@
50
50
  "directory": "packages/@tinacms/cli"
51
51
  },
52
52
  "dependencies": {
53
+ "url-pattern": "^1.0.3",
53
54
  "zod": "^3.14.3"
54
55
  },
55
56
  "scripts": {