@tinacms/graphql 0.0.0-c8b1d84-20241003015733 → 0.0.0-cef656e-20250119001929

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.
@@ -11,15 +11,24 @@ interface ResolverConfig {
11
11
  isAudit: boolean;
12
12
  }
13
13
  export declare const createResolver: (args: ResolverConfig) => Resolver;
14
- export declare const transformDocumentIntoPayload: (fullPath: string, rawData: {
15
- _collection: any;
16
- _template: any;
17
- }, tinaSchema: TinaSchema, config?: GraphQLConfig, isAudit?: boolean) => Promise<{
14
+ export declare const transformDocumentIntoPayload: (args: {
15
+ fullPath: string;
16
+ rawData: {
17
+ _collection: any;
18
+ _template: any;
19
+ };
20
+ tinaSchema: TinaSchema;
21
+ config?: GraphQLConfig;
22
+ isAudit?: boolean;
23
+ hasReferences?: boolean;
24
+ context: Record<string, unknown>;
25
+ }) => Promise<{
18
26
  _sys: {
19
27
  title: any;
20
28
  basename: string;
21
29
  filename: string;
22
30
  extension: string;
31
+ hasReferences: boolean;
23
32
  path: string;
24
33
  relativePath: string;
25
34
  breadcrumbs: string[];
@@ -49,6 +58,7 @@ export declare class Resolver {
49
58
  database: Database;
50
59
  tinaSchema: TinaSchema;
51
60
  isAudit: boolean;
61
+ context: Record<string, unknown>;
52
62
  constructor(init: ResolverConfig);
53
63
  resolveCollection: (args: any, collectionName: string, hasDocuments?: boolean) => Promise<{
54
64
  fields: TinaField<true>[];
@@ -117,6 +127,7 @@ export declare class Resolver {
117
127
  basename: string;
118
128
  filename: string;
119
129
  extension: string;
130
+ hasReferences: boolean;
120
131
  path: string;
121
132
  relativePath: string;
122
133
  breadcrumbs: string[];
@@ -140,12 +151,16 @@ export declare class Resolver {
140
151
  name: any;
141
152
  path: any;
142
153
  }>;
143
- getDocument: (fullPath: unknown) => Promise<{
154
+ getDocument: (fullPath: unknown, opts?: {
155
+ collection?: Collection<true>;
156
+ checkReferences?: boolean;
157
+ }) => Promise<{
144
158
  _sys: {
145
159
  title: any;
146
160
  basename: string;
147
161
  filename: string;
148
162
  extension: string;
163
+ hasReferences: boolean;
149
164
  path: string;
150
165
  relativePath: string;
151
166
  breadcrumbs: string[];
@@ -184,6 +199,7 @@ export declare class Resolver {
184
199
  basename: string;
185
200
  filename: string;
186
201
  extension: string;
202
+ hasReferences: boolean;
187
203
  path: string;
188
204
  relativePath: string;
189
205
  breadcrumbs: string[];
@@ -215,6 +231,7 @@ export declare class Resolver {
215
231
  basename: string;
216
232
  filename: string;
217
233
  extension: string;
234
+ hasReferences: boolean;
218
235
  path: string;
219
236
  relativePath: string;
220
237
  breadcrumbs: string[];
@@ -255,6 +272,7 @@ export declare class Resolver {
255
272
  basename: string;
256
273
  filename: string;
257
274
  extension: string;
275
+ hasReferences: boolean;
258
276
  path: string;
259
277
  relativePath: string;
260
278
  breadcrumbs: string[];
@@ -285,6 +303,7 @@ export declare class Resolver {
285
303
  basename: string;
286
304
  filename: string;
287
305
  extension: string;
306
+ hasReferences: boolean;
288
307
  path: string;
289
308
  relativePath: string;
290
309
  breadcrumbs: string[];
@@ -325,6 +344,20 @@ export declare class Resolver {
325
344
  endCursor: string;
326
345
  };
327
346
  }>;
347
+ /**
348
+ * Checks if a document has references to it
349
+ * @param id The id of the document to check for references
350
+ * @param c The collection to check for references
351
+ * @returns true if the document has references, false otherwise
352
+ */
353
+ private hasReferences;
354
+ /**
355
+ * Finds references to a document
356
+ * @param id the id of the document to find references to
357
+ * @param c the collection to find references in
358
+ * @returns references to the document in the form of a map of collection names to a list of fields that reference the document
359
+ */
360
+ private findReferences;
328
361
  private buildFieldMutations;
329
362
  /**
330
363
  * A mutation looks nearly identical between updateDocument:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
- "version": "0.0.0-c8b1d84-20241003015733",
3
+ "version": "0.0.0-cef656e-20250119001929",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "typings": "dist/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  "isomorphic-git": "^1.27.1",
35
35
  "js-sha1": "^0.6.0",
36
36
  "js-yaml": "^3.14.1",
37
- "jsonpath-plus": "^6.0.1",
37
+ "jsonpath-plus": "10.1.0",
38
38
  "lodash.clonedeep": "^4.5.0",
39
39
  "lodash.set": "^4.3.2",
40
40
  "lodash.uniqby": "^4.7.0",
@@ -44,8 +44,8 @@
44
44
  "readable-stream": "^4.5.2",
45
45
  "scmp": "^2.1.0",
46
46
  "yup": "^0.32.11",
47
- "@tinacms/schema-tools": "0.0.0-c8b1d84-20241003015733",
48
- "@tinacms/mdx": "0.0.0-c8b1d84-20241003015733"
47
+ "@tinacms/mdx": "0.0.0-cef656e-20250119001929",
48
+ "@tinacms/schema-tools": "1.7.0"
49
49
  },
50
50
  "publishConfig": {
51
51
  "registry": "https://registry.npmjs.org"
@@ -59,33 +59,31 @@
59
59
  "@types/estree": "^0.0.50",
60
60
  "@types/express": "^4.17.21",
61
61
  "@types/fs-extra": "^9.0.13",
62
- "@types/jest": "^26.0.24",
63
62
  "@types/js-yaml": "^3.12.10",
64
63
  "@types/lodash.camelcase": "^4.3.9",
65
64
  "@types/lodash.upperfirst": "^4.3.9",
66
65
  "@types/lru-cache": "^5.1.1",
67
66
  "@types/mdast": "^3.0.15",
68
67
  "@types/micromatch": "^4.0.9",
69
- "@types/node": "^22.7.4",
68
+ "@types/node": "^22.9.0",
70
69
  "@types/normalize-path": "^3.0.2",
71
70
  "@types/ws": "^7.4.7",
72
71
  "@types/yup": "^0.29.14",
73
- "jest": "^29.7.0",
74
- "jest-diff": "^29.7.0",
75
72
  "jest-file-snapshot": "^0.5.0",
76
- "jest-matcher-utils": "^29.7.0",
77
73
  "memory-level": "^1.0.0",
78
74
  "nodemon": "3.1.4",
79
- "typescript": "^5.6.2",
80
- "@tinacms/schema-tools": "0.0.0-c8b1d84-20241003015733",
81
- "@tinacms/scripts": "1.2.3"
75
+ "typescript": "^5.6.3",
76
+ "vite": "^4.3.9",
77
+ "vitest": "^0.32.2",
78
+ "zod": "^3.23.8",
79
+ "@tinacms/schema-tools": "1.7.0",
80
+ "@tinacms/scripts": "1.3.1"
82
81
  },
83
82
  "scripts": {
84
83
  "types": "pnpm tsc",
85
84
  "build": "tinacms-scripts build",
86
85
  "docs": "pnpm typedoc",
87
86
  "serve": "pnpm nodemon dist/server.js",
88
- "test": "jest",
89
- "test-watch": "jest --watch"
87
+ "test": "vitest"
90
88
  }
91
89
  }