@tinacms/schema-tools 0.0.6 → 0.0.9

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.
@@ -21,18 +21,25 @@ export declare type UIField<F extends UIField = any, Shape = any> = {
21
21
  validate?(value: Shape, allValues: any, meta: any, field: UIField<F, Shape>): string | object | undefined | void;
22
22
  defaultValue?: Shape;
23
23
  };
24
- export interface TinaCloudSchemaConfig {
24
+ export interface TinaCloudSchemaConfig<Store = any> {
25
+ client?: {
26
+ referenceDepth?: number;
27
+ };
28
+ clientId: string;
29
+ branch: string;
30
+ token: string;
25
31
  media?: {
32
+ loadCustomStore?: () => Promise<Store>;
26
33
  tina?: {
27
34
  publicFolder: string;
28
35
  mediaRoot: string;
29
36
  };
30
37
  };
31
38
  }
32
- export interface TinaCloudSchema<WithNamespace extends boolean> {
39
+ export interface TinaCloudSchema<WithNamespace extends boolean, Store = any> {
33
40
  templates?: GlobalTemplate<WithNamespace>[];
34
41
  collections: TinaCloudCollection<WithNamespace>[];
35
- config?: TinaCloudSchemaConfig;
42
+ config?: TinaCloudSchemaConfig<Store>;
36
43
  }
37
44
  export declare type TinaCloudSchemaBase = TinaCloudSchema<false>;
38
45
  export declare type TinaCloudSchemaEnriched = TinaCloudSchema<true>;
@@ -89,6 +89,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
89
89
  label?: string;
90
90
  }>, "many">;
91
91
  config: z.ZodOptional<z.ZodObject<{
92
+ client: z.ZodOptional<z.ZodObject<{
93
+ referenceDepth: z.ZodOptional<z.ZodNumber>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ referenceDepth?: number;
96
+ }, {
97
+ referenceDepth?: number;
98
+ }>>;
92
99
  media: z.ZodOptional<z.ZodObject<{
93
100
  tina: z.ZodOptional<z.ZodObject<{
94
101
  publicFolder: z.ZodString;
@@ -100,30 +107,41 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
100
107
  publicFolder?: string;
101
108
  mediaRoot?: string;
102
109
  }>>;
110
+ loadCustomStore: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
103
111
  }, "strip", z.ZodTypeAny, {
104
112
  tina?: {
105
113
  publicFolder?: string;
106
114
  mediaRoot?: string;
107
115
  };
116
+ loadCustomStore?: (...args: unknown[]) => unknown;
108
117
  }, {
109
118
  tina?: {
110
119
  publicFolder?: string;
111
120
  mediaRoot?: string;
112
121
  };
122
+ loadCustomStore?: (...args: unknown[]) => unknown;
113
123
  }>>;
114
124
  }, "strip", z.ZodTypeAny, {
125
+ client?: {
126
+ referenceDepth?: number;
127
+ };
115
128
  media?: {
116
129
  tina?: {
117
130
  publicFolder?: string;
118
131
  mediaRoot?: string;
119
132
  };
133
+ loadCustomStore?: (...args: unknown[]) => unknown;
120
134
  };
121
135
  }, {
136
+ client?: {
137
+ referenceDepth?: number;
138
+ };
122
139
  media?: {
123
140
  tina?: {
124
141
  publicFolder?: string;
125
142
  mediaRoot?: string;
126
143
  };
144
+ loadCustomStore?: (...args: unknown[]) => unknown;
127
145
  };
128
146
  }>>;
129
147
  }, "strip", z.ZodTypeAny, {
@@ -139,11 +157,15 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
139
157
  label?: string;
140
158
  }[];
141
159
  config?: {
160
+ client?: {
161
+ referenceDepth?: number;
162
+ };
142
163
  media?: {
143
164
  tina?: {
144
165
  publicFolder?: string;
145
166
  mediaRoot?: string;
146
167
  };
168
+ loadCustomStore?: (...args: unknown[]) => unknown;
147
169
  };
148
170
  };
