@btst/plugin-cms 1.0.0 → 1.2.0-beta.0
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/api/getters.cjs +37 -25
- package/dist/api/getters.mjs +37 -25
- package/dist/api/index.cjs +1 -0
- package/dist/api/index.d.cts +17 -8
- package/dist/api/index.d.mts +17 -8
- package/dist/api/index.d.ts +17 -8
- package/dist/api/index.mjs +1 -1
- package/dist/api/mutations.cjs +46 -19
- package/dist/api/mutations.mjs +46 -20
- package/dist/api/operations.cjs +586 -177
- package/dist/api/operations.mjs +585 -178
- package/dist/api/plugin.cjs +56 -7
- package/dist/api/plugin.mjs +57 -8
- package/dist/api/publication.cjs +8 -0
- package/dist/api/publication.mjs +6 -0
- package/dist/client/components/forms/content-form.cjs +107 -1
- package/dist/client/components/forms/content-form.mjs +108 -2
- package/dist/client/components/pages/content-editor-page.internal.cjs +23 -5
- package/dist/client/components/pages/content-editor-page.internal.mjs +23 -5
- package/dist/client/components/pages/content-list-page.internal.cjs +3 -0
- package/dist/client/components/pages/content-list-page.internal.mjs +3 -0
- package/dist/client/components/pages/dashboard-page.internal.cjs +10 -30
- package/dist/client/components/pages/dashboard-page.internal.mjs +10 -30
- package/dist/client/components/revision-history.cjs +161 -0
- package/dist/client/components/revision-history.mjs +159 -0
- package/dist/client/components/shared/content-type-card.cjs +56 -0
- package/dist/client/components/shared/content-type-card.mjs +54 -0
- package/dist/client/components/shared/empty-state.cjs +18 -1
- package/dist/client/components/shared/empty-state.mjs +19 -2
- package/dist/client/hooks/cms-hooks.cjs +18 -2
- package/dist/client/hooks/cms-hooks.mjs +17 -3
- package/dist/client/hooks/index.cjs +2 -0
- package/dist/client/hooks/index.d.cts +306 -2
- package/dist/client/hooks/index.d.mts +306 -2
- package/dist/client/hooks/index.d.ts +306 -2
- package/dist/client/hooks/index.mjs +1 -1
- package/dist/client/index.d.cts +55 -2
- package/dist/client/index.d.mts +55 -2
- package/dist/client/index.d.ts +55 -2
- package/dist/db.cjs +25 -0
- package/dist/db.mjs +25 -0
- package/dist/permissions.cjs +2 -0
- package/dist/permissions.d.cts +1 -0
- package/dist/permissions.d.mts +1 -0
- package/dist/permissions.d.ts +1 -0
- package/dist/permissions.mjs +2 -0
- package/dist/query-keys.cjs +31 -1
- package/dist/query-keys.d.cts +1 -1
- package/dist/query-keys.d.mts +1 -1
- package/dist/query-keys.d.ts +1 -1
- package/dist/query-keys.mjs +31 -1
- package/dist/shared/{plugin-cms.W4Le8D91.d.mts → plugin-cms.DAAUZ41w.d.mts} +377 -144
- package/dist/shared/{plugin-cms.c-GeWvTf.d.cts → plugin-cms.DJ_293QU.d.cts} +377 -144
- package/dist/shared/{plugin-cms.DQLAoogy.d.ts → plugin-cms.DlUSv7wz.d.ts} +377 -144
- package/dist/types.d.cts +38 -2
- package/dist/types.d.mts +38 -2
- package/dist/types.d.ts +38 -2
- package/dist/ui/src/components/auto-form/config.cjs +2 -0
- package/dist/ui/src/components/auto-form/config.mjs +2 -0
- package/dist/ui/src/components/auto-form/fields/file.cjs +68 -0
- package/dist/ui/src/components/auto-form/fields/file.mjs +63 -0
- package/dist/ui/src/components/auto-form/fields/object.cjs +9 -2
- package/dist/ui/src/components/auto-form/fields/object.mjs +9 -2
- package/dist/ui/src/components/auto-form/helpers.cjs +9 -0
- package/dist/ui/src/components/auto-form/helpers.mjs +9 -0
- package/dist/ui/src/components/auto-form/index.cjs +29 -4
- package/dist/ui/src/components/auto-form/index.mjs +31 -6
- package/dist/ui/src/components/auto-form/stepped-auto-form.cjs +34 -29
- package/dist/ui/src/components/auto-form/stepped-auto-form.mjs +35 -30
- package/dist/ui/src/components/sheet.cjs +126 -0
- package/dist/ui/src/components/sheet.mjs +105 -0
- package/dist/ui/src/lib/form-visibility.cjs +20 -0
- package/dist/ui/src/lib/form-visibility.mjs +18 -0
- package/dist/ui/src/lib/schema-converter.cjs +101 -0
- package/dist/ui/src/lib/schema-converter.mjs +100 -1
- package/package.json +5 -4
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { FileText } from 'lucide-react';
|
|
4
|
+
import { Card, CardHeader, CardTitle, CardContent } from '../../../ui/src/components/card.mjs';
|
|
5
|
+
import { usePluginOverrides } from '@btst/stack/context';
|
|
6
|
+
import { CMS_PLUGIN_ID } from '../../constants.mjs';
|
|
7
|
+
import { cn } from '../../../utils.mjs';
|
|
8
|
+
|
|
9
|
+
function ContentTypeCard({
|
|
10
|
+
page,
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
13
|
+
if (!page) return /* @__PURE__ */ jsx(DefaultContentTypeCard, { ...props });
|
|
14
|
+
return /* @__PURE__ */ jsx(ScopedContentTypeCard, { page, ...props });
|
|
15
|
+
}
|
|
16
|
+
function ScopedContentTypeCard({
|
|
17
|
+
page,
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
20
|
+
const { pageOverrides } = usePluginOverrides(CMS_PLUGIN_ID);
|
|
21
|
+
const TypeCard = (page ? pageOverrides?.[page]?.ContentTypeCard : void 0) ?? DefaultContentTypeCard;
|
|
22
|
+
return /* @__PURE__ */ jsx(TypeCard, { ...props });
|
|
23
|
+
}
|
|
24
|
+
function DefaultContentTypeCard({
|
|
25
|
+
contentType,
|
|
26
|
+
itemCountLabel,
|
|
27
|
+
onOpen,
|
|
28
|
+
className,
|
|
29
|
+
titleClassName
|
|
30
|
+
}) {
|
|
31
|
+
return /* @__PURE__ */ jsxs(
|
|
32
|
+
Card,
|
|
33
|
+
{
|
|
34
|
+
className: cn(
|
|
35
|
+
"hover:border-primary/50 transition-colors cursor-pointer",
|
|
36
|
+
className
|
|
37
|
+
),
|
|
38
|
+
onClick: onOpen,
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
41
|
+
/* @__PURE__ */ jsx(CardTitle, { className: cn("text-lg font-medium", titleClassName), children: contentType.name }),
|
|
42
|
+
/* @__PURE__ */ jsx(FileText, { className: "h-5 w-5 text-muted-foreground" })
|
|
43
|
+
] }),
|
|
44
|
+
/* @__PURE__ */ jsxs(CardContent, { children: [
|
|
45
|
+
/* @__PURE__ */ jsx("div", { className: "text-2xl font-bold", children: contentType.itemCount }),
|
|
46
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: itemCountLabel }),
|
|
47
|
+
contentType.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mt-2 line-clamp-2", children: contentType.description })
|
|
48
|
+
] })
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { ContentTypeCard };
|
|
@@ -2,9 +2,26 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
const context = require('@btst/stack/context');
|
|
6
|
+
const constants = require('../../constants.cjs');
|
|
5
7
|
const lucideReact = require('lucide-react');
|
|
6
8
|
|
|
7
|
-
function EmptyState({
|
|
9
|
+
function EmptyState({
|
|
10
|
+
page,
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
13
|
+
if (!page) return /* @__PURE__ */ jsxRuntime.jsx(DefaultEmptyState, { ...props });
|
|
14
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ScopedEmptyState, { page, ...props });
|
|
15
|
+
}
|
|
16
|
+
function ScopedEmptyState({
|
|
17
|
+
page,
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
20
|
+
const { pageOverrides } = context.usePluginOverrides(constants.CMS_PLUGIN_ID);
|
|
21
|
+
const State = (page ? pageOverrides?.[page]?.EmptyState : void 0) ?? DefaultEmptyState;
|
|
22
|
+
return /* @__PURE__ */ jsxRuntime.jsx(State, { ...props });
|
|
23
|
+
}
|
|
24
|
+
function DefaultEmptyState({ title, description, action }) {
|
|
8
25
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center py-12 px-4 text-center", children: [
|
|
9
26
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-full bg-muted p-4 mb-4", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Inbox, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
10
27
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-medium text-foreground mb-2", children: title }),
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { usePluginOverrides } from '@btst/stack/context';
|
|
4
|
+
import { CMS_PLUGIN_ID } from '../../constants.mjs';
|
|
3
5
|
import { Inbox } from 'lucide-react';
|
|
4
6
|
|
|
5
|
-
function EmptyState({
|
|
7
|
+
function EmptyState({
|
|
8
|
+
page,
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
11
|
+
if (!page) return /* @__PURE__ */ jsx(DefaultEmptyState, { ...props });
|
|
12
|
+
return /* @__PURE__ */ jsx(ScopedEmptyState, { page, ...props });
|
|
13
|
+
}
|
|
14
|
+
function ScopedEmptyState({
|
|
15
|
+
page,
|
|
16
|
+
...props
|
|
17
|
+
}) {
|
|
18
|
+
const { pageOverrides } = usePluginOverrides(CMS_PLUGIN_ID);
|
|
19
|
+
const State = (page ? pageOverrides?.[page]?.EmptyState : void 0) ?? DefaultEmptyState;
|
|
20
|
+
return /* @__PURE__ */ jsx(State, { ...props });
|
|
21
|
+
}
|
|
22
|
+
function DefaultEmptyState({ title, description, action }) {
|
|
6
23
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-12 px-4 text-center", children: [
|
|
7
24
|
/* @__PURE__ */ jsx("div", { className: "rounded-full bg-muted p-4 mb-4", children: /* @__PURE__ */ jsx(Inbox, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
8
25
|
/* @__PURE__ */ jsx("h3", { className: "text-lg font-medium text-foreground mb-2", children: title }),
|
|
@@ -126,12 +126,14 @@ function useCreateContent(typeSlug) {
|
|
|
126
126
|
mutate: (vars) => mutation.mutate({
|
|
127
127
|
typeSlug,
|
|
128
128
|
slug: vars.slug,
|
|
129
|
-
data: vars.data
|
|
129
|
+
data: vars.data,
|
|
130
|
+
publishAt: vars.publishAt
|
|
130
131
|
}),
|
|
131
132
|
mutateAsync: async (vars) => await mutation.mutateAsync({
|
|
132
133
|
typeSlug,
|
|
133
134
|
slug: vars.slug,
|
|
134
|
-
data: vars.data
|
|
135
|
+
data: vars.data,
|
|
136
|
+
publishAt: vars.publishAt
|
|
135
137
|
})
|
|
136
138
|
};
|
|
137
139
|
}
|
|
@@ -278,6 +280,18 @@ function useInverseRelationItems(params, options = {}) {
|
|
|
278
280
|
refetch
|
|
279
281
|
};
|
|
280
282
|
}
|
|
283
|
+
function useContentRevisions(typeSlug, id, enabled = true) {
|
|
284
|
+
const result = cmsResource.cms.cmsRevisions.list.useInfinite([typeSlug, id], {
|
|
285
|
+
enabled: enabled && !!id
|
|
286
|
+
});
|
|
287
|
+
return {
|
|
288
|
+
...result,
|
|
289
|
+
revisions: result.data?.pages.flatMap((page) => page.items) ?? []
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function useRestoreContentRevision() {
|
|
293
|
+
return cmsResource.cms.cmsRevisions.restore.use();
|
|
294
|
+
}
|
|
281
295
|
|
|
282
296
|
exports.useContent = useContent;
|
|
283
297
|
exports.useContentByRelation = useContentByRelation;
|
|
@@ -286,12 +300,14 @@ exports.useContentItemBySlug = useContentItemBySlug;
|
|
|
286
300
|
exports.useContentItemForm = useContentItemForm;
|
|
287
301
|
exports.useContentItemPopulated = useContentItemPopulated;
|
|
288
302
|
exports.useContentOptions = useContentOptions;
|
|
303
|
+
exports.useContentRevisions = useContentRevisions;
|
|
289
304
|
exports.useContentType = useContentType;
|
|
290
305
|
exports.useContentTypes = useContentTypes;
|
|
291
306
|
exports.useCreateContent = useCreateContent;
|
|
292
307
|
exports.useDeleteContent = useDeleteContent;
|
|
293
308
|
exports.useInverseRelationItems = useInverseRelationItems;
|
|
294
309
|
exports.useInverseRelations = useInverseRelations;
|
|
310
|
+
exports.useRestoreContentRevision = useRestoreContentRevision;
|
|
295
311
|
exports.useSuspenseContent = useSuspenseContent;
|
|
296
312
|
exports.useSuspenseContentByRelation = useSuspenseContentByRelation;
|
|
297
313
|
exports.useSuspenseContentItem = useSuspenseContentItem;
|
|
@@ -124,12 +124,14 @@ function useCreateContent(typeSlug) {
|
|
|
124
124
|
mutate: (vars) => mutation.mutate({
|
|
125
125
|
typeSlug,
|
|
126
126
|
slug: vars.slug,
|
|
127
|
-
data: vars.data
|
|
127
|
+
data: vars.data,
|
|
128
|
+
publishAt: vars.publishAt
|
|
128
129
|
}),
|
|
129
130
|
mutateAsync: async (vars) => await mutation.mutateAsync({
|
|
130
131
|
typeSlug,
|
|
131
132
|
slug: vars.slug,
|
|
132
|
-
data: vars.data
|
|
133
|
+
data: vars.data,
|
|
134
|
+
publishAt: vars.publishAt
|
|
133
135
|
})
|
|
134
136
|
};
|
|
135
137
|
}
|
|
@@ -276,5 +278,17 @@ function useInverseRelationItems(params, options = {}) {
|
|
|
276
278
|
refetch
|
|
277
279
|
};
|
|
278
280
|
}
|
|
281
|
+
function useContentRevisions(typeSlug, id, enabled = true) {
|
|
282
|
+
const result = cms.cmsRevisions.list.useInfinite([typeSlug, id], {
|
|
283
|
+
enabled: enabled && !!id
|
|
284
|
+
});
|
|
285
|
+
return {
|
|
286
|
+
...result,
|
|
287
|
+
revisions: result.data?.pages.flatMap((page) => page.items) ?? []
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function useRestoreContentRevision() {
|
|
291
|
+
return cms.cmsRevisions.restore.use();
|
|
292
|
+
}
|
|
279
293
|
|
|
280
|
-
export { useContent, useContentByRelation, useContentItem, useContentItemBySlug, useContentItemForm, useContentItemPopulated, useContentOptions, useContentType, useContentTypes, useCreateContent, useDeleteContent, useInverseRelationItems, useInverseRelations, useSuspenseContent, useSuspenseContentByRelation, useSuspenseContentItem, useSuspenseContentItemPopulated, useSuspenseContentTypes, useUpdateContent };
|
|
294
|
+
export { useContent, useContentByRelation, useContentItem, useContentItemBySlug, useContentItemForm, useContentItemPopulated, useContentOptions, useContentRevisions, useContentType, useContentTypes, useCreateContent, useDeleteContent, useInverseRelationItems, useInverseRelations, useRestoreContentRevision, useSuspenseContent, useSuspenseContentByRelation, useSuspenseContentItem, useSuspenseContentItemPopulated, useSuspenseContentTypes, useUpdateContent };
|
|
@@ -11,12 +11,14 @@ exports.useContentItemBySlug = cmsHooks.useContentItemBySlug;
|
|
|
11
11
|
exports.useContentItemForm = cmsHooks.useContentItemForm;
|
|
12
12
|
exports.useContentItemPopulated = cmsHooks.useContentItemPopulated;
|
|
13
13
|
exports.useContentOptions = cmsHooks.useContentOptions;
|
|
14
|
+
exports.useContentRevisions = cmsHooks.useContentRevisions;
|
|
14
15
|
exports.useContentType = cmsHooks.useContentType;
|
|
15
16
|
exports.useContentTypes = cmsHooks.useContentTypes;
|
|
16
17
|
exports.useCreateContent = cmsHooks.useCreateContent;
|
|
17
18
|
exports.useDeleteContent = cmsHooks.useDeleteContent;
|
|
18
19
|
exports.useInverseRelationItems = cmsHooks.useInverseRelationItems;
|
|
19
20
|
exports.useInverseRelations = cmsHooks.useInverseRelations;
|
|
21
|
+
exports.useRestoreContentRevision = cmsHooks.useRestoreContentRevision;
|
|
20
22
|
exports.useSuspenseContent = cmsHooks.useSuspenseContent;
|
|
21
23
|
exports.useSuspenseContentByRelation = cmsHooks.useSuspenseContentByRelation;
|
|
22
24
|
exports.useSuspenseContentItem = cmsHooks.useSuspenseContentItem;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
|
+
import { SerializedContentItemWithType, CMSReadView, CMSContentFields, CMSReadOptions, CMSContentItemResult, SerializedContentType, CMSContentTypeMap, SerializedContentRevision, InverseRelation } from '../../types.cjs';
|
|
2
4
|
import { ResourceFormConfig, ResourceFormResult, ResourceSelectResult } from '@btst/stack/plugins/client/hooks';
|
|
3
|
-
import { SerializedContentItemWithType, CMSReadView, CMSContentFields, CMSReadOptions, CMSContentItemResult, SerializedContentType, CMSContentTypeMap, InverseRelation } from '../../types.cjs';
|
|
4
5
|
import 'zod';
|
|
5
6
|
|
|
6
7
|
interface UseContentTypesResult {
|
|
@@ -207,10 +208,12 @@ declare function useCreateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
207
208
|
mutate: (vars: {
|
|
208
209
|
slug: string;
|
|
209
210
|
data: TData;
|
|
211
|
+
publishAt?: string | null;
|
|
210
212
|
}) => void;
|
|
211
213
|
mutateAsync: (vars: {
|
|
212
214
|
slug: string;
|
|
213
215
|
data: TData;
|
|
216
|
+
publishAt?: string | null;
|
|
214
217
|
}) => Promise<SerializedContentItemWithType<TData>>;
|
|
215
218
|
data: undefined;
|
|
216
219
|
variables: undefined;
|
|
@@ -230,16 +233,19 @@ declare function useCreateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
230
233
|
mutate: (vars: {
|
|
231
234
|
slug: string;
|
|
232
235
|
data: TData;
|
|
236
|
+
publishAt?: string | null;
|
|
233
237
|
}) => void;
|
|
234
238
|
mutateAsync: (vars: {
|
|
235
239
|
slug: string;
|
|
236
240
|
data: TData;
|
|
241
|
+
publishAt?: string | null;
|
|
237
242
|
}) => Promise<SerializedContentItemWithType<TData>>;
|
|
238
243
|
data: undefined;
|
|
239
244
|
variables: {
|
|
240
245
|
typeSlug: string;
|
|
241
246
|
slug: string;
|
|
242
247
|
data: Record<string, unknown>;
|
|
248
|
+
publishAt?: string | null;
|
|
243
249
|
};
|
|
244
250
|
error: null;
|
|
245
251
|
isError: false;
|
|
@@ -257,10 +263,12 @@ declare function useCreateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
257
263
|
mutate: (vars: {
|
|
258
264
|
slug: string;
|
|
259
265
|
data: TData;
|
|
266
|
+
publishAt?: string | null;
|
|
260
267
|
}) => void;
|
|
261
268
|
mutateAsync: (vars: {
|
|
262
269
|
slug: string;
|
|
263
270
|
data: TData;
|
|
271
|
+
publishAt?: string | null;
|
|
264
272
|
}) => Promise<SerializedContentItemWithType<TData>>;
|
|
265
273
|
data: undefined;
|
|
266
274
|
error: Error;
|
|
@@ -268,6 +276,7 @@ declare function useCreateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
268
276
|
typeSlug: string;
|
|
269
277
|
slug: string;
|
|
270
278
|
data: Record<string, unknown>;
|
|
279
|
+
publishAt?: string | null;
|
|
271
280
|
};
|
|
272
281
|
isError: true;
|
|
273
282
|
isIdle: false;
|
|
@@ -284,10 +293,12 @@ declare function useCreateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
284
293
|
mutate: (vars: {
|
|
285
294
|
slug: string;
|
|
286
295
|
data: TData;
|
|
296
|
+
publishAt?: string | null;
|
|
287
297
|
}) => void;
|
|
288
298
|
mutateAsync: (vars: {
|
|
289
299
|
slug: string;
|
|
290
300
|
data: TData;
|
|
301
|
+
publishAt?: string | null;
|
|
291
302
|
}) => Promise<SerializedContentItemWithType<TData>>;
|
|
292
303
|
data: SerializedContentItemWithType<Record<string, unknown>> | null;
|
|
293
304
|
error: null;
|
|
@@ -295,6 +306,7 @@ declare function useCreateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
295
306
|
typeSlug: string;
|
|
296
307
|
slug: string;
|
|
297
308
|
data: Record<string, unknown>;
|
|
309
|
+
publishAt?: string | null;
|
|
298
310
|
};
|
|
299
311
|
isError: false;
|
|
300
312
|
isIdle: false;
|
|
@@ -330,6 +342,7 @@ declare function useUpdateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
330
342
|
data: {
|
|
331
343
|
slug?: string;
|
|
332
344
|
data?: TData;
|
|
345
|
+
publishAt?: string | null;
|
|
333
346
|
};
|
|
334
347
|
}) => void;
|
|
335
348
|
mutateAsync: (vars: {
|
|
@@ -337,6 +350,7 @@ declare function useUpdateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
337
350
|
data: {
|
|
338
351
|
slug?: string;
|
|
339
352
|
data?: TData;
|
|
353
|
+
publishAt?: string | null;
|
|
340
354
|
};
|
|
341
355
|
}) => Promise<SerializedContentItemWithType<TData>>;
|
|
342
356
|
data: undefined;
|
|
@@ -359,6 +373,7 @@ declare function useUpdateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
359
373
|
data: {
|
|
360
374
|
slug?: string;
|
|
361
375
|
data?: TData;
|
|
376
|
+
publishAt?: string | null;
|
|
362
377
|
};
|
|
363
378
|
}) => void;
|
|
364
379
|
mutateAsync: (vars: {
|
|
@@ -366,6 +381,7 @@ declare function useUpdateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
366
381
|
data: {
|
|
367
382
|
slug?: string;
|
|
368
383
|
data?: TData;
|
|
384
|
+
publishAt?: string | null;
|
|
369
385
|
};
|
|
370
386
|
}) => Promise<SerializedContentItemWithType<TData>>;
|
|
371
387
|
data: undefined;
|
|
@@ -375,6 +391,7 @@ declare function useUpdateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
375
391
|
data: {
|
|
376
392
|
slug?: string;
|
|
377
393
|
data?: Record<string, unknown>;
|
|
394
|
+
publishAt?: string | null;
|
|
378
395
|
};
|
|
379
396
|
};
|
|
380
397
|
error: null;
|
|
@@ -395,6 +412,7 @@ declare function useUpdateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
395
412
|
data: {
|
|
396
413
|
slug?: string;
|
|
397
414
|
data?: TData;
|
|
415
|
+
publishAt?: string | null;
|
|
398
416
|
};
|
|
399
417
|
}) => void;
|
|
400
418
|
mutateAsync: (vars: {
|
|
@@ -402,6 +420,7 @@ declare function useUpdateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
402
420
|
data: {
|
|
403
421
|
slug?: string;
|
|
404
422
|
data?: TData;
|
|
423
|
+
publishAt?: string | null;
|
|
405
424
|
};
|
|
406
425
|
}) => Promise<SerializedContentItemWithType<TData>>;
|
|
407
426
|
data: undefined;
|
|
@@ -412,6 +431,7 @@ declare function useUpdateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
412
431
|
data: {
|
|
413
432
|
slug?: string;
|
|
414
433
|
data?: Record<string, unknown>;
|
|
434
|
+
publishAt?: string | null;
|
|
415
435
|
};
|
|
416
436
|
};
|
|
417
437
|
isError: true;
|
|
@@ -431,6 +451,7 @@ declare function useUpdateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
431
451
|
data: {
|
|
432
452
|
slug?: string;
|
|
433
453
|
data?: TData;
|
|
454
|
+
publishAt?: string | null;
|
|
434
455
|
};
|
|
435
456
|
}) => void;
|
|
436
457
|
mutateAsync: (vars: {
|
|
@@ -438,6 +459,7 @@ declare function useUpdateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
438
459
|
data: {
|
|
439
460
|
slug?: string;
|
|
440
461
|
data?: TData;
|
|
462
|
+
publishAt?: string | null;
|
|
441
463
|
};
|
|
442
464
|
}) => Promise<SerializedContentItemWithType<TData>>;
|
|
443
465
|
data: SerializedContentItemWithType<Record<string, unknown>> | null;
|
|
@@ -448,6 +470,7 @@ declare function useUpdateContent<TData = Record<string, unknown>>(typeSlug: str
|
|
|
448
470
|
data: {
|
|
449
471
|
slug?: string;
|
|
450
472
|
data?: Record<string, unknown>;
|
|
473
|
+
publishAt?: string | null;
|
|
451
474
|
};
|
|
452
475
|
};
|
|
453
476
|
isError: false;
|
|
@@ -688,6 +711,287 @@ declare function useInverseRelationItems<TView extends CMSReadView = undefined,
|
|
|
688
711
|
error: Error | null;
|
|
689
712
|
refetch: () => void;
|
|
690
713
|
};
|
|
714
|
+
/** Paginated revision snapshots, newest first. Fetches only when enabled. */
|
|
715
|
+
declare function useContentRevisions(typeSlug: string, id: string, enabled?: boolean): {
|
|
716
|
+
revisions: SerializedContentRevision[];
|
|
717
|
+
data: _tanstack_react_query.InfiniteData<{
|
|
718
|
+
items: SerializedContentRevision[];
|
|
719
|
+
total: number;
|
|
720
|
+
}, number>;
|
|
721
|
+
error: Error;
|
|
722
|
+
isError: true;
|
|
723
|
+
isPending: false;
|
|
724
|
+
isLoading: false;
|
|
725
|
+
isLoadingError: false;
|
|
726
|
+
isRefetchError: true;
|
|
727
|
+
isSuccess: false;
|
|
728
|
+
isPlaceholderData: false;
|
|
729
|
+
status: "error";
|
|
730
|
+
fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
731
|
+
items: SerializedContentRevision[];
|
|
732
|
+
total: number;
|
|
733
|
+
}, number>, Error>>;
|
|
734
|
+
fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
735
|
+
items: SerializedContentRevision[];
|
|
736
|
+
total: number;
|
|
737
|
+
}, number>, Error>>;
|
|
738
|
+
hasNextPage: boolean;
|
|
739
|
+
hasPreviousPage: boolean;
|
|
740
|
+
isFetchNextPageError: boolean;
|
|
741
|
+
isFetchingNextPage: boolean;
|
|
742
|
+
isFetchPreviousPageError: boolean;
|
|
743
|
+
isFetchingPreviousPage: boolean;
|
|
744
|
+
dataUpdatedAt: number;
|
|
745
|
+
errorUpdatedAt: number;
|
|
746
|
+
failureCount: number;
|
|
747
|
+
failureReason: Error | null;
|
|
748
|
+
errorUpdateCount: number;
|
|
749
|
+
isFetched: boolean;
|
|
750
|
+
isFetchedAfterMount: boolean;
|
|
751
|
+
isFetching: boolean;
|
|
752
|
+
isInitialLoading: boolean;
|
|
753
|
+
isPaused: boolean;
|
|
754
|
+
isRefetching: boolean;
|
|
755
|
+
isStale: boolean;
|
|
756
|
+
isEnabled: boolean;
|
|
757
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
758
|
+
items: SerializedContentRevision[];
|
|
759
|
+
total: number;
|
|
760
|
+
}, number>, Error>>;
|
|
761
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
762
|
+
} | {
|
|
763
|
+
revisions: SerializedContentRevision[];
|
|
764
|
+
data: _tanstack_react_query.InfiniteData<{
|
|
765
|
+
items: SerializedContentRevision[];
|
|
766
|
+
total: number;
|
|
767
|
+
}, number>;
|
|
768
|
+
error: null;
|
|
769
|
+
isError: false;
|
|
770
|
+
isPending: false;
|
|
771
|
+
isLoading: false;
|
|
772
|
+
isLoadingError: false;
|
|
773
|
+
isRefetchError: false;
|
|
774
|
+
isFetchNextPageError: false;
|
|
775
|
+
isFetchPreviousPageError: false;
|
|
776
|
+
isSuccess: true;
|
|
777
|
+
isPlaceholderData: false;
|
|
778
|
+
status: "success";
|
|
779
|
+
fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
780
|
+
items: SerializedContentRevision[];
|
|
781
|
+
total: number;
|
|
782
|
+
}, number>, Error>>;
|
|
783
|
+
fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
784
|
+
items: SerializedContentRevision[];
|
|
785
|
+
total: number;
|
|
786
|
+
}, number>, Error>>;
|
|
787
|
+
hasNextPage: boolean;
|
|
788
|
+
hasPreviousPage: boolean;
|
|
789
|
+
isFetchingNextPage: boolean;
|
|
790
|
+
isFetchingPreviousPage: boolean;
|
|
791
|
+
dataUpdatedAt: number;
|
|
792
|
+
errorUpdatedAt: number;
|
|
793
|
+
failureCount: number;
|
|
794
|
+
failureReason: Error | null;
|
|
795
|
+
errorUpdateCount: number;
|
|
796
|
+
isFetched: boolean;
|
|
797
|
+
isFetchedAfterMount: boolean;
|
|
798
|
+
isFetching: boolean;
|
|
799
|
+
isInitialLoading: boolean;
|
|
800
|
+
isPaused: boolean;
|
|
801
|
+
isRefetching: boolean;
|
|
802
|
+
isStale: boolean;
|
|
803
|
+
isEnabled: boolean;
|
|
804
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
805
|
+
items: SerializedContentRevision[];
|
|
806
|
+
total: number;
|
|
807
|
+
}, number>, Error>>;
|
|
808
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
809
|
+
} | {
|
|
810
|
+
revisions: SerializedContentRevision[];
|
|
811
|
+
data: undefined;
|
|
812
|
+
error: Error;
|
|
813
|
+
isError: true;
|
|
814
|
+
isPending: false;
|
|
815
|
+
isLoading: false;
|
|
816
|
+
isLoadingError: true;
|
|
817
|
+
isRefetchError: false;
|
|
818
|
+
isFetchNextPageError: false;
|
|
819
|
+
isFetchPreviousPageError: false;
|
|
820
|
+
isSuccess: false;
|
|
821
|
+
isPlaceholderData: false;
|
|
822
|
+
status: "error";
|
|
823
|
+
fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
824
|
+
items: SerializedContentRevision[];
|
|
825
|
+
total: number;
|
|
826
|
+
}, number>, Error>>;
|
|
827
|
+
fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
828
|
+
items: SerializedContentRevision[];
|
|
829
|
+
total: number;
|
|
830
|
+
}, number>, Error>>;
|
|
831
|
+
hasNextPage: boolean;
|
|
832
|
+
hasPreviousPage: boolean;
|
|
833
|
+
isFetchingNextPage: boolean;
|
|
834
|
+
isFetchingPreviousPage: boolean;
|
|
835
|
+
dataUpdatedAt: number;
|
|
836
|
+
errorUpdatedAt: number;
|
|
837
|
+
failureCount: number;
|
|
838
|
+
failureReason: Error | null;
|
|
839
|
+
errorUpdateCount: number;
|
|
840
|
+
isFetched: boolean;
|
|
841
|
+
isFetchedAfterMount: boolean;
|
|
842
|
+
isFetching: boolean;
|
|
843
|
+
isInitialLoading: boolean;
|
|
844
|
+
isPaused: boolean;
|
|
845
|
+
isRefetching: boolean;
|
|
846
|
+
isStale: boolean;
|
|
847
|
+
isEnabled: boolean;
|
|
848
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
849
|
+
items: SerializedContentRevision[];
|
|
850
|
+
total: number;
|
|
851
|
+
}, number>, Error>>;
|
|
852
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
853
|
+
} | {
|
|
854
|
+
revisions: SerializedContentRevision[];
|
|
855
|
+
data: undefined;
|
|
856
|
+
error: null;
|
|
857
|
+
isError: false;
|
|
858
|
+
isPending: true;
|
|
859
|
+
isLoading: true;
|
|
860
|
+
isLoadingError: false;
|
|
861
|
+
isRefetchError: false;
|
|
862
|
+
isFetchNextPageError: false;
|
|
863
|
+
isFetchPreviousPageError: false;
|
|
864
|
+
isSuccess: false;
|
|
865
|
+
isPlaceholderData: false;
|
|
866
|
+
status: "pending";
|
|
867
|
+
fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
868
|
+
items: SerializedContentRevision[];
|
|
869
|
+
total: number;
|
|
870
|
+
}, number>, Error>>;
|
|
871
|
+
fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
872
|
+
items: SerializedContentRevision[];
|
|
873
|
+
total: number;
|
|
874
|
+
}, number>, Error>>;
|
|
875
|
+
hasNextPage: boolean;
|
|
876
|
+
hasPreviousPage: boolean;
|
|
877
|
+
isFetchingNextPage: boolean;
|
|
878
|
+
isFetchingPreviousPage: boolean;
|
|
879
|
+
dataUpdatedAt: number;
|
|
880
|
+
errorUpdatedAt: number;
|
|
881
|
+
failureCount: number;
|
|
882
|
+
failureReason: Error | null;
|
|
883
|
+
errorUpdateCount: number;
|
|
884
|
+
isFetched: boolean;
|
|
885
|
+
isFetchedAfterMount: boolean;
|
|
886
|
+
isFetching: boolean;
|
|
887
|
+
isInitialLoading: boolean;
|
|
888
|
+
isPaused: boolean;
|
|
889
|
+
isRefetching: boolean;
|
|
890
|
+
isStale: boolean;
|
|
891
|
+
isEnabled: boolean;
|
|
892
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
893
|
+
items: SerializedContentRevision[];
|
|
894
|
+
total: number;
|
|
895
|
+
}, number>, Error>>;
|
|
896
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
897
|
+
} | {
|
|
898
|
+
revisions: SerializedContentRevision[];
|
|
899
|
+
data: undefined;
|
|
900
|
+
error: null;
|
|
901
|
+
isError: false;
|
|
902
|
+
isPending: true;
|
|
903
|
+
isLoadingError: false;
|
|
904
|
+
isRefetchError: false;
|
|
905
|
+
isFetchNextPageError: false;
|
|
906
|
+
isFetchPreviousPageError: false;
|
|
907
|
+
isSuccess: false;
|
|
908
|
+
isPlaceholderData: false;
|
|
909
|
+
status: "pending";
|
|
910
|
+
fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
911
|
+
items: SerializedContentRevision[];
|
|
912
|
+
total: number;
|
|
913
|
+
}, number>, Error>>;
|
|
914
|
+
fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
915
|
+
items: SerializedContentRevision[];
|
|
916
|
+
total: number;
|
|
917
|
+
}, number>, Error>>;
|
|
918
|
+
hasNextPage: boolean;
|
|
919
|
+
hasPreviousPage: boolean;
|
|
920
|
+
isFetchingNextPage: boolean;
|
|
921
|
+
isFetchingPreviousPage: boolean;
|
|
922
|
+
dataUpdatedAt: number;
|
|
923
|
+
errorUpdatedAt: number;
|
|
924
|
+
failureCount: number;
|
|
925
|
+
failureReason: Error | null;
|
|
926
|
+
errorUpdateCount: number;
|
|
927
|
+
isFetched: boolean;
|
|
928
|
+
isFetchedAfterMount: boolean;
|
|
929
|
+
isFetching: boolean;
|
|
930
|
+
isLoading: boolean;
|
|
931
|
+
isInitialLoading: boolean;
|
|
932
|
+
isPaused: boolean;
|
|
933
|
+
isRefetching: boolean;
|
|
934
|
+
isStale: boolean;
|
|
935
|
+
isEnabled: boolean;
|
|
936
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
937
|
+
items: SerializedContentRevision[];
|
|
938
|
+
total: number;
|
|
939
|
+
}, number>, Error>>;
|
|
940
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
941
|
+
} | {
|
|
942
|
+
revisions: SerializedContentRevision[];
|
|
943
|
+
data: _tanstack_react_query.InfiniteData<{
|
|
944
|
+
items: SerializedContentRevision[];
|
|
945
|
+
total: number;
|
|
946
|
+
}, number>;
|
|
947
|
+
isError: false;
|
|
948
|
+
error: null;
|
|
949
|
+
isPending: false;
|
|
950
|
+
isLoading: false;
|
|
951
|
+
isLoadingError: false;
|
|
952
|
+
isRefetchError: false;
|
|
953
|
+
isSuccess: true;
|
|
954
|
+
isPlaceholderData: true;
|
|
955
|
+
isFetchNextPageError: false;
|
|
956
|
+
isFetchPreviousPageError: false;
|
|
957
|
+
status: "success";
|
|
958
|
+
fetchNextPage: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
959
|
+
items: SerializedContentRevision[];
|
|
960
|
+
total: number;
|
|
961
|
+
}, number>, Error>>;
|
|
962
|
+
fetchPreviousPage: (options?: _tanstack_react_query.FetchPreviousPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
963
|
+
items: SerializedContentRevision[];
|
|
964
|
+
total: number;
|
|
965
|
+
}, number>, Error>>;
|
|
966
|
+
hasNextPage: boolean;
|
|
967
|
+
hasPreviousPage: boolean;
|
|
968
|
+
isFetchingNextPage: boolean;
|
|
969
|
+
isFetchingPreviousPage: boolean;
|
|
970
|
+
dataUpdatedAt: number;
|
|
971
|
+
errorUpdatedAt: number;
|
|
972
|
+
failureCount: number;
|
|
973
|
+
failureReason: Error | null;
|
|
974
|
+
errorUpdateCount: number;
|
|
975
|
+
isFetched: boolean;
|
|
976
|
+
isFetchedAfterMount: boolean;
|
|
977
|
+
isFetching: boolean;
|
|
978
|
+
isInitialLoading: boolean;
|
|
979
|
+
isPaused: boolean;
|
|
980
|
+
isRefetching: boolean;
|
|
981
|
+
isStale: boolean;
|
|
982
|
+
isEnabled: boolean;
|
|
983
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.InfiniteData<{
|
|
984
|
+
items: SerializedContentRevision[];
|
|
985
|
+
total: number;
|
|
986
|
+
}, number>, Error>>;
|
|
987
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
988
|
+
};
|
|
989
|
+
/** Restore a saved revision and refresh the editor, history and relation queries. */
|
|
990
|
+
declare function useRestoreContentRevision(): _tanstack_react_query.UseMutationResult<SerializedContentItemWithType<Record<string, unknown>>, Error, {
|
|
991
|
+
typeSlug: string;
|
|
992
|
+
id: string;
|
|
993
|
+
revisionId: string;
|
|
994
|
+
}>;
|
|
691
995
|
|
|
692
|
-
export { useContent, useContentByRelation, useContentItem, useContentItemBySlug, useContentItemForm, useContentItemPopulated, useContentOptions, useContentType, useContentTypes, useCreateContent, useDeleteContent, useInverseRelationItems, useInverseRelations, useSuspenseContent, useSuspenseContentByRelation, useSuspenseContentItem, useSuspenseContentItemPopulated, useSuspenseContentTypes, useUpdateContent };
|
|
996
|
+
export { useContent, useContentByRelation, useContentItem, useContentItemBySlug, useContentItemForm, useContentItemPopulated, useContentOptions, useContentRevisions, useContentType, useContentTypes, useCreateContent, useDeleteContent, useInverseRelationItems, useInverseRelations, useRestoreContentRevision, useSuspenseContent, useSuspenseContentByRelation, useSuspenseContentItem, useSuspenseContentItemPopulated, useSuspenseContentTypes, useUpdateContent };
|
|
693
997
|
export type { ContentItemWithRelations, UseContentByRelationOptions, UseContentOptions, UseContentResult, UseContentTypesResult };
|