@tinacms/graphql 1.3.2 → 1.3.4

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.
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { Database } from '../database';
5
5
  import type { ObjectTypeDefinitionNode, InlineFragmentNode, FieldDefinitionNode } from 'graphql';
6
- import type { TinaCloudCollectionEnriched, Template } from '@tinacms/schema-tools';
6
+ import type { Collection, Template } from '@tinacms/schema-tools';
7
7
  import { TinaSchema } from '@tinacms/schema-tools';
8
8
  export declare const createBuilder: ({ database, tinaSchema, }: {
9
9
  database: Database;
@@ -39,7 +39,7 @@ export declare class Builder {
39
39
  *
40
40
  * @param collections
41
41
  */
42
- buildCollectionDefinition: (collections: TinaCloudCollectionEnriched[]) => Promise<FieldDefinitionNode>;
42
+ buildCollectionDefinition: (collections: Collection<true>[]) => Promise<FieldDefinitionNode>;
43
43
  /**
44
44
  * ```graphql
45
45
  * # ex.
@@ -53,7 +53,7 @@ export declare class Builder {
53
53
  *
54
54
  * @param collections
55
55
  */
56
- buildMultiCollectionDefinition: (collections: TinaCloudCollectionEnriched[]) => Promise<FieldDefinitionNode>;
56
+ buildMultiCollectionDefinition: (collections: Collection<true>[]) => Promise<FieldDefinitionNode>;
57
57
  /**
58
58
  * ```graphql
59
59
  * # ex.
@@ -79,7 +79,7 @@ export declare class Builder {
79
79
  *
80
80
  * @param collections
81
81
  */
82
- multiCollectionDocument: (collections: TinaCloudCollectionEnriched[]) => Promise<FieldDefinitionNode>;
82
+ multiCollectionDocument: (collections: Collection<true>[]) => Promise<FieldDefinitionNode>;
83
83
  /**
84
84
  * ```graphql
85
85
  * # ex.
@@ -107,7 +107,7 @@ export declare class Builder {
107
107
  *
108
108
  * @param collections
109
109
  */
110
- buildCreateCollectionDocumentMutation: (collections: TinaCloudCollectionEnriched[]) => Promise<FieldDefinitionNode>;
110
+ buildCreateCollectionDocumentMutation: (collections: Collection<true>[]) => Promise<FieldDefinitionNode>;
111
111
  /**
112
112
  * ```graphql
113
113
  * # ex.
@@ -121,7 +121,7 @@ export declare class Builder {
121
121
  *
122
122
  * @param collections
123
123
  */
124
- buildUpdateCollectionDocumentMutation: (collections: TinaCloudCollectionEnriched[]) => Promise<FieldDefinitionNode>;
124
+ buildUpdateCollectionDocumentMutation: (collections: Collection<true>[]) => Promise<FieldDefinitionNode>;
125
125
  /**
126
126
  * ```graphql
127
127
  * # ex.
@@ -135,7 +135,7 @@ export declare class Builder {
135
135
  *
136
136
  * @param collections
137
137
  */
138
- buildDeleteCollectionDocumentMutation: (collections: TinaCloudCollectionEnriched[]) => Promise<FieldDefinitionNode>;
138
+ buildDeleteCollectionDocumentMutation: (collections: Collection<true>[]) => Promise<FieldDefinitionNode>;
139
139
  /**
140
140
  * ```graphql
141
141
  * # ex.
@@ -149,7 +149,7 @@ export declare class Builder {
149
149
  *
150
150
  * @param collection
151
151
  */
152
- collectionDocument: (collection: TinaCloudCollectionEnriched) => Promise<FieldDefinitionNode>;
152
+ collectionDocument: (collection: Collection<true>) => Promise<FieldDefinitionNode>;
153
153
  /**
154
154
  * Turns a collection into a fragment that gets updated on build. This fragment does not resolve references
155
155
  * ```graphql
@@ -164,7 +164,7 @@ export declare class Builder {
164
164
  * @public
165
165
  * @param collection a Tina Cloud collection
166
166
  */
167
- collectionFragment: (collection: TinaCloudCollectionEnriched) => Promise<import("graphql").FragmentDefinitionNode>;
167
+ collectionFragment: (collection: Collection<true>) => Promise<import("graphql").FragmentDefinitionNode>;
168
168
  /**
169
169
  * Given a collection this function returns its selections set. For example for Post this would return
170
170
  *
@@ -195,7 +195,7 @@ export declare class Builder {
195
195
  *
196
196
  * @param collection
197
197
  */
198
- updateCollectionDocumentMutation: (collection: TinaCloudCollectionEnriched) => Promise<FieldDefinitionNode>;
198
+ updateCollectionDocumentMutation: (collection: Collection<true>) => Promise<FieldDefinitionNode>;
199
199
  /**
200
200
  * ```graphql
201
201
  * # ex.
@@ -209,7 +209,7 @@ export declare class Builder {
209
209
  *
210
210
  * @param collection
211
211
  */
212
- createCollectionDocumentMutation: (collection: TinaCloudCollectionEnriched) => Promise<FieldDefinitionNode>;
212
+ createCollectionDocumentMutation: (collection: Collection<true>) => Promise<FieldDefinitionNode>;
213
213
  /**
214
214
  * ```graphql
215
215
  * # ex.
@@ -226,7 +226,7 @@ export declare class Builder {
226
226
  *
227
227
  * @param collection
228
228
  */
229
- collectionDocumentList: (collection: TinaCloudCollectionEnriched) => Promise<FieldDefinitionNode>;
229
+ collectionDocumentList: (collection: Collection<true>) => Promise<FieldDefinitionNode>;
230
230
  /**
231
231
  * GraphQL type definitions which remain unchanged regardless
232
232
  * of the supplied Tina schema. Ex. "node" interface
@@ -0,0 +1,3 @@
1
+ import { Template } from '@tinacms/schema-tools/src';
2
+ export declare const replaceNameOverrides: (template: Template, obj: any) => object;
3
+ export declare const applyNameOverrides: (template: Template, obj: any) => object;
@@ -2,7 +2,7 @@
2
2
 
3
3
  */
4
4
  import type { DocumentNode } from 'graphql';
5
- import type { TinaCloudSchemaBase, TinaSchema } from '@tinacms/schema-tools';
5
+ import type { CollectionTemplateable, TinaCloudCollection, Schema, TinaSchema } from '@tinacms/schema-tools';
6
6
  import type { Bridge } from '../database/bridge';
7
7
  import { BinaryFilter, IndexDefinition, TernaryFilter } from './datalayer';
8
8
  import { Level } from './level';
@@ -59,16 +59,33 @@ export declare class Database {
59
59
  }) => Promise<void>;
60
60
  put: (filepath: string, data: {
61
61
  [key: string]: unknown;
62
- }, collection?: string) => Promise<boolean>;
63
- stringifyFile: (filepath: string, data: {
62
+ }, collectionName?: string) => Promise<boolean>;
63
+ getTemplateDetailsForFile(collection: TinaCloudCollection<true>, data: {
64
64
  [key: string]: unknown;
65
- }) => Promise<{
66
- stringifiedFile: string;
67
- payload: {
68
- [key: string]: unknown;
65
+ }): Promise<{
66
+ template: {
67
+ label?: string | boolean;
68
+ name: string;
69
+ ui?: {
70
+ itemProps?(item: Record<string, any>): {
71
+ key?: string;
72
+ label?: string | boolean;
73
+ };
74
+ defaultItem?: import("@tinacms/schema-tools").DefaultItem<Record<string, any>>;
75
+ previewSrc?: string;
76
+ };
77
+ fields: ((import("@tinacms/schema-tools").StringField | import("@tinacms/schema-tools").NumberField | import("@tinacms/schema-tools").BooleanField | import("@tinacms/schema-tools").DateTimeField | import("@tinacms/schema-tools").ImageField | import("@tinacms/schema-tools").ReferenceField | import("@tinacms/schema-tools").RichTextField<false> | import("@tinacms/schema-tools").ObjectField<false>) & {})[];
69
78
  };
70
- keepTemplateKey: boolean;
79
+ info: CollectionTemplateable;
80
+ }>;
81
+ formatBodyOnPayload: (filepath: string, data: {
82
+ [key: string]: unknown;
83
+ }) => Promise<{
84
+ [key: string]: unknown;
71
85
  }>;
86
+ stringifyFile: (filepath: string, payload: {
87
+ [key: string]: unknown;
88
+ }, collection: TinaCloudCollection<true>) => Promise<string>;
72
89
  /**
73
90
  * Clears the internal cache of the tinaSchema and the lookup file. This allows the state to be reset
74
91
  */
@@ -77,7 +94,7 @@ export declare class Database {
77
94
  getLookup: (returnType: string) => Promise<LookupMapType>;
78
95
  getGraphQLSchema: () => Promise<DocumentNode>;
79
96
  getGraphQLSchemaFromBridge: () => Promise<DocumentNode>;
80
- getTinaSchema: (level?: Level) => Promise<TinaCloudSchemaBase>;
97
+ getTinaSchema: (level?: Level) => Promise<Schema>;
81
98
  getSchema: (level?: Level) => Promise<TinaSchema>;
82
99
  getIndexDefinitions: (level?: Level) => Promise<Record<string, Record<string, IndexDefinition>>>;
83
100
  documentExists: (fullpath: unknown) => Promise<boolean>;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
 
3
3
  */
4
- import type { TinaCloudSchema as TinaCloudSchemaBase, TinaCloudCollection as TinaCloudCollectionBase, TinaCloudTemplateBase as TinaTemplate, TinaFieldBase } from '@tinacms/schema-tools';
4
+ import type { Schema, Collection, Template as TinaTemplate } from '@tinacms/schema-tools';
5
5
  import { buildDotTinaFiles } from './build';
6
6
  export { resolve } from './resolve';
7
7
  export * from './resolver/error';
@@ -19,12 +19,8 @@ export declare const buildSchema: (rootPath: string, database: Database, flags?:
19
19
  tinaSchema: import("@tinacms/schema-tools").TinaSchema;
20
20
  }>;
21
21
  export declare const getASTSchema: (database: Database) => Promise<import("graphql").GraphQLSchema>;
22
- export declare type TinaCloudSchema = TinaCloudSchemaBase<false>;
23
- export declare type TinaSchema = TinaCloudSchema;
24
- export declare type TinaCloudCollection = TinaCloudCollectionBase<false>;
25
- export declare type TinaCollection = TinaCloudCollectionBase<false>;
26
- export declare type TinaField = TinaFieldBase;
27
- export type { TinaTemplate };
22
+ export declare type TinaSchema = Schema;
23
+ export type { TinaTemplate, Schema, Collection };
28
24
  export { FilesystemBridge, AuditFileSystemBridge, } from './database/bridge/filesystem';
29
25
  export { IsomorphicBridge } from './database/bridge/isomorphic';
30
26
  export type { Bridge } from './database/bridge';