@composable-os/pack-content 0.0.0-stage → 0.1.0-beta.10
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/LICENSE +109 -0
- package/dist/blocks/content-native-post/post-screen.d.ts +11 -0
- package/dist/blocks/content-native-post/post-screen.js +26 -0
- package/dist/blocks/content-native-rich-text/rich-text-view.d.ts +24 -0
- package/dist/blocks/content-native-rich-text/rich-text-view.js +122 -0
- package/dist/blocks/content-post/post-page.d.ts +35 -0
- package/dist/blocks/content-post/post-page.js +41 -0
- package/dist/blocks/content-post-list/post-list.d.ts +15 -0
- package/dist/blocks/content-post-list/post-list.js +25 -0
- package/dist/blocks/content-rich-text/rich-text.d.ts +28 -0
- package/dist/blocks/content-rich-text/rich-text.js +85 -0
- package/dist/client/index.d.ts +514 -0
- package/dist/client/index.js +198 -0
- package/dist/index.d.ts +167 -0
- package/dist/index.js +149 -0
- package/dist/tools.d.ts +11 -0
- package/dist/tools.js +30 -0
- package/package.json +36 -4
- package/README.md +0 -3
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
import { type ClientHolding, type PackClient } from "@composable-os/client";
|
|
2
|
+
import type { z } from "@composable-os/sdk";
|
|
3
|
+
import type { categories } from "../tools.ts";
|
|
4
|
+
type Io<T extends {
|
|
5
|
+
input: z.ZodType;
|
|
6
|
+
output: z.ZodType;
|
|
7
|
+
}> = {
|
|
8
|
+
input: z.input<T["input"]>;
|
|
9
|
+
output: z.output<T["output"]>;
|
|
10
|
+
};
|
|
11
|
+
/** The post object, as the host names it. */
|
|
12
|
+
export declare const POST = "content.post";
|
|
13
|
+
export interface TextRun {
|
|
14
|
+
type: "text";
|
|
15
|
+
text: string;
|
|
16
|
+
bold?: boolean;
|
|
17
|
+
italic?: boolean;
|
|
18
|
+
code?: boolean;
|
|
19
|
+
href?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface LineBreak {
|
|
22
|
+
type: "break";
|
|
23
|
+
}
|
|
24
|
+
export type Inline = TextRun | LineBreak;
|
|
25
|
+
export interface ListItem {
|
|
26
|
+
content: Inline[];
|
|
27
|
+
list?: ListBody;
|
|
28
|
+
}
|
|
29
|
+
export interface ListBody {
|
|
30
|
+
style: "bullet" | "ordered";
|
|
31
|
+
items: ListItem[];
|
|
32
|
+
}
|
|
33
|
+
export type Block = {
|
|
34
|
+
type: "paragraph";
|
|
35
|
+
content: Inline[];
|
|
36
|
+
} | {
|
|
37
|
+
type: "heading";
|
|
38
|
+
level: number;
|
|
39
|
+
content: Inline[];
|
|
40
|
+
} | ({
|
|
41
|
+
type: "list";
|
|
42
|
+
} & ListBody) | {
|
|
43
|
+
type: "quote";
|
|
44
|
+
content: Inline[];
|
|
45
|
+
attribution?: string;
|
|
46
|
+
} | {
|
|
47
|
+
type: "image";
|
|
48
|
+
media: string;
|
|
49
|
+
alt: string;
|
|
50
|
+
caption?: Inline[];
|
|
51
|
+
} | {
|
|
52
|
+
type: "divider";
|
|
53
|
+
} | {
|
|
54
|
+
type: "embed";
|
|
55
|
+
url: string;
|
|
56
|
+
caption?: string;
|
|
57
|
+
} | {
|
|
58
|
+
type: "callout";
|
|
59
|
+
tone: "info" | "note" | "success" | "warning";
|
|
60
|
+
content: Inline[];
|
|
61
|
+
} | {
|
|
62
|
+
type: "button";
|
|
63
|
+
label: string;
|
|
64
|
+
href: string;
|
|
65
|
+
};
|
|
66
|
+
export interface RichText {
|
|
67
|
+
blocks: Block[];
|
|
68
|
+
}
|
|
69
|
+
/** A picture field's value (ADR 0444). */
|
|
70
|
+
export interface Picture {
|
|
71
|
+
media: string;
|
|
72
|
+
alt: string;
|
|
73
|
+
focal?: {
|
|
74
|
+
x: number;
|
|
75
|
+
y: number;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** A published post as the public reads it: only the fields the post declares public. */
|
|
79
|
+
export interface PublicPost {
|
|
80
|
+
object: string;
|
|
81
|
+
id: string;
|
|
82
|
+
values: {
|
|
83
|
+
title?: string | null;
|
|
84
|
+
slug?: string | null;
|
|
85
|
+
excerpt?: string | null;
|
|
86
|
+
body?: RichText | null;
|
|
87
|
+
cover?: Picture | null;
|
|
88
|
+
/** Who wrote it, as readers see it; the author's staff account is never public. */
|
|
89
|
+
byline?: string | null;
|
|
90
|
+
/** What search engines and link previews show (ADR 0470); each optional. */
|
|
91
|
+
seoTitle?: string | null;
|
|
92
|
+
seoDescription?: string | null;
|
|
93
|
+
seoImage?: Picture | null;
|
|
94
|
+
noindex?: boolean | null;
|
|
95
|
+
category?: string | null;
|
|
96
|
+
date?: string | null;
|
|
97
|
+
publishedAt?: string | null;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export type PostAnswer = (PublicPost & {
|
|
101
|
+
kind: "record";
|
|
102
|
+
}) | {
|
|
103
|
+
kind: "redirect";
|
|
104
|
+
object: string;
|
|
105
|
+
slug: string;
|
|
106
|
+
};
|
|
107
|
+
/** The operations this entry calls, as the generated client types them. */
|
|
108
|
+
export type ContentOperations = {
|
|
109
|
+
"content.get": {
|
|
110
|
+
kind: "query";
|
|
111
|
+
input: {
|
|
112
|
+
object: string;
|
|
113
|
+
slug: string;
|
|
114
|
+
};
|
|
115
|
+
output: PostAnswer;
|
|
116
|
+
};
|
|
117
|
+
"content.list": {
|
|
118
|
+
kind: "query";
|
|
119
|
+
input: {
|
|
120
|
+
object: string;
|
|
121
|
+
filter?: unknown;
|
|
122
|
+
sort?: {
|
|
123
|
+
field: string;
|
|
124
|
+
direction: "asc" | "desc";
|
|
125
|
+
};
|
|
126
|
+
cursor?: string;
|
|
127
|
+
limit?: number;
|
|
128
|
+
};
|
|
129
|
+
output: {
|
|
130
|
+
items: PublicPost[];
|
|
131
|
+
nextCursor: string | null;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
"content.preview": {
|
|
135
|
+
kind: "query";
|
|
136
|
+
input: {
|
|
137
|
+
object: string;
|
|
138
|
+
slug: string;
|
|
139
|
+
token: string;
|
|
140
|
+
};
|
|
141
|
+
output: PublicPost & {
|
|
142
|
+
kind: "preview";
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
"x.content.categories": {
|
|
146
|
+
kind: "query";
|
|
147
|
+
} & Io<typeof categories>;
|
|
148
|
+
"record.publish": {
|
|
149
|
+
kind: "mutation";
|
|
150
|
+
input: {
|
|
151
|
+
object: string;
|
|
152
|
+
id: string;
|
|
153
|
+
note?: string;
|
|
154
|
+
};
|
|
155
|
+
output: {
|
|
156
|
+
version: number;
|
|
157
|
+
publishedAt: string;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
"record.schedulePublish": {
|
|
161
|
+
kind: "mutation";
|
|
162
|
+
input: {
|
|
163
|
+
object: string;
|
|
164
|
+
id: string;
|
|
165
|
+
at: string;
|
|
166
|
+
note?: string;
|
|
167
|
+
};
|
|
168
|
+
output: {
|
|
169
|
+
publishAt: string;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
"record.unpublish": {
|
|
173
|
+
kind: "mutation";
|
|
174
|
+
input: {
|
|
175
|
+
object: string;
|
|
176
|
+
id: string;
|
|
177
|
+
};
|
|
178
|
+
output: {
|
|
179
|
+
unpublished: number;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
type Name = keyof ContentOperations & string;
|
|
184
|
+
type In<N extends Name> = ContentOperations[N]["input"];
|
|
185
|
+
/** The client of every operation this entry calls (ADR 0453). */
|
|
186
|
+
export type ContentClient = PackClient<ContentOperations>;
|
|
187
|
+
/**
|
|
188
|
+
* Where a picture is, at the width asked for: `/api/media/<id>?w=640` on a site's own hostname,
|
|
189
|
+
* which the client template's media route forwards to the host (issue #181). `base` puts another
|
|
190
|
+
* origin or prefix in front (`https://cdn.example.com`).
|
|
191
|
+
*/
|
|
192
|
+
export declare function mediaPath(id: string, width?: number, base?: string): string;
|
|
193
|
+
/**
|
|
194
|
+
* Where a phone asks the host itself for a picture: its public media route beside the HTTP
|
|
195
|
+
* surface, `https://<host>/api/v1/media/<id>?w=<width>` (bypassed by Cloudflare Access with the
|
|
196
|
+
* rest of /api/v1). For the native blocks' `mediaUrl`: `hostMediaUrl(hostUrl)`.
|
|
197
|
+
*/
|
|
198
|
+
export declare function hostMediaUrl(hostUrl: string): (id: string, width: number) => string;
|
|
199
|
+
/** The text of inline runs, without marks: for excerpts, alt text and screen readers. */
|
|
200
|
+
export declare function inlineText(content: readonly Inline[] | undefined): string;
|
|
201
|
+
/** A document's words, block by block, for a summary or a search box. */
|
|
202
|
+
export declare function plainText(value: RichText | null | undefined): string;
|
|
203
|
+
/** What an embed's address is: a YouTube or Vimeo video the renderer can show, or a link. */
|
|
204
|
+
export declare function embedKind(url: string): {
|
|
205
|
+
kind: "youtube";
|
|
206
|
+
id: string;
|
|
207
|
+
} | {
|
|
208
|
+
kind: "vimeo";
|
|
209
|
+
id: string;
|
|
210
|
+
} | {
|
|
211
|
+
kind: "link";
|
|
212
|
+
};
|
|
213
|
+
/** The player address for a video embed, from the id `embedKind` found (never the raw URL). */
|
|
214
|
+
export declare function embedPlayer(kind: {
|
|
215
|
+
kind: "youtube" | "vimeo";
|
|
216
|
+
id: string;
|
|
217
|
+
}): string;
|
|
218
|
+
/** A post's date as a reader sees it (`21 Nov 2026`), in their own locale. Display only. */
|
|
219
|
+
export declare function postDate(post: PublicPost, locale?: string): string;
|
|
220
|
+
/** What a post's page puts in its <head>: for search engines and link previews. */
|
|
221
|
+
export interface PostHead {
|
|
222
|
+
title: string;
|
|
223
|
+
description: string | null;
|
|
224
|
+
/** The share picture, absolute when `origin` was given. */
|
|
225
|
+
image: {
|
|
226
|
+
url: string;
|
|
227
|
+
alt: string;
|
|
228
|
+
} | null;
|
|
229
|
+
/** `noindex`: the post asks search engines not to list it. */
|
|
230
|
+
robots: "noindex" | null;
|
|
231
|
+
/** The page's own address, when `url` was given. */
|
|
232
|
+
canonical: string | null;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* The head of a post's page, from its published values (ADR 0470): its search title (else its
|
|
236
|
+
* title, with ` · <siteName>`), its search description (else its excerpt, else the start of its
|
|
237
|
+
* body), its share picture (else its cover), and whether to ask search engines not to list it.
|
|
238
|
+
* Plain data, so any page can render it: React 19's hoisted <title>/<meta> (the `PostHead` block),
|
|
239
|
+
* TanStack Start's route `head()`, or an Astro page's <head>.
|
|
240
|
+
*/
|
|
241
|
+
export declare function postHead(post: PublicPost, options?: {
|
|
242
|
+
siteName?: string;
|
|
243
|
+
/** The page's absolute address, for the canonical link and og:url. */
|
|
244
|
+
url?: string;
|
|
245
|
+
/** Where the site's media route is, for an absolute share picture (`https://example.com`). */
|
|
246
|
+
origin?: string;
|
|
247
|
+
mediaUrl?: (id: string, width: number) => string;
|
|
248
|
+
}): PostHead;
|
|
249
|
+
/** The app's `useQuery`, as far as these hooks use it. */
|
|
250
|
+
export type UseQuery = <T>(options: {
|
|
251
|
+
queryKey: readonly unknown[];
|
|
252
|
+
queryFn: () => Promise<T>;
|
|
253
|
+
enabled?: boolean;
|
|
254
|
+
}) => {
|
|
255
|
+
data: T | undefined;
|
|
256
|
+
isPending: boolean;
|
|
257
|
+
error: unknown;
|
|
258
|
+
};
|
|
259
|
+
/** The app's `useMutation`, as far as these hooks use it. */
|
|
260
|
+
export type UseMutation = <I, O>(options: {
|
|
261
|
+
mutationKey: readonly unknown[];
|
|
262
|
+
mutationFn: (input: I) => Promise<O>;
|
|
263
|
+
}) => {
|
|
264
|
+
mutate(input: I): void;
|
|
265
|
+
mutateAsync(input: I): Promise<O>;
|
|
266
|
+
data: O | undefined;
|
|
267
|
+
isPending: boolean;
|
|
268
|
+
error: unknown;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* The operations each hook calls (ADR 0453). A customer's client and the public's get the
|
|
272
|
+
* reading hooks; the staff client gets the publish controls too.
|
|
273
|
+
*
|
|
274
|
+
* The publish controls are a person's: `usePublish` calls `record.publish`, which publishes at
|
|
275
|
+
* once for a person with the permission. An AI actor's call of the same operation waits for a
|
|
276
|
+
* person to approve it, whatever the policy (criterion 12, ADR 0480); that is the host's, so
|
|
277
|
+
* no hook and no block changes for it.
|
|
278
|
+
*/
|
|
279
|
+
export declare const CONTENT_HOOKS_CALL: {
|
|
280
|
+
readonly usePosts: readonly ["content.list"];
|
|
281
|
+
readonly usePost: readonly ["content.get"];
|
|
282
|
+
readonly usePreview: readonly ["content.preview"];
|
|
283
|
+
readonly useCategories: readonly ["x.content.categories"];
|
|
284
|
+
readonly usePublish: readonly ["record.publish"];
|
|
285
|
+
readonly useSchedulePublish: readonly ["record.schedulePublish"];
|
|
286
|
+
readonly useUnpublish: readonly ["record.unpublish"];
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* Hooks for a React or React Native app:
|
|
290
|
+
* `const content = createContentHooks({ useQuery, useMutation }, api)`. `api` is any generated
|
|
291
|
+
* client: the customer's, the public's (the same customer client, signed out) or the staff one.
|
|
292
|
+
* The hooks it cannot back are not there, and calling one does not compile.
|
|
293
|
+
*/
|
|
294
|
+
export declare function createContentHooks<C extends ClientHolding>(react: {
|
|
295
|
+
useQuery: UseQuery;
|
|
296
|
+
useMutation: UseMutation;
|
|
297
|
+
}, client: C): import("@composable-os/client").HooksFor<{
|
|
298
|
+
/** A page of published posts, newest first (or as asked). */
|
|
299
|
+
usePosts(input?: Omit<In<"content.list">, "object">, object?: string): {
|
|
300
|
+
data: {
|
|
301
|
+
items: PublicPost[];
|
|
302
|
+
nextCursor: string | null;
|
|
303
|
+
} | undefined;
|
|
304
|
+
isPending: boolean;
|
|
305
|
+
error: unknown;
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* One published post by its address. An old address answers `redirect`: send the reader to
|
|
309
|
+
* the post's address now (a 301 on the web).
|
|
310
|
+
*/
|
|
311
|
+
usePost(slug: string | null, object?: string): {
|
|
312
|
+
data: PostAnswer | undefined;
|
|
313
|
+
isPending: boolean;
|
|
314
|
+
error: unknown;
|
|
315
|
+
};
|
|
316
|
+
/** A post's working copy, with a preview link's token. */
|
|
317
|
+
usePreview(slug: string | null, token: string | null, object?: string): {
|
|
318
|
+
data: (PublicPost & {
|
|
319
|
+
kind: "preview";
|
|
320
|
+
}) | undefined;
|
|
321
|
+
isPending: boolean;
|
|
322
|
+
error: unknown;
|
|
323
|
+
};
|
|
324
|
+
/** The categories, by name. */
|
|
325
|
+
useCategories(): {
|
|
326
|
+
data: {
|
|
327
|
+
categories: {
|
|
328
|
+
id: string;
|
|
329
|
+
name: string | null;
|
|
330
|
+
slug: string | null;
|
|
331
|
+
}[];
|
|
332
|
+
} | undefined;
|
|
333
|
+
isPending: boolean;
|
|
334
|
+
error: unknown;
|
|
335
|
+
};
|
|
336
|
+
/** Staff: publish a post now (a person with the publish permission). */
|
|
337
|
+
usePublish(): {
|
|
338
|
+
mutate(input: {
|
|
339
|
+
object: string;
|
|
340
|
+
id: string;
|
|
341
|
+
note?: string;
|
|
342
|
+
}): void;
|
|
343
|
+
mutateAsync(input: {
|
|
344
|
+
object: string;
|
|
345
|
+
id: string;
|
|
346
|
+
note?: string;
|
|
347
|
+
}): Promise<{
|
|
348
|
+
version: number;
|
|
349
|
+
publishedAt: string;
|
|
350
|
+
}>;
|
|
351
|
+
data: {
|
|
352
|
+
version: number;
|
|
353
|
+
publishedAt: string;
|
|
354
|
+
} | undefined;
|
|
355
|
+
isPending: boolean;
|
|
356
|
+
error: unknown;
|
|
357
|
+
};
|
|
358
|
+
/** Staff: publish a post at a time; what is published is the post as it is now. */
|
|
359
|
+
useSchedulePublish(): {
|
|
360
|
+
mutate(input: {
|
|
361
|
+
object: string;
|
|
362
|
+
id: string;
|
|
363
|
+
at: string;
|
|
364
|
+
note?: string;
|
|
365
|
+
}): void;
|
|
366
|
+
mutateAsync(input: {
|
|
367
|
+
object: string;
|
|
368
|
+
id: string;
|
|
369
|
+
at: string;
|
|
370
|
+
note?: string;
|
|
371
|
+
}): Promise<{
|
|
372
|
+
publishAt: string;
|
|
373
|
+
}>;
|
|
374
|
+
data: {
|
|
375
|
+
publishAt: string;
|
|
376
|
+
} | undefined;
|
|
377
|
+
isPending: boolean;
|
|
378
|
+
error: unknown;
|
|
379
|
+
};
|
|
380
|
+
/** Staff: take a post down; its versions are kept. */
|
|
381
|
+
useUnpublish(): {
|
|
382
|
+
mutate(input: {
|
|
383
|
+
object: string;
|
|
384
|
+
id: string;
|
|
385
|
+
}): void;
|
|
386
|
+
mutateAsync(input: {
|
|
387
|
+
object: string;
|
|
388
|
+
id: string;
|
|
389
|
+
}): Promise<{
|
|
390
|
+
unpublished: number;
|
|
391
|
+
}>;
|
|
392
|
+
data: {
|
|
393
|
+
unpublished: number;
|
|
394
|
+
} | undefined;
|
|
395
|
+
isPending: boolean;
|
|
396
|
+
error: unknown;
|
|
397
|
+
};
|
|
398
|
+
}, {
|
|
399
|
+
readonly usePosts: readonly ["content.list"];
|
|
400
|
+
readonly usePost: readonly ["content.get"];
|
|
401
|
+
readonly usePreview: readonly ["content.preview"];
|
|
402
|
+
readonly useCategories: readonly ["x.content.categories"];
|
|
403
|
+
readonly usePublish: readonly ["record.publish"];
|
|
404
|
+
readonly useSchedulePublish: readonly ["record.schedulePublish"];
|
|
405
|
+
readonly useUnpublish: readonly ["record.unpublish"];
|
|
406
|
+
}, import("@composable-os/client").OperationsOf<C>>;
|
|
407
|
+
declare function allContentHooks(react: {
|
|
408
|
+
useQuery: UseQuery;
|
|
409
|
+
useMutation: UseMutation;
|
|
410
|
+
}, api: ContentClient): {
|
|
411
|
+
/** A page of published posts, newest first (or as asked). */
|
|
412
|
+
usePosts(input?: Omit<In<"content.list">, "object">, object?: string): {
|
|
413
|
+
data: {
|
|
414
|
+
items: PublicPost[];
|
|
415
|
+
nextCursor: string | null;
|
|
416
|
+
} | undefined;
|
|
417
|
+
isPending: boolean;
|
|
418
|
+
error: unknown;
|
|
419
|
+
};
|
|
420
|
+
/**
|
|
421
|
+
* One published post by its address. An old address answers `redirect`: send the reader to
|
|
422
|
+
* the post's address now (a 301 on the web).
|
|
423
|
+
*/
|
|
424
|
+
usePost(slug: string | null, object?: string): {
|
|
425
|
+
data: PostAnswer | undefined;
|
|
426
|
+
isPending: boolean;
|
|
427
|
+
error: unknown;
|
|
428
|
+
};
|
|
429
|
+
/** A post's working copy, with a preview link's token. */
|
|
430
|
+
usePreview(slug: string | null, token: string | null, object?: string): {
|
|
431
|
+
data: (PublicPost & {
|
|
432
|
+
kind: "preview";
|
|
433
|
+
}) | undefined;
|
|
434
|
+
isPending: boolean;
|
|
435
|
+
error: unknown;
|
|
436
|
+
};
|
|
437
|
+
/** The categories, by name. */
|
|
438
|
+
useCategories(): {
|
|
439
|
+
data: {
|
|
440
|
+
categories: {
|
|
441
|
+
id: string;
|
|
442
|
+
name: string | null;
|
|
443
|
+
slug: string | null;
|
|
444
|
+
}[];
|
|
445
|
+
} | undefined;
|
|
446
|
+
isPending: boolean;
|
|
447
|
+
error: unknown;
|
|
448
|
+
};
|
|
449
|
+
/** Staff: publish a post now (a person with the publish permission). */
|
|
450
|
+
usePublish(): {
|
|
451
|
+
mutate(input: {
|
|
452
|
+
object: string;
|
|
453
|
+
id: string;
|
|
454
|
+
note?: string;
|
|
455
|
+
}): void;
|
|
456
|
+
mutateAsync(input: {
|
|
457
|
+
object: string;
|
|
458
|
+
id: string;
|
|
459
|
+
note?: string;
|
|
460
|
+
}): Promise<{
|
|
461
|
+
version: number;
|
|
462
|
+
publishedAt: string;
|
|
463
|
+
}>;
|
|
464
|
+
data: {
|
|
465
|
+
version: number;
|
|
466
|
+
publishedAt: string;
|
|
467
|
+
} | undefined;
|
|
468
|
+
isPending: boolean;
|
|
469
|
+
error: unknown;
|
|
470
|
+
};
|
|
471
|
+
/** Staff: publish a post at a time; what is published is the post as it is now. */
|
|
472
|
+
useSchedulePublish(): {
|
|
473
|
+
mutate(input: {
|
|
474
|
+
object: string;
|
|
475
|
+
id: string;
|
|
476
|
+
at: string;
|
|
477
|
+
note?: string;
|
|
478
|
+
}): void;
|
|
479
|
+
mutateAsync(input: {
|
|
480
|
+
object: string;
|
|
481
|
+
id: string;
|
|
482
|
+
at: string;
|
|
483
|
+
note?: string;
|
|
484
|
+
}): Promise<{
|
|
485
|
+
publishAt: string;
|
|
486
|
+
}>;
|
|
487
|
+
data: {
|
|
488
|
+
publishAt: string;
|
|
489
|
+
} | undefined;
|
|
490
|
+
isPending: boolean;
|
|
491
|
+
error: unknown;
|
|
492
|
+
};
|
|
493
|
+
/** Staff: take a post down; its versions are kept. */
|
|
494
|
+
useUnpublish(): {
|
|
495
|
+
mutate(input: {
|
|
496
|
+
object: string;
|
|
497
|
+
id: string;
|
|
498
|
+
}): void;
|
|
499
|
+
mutateAsync(input: {
|
|
500
|
+
object: string;
|
|
501
|
+
id: string;
|
|
502
|
+
}): Promise<{
|
|
503
|
+
unpublished: number;
|
|
504
|
+
}>;
|
|
505
|
+
data: {
|
|
506
|
+
unpublished: number;
|
|
507
|
+
} | undefined;
|
|
508
|
+
isPending: boolean;
|
|
509
|
+
error: unknown;
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
/** Every hook of this entry. A block takes the ones it calls: `Pick<ContentHooks, "usePost">`. */
|
|
513
|
+
export type ContentHooks = ReturnType<typeof allContentHooks>;
|
|
514
|
+
export {};
|