@tinacms/graphql 0.0.0-e70425b-20241028042614 → 0.0.0-e96d36b-20251210035710
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/README.md +144 -0
- package/dist/ast-builder/index.d.ts +2 -3
- package/dist/build.d.ts +2 -4
- package/dist/builder/index.d.ts +2 -2
- package/dist/database/alias-utils.d.ts +1 -1
- package/dist/database/bridge/filesystem.d.ts +1 -1
- package/dist/database/datalayer.d.ts +5 -1
- package/dist/database/index.d.ts +2 -0
- package/dist/database/util.d.ts +6 -9
- package/dist/index.d.ts +1 -4
- package/dist/index.js +4044 -3272
- package/dist/mdx/index.d.ts +2 -7
- package/dist/resolver/auth-fields.d.ts +31 -0
- package/dist/resolver/error.d.ts +1 -8
- package/dist/resolver/index.d.ts +42 -7
- package/dist/resolver/media-utils.d.ts +3 -3
- package/dist/schema/createSchema.d.ts +0 -3
- package/dist/schema/validate.d.ts +0 -3
- package/package.json +25 -32
- package/dist/index.mjs +0 -7313
- package/readme.md +0 -194
package/dist/mdx/index.d.ts
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { TinaSchema } from '@tinacms/schema-tools';
|
|
2
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
3
|
+
import type { Resolver } from './index';
|
|
4
|
+
export declare function handleAuthenticate({ tinaSchema, resolver, sub, password, ctxUser, }: {
|
|
5
|
+
tinaSchema: TinaSchema;
|
|
6
|
+
resolver: Resolver;
|
|
7
|
+
sub?: string;
|
|
8
|
+
password: string;
|
|
9
|
+
info: GraphQLResolveInfo;
|
|
10
|
+
ctxUser?: {
|
|
11
|
+
sub?: string;
|
|
12
|
+
};
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
export declare function handleAuthorize({ tinaSchema, resolver, sub, ctxUser, }: {
|
|
15
|
+
tinaSchema: TinaSchema;
|
|
16
|
+
resolver: Resolver;
|
|
17
|
+
sub?: string;
|
|
18
|
+
info: GraphQLResolveInfo;
|
|
19
|
+
ctxUser?: {
|
|
20
|
+
sub?: string;
|
|
21
|
+
};
|
|
22
|
+
}): Promise<any>;
|
|
23
|
+
export declare function handleUpdatePassword({ tinaSchema, resolver, password, ctxUser, }: {
|
|
24
|
+
tinaSchema: TinaSchema;
|
|
25
|
+
resolver: Resolver;
|
|
26
|
+
password: string;
|
|
27
|
+
info: GraphQLResolveInfo;
|
|
28
|
+
ctxUser?: {
|
|
29
|
+
sub?: string;
|
|
30
|
+
};
|
|
31
|
+
}): Promise<boolean>;
|
package/dist/resolver/error.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare class TinaGraphQLError extends Error implements GraphQLError {
|
|
|
15
15
|
constructor(message: string, extensions?: Record<string, any>);
|
|
16
16
|
}
|
|
17
17
|
export type TypeFetchErrorArgs = {
|
|
18
|
+
/** @deprecated */
|
|
18
19
|
stack?: string;
|
|
19
20
|
file?: string;
|
|
20
21
|
includeAuditMessage?: boolean;
|
|
@@ -22,7 +23,6 @@ export type TypeFetchErrorArgs = {
|
|
|
22
23
|
collection?: string;
|
|
23
24
|
};
|
|
24
25
|
export declare class TinaFetchError extends Error {
|
|
25
|
-
stack?: string;
|
|
26
26
|
collection?: string;
|
|
27
27
|
file?: string;
|
|
28
28
|
originalError: Error;
|
|
@@ -30,16 +30,9 @@ export declare class TinaFetchError extends Error {
|
|
|
30
30
|
}
|
|
31
31
|
export declare class TinaQueryError extends TinaFetchError {
|
|
32
32
|
stack?: string;
|
|
33
|
-
collection?: string;
|
|
34
|
-
file?: string;
|
|
35
|
-
originalError: Error;
|
|
36
33
|
constructor(args: TypeFetchErrorArgs);
|
|
37
34
|
}
|
|
38
35
|
export declare class TinaParseDocumentError extends TinaFetchError {
|
|
39
|
-
stack?: string;
|
|
40
|
-
collection?: string;
|
|
41
|
-
file?: string;
|
|
42
|
-
originalError: Error;
|
|
43
36
|
constructor(args: TypeFetchErrorArgs);
|
|
44
37
|
toString(): string;
|
|
45
38
|
}
|
package/dist/resolver/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
*/
|
|
4
4
|
import { Database } from '../database';
|
|
5
|
-
import type { Collectable, Collection,
|
|
5
|
+
import type { Collectable, Collection, Template, TinaField, TinaSchema } from '@tinacms/schema-tools';
|
|
6
6
|
import type { GraphQLConfig } from '../types';
|
|
7
7
|
interface ResolverConfig {
|
|
8
8
|
config?: GraphQLConfig;
|
|
@@ -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
|
|
@@ -62,10 +74,10 @@ export declare class Resolver {
|
|
|
62
74
|
name: string;
|
|
63
75
|
}[];
|
|
64
76
|
}[];
|
|
65
|
-
format?: "
|
|
77
|
+
format?: import("@tinacms/schema-tools").ContentFormat;
|
|
66
78
|
ui?: import("@tinacms/schema-tools").UICollection;
|
|
67
79
|
defaultItem?: import("@tinacms/schema-tools").DefaultItem<Record<string, any>>;
|
|
68
|
-
frontmatterFormat?: "
|
|
80
|
+
frontmatterFormat?: import("@tinacms/schema-tools").ContentFrontmatterFormat;
|
|
69
81
|
frontmatterDelimiters?: [string, string] | string;
|
|
70
82
|
match?: {
|
|
71
83
|
include?: string;
|
|
@@ -90,10 +102,10 @@ export declare class Resolver {
|
|
|
90
102
|
name: string;
|
|
91
103
|
}[];
|
|
92
104
|
}[];
|
|
93
|
-
format?: "
|
|
105
|
+
format?: import("@tinacms/schema-tools").ContentFormat;
|
|
94
106
|
ui?: import("@tinacms/schema-tools").UICollection;
|
|
95
107
|
defaultItem?: import("@tinacms/schema-tools").DefaultItem<Record<string, any>>;
|
|
96
|
-
frontmatterFormat?: "
|
|
108
|
+
frontmatterFormat?: import("@tinacms/schema-tools").ContentFrontmatterFormat;
|
|
97
109
|
frontmatterDelimiters?: [string, string] | string;
|
|
98
110
|
match?: {
|
|
99
111
|
include?: string;
|
|
@@ -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
|
|
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
|
|
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
|
|
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,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/graphql",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.0-e96d36b-20251210035710",
|
|
4
5
|
"main": "dist/index.js",
|
|
5
|
-
"module": "dist/index.
|
|
6
|
-
"typings": "dist/index.d.ts",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"package.json",
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"exports": {
|
|
12
|
-
"
|
|
13
|
-
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
}
|
|
14
16
|
},
|
|
15
17
|
"license": "SEE LICENSE IN LICENSE",
|
|
16
18
|
"buildConfig": {
|
|
@@ -26,26 +28,23 @@
|
|
|
26
28
|
"@iarna/toml": "^2.2.5",
|
|
27
29
|
"abstract-level": "^1.0.4",
|
|
28
30
|
"date-fns": "^2.30.0",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
+
"es-toolkit": "^1.42.0",
|
|
32
|
+
"fast-glob": "^3.3.3",
|
|
33
|
+
"fs-extra": "^11.3.0",
|
|
31
34
|
"glob-parent": "^6.0.2",
|
|
32
35
|
"graphql": "15.8.0",
|
|
33
36
|
"gray-matter": "^4.0.3",
|
|
34
|
-
"isomorphic-git": "^1.
|
|
37
|
+
"isomorphic-git": "^1.29.0",
|
|
35
38
|
"js-sha1": "^0.6.0",
|
|
36
39
|
"js-yaml": "^3.14.1",
|
|
37
|
-
"jsonpath-plus": "
|
|
38
|
-
"lodash.clonedeep": "^4.5.0",
|
|
39
|
-
"lodash.set": "^4.3.2",
|
|
40
|
-
"lodash.uniqby": "^4.7.0",
|
|
40
|
+
"jsonpath-plus": "10.1.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.
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"@tinacms/
|
|
48
|
-
"@tinacms/schema-tools": "0.0.0-e70425b-20241028042614"
|
|
44
|
+
"readable-stream": "^4.7.0",
|
|
45
|
+
"yup": "^1.6.1",
|
|
46
|
+
"@tinacms/mdx": "0.0.0-e96d36b-20251210035710",
|
|
47
|
+
"@tinacms/schema-tools": "0.0.0-e96d36b-20251210035710"
|
|
49
48
|
},
|
|
50
49
|
"publishConfig": {
|
|
51
50
|
"registry": "https://registry.npmjs.org"
|
|
@@ -59,33 +58,27 @@
|
|
|
59
58
|
"@types/estree": "^0.0.50",
|
|
60
59
|
"@types/express": "^4.17.21",
|
|
61
60
|
"@types/fs-extra": "^9.0.13",
|
|
62
|
-
"@types/jest": "^26.0.24",
|
|
63
61
|
"@types/js-yaml": "^3.12.10",
|
|
64
|
-
"@types/lodash.camelcase": "^4.3.9",
|
|
65
|
-
"@types/lodash.upperfirst": "^4.3.9",
|
|
66
62
|
"@types/lru-cache": "^5.1.1",
|
|
67
63
|
"@types/mdast": "^3.0.15",
|
|
68
64
|
"@types/micromatch": "^4.0.9",
|
|
69
|
-
"@types/node": "^22.
|
|
65
|
+
"@types/node": "^22.13.1",
|
|
70
66
|
"@types/normalize-path": "^3.0.2",
|
|
71
67
|
"@types/ws": "^7.4.7",
|
|
72
|
-
"@types/yup": "^0.29.14",
|
|
73
|
-
"jest": "^29.7.0",
|
|
74
|
-
"jest-diff": "^29.7.0",
|
|
75
68
|
"jest-file-snapshot": "^0.5.0",
|
|
76
|
-
"jest-matcher-utils": "^29.7.0",
|
|
77
69
|
"memory-level": "^1.0.0",
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
70
|
+
"typescript": "^5.7.3",
|
|
71
|
+
"vite": "^4.5.9",
|
|
72
|
+
"vitest": "^0.32.4",
|
|
73
|
+
"zod": "^3.24.2",
|
|
74
|
+
"@tinacms/schema-tools": "0.0.0-e96d36b-20251210035710",
|
|
75
|
+
"@tinacms/scripts": "1.4.2"
|
|
82
76
|
},
|
|
83
77
|
"scripts": {
|
|
84
78
|
"types": "pnpm tsc",
|
|
85
79
|
"build": "tinacms-scripts build",
|
|
86
80
|
"docs": "pnpm typedoc",
|
|
87
|
-
"
|
|
88
|
-
"test": "
|
|
89
|
-
"test-watch": "jest --watch"
|
|
81
|
+
"test": "vitest run",
|
|
82
|
+
"test-watch": "vitest"
|
|
90
83
|
}
|
|
91
84
|
}
|