@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.
Files changed (65) hide show
  1. package/CLAUDE.md +50 -0
  2. package/README.md +34 -0
  3. package/dist/account/index.d.ts +440 -0
  4. package/dist/account/index.js +274 -0
  5. package/dist/admin/index.d.ts +95 -0
  6. package/dist/admin/index.js +20 -0
  7. package/dist/ai/index.d.ts +564 -0
  8. package/dist/ai/index.js +179 -0
  9. package/dist/api/envelope.d.ts +33 -0
  10. package/dist/api/envelope.js +140 -0
  11. package/dist/api/pagination.d.ts +7 -0
  12. package/dist/api/pagination.js +9 -0
  13. package/dist/api/routes.d.ts +273 -0
  14. package/dist/api/routes.js +306 -0
  15. package/dist/assets/index.d.ts +722 -0
  16. package/dist/assets/index.js +452 -0
  17. package/dist/collab/index.d.ts +214 -0
  18. package/dist/collab/index.js +211 -0
  19. package/dist/commands/index.d.ts +92 -0
  20. package/dist/commands/index.js +20 -0
  21. package/dist/credits/index.d.ts +26 -0
  22. package/dist/credits/index.js +7 -0
  23. package/dist/formats/index.d.ts +87 -0
  24. package/dist/formats/index.js +26 -0
  25. package/dist/ids/index.d.ts +2 -0
  26. package/dist/ids/index.js +2 -0
  27. package/dist/index.d.ts +33 -0
  28. package/dist/index.js +33 -0
  29. package/dist/io/index.d.ts +395 -0
  30. package/dist/io/index.js +161 -0
  31. package/dist/jobs/index.d.ts +278 -0
  32. package/dist/jobs/index.js +138 -0
  33. package/dist/keys/index.d.ts +53 -0
  34. package/dist/keys/index.js +22 -0
  35. package/dist/lifecycle/index.d.ts +263 -0
  36. package/dist/lifecycle/index.js +148 -0
  37. package/dist/me/index.d.ts +35 -0
  38. package/dist/me/index.js +18 -0
  39. package/dist/packets/index.d.ts +887 -0
  40. package/dist/packets/index.js +312 -0
  41. package/dist/projects/index.d.ts +201 -0
  42. package/dist/projects/index.js +75 -0
  43. package/dist/public/index.d.ts +95 -0
  44. package/dist/public/index.js +25 -0
  45. package/dist/reads/index.d.ts +387 -0
  46. package/dist/reads/index.js +118 -0
  47. package/dist/reports/index.d.ts +168 -0
  48. package/dist/reports/index.js +466 -0
  49. package/dist/sharing/index.d.ts +256 -0
  50. package/dist/sharing/index.js +91 -0
  51. package/dist/sync/codec.d.ts +7 -0
  52. package/dist/sync/codec.js +91 -0
  53. package/dist/sync/index.d.ts +382 -0
  54. package/dist/sync/index.js +262 -0
  55. package/dist/sync/permissions.d.ts +22 -0
  56. package/dist/sync/permissions.js +11 -0
  57. package/dist/templates/index.d.ts +1699 -0
  58. package/dist/templates/index.js +70 -0
  59. package/dist/tenancy/index.d.ts +116 -0
  60. package/dist/tenancy/index.js +102 -0
  61. package/dist/test/index.d.ts +8 -0
  62. package/dist/test/index.js +88 -0
  63. package/dist/versions/index.d.ts +335 -0
  64. package/dist/versions/index.js +107 -0
  65. package/package.json +62 -0
