@tinacms/graphql 1.3.1 → 1.3.3

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.
@@ -1,10 +1,10 @@
1
1
  /**
2
2
 
3
3
  */
4
- import type { TinaCloudSchema } from '@tinacms/schema-tools';
4
+ import type { Schema } from '@tinacms/schema-tools';
5
5
  import { Database } from '../database';
6
6
  import { Level } from '../database/level';
7
- export declare const setup: (rootPath: string, schema: TinaCloudSchema<false>, level: Level) => Promise<{
7
+ export declare const setup: (rootPath: string, schema: Schema, level: Level) => Promise<{
8
8
  database: Database;
9
9
  }>;
10
10
  export declare const print: (fixture: Fixture) => string;
@@ -22,11 +22,11 @@ export declare type Fixture = {
22
22
  message?: string;
23
23
  expectError?: boolean;
24
24
  };
25
- export declare const setupFixture: (rootPath: string, schema: TinaCloudSchema<false>, level: Level, fixture: Fixture, suffix?: string, queryName?: string, folder?: string) => Promise<{
25
+ export declare const setupFixture: (rootPath: string, schema: Schema, level: Level, fixture: Fixture, suffix?: string, queryName?: string, folder?: string) => Promise<{
26
26
  responses: string[];
27
27
  expectedResponsePaths: string[];
28
28
  }>;
29
- export declare const setupFixture2: (rootPath: string, schema: TinaCloudSchema<false>, level: Level, fixture: Fixture, suffix?: string, queryName?: string, folder?: string) => Promise<{
29
+ export declare const setupFixture2: (rootPath: string, schema: Schema, level: Level, fixture: Fixture, suffix?: string, queryName?: string, folder?: string) => Promise<{
30
30
  responses: string[];
31
31
  expectedResponsePaths: string[];
32
32
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "typings": "dist/index.d.ts",
@@ -25,8 +25,8 @@
25
25
  "dependencies": {
26
26
  "@graphql-tools/relay-operation-optimizer": "^6.4.1",
27
27
  "@iarna/toml": "^2.2.5",
28
- "@tinacms/mdx": "1.3.0",
29
- "@tinacms/schema-tools": "1.3.1",
28
+ "@tinacms/mdx": "1.3.2",
29
+ "@tinacms/schema-tools": "1.3.3",
30
30
  "abstract-level": "^1.0.3",
31
31
  "body-parser": "^1.19.0",
32
32
  "cors": "^2.8.5",
@@ -82,8 +82,8 @@
82
82
  "directory": "packages/tina-graphql"
83
83
  },
84
84
  "devDependencies": {
85
- "@tinacms/schema-tools": "1.3.1",
86
- "@tinacms/scripts": "1.0.2",
85
+ "@tinacms/schema-tools": "1.3.3",
86
+ "@tinacms/scripts": "1.0.3",
87
87
  "@types/cors": "^2.8.7",
88
88
  "@types/estree": "^0.0.50",
89
89
  "@types/express": "^4.17.8",
@@ -1,220 +0,0 @@
1
- /**
2
-
3
-
4
-
5
- */
6
- import type { RichTypeInner } from '@tinacms/schema-tools';
7
- import type { GraphQLConfig } from '../types';
8
- import type { TinaCloudSchemaEnriched } from '@tinacms/schema-tools';
9
- import type { Content } from 'mdast';
10
- export declare const parseMDX: (value: string, field: RichTypeInner, graphQLconfig: GraphQLConfig, schema: TinaCloudSchemaEnriched) => {
11
- type: string;
12
- children: any;
13
- };
14
- /**
15
- * ### Convert the MDXAST into an API-friendly format
16
- *
17
- * When we parse with Remark + MDX we get an AST which has a ton of JS capabilities, meaning
18
- * we could pass this back into a JS runtime and evaluate it. Ex.
19
- *
20
- * ```mdx
21
- * ## Hello world! The time and date is: {(new Date().toLocaleString())}
22
- * ```
23
- *
24
- * However, as an intentional constraint we don't want this information as part of our API, as
25
- * we don't intend to support the true JS runtime properties of MDX. Rather, we're using MDX for
26
- * it's expressive syntax and it's advanced tooling with how it parses JSX inside Markdown.
27
- *
28
- * Parsing here does 2 things:
29
- *
30
- * #### Remove non-literal uses of JSX
31
- * Things like <MyComponent myProp={() => alert("HI")} /> are not supported and will be ignored
32
- *
33
- * #### Convert remark nodes to slate-compatible nodes
34
- *
35
- * A remark node might look like this:
36
- * ```js
37
- * {
38
- * type: "heading",
39
- * depth: 1
40
- * children: [{type: 'text', value: 'Hello'}]
41
- * }
42
- * ```
43
- * A slate-compatible node would be:
44
- * ```js
45
- * {
46
- * type: "heading_one",
47
- * children: [{type: 'text', text: 'Hello'}]
48
- * }
49
- * ```
50
- * It's not a huge difference, but in general slate does better with less layers of indirection.
51
- *
52
- * While it may be desirable to ultimately serve a remark AST shape as part of the API response,
53
- * it's currently much easier to only support the shape that works with Slate. This is ok for now for 2
54
- * reasons.
55
- *
56
- * 1. Us providing the `TinaMarkdown` component on the frontend abstracts away an work the developer
57
- * would need to do, so it doesn't really matter what shape the response is as long as the external API
58
- * doesn't change
59
- *
60
- * 2. We don't need to do any client-side parsing. Since TinaMarkdown and the slate editor work with the same
61
- * format we can just allow Tina to do it's thing and update the form valuse with no additional work.
62
- */
63
- export declare const parseMDXInner: (tree: any, field: RichTypeInner, graphQLconfig: GraphQLConfig, schema: TinaCloudSchemaEnriched) => {
64
- type: string;
65
- children: any;
66
- };
67
- export interface NodeTypes {
68
- paragraph: string;
69
- block_quote: string;
70
- code_block: string;
71
- link: string;
72
- image: string;
73
- ul_list: string;
74
- ol_list: string;
75
- listItem: string;
76
- heading: {
77
- 1: string;
78
- 2: string;
79
- 3: string;
80
- 4: string;
81
- 5: string;
82
- 6: string;
83
- };
84
- emphasis_mark: string;
85
- strong_mark: string;
86
- delete_mark: string;
87
- inline_code_mark: string;
88
- thematic_break: string;
89
- break: string;
90
- }
91
- export declare type SlateNodeType = {
92
- type: 'heading_one';
93
- children: SlateNodeType[];
94
- } | {
95
- type: 'heading_two';
96
- children: SlateNodeType[];
97
- } | {
98
- type: 'heading_three';
99
- children: SlateNodeType[];
100
- } | {
101
- type: 'heading_four';
102
- children: SlateNodeType[];
103
- } | {
104
- type: 'heading_five';
105
- children: SlateNodeType[];
106
- } | {
107
- type: 'heading_six';
108
- children: SlateNodeType[];
109
- } | {
110
- type: 'paragraph';
111
- children: SlateNodeType[];
112
- } | {
113
- children: SlateNodeType[];
114
- link: string;
115
- type: 'link';
116
- } | {
117
- type: 'block_quote';
118
- children: SlateNodeType[];
119
- } | {
120
- type: 'text';
121
- text: string;
122
- } | {
123
- type: 'mdxJsxTextElement';
124
- props: object;
125
- children: SlateNodeType[];
126
- name: string;
127
- } | {
128
- type: 'mdxJsxFlowElement';
129
- props: object;
130
- children: SlateNodeType[];
131
- name: string;
132
- } | {
133
- type: 'block_quote';
134
- children: SlateNodeType[];
135
- } | {
136
- type: 'code_block';
137
- language: string;
138
- value: string;
139
- } | {
140
- type: 'image';
141
- link: string;
142
- caption: string;
143
- } | {
144
- type: 'thematic_break';
145
- };
146
- declare type RecursivePartial<T> = {
147
- [P in keyof T]?: RecursivePartial<T[P]>;
148
- };
149
- export interface OptionType {
150
- nodeTypes?: RecursivePartial<NodeTypes>;
151
- linkDestinationKey?: string;
152
- imageSourceKey?: string;
153
- imageCaptionKey?: string;
154
- }
155
- export interface MdastNode {
156
- type?: string;
157
- ordered?: boolean;
158
- value?: string;
159
- text?: string;
160
- children?: Array<MdastNode>;
161
- depth?: 1 | 2 | 3 | 4 | 5 | 6;
162
- url?: string;
163
- alt?: string;
164
- lang?: string;
165
- position?: any;
166
- spread?: any;
167
- checked?: any;
168
- indent?: any;
169
- }
170
- declare type MdxJsxFlowElement = {
171
- type: 'mdxJsxFlowElement';
172
- name: string;
173
- attributes: object;
174
- children: MdxAstNode[];
175
- };
176
- declare type MdxJsxTextElement = {
177
- type: 'mdxJsxTextElement';
178
- name: string;
179
- attributes: object;
180
- children: MdxAstNode[];
181
- };
182
- declare type MdxAstNode = Content | MdxJsxFlowElement | MdxJsxTextElement;
183
- export declare const plateElements: {
184
- ELEMENT_H1: string;
185
- ELEMENT_H2: string;
186
- ELEMENT_H3: string;
187
- ELEMENT_H4: string;
188
- ELEMENT_H5: string;
189
- ELEMENT_H6: string;
190
- ELEMENT_HR: string;
191
- ELEMENT_ALIGN_CENTER: string;
192
- ELEMENT_ALIGN_JUSTIFY: string;
193
- ELEMENT_ALIGN_LEFT: string;
194
- ELEMENT_ALIGN_RIGHT: string;
195
- ELEMENT_BLOCKQUOTE: string;
196
- ELEMENT_CODE_BLOCK: string;
197
- ELEMENT_CODE_LINE: string;
198
- ELEMENT_DEFAULT: string;
199
- ELEMENT_IMAGE: string;
200
- ELEMENT_LI: string;
201
- ELEMENT_LIC: string;
202
- ELEMENT_LINK: string;
203
- ELEMENT_MEDIA_EMBED: string;
204
- ELEMENT_MENTION: string;
205
- ELEMENT_OL: string;
206
- ELEMENT_PARAGRAPH: string;
207
- ELEMENT_TABLE: string;
208
- ELEMENT_TD: string;
209
- ELEMENT_TH: string;
210
- ELEMENT_TODO_LI: string;
211
- ELEMENT_TR: string;
212
- ELEMENT_UL: string;
213
- MARK_ITALIC: string;
214
- MARK_BOLD: string;
215
- MARK_STRIKETHROUGH: string;
216
- MARK_UNDERLINE: string;
217
- };
218
- export declare const defaultNodeTypes: NodeTypes;
219
- export default function remarkToSlate(node: MdxAstNode, graphQLconfig: GraphQLConfig, schema: TinaCloudSchemaEnriched): any;
220
- export {};
@@ -1,13 +0,0 @@
1
- /**
2
-
3
-
4
-
5
- */
6
- import type { GraphQLConfig } from '../types';
7
- import type { TinaCloudSchemaEnriched } from '@tinacms/schema-tools';
8
- import { plateElements } from './parse';
9
- import type { Content } from 'mdast';
10
- export declare const stringifyMDX: (value: unknown, field: any, graphQLconfig: GraphQLConfig, schema: TinaCloudSchemaEnriched) => string;
11
- export declare const stringify: (node: {
12
- type: typeof plateElements;
13
- }, field: any, graphQLconfig: GraphQLConfig, schema: TinaCloudSchemaEnriched) => Content;