tinacms 0.67.3 → 0.68.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/CHANGELOG.md CHANGED
@@ -1,5 +1,193 @@
1
1
  # tinacms
2
2
 
3
+ ## 0.68.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 41d666f9a: Styles list page overflow menu, removes unused prop
8
+ - e5a1152f2: Fix issue where pages that didnt use `useTina` would get a loading spinner that hangs
9
+ - Updated dependencies [41d666f9a]
10
+ - @tinacms/toolkit@0.56.24
11
+
12
+ ## 0.68.0
13
+
14
+ ### Minor Changes
15
+
16
+ - 6a6f137ae: # Simplify GraphQL API
17
+
18
+ ## `schema` must be supplied to the `<TinaCMS>` component
19
+
20
+ 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.
21
+
22
+ ## The GraphQL API has been simplified
23
+
24
+ ### `get<collection name>` is now just the collection name
25
+
26
+ ```graphql
27
+ # old
28
+ {
29
+ getPostDocument(relativePath: $relativePath) { ... }
30
+ }
31
+
32
+ # new
33
+ {
34
+ post(relativePath: $relativePath) { ... }
35
+ }
36
+ ```
37
+
38
+ ### `get<collection name>List` is now `<collection name>Connection`
39
+
40
+ 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
41
+
42
+ ```graphql
43
+ # old
44
+ {
45
+ getPostList { ... }
46
+ }
47
+
48
+ # new
49
+ {
50
+ postConnection { ... }
51
+ }
52
+ ```
53
+
54
+ ### `getCollection` and `getCollections` are now `collection` and `collections`
55
+
56
+ ```graphql
57
+ # old
58
+ {
59
+ getCollection(collection: "post") {...}
60
+ }
61
+ {
62
+ getCollections {...}
63
+ }
64
+
65
+ # new
66
+ {
67
+ collection(collection: "post") {...}
68
+ }
69
+ {
70
+ collections {...}
71
+ }
72
+ ```
73
+
74
+ ### No more `data` property
75
+
76
+ The `data` property was previously where all field definitions could be found. This has been moved on level up:
77
+
78
+ ```graphql
79
+ # old
80
+ {
81
+ getPostDocument(relativePath: $relativePath) {
82
+ data {
83
+ title
84
+ }
85
+ }
86
+ }
87
+
88
+ # new
89
+ {
90
+ post(relativePath: $relativePath) {
91
+ title
92
+ }
93
+ }
94
+ ```
95
+
96
+ #### The type for documents no longer includes "Document" at the end
97
+
98
+ ```graphql
99
+ # old
100
+ {
101
+ getPostDocument(relativePath: $relativePath) {
102
+ data {
103
+ author {
104
+ ... on AuthorDocument {
105
+ data {
106
+ name
107
+ }
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+
114
+ # new
115
+ {
116
+ post(relativePath: $relativePath) {
117
+ author {
118
+ ... on Author {
119
+ name
120
+ }
121
+ }
122
+ }
123
+ }
124
+ ```
125
+
126
+ ### Meta fields are now underscored
127
+
128
+ Aside from `id`, other metadata is now underscored:
129
+
130
+ ```graphql
131
+ # old
132
+ {
133
+ getPostDocument(relativePath: $relativePath) {
134
+ sys {
135
+ relativePath
136
+ }
137
+ values
138
+ }
139
+ }
140
+
141
+ # new
142
+ {
143
+ post(relativePath: $relativePath) {
144
+ _sys {
145
+ relativePath
146
+ }
147
+ _values
148
+ }
149
+ }
150
+ ```
151
+
152
+ ### `dataJSON` is gone
153
+
154
+ This is identical to `_values`
155
+
156
+ ### `form` is gone
157
+
158
+ `form` was used internally to generate forms for the given document, however that's now handled by providing your `schema` to `<TinaCMS>`.
159
+
160
+ ### `getDocumentList` is gone
161
+
162
+ It's no longer possible to query all documents at once, you can query for collection documents via the `collection` query:
163
+
164
+ ```graphql
165
+ {
166
+ collection {
167
+ documents {
168
+ edges {
169
+ node {...}
170
+ }
171
+ }
172
+ }
173
+ }
174
+ ```
175
+
176
+ ### Patch Changes
177
+
178
+ - Updated dependencies [6a6f137ae]
179
+ - @tinacms/toolkit@0.56.23
180
+
181
+ ## 0.67.4
182
+
183
+ ### Patch Changes
184
+
185
+ - 168f6cc6e: Update delete modal header
186
+ - 2a6060138: Fix url parsing issue when a branch name contained a `/`
187
+ - 3af3d6787: Fix issues with finding the template for multitemplate collections
188
+ - Updated dependencies [bf5fe0074]
189
+ - @tinacms/toolkit@0.56.22
190
+
3
191
  ## 0.67.3
4
192
 
5
193
  ### Patch Changes
@@ -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, GetDocumentFields } from './types';
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
- getDocument: DocumentForm;
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
  }
@@ -17,7 +17,7 @@ export interface Template {
17
17
  }
18
18
  export interface DocumentNode {
19
19
  node: {
20
- sys: {
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
- form: {
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
- sys: {
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, Field } from '@tinacms/toolkit';
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
- form: {
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 { AnyField, Form } from '@tinacms/toolkit';
13
+ import { Form } from '@tinacms/toolkit';
14
14
  import type { FormOptions, TinaCMS } from '@tinacms/toolkit';
15
- export declare function useGraphqlFormsUnstable<T extends object>({ variables, onSubmit, query, formify, eventList, }: {
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 generateFormCreatorsUnstable: (cms: TinaCMS, showInSidebar?: boolean) => {
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, useGraphqlFormsUnstable, } from './hooks/use-graphql-forms';
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';