@@ -0,0 +1,335 @@
1
+ import { z } from 'zod';
2
+ /** Spec 03 §10.2 (canonical, kebab-case). */
3
+ export declare const SNAPSHOT_AUTO_REASONS: readonly ["pre-ai-polish", "pre-import", "pre-template", "pre-open", "pre-restore", "pre-cherry-pick-bulk", "pre-clear-revisions", "pre-delete-revision-set", "pre-unlock-all-pages", "pre-bulk-change-decision", "pre-account-transfer", "offline-edits", "access-revoked"];
4
+ export type SnapshotAutoReason = (typeof SNAPSHOT_AUTO_REASONS)[number];
5
+ /** The only reasons a client may send itself. */
6
+ export declare const CLIENT_AUTO_REASONS: readonly ["offline-edits", "access-revoked"];
7
+ export declare const SNAPSHOT_KINDS: readonly ["manual", "auto"];
8
+ export type SnapshotKind = (typeof SNAPSHOT_KINDS)[number];
9
+ export declare const VERSION_REASONS: readonly ["interval", "session-end", "pre-epoch", "pre-restore", "daily", "reconnect"];
10
+ export type VersionReason = (typeof VERSION_REASONS)[number];
11
+ export interface DocStats {
12
+ pages: number;
13
+ scenes: number;
14
+ words: number;
15
+ activeRevisionSetId?: string | null;
16
+ }
17
+ /** A row of `GET /documents/:did/versions` (spec 05 §6.10). */
18
+ export interface VersionPoint {
19
+ id: string;
20
+ createdAt: string;
21
+ contributors: string[];
22
+ stats: DocStats;
23
+ epoch: number;
24
+ reason: VersionReason;
25
+ }
26
+ /** Snapshot marker interleaved in the version list. */
27
+ export interface SnapshotMarker {
28
+ marker: 'snapshot';
29
+ snapshotId: string;
30
+ name: string;
31
+ createdAt: string;
32
+ }
33
+ export type VersionListItem = VersionPoint | SnapshotMarker;
34
+ export interface SnapshotSummary {
35
+ id: string;
36
+ documentId: string;
37
+ parentId: string | null;
38
+ name: string;
39
+ note: string | null;
40
+ kind: SnapshotKind;
41
+ autoReason: SnapshotAutoReason | null;
42
+ stats: DocStats;
43
+ createdBy: string | null;
44
+ createdOnDevice: string | null;
45
+ createdAt: string;
46
+ receivedAt: string;
47
+ forkedDocumentIds: string[];
48
+ hiddenForMe: boolean;
49
+ noteCount: number;
50
+ }
51
+ /** `GET /documents/:did/snapshots` */
52
+ export interface SnapshotListResponse {
53
+ liveParentSnapshotId: string | null;
54
+ snapshots: SnapshotSummary[];
55
+ }
56
+ export declare const snapshotCreateSchema: z.ZodObject<{
57
+ clientSnapshotId: z.ZodOptional<z.ZodString>;
58
+ name: z.ZodString;
59
+ note: z.ZodOptional<z.ZodString>;
60
+ kind: z.ZodOptional<z.ZodEnum<{
61
+ manual: "manual";
62
+ auto: "auto";
63
+ }>>;
64
+ autoReason: z.ZodOptional<z.ZodEnum<{
65
+ "pre-ai-polish": "pre-ai-polish";
66
+ "pre-import": "pre-import";
67
+ "pre-template": "pre-template";
68
+ "pre-open": "pre-open";
69
+ "pre-restore": "pre-restore";
70
+ "pre-cherry-pick-bulk": "pre-cherry-pick-bulk";
71
+ "pre-clear-revisions": "pre-clear-revisions";
72
+ "pre-delete-revision-set": "pre-delete-revision-set";
73
+ "pre-unlock-all-pages": "pre-unlock-all-pages";
74
+ "pre-bulk-change-decision": "pre-bulk-change-decision";
75
+ "pre-account-transfer": "pre-account-transfer";
76
+ "offline-edits": "offline-edits";
77
+ "access-revoked": "access-revoked";
78
+ }>>;
79
+ sourceEpoch: z.ZodOptional<z.ZodNumber>;
80
+ assumedParentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
81
+ createdAt: z.ZodOptional<z.ZodString>;
82
+ createdOnDevice: z.ZodOptional<z.ZodString>;
83
+ state: z.ZodOptional<z.ZodObject<{
84
+ uploadKey: z.ZodString;
85
+ }, z.core.$strip>>;
86
+ }, z.core.$strip>;
87
+ export type SnapshotCreateRequest = z.infer<typeof snapshotCreateSchema>;
88
+ export type SnapshotCreateResponse = SnapshotSummary & {
89
+ reparentedLive: boolean;
90
+ };
91
+ export type SnapshotDetail = SnapshotSummary & {
92
+ parentChain: SnapshotSummary[];
93
+ };
94
+ export declare const snapshotOpenSchema: z.ZodObject<{
95
+ confirm: z.ZodLiteral<true>;
96
+ dryRun: z.ZodOptional<z.ZodBoolean>;
97
+ }, z.core.$strip>;
98
+ export type SnapshotOpenRequest = z.infer<typeof snapshotOpenSchema>;
99
+ export declare const snapshotForkSchema: z.ZodObject<{
100
+ title: z.ZodString;
101
+ targetProjectId: z.ZodOptional<z.ZodString>;
102
+ }, z.core.$strip>;
103
+ export type SnapshotForkRequest = z.infer<typeof snapshotForkSchema>;
104
+ /** Where a read or compare takes its content from (spec 05 §6.7.1). */
105
+ export type SourceRef = {
106
+ kind: 'live';
107
+ documentId: string;
108
+ } | {
109
+ kind: 'snapshot';
110
+ snapshotId: string;
111
+ } | {
112
+ kind: 'version';
113
+ documentId: string;
114
+ versionId: string;
115
+ };
116
+ export declare const sourceRefSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
117
+ kind: z.ZodLiteral<"live">;
118
+ documentId: z.ZodString;
119
+ }, z.core.$strip>, z.ZodObject<{
120
+ kind: z.ZodLiteral<"snapshot">;
121
+ snapshotId: z.ZodString;
122
+ }, z.core.$strip>, z.ZodObject<{
123
+ kind: z.ZodLiteral<"version">;
124
+ documentId: z.ZodString;
125
+ versionId: z.ZodString;
126
+ }, z.core.$strip>], "kind">;
127
+ /** `POST /documents/:did/versions/:vid/snapshot` body. */
128
+ export interface VersionSnapshotRequest {
129
+ name: string;
130
+ note?: string;
131
+ }
132
+ /** `POST /documents/:did/versions/:vid/restore` (bumps the epoch). */
133
+ export interface VersionRestoreResponse {
134
+ document: import('../projects/index.js').DocumentMeta;
135
+ epoch: number;
136
+ preRestoreSnapshot: SnapshotSummary;
137
+ }
138
+ /** `POST /snapshots/:sid/open` (bumps the epoch). */
139
+ export interface SnapshotOpenResponse {
140
+ document: import('../projects/index.js').DocumentMeta;
141
+ epoch: number;
142
+ preOpenSnapshot: SnapshotSummary;
143
+ }
144
+ /** `POST /documents/:did/versions/:vid/restore-as-copy` (spec 05 §6.10). Response: `DocumentMeta`. */
145
+ export declare const versionRestoreAsCopySchema: z.ZodObject<{
146
+ title: z.ZodString;
147
+ targetProjectId: z.ZodOptional<z.ZodString>;
148
+ }, z.core.$strip>;
149
+ export type VersionRestoreAsCopyRequest = z.infer<typeof versionRestoreAsCopySchema>;
150
+ /** `PUT /snapshots/:sid/prefs`: per-user hide; the snapshot row never changes. */
151
+ export declare const snapshotPrefsSchema: z.ZodObject<{
152
+ hidden: z.ZodBoolean;
153
+ }, z.core.$strip>;
154
+ export type SnapshotPrefsRequest = z.infer<typeof snapshotPrefsSchema>;
155
+ export interface SnapshotPrefsResponse {
156
+ hidden: boolean;
157
+ }
158
+ export declare const SNAPSHOT_NOTES_MAX = 200;
159
+ export declare const snapshotNoteCreateSchema: z.ZodObject<{
160
+ body: z.ZodString;
161
+ }, z.core.$strip>;
162
+ export type SnapshotNoteCreateRequest = z.infer<typeof snapshotNoteCreateSchema>;
163
+ /** Append-only (spec 09 F-SNAP-009): there is no edit or delete route. */
164
+ export interface SnapshotNote {
165
+ id: string;
166
+ snapshotId: string;
167
+ body: string;
168
+ authorId: string | null;
169
+ createdAt: string;
170
+ }
171
+ export declare const snapshotCommentAnchorSchema: z.ZodObject<{
172
+ elementId: z.ZodString;
173
+ offset: z.ZodNumber;
174
+ length: z.ZodNumber;
175
+ }, z.core.$strip>;
176
+ export type SnapshotCommentAnchor = z.infer<typeof snapshotCommentAnchorSchema>;
177
+ export declare const snapshotCommentCreateSchema: z.ZodObject<{
178
+ anchor: z.ZodObject<{
179
+ elementId: z.ZodString;
180
+ offset: z.ZodNumber;
181
+ length: z.ZodNumber;
182
+ }, z.core.$strip>;
183
+ body: z.ZodString;
184
+ mentions: z.ZodOptional<z.ZodArray<z.ZodString>>;
185
+ }, z.core.$strip>;
186
+ export type SnapshotCommentCreateRequest = z.infer<typeof snapshotCommentCreateSchema>;
187
+ export declare const snapshotCommentResolveSchema: z.ZodObject<{
188
+ resolved: z.ZodBoolean;
189
+ }, z.core.$strip>;
190
+ export type SnapshotCommentResolveRequest = z.infer<typeof snapshotCommentResolveSchema>;
191
+ /** A review comment on an immutable snapshot (R6). */
192
+ export interface SnapshotComment {
193
+ id: string;
194
+ snapshotId: string;
195
+ anchor: SnapshotCommentAnchor;
196
+ body: string;
197
+ mentions: string[];
198
+ authorId: string | null;
199
+ viaLinkId: string | null;
200
+ resolvedAt: string | null;
201
+ resolvedBy: string | null;
202
+ copiedToLiveNoteId: string | null;
203
+ createdAt: string;
204
+ }
205
+ export declare const snapshotCommentsQuerySchema: z.ZodObject<{
206
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
207
+ cursor: z.ZodOptional<z.ZodString>;
208
+ }, z.core.$strip>;
209
+ export interface CopyToLiveResponse {
210
+ noteId: string;
211
+ }
212
+ export declare const COMPARE_GRANULARITIES: readonly ["scene", "element", "word"];
213
+ export declare const TRACKED_CHANGE_MODES: readonly ["accept-all", "reject-all", "as-marked"];
214
+ export declare const compareRequestSchema: z.ZodObject<{
215
+ base: z.ZodDiscriminatedUnion<[z.ZodObject<{
216
+ kind: z.ZodLiteral<"live">;
217
+ documentId: z.ZodString;
218
+ }, z.core.$strip>, z.ZodObject<{
219
+ kind: z.ZodLiteral<"snapshot">;
220
+ snapshotId: z.ZodString;
221
+ }, z.core.$strip>, z.ZodObject<{
222
+ kind: z.ZodLiteral<"version">;
223
+ documentId: z.ZodString;
224
+ versionId: z.ZodString;
225
+ }, z.core.$strip>], "kind">;
226
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
227
+ kind: z.ZodLiteral<"live">;
228
+ documentId: z.ZodString;
229
+ }, z.core.$strip>, z.ZodObject<{
230
+ kind: z.ZodLiteral<"snapshot">;
231
+ snapshotId: z.ZodString;
232
+ }, z.core.$strip>, z.ZodObject<{
233
+ kind: z.ZodLiteral<"version">;
234
+ documentId: z.ZodString;
235
+ versionId: z.ZodString;
236
+ }, z.core.$strip>], "kind">;
237
+ granularity: z.ZodDefault<z.ZodEnum<{
238
+ scene: "scene";
239
+ element: "element";
240
+ word: "word";
241
+ }>>;
242
+ ignoreFormatting: z.ZodDefault<z.ZodBoolean>;
243
+ ignoreRevisionMarks: z.ZodDefault<z.ZodBoolean>;
244
+ ignoreTrackedChanges: z.ZodDefault<z.ZodEnum<{
245
+ "accept-all": "accept-all";
246
+ "reject-all": "reject-all";
247
+ "as-marked": "as-marked";
248
+ }>>;
249
+ }, z.core.$strip>;
250
+ export type CompareRequest = z.input<typeof compareRequestSchema>;
251
+ /** Above this many combined pages a compare is refused (spec 05 returns a `doc.compare` job; no runner exists, so 413 `COMPARE_TOO_LARGE`). */
252
+ export declare const COMPARE_MAX_PAGES = 400;
253
+ export type WordOp = {
254
+ op: 'equal' | 'insert' | 'delete';
255
+ text: string;
256
+ };
257
+ export type ElementDiffStatus = 'unchanged' | 'modified' | 'added' | 'removed' | 'moved' | 'restyled';
258
+ export interface ElementDiff {
259
+ status: ElementDiffStatus;
260
+ baseElementId?: string;
261
+ targetElementId?: string;
262
+ alignment: 'id' | 'text';
263
+ styleChange?: {
264
+ from: string;
265
+ to: string;
266
+ };
267
+ /** `modified`: only formatting (marks) changed, the words are equal. */
268
+ formattingOnly?: boolean;
269
+ /** Plain text of the side(s), so a client can render a row without loading either document. */
270
+ baseText?: string;
271
+ targetText?: string;
272
+ /** `granularity: "word"`, modified elements only. */
273
+ words?: WordOp[];
274
+ }
275
+ export type SceneDiffStatus = 'unchanged' | 'modified' | 'added' | 'removed' | 'moved' | 'moved-modified';
276
+ export interface SceneDiff {
277
+ status: SceneDiffStatus;
278
+ baseSceneId?: string;
279
+ targetSceneId?: string;
280
+ alignment: 'id' | 'fuzzy';
281
+ similarity?: number;
282
+ heading?: string;
283
+ /** Empty at `granularity: "scene"`. */
284
+ elements: ElementDiff[];
285
+ }
286
+ export interface BeatDiff {
287
+ status: 'unchanged' | 'modified' | 'added' | 'removed';
288
+ id: string;
289
+ baseTitle?: string;
290
+ targetTitle?: string;
291
+ }
292
+ export interface EntityDiff {
293
+ status: 'unchanged' | 'modified' | 'added' | 'removed';
294
+ id: string;
295
+ kind?: string;
296
+ baseName?: string;
297
+ targetName?: string;
298
+ }
299
+ export interface DocumentDiff {
300
+ scenes: SceneDiff[];
301
+ titlePage: ElementDiff[];
302
+ beats: BeatDiff[];
303
+ entities: EntityDiff[];
304
+ summary: {
305
+ scenesAdded: number;
306
+ scenesRemoved: number;
307
+ scenesModified: number;
308
+ scenesMoved: number;
309
+ wordsAdded: number;
310
+ wordsRemoved: number;
311
+ pageDelta: number;
312
+ };
313
+ }
314
+ /** `GET /documents/:did/elements/:elementId/history`: newest first (spec 03 §14). */
315
+ export declare const elementHistoryQuerySchema: z.ZodObject<{
316
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
317
+ cursor: z.ZodOptional<z.ZodString>;
318
+ }, z.core.$strip>;
319
+ export interface ElementHistoryEntry {
320
+ at: string;
321
+ authors: string[];
322
+ text: string;
323
+ source: 'update' | 'version';
324
+ }
325
+ /** `GET /documents/:did/presence`: who has the document open on this API instance right now. */
326
+ export interface PresenceEntry {
327
+ userId: string;
328
+ displayName: string | null;
329
+ colour: string;
330
+ since: string;
331
+ deviceId: string | null;
332
+ deviceName: string | null;
333
+ mode: 'edit' | 'view';
334
+ role: string;
335
+ }
@@ -0,0 +1,107 @@
1
+ import { z } from 'zod';
2
+ import { cursorQuerySchema } from '../api/pagination.js';
3
+ /** Spec 03 §10.2 (canonical, kebab-case). */
4
+ export const SNAPSHOT_AUTO_REASONS = [
5
+ 'pre-ai-polish',
6
+ 'pre-import',
7
+ 'pre-template',
8
+ 'pre-open',
9
+ 'pre-restore',
10
+ 'pre-cherry-pick-bulk',
11
+ 'pre-clear-revisions',
12
+ 'pre-delete-revision-set',
13
+ 'pre-unlock-all-pages',
14
+ 'pre-bulk-change-decision',
15
+ 'pre-account-transfer',
16
+ 'offline-edits',
17
+ 'access-revoked',
18
+ ];
19
+ /** The only reasons a client may send itself. */
20
+ export const CLIENT_AUTO_REASONS = ['offline-edits', 'access-revoked'];
21
+ export const SNAPSHOT_KINDS = ['manual', 'auto'];
22
+ export const VERSION_REASONS = [
23
+ 'interval',
24
+ 'session-end',
25
+ 'pre-epoch',
26
+ 'pre-restore',
27
+ 'daily',
28
+ 'reconnect',
29
+ ];
30
+ export const snapshotCreateSchema = z.object({
31
+ /** Idempotency key, unique per document. */
32
+ clientSnapshotId: z.string().min(1).max(64).optional(),
33
+ name: z.string().trim().min(1).max(120),
34
+ note: z.string().max(2000).optional(),
35
+ kind: z.enum(SNAPSHOT_KINDS).optional(),
36
+ autoReason: z.enum(SNAPSHOT_AUTO_REASONS).optional(),
37
+ sourceEpoch: z.number().int().min(0).optional(),
38
+ assumedParentId: z.string().nullable().optional(),
39
+ createdAt: z.string().optional(),
40
+ createdOnDevice: z.string().max(200).optional(),
41
+ /**
42
+ * Client-provided state for offline creation (spec 03 §10.2, spec 05 §6.11): exactly what the writer saw, uploaded through
43
+ * `POST /uploads/state`. With it, `sourceEpoch` may be older than the live epoch (an offline-edits snapshot after an epoch bump).
44
+ */
45
+ state: z.object({ uploadKey: z.string().min(1).max(128) }).optional(),
46
+ });
47
+ export const snapshotOpenSchema = z.object({
48
+ confirm: z.literal(true),
49
+ dryRun: z.boolean().optional(),
50
+ });
51
+ export const snapshotForkSchema = z.object({
52
+ title: z.string().trim().min(1).max(200),
53
+ targetProjectId: z.string().optional(),
54
+ });
55
+ export const sourceRefSchema = z.discriminatedUnion('kind', [
56
+ z.object({ kind: z.literal('live'), documentId: z.string() }),
57
+ z.object({ kind: z.literal('snapshot'), snapshotId: z.string() }),
58
+ z.object({
59
+ kind: z.literal('version'),
60
+ documentId: z.string(),
61
+ versionId: z.string(),
62
+ }),
63
+ ]);
64
+ // ─── B15: restore-as-copy, prefs, notes, comments, compare, history, presence ────────────────────────────────────
65
+ /** `POST /documents/:did/versions/:vid/restore-as-copy` (spec 05 §6.10). Response: `DocumentMeta`. */
66
+ export const versionRestoreAsCopySchema = z.object({
67
+ title: z.string().trim().min(1).max(200),
68
+ targetProjectId: z.string().optional(),
69
+ });
70
+ /** `PUT /snapshots/:sid/prefs`: per-user hide; the snapshot row never changes. */
71
+ export const snapshotPrefsSchema = z.object({ hidden: z.boolean() });
72
+ export const SNAPSHOT_NOTES_MAX = 200;
73
+ export const snapshotNoteCreateSchema = z.object({
74
+ body: z.string().trim().min(1).max(2000),
75
+ });
76
+ export const snapshotCommentAnchorSchema = z.object({
77
+ elementId: z.string().min(1),
78
+ offset: z.number().int().min(0),
79
+ length: z.number().int().min(0),
80
+ });
81
+ export const snapshotCommentCreateSchema = z.object({
82
+ anchor: snapshotCommentAnchorSchema,
83
+ body: z.string().trim().min(1).max(10_000),
84
+ /** User ids mentioned in the body (notifications are B12). */
85
+ mentions: z.array(z.string().min(1)).max(50).optional(),
86
+ });
87
+ export const snapshotCommentResolveSchema = z.object({ resolved: z.boolean() });
88
+ export const snapshotCommentsQuerySchema = cursorQuerySchema;
89
+ // Compare (spec 03 §11.1)
90
+ export const COMPARE_GRANULARITIES = ['scene', 'element', 'word'];
91
+ export const TRACKED_CHANGE_MODES = [
92
+ 'accept-all',
93
+ 'reject-all',
94
+ 'as-marked',
95
+ ];
96
+ export const compareRequestSchema = z.object({
97
+ base: sourceRefSchema,
98
+ target: sourceRefSchema,
99
+ granularity: z.enum(COMPARE_GRANULARITIES).default('element'),
100
+ ignoreFormatting: z.boolean().default(false),
101
+ ignoreRevisionMarks: z.boolean().default(false),
102
+ ignoreTrackedChanges: z.enum(TRACKED_CHANGE_MODES).default('as-marked'),
103
+ });
104
+ /** Above this many combined pages a compare is refused (spec 05 returns a `doc.compare` job; no runner exists, so 413 `COMPARE_TOO_LARGE`). */
105
+ export const COMPARE_MAX_PAGES = 400;
106
+ /** `GET /documents/:did/elements/:elementId/history`: newest first (spec 03 §14). */
107
+ export const elementHistoryQuerySchema = cursorQuerySchema;
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@sudobility/screenwriter_types",
3
+ "version": "0.1.1",
4
+ "description": "Shared TypeScript types and Zod schemas for the Fadewright frontend and backend",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./test": {
14
+ "types": "./dist/test/index.d.ts",
15
+ "import": "./dist/test/index.js"
16
+ },
17
+ "./keys": {
18
+ "types": "./dist/keys/index.d.ts",
19
+ "import": "./dist/keys/index.js"
20
+ }
21
+ },
22
+ "scripts": {
23
+ "build": "tsc -p tsconfig.esm.json",
24
+ "clean": "rimraf dist",
25
+ "test:unit": "vitest run",
26
+ "test:watch": "vitest",
27
+ "lint": "eslint src",
28
+ "format": "prettier --write \"src/**/*.ts\"",
29
+ "typecheck": "tsc --noEmit"
30
+ },
31
+ "files": [
32
+ "dist/**/*",
33
+ "CLAUDE.md"
34
+ ],
35
+ "author": "Sudobility",
36
+ "license": "BUSL-1.1",
37
+ "dependencies": {
38
+ "@sudobility/types": "^1.9.67",
39
+ "@sudobility/writing_core": "^0.1.2",
40
+ "lib0": "0.2.117",
41
+ "zod": "^4.6.5"
42
+ },
43
+ "devDependencies": {
44
+ "@eslint/js": "^9.38.0",
45
+ "@typescript-eslint/eslint-plugin": "^8.46.2",
46
+ "@typescript-eslint/parser": "^8.46.2",
47
+ "eslint": "^9.38.0",
48
+ "eslint-config-prettier": "^10.1.8",
49
+ "eslint-plugin-prettier": "^5.5.5",
50
+ "prettier": "^3.6.2",
51
+ "rimraf": "^6.0.1",
52
+ "typescript": "^5.9.3",
53
+ "vitest": "^4.0.15"
54
+ },
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "https://github.com/johnqh/screenwriter_types.git"
61
+ }
62
+ }