tinacms 0.66.3 → 0.66.6

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,45 @@
1
1
  # tinacms
2
2
 
3
+ ## 0.66.6
4
+
5
+ ### Patch Changes
6
+
7
+ - becff2a0b: Adds define schema to the `tinacms` package (instead of `@tinacms/cli`. This is done in preparation of the extending tina work)
8
+ - ae1a5a58f: Sets `tina-admin` to default to `true`
9
+ - 3ed4c8727: Add flag for experimental new formify logic
10
+ - 5535a9970: Switches to using HashRouter for Admin
11
+ - 3ff1de06a: Upgrade to Tailwind 3
12
+ - fbdb7be01: Adds a defineConfig function to allow type hints for the tinacms config
13
+ - 24f8b057f: Handles errors better in the CMS
14
+ - Updated dependencies [ae1a5a58f]
15
+ - Updated dependencies [5535a9970]
16
+ - Updated dependencies [3ff1de06a]
17
+ - Updated dependencies [022ccd389]
18
+ - Updated dependencies [24f8b057f]
19
+ - @tinacms/toolkit@0.56.16
20
+ - @tinacms/sharedctx@0.1.0
21
+
22
+ ## 0.66.5
23
+
24
+ ### Patch Changes
25
+
26
+ - 43c834565: Adds an activity indicator throughout Admin
27
+ - 53a4550db: Allows RouteMapping to be dynamically imported
28
+ - 731451bee: Adjust the JWT token refresh logic to refresh tokens _before_ they expire.
29
+ - e102d7438: Updated auth modal to use toolkit button components
30
+ - Updated dependencies [43c834565]
31
+ - @tinacms/toolkit@0.56.15
32
+
33
+ ## 0.66.4
34
+
35
+ ### Patch Changes
36
+
37
+ - cc5c8431d: Remove console.log
38
+ - Updated dependencies [af9f6c2c2]
39
+ - Updated dependencies [2e14cda5e]
40
+ - Updated dependencies [3d4c52a19]
41
+ - @tinacms/toolkit@0.56.14
42
+
3
43
  ## 0.66.3
4
44
 
5
45
  ### Patch Changes
@@ -12,7 +12,11 @@ limitations under the License.
12
12
  */
13
13
  import type { TinaCMS } from '@tinacms/toolkit';
14
14
  import type { Collection } from '../types';
