tinacms 0.0.0-eb519f2-20241015053224 → 0.0.0-ebe1b69-20250211022853
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/dist/admin/types.d.ts +3 -0
- package/dist/cache/node-cache.d.ts +1 -0
- package/dist/client.js +90 -61
- package/dist/client.mjs +49 -35
- package/dist/index.d.ts +1 -1
- package/dist/index.js +297 -339
- package/dist/index.mjs +313 -355
- package/dist/node-cache-5e8db9f0.mjs +63 -0
- package/dist/toolkit/fields/components/reference/reference-select.d.ts +2 -2
- package/dist/toolkit/fields/plugins/mdx-field-plugin/index.d.ts +4 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/index.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +4 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +2 -2
- package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
- package/dist/unifiedClient/index.d.ts +8 -1
- package/package.json +28 -28
- package/dist/__vite-browser-external-d06ac358.mjs +0 -4
- package/dist/node-cache-7fa2452c.mjs +0 -43
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const makeCacheDir = async (dir, fs, path, os) => {
|
|
2
|
+
const pathParts = dir.split(path.sep).filter(Boolean);
|
|
3
|
+
const cacheHash = pathParts[pathParts.length - 1];
|
|
4
|
+
const rootUser = pathParts[0];
|
|
5
|
+
let cacheDir = dir;
|
|
6
|
+
if (!fs.existsSync(path.join(path.sep, rootUser))) {
|
|
7
|
+
cacheDir = path.join(os.tmpdir(), cacheHash);
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
11
|
+
} catch (error) {
|
|
12
|
+
throw new Error(`Failed to create cache directory: ${error.message}`);
|
|
13
|
+
}
|
|
14
|
+
return cacheDir;
|
|
15
|
+
};
|
|
16
|
+
const NodeCache = async (dir) => {
|
|
17
|
+
const fs = require("node:fs");
|
|
18
|
+
const path = require("node:path");
|
|
19
|
+
const os = require("node:os");
|
|
20
|
+
const { createHash } = require("node:crypto");
|
|
21
|
+
const cacheDir = await makeCacheDir(dir, fs, path, os);
|
|
22
|
+
return {
|
|
23
|
+
makeKey: (key) => {
|
|
24
|
+
const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
|
|
25
|
+
return createHash("sha256").update(input).digest("hex");
|
|
26
|
+
},
|
|
27
|
+
get: async (key) => {
|
|
28
|
+
let readValue;
|
|
29
|
+
const cacheFilename = `${cacheDir}/${key}`;
|
|
30
|
+
try {
|
|
31
|
+
const data = await fs.promises.readFile(cacheFilename, "utf-8");
|
|
32
|
+
readValue = JSON.parse(data);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
if (e.code !== "ENOENT") {
|
|
35
|
+
console.error(
|
|
36
|
+
`Failed to read cache file to ${cacheFilename}: ${e.message}`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return readValue;
|
|
41
|
+
},
|
|
42
|
+
set: async (key, value) => {
|
|
43
|
+
const cacheFilename = `${cacheDir}/${key}`;
|
|
44
|
+
try {
|
|
45
|
+
await fs.promises.writeFile(cacheFilename, JSON.stringify(value), {
|
|
46
|
+
encoding: "utf-8",
|
|
47
|
+
flag: "wx"
|
|
48
|
+
// Don't overwrite existing caches
|
|
49
|
+
});
|
|
50
|
+
} catch (e) {
|
|
51
|
+
if (e.code !== "EEXIST") {
|
|
52
|
+
console.error(
|
|
53
|
+
`Failed to write cache file to ${cacheFilename}: ${e.message}`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
NodeCache,
|
|
62
|
+
makeCacheDir
|
|
63
|
+
};
|
|
@@ -7,5 +7,5 @@ interface ReferenceSelectProps {
|
|
|
7
7
|
input: any;
|
|
8
8
|
field: ReferenceFieldProps & Field;
|
|
9
9
|
}
|
|
10
|
-
declare const
|
|
11
|
-
export default
|
|
10
|
+
declare const Combobox: React.FC<ReferenceSelectProps>;
|
|
11
|
+
export default Combobox;
|
|
@@ -2,16 +2,18 @@ import React from 'react';
|
|
|
2
2
|
import { type InputFieldType } from '../wrap-field-with-meta';
|
|
3
3
|
import type { MdxTemplate } from './plate/types';
|
|
4
4
|
import type { InputProps } from '../../../fields/components';
|
|
5
|
-
import type { ToolbarOverrideType } from './plate/toolbar/toolbar-overrides';
|
|
5
|
+
import type { ToolbarOverrides, ToolbarOverrideType } from './plate/toolbar/toolbar-overrides';
|
|
6
6
|
export type RichTextType = React.PropsWithChildren<InputFieldType<InputProps, {
|
|
7
7
|
templates: MdxTemplate[];
|
|
8
8
|
toolbarOverride?: ToolbarOverrideType[];
|
|
9
|
+
overrides?: ToolbarOverrides;
|
|
9
10
|
}>>;
|
|
10
11
|
export declare const MdxFieldPlugin: {
|
|
11
12
|
name: string;
|
|
12
13
|
Component: (props: InputFieldType<InputProps, {
|
|
13
14
|
templates: MdxTemplate[];
|
|
14
15
|
toolbarOverride?: ToolbarOverrideType[];
|
|
16
|
+
overrides?: ToolbarOverrides;
|
|
15
17
|
}>) => React.JSX.Element;
|
|
16
18
|
};
|
|
17
19
|
export declare const MdxFieldPluginExtendible: {
|
|
@@ -20,5 +22,6 @@ export declare const MdxFieldPluginExtendible: {
|
|
|
20
22
|
Component: (props: InputFieldType<InputProps, {
|
|
21
23
|
templates: MdxTemplate[];
|
|
22
24
|
toolbarOverride?: ToolbarOverrideType[];
|
|
25
|
+
overrides?: ToolbarOverrides;
|
|
23
26
|
}>) => React.JSX.Element;
|
|
24
27
|
};
|
|
@@ -6,3 +6,7 @@ export declare const EMBED_ICON_WIDTH = 78;
|
|
|
6
6
|
export declare const CONTAINER_MD_BREAKPOINT = 448;
|
|
7
7
|
export declare const FLOAT_BUTTON_WIDTH = 25;
|
|
8
8
|
export declare const HEADING_LABEL = "Headings";
|
|
9
|
+
export type ToolbarOverrides = {
|
|
10
|
+
toolbar?: ToolbarOverrideType[];
|
|
11
|
+
showFloatingToolbar?: boolean;
|
|
12
|
+
};
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
3
|
import type { Form } from '../../../../../forms';
|
|
4
4
|
import type { MdxTemplate } from '../types';
|
|
5
|
-
import type { ToolbarOverrideType } from './toolbar-overrides';
|
|
5
|
+
import type { ToolbarOverrides, ToolbarOverrideType } from './toolbar-overrides';
|
|
6
6
|
interface ToolbarContextProps {
|
|
7
7
|
tinaForm: Form;
|
|
8
8
|
templates: MdxTemplate[];
|
|
9
|
-
overrides: ToolbarOverrideType[];
|
|
9
|
+
overrides: ToolbarOverrideType[] | ToolbarOverrides;
|
|
10
10
|
}
|
|
11
11
|
interface ToolbarProviderProps extends ToolbarContextProps {
|
|
12
12
|
children: ReactNode;
|
|
@@ -3,6 +3,14 @@ import { FieldProps } from './field-props';
|
|
|
3
3
|
import { Form } from '../../forms';
|
|
4
4
|
export type InputFieldType<ExtraFieldProps, InputProps> = FieldProps<InputProps> & ExtraFieldProps;
|
|
5
5
|
export declare function wrapFieldsWithMeta<ExtraFieldProps = {}, InputProps = {}>(Field: React.FunctionComponent<InputFieldType<ExtraFieldProps, InputProps>> | React.ComponentClass<InputFieldType<ExtraFieldProps, InputProps>>): (props: InputFieldType<ExtraFieldProps, InputProps>) => React.JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* Same as wrapFieldsWithMeta but excludes the label, and description useful for fields that render their label and description
|
|
8
|
+
*/
|
|
9
|
+
export declare function wrapFieldWithNoHeader<ExtraFieldProps = {}, InputProps = {}>(Field: React.FunctionComponent<InputFieldType<ExtraFieldProps, InputProps>> | React.ComponentClass<InputFieldType<ExtraFieldProps, InputProps>>): (props: InputFieldType<ExtraFieldProps, InputProps>) => React.JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* Same as above but excludes the label, useful for fields that have their own label
|
|
12
|
+
* @deprecated This function is deprecated and will be removed in future versions.
|
|
13
|
+
*/
|
|
6
14
|
export declare function wrapFieldWithError<ExtraFieldProps = {}, InputProps = {}>(Field: React.FunctionComponent<InputFieldType<ExtraFieldProps, InputProps>> | React.ComponentClass<InputFieldType<ExtraFieldProps, InputProps>>): (props: InputFieldType<ExtraFieldProps, InputProps>) => React.JSX.Element;
|
|
7
15
|
interface FieldMetaProps extends React.HTMLAttributes<HTMLElement> {
|
|
8
16
|
name: string;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import AsyncLock from 'async-lock';
|
|
2
|
+
import type { GraphQLError } from 'graphql';
|
|
1
3
|
import type { Config } from '@tinacms/schema-tools';
|
|
2
4
|
import type { Cache } from '../cache/index';
|
|
3
5
|
export declare const TINA_HOST = "content.tinajs.io";
|
|
@@ -25,12 +27,17 @@ export declare class TinaClient<GenQueries> {
|
|
|
25
27
|
queries: GenQueries;
|
|
26
28
|
errorPolicy: Config['client']['errorPolicy'];
|
|
27
29
|
initialized: boolean;
|
|
30
|
+
cacheLock: AsyncLock | undefined;
|
|
28
31
|
cacheDir: string;
|
|
29
32
|
cache: Cache;
|
|
30
33
|
constructor({ token, url, queries, errorPolicy, cacheDir, }: TinaClientArgs<GenQueries>);
|
|
31
34
|
init(): Promise<void>;
|
|
32
35
|
request<DataType extends Record<string, any> = any>({ errorPolicy, ...args }: TinaClientRequestArgs, options: {
|
|
33
36
|
fetchOptions?: Parameters<typeof fetch>[1];
|
|
34
|
-
}): Promise<
|
|
37
|
+
}): Promise<{
|
|
38
|
+
data: DataType;
|
|
39
|
+
errors: GraphQLError[] | null;
|
|
40
|
+
query: string;
|
|
41
|
+
}>;
|
|
35
42
|
}
|
|
36
43
|
export declare function createClient<GenQueries>(args: TinaClientArgs<GenQueries>): TinaClient<GenQueries>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-ebe1b69-20250211022853",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -60,21 +60,21 @@
|
|
|
60
60
|
"typings": "dist/index.d.ts",
|
|
61
61
|
"license": "Apache-2.0",
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@ariakit/react": "^0.4.
|
|
64
|
-
"@floating-ui/dom": "^1.6.
|
|
63
|
+
"@ariakit/react": "^0.4.13",
|
|
64
|
+
"@floating-ui/dom": "^1.6.12",
|
|
65
65
|
"@floating-ui/react-dom": "^2.1.2",
|
|
66
|
-
"@graphql-inspector/core": "^6.
|
|
66
|
+
"@graphql-inspector/core": "^6.2.0",
|
|
67
67
|
"@headlessui/react": "2.1.8",
|
|
68
68
|
"@heroicons/react": "^1.0.6",
|
|
69
69
|
"@monaco-editor/react": "4.4.5",
|
|
70
|
-
"@radix-ui/react-checkbox": "^1.1.
|
|
71
|
-
"@radix-ui/react-dialog": "^1.1.
|
|
72
|
-
"@radix-ui/react-dropdown-menu": "^2.1.
|
|
73
|
-
"@radix-ui/react-popover": "^1.1.
|
|
70
|
+
"@radix-ui/react-checkbox": "^1.1.2",
|
|
71
|
+
"@radix-ui/react-dialog": "^1.1.2",
|
|
72
|
+
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
|
73
|
+
"@radix-ui/react-popover": "^1.1.2",
|
|
74
74
|
"@radix-ui/react-separator": "^1.1.0",
|
|
75
75
|
"@radix-ui/react-slot": "^1.1.0",
|
|
76
76
|
"@radix-ui/react-toolbar": "^1.1.0",
|
|
77
|
-
"@radix-ui/react-tooltip": "^1.1.
|
|
77
|
+
"@radix-ui/react-tooltip": "^1.1.4",
|
|
78
78
|
"@react-hook/window-size": "^3.1.1",
|
|
79
79
|
"@udecode/cn": "^33.0.0",
|
|
80
80
|
"@udecode/plate": "^36.5.9",
|
|
@@ -92,13 +92,13 @@
|
|
|
92
92
|
"@udecode/plate-resizable": "36.0.0",
|
|
93
93
|
"@udecode/plate-slash-command": "^36.0.0",
|
|
94
94
|
"@udecode/plate-table": "36.5.8",
|
|
95
|
+
"async-lock": "^1.4.1",
|
|
95
96
|
"class-variance-authority": "^0.7.0",
|
|
96
97
|
"clsx": "^2.1.1",
|
|
97
|
-
"cmdk": "^1.0.
|
|
98
|
+
"cmdk": "^1.0.4",
|
|
98
99
|
"color-string": "^1.9.1",
|
|
99
100
|
"crypto-js": "^4.2.0",
|
|
100
101
|
"date-fns": "2.30.0",
|
|
101
|
-
"fetch-ponyfill": "^7.1.0",
|
|
102
102
|
"final-form": "4.20.10",
|
|
103
103
|
"final-form-arrays": "^3.1.0",
|
|
104
104
|
"final-form-set-field-data": "^1.0.2",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"lodash.get": "^4.4.2",
|
|
109
109
|
"lodash.set": "^4.3.2",
|
|
110
110
|
"lucide-react": "^0.424.0",
|
|
111
|
-
"mermaid": "
|
|
111
|
+
"mermaid": "9.3.0",
|
|
112
112
|
"moment": "2.29.4",
|
|
113
113
|
"monaco-editor": "0.31.0",
|
|
114
114
|
"prism-react-renderer": "^2.4.0",
|
|
@@ -119,24 +119,24 @@
|
|
|
119
119
|
"react-dropzone": "14.2.3",
|
|
120
120
|
"react-final-form": "^6.5.9",
|
|
121
121
|
"react-icons": "^5.3.0",
|
|
122
|
-
"react-onclickoutside": "^6.13.1",
|
|
123
122
|
"react-router-dom": "6.3.0",
|
|
123
|
+
"react-use": "^17.6.0",
|
|
124
124
|
"slate": "^0.103.0",
|
|
125
125
|
"slate-history": "^0.100.0",
|
|
126
126
|
"slate-hyperscript": "^0.100.0",
|
|
127
127
|
"slate-react": "^0.107.1",
|
|
128
|
-
"tailwind-merge": "^2.5.
|
|
128
|
+
"tailwind-merge": "^2.5.4",
|
|
129
129
|
"webfontloader": "1.6.28",
|
|
130
130
|
"yup": "^1.4.0",
|
|
131
131
|
"zod": "^3.23.8",
|
|
132
|
-
"@tinacms/
|
|
133
|
-
"@tinacms/
|
|
134
|
-
"@tinacms/search": "0.0.0-
|
|
132
|
+
"@tinacms/schema-tools": "1.7.0",
|
|
133
|
+
"@tinacms/mdx": "1.5.4",
|
|
134
|
+
"@tinacms/search": "0.0.0-ebe1b69-20250211022853"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
|
-
"@graphql-tools/utils": "^10.5.
|
|
137
|
+
"@graphql-tools/utils": "^10.5.6",
|
|
138
138
|
"@testing-library/dom": "^10.4.0",
|
|
139
|
-
"@testing-library/jest-dom": "^6.
|
|
139
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
140
140
|
"@testing-library/react": "^16.0.1",
|
|
141
141
|
"@testing-library/user-event": "^14.5.2",
|
|
142
142
|
"@types/atob": "^2.1.4",
|
|
@@ -144,14 +144,14 @@
|
|
|
144
144
|
"@types/color-string": "^1.5.5",
|
|
145
145
|
"@types/lodash.debounce": "^4.0.9",
|
|
146
146
|
"@types/lodash.get": "^4.4.9",
|
|
147
|
-
"@types/node": "^22.
|
|
147
|
+
"@types/node": "^22.9.0",
|
|
148
148
|
"@types/prop-types": "^15.7.13",
|
|
149
|
-
"@types/react": "^18.3.
|
|
149
|
+
"@types/react": "^18.3.12",
|
|
150
150
|
"@types/react-beautiful-dnd": "^13.1.8",
|
|
151
151
|
"@types/react-color": "^3.0.12",
|
|
152
|
-
"@types/react-dom": "^18.3.
|
|
152
|
+
"@types/react-dom": "^18.3.1",
|
|
153
153
|
"@types/yup": "^0.32.0",
|
|
154
|
-
"happy-dom": "
|
|
154
|
+
"happy-dom": "15.10.2",
|
|
155
155
|
"identity-obj-proxy": "^3.0.0",
|
|
156
156
|
"isomorphic-fetch": "^3.0.0",
|
|
157
157
|
"jest-file-snapshot": "^0.7.0",
|
|
@@ -160,11 +160,11 @@
|
|
|
160
160
|
"react-dom": "^18.3.1",
|
|
161
161
|
"react-is": "^18.3.1",
|
|
162
162
|
"tsc-alias": "^1.8.10",
|
|
163
|
-
"tslib": "^2.
|
|
164
|
-
"typescript": "^5.6.
|
|
165
|
-
"vite": "^5.4.
|
|
166
|
-
"vitest": "^2.1.
|
|
167
|
-
"@tinacms/scripts": "
|
|
163
|
+
"tslib": "^2.8.1",
|
|
164
|
+
"typescript": "^5.6.3",
|
|
165
|
+
"vite": "^5.4.11",
|
|
166
|
+
"vitest": "^2.1.5",
|
|
167
|
+
"@tinacms/scripts": "1.3.1"
|
|
168
168
|
},
|
|
169
169
|
"peerDependencies": {
|
|
170
170
|
"react": ">=16.14.0",
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const makeCacheDir = async (dir, fs) => {
|
|
2
|
-
const path = await import("./__vite-browser-external-d06ac358.mjs");
|
|
3
|
-
const os = await import("./__vite-browser-external-d06ac358.mjs");
|
|
4
|
-
const parts = dir.split(path.sep).filter(Boolean);
|
|
5
|
-
let cacheDir = dir;
|
|
6
|
-
if (!fs.existsSync(path.join(path.sep, parts[0]))) {
|
|
7
|
-
cacheDir = path.join(os.tmpdir(), parts[parts.length - 1]);
|
|
8
|
-
}
|
|
9
|
-
fs.mkdirSync(cacheDir, { recursive: true });
|
|
10
|
-
return cacheDir;
|
|
11
|
-
};
|
|
12
|
-
const NodeCache = async (dir) => {
|
|
13
|
-
const fs = await import("./__vite-browser-external-d06ac358.mjs");
|
|
14
|
-
const { createHash } = await import("./__vite-browser-external-d06ac358.mjs");
|
|
15
|
-
const cacheDir = await makeCacheDir(dir, fs);
|
|
16
|
-
return {
|
|
17
|
-
makeKey: (key) => {
|
|
18
|
-
const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
|
|
19
|
-
return createHash("sha256").update(input).digest("hex");
|
|
20
|
-
},
|
|
21
|
-
get: async (key) => {
|
|
22
|
-
try {
|
|
23
|
-
const data = await fs.promises.readFile(`${cacheDir}/${key}`, "utf-8");
|
|
24
|
-
return JSON.parse(data);
|
|
25
|
-
} catch (e) {
|
|
26
|
-
if (e.code === "ENOENT") {
|
|
27
|
-
return void 0;
|
|
28
|
-
}
|
|
29
|
-
throw e;
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
set: async (key, value) => {
|
|
33
|
-
await fs.promises.writeFile(
|
|
34
|
-
`${cacheDir}/${key}`,
|
|
35
|
-
JSON.stringify(value),
|
|
36
|
-
"utf-8"
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
export {
|
|
42
|
-
NodeCache
|
|
43
|
-
};
|