@tinacms/schema-tools 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -0
- package/dist/index.es.js +701 -0
- package/dist/index.js +676 -705
- package/dist/types/SchemaTypes.d.ts +4 -3
- package/dist/validate/schema.d.ts +9 -0
- package/dist/validate/tinaCloudSchemaConfig.d.ts +5 -0
- package/package.json +19 -12
- package/CHANGELOG.md +0 -59
|
@@ -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
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>;
|
|
@@ -100,16 +100,19 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
100
100
|
publicFolder?: string;
|
|
101
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
107
|
mediaRoot?: string;
|
|
107
108
|
};
|
|
109
|
+
loadCustomStore?: (...args: unknown[]) => unknown;
|
|
108
110
|
}, {
|
|
109
111
|
tina?: {
|
|
110
112
|
publicFolder?: string;
|
|
111
113
|
mediaRoot?: string;
|
|
112
114
|
};
|
|
115
|
+
loadCustomStore?: (...args: unknown[]) => unknown;
|
|
113
116
|
}>>;
|
|
114
117
|
}, "strip", z.ZodTypeAny, {
|
|
115
118
|
media?: {
|
|
@@ -117,6 +120,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
117
120
|
publicFolder?: string;
|
|
118
121
|
mediaRoot?: string;
|
|
119
122
|
};
|
|
123
|
+
loadCustomStore?: (...args: unknown[]) => unknown;
|
|
120
124
|
};
|
|
121
125
|
}, {
|
|
122
126
|
media?: {
|
|
@@ -124,6 +128,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
124
128
|
publicFolder?: string;
|
|
125
129
|
mediaRoot?: string;
|
|
126
130
|
};
|
|
131
|
+
loadCustomStore?: (...args: unknown[]) => unknown;
|
|
127
132
|
};
|
|
128
133
|
}>>;
|
|
129
134
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -144,6 +149,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
144
149
|
publicFolder?: string;
|
|
145
150
|
mediaRoot?: string;
|
|
146
151
|
};
|
|
152
|
+
loadCustomStore?: (...args: unknown[]) => unknown;
|
|
147
153
|
};
|
|
148
154
|
};
|
|
149
155
|
}, {
|
|
@@ -164,6 +170,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
164
170
|
publicFolder?: string;
|
|
165
171
|
mediaRoot?: string;
|
|
166
172
|
};
|
|
173
|
+
loadCustomStore?: (...args: unknown[]) => unknown;
|
|
167
174
|
};
|
|
168
175
|
};
|
|
169
176
|
}>, {
|
|
@@ -184,6 +191,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
184
191
|
publicFolder?: string;
|
|
185
192
|
mediaRoot?: string;
|
|
186
193
|
};
|
|
194
|
+
loadCustomStore?: (...args: unknown[]) => unknown;
|
|
187
195
|
};
|
|
188
196
|
};
|
|
189
197
|
}, {
|
|
@@ -204,6 +212,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
204
212
|
publicFolder?: string;
|
|
205
213
|
mediaRoot?: string;
|
|
206
214
|
};
|
|
215
|
+
loadCustomStore?: (...args: unknown[]) => unknown;
|
|
207
216
|
};
|
|
208
217
|
};
|
|
209
218
|
}>;
|
|
@@ -24,16 +24,19 @@ export declare const tinaConfigZod: z.ZodObject<{
|
|
|
24
24
|
publicFolder?: string;
|
|
25
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
31
|
mediaRoot?: string;
|
|
31
32
|
};
|
|
33
|
+
loadCustomStore?: (...args: unknown[]) => unknown;
|
|
32
34
|
}, {
|
|
33
35
|
tina?: {
|
|
34
36
|
publicFolder?: string;
|
|
35
37
|
mediaRoot?: string;
|
|
36
38
|
};
|
|
39
|
+
loadCustomStore?: (...args: unknown[]) => unknown;
|
|
37
40
|
}>>;
|
|
38
41
|
}, "strip", z.ZodTypeAny, {
|
|
39
42
|
media?: {
|
|
@@ -41,6 +44,7 @@ export declare const tinaConfigZod: z.ZodObject<{
|
|
|
41
44
|
publicFolder?: string;
|
|
42
45
|
mediaRoot?: string;
|
|
43
46
|
};
|
|
47
|
+
loadCustomStore?: (...args: unknown[]) => unknown;
|
|
44
48
|
};
|
|
45
49
|
}, {
|
|
46
50
|
media?: {
|
|
@@ -48,6 +52,7 @@ export declare const tinaConfigZod: z.ZodObject<{
|
|
|
48
52
|
publicFolder?: string;
|
|
49
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.
|
|
3
|
+
"version": "0.0.7",
|
|
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": "
|
|
23
|
-
"typescript": "
|
|
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.
|