@tinacms/graphql 0.0.0-e0ddb8c-20241004065742 → 0.0.0-e5c0e91-20250421003142

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.
@@ -14,12 +14,13 @@ export declare const createResolver: (args: ResolverConfig) => Resolver;
14
14
  export declare const transformDocumentIntoPayload: (fullPath: string, rawData: {
15
15
  _collection: any;
16
16
  _template: any;
17
- }, tinaSchema: TinaSchema, config?: GraphQLConfig, isAudit?: boolean) => Promise<{
17
+ }, tinaSchema: TinaSchema, config?: GraphQLConfig, isAudit?: boolean, hasReferences?: boolean) => Promise<{
18
18
  _sys: {
19
19
  title: any;
20
20
  basename: string;
21
21
  filename: string;
22
22
  extension: string;
23
+ hasReferences: boolean;
23
24
  path: string;
24
25
  relativePath: string;
25
26
  breadcrumbs: string[];
@@ -39,6 +40,17 @@ export declare const transformDocumentIntoPayload: (fullPath: string, rawData: {
39
40
  __typename: string;
40
41
  id: string;
41
42
  }>;
43
+ /**
44
+ * Updates a property in an object using a JSONPath.
45
+ * @param obj - The object to update.
46
+ * @param path - The JSONPath string.
47
+ * @param newValue - The new value to set at the specified path.
48
+ * @returns the updated object.
49
+ */
50
+ export declare const updateObjectWithJsonPath: (obj: any, path: string, oldValue: any, newValue: any) => {
51
+ object: any;
52
+ updated: boolean;
53
+ };
42
54
  /**
43
55
  * The resolver provides functions for all possible types of lookup
44
56
  * values and retrieves them from the database
@@ -117,6 +129,7 @@ export declare class Resolver {
117
129
  basename: string;
118
130
  filename: string;
119
131
  extension: string;
132
+ hasReferences: boolean;
120
133
  path: string;
121
134
  relativePath: string;
122
135
  breadcrumbs: string[];
@@ -140,12 +153,16 @@ export declare class Resolver {
140
153
  name: any;
141
154
  path: any;
142
155
  }>;
143
- getDocument: (fullPath: unknown) => Promise<{
156
+ getDocument: (fullPath: unknown, opts?: {
157
+ collection?: Collection<true>;
158
+ checkReferences?: boolean;
159
+ }) => Promise<{
144
160
  _sys: {
145
161
  title: any;
146
162
  basename: string;
147
163
  filename: string;
148
164
  extension: string;
165
+ hasReferences: boolean;
149
166
  path: string;
150
167
  relativePath: string;
151
168
  breadcrumbs: string[];
@@ -184,6 +201,7 @@ export declare class Resolver {
184
201
  basename: string;
185
202
  filename: string;
186
203
  extension: string;
204
+ hasReferences: boolean;
187
205
  path: string;
188
206
  relativePath: string;
189
207
  breadcrumbs: string[];
@@ -215,6 +233,7 @@ export declare class Resolver {
215
233
  basename: string;
216
234
  filename: string;
217
235
  extension: string;
236
+ hasReferences: boolean;
218
237
  path: string;
219
238
  relativePath: string;
220
239
  breadcrumbs: string[];
@@ -255,6 +274,7 @@ export declare class Resolver {
255
274
  basename: string;
256
275
  filename: string;
257
276
  extension: string;
277
+ hasReferences: boolean;
258
278
  path: string;
259
279
  relativePath: string;
260
280
  breadcrumbs: string[];
@@ -285,6 +305,7 @@ export declare class Resolver {
285
305
  basename: string;
286
306
  filename: string;
287
307
  extension: string;
308
+ hasReferences: boolean;
288
309
  path: string;
289
310
  relativePath: string;
290
311
  breadcrumbs: string[];
@@ -325,6 +346,20 @@ export declare class Resolver {
325
346
  endCursor: string;
326
347
  };
327
348
  }>;
349
+ /**
350
+ * Checks if a document has references to it
351
+ * @param id The id of the document to check for references
352
+ * @param c The collection to check for references
353
+ * @returns true if the document has references, false otherwise
354
+ */
355
+ private hasReferences;
356
+ /**
357
+ * Finds references to a document
358
+ * @param id the id of the document to find references to
359
+ * @param c the collection to find references in
360
+ * @returns a map of references to the document
361
+ */
362
+ private findReferences;
328
363
  private buildFieldMutations;
329
364
  /**
330
365
  * A mutation looks nearly identical between updateDocument:
@@ -1,10 +1,10 @@
1
1
  /**
2
2
 
3
3
  */
4
- import type { GraphQLConfig } from '../types';
5
4
  import type { Schema } from '@tinacms/schema-tools';
5
+ import type { GraphQLConfig } from '../types';
6
6
  /**
7
- * Strips away the Tina Cloud Asset URL from an `image` value
7
+ * Strips away the TinaCloud Asset URL from an `image` value
8
8
  *
9
9
  * @param {string | string[]} value
10
10
  * @param {GraphQLConfig} config
@@ -12,7 +12,7 @@ import type { Schema } from '@tinacms/schema-tools';
12
12
  */
13
13
  export declare const resolveMediaCloudToRelative: (value: string | string[], config: GraphQLConfig, schema: Schema<true>) => string | string[];
14
14
  /**
15
- * Adds Tina Cloud Asset URL to an `image` value
15
+ * Adds TinaCloud Asset URL to an `image` value
16
16
  *
17
17
  * @param {string | string[]} value
18
18
  * @param {GraphQLConfig} config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
- "version": "0.0.0-e0ddb8c-20241004065742",
3
+ "version": "0.0.0-e5c0e91-20250421003142",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "typings": "dist/index.d.ts",
@@ -26,26 +26,26 @@
26
26
  "@iarna/toml": "^2.2.5",
27
27
  "abstract-level": "^1.0.4",
28
28
  "date-fns": "^2.30.0",
29
- "fast-glob": "^3.3.2",
30
- "fs-extra": "^11.2.0",
29
+ "fast-glob": "^3.3.3",
30
+ "fs-extra": "^11.3.0",
31
31
  "glob-parent": "^6.0.2",
32
32
  "graphql": "15.8.0",
33
33
  "gray-matter": "^4.0.3",
34
- "isomorphic-git": "^1.27.1",
34
+ "isomorphic-git": "^1.29.0",
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",
41
41
  "many-level": "^2.0.0",
42
42
  "micromatch": "4.0.8",
43
43
  "normalize-path": "^3.0.0",
44
- "readable-stream": "^4.5.2",
44
+ "readable-stream": "^4.7.0",
45
45
  "scmp": "^2.1.0",
46
46
  "yup": "^0.32.11",
47
- "@tinacms/schema-tools": "0.0.0-e0ddb8c-20241004065742",
48
- "@tinacms/mdx": "0.0.0-e0ddb8c-20241004065742"
47
+ "@tinacms/mdx": "0.0.0-e5c0e91-20250421003142",
48
+ "@tinacms/schema-tools": "0.0.0-e5c0e91-20250421003142"
49
49
  },
50
50
  "publishConfig": {
51
51
  "registry": "https://registry.npmjs.org"
@@ -59,33 +59,32 @@
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.13.1",
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-e0ddb8c-20241004065742",
81
- "@tinacms/scripts": "1.2.3"
75
+ "typescript": "^5.7.3",
76
+ "vite": "^4.5.9",
77
+ "vitest": "^0.32.4",
78
+ "zod": "^3.24.2",
79
+ "@tinacms/scripts": "1.3.4",
80
+ "@tinacms/schema-tools": "0.0.0-e5c0e91-20250421003142"
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 run",
88
+ "test-watch": "vitest"
90
89
  }
91
90
  }