149
171
  }, {
@@ -159,11 +181,15 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
159
181
  label?: string;
160
182
  }[];
161
183
  config?: {
184
+ client?: {
185
+ referenceDepth?: number;
186
+ };
162
187
  media?: {
163
188
  tina?: {
164
189
  publicFolder?: string;
165
190
  mediaRoot?: string;
166
191
  };
192
+ loadCustomStore?: (...args: unknown[]) => unknown;
167
193
  };
168
194
  };
169
195
  }>, {
@@ -179,11 +205,15 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
179
205
  label?: string;
180
206
  }[];
181
207
  config?: {
208
+ client?: {
209
+ referenceDepth?: number;
210
+ };
182
211
  media?: {
183
212
  tina?: {
184
213
  publicFolder?: string;
185
214
  mediaRoot?: string;
186
215
  };
216
+ loadCustomStore?: (...args: unknown[]) => unknown;
187
217
  };
188
218
  };
189
219
  }, {
@@ -199,11 +229,15 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
199
229
  label?: string;
200
230
  }[];
201
231
  config?: {
232
+ client?: {
233
+ referenceDepth?: number;
234
+ };
202
235
  media?: {
203
236
  tina?: {
204
237
  publicFolder?: string;
205
238
  mediaRoot?: string;
206
239
  };
240
+ loadCustomStore?: (...args: unknown[]) => unknown;
207
241
  };
208
242
  };
209
243
  }>;
@@ -13,6 +13,13 @@ limitations under the License.
13
13
  import { TinaCloudSchemaConfig } from '../types';
14
14
  import z from 'zod';
15
15
  export declare const tinaConfigZod: z.ZodObject<{
16
+ client: z.ZodOptional<z.ZodObject<{
17
+ referenceDepth: z.ZodOptional<z.ZodNumber>;
18
+ }, "strip", z.ZodTypeAny, {
19
+ referenceDepth?: number;
20
+ }, {
21
+ referenceDepth?: number;
22
+ }>>;
16
23
  media: z.ZodOptional<z.ZodObject<{
17
24
  tina: z.ZodOptional<z.ZodObject<{
18
25
  publicFolder: z.ZodString;
@@ -24,30 +31,41 @@ export declare const tinaConfigZod: z.ZodObject<{
24
31
  publicFolder?: string;
25
32
  mediaRoot?: string;
26
33
  }>>;
34
+ loadCustomStore: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
27
35
  }, "strip", z.ZodTypeAny, {
28
36
  tina?: {
29
37
  publicFolder?: string;
30
38
  mediaRoot?: string;
31
39
  };
40
+ loadCustomStore?: (...args: unknown[]) => unknown;
32
41
  }, {
33
42
  tina?: {
34
43
  publicFolder?: string;
35
44
  mediaRoot?: string;
36
45
  };
46
+ loadCustomStore?: (...args: unknown[]) => unknown;
37
47
  }>>;
38
48
  }, "strip", z.ZodTypeAny, {
49
+ client?: {
50
+ referenceDepth?: number;
51
+ };
39
52
  media?: {
40
53
  tina?: {
41
54
  publicFolder?: string;
42
55
  mediaRoot?: string;
43
56
  };
57
+ loadCustomStore?: (...args: unknown[]) => unknown;
44
58
  };
45
59
  }, {
60
+ client?: {
61
+ referenceDepth?: number;
62
+ };
46
63
  media?: {
47
64
  tina?: {
48
65
  publicFolder?: string;
49
66
  mediaRoot?: string;
50
67
  };
68
+ loadCustomStore?: (...args: unknown[]) => unknown;
51
69
  };
52
70
  }>;
53
71
  export declare const validateTinaCloudSchemaConfig: (config: unknown) => TinaCloudSchemaConfig;
package/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "@tinacms/schema-tools",
3
- "version": "0.0.6",
3
+ "version": "0.0.9",
4
4
  "main": "dist/index.js",
5
+ "module": "./dist/index.es.js",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.es.js",
10
+ "require": "./dist/index.js"
11
+ }
12
+ },
5
13
  "typings": "dist/index.d.ts",
