@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
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# screenwriter_types
|
|
2
|
+
|
|
3
|
+
Shared TypeScript types and Zod v4 schemas for Fadewright (frontend and backend). Platform-free ESM: no DOM, no Node built-ins, no clock reads. Consumers import from the package root only (plus `/test` for fixtures).
|
|
4
|
+
|
|
5
|
+
## Stack
|
|
6
|
+
|
|
7
|
+
TypeScript, Zod v4, Vitest, Bun. Depends on `@sudobility/writing_core` for ids, `DOCUMENT_KINDS` and `TemplateCategory`; `@sudobility/types` (B17, resolved from npm like any ordinary dependency — a stable, general-purpose types package, not a sibling under co-development) for the generic consumables shapes `src/credits/` re-exports.
|
|
8
|
+
|
|
9
|
+
## Structure
|
|
10
|
+
|
|
11
|
+
- `src/api/` envelope (`successResponse`, `errorResponse`, `API_ERROR_CODES`, `ERROR_STATUS`, `Paginated`), `cursorQuerySchema`, `API_ROUTES`
|
|
12
|
+
- `src/ids/` re-exports from writing_core
|
|
13
|
+
- `src/tenancy/`, `projects/`, `me/`, `templates/`, `versions/`, `commands/` DTOs and request schemas. `tenancy/` also holds the role/permission matrix (`PERMISSION_MIN_ROLE`, `ROLE_PERMISSIONS`, `hasPermission`, `roleAtLeast`, `maxRole`, `minRole`, `requiredRoleFor`; spec 05 §5.2)
|
|
14
|
+
- `src/sharing/` (B8) workspace/member/invitation/grant/share-link/lock DTOs and Zod request schemas (spec 05 §5.4, §6.2-6.4, §8.3)
|
|
15
|
+
- `src/ai/` spec 06 AI: `AI_TASKS`, `AI_LIMITS`, model-output Zod schemas per ShapeShyft endpoint (`AI_ENDPOINT_OUTPUT_SCHEMAS`, all-required and closed so `z.toJSONSchema` gives the stored endpoint schema), `CoverageReport`, job and suggestion-set DTOs. (B17) `AI_CONSENT_VERSION`, consent/estimate/activity/report DTOs, `suggestionDecideSchema`
|
|
16
|
+
- `src/credits/` (B17) a thin re-export of `@sudobility/types`' generic consumables shapes (the ledger itself is `@sudobility/consumables_service`'s, never redefined here) plus `CreditProduct` and the purchase-handoff request/response (spec 05 §6.20-6.21)
|
|
17
|
+
- `src/reads/` (B10) `?source=` schemas (`sourceParamSchema`, `docSourceSchema`), entity/tag/note/beat/bin/revision/change/stats/shot read DTOs (`EntityUsage`...), locator types (`ResolveResult`) and search schemas/hits
|
|
18
|
+
- `src/reports/` (B10) `REPORT_KINDS` (18), `REPORT_DEFS` (options and columns per kind, until writing_core owns them: spec 09 R25), `parseReportOptions`, `ReportResult`/`ReportTable`, `reportToCsv`
|
|
19
|
+
- `src/packets/` (B10) `scenePacketSchema`, `characterPacketSchema`, `locationPacketSchema`, `shotPacketSchema` (spec 11 §7; what MCP consumes) and `packetQuerySchema`
|
|
20
|
+
- `src/account/` (B13) `userPreferencesSchema` (closed at the top level, `USER_PREFERENCES_VERSION`, `baseUpdatedAt` PUT variant), dictionary, macro, writing session/stats/goal, `documentViewStateSchema` (`my-state`), account delete/export DTOs and limits
|
|
21
|
+
- `src/lifecycle/` (B14) project folders (`FOLDER_MAX_DEPTH` 8), purge/duplicate/move/apply-template DTOs, trash and workspace-documents queries (`TRASH_RETENTION_DAYS` 30, `TrashItem`), Shared Bin (`ProjectBinItem`, 2 MiB cap), `WorkspaceDefaults` (+ `baseUpdatedAt` PUT), contacts, and the job input schemas (`project.duplicate`, `doc.applyTemplate`, `template.thumbnail`, `system.purge`). `templates/` also holds template create/version/update/import/export DTOs (`TEMPLATE_FILE_FORMATS`, `.fwtemplate` envelope constants); `projects/` has `PROJECT_KINDS`, `documentLabelsSchema` and `DocumentListQuery.order`
|
|
22
|
+
- `src/io/` (B16) upload/import/export/watermark DTOs: `uploadStateRequestSchema`, `importCreateSchema` (`targetProjectId` xor `templateTarget`), `importOverSchema`, `importOptionsSchema`, `exportCreateSchema`, `exportCombinedSchema`, `batchWatermarkSchema`, `watermarkLookupSchema`, job input schemas (`import.*`, `doc.importOver`, `export.*`/`watermark.batch`), `JOB_IMPORT_FORMATS`/`JOB_EXPORT_FORMATS` (what writing_formats has), `EXPORT_CODE_PREFIX` `FWX-`; `templateImportByIdSchema` is in `templates/`
|
|
23
|
+
- `src/sync/` spec 03 frame schemas, message codes, close codes; `permissions.ts` the commenter write matrix as data (`COMMENTER_WRITABLE_KEYS`, `isCommenterMark`, `markPermissionsFor`)
|
|
24
|
+
- `src/public/` (B18, spec 05 §6.21, §6.24) `PublicConfig`, `NamesDbEntry`/`NamesDbResponse`, `DeepHealthResponse`, `WatermarkedDownloadInfo`, `purchaseHandoffRedeemSchema`, `telemetryRequestSchema`/`telemetryEventSchema`/`clientErrorReportSchema`
|
|
25
|
+
- `src/admin/` (B18, spec 05 §6.23) `AdminUserLookup`, `adminJobListQuerySchema` (a hand-written `AdminJobListQuery` interface sits beside it — `z.input<>` of the `.extend()`-derived schema resolved `limit` to `{}` under this repo's tsconfig for reasons not fully tracked down; avoided rather than chased), `adminJobKindPatchSchema`, `AdminJobKind`, `adminJobRefundSchema`, `AdminUserPurgeResponse` (documents why the route is a bounded schedule-and-revoke, not a real data purge)
|
|
26
|
+
- `src/test/` fixture factories (`makeWorkspace`, `makeProject`, `makeDocumentMeta`, `makeSnapshotSummary`)
|
|
27
|
+
- `src/index.ts` the barrel
|
|
28
|
+
|
|
29
|
+
## Commands
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
bun install
|
|
33
|
+
bunx tsc --noEmit # typecheck
|
|
34
|
+
bunx vitest run # smoke tests (never `bun test`)
|
|
35
|
+
bun run lint
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Local-path rule (no publishing)
|
|
39
|
+
|
|
40
|
+
`@sudobility/writing_core` resolves by path to the sibling repo: `tsconfig.json` `paths` and a `vitest.config.ts` alias both point at `../writing_core/src/index.ts`. Do not publish or bump versions. `bun run build` does not work in this mode (writing_core sits outside `rootDir`); downstream repos import `src` directly by path.
|
|
41
|
+
|
|
42
|
+
## Notes
|
|
43
|
+
|
|
44
|
+
- Envelope is `{success, data}` or `{success:false, error, code, details?}`, with no timestamp (no clock in this package).
|
|
45
|
+
- `ping` and `pong` share message code 4.
|
|
46
|
+
- Spec source: screenwriter_plans specs 05 (§1.1, §6, §10, §12) and 03 (§2).
|
|
47
|
+
|
|
48
|
+
## Related
|
|
49
|
+
|
|
50
|
+
`writing_core`, `screenwriter_api`, `screenwriter_client`, `screenwriter_lib`, `screenwriter_plans`
|
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @sudobility/screenwriter_types
|
|
2
|
+
|
|
3
|
+
Shared TypeScript types and Zod schemas for the Fadewright screenwriting app, used by both the frontend and the backend.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- API envelope helpers, error codes, cursor pagination, and a route table
|
|
8
|
+
- Workspace, project, document, template, version and snapshot types
|
|
9
|
+
- Request schemas (projects, documents, snapshots, commands, `/me`)
|
|
10
|
+
- Sync WebSocket frame schemas and close codes
|
|
11
|
+
- Fixture factories under `@sudobility/screenwriter_types/test`
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { successResponse, errorResponse, documentCreateSchema } from '@sudobility/screenwriter_types';
|
|
17
|
+
|
|
18
|
+
const body = documentCreateSchema.parse({ title: 'Draft', kind: 'script' });
|
|
19
|
+
return successResponse(body);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Development
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
bun install
|
|
26
|
+
bunx tsc --noEmit
|
|
27
|
+
bunx vitest run
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This package currently resolves `@sudobility/writing_core` from a sibling checkout by path and is not published.
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
BUSL-1.1
|
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Account and per-user data (slice B13; spec 05 §6.1, §6.1.1, §6.26, §8.1, §17).
|
|
4
|
+
* Everything here belongs to one user: preferences, spelling dictionary, macros, writing sessions, stats, goals, the
|
|
5
|
+
* per-document view state (`my-state`) and stars. All are user-only routes (an API key gets 403 `API_KEY_FORBIDDEN`),
|
|
6
|
+
* except the macro list, which a key may read.
|
|
7
|
+
*/
|
|
8
|
+
export declare const USER_PREFERENCES_VERSION = 1;
|
|
9
|
+
/** Serialised size cap of `PUT /me/preferences` (`LIMIT_EXCEEDED`). */
|
|
10
|
+
export declare const USER_PREFERENCES_MAX_BYTES: number;
|
|
11
|
+
export declare const AUTOCORRECT_MAX_PAIRS = 5000;
|
|
12
|
+
export declare const RECENT_SEARCHES_MAX = 20;
|
|
13
|
+
export declare const DEVICE_CLASSES: readonly ["phone", "tablet", "desktop"];
|
|
14
|
+
export type DeviceClass = (typeof DEVICE_CLASSES)[number];
|
|
15
|
+
/**
|
|
16
|
+
* `UserPreferences`: one JSON document per user, closed at the top level (an unknown top-level key is `VALIDATION`),
|
|
17
|
+
* open inside each section. `version` is `USER_PREFERENCES_VERSION`; a higher version from a newer client is stored as is.
|
|
18
|
+
*/
|
|
19
|
+
export declare const userPreferencesSchema: z.ZodObject<{
|
|
20
|
+
version: z.ZodDefault<z.ZodNumber>;
|
|
21
|
+
appearance: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
theme: z.ZodOptional<z.ZodEnum<{
|
|
23
|
+
light: "light";
|
|
24
|
+
system: "system";
|
|
25
|
+
dark: "dark";
|
|
26
|
+
}>>;
|
|
27
|
+
pageTheme: z.ZodOptional<z.ZodEnum<{
|
|
28
|
+
custom: "custom";
|
|
29
|
+
paper: "paper";
|
|
30
|
+
night: "night";
|
|
31
|
+
midnight: "midnight";
|
|
32
|
+
sepia: "sepia";
|
|
33
|
+
}>>;
|
|
34
|
+
custom: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
35
|
+
density: z.ZodOptional<z.ZodString>;
|
|
36
|
+
largeIcons: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
+
reducedMotion: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
}, z.core.$loose>>;
|
|
39
|
+
editor: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
40
|
+
deviceClasses: z.ZodOptional<z.ZodObject<{
|
|
41
|
+
phone: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
42
|
+
tablet: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
43
|
+
desktop: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
44
|
+
}, z.core.$strict>>;
|
|
45
|
+
keymap: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
preset: z.ZodOptional<z.ZodEnum<{
|
|
47
|
+
fadewright: "fadewright";
|
|
48
|
+
finalDraft: "finalDraft";
|
|
49
|
+
fadeIn: "fadeIn";
|
|
50
|
+
}>>;
|
|
51
|
+
overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
|
|
52
|
+
byPlatform: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
53
|
+
}, z.core.$loose>>;
|
|
54
|
+
autocorrect: z.ZodOptional<z.ZodObject<{
|
|
55
|
+
options: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
56
|
+
pairs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
57
|
+
from: z.ZodString;
|
|
58
|
+
to: z.ZodString;
|
|
59
|
+
}, z.core.$strip>>>;
|
|
60
|
+
}, z.core.$loose>>;
|
|
61
|
+
language: z.ZodOptional<z.ZodObject<{
|
|
62
|
+
scriptDefault: z.ZodOptional<z.ZodString>;
|
|
63
|
+
installedDictionaries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
64
|
+
ignoreLists: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
65
|
+
lookups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
66
|
+
label: z.ZodString;
|
|
67
|
+
url: z.ZodString;
|
|
68
|
+
}, z.core.$strip>>>;
|
|
69
|
+
}, z.core.$loose>>;
|
|
70
|
+
tableRead: z.ZodOptional<z.ZodObject<{
|
|
71
|
+
narratorVoiceByLanguage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{}, z.core.$loose>>>;
|
|
72
|
+
rate: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
actors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
74
|
+
id: z.ZodString;
|
|
75
|
+
name: z.ZodString;
|
|
76
|
+
}, z.core.$loose>>>;
|
|
77
|
+
}, z.core.$loose>>;
|
|
78
|
+
toolbar: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
79
|
+
recentSearches: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
80
|
+
revisionColourSets: z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
81
|
+
offline: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
82
|
+
}, z.core.$strict>;
|
|
83
|
+
export type UserPreferences = z.output<typeof userPreferencesSchema>;
|
|
84
|
+
export type UserPreferencesInput = z.input<typeof userPreferencesSchema>;
|
|
85
|
+
export declare const USER_PREFERENCES_KEYS: readonly ["version", "appearance", "editor", "deviceClasses", "keymap", "autocorrect", "language", "tableRead", "toolbar", "recentSearches", "revisionColourSets", "offline"];
|
|
86
|
+
/** `GET /me/preferences` (and `details.current` of a `STALE_WRITE`): the document plus its optimistic-concurrency token. */
|
|
87
|
+
export type UserPreferencesResponse = UserPreferences & {
|
|
88
|
+
updatedAt: string;
|
|
89
|
+
};
|
|
90
|
+
/** `PUT /me/preferences`: a whole-document replace; `baseUpdatedAt` is the `updatedAt` of the last GET/PUT. */
|
|
91
|
+
export declare const userPreferencesPutSchema: z.ZodObject<{
|
|
92
|
+
version: z.ZodDefault<z.ZodNumber>;
|
|
93
|
+
appearance: z.ZodOptional<z.ZodObject<{
|
|
94
|
+
theme: z.ZodOptional<z.ZodEnum<{
|
|
95
|
+
light: "light";
|
|
96
|
+
system: "system";
|
|
97
|
+
dark: "dark";
|
|
98
|
+
}>>;
|
|
99
|
+
pageTheme: z.ZodOptional<z.ZodEnum<{
|
|
100
|
+
custom: "custom";
|
|
101
|
+
paper: "paper";
|
|
102
|
+
night: "night";
|
|
103
|
+
midnight: "midnight";
|
|
104
|
+
sepia: "sepia";
|
|
105
|
+
}>>;
|
|
106
|
+
custom: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
107
|
+
density: z.ZodOptional<z.ZodString>;
|
|
108
|
+
largeIcons: z.ZodOptional<z.ZodBoolean>;
|
|
109
|
+
reducedMotion: z.ZodOptional<z.ZodBoolean>;
|
|
110
|
+
}, z.core.$loose>>;
|
|
111
|
+
editor: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
112
|
+
deviceClasses: z.ZodOptional<z.ZodObject<{
|
|
113
|
+
phone: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
114
|
+
tablet: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
115
|
+
desktop: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
116
|
+
}, z.core.$strict>>;
|
|
117
|
+
keymap: z.ZodOptional<z.ZodObject<{
|
|
118
|
+
preset: z.ZodOptional<z.ZodEnum<{
|
|
119
|
+
fadewright: "fadewright";
|
|
120
|
+
finalDraft: "finalDraft";
|
|
121
|
+
fadeIn: "fadeIn";
|
|
122
|
+
}>>;
|
|
123
|
+
overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
|
|
124
|
+
byPlatform: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
125
|
+
}, z.core.$loose>>;
|
|
126
|
+
autocorrect: z.ZodOptional<z.ZodObject<{
|
|
127
|
+
options: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
128
|
+
pairs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
129
|
+
from: z.ZodString;
|
|
130
|
+
to: z.ZodString;
|
|
131
|
+
}, z.core.$strip>>>;
|
|
132
|
+
}, z.core.$loose>>;
|
|
133
|
+
language: z.ZodOptional<z.ZodObject<{
|
|
134
|
+
scriptDefault: z.ZodOptional<z.ZodString>;
|
|
135
|
+
installedDictionaries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
136
|
+
ignoreLists: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
137
|
+
lookups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
138
|
+
label: z.ZodString;
|
|
139
|
+
url: z.ZodString;
|
|
140
|
+
}, z.core.$strip>>>;
|
|
141
|
+
}, z.core.$loose>>;
|
|
142
|
+
tableRead: z.ZodOptional<z.ZodObject<{
|
|
143
|
+
narratorVoiceByLanguage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{}, z.core.$loose>>>;
|
|
144
|
+
rate: z.ZodOptional<z.ZodNumber>;
|
|
145
|
+
actors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
146
|
+
id: z.ZodString;
|
|
147
|
+
name: z.ZodString;
|
|
148
|
+
}, z.core.$loose>>>;
|
|
149
|
+
}, z.core.$loose>>;
|
|
150
|
+
toolbar: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
151
|
+
recentSearches: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
152
|
+
revisionColourSets: z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
153
|
+
offline: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
154
|
+
baseUpdatedAt: z.ZodString;
|
|
155
|
+
}, z.core.$strict>;
|
|
156
|
+
export type UserPreferencesPutRequest = z.input<typeof userPreferencesPutSchema>;
|
|
157
|
+
export interface UserPreferencesPutResponse {
|
|
158
|
+
updatedAt: string;
|
|
159
|
+
}
|
|
160
|
+
export declare const DICTIONARY_MAX_WORDS = 50000;
|
|
161
|
+
export declare const dictionaryUpdateSchema: z.ZodObject<{
|
|
162
|
+
add: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
163
|
+
remove: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
export type DictionaryUpdateRequest = z.infer<typeof dictionaryUpdateSchema>;
|
|
166
|
+
export interface DictionaryResponse {
|
|
167
|
+
words: string[];
|
|
168
|
+
}
|
|
169
|
+
export interface DictionaryUpdateResponse {
|
|
170
|
+
count: number;
|
|
171
|
+
}
|
|
172
|
+
export declare const USER_MACRO_MAX = 500;
|
|
173
|
+
export declare const MACRO_TRIGGER_KINDS: readonly ["shortcut", "alias"];
|
|
174
|
+
/** Create: every option defaulted. */
|
|
175
|
+
declare const macroOptionsSchema: z.ZodObject<{
|
|
176
|
+
smartReplace: z.ZodDefault<z.ZodBoolean>;
|
|
177
|
+
confirm: z.ZodDefault<z.ZodBoolean>;
|
|
178
|
+
wordOnly: z.ZodDefault<z.ZodBoolean>;
|
|
179
|
+
matchCase: z.ZodDefault<z.ZodBoolean>;
|
|
180
|
+
activeInStyles: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
181
|
+
}, z.core.$strip>;
|
|
182
|
+
export declare const userMacroSchema: z.ZodObject<{
|
|
183
|
+
name: z.ZodString;
|
|
184
|
+
trigger: z.ZodObject<{
|
|
185
|
+
kind: z.ZodEnum<{
|
|
186
|
+
shortcut: "shortcut";
|
|
187
|
+
alias: "alias";
|
|
188
|
+
}>;
|
|
189
|
+
value: z.ZodString;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
insertText: z.ZodString;
|
|
192
|
+
setElementStyle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
193
|
+
nextElementStyle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
194
|
+
options: z.ZodPrefault<z.ZodObject<{
|
|
195
|
+
smartReplace: z.ZodDefault<z.ZodBoolean>;
|
|
196
|
+
confirm: z.ZodDefault<z.ZodBoolean>;
|
|
197
|
+
wordOnly: z.ZodDefault<z.ZodBoolean>;
|
|
198
|
+
matchCase: z.ZodDefault<z.ZodBoolean>;
|
|
199
|
+
activeInStyles: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
200
|
+
}, z.core.$strip>>;
|
|
201
|
+
}, z.core.$strip>;
|
|
202
|
+
export type UserMacroCreateRequest = z.input<typeof userMacroSchema>;
|
|
203
|
+
/** `PATCH /me/macros/:mid`: any subset; `options` and `trigger` merge into the stored ones. */
|
|
204
|
+
export declare const userMacroPatchSchema: z.ZodObject<{
|
|
205
|
+
name: z.ZodOptional<z.ZodString>;
|
|
206
|
+
trigger: z.ZodOptional<z.ZodObject<{
|
|
207
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
208
|
+
shortcut: "shortcut";
|
|
209
|
+
alias: "alias";
|
|
210
|
+
}>>;
|
|
211
|
+
value: z.ZodOptional<z.ZodString>;
|
|
212
|
+
}, z.core.$strip>>;
|
|
213
|
+
insertText: z.ZodOptional<z.ZodString>;
|
|
214
|
+
setElementStyle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
215
|
+
nextElementStyle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
216
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
217
|
+
smartReplace: z.ZodOptional<z.ZodBoolean>;
|
|
218
|
+
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
219
|
+
wordOnly: z.ZodOptional<z.ZodBoolean>;
|
|
220
|
+
matchCase: z.ZodOptional<z.ZodBoolean>;
|
|
221
|
+
activeInStyles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
222
|
+
}, z.core.$strip>>;
|
|
223
|
+
}, z.core.$strip>;
|
|
224
|
+
export type UserMacroPatchRequest = z.input<typeof userMacroPatchSchema>;
|
|
225
|
+
export interface UserMacro {
|
|
226
|
+
id: string;
|
|
227
|
+
name: string;
|
|
228
|
+
trigger: {
|
|
229
|
+
kind: (typeof MACRO_TRIGGER_KINDS)[number];
|
|
230
|
+
value: string;
|
|
231
|
+
};
|
|
232
|
+
insertText: string;
|
|
233
|
+
setElementStyle: string | null;
|
|
234
|
+
nextElementStyle: string | null;
|
|
235
|
+
options: z.output<typeof macroOptionsSchema>;
|
|
236
|
+
createdAt: string;
|
|
237
|
+
updatedAt: string;
|
|
238
|
+
}
|
|
239
|
+
export interface DeleteResponse {
|
|
240
|
+
deleted: true;
|
|
241
|
+
}
|
|
242
|
+
export declare const WRITING_GOAL_KINDS: readonly ["wordsPerDay", "pagesPerDay", "minutesPerDay", "wordsPerWeek", "documentTarget"];
|
|
243
|
+
export type WritingGoalKind = (typeof WRITING_GOAL_KINDS)[number];
|
|
244
|
+
export declare const WRITING_GOALS_MAX = 50;
|
|
245
|
+
export declare const WRITING_STATS_GRANULARITIES: readonly ["day", "week", "month", "year"];
|
|
246
|
+
export type WritingStatsGranularity = (typeof WRITING_STATS_GRANULARITIES)[number];
|
|
247
|
+
/**
|
|
248
|
+
* `POST /me/writing-sessions`. `clientSessionId` is the row id (`wss_...`, made by the client) and makes the upload
|
|
249
|
+
* idempotent: a repeat is accepted and changes nothing, so a device may retry and may upload offline sessions later.
|
|
250
|
+
*/
|
|
251
|
+
export declare const writingSessionSchema: z.ZodObject<{
|
|
252
|
+
clientSessionId: z.ZodString;
|
|
253
|
+
documentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
254
|
+
startedAt: z.ZodISODateTime;
|
|
255
|
+
endedAt: z.ZodISODateTime;
|
|
256
|
+
activeSeconds: z.ZodNumber;
|
|
257
|
+
wordsAdded: z.ZodNumber;
|
|
258
|
+
wordsRemoved: z.ZodNumber;
|
|
259
|
+
netPagesEighths: z.ZodNumber;
|
|
260
|
+
sprint: z.ZodOptional<z.ZodObject<{
|
|
261
|
+
targetWords: z.ZodOptional<z.ZodNumber>;
|
|
262
|
+
targetMinutes: z.ZodOptional<z.ZodNumber>;
|
|
263
|
+
}, z.core.$strip>>;
|
|
264
|
+
}, z.core.$strip>;
|
|
265
|
+
export type WritingSessionRequest = z.input<typeof writingSessionSchema>;
|
|
266
|
+
export interface WritingSessionResponse {
|
|
267
|
+
accepted: true;
|
|
268
|
+
}
|
|
269
|
+
/** `GET /me/writing-stats`: dates are calendar days in the user's time zone (`users.time_zone`). Defaults: the last 30 days by day. */
|
|
270
|
+
export declare const writingStatsQuerySchema: z.ZodObject<{
|
|
271
|
+
from: z.ZodOptional<z.ZodString>;
|
|
272
|
+
to: z.ZodOptional<z.ZodString>;
|
|
273
|
+
granularity: z.ZodDefault<z.ZodEnum<{
|
|
274
|
+
day: "day";
|
|
275
|
+
week: "week";
|
|
276
|
+
month: "month";
|
|
277
|
+
year: "year";
|
|
278
|
+
}>>;
|
|
279
|
+
documentId: z.ZodOptional<z.ZodString>;
|
|
280
|
+
}, z.core.$strip>;
|
|
281
|
+
export type WritingStatsQuery = z.input<typeof writingStatsQuerySchema>;
|
|
282
|
+
export interface WritingStatsBucket {
|
|
283
|
+
/** `YYYY-MM-DD`: the first day of the day/week (Monday)/month/year, in the user's time zone. */
|
|
284
|
+
start: string;
|
|
285
|
+
wordsAdded: number;
|
|
286
|
+
wordsRemoved: number;
|
|
287
|
+
/** `netPagesEighths / 8`. */
|
|
288
|
+
netPages: number;
|
|
289
|
+
activeSeconds: number;
|
|
290
|
+
}
|
|
291
|
+
/** A day counts when the user added words on it (over all documents, in their time zone). Today does not break a streak until it ends. */
|
|
292
|
+
export interface StreakSummary {
|
|
293
|
+
current: number;
|
|
294
|
+
longest: number;
|
|
295
|
+
/** `YYYY-MM-DD` of the latest day with words, or null. */
|
|
296
|
+
lastActiveDate: string | null;
|
|
297
|
+
activeToday: boolean;
|
|
298
|
+
}
|
|
299
|
+
export interface WritingStats {
|
|
300
|
+
buckets: WritingStatsBucket[];
|
|
301
|
+
streak: StreakSummary;
|
|
302
|
+
}
|
|
303
|
+
export declare const writingGoalInputSchema: z.ZodObject<{
|
|
304
|
+
id: z.ZodOptional<z.ZodString>;
|
|
305
|
+
kind: z.ZodEnum<{
|
|
306
|
+
wordsPerDay: "wordsPerDay";
|
|
307
|
+
pagesPerDay: "pagesPerDay";
|
|
308
|
+
minutesPerDay: "minutesPerDay";
|
|
309
|
+
wordsPerWeek: "wordsPerWeek";
|
|
310
|
+
documentTarget: "documentTarget";
|
|
311
|
+
}>;
|
|
312
|
+
documentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
313
|
+
target: z.ZodNumber;
|
|
314
|
+
daysOfWeek: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
315
|
+
idleTimeoutSec: z.ZodOptional<z.ZodNumber>;
|
|
316
|
+
}, z.core.$strip>;
|
|
317
|
+
/** `PUT /me/writing-goals`: the whole list. A goal missing from it is deleted; one without `id` is created. `daysOfWeek`: 0 = Sunday. */
|
|
318
|
+
/** No `.max` here on purpose: more than `WRITING_GOALS_MAX` is 409 `LIMIT_EXCEEDED` from the server, not `VALIDATION`. */
|
|
319
|
+
export declare const writingGoalsPutSchema: z.ZodObject<{
|
|
320
|
+
goals: z.ZodArray<z.ZodObject<{
|
|
321
|
+
id: z.ZodOptional<z.ZodString>;
|
|
322
|
+
kind: z.ZodEnum<{
|
|
323
|
+
wordsPerDay: "wordsPerDay";
|
|
324
|
+
pagesPerDay: "pagesPerDay";
|
|
325
|
+
minutesPerDay: "minutesPerDay";
|
|
326
|
+
wordsPerWeek: "wordsPerWeek";
|
|
327
|
+
documentTarget: "documentTarget";
|
|
328
|
+
}>;
|
|
329
|
+
documentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
330
|
+
target: z.ZodNumber;
|
|
331
|
+
daysOfWeek: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
332
|
+
idleTimeoutSec: z.ZodOptional<z.ZodNumber>;
|
|
333
|
+
}, z.core.$strip>>;
|
|
334
|
+
}, z.core.$strip>;
|
|
335
|
+
export type WritingGoalsPutRequest = z.input<typeof writingGoalsPutSchema>;
|
|
336
|
+
export interface WritingGoal {
|
|
337
|
+
id: string;
|
|
338
|
+
kind: WritingGoalKind;
|
|
339
|
+
documentId: string | null;
|
|
340
|
+
target: number;
|
|
341
|
+
daysOfWeek: number[] | null;
|
|
342
|
+
idleTimeoutSec: number | null;
|
|
343
|
+
createdAt: string;
|
|
344
|
+
updatedAt: string;
|
|
345
|
+
}
|
|
346
|
+
export declare const ACCOUNT_DELETE_CONFIRM = "DELETE";
|
|
347
|
+
export declare const accountDeleteSchema: z.ZodObject<{
|
|
348
|
+
confirm: z.ZodLiteral<"DELETE">;
|
|
349
|
+
}, z.core.$strip>;
|
|
350
|
+
export type AccountDeleteRequest = z.infer<typeof accountDeleteSchema>;
|
|
351
|
+
export interface AccountDeleteResponse {
|
|
352
|
+
deletionScheduledFor: string;
|
|
353
|
+
}
|
|
354
|
+
export interface AccountRestoreResponse {
|
|
355
|
+
restored: true;
|
|
356
|
+
}
|
|
357
|
+
/** `account.export` job input: none. The output is `fadewright-export.zip`. */
|
|
358
|
+
export declare const accountExportInputSchema: z.ZodDefault<z.ZodObject<{}, z.core.$strip>>;
|
|
359
|
+
export declare const ACCOUNT_EXPORT_FILENAME = "fadewright-export.zip";
|
|
360
|
+
export declare const DOCUMENT_VIEW_STATE_MAX_BYTES: number;
|
|
361
|
+
/**
|
|
362
|
+
* Cross-device view state of one document for one user: Navigator tabs and columns, split layout, view mode and zoom per
|
|
363
|
+
* device class. Caret, selection, undo history and the Beat Board viewport stay device-local. Every key optional: the
|
|
364
|
+
* client merges per top-level key.
|
|
365
|
+
*/
|
|
366
|
+
export declare const documentViewStateSchema: z.ZodObject<{
|
|
367
|
+
navigator: z.ZodOptional<z.ZodObject<{
|
|
368
|
+
tabs: z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
369
|
+
activeTab: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
370
|
+
}, z.core.$loose>>;
|
|
371
|
+
layout: z.ZodOptional<z.ZodObject<{
|
|
372
|
+
split: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>;
|
|
373
|
+
panes: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
374
|
+
}, z.core.$loose>>;
|
|
375
|
+
views: z.ZodOptional<z.ZodObject<{
|
|
376
|
+
phone: z.ZodOptional<z.ZodObject<{
|
|
377
|
+
view: z.ZodOptional<z.ZodString>;
|
|
378
|
+
zoom: z.ZodOptional<z.ZodNumber>;
|
|
379
|
+
invisibles: z.ZodOptional<z.ZodBoolean>;
|
|
380
|
+
ruler: z.ZodOptional<z.ZodBoolean>;
|
|
381
|
+
}, z.core.$loose>>;
|
|
382
|
+
tablet: z.ZodOptional<z.ZodObject<{
|
|
383
|
+
view: z.ZodOptional<z.ZodString>;
|
|
384
|
+
zoom: z.ZodOptional<z.ZodNumber>;
|
|
385
|
+
invisibles: z.ZodOptional<z.ZodBoolean>;
|
|
386
|
+
ruler: z.ZodOptional<z.ZodBoolean>;
|
|
387
|
+
}, z.core.$loose>>;
|
|
388
|
+
desktop: z.ZodOptional<z.ZodObject<{
|
|
389
|
+
view: z.ZodOptional<z.ZodString>;
|
|
390
|
+
zoom: z.ZodOptional<z.ZodNumber>;
|
|
391
|
+
invisibles: z.ZodOptional<z.ZodBoolean>;
|
|
392
|
+
ruler: z.ZodOptional<z.ZodBoolean>;
|
|
393
|
+
}, z.core.$loose>>;
|
|
394
|
+
}, z.core.$strict>>;
|
|
395
|
+
}, z.core.$strict>;
|
|
396
|
+
export type DocumentViewState = z.output<typeof documentViewStateSchema>;
|
|
397
|
+
/** `GET /documents/:did/my-state`: `{}` until first saved, then the state plus `updatedAt`. */
|
|
398
|
+
export type DocumentViewStateResponse = DocumentViewState & {
|
|
399
|
+
updatedAt?: string;
|
|
400
|
+
};
|
|
401
|
+
/** `PUT`: the whole state; `baseUpdatedAt` is the `updatedAt` last read (null or absent when the GET returned `{}`). */
|
|
402
|
+
export declare const documentViewStatePutSchema: z.ZodObject<{
|
|
403
|
+
navigator: z.ZodOptional<z.ZodObject<{
|
|
404
|
+
tabs: z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
405
|
+
activeTab: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
406
|
+
}, z.core.$loose>>;
|
|
407
|
+
layout: z.ZodOptional<z.ZodObject<{
|
|
408
|
+
split: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>;
|
|
409
|
+
panes: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
410
|
+
}, z.core.$loose>>;
|
|
411
|
+
views: z.ZodOptional<z.ZodObject<{
|
|
412
|
+
phone: z.ZodOptional<z.ZodObject<{
|
|
413
|
+
view: z.ZodOptional<z.ZodString>;
|
|
414
|
+
zoom: z.ZodOptional<z.ZodNumber>;
|
|
415
|
+
invisibles: z.ZodOptional<z.ZodBoolean>;
|
|
416
|
+
ruler: z.ZodOptional<z.ZodBoolean>;
|
|
417
|
+
}, z.core.$loose>>;
|
|
418
|
+
tablet: z.ZodOptional<z.ZodObject<{
|
|
419
|
+
view: z.ZodOptional<z.ZodString>;
|
|
420
|
+
zoom: z.ZodOptional<z.ZodNumber>;
|
|
421
|
+
invisibles: z.ZodOptional<z.ZodBoolean>;
|
|
422
|
+
ruler: z.ZodOptional<z.ZodBoolean>;
|
|
423
|
+
}, z.core.$loose>>;
|
|
424
|
+
desktop: z.ZodOptional<z.ZodObject<{
|
|
425
|
+
view: z.ZodOptional<z.ZodString>;
|
|
426
|
+
zoom: z.ZodOptional<z.ZodNumber>;
|
|
427
|
+
invisibles: z.ZodOptional<z.ZodBoolean>;
|
|
428
|
+
ruler: z.ZodOptional<z.ZodBoolean>;
|
|
429
|
+
}, z.core.$loose>>;
|
|
430
|
+
}, z.core.$strict>>;
|
|
431
|
+
baseUpdatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
432
|
+
}, z.core.$strict>;
|
|
433
|
+
export type DocumentViewStatePutRequest = z.input<typeof documentViewStatePutSchema>;
|
|
434
|
+
export interface DocumentViewStatePutResponse {
|
|
435
|
+
updatedAt: string;
|
|
436
|
+
}
|
|
437
|
+
export interface StarResponse {
|
|
438
|
+
starred: boolean;
|
|
439
|
+
}
|
|
440
|
+
export {};
|