@mainsoft/agent-cms 0.6.1 → 0.10.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/CHANGELOG.md +65 -0
- package/README.md +303 -32
- package/TODO.md +72 -26
- package/UPGRADE-0.10.md +36 -0
- package/UPGRADE-0.8.md +117 -0
- package/dist/agent.cjs +39 -17
- package/dist/agent.d.cts +2 -2
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +9 -7
- package/dist/bin.js +4528 -355
- package/dist/{chunk-OQ55GEF3.js → chunk-3OPKTBEI.js} +1 -1
- package/dist/chunk-6PB4ZCHH.js +328 -0
- package/dist/chunk-7SCYDG2G.js +2943 -0
- package/dist/chunk-7WJIIJCI.js +544 -0
- package/dist/chunk-7Y6TU2UA.js +150 -0
- package/dist/{chunk-BTO42652.js → chunk-AKCXMT3X.js} +19 -24
- package/dist/{chunk-QC2M4NZY.js → chunk-BFVBHIHV.js} +72 -1
- package/dist/chunk-DSJETZT4.js +493 -0
- package/dist/{chunk-IW3D4I7Q.js → chunk-IU2SMWAM.js} +246 -4
- package/dist/{chunk-VICZ76TR.js → chunk-KAO3Z3CF.js} +43 -2
- package/dist/{chunk-CRDW6Q72.js → chunk-MA6VKJ3F.js} +87 -25
- package/dist/{chunk-6K5ZTGHQ.js → chunk-PEQY4N73.js} +16 -0
- package/dist/{chunk-DOADAH4L.js → chunk-PGV2QPIL.js} +40 -0
- package/dist/{chunk-QIUXAUQ6.js → chunk-TOZQYJFG.js} +1 -1
- package/dist/cli.cjs +4528 -355
- package/dist/cli.d.cts +19 -3
- package/dist/cli.d.ts +19 -3
- package/dist/cli.js +206 -16
- package/dist/client.cjs +72 -1
- package/dist/client.d.cts +308 -6
- package/dist/client.d.ts +308 -6
- package/dist/client.js +1 -1
- package/dist/cms-C_vkAxYV.d.cts +1537 -0
- package/dist/cms-pqJyowu1.d.ts +1537 -0
- package/dist/config.d.cts +7 -1
- package/dist/config.d.ts +7 -1
- package/dist/drizzle-repo-CviH3EX7.d.cts +146 -0
- package/dist/drizzle-repo-DWLD0rWe.d.ts +146 -0
- package/dist/errors.cjs +82 -1
- package/dist/errors.d.cts +43 -3
- package/dist/errors.d.ts +43 -3
- package/dist/errors.js +2 -2
- package/dist/frontmatter.d.cts +5 -4
- package/dist/frontmatter.d.ts +5 -4
- package/dist/http.cjs +644 -97
- package/dist/http.d.cts +59 -2
- package/dist/http.d.ts +59 -2
- package/dist/http.js +204 -14
- package/dist/index.cjs +3759 -575
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +226 -30
- package/dist/markdown.cjs +89 -25
- package/dist/markdown.d.cts +57 -3
- package/dist/markdown.d.ts +57 -3
- package/dist/markdown.js +5 -1
- package/dist/mcp.cjs +319 -39
- package/dist/mcp.d.cts +15 -4
- package/dist/mcp.d.ts +15 -4
- package/dist/mcp.js +14 -9
- package/dist/messages/en.cjs +40 -0
- package/dist/messages/en.js +1 -1
- package/dist/messages/ko.cjs +40 -0
- package/dist/messages/ko.js +40 -0
- package/dist/registry/cms-audit.json +1 -1
- package/dist/registry/cms-doc-editor.json +15 -4
- package/dist/registry/cms-doc-list.json +2 -1
- package/dist/registry/cms-files.json +29 -0
- package/dist/registry/cms-lib.json +3 -3
- package/dist/registry/cms-media-picker.json +29 -0
- package/dist/registry/cms-media.json +28 -0
- package/dist/registry/cms-preview-comments.json +24 -0
- package/dist/registry/cms-releases.json +28 -0
- package/dist/registry/cms-shell.json +2 -2
- package/dist/registry/cms-trash.json +24 -0
- package/dist/registry/cms-versions.json +2 -1
- package/dist/registry/registry.json +163 -3
- package/dist/storage-s3.cjs +168 -0
- package/dist/storage-s3.d.cts +53 -0
- package/dist/storage-s3.d.ts +53 -0
- package/dist/storage-s3.js +143 -0
- package/dist/storage.cjs +373 -0
- package/dist/storage.d.cts +183 -0
- package/dist/storage.d.ts +183 -0
- package/dist/storage.js +49 -0
- package/dist/tables.cjs +251 -3
- package/dist/tables.d.cts +4965 -681
- package/dist/tables.d.ts +4965 -681
- package/dist/tables.js +14 -2
- package/dist/tools.cjs +331 -20
- package/dist/tools.d.cts +54 -7
- package/dist/tools.d.ts +54 -7
- package/dist/tools.js +16 -7
- package/dist/types.cjs +99 -1
- package/dist/types.d.cts +205 -5
- package/dist/types.d.ts +205 -5
- package/dist/types.js +5 -3
- package/package.json +32 -22
- package/dist/ai.cjs +0 -555
- package/dist/ai.d.cts +0 -48
- package/dist/ai.d.ts +0 -48
- package/dist/ai.js +0 -73
- package/dist/chunk-52NUUZC7.js +0 -1446
- package/dist/chunk-IGL2V6US.js +0 -324
- package/dist/chunk-QQV6VLYJ.js +0 -204
- package/dist/cms-BPp01z-8.d.ts +0 -411
- package/dist/cms-D6D89-qZ.d.cts +0 -411
- package/dist/drizzle-repo-B1rt7r4j.d.ts +0 -90
- package/dist/drizzle-repo-Cn-kL2FK.d.cts +0 -90
- package/dist/repo-BWI2Pkrv.d.ts +0 -162
- package/dist/repo-CeDxUxO6.d.cts +0 -162
package/dist/tools.js
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CMS_TOOLS,
|
|
3
3
|
CMS_TOOL_NAMES,
|
|
4
|
+
callTool,
|
|
5
|
+
runTool,
|
|
6
|
+
toolErrorResult,
|
|
4
7
|
toolsFor
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-DSJETZT4.js";
|
|
9
|
+
import "./chunk-BFVBHIHV.js";
|
|
10
|
+
import "./chunk-7Y6TU2UA.js";
|
|
11
|
+
import "./chunk-7SCYDG2G.js";
|
|
12
|
+
import "./chunk-MA6VKJ3F.js";
|
|
13
|
+
import "./chunk-PEQY4N73.js";
|
|
14
|
+
import "./chunk-3OPKTBEI.js";
|
|
9
15
|
import "./chunk-AKN7SUXU.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-KAO3Z3CF.js";
|
|
17
|
+
import "./chunk-PGV2QPIL.js";
|
|
18
|
+
import "./chunk-6PB4ZCHH.js";
|
|
13
19
|
import "./chunk-2NTK7H4W.js";
|
|
14
20
|
export {
|
|
15
21
|
CMS_TOOLS,
|
|
16
22
|
CMS_TOOL_NAMES,
|
|
23
|
+
callTool,
|
|
24
|
+
runTool,
|
|
25
|
+
toolErrorResult,
|
|
17
26
|
toolsFor
|
|
18
27
|
};
|
package/dist/types.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/types.ts
|
|
21
21
|
var types_exports = {};
|
|
22
22
|
__export(types_exports, {
|
|
23
|
+
ASSET_KINDS: () => ASSET_KINDS,
|
|
23
24
|
AUDIT_ACTIONS: () => AUDIT_ACTIONS,
|
|
24
25
|
CmsError: () => CmsError,
|
|
25
26
|
DOC_STATUSES: () => DOC_STATUSES,
|
|
@@ -78,6 +79,46 @@ var en = {
|
|
|
78
79
|
schema_outdated: "The database schema is v{found}, this version needs v{expected}. Run: {command}",
|
|
79
80
|
conflict_version: "Someone else saved v{current} since you read v{expected}. Reload or merge, then save",
|
|
80
81
|
slug_taken: "The slug {slug} is already used",
|
|
82
|
+
asset_not_found: "File not found",
|
|
83
|
+
unknown_store: "Unknown file store: {store}",
|
|
84
|
+
forbidden_media: "You are not allowed to do that with files in this store",
|
|
85
|
+
media_disabled: "The media library is off (set media in createCms)",
|
|
86
|
+
asset_type_not_allowed: "This file type is not allowed",
|
|
87
|
+
asset_type_mismatch: "The file content does not match its extension",
|
|
88
|
+
asset_too_large: "The file is too large. The limit is {max}",
|
|
89
|
+
invalid_folder: "That folder name cannot be used",
|
|
90
|
+
upload_incomplete: "The file did not arrive completely. Upload it again",
|
|
91
|
+
import_blocked: "That address cannot be fetched",
|
|
92
|
+
import_failed: "Could not fetch the file ({reason})",
|
|
93
|
+
asset_rejected: "This file did not pass the check",
|
|
94
|
+
asset_missing: "The file {id} does not exist",
|
|
95
|
+
asset_wrong_kind: "The file {id} is not a kind this field takes",
|
|
96
|
+
asset_alt_missing: "The image on line {line} has no alt text",
|
|
97
|
+
asset_alt_empty: "The image has no alt text",
|
|
98
|
+
asset_private_in_public: "A private file is used in a document anyone can read: {id}",
|
|
99
|
+
asset_in_use: "{count} documents use this file",
|
|
100
|
+
folder_not_empty: "The folder is not empty",
|
|
101
|
+
slug_in_trash: "A document with this address is in the trash. Restore it or delete it for good first",
|
|
102
|
+
in_other_release: 'This document is already in the release "{release}"',
|
|
103
|
+
comment_not_found: "Comment not found",
|
|
104
|
+
release_not_found: "Release not found",
|
|
105
|
+
filter_not_found: "Saved filter not found",
|
|
106
|
+
trash_not_found: "Not in the trash",
|
|
107
|
+
review_required: "Publishing here needs a review. Request one instead",
|
|
108
|
+
review_self: "Someone else has to approve your request",
|
|
109
|
+
review_people_only: "Only a person can approve or send back a review",
|
|
110
|
+
forbidden_trash: "Only an admin can delete for good",
|
|
111
|
+
forbidden_filter: "Only an admin can share a filter or remove someone else's",
|
|
112
|
+
comments_off: "This link does not allow comments",
|
|
113
|
+
review_not_requested: "No review was requested for this document",
|
|
114
|
+
not_scheduled: "Nothing is scheduled for this document",
|
|
115
|
+
release_closed: "This release was already published",
|
|
116
|
+
release_empty: "The release has no documents",
|
|
117
|
+
release_blocked: "{count} documents cannot go out, so nothing was published",
|
|
118
|
+
schedule_invalid: "The time must be in the future, and unpublishing must come after publishing",
|
|
119
|
+
comment_invalid: "A comment needs 1 to {max} characters",
|
|
120
|
+
name_invalid: "A name needs 1 to {max} characters",
|
|
121
|
+
too_many_files: "Too many files at once. The limit is {max}",
|
|
81
122
|
precondition_required: "Send If-Match (or expectedVersion) to change this document",
|
|
82
123
|
internal: "Something went wrong"
|
|
83
124
|
};
|
|
@@ -90,6 +131,8 @@ var ERROR_CODES = {
|
|
|
90
131
|
version_not_found: "not_found",
|
|
91
132
|
key_not_found: "not_found",
|
|
92
133
|
route_not_found: "not_found",
|
|
134
|
+
asset_not_found: "not_found",
|
|
135
|
+
unknown_store: "not_found",
|
|
93
136
|
unknown_collection: "unknown_collection",
|
|
94
137
|
// access
|
|
95
138
|
unauthorized: "unauthorized",
|
|
@@ -103,6 +146,7 @@ var ERROR_CODES = {
|
|
|
103
146
|
forbidden_publish: "forbidden",
|
|
104
147
|
forbidden_keys: "forbidden",
|
|
105
148
|
forbidden_audit: "forbidden",
|
|
149
|
+
forbidden_media: "forbidden",
|
|
106
150
|
key_too_wide: "forbidden",
|
|
107
151
|
cross_site: "forbidden",
|
|
108
152
|
// validation
|
|
@@ -127,11 +171,49 @@ var ERROR_CODES = {
|
|
|
127
171
|
invalid_json: "invalid",
|
|
128
172
|
body_too_large: "invalid",
|
|
129
173
|
preview_disabled: "invalid",
|
|
174
|
+
// media
|
|
175
|
+
media_disabled: "invalid",
|
|
176
|
+
asset_type_not_allowed: "invalid",
|
|
177
|
+
asset_type_mismatch: "invalid",
|
|
178
|
+
asset_too_large: "invalid",
|
|
179
|
+
invalid_folder: "invalid",
|
|
180
|
+
upload_incomplete: "invalid",
|
|
181
|
+
import_blocked: "invalid",
|
|
182
|
+
import_failed: "invalid",
|
|
183
|
+
asset_rejected: "invalid",
|
|
184
|
+
asset_missing: "invalid",
|
|
185
|
+
asset_wrong_kind: "invalid",
|
|
186
|
+
asset_alt_missing: "invalid",
|
|
187
|
+
asset_alt_empty: "invalid",
|
|
188
|
+
asset_private_in_public: "invalid",
|
|
130
189
|
no_public_url: "invalid",
|
|
131
190
|
schema_outdated: "invalid",
|
|
132
191
|
// concurrency
|
|
133
192
|
conflict_version: "conflict",
|
|
134
193
|
slug_taken: "conflict",
|
|
194
|
+
asset_in_use: "conflict",
|
|
195
|
+
folder_not_empty: "conflict",
|
|
196
|
+
slug_in_trash: "conflict",
|
|
197
|
+
in_other_release: "conflict",
|
|
198
|
+
comment_not_found: "not_found",
|
|
199
|
+
release_not_found: "not_found",
|
|
200
|
+
filter_not_found: "not_found",
|
|
201
|
+
trash_not_found: "not_found",
|
|
202
|
+
review_required: "forbidden",
|
|
203
|
+
review_self: "forbidden",
|
|
204
|
+
review_people_only: "forbidden",
|
|
205
|
+
forbidden_trash: "forbidden",
|
|
206
|
+
forbidden_filter: "forbidden",
|
|
207
|
+
comments_off: "forbidden",
|
|
208
|
+
review_not_requested: "precondition",
|
|
209
|
+
not_scheduled: "precondition",
|
|
210
|
+
release_closed: "precondition",
|
|
211
|
+
release_empty: "precondition",
|
|
212
|
+
release_blocked: "precondition",
|
|
213
|
+
schedule_invalid: "invalid",
|
|
214
|
+
comment_invalid: "invalid",
|
|
215
|
+
name_invalid: "invalid",
|
|
216
|
+
too_many_files: "invalid",
|
|
135
217
|
precondition_required: "precondition",
|
|
136
218
|
// anything else
|
|
137
219
|
internal: "internal"
|
|
@@ -173,7 +255,7 @@ var CmsError = class extends Error {
|
|
|
173
255
|
current;
|
|
174
256
|
/** Marks CmsErrors so `isCmsError` works across bundle copies of this class. */
|
|
175
257
|
isCmsError = true;
|
|
176
|
-
/** The wire shape (REST body, MCP error text,
|
|
258
|
+
/** The wire shape (REST body, MCP error text, `callTool` result). */
|
|
177
259
|
toJSON() {
|
|
178
260
|
return {
|
|
179
261
|
error: this.code,
|
|
@@ -202,10 +284,25 @@ var AUDIT_ACTIONS = [
|
|
|
202
284
|
"doc.unarchive",
|
|
203
285
|
"doc.delete",
|
|
204
286
|
"doc.restore",
|
|
287
|
+
"doc.undelete",
|
|
288
|
+
"doc.purge",
|
|
289
|
+
"doc.schedule",
|
|
290
|
+
"doc.unschedule",
|
|
291
|
+
"review.request",
|
|
292
|
+
"review.approve",
|
|
293
|
+
"review.reject",
|
|
294
|
+
"release.publish",
|
|
295
|
+
"asset.restore",
|
|
205
296
|
"preview.create",
|
|
297
|
+
"asset.upload",
|
|
298
|
+
"asset.move",
|
|
299
|
+
"asset.delete",
|
|
300
|
+
"asset.register",
|
|
301
|
+
"asset.share",
|
|
206
302
|
"access.denied",
|
|
207
303
|
"auth.failed"
|
|
208
304
|
];
|
|
305
|
+
var ASSET_KINDS = ["image", "video", "audio", "document", "other", "folder"];
|
|
209
306
|
function docState(doc) {
|
|
210
307
|
if (doc.status === "archived") return { state: "archived", modifiedSincePublish: false };
|
|
211
308
|
if (doc.publishedVersion === null) return { state: "draft", modifiedSincePublish: false };
|
|
@@ -213,6 +310,7 @@ function docState(doc) {
|
|
|
213
310
|
}
|
|
214
311
|
// Annotate the CommonJS export names for ESM import in node:
|
|
215
312
|
0 && (module.exports = {
|
|
313
|
+
ASSET_KINDS,
|
|
216
314
|
AUDIT_ACTIONS,
|
|
217
315
|
CmsError,
|
|
218
316
|
DOC_STATUSES,
|
package/dist/types.d.cts
CHANGED
|
@@ -3,7 +3,8 @@ export { CmsError, CmsErrorCode, CmsErrorKind, CmsErrorOptions, Diagnostic, ERRO
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* agent-cms — an add-on CMS that people (an admin screen) and agents (REST,
|
|
6
|
-
* MCP,
|
|
6
|
+
* MCP, CLI) edit together. Lives inside the app: no separate server. It hands
|
|
7
|
+
* agents tools and never calls a model itself.
|
|
7
8
|
*
|
|
8
9
|
* EXTRACTION RULE: nothing under `src/` may import from a host app (`@/`) or
|
|
9
10
|
* any app module (`src/parts.test.ts` enforces it).
|
|
@@ -32,6 +33,16 @@ type Actor = ({
|
|
|
32
33
|
label: string;
|
|
33
34
|
email?: string | null;
|
|
34
35
|
isAdmin: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Set when an agent acts for this person (an assistant inside the admin,
|
|
38
|
+
* say). Permissions are exactly the person's; versions, the document and
|
|
39
|
+
* the audit log also record the agent's name, and its edits show up as
|
|
40
|
+
* agent changes to review. Only code in the app can set this: REST and
|
|
41
|
+
* MCP never accept it.
|
|
42
|
+
*/
|
|
43
|
+
agent?: {
|
|
44
|
+
label: string;
|
|
45
|
+
};
|
|
35
46
|
} | {
|
|
36
47
|
kind: "key";
|
|
37
48
|
id: string;
|
|
@@ -42,7 +53,7 @@ type Actor = ({
|
|
|
42
53
|
kind: "system";
|
|
43
54
|
label: string;
|
|
44
55
|
}) & {
|
|
45
|
-
/** Set by the transports (REST, MCP,
|
|
56
|
+
/** Set by the transports (REST, MCP, `callTool`); app code may leave it out. */
|
|
46
57
|
via?: Via;
|
|
47
58
|
};
|
|
48
59
|
/** The editable content of a document; one version = one snapshot of this. */
|
|
@@ -82,10 +93,117 @@ interface CmsDoc extends DocContent {
|
|
|
82
93
|
/** Label of whoever wrote the latest version. */
|
|
83
94
|
updatedBy: string | null;
|
|
84
95
|
updatedByKind: "user" | "key" | "system" | null;
|
|
96
|
+
/** Name of the agent that acted for `updatedBy` (a person), or null. */
|
|
97
|
+
updatedByAgent: string | null;
|
|
85
98
|
/** Unsaved editor content (only for editors; never on a public read). */
|
|
86
99
|
autosave: AutosaveState | null;
|
|
100
|
+
/** In the trash since (null: not deleted). A trashed document is invisible everywhere but the trash. */
|
|
101
|
+
deletedAt: string | null;
|
|
102
|
+
deletedBy: string | null;
|
|
103
|
+
/** A publish or unpublish waiting for its time. */
|
|
104
|
+
schedule: Schedule | null;
|
|
105
|
+
/** The next time the schedule has something to do (for the runner). */
|
|
106
|
+
dueAt: string | null;
|
|
107
|
+
/** An open review request, or the reviewer's answer to it. */
|
|
108
|
+
review: ReviewRequest | null;
|
|
87
109
|
}
|
|
88
110
|
/** What `commit()` records about a version: changed fields and body hunks. */
|
|
111
|
+
type ActorKind = "user" | "key" | "system";
|
|
112
|
+
interface Schedule {
|
|
113
|
+
publishAt: string | null;
|
|
114
|
+
unpublishAt: string | null;
|
|
115
|
+
/** The version that will go public: the one that was current when it was scheduled. */
|
|
116
|
+
version: number;
|
|
117
|
+
by: string;
|
|
118
|
+
byKind: ActorKind;
|
|
119
|
+
byId: string | null;
|
|
120
|
+
byAgent: string | null;
|
|
121
|
+
at: string;
|
|
122
|
+
}
|
|
123
|
+
interface ReviewRequest {
|
|
124
|
+
state: "requested" | "changes_requested";
|
|
125
|
+
/** The version under review (moves along while the request is open). */
|
|
126
|
+
version: number;
|
|
127
|
+
by: string;
|
|
128
|
+
byKind: ActorKind;
|
|
129
|
+
byId: string | null;
|
|
130
|
+
byAgent: string | null;
|
|
131
|
+
at: string;
|
|
132
|
+
note: string | null;
|
|
133
|
+
/** Who sent it back, with `changes_requested`. */
|
|
134
|
+
answeredBy?: string | null;
|
|
135
|
+
answeredAt?: string | null;
|
|
136
|
+
}
|
|
137
|
+
interface CmsComment {
|
|
138
|
+
id: string;
|
|
139
|
+
documentId: string;
|
|
140
|
+
/** The comment this one answers (one level only), or null. */
|
|
141
|
+
threadId: string | null;
|
|
142
|
+
/** Section anchor (`sectionRanges`), "" for the top of the document. */
|
|
143
|
+
anchor: string;
|
|
144
|
+
/** The text it was written about. */
|
|
145
|
+
quote: string;
|
|
146
|
+
body: string;
|
|
147
|
+
authorKind: ActorKind | "guest";
|
|
148
|
+
authorId: string | null;
|
|
149
|
+
authorLabel: string;
|
|
150
|
+
authorAgent: string | null;
|
|
151
|
+
createdAt: string;
|
|
152
|
+
resolvedAt: string | null;
|
|
153
|
+
resolvedBy: string | null;
|
|
154
|
+
}
|
|
155
|
+
interface ReleaseItem {
|
|
156
|
+
documentId: string;
|
|
157
|
+
collection: string;
|
|
158
|
+
slug: string;
|
|
159
|
+
title: string;
|
|
160
|
+
action: "publish" | "unpublish";
|
|
161
|
+
/** The version pinned when it was added. */
|
|
162
|
+
version: number;
|
|
163
|
+
}
|
|
164
|
+
interface CmsRelease {
|
|
165
|
+
id: string;
|
|
166
|
+
name: string;
|
|
167
|
+
state: "open" | "scheduled" | "published";
|
|
168
|
+
publishAt: string | null;
|
|
169
|
+
items: ReleaseItem[];
|
|
170
|
+
createdBy: string;
|
|
171
|
+
createdById: string | null;
|
|
172
|
+
createdAt: string;
|
|
173
|
+
updatedAt: string;
|
|
174
|
+
publishedAt: string | null;
|
|
175
|
+
publishedBy: string | null;
|
|
176
|
+
/** Why the last scheduled run did nothing. */
|
|
177
|
+
lastError: string | null;
|
|
178
|
+
}
|
|
179
|
+
interface SavedFilter {
|
|
180
|
+
id: string;
|
|
181
|
+
collection: string;
|
|
182
|
+
name: string;
|
|
183
|
+
query: Record<string, string>;
|
|
184
|
+
ownerId: string;
|
|
185
|
+
ownerLabel: string;
|
|
186
|
+
/** Visible to everyone who can edit the collection. */
|
|
187
|
+
shared: boolean;
|
|
188
|
+
createdAt: string;
|
|
189
|
+
}
|
|
190
|
+
interface Presence {
|
|
191
|
+
documentId: string;
|
|
192
|
+
actorId: string;
|
|
193
|
+
label: string;
|
|
194
|
+
kind: ActorKind;
|
|
195
|
+
agent: string | null;
|
|
196
|
+
/** Editor position: line and column of the cursor, and of the other end of a selection. */
|
|
197
|
+
cursor: {
|
|
198
|
+
line: number;
|
|
199
|
+
ch: number;
|
|
200
|
+
} | null;
|
|
201
|
+
selection: {
|
|
202
|
+
line: number;
|
|
203
|
+
ch: number;
|
|
204
|
+
} | null;
|
|
205
|
+
seenAt: string;
|
|
206
|
+
}
|
|
89
207
|
interface VersionChange {
|
|
90
208
|
fields: string[];
|
|
91
209
|
/** Body hunks (added and removed lines) against the previous version. */
|
|
@@ -111,11 +229,20 @@ interface CmsVersion {
|
|
|
111
229
|
authorKind: "user" | "key" | "system";
|
|
112
230
|
authorId: string | null;
|
|
113
231
|
authorLabel: string;
|
|
232
|
+
/** Name of the agent that acted for the author (a person), or null. */
|
|
233
|
+
authorAgent: string | null;
|
|
114
234
|
note: string | null;
|
|
115
235
|
published: boolean;
|
|
116
236
|
createdAt: string;
|
|
117
237
|
changed: VersionChange | null;
|
|
118
238
|
reviewed: ReviewMark[];
|
|
239
|
+
/** A name someone gave this version ("launch copy"). */
|
|
240
|
+
label: string | null;
|
|
241
|
+
/** Pinned versions are never pruned. */
|
|
242
|
+
pinned: boolean;
|
|
243
|
+
/** Who approved this version in a review. */
|
|
244
|
+
approvedBy: string | null;
|
|
245
|
+
approvedAt: string | null;
|
|
119
246
|
}
|
|
120
247
|
/** A version without its snapshot (version lists). */
|
|
121
248
|
type VersionSummary = Omit<CmsVersion, "snapshot"> & {
|
|
@@ -133,7 +260,7 @@ interface CmsKey {
|
|
|
133
260
|
expiresAt: string | null;
|
|
134
261
|
createdAt: string;
|
|
135
262
|
}
|
|
136
|
-
declare const AUDIT_ACTIONS: readonly ["key.create", "key.revoke", "doc.publish", "doc.unpublish", "doc.archive", "doc.unarchive", "doc.delete", "doc.restore", "preview.create", "access.denied", "auth.failed"];
|
|
263
|
+
declare const AUDIT_ACTIONS: readonly ["key.create", "key.revoke", "doc.publish", "doc.unpublish", "doc.archive", "doc.unarchive", "doc.delete", "doc.restore", "doc.undelete", "doc.purge", "doc.schedule", "doc.unschedule", "review.request", "review.approve", "review.reject", "release.publish", "asset.restore", "preview.create", "asset.upload", "asset.move", "asset.delete", "asset.register", "asset.share", "access.denied", "auth.failed"];
|
|
137
264
|
type AuditAction = (typeof AUDIT_ACTIONS)[number];
|
|
138
265
|
interface AuditEntry {
|
|
139
266
|
id: string;
|
|
@@ -141,6 +268,8 @@ interface AuditEntry {
|
|
|
141
268
|
actorKind: Actor["kind"];
|
|
142
269
|
actorId: string | null;
|
|
143
270
|
actorLabel: string;
|
|
271
|
+
/** Name of the agent that acted for the actor (a person), or null. */
|
|
272
|
+
actorAgent: string | null;
|
|
144
273
|
action: AuditAction;
|
|
145
274
|
collection: string | null;
|
|
146
275
|
slug: string | null;
|
|
@@ -177,7 +306,60 @@ interface AccessArgs {
|
|
|
177
306
|
interface FieldAdmin {
|
|
178
307
|
label?: string;
|
|
179
308
|
help?: string;
|
|
180
|
-
widget?: "text" | "textarea" | "number" | "switch" | "select" | "multiselect" | "date" | "tags" | "json";
|
|
309
|
+
widget?: "text" | "textarea" | "number" | "switch" | "select" | "multiselect" | "date" | "tags" | "json" | "image" | "file";
|
|
310
|
+
/**
|
|
311
|
+
* For `image` and `file` (the value is a media library file id): which
|
|
312
|
+
* files the field takes, as MIME types (`image/png`), groups (`image/*`)
|
|
313
|
+
* or extensions (`.pdf`). Applied on top of the store's own rule. Default
|
|
314
|
+
* for `image`: `["image/*"]`.
|
|
315
|
+
*/
|
|
316
|
+
accept?: readonly string[];
|
|
317
|
+
/** For `image` and `file`: largest file (bytes) the field takes. */
|
|
318
|
+
maxFileSize?: number;
|
|
319
|
+
/** For `image` and `file`: the only store the field picks from and uploads to. */
|
|
320
|
+
store?: string;
|
|
321
|
+
}
|
|
322
|
+
declare const ASSET_KINDS: readonly ["image", "video", "audio", "document", "other", "folder"];
|
|
323
|
+
type AssetKind = (typeof ASSET_KINDS)[number];
|
|
324
|
+
/** A file in a store (`cms_assets`). Documents point at it by `id`. */
|
|
325
|
+
interface CmsAsset {
|
|
326
|
+
/** 12 lowercase letters and digits. */
|
|
327
|
+
id: string;
|
|
328
|
+
store: string;
|
|
329
|
+
/** Path inside the store, e.g. `blog/launch-hero.jpg`. */
|
|
330
|
+
key: string;
|
|
331
|
+
/** Folder part of `key` ("" = top level), without slashes at either end. */
|
|
332
|
+
folder: string;
|
|
333
|
+
name: string;
|
|
334
|
+
kind: AssetKind;
|
|
335
|
+
mime: string;
|
|
336
|
+
/** Bytes. */
|
|
337
|
+
size: number;
|
|
338
|
+
width: number | null;
|
|
339
|
+
height: number | null;
|
|
340
|
+
/** Seconds (video, audio). */
|
|
341
|
+
duration: number | null;
|
|
342
|
+
alt: string;
|
|
343
|
+
tags: string[];
|
|
344
|
+
thumbKey: string | null;
|
|
345
|
+
/** `pending` while it is being uploaded. */
|
|
346
|
+
status: "pending" | "ready";
|
|
347
|
+
uploadId: string | null;
|
|
348
|
+
createdBy: string | null;
|
|
349
|
+
createdByKind: "user" | "key" | "system" | null;
|
|
350
|
+
createdByAgent: string | null;
|
|
351
|
+
createdAt: string;
|
|
352
|
+
updatedAt: string;
|
|
353
|
+
/** In the trash since (null: not deleted). The object stays in the store until it is purged. */
|
|
354
|
+
deletedAt: string | null;
|
|
355
|
+
deletedBy: string | null;
|
|
356
|
+
}
|
|
357
|
+
/** One document's use of a file (`cms_asset_refs`). */
|
|
358
|
+
interface AssetRef {
|
|
359
|
+
assetId: string;
|
|
360
|
+
documentId: string;
|
|
361
|
+
inDraft: boolean;
|
|
362
|
+
inPublished: boolean;
|
|
181
363
|
}
|
|
182
364
|
interface CollectionConfig<F extends ZodTypeAny | undefined = ZodTypeAny | undefined, S extends string = string> {
|
|
183
365
|
slug: S;
|
|
@@ -235,6 +417,19 @@ interface CollectionConfig<F extends ZodTypeAny | undefined = ZodTypeAny | undef
|
|
|
235
417
|
/** Per field path (`tags`, `seo.title`): label, help text, widget. */
|
|
236
418
|
fields?: Record<string, FieldAdmin>;
|
|
237
419
|
};
|
|
420
|
+
media?: {
|
|
421
|
+
/** true: an image without alt text is an error, not a warning. */
|
|
422
|
+
requireAlt?: boolean;
|
|
423
|
+
};
|
|
424
|
+
/**
|
|
425
|
+
* Who needs another person's approval before publishing. `agents`: API
|
|
426
|
+
* keys and agents acting for a person. `everyone`: people too (nobody
|
|
427
|
+
* approves their own request). Default: nobody.
|
|
428
|
+
*/
|
|
429
|
+
review?: {
|
|
430
|
+
agents?: "required";
|
|
431
|
+
everyone?: "required";
|
|
432
|
+
};
|
|
238
433
|
hooks?: {
|
|
239
434
|
/**
|
|
240
435
|
* After every write. `info.contentChanged` is false when only the draft
|
|
@@ -273,7 +468,10 @@ interface DocSummary {
|
|
|
273
468
|
updatedAt: string;
|
|
274
469
|
updatedBy: string | null;
|
|
275
470
|
updatedByKind: CmsDoc["updatedByKind"];
|
|
471
|
+
updatedByAgent: string | null;
|
|
276
472
|
hits7d?: number;
|
|
473
|
+
schedule: Pick<Schedule, "publishAt" | "unpublishAt" | "version" | "by"> | null;
|
|
474
|
+
review: Pick<ReviewRequest, "state" | "version" | "by" | "note"> | null;
|
|
277
475
|
}
|
|
278
476
|
interface DocCounts {
|
|
279
477
|
all: number;
|
|
@@ -281,6 +479,8 @@ interface DocCounts {
|
|
|
281
479
|
published: number;
|
|
282
480
|
modified: number;
|
|
283
481
|
archived: number;
|
|
482
|
+
scheduled: number;
|
|
483
|
+
review: number;
|
|
284
484
|
}
|
|
285
485
|
|
|
286
|
-
export { AUDIT_ACTIONS, type AccessArgs, type Actor, type AuditAction, type AuditEntry, type AutosaveState, type CmsDoc, type CmsKey, type CmsVersion, type CollectionConfig, DOC_STATUSES, type DocContent, type DocCounts, type DocState, type DocStatus, type DocSummary, type FieldAdmin, KEY_SCOPES, type KeyScope, type ReviewMark, type SearchMissEvent, VIAS, type VersionChange, type VersionSummary, type Via, docState };
|
|
486
|
+
export { ASSET_KINDS, AUDIT_ACTIONS, type AccessArgs, type Actor, type ActorKind, type AssetKind, type AssetRef, type AuditAction, type AuditEntry, type AutosaveState, type CmsAsset, type CmsComment, type CmsDoc, type CmsKey, type CmsRelease, type CmsVersion, type CollectionConfig, DOC_STATUSES, type DocContent, type DocCounts, type DocState, type DocStatus, type DocSummary, type FieldAdmin, KEY_SCOPES, type KeyScope, type Presence, type ReleaseItem, type ReviewMark, type ReviewRequest, type SavedFilter, type Schedule, type SearchMissEvent, VIAS, type VersionChange, type VersionSummary, type Via, docState };
|