@tinacms/graphql 0.59.11 → 0.60.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/dist/resolve.d.ts CHANGED
@@ -11,7 +11,9 @@ See the License for the specific language governing permissions and
11
11
  limitations under the License.
12
12
  */
13
13
  import type { Database } from './database';
14
- export declare const resolve: ({ query, variables, database, silenceErrors, }: {
14
+ import type { GraphQLConfig } from './types';
15
+ export declare const resolve: ({ config, query, variables, database, silenceErrors, }: {
16
+ config?: GraphQLConfig;
15
17
  query: string;
16
18
  variables: object;
17
19
  database: Database;
@@ -10,11 +10,11 @@ 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 { TinaSchema } from '../schema';
14
13
  import { Database } from '../database';
15
- import type { Collectable, ReferenceTypeWithNamespace, TinaCloudCollection } from '../types';
16
- import { TinaFieldInner } from '../types';
14
+ import type { Collectable, ReferenceTypeWithNamespace, TinaCloudCollection, TinaFieldInner, TinaSchema } from '@tinacms/schema-tools';
15
+ import type { GraphQLConfig } from '../types';
17
16
  interface ResolverConfig {
17
+ config?: GraphQLConfig;
18
18
  database: Database;
19
19
  tinaSchema: TinaSchema;
20
20
  }
@@ -25,11 +25,12 @@ export declare const createResolver: (args: ResolverConfig) => Resolver;
25
25
  */
26
26
  export declare class Resolver {
27
27
  init: ResolverConfig;
28
+ config: GraphQLConfig;
28
29
  database: Database;
29
30
  tinaSchema: TinaSchema;
30
31
  constructor(init: ResolverConfig);
31
- resolveCollection: (collectionName: string, hasDocuments?: boolean) => Promise<{
32
- fields: string | TinaFieldInner<true>[];
32
+ resolveCollection: (args: any, collectionName: string, hasDocuments?: boolean) => Promise<{
33
+ fields: TinaFieldInner<true>[];
33
34
  templates?: undefined;
34
35
  references?: ReferenceTypeWithNamespace[];
35
36
  namespace: string[];
@@ -38,14 +39,18 @@ export declare class Resolver {
38
39
  path: string;
39
40
  format?: "json" | "md" | "markdown" | "mdx";
40
41
  match?: string;
41
- indexes?: import("../types").TinaIndex[];
42
- documents: {};
42
+ documents: {
43
+ collection: TinaCloudCollection<true>;
44
+ hasDocuments: boolean;
45
+ };
43
46
  } | {
44
47
  templates: (string | {
45
48
  label: string;
46
49
  name: string;
47
50
  fields: TinaFieldInner<true>[];
48
- ui?: object;
51
+ ui?: object | (import("@tinacms/schema-tools").UIField<any, any> & {
52
+ previewSrc: string;
53
+ });
49
54
  namespace: string[];
50
55
  })[];
51
56
  fields?: undefined;
@@ -56,13 +61,14 @@ export declare class Resolver {
56
61
  path: string;
57
62
  format?: "json" | "md" | "markdown" | "mdx";
58
63
  match?: string;
59
- indexes?: import("../types").TinaIndex[];
60
- documents: {};
64
+ documents: {
65
+ collection: TinaCloudCollection<true>;
66
+ hasDocuments: boolean;
67
+ };
61
68
  }>;
62
69
  getDocument: (fullPath: unknown) => Promise<{
63
- __typename: string;
64
- id: string;
65
- sys: {
70
+ _sys: {
71
+ title: any;
66
72
  basename: string;
67
73
  filename: string;
68
74
  extension: string;
@@ -72,26 +78,16 @@ export declare class Resolver {
72
78
  collection: TinaCloudCollection<true>;
73
79
  template: string | number;
74
80
  };
75
- data: {
76
- _collection: string;
77
- _template: string;
78
- };
79
- values: {
81
+ _values: {
80
82
  _collection: string;
81
83
  _template: string;
82
84
  };
83
- dataJSON: {
84
- _collection: string;
85
- _template: string;
86
- };
87
- form: {
88
- label: string;
89
- name: string;
90
- fields: unknown[];
91
- };
85
+ _collection: string;
86
+ _template: string;
87
+ __typename: string;
88
+ id: string;
92
89
  }>;
93
90
  deleteDocument: (fullPath: unknown) => Promise<void>;
94
- getDocumentFields: () => Promise<{}>;
95
91
  buildObjectMutations: (fieldValue: any, field: Collectable) => {
96
92
  [key: string]: unknown;
97
93
  } | {
@@ -103,9 +99,8 @@ export declare class Resolver {
103
99
  args: unknown;
104
100
  isAddPendingDocument: boolean;
105
101
  }) => Promise<{
106
- __typename: string;
107
- id: string;
108
- sys: {
102
+ _sys: {
103
+ title: any;
109
104
  basename: string;
110
105
  filename: string;
111
106
  extension: string;
@@ -115,23 +110,14 @@ export declare class Resolver {
115
110
  collection: TinaCloudCollection<true>;
116
111
  template: string | number;
117
112
  };
118
- data: {
119
- _collection: string;
120
- _template: string;
121
- };
122
- values: {
113
+ _values: {
123
114
  _collection: string;
124
115
  _template: string;
125
116
  };
126
- dataJSON: {
127
- _collection: string;
128
- _template: string;
129
- };
130
- form: {
131
- label: string;
132
- name: string;
133
- fields: unknown[];
134
- };
117
+ _collection: string;
118
+ _template: string;
119
+ __typename: string;
120
+ id: string;
135
121
  }>;
136
122
  updateResolveDocument: ({ collection, realPath, args, isAddPendingDocument, isCollectionSpecific, }: {
137
123
  collection: TinaCloudCollection<true>;
@@ -140,9 +126,8 @@ export declare class Resolver {
140
126
  isAddPendingDocument: boolean;
141
127
  isCollectionSpecific: boolean;
142
128
  }) => Promise<{
143
- __typename: string;
144
- id: string;
145
- sys: {
129
+ _sys: {
130
+ title: any;
146
131
  basename: string;
147
132
  filename: string;
148
133
  extension: string;
@@ -152,23 +137,14 @@ export declare class Resolver {
152
137
  collection: TinaCloudCollection<true>;
153
138
  template: string | number;
154
139
  };
155
- data: {
140
+ _values: {
156
141
  _collection: string;
157
142
  _template: string;
158
143
  };
159
- values: {
160
- _collection: string;
161
- _template: string;
162
- };
163
- dataJSON: {
164
- _collection: string;
165
- _template: string;
166
- };
167
- form: {
168
- label: string;
169
- name: string;
170
- fields: unknown[];
171
- };
144
+ _collection: string;
145
+ _template: string;
146
+ __typename: string;
147
+ id: string;
172
148
  }>;
173
149
  resolveDocument: ({ args, collection: collectionName, isMutation, isCreation, isDeletion, isAddPendingDocument, isCollectionSpecific, }: {
174
150
  args: unknown;
@@ -179,9 +155,8 @@ export declare class Resolver {
179
155
  isAddPendingDocument?: boolean;
180
156
  isCollectionSpecific?: boolean;
181
157
  }) => Promise<{
182
- __typename: string;
183
- id: string;
184
- sys: {
158
+ _sys: {
159
+ title: any;
185
160
  basename: string;
186
161
  filename: string;
187
162
  extension: string;
@@ -191,23 +166,14 @@ export declare class Resolver {
191
166
  collection: TinaCloudCollection<true>;
192
167
  template: string | number;
193
168
  };
194
- data: {
195
- _collection: string;
196
- _template: string;
197
- };
198
- values: {
199
- _collection: string;
200
- _template: string;
201
- };
202
- dataJSON: {
169
+ _values: {
203
170
  _collection: string;
204
171
  _template: string;
205
172
  };
206
- form: {
207
- label: string;
208
- name: string;
209
- fields: unknown[];
210
- };
173
+ _collection: string;
174
+ _template: string;
175
+ __typename: string;
176
+ id: string;
211
177
  }>;
212
178
  resolveCollectionConnections: ({ ids }: {
213
179
  ids: string[];
@@ -215,9 +181,8 @@ export declare class Resolver {
215
181
  totalCount: number;
216
182
  edges: {
217
183
  node: {
218
- __typename: string;
219
- id: string;
220
- sys: {
184
+ _sys: {
185
+ title: any;
221
186
  basename: string;
222
187
  filename: string;
223
188
  extension: string;
@@ -227,23 +192,14 @@ export declare class Resolver {
227
192
  collection: TinaCloudCollection<true>;
228
193
  template: string | number;
229
194
  };
230
- data: {
231
- _collection: string;
232
- _template: string;
233
- };
234
- values: {
235
- _collection: string;
236
- _template: string;
237
- };
238
- dataJSON: {
195
+ _values: {
239
196
  _collection: string;
240
197
  _template: string;
241
198
  };
242
- form: {
243
- label: string;
244
- name: string;
245
- fields: unknown[];
246
- };
199
+ _collection: string;
200
+ _template: string;
201
+ __typename: string;
202
+ id: string;
247
203
  };
248
204
  }[];
249
205
  }>;
@@ -283,6 +239,5 @@ export declare class Resolver {
283
239
  * from the corresponding field name in the key
284
240
  */
285
241
  private buildParams;
286
- private resolveField;
287
242
  }
288
243
  export {};
package/dist/types.d.ts CHANGED
@@ -263,4 +263,10 @@ export declare type Templateable = {
263
263
  fields: TinaFieldEnriched[];
264
264
  ui?: object;
265
265
  };
266
+ export declare type GraphQLConfig = {
267
+ useRelativeMedia: true;
268
+ } | {
269
+ useRelativeMedia: false;
270
+ clientId: string;
271
+ };
266
272
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
- "version": "0.59.11",
3
+ "version": "0.60.2",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [
@@ -97,6 +97,7 @@
97
97
  },
98
98
  "devDependencies": {
99
99
  "@tinacms/datalayer": "0.1.1",
100
+ "@tinacms/schema-tools": "0.0.4",
100
101
  "@tinacms/scripts": "0.50.7",
101
102
  "@types/cors": "^2.8.7",
102
103
  "@types/estree": "^0.0.50",
@@ -119,5 +120,8 @@
119
120
  "jest-matcher-utils": "27.0.6",
120
121
  "nodemon": "^2.0.4",
121
122
  "typescript": "^4.3.5"
123
+ },
124
+ "peerDependencies": {
125
+ "@tinacms/schema-tools": "*"
122
126
  }
123
127
  }