tinacms 0.67.4 → 0.68.2
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 +185 -0
- package/dist/admin/api.d.ts +5 -9
- package/dist/admin/types.d.ts +4 -21
- package/dist/hooks/formify/formify-utils.d.ts +1 -0
- package/dist/hooks/formify/formify.d.ts +0 -1
- package/dist/hooks/formify/types.d.ts +3 -11
- package/dist/hooks/use-graphql-forms.d.ts +4 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +194 -556
- package/dist/index.js +192 -555
- package/package.json +2 -2
- package/dist/admin/components/GetDocumentFields.d.ts +0 -40
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,190 @@
|
|
|
1
1
|
# tinacms
|
|
2
2
|
|
|
3
|
+
## 0.68.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [e90647da3]
|
|
8
|
+
- @tinacms/toolkit@0.56.25
|
|
9
|
+
|
|
10
|
+
## 0.68.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 41d666f9a: Styles list page overflow menu, removes unused prop
|
|
15
|
+
- e5a1152f2: Fix issue where pages that didnt use `useTina` would get a loading spinner that hangs
|
|
16
|
+
- Updated dependencies [41d666f9a]
|
|
17
|
+
- @tinacms/toolkit@0.56.24
|
|
18
|
+
|
|
19
|
+
## 0.68.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- 6a6f137ae: # Simplify GraphQL API
|
|
24
|
+
|
|
25
|
+
## `schema` must be supplied to the `<TinaCMS>` component
|
|
26
|
+
|
|
27
|
+
Previously the `.tina/schema.ts` was only used by the Tina CLI to generate the GraphQL API. However it's now required as a prop to `<TinaCMS>`. This allows you to provide runtime logic in the `ui` property of field definitions. See the documentation on "Extending Tina" for examples.
|
|
28
|
+
|
|
29
|
+
## The GraphQL API has been simplified
|
|
30
|
+
|
|
31
|
+
### `get<collection name>` is now just the collection name
|
|
32
|
+
|
|
33
|
+
```graphql
|
|
34
|
+
# old
|
|
35
|
+
{
|
|
36
|
+
getPostDocument(relativePath: $relativePath) { ... }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# new
|
|
40
|
+
{
|
|
41
|
+
post(relativePath: $relativePath) { ... }
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### `get<collection name>List` is now `<collection name>Connection`
|
|
46
|
+
|
|
47
|
+
The use of the term `connection` is due to our adherence the the [relay cursor spec](https://relay.dev/graphql/connections.htm). We may offer a simplified list field in a future release
|
|
48
|
+
|
|
49
|
+
```graphql
|
|
50
|
+
# old
|
|
51
|
+
{
|
|
52
|
+
getPostList { ... }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# new
|
|
56
|
+
{
|
|
57
|
+
postConnection { ... }
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### `getCollection` and `getCollections` are now `collection` and `collections`
|
|
62
|
+
|
|
63
|
+
```graphql
|
|
64
|
+
# old
|
|
65
|
+
{
|
|
66
|
+
getCollection(collection: "post") {...}
|
|
67
|
+
}
|
|
68
|
+
{
|
|
69
|
+
getCollections {...}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# new
|
|
73
|
+
{
|
|
74
|
+
collection(collection: "post") {...}
|
|
75
|
+
}
|
|
76
|
+
{
|
|
77
|
+
collections {...}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### No more `data` property
|
|
82
|
+
|
|
83
|
+
The `data` property was previously where all field definitions could be found. This has been moved on level up:
|
|
84
|
+
|
|
85
|
+
```graphql
|
|
86
|
+
# old
|
|
87
|
+
{
|
|
88
|
+
getPostDocument(relativePath: $relativePath) {
|
|
89
|
+
data {
|
|
90
|
+
title
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
# new
|
|
96
|
+
{
|
|
97
|
+
post(relativePath: $relativePath) {
|
|
98
|
+
title
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### The type for documents no longer includes "Document" at the end
|
|
104
|
+
|
|
105
|
+
```graphql
|
|
106
|
+
# old
|
|
107
|
+
{
|
|
108
|
+
getPostDocument(relativePath: $relativePath) {
|
|
109
|
+
data {
|
|
110
|
+
author {
|
|
111
|
+
... on AuthorDocument {
|
|
112
|
+
data {
|
|
113
|
+
name
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
# new
|
|
122
|
+
{
|
|
123
|
+
post(relativePath: $relativePath) {
|
|
124
|
+
author {
|
|
125
|
+
... on Author {
|
|
126
|
+
name
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Meta fields are now underscored
|
|
134
|
+
|
|
135
|
+
Aside from `id`, other metadata is now underscored:
|
|
136
|
+
|
|
137
|
+
```graphql
|
|
138
|
+
# old
|
|
139
|
+
{
|
|
140
|
+
getPostDocument(relativePath: $relativePath) {
|
|
141
|
+
sys {
|
|
142
|
+
relativePath
|
|
143
|
+
}
|
|
144
|
+
values
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
# new
|
|
149
|
+
{
|
|
150
|
+
post(relativePath: $relativePath) {
|
|
151
|
+
_sys {
|
|
152
|
+
relativePath
|
|
153
|
+
}
|
|
154
|
+
_values
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### `dataJSON` is gone
|
|
160
|
+
|
|
161
|
+
This is identical to `_values`
|
|
162
|
+
|
|
163
|
+
### `form` is gone
|
|
164
|
+
|
|
165
|
+
`form` was used internally to generate forms for the given document, however that's now handled by providing your `schema` to `<TinaCMS>`.
|
|
166
|
+
|
|
167
|
+
### `getDocumentList` is gone
|
|
168
|
+
|
|
169
|
+
It's no longer possible to query all documents at once, you can query for collection documents via the `collection` query:
|
|
170
|
+
|
|
171
|
+
```graphql
|
|
172
|
+
{
|
|
173
|
+
collection {
|
|
174
|
+
documents {
|
|
175
|
+
edges {
|
|
176
|
+
node {...}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Patch Changes
|
|
184
|
+
|
|
185
|
+
- Updated dependencies [6a6f137ae]
|
|
186
|
+
- @tinacms/toolkit@0.56.23
|
|
187
|
+
|
|
3
188
|
## 0.67.4
|
|
4
189
|
|
|
5
190
|
### Patch Changes
|
package/dist/admin/api.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ See the License for the specific language governing permissions and
|
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
import type { TinaCMS } from '@tinacms/toolkit';
|
|
14
|
-
import type { Collection, DocumentForm
|
|
14
|
+
import type { Collection, DocumentForm } from './types';
|
|
15
15
|
export declare class TinaAdminApi {
|
|
16
16
|
api: {
|
|
17
17
|
request: (query: string, { variables }: {
|
|
@@ -19,22 +19,18 @@ export declare class TinaAdminApi {
|
|
|
19
19
|
}) => any;
|
|
20
20
|
isAuthenticated: () => boolean;
|
|
21
21
|
};
|
|
22
|
+
schema: any;
|
|
22
23
|
constructor(cms: TinaCMS);
|
|
23
24
|
isAuthenticated(): Promise<boolean>;
|
|
24
|
-
fetchCollections(): Promise<
|
|
25
|
-
getCollections: Collection[];
|
|
26
|
-
}>;
|
|
25
|
+
fetchCollections(): Promise<Collection[]>;
|
|
27
26
|
deleteDocument({ collection, relativePath, }: {
|
|
28
27
|
collection: string;
|
|
29
28
|
relativePath: string;
|
|
30
29
|
}): Promise<void>;
|
|
31
|
-
fetchCollection(collectionName: string, includeDocuments: boolean): Promise<
|
|
32
|
-
getCollection: Collection;
|
|
33
|
-
}>;
|
|
30
|
+
fetchCollection(collectionName: string, includeDocuments: boolean): Promise<Collection>;
|
|
34
31
|
fetchDocument(collectionName: string, relativePath: string): Promise<{
|
|
35
|
-
|
|
32
|
+
document: DocumentForm;
|
|
36
33
|
}>;
|
|
37
|
-
fetchDocumentFields(): Promise<GetDocumentFields>;
|
|
38
34
|
createDocument(collectionName: string, relativePath: string, params: Object): Promise<any>;
|
|
39
35
|
updateDocument(collectionName: string, relativePath: string, params: Object): Promise<any>;
|
|
40
36
|
}
|
package/dist/admin/types.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface Template {
|
|
|
17
17
|
}
|
|
18
18
|
export interface DocumentNode {
|
|
19
19
|
node: {
|
|
20
|
-
|
|
20
|
+
_sys: {
|
|
21
21
|
template: string;
|
|
22
22
|
breadcrumbs: string[];
|
|
23
23
|
path: string;
|
|
@@ -29,21 +29,10 @@ export interface DocumentNode {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
export interface DocumentForm {
|
|
32
|
-
|
|
33
|
-
label: string;
|
|
34
|
-
name: string;
|
|
35
|
-
fields: Object[];
|
|
36
|
-
mutationInfo: {
|
|
37
|
-
path: string[];
|
|
38
|
-
string: string;
|
|
39
|
-
includeCollection: boolean;
|
|
40
|
-
includeTemplate: boolean;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
values: Object;
|
|
32
|
+
_values: Object;
|
|
44
33
|
}
|
|
45
34
|
export interface DocumentSys {
|
|
46
|
-
|
|
35
|
+
_sys: {
|
|
47
36
|
template: string;
|
|
48
37
|
breadcrumbs: string[];
|
|
49
38
|
path: string;
|
|
@@ -56,6 +45,7 @@ export interface DocumentSys {
|
|
|
56
45
|
export interface Collection {
|
|
57
46
|
label: string;
|
|
58
47
|
name: string;
|
|
48
|
+
slug: string;
|
|
59
49
|
format?: string;
|
|
60
50
|
templates?: Template[];
|
|
61
51
|
documents?: {
|
|
@@ -63,10 +53,3 @@ export interface Collection {
|
|
|
63
53
|
edges?: DocumentNode[];
|
|
64
54
|
};
|
|
65
55
|
}
|
|
66
|
-
export interface GetDocumentFields {
|
|
67
|
-
[collectionName: string]: {
|
|
68
|
-
collection: Object;
|
|
69
|
-
templates?: Object[];
|
|
70
|
-
fields?: Object[];
|
|
71
|
-
};
|
|
72
|
-
}
|
|
@@ -85,5 +85,6 @@ export declare function buildPath({ fieldNode, type, parentTypename, path, }: {
|
|
|
85
85
|
}): BlueprintPath[];
|
|
86
86
|
export declare const metaFields: G.SelectionNode[];
|
|
87
87
|
export declare const getRelativeBlueprint: (path: BlueprintPath[]) => string;
|
|
88
|
+
export declare const isSysField: (fieldNode: G.FieldNode) => boolean;
|
|
88
89
|
export declare const getBlueprintId: (path: BlueprintPath[]) => string;
|
|
89
90
|
export declare const getFieldAliasForBlueprint: (path: BlueprintPath[]) => string;
|
|
@@ -12,7 +12,6 @@ limitations under the License.
|
|
|
12
12
|
*/
|
|
13
13
|
import * as G from 'graphql';
|
|
14
14
|
import type { DocumentBlueprint } from './types';
|
|
15
|
-
export declare const DATA_NODE_NAME = "data";
|
|
16
15
|
export declare const formify: ({ schema, query, getOptimizedQuery, }: {
|
|
17
16
|
schema: G.GraphQLSchema;
|
|
18
17
|
query: string;
|
|
@@ -12,7 +12,7 @@ limitations under the License.
|
|
|
12
12
|
*/
|
|
13
13
|
/// <reference types="react" />
|
|
14
14
|
import type * as G from 'graphql';
|
|
15
|
-
import type { Form
|
|
15
|
+
import type { Form } from '@tinacms/toolkit';
|
|
16
16
|
export declare type Action = {
|
|
17
17
|
type: 'start';
|
|
18
18
|
value: {
|
|
@@ -58,20 +58,12 @@ export declare type FormifiedDocumentNode = {
|
|
|
58
58
|
id: string;
|
|
59
59
|
_internalSys: {
|
|
60
60
|
path: string;
|
|
61
|
+
relativePath: string;
|
|
61
62
|
collection: {
|
|
62
63
|
name: any;
|
|
63
64
|
};
|
|
64
65
|
};
|
|
65
|
-
|
|
66
|
-
mutationInfo: {
|
|
67
|
-
string: string;
|
|
68
|
-
includeCollection?: boolean;
|
|
69
|
-
includeTemplate?: boolean;
|
|
70
|
-
};
|
|
71
|
-
label: string;
|
|
72
|
-
fields: Field[];
|
|
73
|
-
};
|
|
74
|
-
values: object;
|
|
66
|
+
_values: object;
|
|
75
67
|
};
|
|
76
68
|
export declare type ChangeMutation = {
|
|
77
69
|
type: 'change';
|
|
@@ -10,9 +10,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
10
10
|
See the License for the specific language governing permissions and
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
|
-
import {
|
|
13
|
+
import { Form } from '@tinacms/toolkit';
|
|
14
14
|
import type { FormOptions, TinaCMS } from '@tinacms/toolkit';
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function useGraphqlForms<T extends object>({ variables, onSubmit, query, formify, eventList, }: {
|
|
16
16
|
query: string;
|
|
17
17
|
variables: object;
|
|
18
18
|
onSubmit?: (args: onSubmitArgs) => void;
|
|
@@ -24,12 +24,6 @@ export declare function useGraphqlFormsUnstable<T extends object>({ variables, o
|
|
|
24
24
|
*/
|
|
25
25
|
eventList?: [];
|
|
26
26
|
}): [T, Boolean];
|
|
27
|
-
export declare function useGraphqlForms<T extends object>({ variables, onSubmit, formify, query, }: {
|
|
28
|
-
query: string;
|
|
29
|
-
variables: object;
|
|
30
|
-
onSubmit?: (args: onSubmitArgs) => void;
|
|
31
|
-
formify?: formifyCallback;
|
|
32
|
-
}): [T, Boolean];
|
|
33
27
|
export declare const transformDocumentIntoMutationRequestPayload: (document: {
|
|
34
28
|
[key: string]: unknown;
|
|
35
29
|
_collection: string;
|
|
@@ -39,8 +33,8 @@ export declare const transformDocumentIntoMutationRequestPayload: (document: {
|
|
|
39
33
|
includeCollection?: boolean;
|
|
40
34
|
includeTemplate?: boolean;
|
|
41
35
|
}) => any;
|
|
42
|
-
export declare const
|
|
43
|
-
createForm: (formConfig: any) => Form<any, AnyField>;
|
|
36
|
+
export declare const generateFormCreators: (cms: TinaCMS, showInSidebar?: boolean) => {
|
|
37
|
+
createForm: (formConfig: any) => Form<any, import("@tinacms/toolkit").AnyField>;
|
|
44
38
|
createGlobalForm: GlobalFormCreator;
|
|
45
39
|
};
|
|
46
40
|
declare type FormCreator = (formConfig: FormOptions<any>) => Form;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export * from './client';
|
|
|
14
14
|
export * from './auth';
|
|
15
15
|
export * from './utils';
|
|
16
16
|
export * from './tina-cms';
|
|
17
|
-
export { useGraphqlForms
|
|
17
|
+
export { useGraphqlForms } from './hooks/use-graphql-forms';
|
|
18
18
|
export { useDocumentCreatorPlugin } from './hooks/use-content-creator';
|
|
19
19
|
export * from '@tinacms/toolkit';
|
|
20
20
|
export { TinaAdmin } from './admin';
|