@tinacms/schema-tools 0.0.5 → 0.0.8

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,19 @@ 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
25
  media?: {
26
+ loadCustomStore?: () => Promise<Store>;
26
27
  tina?: {
27
28
  publicFolder: string;
28
- syncFolder: string;
29
+ mediaRoot: string;
29
30
  };
30
31
  };
31
32
  }
32
- export interface TinaCloudSchema<WithNamespace extends boolean> {
33
+ export interface TinaCloudSchema<WithNamespace extends boolean, Store = any> {
33
34
  templates?: GlobalTemplate<WithNamespace>[];
34
35
  collections: TinaCloudCollection<WithNamespace>[];
35
- config?: TinaCloudSchemaConfig;
36
+ config?: TinaCloudSchemaConfig<Store>;
36
37
  }
37
38
  export declare type TinaCloudSchemaBase = TinaCloudSchema<false>;
38
39
  export declare type TinaCloudSchemaEnriched = TinaCloudSchema<true>;
@@ -92,38 +92,43 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
92
92
  media: z.ZodOptional<z.ZodObject<{
93
93
  tina: z.ZodOptional<z.ZodObject<{
94
94
  publicFolder: z.ZodString;
95
- syncFolder: z.ZodString;
95
+ mediaRoot: z.ZodString;
96
96
  }, "strict", z.ZodTypeAny, {
97
97
  publicFolder?: string;
98
- syncFolder?: string;
98
+ mediaRoot?: string;
99
99
  }, {
100
100
  publicFolder?: string;
101
- syncFolder?: string;
101
+ mediaRoot?: string;
102
102
  }>>;
103
+ loadCustomStore: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
103
104
  }, "strip", z.ZodTypeAny, {
104
105
  tina?: {
105
106
  publicFolder?: string;
106
- syncFolder?: string;
107
+ mediaRoot?: string;
107
108
  };
109
+ loadCustomStore?: (...args: unknown[]) => unknown;
108
110
  }, {
109
111
  tina?: {
110
112
  publicFolder?: string;
111
- syncFolder?: string;
113
+ mediaRoot?: string;
112
114
  };
115
+ loadCustomStore?: (...args: unknown[]) => unknown;
113
116
  }>>;
114
117
  }, "strip", z.ZodTypeAny, {
115
118
  media?: {
116
119
  tina?: {
117
120
  publicFolder?: string;
118
- syncFolder?: string;
121
+ mediaRoot?: string;
119
122
  };
123
+ loadCustomStore?: (...args: unknown[]) => unknown;
120
124
  };
121
125
  }, {
122
126
  media?: {
123
127
  tina?: {
124
128
  publicFolder?: string;
125
- syncFolder?: string;
129
+ mediaRoot?: string;
126
130
  };
131
+ loadCustomStore?: (...args: unknown[]) => unknown;
127
132
  };
128
133
  }>>;
129
134
  }, "strip", z.ZodTypeAny, {
@@ -142,8 +147,9 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
142
147
  media?: {
143
148
  tina?: {
144
149
  publicFolder?: string;
145
- syncFolder?: string;
150
+ mediaRoot?: string;
146
151
  };
152
+ loadCustomStore?: (...args: unknown[]) => unknown;
147
153
  };
148
154
  };
149
155
  }, {
@@ -162,8 +168,9 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
162
168
  media?: {
163
169
  tina?: {
164
170
  publicFolder?: string;
165
- syncFolder?: string;
171
+ mediaRoot?: string;
166
172
  };
173
+ loadCustomStore?: (...args: unknown[]) => unknown;
167
174
  };
168
175
  };
169
176
  }>, {
@@ -182,8 +189,9 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
182
189
  media?: {
183
190
  tina?: {
184
191
  publicFolder?: string;
185
- syncFolder?: string;
192
+ mediaRoot?: string;
186
193
  };
194
+ loadCustomStore?: (...args: unknown[]) => unknown;
187
195
  };
188
196
  };
