@sudobility/screenwriter_types 0.1.1
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/CLAUDE.md +50 -0
- package/README.md +34 -0
- package/dist/account/index.d.ts +440 -0
- package/dist/account/index.js +274 -0
- package/dist/admin/index.d.ts +95 -0
- package/dist/admin/index.js +20 -0
- package/dist/ai/index.d.ts +564 -0
- package/dist/ai/index.js +179 -0
- package/dist/api/envelope.d.ts +33 -0
- package/dist/api/envelope.js +140 -0
- package/dist/api/pagination.d.ts +7 -0
- package/dist/api/pagination.js +9 -0
- package/dist/api/routes.d.ts +273 -0
- package/dist/api/routes.js +306 -0
- package/dist/assets/index.d.ts +722 -0
- package/dist/assets/index.js +452 -0
- package/dist/collab/index.d.ts +214 -0
- package/dist/collab/index.js +211 -0
- package/dist/commands/index.d.ts +92 -0
- package/dist/commands/index.js +20 -0
- package/dist/credits/index.d.ts +26 -0
- package/dist/credits/index.js +7 -0
- package/dist/formats/index.d.ts +87 -0
- package/dist/formats/index.js +26 -0
- package/dist/ids/index.d.ts +2 -0
- package/dist/ids/index.js +2 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +33 -0
- package/dist/io/index.d.ts +395 -0
- package/dist/io/index.js +161 -0
- package/dist/jobs/index.d.ts +278 -0
- package/dist/jobs/index.js +138 -0
- package/dist/keys/index.d.ts +53 -0
- package/dist/keys/index.js +22 -0
- package/dist/lifecycle/index.d.ts +263 -0
- package/dist/lifecycle/index.js +148 -0
- package/dist/me/index.d.ts +35 -0
- package/dist/me/index.js +18 -0
- package/dist/packets/index.d.ts +887 -0
- package/dist/packets/index.js +312 -0
- package/dist/projects/index.d.ts +201 -0
- package/dist/projects/index.js +75 -0
- package/dist/public/index.d.ts +95 -0
- package/dist/public/index.js +25 -0
- package/dist/reads/index.d.ts +387 -0
- package/dist/reads/index.js +118 -0
- package/dist/reports/index.d.ts +168 -0
- package/dist/reports/index.js +466 -0
- package/dist/sharing/index.d.ts +256 -0
- package/dist/sharing/index.js +91 -0
- package/dist/sync/codec.d.ts +7 -0
- package/dist/sync/codec.js +91 -0
- package/dist/sync/index.d.ts +382 -0
- package/dist/sync/index.js +262 -0
- package/dist/sync/permissions.d.ts +22 -0
- package/dist/sync/permissions.js +11 -0
- package/dist/templates/index.d.ts +1699 -0
- package/dist/templates/index.js +70 -0
- package/dist/tenancy/index.d.ts +116 -0
- package/dist/tenancy/index.js +102 -0
- package/dist/test/index.d.ts +8 -0
- package/dist/test/index.js +88 -0
- package/dist/versions/index.d.ts +335 -0
- package/dist/versions/index.js +107 -0
- package/package.json +62 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Job } from '../jobs/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Project, document and template lifecycle, workspace settings (slice B14; spec 05 §6.2, §6.6, §6.7, §6.26).
|
|
5
|
+
* Folders, move / duplicate / purge / apply template, the workspace documents list and trash, the Shared Bin, the workspace
|
|
6
|
+
* defaults and the batch-watermark contacts. Template CRUD types live in `templates/`.
|
|
7
|
+
*/
|
|
8
|
+
/** Trashed items are purged (`system.purge`) this many days after they were trashed (spec 05 §17). */
|
|
9
|
+
export declare const TRASH_RETENTION_DAYS = 30;
|
|
10
|
+
export interface PurgeScheduledResponse {
|
|
11
|
+
purgeScheduled: true;
|
|
12
|
+
}
|
|
13
|
+
/** A folder may sit at most this deep (`FOLDER_DEPTH`): the root's children are depth 1. */
|
|
14
|
+
export declare const FOLDER_MAX_DEPTH = 8;
|
|
15
|
+
export declare const projectFolderCreateSchema: z.ZodObject<{
|
|
16
|
+
name: z.ZodString;
|
|
17
|
+
parentFolderId: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type ProjectFolderCreateRequest = z.infer<typeof projectFolderCreateSchema>;
|
|
20
|
+
export declare const projectFolderUpdateSchema: z.ZodObject<{
|
|
21
|
+
name: z.ZodOptional<z.ZodString>;
|
|
22
|
+
parentFolderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export type ProjectFolderUpdateRequest = z.infer<typeof projectFolderUpdateSchema>;
|
|
26
|
+
/** `DELETE /project-folders/:fid?moveContentsTo=<fid>|root`; without it the contents move up to the folder's own parent. */
|
|
27
|
+
export declare const projectFolderDeleteQuerySchema: z.ZodObject<{
|
|
28
|
+
moveContentsTo: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export type ProjectFolderDeleteQuery = z.infer<typeof projectFolderDeleteQuerySchema>;
|
|
31
|
+
export interface ProjectFolderDeleteResponse {
|
|
32
|
+
deleted: true;
|
|
33
|
+
}
|
|
34
|
+
export declare const projectPurgeSchema: z.ZodObject<{
|
|
35
|
+
confirmName: z.ZodString;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type ProjectPurgeRequest = z.infer<typeof projectPurgeSchema>;
|
|
38
|
+
export declare const projectDuplicateSchema: z.ZodObject<{
|
|
39
|
+
name: z.ZodString;
|
|
40
|
+
targetWorkspaceId: z.ZodOptional<z.ZodString>;
|
|
41
|
+
includeSnapshots: z.ZodDefault<z.ZodBoolean>;
|
|
42
|
+
includeAssets: z.ZodDefault<z.ZodBoolean>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export type ProjectDuplicateRequest = z.input<typeof projectDuplicateSchema>;
|
|
45
|
+
/** `job.result` of a finished `project.duplicate` job. */
|
|
46
|
+
export interface ProjectDuplicateResult {
|
|
47
|
+
projectId: string;
|
|
48
|
+
documents: number;
|
|
49
|
+
snapshots: number;
|
|
50
|
+
/** Documents that were not copied: a locked document needs a re-authentication a job cannot give. */
|
|
51
|
+
skipped: {
|
|
52
|
+
documentId: string;
|
|
53
|
+
reason: 'locked';
|
|
54
|
+
}[];
|
|
55
|
+
}
|
|
56
|
+
export declare const documentMoveSchema: z.ZodObject<{
|
|
57
|
+
targetProjectId: z.ZodString;
|
|
58
|
+
folderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export type DocumentMoveRequest = z.infer<typeof documentMoveSchema>;
|
|
61
|
+
export declare const documentDuplicateSchema: z.ZodObject<{
|
|
62
|
+
title: z.ZodString;
|
|
63
|
+
targetProjectId: z.ZodOptional<z.ZodString>;
|
|
64
|
+
includeSnapshots: z.ZodDefault<z.ZodBoolean>;
|
|
65
|
+
includeAssets: z.ZodDefault<z.ZodBoolean>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
export type DocumentDuplicateRequest = z.input<typeof documentDuplicateSchema>;
|
|
68
|
+
/** `POST /documents/:did/template`. `templateVersion` defaults to the template's latest. */
|
|
69
|
+
export declare const documentApplyTemplateSchema: z.ZodObject<{
|
|
70
|
+
templateId: z.ZodString;
|
|
71
|
+
templateVersion: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
mapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
73
|
+
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
export type DocumentApplyTemplateRequest = z.infer<typeof documentApplyTemplateSchema>;
|
|
76
|
+
export interface ApplyTemplateDryRunResponse {
|
|
77
|
+
/** Style ids used by elements that have no counterpart (same id, same role or explicit `mapping`) in the new template. */
|
|
78
|
+
unmappedStyles: string[];
|
|
79
|
+
/** Pages of the document after minus before. */
|
|
80
|
+
pageDelta: number;
|
|
81
|
+
}
|
|
82
|
+
export type ApplyTemplateResponse = Job | ApplyTemplateDryRunResponse;
|
|
83
|
+
/** `job.result` of a finished `doc.applyTemplate` job. */
|
|
84
|
+
export interface ApplyTemplateResult {
|
|
85
|
+
templateId: string;
|
|
86
|
+
templateVersion: number;
|
|
87
|
+
remapped: number;
|
|
88
|
+
preTemplateSnapshotId: string;
|
|
89
|
+
}
|
|
90
|
+
/** `GET /workspaces/:wid/documents`: across every project; `starred` is the caller's own stars (`document_stars`). */
|
|
91
|
+
export declare const workspaceDocumentsQuerySchema: z.ZodObject<{
|
|
92
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
93
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
94
|
+
q: z.ZodOptional<z.ZodString>;
|
|
95
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
96
|
+
outline: "outline";
|
|
97
|
+
script: "script";
|
|
98
|
+
bible: "bible";
|
|
99
|
+
treatment: "treatment";
|
|
100
|
+
other: "other";
|
|
101
|
+
}>>;
|
|
102
|
+
trashed: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
103
|
+
true: "true";
|
|
104
|
+
false: "false";
|
|
105
|
+
}>, z.ZodTransform<boolean, "true" | "false">>>;
|
|
106
|
+
starred: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
107
|
+
true: "true";
|
|
108
|
+
false: "false";
|
|
109
|
+
}>, z.ZodTransform<boolean, "true" | "false">>>;
|
|
110
|
+
label: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
export type WorkspaceDocumentsQuery = z.output<typeof workspaceDocumentsQuerySchema>;
|
|
113
|
+
export declare const TRASH_ITEM_TYPES: readonly ["project", "document", "asset"];
|
|
114
|
+
export type TrashItemType = (typeof TRASH_ITEM_TYPES)[number];
|
|
115
|
+
/** `GET /workspaces/:wid/trash`. A document trashed together with its project is not listed on its own (restore the project). */
|
|
116
|
+
export interface TrashItem {
|
|
117
|
+
type: TrashItemType;
|
|
118
|
+
id: string;
|
|
119
|
+
title: string;
|
|
120
|
+
/** A document's project, for the "in <project>" line. */
|
|
121
|
+
projectId: string | null;
|
|
122
|
+
trashedAt: string;
|
|
123
|
+
trashedBy: string | null;
|
|
124
|
+
/** `trashedAt` + `TRASH_RETENTION_DAYS`. */
|
|
125
|
+
purgeAt: string;
|
|
126
|
+
}
|
|
127
|
+
/** `confirm` must be `EMPTY`: anything else is the server's `CONFIRMATION_MISMATCH`, not a schema error. */
|
|
128
|
+
export declare const trashEmptySchema: z.ZodObject<{
|
|
129
|
+
confirm: z.ZodString;
|
|
130
|
+
}, z.core.$strip>;
|
|
131
|
+
export type TrashEmptyRequest = z.infer<typeof trashEmptySchema>;
|
|
132
|
+
/** The `system.purge` job's input (also what a purge job row shows in its `requestSummary`). */
|
|
133
|
+
export declare const purgeInputSchema: z.ZodObject<{
|
|
134
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
135
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
136
|
+
documentId: z.ZodOptional<z.ZodString>;
|
|
137
|
+
}, z.core.$strip>;
|
|
138
|
+
export type PurgeInput = z.infer<typeof purgeInputSchema>;
|
|
139
|
+
export interface PurgeResult {
|
|
140
|
+
projects: number;
|
|
141
|
+
documents: number;
|
|
142
|
+
}
|
|
143
|
+
/** Serialised size cap of one snippet (`LIMIT_EXCEEDED`). */
|
|
144
|
+
export declare const PROJECT_BIN_ITEM_MAX_BYTES: number;
|
|
145
|
+
export interface ProjectBinItem {
|
|
146
|
+
id: string;
|
|
147
|
+
projectId: string;
|
|
148
|
+
title: string;
|
|
149
|
+
/** Frozen `ElementJSON[]`: notes and tags are stripped. */
|
|
150
|
+
elements: Record<string, unknown>[];
|
|
151
|
+
sourceDocumentId: string | null;
|
|
152
|
+
createdBy: string | null;
|
|
153
|
+
createdAt: string;
|
|
154
|
+
}
|
|
155
|
+
export declare const projectBinCreateSchema: z.ZodObject<{
|
|
156
|
+
id: z.ZodOptional<z.ZodString>;
|
|
157
|
+
title: z.ZodOptional<z.ZodString>;
|
|
158
|
+
elements: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
159
|
+
sourceDocumentId: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
export type ProjectBinCreateRequest = z.input<typeof projectBinCreateSchema>;
|
|
162
|
+
export interface ProjectBinDeleteResponse {
|
|
163
|
+
deleted: true;
|
|
164
|
+
}
|
|
165
|
+
export declare const DEFAULT_PROJECT_ROLES: readonly ["admin", "writer", "commenter", "viewer"];
|
|
166
|
+
export type DefaultProjectRole = (typeof DEFAULT_PROJECT_ROLES)[number];
|
|
167
|
+
/**
|
|
168
|
+
* What *New document* copies into a document of the workspace (then the two diverge, spec 01 §5.4) and *Save as workspace
|
|
169
|
+
* worksheet* writes to. The lists are open objects owned by spec 09 features.
|
|
170
|
+
*/
|
|
171
|
+
export declare const workspaceDefaultsSchema: z.ZodObject<{
|
|
172
|
+
tagCategories: z.ZodDefault<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
173
|
+
revisionColourSets: z.ZodDefault<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
174
|
+
noteTypes: z.ZodDefault<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
175
|
+
worksheets: z.ZodDefault<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
176
|
+
defaultProjectRole: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
177
|
+
admin: "admin";
|
|
178
|
+
writer: "writer";
|
|
179
|
+
commenter: "commenter";
|
|
180
|
+
viewer: "viewer";
|
|
181
|
+
}>>>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
export type WorkspaceDefaultsInput = z.input<typeof workspaceDefaultsSchema>;
|
|
184
|
+
export type WorkspaceDefaultsDoc = z.output<typeof workspaceDefaultsSchema>;
|
|
185
|
+
export interface WorkspaceDefaults extends WorkspaceDefaultsDoc {
|
|
186
|
+
updatedAt: string;
|
|
187
|
+
}
|
|
188
|
+
/** Serialised size cap of the defaults document (`LIMIT_EXCEEDED`). */
|
|
189
|
+
export declare const WORKSPACE_DEFAULTS_MAX_BYTES: number;
|
|
190
|
+
export declare const workspaceDefaultsPutSchema: z.ZodObject<{
|
|
191
|
+
tagCategories: z.ZodDefault<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
192
|
+
revisionColourSets: z.ZodDefault<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
193
|
+
noteTypes: z.ZodDefault<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
194
|
+
worksheets: z.ZodDefault<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
195
|
+
defaultProjectRole: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
196
|
+
admin: "admin";
|
|
197
|
+
writer: "writer";
|
|
198
|
+
commenter: "commenter";
|
|
199
|
+
viewer: "viewer";
|
|
200
|
+
}>>>;
|
|
201
|
+
baseUpdatedAt: z.ZodString;
|
|
202
|
+
}, z.core.$strip>;
|
|
203
|
+
export type WorkspaceDefaultsPutRequest = z.input<typeof workspaceDefaultsPutSchema>;
|
|
204
|
+
export interface WorkspaceDefaultsPutResponse {
|
|
205
|
+
updatedAt: string;
|
|
206
|
+
}
|
|
207
|
+
export declare const WORKSPACE_CONTACTS_BATCH_MAX = 500;
|
|
208
|
+
export interface WorkspaceContact {
|
|
209
|
+
id: string;
|
|
210
|
+
name: string;
|
|
211
|
+
company: string | null;
|
|
212
|
+
email: string | null;
|
|
213
|
+
}
|
|
214
|
+
export declare const workspaceContactInputSchema: z.ZodObject<{
|
|
215
|
+
name: z.ZodString;
|
|
216
|
+
company: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
217
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
218
|
+
id: z.ZodOptional<z.ZodString>;
|
|
219
|
+
}, z.core.$strip>;
|
|
220
|
+
/** More than `WORKSPACE_CONTACTS_BATCH_MAX` entries is the server's `LIMIT_EXCEEDED`, not a schema error. */
|
|
221
|
+
export declare const workspaceContactsCreateSchema: z.ZodObject<{
|
|
222
|
+
contacts: z.ZodArray<z.ZodObject<{
|
|
223
|
+
name: z.ZodString;
|
|
224
|
+
company: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
225
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
226
|
+
id: z.ZodOptional<z.ZodString>;
|
|
227
|
+
}, z.core.$strip>>;
|
|
228
|
+
}, z.core.$strip>;
|
|
229
|
+
export type WorkspaceContactsCreateRequest = z.input<typeof workspaceContactsCreateSchema>;
|
|
230
|
+
export declare const workspaceContactPatchSchema: z.ZodObject<{
|
|
231
|
+
name: z.ZodOptional<z.ZodString>;
|
|
232
|
+
company: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
233
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
234
|
+
}, z.core.$strip>;
|
|
235
|
+
export type WorkspaceContactPatchRequest = z.infer<typeof workspaceContactPatchSchema>;
|
|
236
|
+
export declare const workspaceContactsQuerySchema: z.ZodObject<{
|
|
237
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
238
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
239
|
+
q: z.ZodOptional<z.ZodString>;
|
|
240
|
+
}, z.core.$strip>;
|
|
241
|
+
export type WorkspaceContactsQuery = z.output<typeof workspaceContactsQuerySchema>;
|
|
242
|
+
export interface WorkspaceContactDeleteResponse {
|
|
243
|
+
deleted: true;
|
|
244
|
+
}
|
|
245
|
+
export declare const projectDuplicateJobInputSchema: z.ZodObject<{
|
|
246
|
+
projectId: z.ZodString;
|
|
247
|
+
name: z.ZodString;
|
|
248
|
+
targetWorkspaceId: z.ZodString;
|
|
249
|
+
includeSnapshots: z.ZodBoolean;
|
|
250
|
+
includeAssets: z.ZodBoolean;
|
|
251
|
+
}, z.core.$strip>;
|
|
252
|
+
export type ProjectDuplicateJobInput = z.infer<typeof projectDuplicateJobInputSchema>;
|
|
253
|
+
export declare const applyTemplateJobInputSchema: z.ZodObject<{
|
|
254
|
+
templateId: z.ZodString;
|
|
255
|
+
templateVersion: z.ZodNumber;
|
|
256
|
+
mapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
257
|
+
}, z.core.$strip>;
|
|
258
|
+
export type ApplyTemplateJobInput = z.infer<typeof applyTemplateJobInputSchema>;
|
|
259
|
+
export declare const templateThumbnailInputSchema: z.ZodObject<{
|
|
260
|
+
templateId: z.ZodString;
|
|
261
|
+
version: z.ZodNumber;
|
|
262
|
+
}, z.core.$strip>;
|
|
263
|
+
export type TemplateThumbnailInput = z.infer<typeof templateThumbnailInputSchema>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { cursorQuerySchema } from '../api/pagination.js';
|
|
3
|
+
import { documentKindSchema } from '../projects/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Project, document and template lifecycle, workspace settings (slice B14; spec 05 §6.2, §6.6, §6.7, §6.26).
|
|
6
|
+
* Folders, move / duplicate / purge / apply template, the workspace documents list and trash, the Shared Bin, the workspace
|
|
7
|
+
* defaults and the batch-watermark contacts. Template CRUD types live in `templates/`.
|
|
8
|
+
*/
|
|
9
|
+
/** Trashed items are purged (`system.purge`) this many days after they were trashed (spec 05 §17). */
|
|
10
|
+
export const TRASH_RETENTION_DAYS = 30;
|
|
11
|
+
// ─── project folders (`pfd_`, §6.6) ───────────────────────────────────────────
|
|
12
|
+
/** A folder may sit at most this deep (`FOLDER_DEPTH`): the root's children are depth 1. */
|
|
13
|
+
export const FOLDER_MAX_DEPTH = 8;
|
|
14
|
+
export const projectFolderCreateSchema = z.object({
|
|
15
|
+
name: z.string().trim().min(1).max(120),
|
|
16
|
+
parentFolderId: z.string().min(1).optional(),
|
|
17
|
+
});
|
|
18
|
+
export const projectFolderUpdateSchema = z.object({
|
|
19
|
+
name: z.string().trim().min(1).max(120).optional(),
|
|
20
|
+
/** `null` moves the folder to the project root. */
|
|
21
|
+
parentFolderId: z.string().min(1).nullable().optional(),
|
|
22
|
+
position: z.number().finite().optional(),
|
|
23
|
+
});
|
|
24
|
+
/** `DELETE /project-folders/:fid?moveContentsTo=<fid>|root`; without it the contents move up to the folder's own parent. */
|
|
25
|
+
export const projectFolderDeleteQuerySchema = z.object({
|
|
26
|
+
moveContentsTo: z.string().min(1).optional(),
|
|
27
|
+
});
|
|
28
|
+
// ─── projects: purge and duplicate ────────────────────────────────────────────
|
|
29
|
+
export const projectPurgeSchema = z.object({ confirmName: z.string() });
|
|
30
|
+
export const projectDuplicateSchema = z.object({
|
|
31
|
+
name: z.string().trim().min(1).max(200),
|
|
32
|
+
targetWorkspaceId: z.string().min(1).optional(),
|
|
33
|
+
includeSnapshots: z.boolean().default(false),
|
|
34
|
+
/** Re-links the source's asset links onto the copy (B11); a no-op when the target is a different workspace. */
|
|
35
|
+
includeAssets: z.boolean().default(false),
|
|
36
|
+
});
|
|
37
|
+
// ─── documents: move, duplicate, apply template ───────────────────────────────
|
|
38
|
+
export const documentMoveSchema = z.object({
|
|
39
|
+
targetProjectId: z.string().min(1),
|
|
40
|
+
folderId: z.string().min(1).nullable().optional(),
|
|
41
|
+
});
|
|
42
|
+
export const documentDuplicateSchema = z.object({
|
|
43
|
+
title: z.string().trim().min(1).max(200),
|
|
44
|
+
targetProjectId: z.string().min(1).optional(),
|
|
45
|
+
includeSnapshots: z.boolean().default(false),
|
|
46
|
+
includeAssets: z.boolean().default(false),
|
|
47
|
+
});
|
|
48
|
+
/** `POST /documents/:did/template`. `templateVersion` defaults to the template's latest. */
|
|
49
|
+
export const documentApplyTemplateSchema = z.object({
|
|
50
|
+
templateId: z.string().min(1),
|
|
51
|
+
templateVersion: z.number().int().min(1).optional(),
|
|
52
|
+
/** Old style id -> style id of the new template, for styles the new template has no counterpart of. */
|
|
53
|
+
mapping: z.record(z.string(), z.string()).optional(),
|
|
54
|
+
dryRun: z.boolean().optional(),
|
|
55
|
+
});
|
|
56
|
+
// ─── workspace documents and trash ────────────────────────────────────────────
|
|
57
|
+
const boolQuery = z.enum(['true', 'false']).transform((v) => v === 'true');
|
|
58
|
+
/** `GET /workspaces/:wid/documents`: across every project; `starred` is the caller's own stars (`document_stars`). */
|
|
59
|
+
export const workspaceDocumentsQuerySchema = cursorQuerySchema.extend({
|
|
60
|
+
q: z.string().max(200).optional(),
|
|
61
|
+
kind: documentKindSchema.optional(),
|
|
62
|
+
trashed: boolQuery.optional(),
|
|
63
|
+
starred: boolQuery.optional(),
|
|
64
|
+
label: z.string().max(40).optional(),
|
|
65
|
+
});
|
|
66
|
+
export const TRASH_ITEM_TYPES = ['project', 'document', 'asset'];
|
|
67
|
+
/** `confirm` must be `EMPTY`: anything else is the server's `CONFIRMATION_MISMATCH`, not a schema error. */
|
|
68
|
+
export const trashEmptySchema = z.object({ confirm: z.string() });
|
|
69
|
+
/** The `system.purge` job's input (also what a purge job row shows in its `requestSummary`). */
|
|
70
|
+
export const purgeInputSchema = z.object({
|
|
71
|
+
workspaceId: z.string().optional(),
|
|
72
|
+
projectId: z.string().optional(),
|
|
73
|
+
documentId: z.string().optional(),
|
|
74
|
+
});
|
|
75
|
+
// ─── Shared Bin (`bin_`, §6.26) ───────────────────────────────────────────────
|
|
76
|
+
/** Serialised size cap of one snippet (`LIMIT_EXCEEDED`). */
|
|
77
|
+
export const PROJECT_BIN_ITEM_MAX_BYTES = 2 * 1024 * 1024;
|
|
78
|
+
export const projectBinCreateSchema = z.object({
|
|
79
|
+
id: z.string().startsWith('bin_').optional(),
|
|
80
|
+
title: z.string().trim().min(1).max(200).optional(),
|
|
81
|
+
elements: z.array(z.record(z.string(), z.unknown())).min(1),
|
|
82
|
+
sourceDocumentId: z.string().min(1).optional(),
|
|
83
|
+
});
|
|
84
|
+
// ─── workspace defaults (§6.26) ───────────────────────────────────────────────
|
|
85
|
+
export const DEFAULT_PROJECT_ROLES = [
|
|
86
|
+
'admin',
|
|
87
|
+
'writer',
|
|
88
|
+
'commenter',
|
|
89
|
+
'viewer',
|
|
90
|
+
];
|
|
91
|
+
const looseItems = (max) => z.array(z.looseObject({})).max(max);
|
|
92
|
+
/**
|
|
93
|
+
* What *New document* copies into a document of the workspace (then the two diverge, spec 01 §5.4) and *Save as workspace
|
|
94
|
+
* worksheet* writes to. The lists are open objects owned by spec 09 features.
|
|
95
|
+
*/
|
|
96
|
+
export const workspaceDefaultsSchema = z.object({
|
|
97
|
+
tagCategories: looseItems(200).default([]),
|
|
98
|
+
revisionColourSets: looseItems(100).default([]),
|
|
99
|
+
noteTypes: looseItems(100).default([]),
|
|
100
|
+
worksheets: looseItems(200).default([]),
|
|
101
|
+
/** The role newly created projects grant workspace members who have none (F-SET-009). */
|
|
102
|
+
defaultProjectRole: z.enum(DEFAULT_PROJECT_ROLES).nullable().default(null),
|
|
103
|
+
});
|
|
104
|
+
/** Serialised size cap of the defaults document (`LIMIT_EXCEEDED`). */
|
|
105
|
+
export const WORKSPACE_DEFAULTS_MAX_BYTES = 256 * 1024;
|
|
106
|
+
export const workspaceDefaultsPutSchema = workspaceDefaultsSchema.extend({
|
|
107
|
+
baseUpdatedAt: z.string().min(1),
|
|
108
|
+
});
|
|
109
|
+
// ─── contacts (`ctc_`, §6.26) ─────────────────────────────────────────────────
|
|
110
|
+
export const WORKSPACE_CONTACTS_BATCH_MAX = 500;
|
|
111
|
+
const contactFields = {
|
|
112
|
+
name: z.string().trim().min(1).max(200),
|
|
113
|
+
company: z.string().trim().max(200).nullable().optional(),
|
|
114
|
+
email: z.string().trim().max(320).nullable().optional(),
|
|
115
|
+
};
|
|
116
|
+
export const workspaceContactInputSchema = z.object({
|
|
117
|
+
id: z.string().startsWith('ctc_').optional(),
|
|
118
|
+
...contactFields,
|
|
119
|
+
});
|
|
120
|
+
/** More than `WORKSPACE_CONTACTS_BATCH_MAX` entries is the server's `LIMIT_EXCEEDED`, not a schema error. */
|
|
121
|
+
export const workspaceContactsCreateSchema = z.object({
|
|
122
|
+
contacts: z.array(workspaceContactInputSchema).min(1),
|
|
123
|
+
});
|
|
124
|
+
export const workspaceContactPatchSchema = z.object({
|
|
125
|
+
name: contactFields.name.optional(),
|
|
126
|
+
company: contactFields.company,
|
|
127
|
+
email: contactFields.email,
|
|
128
|
+
});
|
|
129
|
+
export const workspaceContactsQuerySchema = cursorQuerySchema.extend({
|
|
130
|
+
q: z.string().max(200).optional(),
|
|
131
|
+
});
|
|
132
|
+
// ─── job inputs (`project.duplicate`, `doc.applyTemplate`, `template.thumbnail`; `system.purge` is `purgeInputSchema`) ───
|
|
133
|
+
export const projectDuplicateJobInputSchema = z.object({
|
|
134
|
+
projectId: z.string().min(1),
|
|
135
|
+
name: z.string().min(1),
|
|
136
|
+
targetWorkspaceId: z.string().min(1),
|
|
137
|
+
includeSnapshots: z.boolean(),
|
|
138
|
+
includeAssets: z.boolean(),
|
|
139
|
+
});
|
|
140
|
+
export const applyTemplateJobInputSchema = z.object({
|
|
141
|
+
templateId: z.string().min(1),
|
|
142
|
+
templateVersion: z.number().int().min(1),
|
|
143
|
+
mapping: z.record(z.string(), z.string()).optional(),
|
|
144
|
+
});
|
|
145
|
+
export const templateThumbnailInputSchema = z.object({
|
|
146
|
+
templateId: z.string().min(1),
|
|
147
|
+
version: z.number().int().min(1),
|
|
148
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const UI_LANGUAGES: readonly ["en", "es", "fr", "de", "pt", "it", "ja", "zh"];
|
|
3
|
+
export type UiLanguage = (typeof UI_LANGUAGES)[number];
|
|
4
|
+
/** `GET /me` (spec 05 §6.1). */
|
|
5
|
+
export interface Me {
|
|
6
|
+
userId: string;
|
|
7
|
+
email: string | null;
|
|
8
|
+
displayName: string | null;
|
|
9
|
+
avatarUrl: string | null;
|
|
10
|
+
locale: string;
|
|
11
|
+
uiLanguage: string;
|
|
12
|
+
timeZone: string;
|
|
13
|
+
siteAdmin: boolean;
|
|
14
|
+
personalWorkspaceId: string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
/** Set while an account deletion is scheduled (`DELETE /me`); `POST /me/restore` clears it. */
|
|
17
|
+
deletionScheduledFor?: string | null;
|
|
18
|
+
}
|
|
19
|
+
export declare const meUpdateSchema: z.ZodObject<{
|
|
20
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
21
|
+
avatarAssetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
23
|
+
uiLanguage: z.ZodOptional<z.ZodEnum<{
|
|
24
|
+
en: "en";
|
|
25
|
+
es: "es";
|
|
26
|
+
fr: "fr";
|
|
27
|
+
de: "de";
|
|
28
|
+
pt: "pt";
|
|
29
|
+
it: "it";
|
|
30
|
+
ja: "ja";
|
|
31
|
+
zh: "zh";
|
|
32
|
+
}>>;
|
|
33
|
+
timeZone: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type MeUpdateRequest = z.infer<typeof meUpdateSchema>;
|
package/dist/me/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const UI_LANGUAGES = [
|
|
3
|
+
'en',
|
|
4
|
+
'es',
|
|
5
|
+
'fr',
|
|
6
|
+
'de',
|
|
7
|
+
'pt',
|
|
8
|
+
'it',
|
|
9
|
+
'ja',
|
|
10
|
+
'zh',
|
|
11
|
+
];
|
|
12
|
+
export const meUpdateSchema = z.object({
|
|
13
|
+
displayName: z.string().trim().min(1).max(120).optional(),
|
|
14
|
+
avatarAssetId: z.string().nullable().optional(),
|
|
15
|
+
locale: z.string().min(2).max(35).optional(),
|
|
16
|
+
uiLanguage: z.enum(UI_LANGUAGES).optional(),
|
|
17
|
+
timeZone: z.string().min(1).max(64).optional(),
|
|
18
|
+
});
|