@tinacms/graphql 0.55.0 → 0.56.1
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/CHANGELOG.md +29 -0
- package/dist/index.js +21648 -1744
- package/dist/primitives/ast-builder/index.d.ts +1 -0
- package/dist/primitives/builder/index.d.ts +8 -0
- package/dist/primitives/mdx/index.d.ts +21 -0
- package/dist/primitives/mdx/parse.d.ts +229 -0
- package/dist/primitives/mdx/stringify.d.ts +24 -0
- package/dist/primitives/resolver/index.d.ts +90 -9
- package/dist/primitives/spec/setup.d.ts +8 -4
- package/dist/primitives/types.d.ts +18 -2
- package/package.json +44 -7
|
@@ -88,6 +88,14 @@ export declare class Builder {
|
|
|
88
88
|
* @param collections
|
|
89
89
|
*/
|
|
90
90
|
multiCollectionDocument: (collections: TinaCloudCollectionEnriched[]) => Promise<import("graphql").FieldDefinitionNode>;
|
|
91
|
+
/**
|
|
92
|
+
* ```graphql
|
|
93
|
+
* {
|
|
94
|
+
* getDocumentFields()
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
multiCollectionDocumentFields: () => Promise<import("graphql").FieldDefinitionNode>;
|
|
91
99
|
/**
|
|
92
100
|
* ```graphql
|
|
93
101
|
* # ex.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
|
|
3
|
+
Copyright 2021 Forestry.io Holdings, Inc.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
|
|
17
|
+
*/
|
|
18
|
+
import { parseMDX } from './parse';
|
|
19
|
+
import { stringifyMDX } from './stringify';
|
|
20
|
+
export { parseMDX };
|
|
21
|
+
export { stringifyMDX };
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
|
|
3
|
+
Copyright 2021 Forestry.io Holdings, Inc.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
|
|
17
|
+
*/
|
|
18
|
+
import type { Content } from 'mdast';
|
|
19
|
+
import type { RichTypeInner } from '../types';
|
|
20
|
+
export declare const parseMDX: (value: string, field: RichTypeInner) => {
|
|
21
|
+
type: string;
|
|
22
|
+
children: any;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* ### Convert the MDXAST into an API-friendly format
|
|
26
|
+
*
|
|
27
|
+
* When we parse with Remark + MDX we get an AST which has a ton of JS capabilities, meaning
|
|
28
|
+
* we could pass this back into a JS runtime and evaluate it. Ex.
|
|
29
|
+
*
|
|
30
|
+
* ```mdx
|
|
31
|
+
* ## Hello world! The time and date is: {(new Date().toLocaleString())}
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* However, as an intentional constraint we don't want this information as part of our API, as
|
|
35
|
+
* we don't intend to support the true JS runtime properties of MDX. Rather, we're using MDX for
|
|
36
|
+
* it's expressive syntax and it's advanced tooling with how it parses JSX inside Markdown.
|
|
37
|
+
*
|
|
38
|
+
* Parsing here does 2 things:
|
|
39
|
+
*
|
|
40
|
+
* #### Remove non-literal uses of JSX
|
|
41
|
+
* Things like <MyComponent myProp={() => alert("HI")} /> are not supported and will be ignored
|
|
42
|
+
*
|
|
43
|
+
* #### Convert remark nodes to slate-compatible nodes
|
|
44
|
+
*
|
|
45
|
+
* A remark node might look like this:
|
|
46
|
+
* ```js
|
|
47
|
+
* {
|
|
48
|
+
* type: "heading",
|
|
49
|
+
* depth: 1
|
|
50
|
+
* children: [{type: 'text', value: 'Hello'}]
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
* A slate-compatible node would be:
|
|
54
|
+
* ```js
|
|
55
|
+
* {
|
|
56
|
+
* type: "heading_one",
|
|
57
|
+
* children: [{type: 'text', text: 'Hello'}]
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
* It's not a huge difference, but in general slate does better with less layers of indirection.
|
|
61
|
+
*
|
|
62
|
+
* While it may be desirable to ultimately serve a remark AST shape as part of the API response,
|
|
63
|
+
* it's currently much easier to only support the shape that works with Slate. This is ok for now for 2
|
|
64
|
+
* reasons.
|
|
65
|
+
*
|
|
66
|
+
* 1. Us providing the `TinaMarkdown` component on the frontend abstracts away an work the developer
|
|
67
|
+
* would need to do, so it doesn't really matter what shape the response is as long as the external API
|
|
68
|
+
* doesn't change
|
|
69
|
+
*
|
|
70
|
+
* 2. We don't need to do any client-side parsing. Since TinaMarkdown and the slate editor work with the same
|
|
71
|
+
* format we can just allow Tina to do it's thing and update the form valuse with no additional work.
|
|
72
|
+
*/
|
|
73
|
+
export declare const parseMDXInner: (tree: any, field: RichTypeInner) => {
|
|
74
|
+
type: string;
|
|
75
|
+
children: any;
|
|
76
|
+
};
|
|
77
|
+
export interface NodeTypes {
|
|
78
|
+
paragraph: string;
|
|
79
|
+
block_quote: string;
|
|
80
|
+
code_block: string;
|
|
81
|
+
link: string;
|
|
82
|
+
image: string;
|
|
83
|
+
ul_list: string;
|
|
84
|
+
ol_list: string;
|
|
85
|
+
listItem: string;
|
|
86
|
+
heading: {
|
|
87
|
+
1: string;
|
|
88
|
+
2: string;
|
|
89
|
+
3: string;
|
|
90
|
+
4: string;
|
|
91
|
+
5: string;
|
|
92
|
+
6: string;
|
|
93
|
+
};
|
|
94
|
+
emphasis_mark: string;
|
|
95
|
+
strong_mark: string;
|
|
96
|
+
delete_mark: string;
|
|
97
|
+
inline_code_mark: string;
|
|
98
|
+
thematic_break: string;
|
|
99
|
+
}
|
|
100
|
+
export declare type SlateNodeType = {
|
|
101
|
+
type: 'heading_one';
|
|
102
|
+
children: SlateNodeType[];
|
|
103
|
+
} | {
|
|
104
|
+
type: 'heading_two';
|
|
105
|
+
children: SlateNodeType[];
|
|
106
|
+
} | {
|
|
107
|
+
type: 'heading_three';
|
|
108
|
+
children: SlateNodeType[];
|
|
109
|
+
} | {
|
|
110
|
+
type: 'heading_four';
|
|
111
|
+
children: SlateNodeType[];
|
|
112
|
+
} | {
|
|
113
|
+
type: 'heading_five';
|
|
114
|
+
children: SlateNodeType[];
|
|
115
|
+
} | {
|
|
116
|
+
type: 'heading_six';
|
|
117
|
+
children: SlateNodeType[];
|
|
118
|
+
} | {
|
|
119
|
+
type: 'paragraph';
|
|
120
|
+
children: SlateNodeType[];
|
|
121
|
+
} | {
|
|
122
|
+
children: SlateNodeType[];
|
|
123
|
+
link: string;
|
|
124
|
+
type: 'link';
|
|
125
|
+
} | {
|
|
126
|
+
type: 'block_quote';
|
|
127
|
+
children: SlateNodeType[];
|
|
128
|
+
} | {
|
|
129
|
+
type: 'text';
|
|
130
|
+
text: string;
|
|
131
|
+
} | {
|
|
132
|
+
type: 'mdxJsxTextElement';
|
|
133
|
+
props: object;
|
|
134
|
+
children: SlateNodeType[];
|
|
135
|
+
name: string;
|
|
136
|
+
} | {
|
|
137
|
+
type: 'mdxJsxFlowElement';
|
|
138
|
+
props: object;
|
|
139
|
+
children: SlateNodeType[];
|
|
140
|
+
name: string;
|
|
141
|
+
} | {
|
|
142
|
+
type: 'block_quote';
|
|
143
|
+
children: SlateNodeType[];
|
|
144
|
+
} | {
|
|
145
|
+
type: 'code_block';
|
|
146
|
+
language: string;
|
|
147
|
+
value: string;
|
|
148
|
+
} | {
|
|
149
|
+
type: 'image';
|
|
150
|
+
link: string;
|
|
151
|
+
caption: string;
|
|
152
|
+
} | {
|
|
153
|
+
type: 'thematic_break';
|
|
154
|
+
};
|
|
155
|
+
declare type RecursivePartial<T> = {
|
|
156
|
+
[P in keyof T]?: RecursivePartial<T[P]>;
|
|
157
|
+
};
|
|
158
|
+
export interface OptionType {
|
|
159
|
+
nodeTypes?: RecursivePartial<NodeTypes>;
|
|
160
|
+
linkDestinationKey?: string;
|
|
161
|
+
imageSourceKey?: string;
|
|
162
|
+
imageCaptionKey?: string;
|
|
163
|
+
}
|
|
164
|
+
export interface MdastNode {
|
|
165
|
+
type?: string;
|
|
166
|
+
ordered?: boolean;
|
|
167
|
+
value?: string;
|
|
168
|
+
text?: string;
|
|
169
|
+
children?: Array<MdastNode>;
|
|
170
|
+
depth?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
171
|
+
url?: string;
|
|
172
|
+
alt?: string;
|
|
173
|
+
lang?: string;
|
|
174
|
+
position?: any;
|
|
175
|
+
spread?: any;
|
|
176
|
+
checked?: any;
|
|
177
|
+
indent?: any;
|
|
178
|
+
}
|
|
179
|
+
declare type MdxJsxFlowElement = {
|
|
180
|
+
type: 'mdxJsxFlowElement';
|
|
181
|
+
name: string;
|
|
182
|
+
attributes: object;
|
|
183
|
+
children: MdxAstNode[];
|
|
184
|
+
};
|
|
185
|
+
declare type MdxJsxTextElement = {
|
|
186
|
+
type: 'mdxJsxTextElement';
|
|
187
|
+
name: string;
|
|
188
|
+
attributes: object;
|
|
189
|
+
children: MdxAstNode[];
|
|
190
|
+
};
|
|
191
|
+
declare type MdxAstNode = Content | MdxJsxFlowElement | MdxJsxTextElement;
|
|
192
|
+
export declare const plateElements: {
|
|
193
|
+
ELEMENT_H1: string;
|
|
194
|
+
ELEMENT_H2: string;
|
|
195
|
+
ELEMENT_H3: string;
|
|
196
|
+
ELEMENT_H4: string;
|
|
197
|
+
ELEMENT_H5: string;
|
|
198
|
+
ELEMENT_H6: string;
|
|
199
|
+
ELEMENT_HR: string;
|
|
200
|
+
ELEMENT_ALIGN_CENTER: string;
|
|
201
|
+
ELEMENT_ALIGN_JUSTIFY: string;
|
|
202
|
+
ELEMENT_ALIGN_LEFT: string;
|
|
203
|
+
ELEMENT_ALIGN_RIGHT: string;
|
|
204
|
+
ELEMENT_BLOCKQUOTE: string;
|
|
205
|
+
ELEMENT_CODE_BLOCK: string;
|
|
206
|
+
ELEMENT_CODE_LINE: string;
|
|
207
|
+
ELEMENT_DEFAULT: string;
|
|
208
|
+
ELEMENT_IMAGE: string;
|
|
209
|
+
ELEMENT_LI: string;
|
|
210
|
+
ELEMENT_LIC: string;
|
|
211
|
+
ELEMENT_LINK: string;
|
|
212
|
+
ELEMENT_MEDIA_EMBED: string;
|
|
213
|
+
ELEMENT_MENTION: string;
|
|
214
|
+
ELEMENT_OL: string;
|
|
215
|
+
ELEMENT_PARAGRAPH: string;
|
|
216
|
+
ELEMENT_TABLE: string;
|
|
217
|
+
ELEMENT_TD: string;
|
|
218
|
+
ELEMENT_TH: string;
|
|
219
|
+
ELEMENT_TODO_LI: string;
|
|
220
|
+
ELEMENT_TR: string;
|
|
221
|
+
ELEMENT_UL: string;
|
|
222
|
+
MARK_ITALIC: string;
|
|
223
|
+
MARK_BOLD: string;
|
|
224
|
+
MARK_STRIKETHROUGH: string;
|
|
225
|
+
MARK_UNDERLINE: string;
|
|
226
|
+
};
|
|
227
|
+
export declare const defaultNodeTypes: NodeTypes;
|
|
228
|
+
export default function remarkToSlate(node: MdxAstNode): any;
|
|
229
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
|
|
3
|
+
Copyright 2021 Forestry.io Holdings, Inc.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
|
|
17
|
+
*/
|
|
18
|
+
import type { RichTypeInner } from '../types';
|
|
19
|
+
import { plateElements } from './parse';
|
|
20
|
+
import type { Content } from 'mdast';
|
|
21
|
+
export declare const stringifyMDX: (value: unknown, field: RichTypeInner) => string;
|
|
22
|
+
export declare const stringify: (node: {
|
|
23
|
+
type: typeof plateElements;
|
|
24
|
+
}, field: RichTypeInner) => Content;
|
|
@@ -12,6 +12,7 @@ limitations under the License.
|
|
|
12
12
|
*/
|
|
13
13
|
import { TinaSchema } from '../schema';
|
|
14
14
|
import { Database, CollectionDocumentListLookup } from '../database';
|
|
15
|
+
import type { Collectable, TinaCloudCollection } from '../types';
|
|
15
16
|
interface ResolverConfig {
|
|
16
17
|
database: Database;
|
|
17
18
|
tinaSchema: TinaSchema;
|
|
@@ -34,7 +35,7 @@ export declare class Resolver {
|
|
|
34
35
|
label: string;
|
|
35
36
|
name: string;
|
|
36
37
|
path: string;
|
|
37
|
-
format?: "json" | "md" | "markdown" | "
|
|
38
|
+
format?: "json" | "md" | "markdown" | "mdx";
|
|
38
39
|
match?: string;
|
|
39
40
|
documents: string[];
|
|
40
41
|
} | {
|
|
@@ -51,7 +52,7 @@ export declare class Resolver {
|
|
|
51
52
|
label: string;
|
|
52
53
|
name: string;
|
|
53
54
|
path: string;
|
|
54
|
-
format?: "json" | "md" | "markdown" | "
|
|
55
|
+
format?: "json" | "md" | "markdown" | "mdx";
|
|
55
56
|
match?: string;
|
|
56
57
|
documents: string[];
|
|
57
58
|
}>;
|
|
@@ -65,7 +66,7 @@ export declare class Resolver {
|
|
|
65
66
|
path: string;
|
|
66
67
|
relativePath: string;
|
|
67
68
|
breadcrumbs: string[];
|
|
68
|
-
collection:
|
|
69
|
+
collection: TinaCloudCollection<true>;
|
|
69
70
|
template: string | number;
|
|
70
71
|
};
|
|
71
72
|
data: {
|
|
@@ -86,12 +87,92 @@ export declare class Resolver {
|
|
|
86
87
|
fields: unknown[];
|
|
87
88
|
};
|
|
88
89
|
}>;
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
getDocumentFields: () => Promise<{}>;
|
|
91
|
+
buildObjectMutations: (fieldValue: any, field: Collectable) => {
|
|
92
|
+
[key: string]: unknown;
|
|
93
|
+
} | {
|
|
94
|
+
[key: string]: unknown;
|
|
95
|
+
}[];
|
|
96
|
+
createResolveDocument: ({ collection, realPath, args, isAddPendingDocument, }: {
|
|
97
|
+
collection: TinaCloudCollection<true>;
|
|
98
|
+
realPath: string;
|
|
99
|
+
args: unknown;
|
|
100
|
+
isAddPendingDocument: boolean;
|
|
101
|
+
}) => Promise<{
|
|
102
|
+
__typename: string;
|
|
103
|
+
id: string;
|
|
104
|
+
sys: {
|
|
105
|
+
basename: string;
|
|
106
|
+
filename: string;
|
|
107
|
+
extension: string;
|
|
108
|
+
path: string;
|
|
109
|
+
relativePath: string;
|
|
110
|
+
breadcrumbs: string[];
|
|
111
|
+
collection: TinaCloudCollection<true>;
|
|
112
|
+
template: string | number;
|
|
113
|
+
};
|
|
114
|
+
data: {
|
|
115
|
+
_collection: string;
|
|
116
|
+
_template: string;
|
|
117
|
+
};
|
|
118
|
+
values: {
|
|
119
|
+
_collection: string;
|
|
120
|
+
_template: string;
|
|
121
|
+
};
|
|
122
|
+
dataJSON: {
|
|
123
|
+
_collection: string;
|
|
124
|
+
_template: string;
|
|
125
|
+
};
|
|
126
|
+
form: {
|
|
127
|
+
label: string;
|
|
128
|
+
name: string;
|
|
129
|
+
fields: unknown[];
|
|
130
|
+
};
|
|
131
|
+
}>;
|
|
132
|
+
updateResolveDocument: ({ collection, realPath, args, isAddPendingDocument, isCollectionSpecific, }: {
|
|
133
|
+
collection: TinaCloudCollection<true>;
|
|
134
|
+
realPath: string;
|
|
135
|
+
args: unknown;
|
|
136
|
+
isAddPendingDocument: boolean;
|
|
137
|
+
isCollectionSpecific: boolean;
|
|
138
|
+
}) => Promise<{
|
|
139
|
+
__typename: string;
|
|
140
|
+
id: string;
|
|
141
|
+
sys: {
|
|
142
|
+
basename: string;
|
|
143
|
+
filename: string;
|
|
144
|
+
extension: string;
|
|
145
|
+
path: string;
|
|
146
|
+
relativePath: string;
|
|
147
|
+
breadcrumbs: string[];
|
|
148
|
+
collection: TinaCloudCollection<true>;
|
|
149
|
+
template: string | number;
|
|
150
|
+
};
|
|
151
|
+
data: {
|
|
152
|
+
_collection: string;
|
|
153
|
+
_template: string;
|
|
154
|
+
};
|
|
155
|
+
values: {
|
|
156
|
+
_collection: string;
|
|
157
|
+
_template: string;
|
|
158
|
+
};
|
|
159
|
+
dataJSON: {
|
|
160
|
+
_collection: string;
|
|
161
|
+
_template: string;
|
|
162
|
+
};
|
|
163
|
+
form: {
|
|
164
|
+
label: string;
|
|
165
|
+
name: string;
|
|
166
|
+
fields: unknown[];
|
|
167
|
+
};
|
|
168
|
+
}>;
|
|
169
|
+
resolveDocument: ({ args, collection: collectionName, isMutation, isCreation, isAddPendingDocument, isCollectionSpecific, }: {
|
|
91
170
|
args: unknown;
|
|
92
|
-
collection
|
|
171
|
+
collection?: string;
|
|
93
172
|
isMutation: boolean;
|
|
94
173
|
isCreation?: boolean;
|
|
174
|
+
isAddPendingDocument?: boolean;
|
|
175
|
+
isCollectionSpecific?: boolean;
|
|
95
176
|
}) => Promise<{
|
|
96
177
|
__typename: string;
|
|
97
178
|
id: string;
|
|
@@ -102,7 +183,7 @@ export declare class Resolver {
|
|
|
102
183
|
path: string;
|
|
103
184
|
relativePath: string;
|
|
104
185
|
breadcrumbs: string[];
|
|
105
|
-
collection:
|
|
186
|
+
collection: TinaCloudCollection<true>;
|
|
106
187
|
template: string | number;
|
|
107
188
|
};
|
|
108
189
|
data: {
|
|
@@ -138,7 +219,7 @@ export declare class Resolver {
|
|
|
138
219
|
path: string;
|
|
139
220
|
relativePath: string;
|
|
140
221
|
breadcrumbs: string[];
|
|
141
|
-
collection:
|
|
222
|
+
collection: TinaCloudCollection<true>;
|
|
142
223
|
template: string | number;
|
|
143
224
|
};
|
|
144
225
|
data: {
|
|
@@ -177,7 +258,7 @@ export declare class Resolver {
|
|
|
177
258
|
path: string;
|
|
178
259
|
relativePath: string;
|
|
179
260
|
breadcrumbs: string[];
|
|
180
|
-
collection:
|
|
261
|
+
collection: TinaCloudCollection<true>;
|
|
181
262
|
template: string | number;
|
|
182
263
|
};
|
|
183
264
|
data: {
|
|
@@ -36,8 +36,12 @@ export declare const setupFixture: (rootPath: string, schema: TinaCloudSchema<fa
|
|
|
36
36
|
[key: string]: any;
|
|
37
37
|
}>;
|
|
38
38
|
expectedReponse: string;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
expectedReponsePath: string;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const setupFixture2: (rootPath: string, schema: TinaCloudSchema<false>, fixture: {
|
|
42
|
+
name: string;
|
|
43
|
+
assert: 'output' | 'file';
|
|
44
|
+
}) => Promise<{
|
|
45
|
+
response: string;
|
|
46
|
+
expectedResponsePath: string;
|
|
43
47
|
}>;
|
|
@@ -29,7 +29,7 @@ export interface TinaCloudSchemaWithNamespace {
|
|
|
29
29
|
export declare type TinaCloudCollection<WithNamespace extends boolean> = CollectionFields<WithNamespace> | CollectionTemplates<WithNamespace>;
|
|
30
30
|
export declare type TinaCloudCollectionBase = TinaCloudCollection<false>;
|
|
31
31
|
export declare type TinaCloudCollectionEnriched = TinaCloudCollection<true>;
|
|
32
|
-
declare type FormatType = 'json' | 'md' | 'markdown' | '
|
|
32
|
+
declare type FormatType = 'json' | 'md' | 'markdown' | 'mdx';
|
|
33
33
|
interface BaseCollection {
|
|
34
34
|
label: string;
|
|
35
35
|
name: string;
|
|
@@ -59,7 +59,7 @@ interface CollectionFieldsInner<WithNamespace extends boolean> extends BaseColle
|
|
|
59
59
|
fields: string | TinaFieldInner<WithNamespace>[];
|
|
60
60
|
templates?: undefined;
|
|
61
61
|
}
|
|
62
|
-
export declare type TinaFieldInner<WithNamespace extends boolean> = ScalarType<WithNamespace> | ObjectType<WithNamespace> | ReferenceType<WithNamespace>;
|
|
62
|
+
export declare type TinaFieldInner<WithNamespace extends boolean> = ScalarType<WithNamespace> | ObjectType<WithNamespace> | ReferenceType<WithNamespace> | RichType<WithNamespace>;
|
|
63
63
|
export declare type TinaFieldBase = TinaFieldInner<false>;
|
|
64
64
|
export declare type TinaFieldEnriched = TinaFieldInner<true>;
|
|
65
65
|
interface TinaField {
|
|
@@ -107,6 +107,7 @@ declare type ImageField = {
|
|
|
107
107
|
type: 'image';
|
|
108
108
|
};
|
|
109
109
|
export declare type ReferenceType<WithNamespace extends boolean> = WithNamespace extends true ? ReferenceTypeWithNamespace : ReferenceTypeInner;
|
|
110
|
+
export declare type RichType<WithNamespace extends boolean> = WithNamespace extends true ? RichTypeWithNamespace : RichTypeInner;
|
|
110
111
|
export interface ReferenceTypeInner extends TinaField {
|
|
111
112
|
type: 'reference';
|
|
112
113
|
reverseLookup?: {
|
|
@@ -124,6 +125,21 @@ export interface ReferenceTypeWithNamespace extends TinaField {
|
|
|
124
125
|
};
|
|
125
126
|
namespace: string[];
|
|
126
127
|
}
|
|
128
|
+
export interface RichTypeWithNamespace extends TinaField {
|
|
129
|
+
type: 'rich-text';
|
|
130
|
+
namespace: string[];
|
|
131
|
+
isBody?: boolean;
|
|
132
|
+
templates?: (string | (Template<true> & {
|
|
133
|
+
inline?: boolean;
|
|
134
|
+
}))[];
|
|
135
|
+
}
|
|
136
|
+
export interface RichTypeInner extends TinaField {
|
|
137
|
+
type: 'rich-text';
|
|
138
|
+
isBody?: boolean;
|
|
139
|
+
templates?: (string | (Template<false> & {
|
|
140
|
+
inline?: boolean;
|
|
141
|
+
}))[];
|
|
142
|
+
}
|
|
127
143
|
export declare type ObjectType<WithNamespace extends boolean> = ObjectTemplates<WithNamespace> | ObjectFields<WithNamespace>;
|
|
128
144
|
declare type ObjectTemplates<WithNamespace extends boolean> = WithNamespace extends true ? ObjectTemplatesWithNamespace<WithNamespace> : ObjectTemplatesInner<WithNamespace>;
|
|
129
145
|
interface ObjectTemplatesInner<WithNamespace extends boolean> extends TinaField {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/graphql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.56.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -12,14 +12,35 @@
|
|
|
12
12
|
"entryPoints": [
|
|
13
13
|
{
|
|
14
14
|
"name": "src/index.ts",
|
|
15
|
-
"target": "node"
|
|
15
|
+
"target": "node",
|
|
16
|
+
"bundle": [
|
|
17
|
+
"mdast",
|
|
18
|
+
"mdast-util-from-markdown",
|
|
19
|
+
"mdast-util-mdx",
|
|
20
|
+
"mdast-util-mdx-expression",
|
|
21
|
+
"mdast-util-to-markdown",
|
|
22
|
+
"micromark-extension-mdxjs",
|
|
23
|
+
"rehype-format",
|
|
24
|
+
"rehype-stringify",
|
|
25
|
+
"remark",
|
|
26
|
+
"remark-frontmatter",
|
|
27
|
+
"remark-mdx",
|
|
28
|
+
"remark-parse",
|
|
29
|
+
"remark-rehype",
|
|
30
|
+
"remark-slate",
|
|
31
|
+
"remark-stringify",
|
|
32
|
+
"unified",
|
|
33
|
+
"unist-util-remove-position",
|
|
34
|
+
"unist-util-visit",
|
|
35
|
+
"vfile"
|
|
36
|
+
]
|
|
16
37
|
}
|
|
17
38
|
]
|
|
18
39
|
},
|
|
19
40
|
"scripts": {
|
|
20
41
|
"build": "yarn tsup src/index.ts --format cjs --dts",
|
|
21
42
|
"watch": "yarn tsup src/index.ts --watch --format cjs --dts",
|
|
22
|
-
"types": "yarn tsc",
|
|
43
|
+
"types": "yarn tsc --project ./tsconfig.real.json",
|
|
23
44
|
"docs": "yarn typedoc",
|
|
24
45
|
"serve": "yarn nodemon dist/server.js",
|
|
25
46
|
"test": "jest"
|
|
@@ -29,11 +50,17 @@
|
|
|
29
50
|
"@octokit/graphql": "^4.5.6",
|
|
30
51
|
"@octokit/rest": "18.0.6",
|
|
31
52
|
"@types/aws-sdk": "^2.7.0",
|
|
53
|
+
"@types/estree": "^0.0.50",
|
|
54
|
+
"@types/mdast": "^3.0.10",
|
|
55
|
+
"@types/node": "^16.9.1",
|
|
32
56
|
"aws-sdk": "^2.930.0",
|
|
33
57
|
"body-parser": "^1.19.0",
|
|
34
58
|
"cors": "^2.8.5",
|
|
35
59
|
"dataloader": "^2.0.0",
|
|
36
60
|
"date-fns": "^2.21.1",
|
|
61
|
+
"esbuild": "^0.12.25",
|
|
62
|
+
"esbuild-jest": "^0.5.0",
|
|
63
|
+
"estree-walker": "^3.0.0",
|
|
37
64
|
"fast-glob": "^3.2.5",
|
|
38
65
|
"fs-extra": "^9.0.1",
|
|
39
66
|
"graphql": "^15.3.0",
|
|
@@ -42,19 +69,28 @@
|
|
|
42
69
|
"js-yaml": "^3.14.0",
|
|
43
70
|
"lodash": "^4.17.20",
|
|
44
71
|
"lru-cache": "^6.0.0",
|
|
72
|
+
"mdast": "^3.0.0",
|
|
73
|
+
"mdast-util-from-markdown": "^1.0.0",
|
|
74
|
+
"mdast-util-mdx": "^1.1.0",
|
|
75
|
+
"mdast-util-mdx-expression": "^1.1.0",
|
|
76
|
+
"mdast-util-to-markdown": "^1.2.1",
|
|
77
|
+
"micromark-extension-mdxjs": "^1.0.0",
|
|
78
|
+
"mocha": "^9.1.1",
|
|
45
79
|
"normalize-path": "^3.0.0",
|
|
46
80
|
"prettier": "^2.2.1",
|
|
47
81
|
"rehype-format": "^3.1.0",
|
|
48
82
|
"rehype-stringify": "^8.0.0",
|
|
49
83
|
"remark": "^13.0.0",
|
|
50
84
|
"remark-frontmatter": "^3.0.0",
|
|
51
|
-
"remark-mdx": "
|
|
52
|
-
"remark-parse": "^
|
|
85
|
+
"remark-mdx": "next",
|
|
86
|
+
"remark-parse": "^10.0.0",
|
|
53
87
|
"remark-rehype": "^8.0.0",
|
|
88
|
+
"remark-slate": "^1.8.0",
|
|
54
89
|
"remark-stringify": "^8.1.1",
|
|
55
90
|
"tslib": "^1.11.1",
|
|
56
|
-
"unified": "^
|
|
91
|
+
"unified": "^10.1.0",
|
|
57
92
|
"unist-util-remove-position": "^3.0.0",
|
|
93
|
+
"unist-util-visit": "^4.0.0",
|
|
58
94
|
"vfile": "^4.2.0",
|
|
59
95
|
"ws": "^7.3.1",
|
|
60
96
|
"yup": "^0.32.9"
|
|
@@ -68,7 +104,7 @@
|
|
|
68
104
|
},
|
|
69
105
|
"devDependencies": {
|
|
70
106
|
"@graphql-tools/schema": "^6.2.1",
|
|
71
|
-
"@tinacms/scripts": "0.50.
|
|
107
|
+
"@tinacms/scripts": "0.50.3",
|
|
72
108
|
"@types/cors": "^2.8.7",
|
|
73
109
|
"@types/express": "^4.17.8",
|
|
74
110
|
"@types/fs-extra": "^9.0.2",
|
|
@@ -84,6 +120,7 @@
|
|
|
84
120
|
"graphql-tools": "^6.2.1",
|
|
85
121
|
"jest": "27.0.6",
|
|
86
122
|
"jest-diff": "27.0.6",
|
|
123
|
+
"jest-file-snapshot": "^0.5.0",
|
|
87
124
|
"jest-matcher-utils": "27.0.6",
|
|
88
125
|
"nodemon": "^2.0.4",
|
|
89
126
|
"ts-jest": "27.0.3",
|