189
197
  }, {
@@ -202,8 +210,9 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
202
210
  media?: {
203
211
  tina?: {
204
212
  publicFolder?: string;
205
- syncFolder?: string;
213
+ mediaRoot?: string;
206
214
  };
215
+ loadCustomStore?: (...args: unknown[]) => unknown;
207
216
  };
208
217
  };
209
218
  }>;
@@ -16,38 +16,43 @@ export declare const tinaConfigZod: z.ZodObject<{
16
16
  media: z.ZodOptional<z.ZodObject<{
17
17
  tina: z.ZodOptional<z.ZodObject<{
18
18
  publicFolder: z.ZodString;
19
- syncFolder: z.ZodString;
19
+ mediaRoot: z.ZodString;
20
20
  }, "strict", z.ZodTypeAny, {
21
21
  publicFolder?: string;
22
- syncFolder?: string;
22
+ mediaRoot?: string;
23
23
  }, {
24
24
  publicFolder?: string;
25
- syncFolder?: string;
25
+ mediaRoot?: string;
26
26
  }>>;
27
+ loadCustomStore: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
27
28
  }, "strip", z.ZodTypeAny, {
28
29
  tina?: {
29
30
  publicFolder?: string;
30
- syncFolder?: string;
31
+ mediaRoot?: string;
31
32
  };
33
+ loadCustomStore?: (...args: unknown[]) => unknown;
32
34
  }, {
33
35
  tina?: {
34
36
  publicFolder?: string;
35
- syncFolder?: string;
37
+ mediaRoot?: string;
36
38
  };
39
+ loadCustomStore?: (...args: unknown[]) => unknown;
37
40
  }>>;
38
41
  }, "strip", z.ZodTypeAny, {
39
42
  media?: {
40
43
  tina?: {
41
44
  publicFolder?: string;
42
- syncFolder?: string;
45
+ mediaRoot?: string;
43
46
  };
47
+ loadCustomStore?: (...args: unknown[]) => unknown;
44
48
  };
45
49
  }, {
46
50
  media?: {
47
51
  tina?: {
48
52
  publicFolder?: string;
49
- syncFolder?: string;
53
+ mediaRoot?: string;
50
54
  };
55
+ loadCustomStore?: (...args: unknown[]) => unknown;
51
56
  };
52
57
  }>;
53
58
  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.5",
3
+ "version": "0.0.8",
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,30 +18,22 @@
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
  },
18
25
  "devDependencies": {
19
- "@tinacms/scripts": "0.50.8",
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,53 +0,0 @@
1
- # @tinacms/schema-tools
2
-
3
- ## 0.0.5
4
-
5
- ### Patch Changes
6
-
7
- - f6cb634c2: Added an optional config key to the schema that will be used for tina cloud media store
8
-
9
- ## 0.0.4
10
-
11
- ### Patch Changes
12
-
13
- - 6e2ed31a2: Added `isTitle` property to the schema that allows the title to be displayed in the CMS
14
-
15
- ## 0.0.3
16
-
17
- ### Patch Changes
18
-
19
- - 921709a7e: Adds validation to the schema instead of only using typescript types
20
-
21
- ## 0.0.2
22
-
23
- ### Patch Changes
24
-
25
- - abf25c673: The schema can now to used on the frontend (optional for now but will be the main path moving forward).
26
-
27
- ### How to migrate.
28
-
29
- 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.
30
-
31
- ```tsx
32
- import TinaCMS from 'tinacms'
33
- import schema, { tinaConfig } from '../schema.ts'
34
-
35
- // Importing the TinaProvider directly into your page will cause Tina to be added to the production bundle.
36
- // Instead, import the tina/provider/index default export to have it dynamially imported in edit-moode
37
- /**
38
- *
39
- * @private Do not import this directly, please import the dynamic provider instead
40
- */
41
- const TinaProvider = ({ children }) => {
42
- return (
43
- <TinaCMS {...tinaConfig} schema={schema}>
44
- {children}
45
- </TinaCMS>
46
- )
47
- }
48
-
49
- export default TinaProvider
50
- ```
51
-
52
- - 801f39f62: Update types
53
- - 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.