15
- export declare const useGetCollection: (cms: TinaCMS, collectionName: string, includeDocuments?: boolean) => Collection;
15
+ export declare const useGetCollection: (cms: TinaCMS, collectionName: string, includeDocuments?: boolean) => {
16
+ collection: Collection;
17
+ loading: boolean;
18
+ error: Error;
19
+ };
16
20
  declare const GetCollection: ({ cms, collectionName, includeDocuments, children, }: {
17
21
  cms: TinaCMS;
18
22
  collectionName: string;
@@ -15,7 +15,7 @@ import type { Collection } from '../types';
15
15
  export declare const useGetCollections: (cms: TinaCMS) => {
16
16
  collections: Collection[];
17
17
  loading: boolean;
18
- error: boolean;
18
+ error: Error;
19
19
  };
20
20
  declare const GetCollections: ({ cms, children }: {
21
21
  cms: TinaCMS;
@@ -12,7 +12,11 @@ limitations under the License.
12
12
  */
13
13
  import type { TinaCMS } from '@tinacms/toolkit';
14
14
  import type { DocumentForm } from '../types';
15
- export declare const useGetDocument: (cms: TinaCMS, collectionName: string, relativePath: string) => DocumentForm;
15
+ export declare const useGetDocument: (cms: TinaCMS, collectionName: string, relativePath: string) => {
16
+ document: DocumentForm;
17
+ loading: boolean;
18
+ error: Error;
19
+ };
16
20
  declare const GetDocument: ({ cms, collectionName, relativePath, children, }: {
17
21
  cms: TinaCMS;
18
22
  collectionName: string;
@@ -20,7 +20,17 @@ export interface Info {
20
20
  includeTemplate: boolean;
21
21
  };
22
22
  }
23
- export declare const useGetDocumentFields: (cms: TinaCMS, collectionName: string, templateName: string) => Info;
23
+ export declare const useGetDocumentFields: (cms: TinaCMS, collectionName: string, templateName: string) => {
24
+ loading: boolean;
25
+ error: Error;
26
+ collection: Object | undefined;
27
+ template: Object | undefined;
28
+ fields: Object[] | undefined;
29
+ mutationInfo: {
30
+ includeCollection: boolean;
31
+ includeTemplate: boolean;
32
+ };
33
+ };
24
34
  declare const GetDocumentFields: ({ cms, collectionName, templateName, children, }: {
25
35
  cms: TinaCMS;
26
36
  collectionName: string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ declare const LoadingPage: () => JSX.Element;
14
+ export default LoadingPage;
@@ -46,8 +46,36 @@ export declare class Client {
46
46
  setBranch(branchName: string): void;
47
47
  addPendingContent: (props: any) => Promise<unknown>;
48
48
  getSchema: () => Promise<GraphQLSchema>;
49
- requestWithForm<ReturnType>(query: (gqlTag: typeof gql) => DocumentNode, { variables }: {
49
+ /**
50
+ *
51
+ * Returns a version of the query with fragments inlined. Eg.
52
+ * ```graphql
53
+ * {
54
+ * getPostDocument(relativePath: "") {
55
+ * data {
56
+ * ...PostFragment
57
+ * }
58
+ * }
59
+ * }
60
+ *
61
+ * fragment PostFragment on Post {
62
+ * title
63
+ * }
64
+ * ```
65
+ * Turns into
66
+ * ```graphql
67
+ * {
68
+ * getPostDocument(relativePath: "") {
69
+ * data {
70
+ * title
71
+ * }
72
+ * }
73
+ * }
74
+ */
75
+ getOptimizedQuery: (documentNode: DocumentNode) => Promise<DocumentNode>;
76
+ requestWithForm<ReturnType>(query: (gqlTag: typeof gql) => DocumentNode, { variables, useUnstableFormify, }: {
50
77
  variables: any;
78
+ useUnstableFormify?: boolean;
51
79
  }): Promise<ReturnType>;
52
80
  request<ReturnType>(query: ((gqlTag: typeof gql) => DocumentNode) | string, { variables }: {
53
81
  variables: object;
@@ -0,0 +1,57 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ import { GraphQLSchema, DocumentNode } from 'graphql';
14
+ import React from 'react';
15
+ import * as G from 'graphql';
16
+ import type { TinaCMS } from '@tinacms/toolkit';
17
+ declare type Action = {
18
+ type: 'setSchema';
19
+ value: G.GraphQLSchema;
20
+ } | {
21
+ type: 'setQuery';
22
+ value: G.DocumentNode;
23
+ } | {
24
+ type: 'addNode';
25
+ value: DocNode;
26
+ };
27
+ export declare type DocNode = {
28
+ path: readonly (string | number)[];
29
+ };
30
+ export declare type Dispatch = React.Dispatch<Action>;
31
+ /**
32
+ * TODO: this is currently only used for testing, `formify` is where the primary logic is housed
33
+ */
34
+ export declare const useFormify: ({ query, cms }: {
35
+ query: string;
36
+ cms: TinaCMS;
37
+ }) => {
38
+ query: string;
39
+ status: "pending" | "ready" | "done";
40
+ nodes: DocNode[];
41
+ };
42
+ declare type TinaDocumentNode = {
43
+ path: {
44
+ name: string;
45
+ alias: string;
46
+ list?: boolean;
47
+ }[];
48
+ };
49
+ export declare const formify: ({ schema, query, getOptimizedQuery, }: {
50
+ schema: GraphQLSchema;
51
+ query: string;
52
+ getOptimizedQuery: (query: DocumentNode) => Promise<DocumentNode>;
53
+ }) => Promise<{
54
+ formifiedQuery: DocumentNode;
55
+ nodes: TinaDocumentNode[];
56
+ }>;
57
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ export {};
@@ -0,0 +1,59 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ import * as G from 'graphql';
14
+ export declare const isNodeField: (type: G.GraphQLNamedType) => boolean;
15
+ export declare const isCollectionField: (type: G.GraphQLNamedType) => boolean;
16
+ export declare const isConnectionField: (type: G.GraphQLNamedType) => boolean;
17
+ /**
18
+ * Selects the appropriate field from a GraphQLObject based on the selection's name
19
+ */
20
+ export declare const getObjectField: (object: G.GraphQLObjectType<any, any>, selectionNode: G.FieldNode) => G.GraphQLField<any, any, {
21
+ [key: string]: any;
22
+ }>;
23
+ /**
24
+ * Selects the appropriate type from a union based on the selection's typeCondition
25
+ *
26
+ * ```graphql
27
+ * post {
28
+ * # would return PostDocument
29
+ * ...on PostDocument { ... }
30
+ * }
31
+ * ```
32
+ */
33
+ export declare const getSelectedUnionType: (unionType: G.GraphQLUnionType, selectionNode: G.InlineFragmentNode) => G.GraphQLObjectType<any, any>;
34
+ /**
35
+ *
36
+ * Throws an error if the provided type is no a GraphQLUnionType
37
+ */
38
+ export declare function ensureNodeField(field: G.GraphQLNamedType): void;
39
+ /**
40
+ *
41
+ * Throws an error if the provided type is no a GraphQLUnionType
42
+ */
43
+ export declare function ensureUnionType(type: unknown): asserts type is G.GraphQLUnionType;
44
+ /**
45
+ *
46
+ * Throws an error if the provided type is no a GraphQLUnionType
47
+ */
48
+ export declare function ensureObjectType(type: unknown): asserts type is G.GraphQLObjectType;
49
+ /**
50
+ *
51
+ * Throws an error if the provided type is no a GraphQLUnionType
52
+ */
53
+ export declare function ensureOperationDefinition(type: G.DefinitionNode): asserts type is G.OperationDefinitionNode;
54
+ export declare function getNameAndAlias(fieldNode: G.FieldNode, list?: boolean): {
55
+ name: string;
56
+ alias: string;
57
+ list: boolean;
58
+ };
59
+ export declare const metaFields: G.SelectionNode[];
package/dist/index.d.ts CHANGED
@@ -20,5 +20,15 @@ export * from '@tinacms/toolkit';
20
20
  export { TinaAdmin } from './admin';
21
21
  export { RouteMappingPlugin } from './admin/plugins/route-mapping';
22
22
  export { TinaAdminApi } from './admin/api';
23
- import { TinaCMSProvider2 } from './tina-cms';
23
+ import { TinaCMSProvider2, TinaCMSProviderDefaultProps } from './tina-cms';
24
+ export type { TinaCMSProviderDefaultProps };
24
25
  export default TinaCMSProvider2;
26
+ import type { TinaCloudSchema as TinaCloudSchemaBase, TinaCloudCollection as TinaCloudCollectionBase, TinaCloudTemplateBase as TinaTemplate, TinaFieldBase } from './types';
27
+ export declare type TinaCloudSchema = TinaCloudSchemaBase<false>;
28
+ export declare type TinaSchema = TinaCloudSchema;
29
+ export declare type TinaCloudCollection = TinaCloudCollectionBase<false>;
30
+ export declare type TinaCollection = TinaCloudCollectionBase<false>;
31
+ export declare type TinaField = TinaFieldBase;
32
+ export type { TinaTemplate };
33
+ export declare const defineSchema: (config: TinaCloudSchema) => TinaCloudSchema;
34
+ export declare const defineConfig: (config: Omit<TinaCMSProviderDefaultProps, 'children'>) => Omit<TinaCMSProviderDefaultProps, "children">;