things-api 0.5.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/LICENSE +21 -0
- package/README.md +77 -0
- package/bin/things.js +9 -0
- package/dist/audit/log.d.ts +10 -0
- package/dist/audit/log.js +31 -0
- package/dist/audit/log.js.map +1 -0
- package/dist/audit/schema.d.ts +37 -0
- package/dist/audit/schema.js +9 -0
- package/dist/audit/schema.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +9 -0
- package/dist/cli/commands/doctor.js +60 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/mcp.d.ts +7 -0
- package/dist/cli/commands/mcp.js +26 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/project.d.ts +5 -0
- package/dist/cli/commands/project.js +50 -0
- package/dist/cli/commands/project.js.map +1 -0
- package/dist/cli/commands/reads.d.ts +21 -0
- package/dist/cli/commands/reads.js +295 -0
- package/dist/cli/commands/reads.js.map +1 -0
- package/dist/cli/commands/snapshot.d.ts +7 -0
- package/dist/cli/commands/snapshot.js +22 -0
- package/dist/cli/commands/snapshot.js.map +1 -0
- package/dist/cli/commands/todo.d.ts +6 -0
- package/dist/cli/commands/todo.js +43 -0
- package/dist/cli/commands/todo.js.map +1 -0
- package/dist/cli/commands/writes.d.ts +9 -0
- package/dist/cli/commands/writes.js +994 -0
- package/dist/cli/commands/writes.js.map +1 -0
- package/dist/cli/exit-codes.d.ts +26 -0
- package/dist/cli/exit-codes.js +26 -0
- package/dist/cli/exit-codes.js.map +1 -0
- package/dist/cli/main.d.ts +4 -0
- package/dist/cli/main.js +73 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/output.d.ts +42 -0
- package/dist/cli/output.js +16 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli/style.d.ts +6 -0
- package/dist/cli/style.js +25 -0
- package/dist/cli/style.js.map +1 -0
- package/dist/client.d.ts +184 -0
- package/dist/client.js +187 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +31 -0
- package/dist/config.js +76 -0
- package/dist/config.js.map +1 -0
- package/dist/contracts.d.ts +79 -0
- package/dist/contracts.js +46 -0
- package/dist/contracts.js.map +1 -0
- package/dist/db/baselines/db-v26.d.ts +8 -0
- package/dist/db/baselines/db-v26.js +16 -0
- package/dist/db/baselines/db-v26.js.map +1 -0
- package/dist/db/baselines/index.d.ts +3 -0
- package/dist/db/baselines/index.js +4 -0
- package/dist/db/baselines/index.js.map +1 -0
- package/dist/db/connection.d.ts +22 -0
- package/dist/db/connection.js +40 -0
- package/dist/db/connection.js.map +1 -0
- package/dist/db/fingerprint.d.ts +42 -0
- package/dist/db/fingerprint.js +82 -0
- package/dist/db/fingerprint.js.map +1 -0
- package/dist/db/locate.d.ts +13 -0
- package/dist/db/locate.js +44 -0
- package/dist/db/locate.js.map +1 -0
- package/dist/db/schema.d.ts +37 -0
- package/dist/db/schema.js +81 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/diagnose.d.ts +67 -0
- package/dist/diagnose.js +143 -0
- package/dist/diagnose.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/server.d.ts +8 -0
- package/dist/mcp/server.js +1002 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/model/dates.d.ts +38 -0
- package/dist/model/dates.js +104 -0
- package/dist/model/dates.js.map +1 -0
- package/dist/model/entities.d.ts +117 -0
- package/dist/model/entities.js +21 -0
- package/dist/model/entities.js.map +1 -0
- package/dist/model/mappers.d.ts +55 -0
- package/dist/model/mappers.js +105 -0
- package/dist/model/mappers.js.map +1 -0
- package/dist/model/occurrences.d.ts +46 -0
- package/dist/model/occurrences.js +164 -0
- package/dist/model/occurrences.js.map +1 -0
- package/dist/model/recurrence.d.ts +52 -0
- package/dist/model/recurrence.js +164 -0
- package/dist/model/recurrence.js.map +1 -0
- package/dist/paths.d.ts +6 -0
- package/dist/paths.js +30 -0
- package/dist/paths.js.map +1 -0
- package/dist/read/detail.d.ts +8 -0
- package/dist/read/detail.js +34 -0
- package/dist/read/detail.js.map +1 -0
- package/dist/read/project-view.d.ts +34 -0
- package/dist/read/project-view.js +87 -0
- package/dist/read/project-view.js.map +1 -0
- package/dist/read/queries.d.ts +39 -0
- package/dist/read/queries.js +134 -0
- package/dist/read/queries.js.map +1 -0
- package/dist/read/snapshot.d.ts +25 -0
- package/dist/read/snapshot.js +39 -0
- package/dist/read/snapshot.js.map +1 -0
- package/dist/read/tags.d.ts +17 -0
- package/dist/read/tags.js +64 -0
- package/dist/read/tags.js.map +1 -0
- package/dist/read/views.d.ts +152 -0
- package/dist/read/views.js +322 -0
- package/dist/read/views.js.map +1 -0
- package/dist/surface-copy.d.ts +15 -0
- package/dist/surface-copy.js +16 -0
- package/dist/surface-copy.js.map +1 -0
- package/dist/write/automation-probe.d.ts +12 -0
- package/dist/write/automation-probe.js +59 -0
- package/dist/write/automation-probe.js.map +1 -0
- package/dist/write/batch.d.ts +51 -0
- package/dist/write/batch.js +97 -0
- package/dist/write/batch.js.map +1 -0
- package/dist/write/capabilities.d.ts +16 -0
- package/dist/write/capabilities.js +16 -0
- package/dist/write/capabilities.js.map +1 -0
- package/dist/write/commands.d.ts +32 -0
- package/dist/write/commands.js +1274 -0
- package/dist/write/commands.js.map +1 -0
- package/dist/write/environment.d.ts +29 -0
- package/dist/write/environment.js +105 -0
- package/dist/write/environment.js.map +1 -0
- package/dist/write/experimental.d.ts +7 -0
- package/dist/write/experimental.js +39 -0
- package/dist/write/experimental.js.map +1 -0
- package/dist/write/failure-hints.d.ts +32 -0
- package/dist/write/failure-hints.js +71 -0
- package/dist/write/failure-hints.js.map +1 -0
- package/dist/write/guards.d.ts +21 -0
- package/dist/write/guards.js +312 -0
- package/dist/write/guards.js.map +1 -0
- package/dist/write/lock.d.ts +10 -0
- package/dist/write/lock.js +70 -0
- package/dist/write/lock.js.map +1 -0
- package/dist/write/operations.d.ts +262 -0
- package/dist/write/operations.js +34 -0
- package/dist/write/operations.js.map +1 -0
- package/dist/write/pipeline.d.ts +90 -0
- package/dist/write/pipeline.js +375 -0
- package/dist/write/pipeline.js.map +1 -0
- package/dist/write/planner.d.ts +40 -0
- package/dist/write/planner.js +57 -0
- package/dist/write/planner.js.map +1 -0
- package/dist/write/pre-state.d.ts +125 -0
- package/dist/write/pre-state.js +299 -0
- package/dist/write/pre-state.js.map +1 -0
- package/dist/write/reopen.d.ts +29 -0
- package/dist/write/reopen.js +63 -0
- package/dist/write/reopen.js.map +1 -0
- package/dist/write/reorder.d.ts +19 -0
- package/dist/write/reorder.js +285 -0
- package/dist/write/reorder.js.map +1 -0
- package/dist/write/undo.d.ts +53 -0
- package/dist/write/undo.js +703 -0
- package/dist/write/undo.js.map +1 -0
- package/dist/write/vectors/applescript.d.ts +5 -0
- package/dist/write/vectors/applescript.js +216 -0
- package/dist/write/vectors/applescript.js.map +1 -0
- package/dist/write/vectors/registry.d.ts +2 -0
- package/dist/write/vectors/registry.js +11 -0
- package/dist/write/vectors/registry.js.map +1 -0
- package/dist/write/vectors/types.d.ts +48 -0
- package/dist/write/vectors/types.js +2 -0
- package/dist/write/vectors/types.js.map +1 -0
- package/dist/write/vectors/url-scheme.d.ts +3 -0
- package/dist/write/vectors/url-scheme.js +176 -0
- package/dist/write/vectors/url-scheme.js.map +1 -0
- package/dist/write/verify/delta.d.ts +126 -0
- package/dist/write/verify/delta.js +281 -0
- package/dist/write/verify/delta.js.map +1 -0
- package/dist/write/verify/poller.d.ts +24 -0
- package/dist/write/verify/poller.js +28 -0
- package/dist/write/verify/poller.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operation catalog: every mutation the write layer can express, plus the
|
|
3
|
+
* typed parameter shapes. Vector support for each operation lives in the
|
|
4
|
+
* per-vector matrices (data, produced by the lab), not here.
|
|
5
|
+
*/
|
|
6
|
+
import type { IsoDate, ReminderTime } from "../model/dates.ts";
|
|
7
|
+
export declare const OPERATION_KINDS: readonly ["todo.add", "todo.update", "todo.complete", "todo.cancel", "todo.reopen", "todo.move", "todo.set-tags", "todo.replace-checklist", "todo.delete", "project.add", "project.update", "project.complete", "project.delete", "area.add", "area.delete", "tag.add", "tag.delete", "trash.empty", "reorder", "todo.duplicate", "area.update", "tag.update", "project.move", "todo.restore", "project.duplicate", "project.cancel", "project.reopen", "project.restore", "project.set-tags", "todo.backdate", "todo.add-logged"];
|
|
8
|
+
export type OperationKind = (typeof OPERATION_KINDS)[number];
|
|
9
|
+
/** `when` scheduling value: list keyword or a concrete date. */
|
|
10
|
+
export type WhenValue = "today" | "evening" | "anytime" | "someday" | IsoDate;
|
|
11
|
+
/** Container reference by uuid or (unique, case-insensitive) title. */
|
|
12
|
+
export interface ContainerRef {
|
|
13
|
+
uuid?: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface TodoAddParams {
|
|
17
|
+
title: string;
|
|
18
|
+
notes?: string;
|
|
19
|
+
when?: WhenValue;
|
|
20
|
+
/**
|
|
21
|
+
* Time-of-day reminder, `HH:mm` 24h. Requires a schedulable `when`
|
|
22
|
+
* (today, evening, or a date) in the same call.
|
|
23
|
+
*/
|
|
24
|
+
reminder?: ReminderTime;
|
|
25
|
+
deadline?: IsoDate;
|
|
26
|
+
tags?: string[];
|
|
27
|
+
checklistItems?: string[];
|
|
28
|
+
project?: ContainerRef;
|
|
29
|
+
area?: ContainerRef;
|
|
30
|
+
/** Existing heading inside the target project (placement only). */
|
|
31
|
+
heading?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface TodoUpdateParams {
|
|
34
|
+
uuid: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
notes?: string;
|
|
37
|
+
/** Append to the existing notes (newline-joined). Exclusive with notes/prependNotes. */
|
|
38
|
+
appendNotes?: string;
|
|
39
|
+
/** Prepend to the existing notes (newline-joined). Exclusive with notes/appendNotes. */
|
|
40
|
+
prependNotes?: string;
|
|
41
|
+
when?: WhenValue;
|
|
42
|
+
/**
|
|
43
|
+
* `HH:mm` sets a reminder (requires when: today|evening in the same call);
|
|
44
|
+
* null clears it (today/evening only — a dated reminder can only be
|
|
45
|
+
* changed, not cleared). When re-scheduling with this OMITTED, an existing
|
|
46
|
+
* reminder is auto-preserved.
|
|
47
|
+
*/
|
|
48
|
+
reminder?: ReminderTime | null;
|
|
49
|
+
deadline?: IsoDate | null;
|
|
50
|
+
}
|
|
51
|
+
export interface UuidParams {
|
|
52
|
+
uuid: string;
|
|
53
|
+
}
|
|
54
|
+
export interface TodoBackdateParams {
|
|
55
|
+
uuid: string;
|
|
56
|
+
/**
|
|
57
|
+
* Rewrite the completion timestamp to noon (local) on this date. The
|
|
58
|
+
* to-do must already be completed or canceled.
|
|
59
|
+
*/
|
|
60
|
+
completionDate?: IsoDate;
|
|
61
|
+
/** Rewrite the creation timestamp to noon (local) on this date. */
|
|
62
|
+
creationDate?: IsoDate;
|
|
63
|
+
}
|
|
64
|
+
export interface TodoAddLoggedParams {
|
|
65
|
+
title: string;
|
|
66
|
+
notes?: string;
|
|
67
|
+
/** The completion timestamp the created row carries (logged in the past). */
|
|
68
|
+
completionDate: IsoDate;
|
|
69
|
+
/** Optional backdated creation timestamp (must be <= completionDate). */
|
|
70
|
+
creationDate?: IsoDate;
|
|
71
|
+
}
|
|
72
|
+
export interface TodoMoveParams {
|
|
73
|
+
uuid: string;
|
|
74
|
+
project?: ContainerRef;
|
|
75
|
+
area?: ContainerRef;
|
|
76
|
+
/** Existing heading inside the destination project. */
|
|
77
|
+
heading?: string;
|
|
78
|
+
/** Move back to the Inbox — removes any schedule. Exclusive with the others. */
|
|
79
|
+
inbox?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Detach from the current project/area/heading, keeping the schedule and
|
|
82
|
+
* everything else. Exclusive with the others.
|
|
83
|
+
*/
|
|
84
|
+
detach?: boolean;
|
|
85
|
+
}
|
|
86
|
+
export interface TodoSetTagsParams {
|
|
87
|
+
uuid: string;
|
|
88
|
+
/** Full replacement set (an empty list clears all tags). */
|
|
89
|
+
tags: string[];
|
|
90
|
+
}
|
|
91
|
+
/** One checklist item in a stateful replacement. */
|
|
92
|
+
export interface ChecklistItemSpec {
|
|
93
|
+
title: string;
|
|
94
|
+
/** Recreate the item pre-checked. */
|
|
95
|
+
completed?: boolean;
|
|
96
|
+
}
|
|
97
|
+
export interface TodoReplaceChecklistParams {
|
|
98
|
+
uuid: string;
|
|
99
|
+
/**
|
|
100
|
+
* Full replacement list. Plain strings recreate items unchecked; object
|
|
101
|
+
* entries can recreate items pre-checked. Item uuids are NOT stable
|
|
102
|
+
* across a rewrite.
|
|
103
|
+
*/
|
|
104
|
+
items: (string | ChecklistItemSpec)[];
|
|
105
|
+
}
|
|
106
|
+
export interface ProjectAddParams {
|
|
107
|
+
title: string;
|
|
108
|
+
notes?: string;
|
|
109
|
+
area?: ContainerRef;
|
|
110
|
+
when?: WhenValue;
|
|
111
|
+
deadline?: IsoDate;
|
|
112
|
+
todos?: string[];
|
|
113
|
+
}
|
|
114
|
+
export interface ProjectUpdateParams {
|
|
115
|
+
uuid: string;
|
|
116
|
+
title?: string;
|
|
117
|
+
notes?: string;
|
|
118
|
+
/** Append to the existing notes (newline-joined). Exclusive with notes/prependNotes. */
|
|
119
|
+
appendNotes?: string;
|
|
120
|
+
/** Prepend to the existing notes (newline-joined). Exclusive with notes/appendNotes. */
|
|
121
|
+
prependNotes?: string;
|
|
122
|
+
when?: WhenValue;
|
|
123
|
+
/**
|
|
124
|
+
* `HH:mm` sets a reminder (requires when: today|evening|YYYY-MM-DD in the
|
|
125
|
+
* same call); null clears it (today/evening only — a dated reminder can
|
|
126
|
+
* only be changed, not cleared). Same semantics as to-do reminders.
|
|
127
|
+
*/
|
|
128
|
+
reminder?: ReminderTime | null;
|
|
129
|
+
deadline?: IsoDate | null;
|
|
130
|
+
}
|
|
131
|
+
export interface ProjectSetTagsParams {
|
|
132
|
+
uuid: string;
|
|
133
|
+
/** Full replacement set (an empty list clears all tags). */
|
|
134
|
+
tags: string[];
|
|
135
|
+
}
|
|
136
|
+
export interface ProjectMoveParams {
|
|
137
|
+
uuid: string;
|
|
138
|
+
/** Destination area (uuid or unique name). */
|
|
139
|
+
area?: ContainerRef;
|
|
140
|
+
/** Detach from the current area. Exclusive with area. */
|
|
141
|
+
detach?: boolean;
|
|
142
|
+
}
|
|
143
|
+
export interface ProjectCompleteParams {
|
|
144
|
+
uuid: string;
|
|
145
|
+
/**
|
|
146
|
+
* Open-children policy — REQUIRED, no default: completing a project also
|
|
147
|
+
* completes its open children.
|
|
148
|
+
*/
|
|
149
|
+
children: "require-resolved" | "auto-complete";
|
|
150
|
+
}
|
|
151
|
+
export interface ProjectCancelParams {
|
|
152
|
+
uuid: string;
|
|
153
|
+
/**
|
|
154
|
+
* Open-children policy — REQUIRED, no default: canceling a project also
|
|
155
|
+
* cancels its open children; completed children are untouched.
|
|
156
|
+
*/
|
|
157
|
+
children: "require-resolved" | "auto-cancel";
|
|
158
|
+
}
|
|
159
|
+
export interface AreaAddParams {
|
|
160
|
+
title: string;
|
|
161
|
+
tags?: string[];
|
|
162
|
+
}
|
|
163
|
+
export interface TagAddParams {
|
|
164
|
+
title: string;
|
|
165
|
+
/** Existing parent tag title to nest under. */
|
|
166
|
+
parent?: string;
|
|
167
|
+
}
|
|
168
|
+
export interface NameOrUuidParams {
|
|
169
|
+
/** uuid or unique case-insensitive title. */
|
|
170
|
+
target: string;
|
|
171
|
+
}
|
|
172
|
+
export interface AreaUpdateParams {
|
|
173
|
+
/** uuid or unique case-insensitive title. */
|
|
174
|
+
target: string;
|
|
175
|
+
title?: string;
|
|
176
|
+
/** Full replacement set of EXISTING tag titles. */
|
|
177
|
+
tags?: string[];
|
|
178
|
+
}
|
|
179
|
+
export interface TagUpdateParams {
|
|
180
|
+
/** uuid or unique case-insensitive title. */
|
|
181
|
+
target: string;
|
|
182
|
+
title?: string;
|
|
183
|
+
/** Existing tag to nest under. Exclusive with unnest. */
|
|
184
|
+
parent?: string;
|
|
185
|
+
/** Un-nest the tag to the root of the hierarchy. Exclusive with parent. */
|
|
186
|
+
unnest?: boolean;
|
|
187
|
+
/** Single character to bind. Exclusive with clearShortcut. */
|
|
188
|
+
shortcut?: string;
|
|
189
|
+
/** Remove the tag's keyboard shortcut. Exclusive with shortcut. */
|
|
190
|
+
clearShortcut?: boolean;
|
|
191
|
+
}
|
|
192
|
+
export type ReorderScope = "today" | "evening" | "project" | "area" | "inbox" | "headings" | "someday" | "projects";
|
|
193
|
+
export type ReorderStrategy = "native" | "bounce";
|
|
194
|
+
export interface ReorderParams {
|
|
195
|
+
scope: ReorderScope;
|
|
196
|
+
/**
|
|
197
|
+
* Required for project/area/headings scopes (headings: the project whose
|
|
198
|
+
* heading rows are being reordered); must be omitted for
|
|
199
|
+
* today/evening/inbox/someday/projects.
|
|
200
|
+
*/
|
|
201
|
+
container?: ContainerRef;
|
|
202
|
+
/**
|
|
203
|
+
* Desired order, top-first. May be a SUBSET of the scope's members: the
|
|
204
|
+
* requested uuids are placed at the top in this order and every remaining
|
|
205
|
+
* member keeps its current relative order below them.
|
|
206
|
+
*/
|
|
207
|
+
uuids: string[];
|
|
208
|
+
/**
|
|
209
|
+
* Omit for the default per scope: native for today/project/area/inbox/
|
|
210
|
+
* headings/someday (requires allowExperimental), bounce for evening and
|
|
211
|
+
* projects. Today accepts an explicit "bounce" fallback; evening is
|
|
212
|
+
* bounce-only; "projects" (top-level sidebar order) is bounce-only — each
|
|
213
|
+
* project takes a when=someday -> when=anytime round-trip, which
|
|
214
|
+
* front-inserts it (P8e).
|
|
215
|
+
*/
|
|
216
|
+
strategy?: ReorderStrategy;
|
|
217
|
+
}
|
|
218
|
+
export type EmptyParams = Record<string, never>;
|
|
219
|
+
export interface OperationParamsMap {
|
|
220
|
+
"todo.add": TodoAddParams;
|
|
221
|
+
"todo.update": TodoUpdateParams;
|
|
222
|
+
"todo.complete": UuidParams;
|
|
223
|
+
"todo.cancel": UuidParams;
|
|
224
|
+
"todo.reopen": UuidParams;
|
|
225
|
+
"todo.move": TodoMoveParams;
|
|
226
|
+
"todo.set-tags": TodoSetTagsParams;
|
|
227
|
+
"todo.replace-checklist": TodoReplaceChecklistParams;
|
|
228
|
+
"todo.delete": UuidParams;
|
|
229
|
+
"project.add": ProjectAddParams;
|
|
230
|
+
"project.update": ProjectUpdateParams;
|
|
231
|
+
"project.complete": ProjectCompleteParams;
|
|
232
|
+
"project.delete": UuidParams;
|
|
233
|
+
"area.add": AreaAddParams;
|
|
234
|
+
"area.delete": NameOrUuidParams;
|
|
235
|
+
"tag.add": TagAddParams;
|
|
236
|
+
"tag.delete": NameOrUuidParams;
|
|
237
|
+
"trash.empty": EmptyParams;
|
|
238
|
+
reorder: ReorderParams;
|
|
239
|
+
"todo.duplicate": UuidParams;
|
|
240
|
+
"area.update": AreaUpdateParams;
|
|
241
|
+
"tag.update": TagUpdateParams;
|
|
242
|
+
"project.move": ProjectMoveParams;
|
|
243
|
+
"todo.restore": UuidParams;
|
|
244
|
+
"project.duplicate": UuidParams;
|
|
245
|
+
"project.cancel": ProjectCancelParams;
|
|
246
|
+
"project.reopen": UuidParams;
|
|
247
|
+
"project.restore": UuidParams;
|
|
248
|
+
"project.set-tags": ProjectSetTagsParams;
|
|
249
|
+
"todo.backdate": TodoBackdateParams;
|
|
250
|
+
"todo.add-logged": TodoAddLoggedParams;
|
|
251
|
+
}
|
|
252
|
+
/** Explicit confirmations for operations with cascading or permanent effects (never defaulted). */
|
|
253
|
+
export interface Acknowledgements {
|
|
254
|
+
/** Confirm a wholesale checklist replacement that discards existing items and their checked states. */
|
|
255
|
+
acknowledgeChecklistReset?: boolean;
|
|
256
|
+
/** Confirm adding/moving an open item into a completed/canceled project (this reopens the project). */
|
|
257
|
+
acknowledgeProjectReopen?: boolean;
|
|
258
|
+
/** Confirm a permanent deletion: area/tag delete and empty-trash skip the Trash entirely. */
|
|
259
|
+
dangerouslyPermanent?: boolean;
|
|
260
|
+
/** Confirm that deleting a parent tag permanently deletes ALL of its descendant tags. */
|
|
261
|
+
acknowledgeTagSubtree?: boolean;
|
|
262
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const OPERATION_KINDS = [
|
|
2
|
+
"todo.add",
|
|
3
|
+
"todo.update",
|
|
4
|
+
"todo.complete",
|
|
5
|
+
"todo.cancel",
|
|
6
|
+
"todo.reopen",
|
|
7
|
+
"todo.move",
|
|
8
|
+
"todo.set-tags",
|
|
9
|
+
"todo.replace-checklist",
|
|
10
|
+
"todo.delete",
|
|
11
|
+
"project.add",
|
|
12
|
+
"project.update",
|
|
13
|
+
"project.complete",
|
|
14
|
+
"project.delete",
|
|
15
|
+
"area.add",
|
|
16
|
+
"area.delete",
|
|
17
|
+
"tag.add",
|
|
18
|
+
"tag.delete",
|
|
19
|
+
"trash.empty",
|
|
20
|
+
"reorder",
|
|
21
|
+
"todo.duplicate",
|
|
22
|
+
"area.update",
|
|
23
|
+
"tag.update",
|
|
24
|
+
"project.move",
|
|
25
|
+
"todo.restore",
|
|
26
|
+
"project.duplicate",
|
|
27
|
+
"project.cancel",
|
|
28
|
+
"project.reopen",
|
|
29
|
+
"project.restore",
|
|
30
|
+
"project.set-tags",
|
|
31
|
+
"todo.backdate",
|
|
32
|
+
"todo.add-logged",
|
|
33
|
+
];
|
|
34
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/write/operations.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,UAAU;IACV,aAAa;IACb,eAAe;IACf,aAAa;IACb,aAAa;IACb,WAAW;IACX,eAAe;IACf,wBAAwB;IACxB,aAAa;IACb,aAAa;IACb,gBAAgB;IAChB,kBAAkB;IAClB,gBAAgB;IAChB,UAAU;IACV,aAAa;IACb,SAAS;IACT,YAAY;IACZ,aAAa;IACb,SAAS;IACT,gBAAgB;IAChB,aAAa;IACb,YAAY;IACZ,cAAc;IACd,cAAc;IACd,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,kBAAkB;IAClB,eAAe;IACf,iBAAiB;CACT,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { DatabaseSync } from "node:sqlite";
|
|
2
|
+
import type { AuditWriter } from "../audit/log.ts";
|
|
3
|
+
import type { DisruptionTier, ThingsApiConfig } from "../config.ts";
|
|
4
|
+
import type { FingerprintStatus } from "../db/fingerprint.ts";
|
|
5
|
+
import { type EnvironmentTracker } from "./environment.ts";
|
|
6
|
+
import { type LikelyCause } from "./failure-hints.ts";
|
|
7
|
+
import { type HazardId } from "./guards.ts";
|
|
8
|
+
import type { Acknowledgements, OperationKind, OperationParamsMap } from "./operations.ts";
|
|
9
|
+
import type { VectorId, WriteVector } from "./vectors/types.ts";
|
|
10
|
+
import { type DeltaSpec } from "./verify/delta.ts";
|
|
11
|
+
import { type PollerDeps } from "./verify/poller.ts";
|
|
12
|
+
export interface WriteOptions extends Acknowledgements {
|
|
13
|
+
/** Caps vector selection; defaults from the config profile. */
|
|
14
|
+
maxDisruption?: DisruptionTier;
|
|
15
|
+
/** Force a specific vector (must still be validated + support the op). */
|
|
16
|
+
vector?: VectorId;
|
|
17
|
+
verifyTimeoutMs?: number;
|
|
18
|
+
/** Return the plan without executing (nothing is audited). */
|
|
19
|
+
dryRun?: boolean;
|
|
20
|
+
/** Audit attribution. */
|
|
21
|
+
actor?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface MutationPlan {
|
|
24
|
+
op: OperationKind;
|
|
25
|
+
vector: VectorId;
|
|
26
|
+
tier: DisruptionTier;
|
|
27
|
+
invocation: string;
|
|
28
|
+
expectedDelta: DeltaSpec;
|
|
29
|
+
hazardsChecked: HazardId[];
|
|
30
|
+
}
|
|
31
|
+
export type MutationResult = {
|
|
32
|
+
kind: "ok";
|
|
33
|
+
op: OperationKind;
|
|
34
|
+
uuid: string | null;
|
|
35
|
+
observed: Record<string, unknown> | null;
|
|
36
|
+
vector: VectorId;
|
|
37
|
+
tier: DisruptionTier;
|
|
38
|
+
/** Advisory notes (e.g. a changed environment tuple — consent may re-prompt later). */
|
|
39
|
+
warnings?: string[];
|
|
40
|
+
} | {
|
|
41
|
+
kind: "verify-failed";
|
|
42
|
+
op: OperationKind;
|
|
43
|
+
reason: "timeout" | "mismatch" | "silent-noop";
|
|
44
|
+
expected: DeltaSpec;
|
|
45
|
+
observed: Record<string, unknown> | null;
|
|
46
|
+
detail: string;
|
|
47
|
+
/** Advisory attribution when the failure signals point somewhere. */
|
|
48
|
+
likelyCause?: LikelyCause;
|
|
49
|
+
hint?: string;
|
|
50
|
+
} | {
|
|
51
|
+
kind: "blocked";
|
|
52
|
+
op: OperationKind;
|
|
53
|
+
reason: "hazard" | "disruption-tier" | "drift" | "lock" | "environment";
|
|
54
|
+
hazard?: HazardId;
|
|
55
|
+
detail: string;
|
|
56
|
+
remediation: string;
|
|
57
|
+
likelyCause?: LikelyCause;
|
|
58
|
+
} | {
|
|
59
|
+
kind: "unsupported";
|
|
60
|
+
op: OperationKind;
|
|
61
|
+
considered: {
|
|
62
|
+
vector: VectorId;
|
|
63
|
+
why: string;
|
|
64
|
+
}[];
|
|
65
|
+
} | {
|
|
66
|
+
kind: "dry-run";
|
|
67
|
+
op: OperationKind;
|
|
68
|
+
plan: MutationPlan;
|
|
69
|
+
};
|
|
70
|
+
export interface WriteDeps {
|
|
71
|
+
db: DatabaseSync;
|
|
72
|
+
vectors: WriteVector[];
|
|
73
|
+
config: ThingsApiConfig;
|
|
74
|
+
audit: AuditWriter;
|
|
75
|
+
fingerprint(): FingerprintStatus;
|
|
76
|
+
lockPath: string;
|
|
77
|
+
/** Injectable for tests/lab: returns true when Things is up (launching if needed). */
|
|
78
|
+
ensureRunning?: (alreadyRunning: boolean) => Promise<boolean>;
|
|
79
|
+
isAppRunning?: () => boolean;
|
|
80
|
+
/** Canary seam: does the installed sdef still declare the private command? */
|
|
81
|
+
sdefProbe?: () => boolean;
|
|
82
|
+
/** Consent-churn tripwire: tuple recorded per verified mutation (client wires the default). */
|
|
83
|
+
environment?: EnvironmentTracker;
|
|
84
|
+
now?: () => Date;
|
|
85
|
+
poller?: PollerDeps;
|
|
86
|
+
pkgVersion?: string;
|
|
87
|
+
}
|
|
88
|
+
export declare function readAuthToken(db: DatabaseSync): string | null;
|
|
89
|
+
export declare function runMutation<K extends OperationKind>(deps: WriteDeps, op: K, params: OperationParamsMap[K], options?: WriteOptions): Promise<MutationResult>;
|
|
90
|
+
export declare function fingerprintLabel(fp: FingerprintStatus, config: ThingsApiConfig): "ok" | "drift" | "user-accepted" | "unknown";
|