tinacms 0.0.0-f97a9b1-20241023074747 → 0.0.0-fbcd928-20241024223724
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/__vite-browser-external-d06ac358.mjs +4 -0
- package/dist/admin/types.d.ts +3 -0
- package/dist/client.js +13 -16
- package/dist/client.mjs +1 -1
- package/dist/index.js +50 -8
- package/dist/index.mjs +50 -8
- package/dist/{node-cache-43c88aed.mjs → node-cache-7fa2452c.mjs} +8 -16
- package/package.json +4 -4
package/dist/admin/types.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -106,27 +106,19 @@
|
|
|
106
106
|
return client;
|
|
107
107
|
}
|
|
108
108
|
const makeCacheDir = async (dir, fs) => {
|
|
109
|
-
const path =
|
|
110
|
-
const os =
|
|
111
|
-
|
|
112
|
-
throw new Error("Invalid directory path");
|
|
113
|
-
}
|
|
114
|
-
const pathParts = dir.split(path.sep);
|
|
115
|
-
const cacheHash = pathParts[pathParts.length - 1];
|
|
109
|
+
const path = await Promise.resolve().then(() => __viteBrowserExternal$1);
|
|
110
|
+
const os = await Promise.resolve().then(() => __viteBrowserExternal$1);
|
|
111
|
+
const parts = dir.split(path.sep).filter(Boolean);
|
|
116
112
|
let cacheDir = dir;
|
|
117
|
-
if (!fs.existsSync(
|
|
118
|
-
cacheDir = path.join(os.tmpdir(),
|
|
119
|
-
}
|
|
120
|
-
try {
|
|
121
|
-
fs.mkdirSync(cacheDir, { recursive: true });
|
|
122
|
-
} catch (error) {
|
|
123
|
-
throw new Error(`Failed to create cache directory: ${error.message}`);
|
|
113
|
+
if (!fs.existsSync(path.join(path.sep, parts[0]))) {
|
|
114
|
+
cacheDir = path.join(os.tmpdir(), parts[parts.length - 1]);
|
|
124
115
|
}
|
|
116
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
125
117
|
return cacheDir;
|
|
126
118
|
};
|
|
127
119
|
const NodeCache = async (dir) => {
|
|
128
|
-
const fs =
|
|
129
|
-
const { createHash } =
|
|
120
|
+
const fs = await Promise.resolve().then(() => __viteBrowserExternal$1);
|
|
121
|
+
const { createHash } = await Promise.resolve().then(() => __viteBrowserExternal$1);
|
|
130
122
|
const cacheDir = await makeCacheDir(dir, fs);
|
|
131
123
|
return {
|
|
132
124
|
makeKey: (key) => {
|
|
@@ -157,6 +149,11 @@
|
|
|
157
149
|
__proto__: null,
|
|
158
150
|
NodeCache
|
|
159
151
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
152
|
+
const __viteBrowserExternal = {};
|
|
153
|
+
const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
154
|
+
__proto__: null,
|
|
155
|
+
default: __viteBrowserExternal
|
|
156
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
160
157
|
exports2.TINA_HOST = TINA_HOST;
|
|
161
158
|
exports2.TinaClient = TinaClient;
|
|
162
159
|
exports2.createClient = createClient;
|
package/dist/client.mjs
CHANGED
|
@@ -24,7 +24,7 @@ class TinaClient {
|
|
|
24
24
|
}
|
|
25
25
|
try {
|
|
26
26
|
if (this.cacheDir && typeof window === "undefined" && typeof require !== "undefined") {
|
|
27
|
-
const { NodeCache } = await import("./node-cache-
|
|
27
|
+
const { NodeCache } = await import("./node-cache-7fa2452c.mjs");
|
|
28
28
|
this.cache = await NodeCache(this.cacheDir);
|
|
29
29
|
}
|
|
30
30
|
} catch (e) {
|
package/dist/index.js
CHANGED
|
@@ -3676,7 +3676,7 @@ flowchart TD
|
|
|
3676
3676
|
};
|
|
3677
3677
|
const sizeClasses = {
|
|
3678
3678
|
small: `text-xs h-8 px-3`,
|
|
3679
|
-
medium: `text-sm h-10 px-
|
|
3679
|
+
medium: `text-sm h-10 px-8`,
|
|
3680
3680
|
custom: ``
|
|
3681
3681
|
};
|
|
3682
3682
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -12839,15 +12839,14 @@ flowchart TD
|
|
|
12839
12839
|
fields: fieldGroup.fields
|
|
12840
12840
|
}
|
|
12841
12841
|
) : /* @__PURE__ */ React__namespace.createElement(NoFieldsPlaceholder, null)
|
|
12842
|
-
)), !hideFooter && /* @__PURE__ */ React__namespace.createElement("div", { className: "relative flex-none w-full h-16 px-
|
|
12842
|
+
)), !hideFooter && /* @__PURE__ */ React__namespace.createElement("div", { className: "relative flex-none w-full h-16 px-12 bg-white border-t border-gray-100 flex items-center justify-end" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1 w-full justify-end gap-2 flex items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React__namespace.createElement(
|
|
12843
12843
|
ResetForm,
|
|
12844
12844
|
{
|
|
12845
12845
|
pristine,
|
|
12846
12846
|
reset: async () => {
|
|
12847
12847
|
finalForm2.reset();
|
|
12848
12848
|
await tinaForm.reset();
|
|
12849
|
-
}
|
|
12850
|
-
style: { flexGrow: 1 }
|
|
12849
|
+
}
|
|
12851
12850
|
},
|
|
12852
12851
|
tinaForm.buttons.reset
|
|
12853
12852
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -12856,8 +12855,7 @@ flowchart TD
|
|
|
12856
12855
|
onClick: safeHandleSubmit,
|
|
12857
12856
|
disabled: !canSubmit,
|
|
12858
12857
|
busy: submitting,
|
|
12859
|
-
variant: "primary"
|
|
12860
|
-
style: { flexGrow: 3 }
|
|
12858
|
+
variant: "primary"
|
|
12861
12859
|
},
|
|
12862
12860
|
submitting && /* @__PURE__ */ React__namespace.createElement(LoadingDots, null),
|
|
12863
12861
|
!submitting && tinaForm.buttons.save
|
|
@@ -30079,6 +30077,7 @@ mutation addPendingDocumentMutation(
|
|
|
30079
30077
|
relativePath
|
|
30080
30078
|
filename
|
|
30081
30079
|
extension
|
|
30080
|
+
hasReferences
|
|
30082
30081
|
}
|
|
30083
30082
|
}
|
|
30084
30083
|
}
|
|
@@ -30170,6 +30169,9 @@ mutation addPendingDocumentMutation(
|
|
|
30170
30169
|
document(collection:$collection, relativePath:$relativePath) {
|
|
30171
30170
|
... on Document {
|
|
30172
30171
|
_values
|
|
30172
|
+
_sys {
|
|
30173
|
+
hasReferences
|
|
30174
|
+
}
|
|
30173
30175
|
}
|
|
30174
30176
|
}
|
|
30175
30177
|
}`;
|
|
@@ -31896,6 +31898,23 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31896
31898
|
DeleteModal,
|
|
31897
31899
|
{
|
|
31898
31900
|
filename: vars.relativePath,
|
|
31901
|
+
checkRefsFunc: async () => {
|
|
31902
|
+
var _a2, _b2;
|
|
31903
|
+
try {
|
|
31904
|
+
const doc = await admin.fetchDocument(
|
|
31905
|
+
collection.name,
|
|
31906
|
+
vars.relativePath,
|
|
31907
|
+
true
|
|
31908
|
+
);
|
|
31909
|
+
return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
|
|
31910
|
+
} catch (error) {
|
|
31911
|
+
cms.alerts.error(
|
|
31912
|
+
"Document was not found, ask a developer for help or check the console for an error message"
|
|
31913
|
+
);
|
|
31914
|
+
console.error(error);
|
|
31915
|
+
throw error;
|
|
31916
|
+
}
|
|
31917
|
+
},
|
|
31899
31918
|
deleteFunc: async () => {
|
|
31900
31919
|
try {
|
|
31901
31920
|
await admin.deleteDocument(vars);
|
|
@@ -31904,6 +31923,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31904
31923
|
);
|
|
31905
31924
|
reFetchCollection();
|
|
31906
31925
|
} catch (error) {
|
|
31926
|
+
if (error.message.indexOf("has references")) {
|
|
31927
|
+
cms.alerts.error(
|
|
31928
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31929
|
+
);
|
|
31930
|
+
return;
|
|
31931
|
+
}
|
|
31907
31932
|
cms.alerts.warn(
|
|
31908
31933
|
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
31909
31934
|
);
|
|
@@ -31955,6 +31980,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31955
31980
|
cms.alerts.info("Document was successfully renamed");
|
|
31956
31981
|
reFetchCollection();
|
|
31957
31982
|
} catch (error) {
|
|
31983
|
+
if (error.message.indexOf("has references")) {
|
|
31984
|
+
cms.alerts.error(
|
|
31985
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31986
|
+
);
|
|
31987
|
+
return;
|
|
31988
|
+
}
|
|
31958
31989
|
cms.alerts.warn(
|
|
31959
31990
|
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
31960
31991
|
);
|
|
@@ -32428,8 +32459,19 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
32428
32459
|
const NoDocumentsPlaceholder = () => {
|
|
32429
32460
|
return /* @__PURE__ */ React.createElement("div", { className: "text-center px-5 py-3 flex flex-col items-center justify-center shadow border border-gray-100 bg-gray-50 border-b border-gray-200 w-full max-w-full rounded-lg" }, /* @__PURE__ */ React.createElement("p", { className: "text-base italic font-medium text-gray-300" }, "No documents found."));
|
|
32430
32461
|
};
|
|
32431
|
-
const DeleteModal = ({
|
|
32432
|
-
|
|
32462
|
+
const DeleteModal = ({
|
|
32463
|
+
close: close2,
|
|
32464
|
+
deleteFunc,
|
|
32465
|
+
checkRefsFunc,
|
|
32466
|
+
filename
|
|
32467
|
+
}) => {
|
|
32468
|
+
const [hasRefs, setHasRefs] = React.useState();
|
|
32469
|
+
React.useEffect(() => {
|
|
32470
|
+
checkRefsFunc().then((result) => {
|
|
32471
|
+
setHasRefs(result);
|
|
32472
|
+
});
|
|
32473
|
+
}, [filename, checkRefsFunc]);
|
|
32474
|
+
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", null, `Are you sure you want to delete ${filename}?${hasRefs ? " References to this document will also be deleted." : ""}`)), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
|
|
32433
32475
|
Button$1,
|
|
32434
32476
|
{
|
|
32435
32477
|
style: { flexGrow: 3 },
|
package/dist/index.mjs
CHANGED
|
@@ -3703,7 +3703,7 @@ const Button$1 = ({
|
|
|
3703
3703
|
};
|
|
3704
3704
|
const sizeClasses = {
|
|
3705
3705
|
small: `text-xs h-8 px-3`,
|
|
3706
|
-
medium: `text-sm h-10 px-
|
|
3706
|
+
medium: `text-sm h-10 px-8`,
|
|
3707
3707
|
custom: ``
|
|
3708
3708
|
};
|
|
3709
3709
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -12866,15 +12866,14 @@ const FormBuilder = ({
|
|
|
12866
12866
|
fields: fieldGroup.fields
|
|
12867
12867
|
}
|
|
12868
12868
|
) : /* @__PURE__ */ React.createElement(NoFieldsPlaceholder, null)
|
|
12869
|
-
)), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-
|
|
12869
|
+
)), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-12 bg-white border-t border-gray-100 flex items-center justify-end" }, /* @__PURE__ */ React.createElement("div", { className: "flex-1 w-full justify-end gap-2 flex items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React.createElement(
|
|
12870
12870
|
ResetForm,
|
|
12871
12871
|
{
|
|
12872
12872
|
pristine,
|
|
12873
12873
|
reset: async () => {
|
|
12874
12874
|
finalForm.reset();
|
|
12875
12875
|
await tinaForm.reset();
|
|
12876
|
-
}
|
|
12877
|
-
style: { flexGrow: 1 }
|
|
12876
|
+
}
|
|
12878
12877
|
},
|
|
12879
12878
|
tinaForm.buttons.reset
|
|
12880
12879
|
), /* @__PURE__ */ React.createElement(
|
|
@@ -12883,8 +12882,7 @@ const FormBuilder = ({
|
|
|
12883
12882
|
onClick: safeHandleSubmit,
|
|
12884
12883
|
disabled: !canSubmit,
|
|
12885
12884
|
busy: submitting,
|
|
12886
|
-
variant: "primary"
|
|
12887
|
-
style: { flexGrow: 3 }
|
|
12885
|
+
variant: "primary"
|
|
12888
12886
|
},
|
|
12889
12887
|
submitting && /* @__PURE__ */ React.createElement(LoadingDots, null),
|
|
12890
12888
|
!submitting && tinaForm.buttons.save
|
|
@@ -30106,6 +30104,7 @@ class TinaAdminApi {
|
|
|
30106
30104
|
relativePath
|
|
30107
30105
|
filename
|
|
30108
30106
|
extension
|
|
30107
|
+
hasReferences
|
|
30109
30108
|
}
|
|
30110
30109
|
}
|
|
30111
30110
|
}
|
|
@@ -30197,6 +30196,9 @@ class TinaAdminApi {
|
|
|
30197
30196
|
document(collection:$collection, relativePath:$relativePath) {
|
|
30198
30197
|
... on Document {
|
|
30199
30198
|
_values
|
|
30199
|
+
_sys {
|
|
30200
|
+
hasReferences
|
|
30201
|
+
}
|
|
30200
30202
|
}
|
|
30201
30203
|
}
|
|
30202
30204
|
}`;
|
|
@@ -31923,6 +31925,23 @@ const CollectionListPage = () => {
|
|
|
31923
31925
|
DeleteModal,
|
|
31924
31926
|
{
|
|
31925
31927
|
filename: vars.relativePath,
|
|
31928
|
+
checkRefsFunc: async () => {
|
|
31929
|
+
var _a2, _b2;
|
|
31930
|
+
try {
|
|
31931
|
+
const doc = await admin.fetchDocument(
|
|
31932
|
+
collection.name,
|
|
31933
|
+
vars.relativePath,
|
|
31934
|
+
true
|
|
31935
|
+
);
|
|
31936
|
+
return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
|
|
31937
|
+
} catch (error) {
|
|
31938
|
+
cms.alerts.error(
|
|
31939
|
+
"Document was not found, ask a developer for help or check the console for an error message"
|
|
31940
|
+
);
|
|
31941
|
+
console.error(error);
|
|
31942
|
+
throw error;
|
|
31943
|
+
}
|
|
31944
|
+
},
|
|
31926
31945
|
deleteFunc: async () => {
|
|
31927
31946
|
try {
|
|
31928
31947
|
await admin.deleteDocument(vars);
|
|
@@ -31931,6 +31950,12 @@ const CollectionListPage = () => {
|
|
|
31931
31950
|
);
|
|
31932
31951
|
reFetchCollection();
|
|
31933
31952
|
} catch (error) {
|
|
31953
|
+
if (error.message.indexOf("has references")) {
|
|
31954
|
+
cms.alerts.error(
|
|
31955
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31956
|
+
);
|
|
31957
|
+
return;
|
|
31958
|
+
}
|
|
31934
31959
|
cms.alerts.warn(
|
|
31935
31960
|
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
31936
31961
|
);
|
|
@@ -31982,6 +32007,12 @@ const CollectionListPage = () => {
|
|
|
31982
32007
|
cms.alerts.info("Document was successfully renamed");
|
|
31983
32008
|
reFetchCollection();
|
|
31984
32009
|
} catch (error) {
|
|
32010
|
+
if (error.message.indexOf("has references")) {
|
|
32011
|
+
cms.alerts.error(
|
|
32012
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
32013
|
+
);
|
|
32014
|
+
return;
|
|
32015
|
+
}
|
|
31985
32016
|
cms.alerts.warn(
|
|
31986
32017
|
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
31987
32018
|
);
|
|
@@ -32455,8 +32486,19 @@ const Breadcrumb = ({ folder, navigate, collectionName }) => {
|
|
|
32455
32486
|
const NoDocumentsPlaceholder = () => {
|
|
32456
32487
|
return /* @__PURE__ */ React__default.createElement("div", { className: "text-center px-5 py-3 flex flex-col items-center justify-center shadow border border-gray-100 bg-gray-50 border-b border-gray-200 w-full max-w-full rounded-lg" }, /* @__PURE__ */ React__default.createElement("p", { className: "text-base italic font-medium text-gray-300" }, "No documents found."));
|
|
32457
32488
|
};
|
|
32458
|
-
const DeleteModal = ({
|
|
32459
|
-
|
|
32489
|
+
const DeleteModal = ({
|
|
32490
|
+
close: close2,
|
|
32491
|
+
deleteFunc,
|
|
32492
|
+
checkRefsFunc,
|
|
32493
|
+
filename
|
|
32494
|
+
}) => {
|
|
32495
|
+
const [hasRefs, setHasRefs] = React__default.useState();
|
|
32496
|
+
useEffect(() => {
|
|
32497
|
+
checkRefsFunc().then((result) => {
|
|
32498
|
+
setHasRefs(result);
|
|
32499
|
+
});
|
|
32500
|
+
}, [filename, checkRefsFunc]);
|
|
32501
|
+
return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React__default.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__default.createElement("p", null, `Are you sure you want to delete ${filename}?${hasRefs ? " References to this document will also be deleted." : ""}`)), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React__default.createElement(
|
|
32460
32502
|
Button$1,
|
|
32461
32503
|
{
|
|
32462
32504
|
style: { flexGrow: 3 },
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
const makeCacheDir = async (dir, fs) => {
|
|
2
|
-
const path =
|
|
3
|
-
const os =
|
|
4
|
-
|
|
5
|
-
throw new Error("Invalid directory path");
|
|
6
|
-
}
|
|
7
|
-
const pathParts = dir.split(path.sep);
|
|
8
|
-
const cacheHash = pathParts[pathParts.length - 1];
|
|
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);
|
|
9
5
|
let cacheDir = dir;
|
|
10
|
-
if (!fs.existsSync(
|
|
11
|
-
cacheDir = path.join(os.tmpdir(),
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
fs.mkdirSync(cacheDir, { recursive: true });
|
|
15
|
-
} catch (error) {
|
|
16
|
-
throw new Error(`Failed to create cache directory: ${error.message}`);
|
|
6
|
+
if (!fs.existsSync(path.join(path.sep, parts[0]))) {
|
|
7
|
+
cacheDir = path.join(os.tmpdir(), parts[parts.length - 1]);
|
|
17
8
|
}
|
|
9
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
18
10
|
return cacheDir;
|
|
19
11
|
};
|
|
20
12
|
const NodeCache = async (dir) => {
|
|
21
|
-
const fs =
|
|
22
|
-
const { createHash } =
|
|
13
|
+
const fs = await import("./__vite-browser-external-d06ac358.mjs");
|
|
14
|
+
const { createHash } = await import("./__vite-browser-external-d06ac358.mjs");
|
|
23
15
|
const cacheDir = await makeCacheDir(dir, fs);
|
|
24
16
|
return {
|
|
25
17
|
makeKey: (key) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-fbcd928-20241024223724",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -129,9 +129,9 @@
|
|
|
129
129
|
"webfontloader": "1.6.28",
|
|
130
130
|
"yup": "^1.4.0",
|
|
131
131
|
"zod": "^3.23.8",
|
|
132
|
-
"@tinacms/mdx": "
|
|
133
|
-
"@tinacms/schema-tools": "
|
|
134
|
-
"@tinacms/search": "
|
|
132
|
+
"@tinacms/mdx": "0.0.0-fbcd928-20241024223724",
|
|
133
|
+
"@tinacms/schema-tools": "0.0.0-fbcd928-20241024223724",
|
|
134
|
+
"@tinacms/search": "0.0.0-fbcd928-20241024223724"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
137
|
"@graphql-tools/utils": "^10.5.4",
|