6
14
  "files": [
7
15
  "dist"
@@ -10,8 +18,7 @@
10
18
  "buildConfig": {
11
19
  "entryPoints": [
12
20
  {
13
- "name": "src/index.ts",
14
- "target": "node"
21
+ "name": "src/index.ts"
15
22
  }
16
23
  ]
17
24
  },
@@ -19,21 +26,14 @@
19
26
  "@tinacms/scripts": "0.50.9",
20
27
  "@types/yup": "^0.29.10",
21
28
  "jest": "^27.0.6",
22
- "react": "16.14.0",
23
- "typescript": "^4.3.5",
29
+ "react": "17.0.2",
30
+ "typescript": "4.3.5",
24
31
  "yup": "^0.32.0"
25
32
  },
26
33
  "peerDependencies": {
27
34
  "react": ">=16.14.0",
28
35
  "yup": "^0.32.0"
29
36
  },
30
- "scripts": {
31
- "build": "echo \"Run `yarn build` from the root of the repository instead\"",
32
- "test": "jest --passWithNoTests",
33
- "types": "yarn tsc",
34
- "test-watch": "jest --passWithNoTests --watch",
35
- "generate:schema": "yarn node scripts/generateSchema.js"
36
- },
37
37
  "publishConfig": {
38
38
  "registry": "https://registry.npmjs.org"
39
39
  },
@@ -43,5 +43,12 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "zod": "^3.14.3"
46
+ },
47
+ "scripts": {
48
+ "build": "tinacms-scripts build",
49
+ "test": "jest --passWithNoTests",
50
+ "types": "pnpm tsc",
51
+ "test-watch": "jest --passWithNoTests --watch",
52
+ "generate:schema": "yarn node scripts/generateSchema.js"
46
53
  }
47
54
  }
package/CHANGELOG.md DELETED
@@ -1,59 +0,0 @@
1
- # @tinacms/schema-tools
2
-
3
- ## 0.0.6
4
-
5
- ### Patch Changes
6
-
7
- - fb73fb355: Renames syncFolder to a mediaRoot when configuring Repo-Based Media
8
-
9
- ## 0.0.5
10
-
11
- ### Patch Changes
12
-
13
- - f6cb634c2: Added an optional config key to the schema that will be used for tina cloud media store
14
-
15
- ## 0.0.4
16
-
17
- ### Patch Changes
18
-
19
- - 6e2ed31a2: Added `isTitle` property to the schema that allows the title to be displayed in the CMS
20
-
21
- ## 0.0.3
22
-
23
- ### Patch Changes
24
-
25
- - 921709a7e: Adds validation to the schema instead of only using typescript types
26
-
27
- ## 0.0.2
28
-
29
- ### Patch Changes
30
-
31
- - abf25c673: The schema can now to used on the frontend (optional for now but will be the main path moving forward).
32
-
33
- ### How to migrate.
34
-
35
- 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.
36
-
37
- ```tsx
38
- import TinaCMS from 'tinacms'
39
- import schema, { tinaConfig } from '../schema.ts'
40
-
41
- // Importing the TinaProvider directly into your page will cause Tina to be added to the production bundle.
42
- // Instead, import the tina/provider/index default export to have it dynamially imported in edit-moode
43
- /**
44
- *
45
- * @private Do not import this directly, please import the dynamic provider instead
46
- */
47
- const TinaProvider = ({ children }) => {
48
- return (
49
- <TinaCMS {...tinaConfig} schema={schema}>
50
- {children}
51
- </TinaCMS>
52
- )
53
- }
54
-
55
- export default TinaProvider
56
- ```
57
-
58
- - 801f39f62: Update types
59
- - e8b0de1f7: Add `parentTypename` to fields to allow us to disambiguate between fields which have the same field names but different types. Example, an event from field name of `blocks.0.title` could belong to a `Cta` block or a `Hero` block, both of which have a `title` field.