@graview/core 0.2.14 → 0.2.16

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 (68) hide show
  1. package/README.md +8 -2
  2. package/dist/cli/document-schema.js +1 -1
  3. package/dist/cli/document-schema.js.map +1 -1
  4. package/dist/document/connection-findings.d.ts.map +1 -1
  5. package/dist/document/connection-findings.js +103 -10
  6. package/dist/document/connection-findings.js.map +1 -1
  7. package/dist/document/connection-spec.d.ts +43 -3
  8. package/dist/document/connection-spec.d.ts.map +1 -1
  9. package/dist/document/connection-spec.js +51 -4
  10. package/dist/document/connection-spec.js.map +1 -1
  11. package/dist/document/describe-place.d.ts.map +1 -1
  12. package/dist/document/describe-place.js +2 -0
  13. package/dist/document/describe-place.js.map +1 -1
  14. package/dist/document/described.d.ts +6 -0
  15. package/dist/document/described.d.ts.map +1 -1
  16. package/dist/document/edit.js +1 -1
  17. package/dist/document/edit.js.map +1 -1
  18. package/dist/document/kept-in-step-with.d.ts +4 -4
  19. package/dist/document/kept-in-step-with.d.ts.map +1 -1
  20. package/dist/document/kept-in-step-with.js +5 -1
  21. package/dist/document/kept-in-step-with.js.map +1 -1
  22. package/dist/document/kept-in-step.js +1 -1
  23. package/dist/document/kept-in-step.js.map +1 -1
  24. package/dist/document.schema.json +154 -3
  25. package/dist/sync/connection.d.ts +22 -5
  26. package/dist/sync/connection.d.ts.map +1 -1
  27. package/dist/sync/connection.js +274 -6
  28. package/dist/sync/connection.js.map +1 -1
  29. package/dist/sync/engine.d.ts +38 -1
  30. package/dist/sync/engine.d.ts.map +1 -1
  31. package/dist/sync/engine.js +184 -12
  32. package/dist/sync/engine.js.map +1 -1
  33. package/dist/sync/google-calendar.d.ts.map +1 -1
  34. package/dist/sync/google-calendar.js +27 -4
  35. package/dist/sync/google-calendar.js.map +1 -1
  36. package/dist/sync/guests.d.ts +7 -2
  37. package/dist/sync/guests.d.ts.map +1 -1
  38. package/dist/sync/guests.js +33 -15
  39. package/dist/sync/guests.js.map +1 -1
  40. package/dist/sync/index.d.ts +10 -3
  41. package/dist/sync/index.d.ts.map +1 -1
  42. package/dist/sync/index.js +6 -2
  43. package/dist/sync/index.js.map +1 -1
  44. package/dist/sync/notion.d.ts.map +1 -1
  45. package/dist/sync/notion.js +18 -10
  46. package/dist/sync/notion.js.map +1 -1
  47. package/dist/sync/todoist-due.d.ts +35 -0
  48. package/dist/sync/todoist-due.d.ts.map +1 -0
  49. package/dist/sync/todoist-due.js +132 -0
  50. package/dist/sync/todoist-due.js.map +1 -0
  51. package/dist/sync/todoist-stub.d.ts +85 -0
  52. package/dist/sync/todoist-stub.d.ts.map +1 -0
  53. package/dist/sync/todoist-stub.js +316 -0
  54. package/dist/sync/todoist-stub.js.map +1 -0
  55. package/dist/sync/todoist-types.d.ts +27 -0
  56. package/dist/sync/todoist-types.d.ts.map +1 -0
  57. package/dist/sync/todoist-types.js +46 -0
  58. package/dist/sync/todoist-types.js.map +1 -0
  59. package/dist/sync/todoist.d.ts +112 -0
  60. package/dist/sync/todoist.d.ts.map +1 -0
  61. package/dist/sync/todoist.js +892 -0
  62. package/dist/sync/todoist.js.map +1 -0
  63. package/dist/sync/types.d.ts +53 -2
  64. package/dist/sync/types.d.ts.map +1 -1
  65. package/dist/sync/types.js.map +1 -1
  66. package/dist/version.d.ts +1 -1
  67. package/dist/version.js +1 -1
  68. package/package.json +1 -1
@@ -0,0 +1,316 @@
1
+ import { occurrences } from "../repeat.js";
2
+ import { readRepeat } from "./todoist-due.js";
3
+ class Refusal extends Error {
4
+ tag;
5
+ http;
6
+ constructor(tag, message, http = 400) {
7
+ super(message);
8
+ this.tag = tag;
9
+ this.http = http;
10
+ }
11
+ }
12
+ export function scriptedTodoist(options = {}) {
13
+ const token = options.token ?? "0123456789abcdef0123456789abcdef01234567";
14
+ const projects = new Map();
15
+ const sections = new Map();
16
+ const people = new Map();
17
+ const states = [];
18
+ const items = new Map();
19
+ const changed = new Map();
20
+ const forgotten = new Set();
21
+ const executed = new Map();
22
+ const requests = [];
23
+ const commands = [];
24
+ const user = { id: "1000", email: "me@example.com", full_name: "Me", tz_info: { timezone: options.timeZone ?? "UTC" } };
25
+ let made = 0;
26
+ let seq = 0;
27
+ let oldest = 0;
28
+ let limited = 0;
29
+ let retryAfter = 1;
30
+ let losing = 0;
31
+ let refusing;
32
+ let refused = 0;
33
+ let failing = 0;
34
+ let dropping;
35
+ let before;
36
+ const id = (salt) => `6${salt}${(made += 1).toString(36).padStart(14, "0")}`;
37
+ const touch = (one) => {
38
+ seq += 1;
39
+ changed.set(String(one["id"]), seq);
40
+ one["updated_at"] = `2026-10-25T10:00:00.000000Z`;
41
+ return one;
42
+ };
43
+ const found = (one) => {
44
+ const item = items.get(String(one));
45
+ if (!item || item["is_deleted"] === true)
46
+ throw new Refusal("ITEM_NOT_FOUND", "Item not found", 404);
47
+ return item;
48
+ };
49
+ const below = (parent) => [...items.values()].filter((item) => item["parent_id"] === parent["id"] && item["is_deleted"] !== true).flatMap((item) => [item, ...below(item)]);
50
+ /** A due date as Todoist keeps it: what was given, the rest filled in. */
51
+ const dueOf = (due) => {
52
+ if (!due || typeof due !== "object")
53
+ return null;
54
+ const { date, string, timezone, lang } = due;
55
+ if (typeof date !== "string")
56
+ throw new Refusal("INVALID_ARGUMENT_VALUE", "Invalid date format");
57
+ const words = typeof string === "string" ? string : String(date);
58
+ return { date, timezone: timezone ?? (date.endsWith("Z") ? user["tz_info"] && user["tz_info"]["timezone"] : null), string: words, lang: lang ?? "en", is_recurring: /^(?:every|ev|daily|weekly|monthly|yearly)\b/i.test(words) };
59
+ };
60
+ const WRITTEN = ["content", "description", "priority", "labels", "responsible_uid", "deadline"];
61
+ const assign = (item, args) => {
62
+ for (const key of WRITTEN)
63
+ if (key in args)
64
+ item[key] = key === "labels" ? [...args[key]] : args[key];
65
+ if ("due" in args)
66
+ item["due"] = dueOf(args["due"]);
67
+ if (String(item["content"] ?? "") === "")
68
+ throw new Refusal("INVALID_ARGUMENT_VALUE", "Content can not be empty");
69
+ if (item["responsible_uid"] && !states.some((one) => one["user_id"] === item["responsible_uid"]) && item["responsible_uid"] !== user["id"])
70
+ throw new Refusal("INVALID_ARGUMENT_VALUE", "Invalid responsible_uid");
71
+ };
72
+ const place = (item, args) => {
73
+ if (args["parent_id"]) {
74
+ const parent = found(args["parent_id"]);
75
+ Object.assign(item, { parent_id: parent["id"], section_id: parent["section_id"], project_id: parent["project_id"] });
76
+ }
77
+ else if (args["section_id"]) {
78
+ const section = sections.get(String(args["section_id"]));
79
+ if (!section)
80
+ throw new Refusal("SECTION_NOT_FOUND", "Section not found", 404);
81
+ Object.assign(item, { parent_id: null, section_id: section["id"], project_id: section["project_id"] });
82
+ }
83
+ else {
84
+ if (!projects.has(String(args["project_id"])))
85
+ throw new Refusal("PROJECT_NOT_FOUND", "Project not found", 404);
86
+ Object.assign(item, { parent_id: null, section_id: null, project_id: args["project_id"] });
87
+ }
88
+ for (const child of below(item))
89
+ touch(Object.assign(child, { section_id: item["section_id"], project_id: item["project_id"] }));
90
+ };
91
+ const add = (args) => {
92
+ const item = { id: id("X"), user_id: user["id"], content: "", description: "", priority: 1, due: null, deadline: null, labels: [], responsible_uid: null, checked: false, is_deleted: false, completed_at: null, parent_id: null, section_id: null };
93
+ assign(item, args);
94
+ place(item, args);
95
+ items.set(String(item["id"]), item);
96
+ return touch(item);
97
+ };
98
+ const complete = (item) => {
99
+ for (const one of [item, ...below(item)])
100
+ touch(Object.assign(one, { checked: true, completed_at: new Date().toISOString() }));
101
+ };
102
+ const close = (item) => {
103
+ const due = item["due"];
104
+ if (!due?.["is_recurring"])
105
+ return complete(item);
106
+ const repeat = readRepeat(String(due["string"]));
107
+ const next = repeat ? occurrences(String(due["date"]), repeat, { limit: 2 })[1] : undefined;
108
+ touch(Object.assign(item, { due: { ...due, date: next ?? due["date"] } }));
109
+ };
110
+ const reopen = (item) => {
111
+ touch(Object.assign(item, { checked: false, completed_at: null }));
112
+ if (item["parent_id"])
113
+ reopen(found(item["parent_id"]));
114
+ };
115
+ const remove = (item) => {
116
+ for (const one of [item, ...below(item)])
117
+ touch(Object.assign(one, { is_deleted: true }));
118
+ };
119
+ const run = (type, args) => {
120
+ if (type === refusing) {
121
+ refusing = undefined;
122
+ throw new Refusal("FORBIDDEN", "Forbidden", 403);
123
+ }
124
+ switch (type) {
125
+ case "item_add":
126
+ return add(args);
127
+ case "item_update": {
128
+ const item = found(args["id"]);
129
+ const next = { ...item };
130
+ assign(next, args);
131
+ touch(Object.assign(item, next));
132
+ return undefined;
133
+ }
134
+ case "item_move":
135
+ if (["parent_id", "section_id", "project_id"].filter((key) => args[key]).length !== 1)
136
+ throw new Refusal("INVALID_ARGUMENT_VALUE", "Only one of parent_id, section_id or project_id must be set");
137
+ place(found(args["id"]), args);
138
+ touch(found(args["id"]));
139
+ return undefined;
140
+ case "item_close":
141
+ close(found(args["id"]));
142
+ return undefined;
143
+ case "item_uncomplete":
144
+ reopen(found(args["id"]));
145
+ return undefined;
146
+ case "item_delete":
147
+ remove(found(args["id"]));
148
+ return undefined;
149
+ default:
150
+ throw new Refusal("INVALID_COMMAND", `Invalid command ${type}`);
151
+ }
152
+ };
153
+ const answer = (status, body, headers = {}) => ({ ok: status < 400, status, json: async () => structuredClone(body), headers: { get: (name) => headers[name.toLowerCase()] ?? null } });
154
+ const read = (since, resources) => {
155
+ const whole = since === "*";
156
+ const at = whole ? 0 : Number(since.slice(1));
157
+ if (!whole && (!Number.isFinite(at) || at < oldest))
158
+ throw new Refusal("INVALID_SYNC_TOKEN", "Invalid sync token");
159
+ const news = (one) => (whole ? one["is_deleted"] !== true : (changed.get(String(one["id"])) ?? 0) > at);
160
+ const out = { full_sync: whole, sync_token: `t${seq}`, ...(whole ? { full_sync_date_utc: new Date().toISOString() } : {}) };
161
+ if (resources.includes("items"))
162
+ out["items"] = [...items.values()].filter((item) => news(item) && !forgotten.has(String(item["id"])) && (!whole || item["checked"] !== true));
163
+ if (resources.includes("projects"))
164
+ out["projects"] = [...projects.values()].filter(news);
165
+ if (resources.includes("sections"))
166
+ out["sections"] = [...sections.values()].filter(news);
167
+ if (resources.includes("collaborators"))
168
+ out["collaborators"] = [...people.values()].filter(news);
169
+ if (resources.includes("collaborator_states"))
170
+ out["collaborator_states"] = states.filter((one) => whole || (changed.get(String(one["user_id"])) ?? 0) > at);
171
+ if (resources.includes("user"))
172
+ out["user"] = user;
173
+ return out;
174
+ };
175
+ const fetch = async (url, init) => {
176
+ const at = new URL(url);
177
+ const path = at.pathname.replace(/^\/api\/v1/, "");
178
+ const form = new URLSearchParams(init?.body ?? "");
179
+ const sent = form.get("commands") ? JSON.parse(form.get("commands")) : [];
180
+ const resources = form.get("resource_types") ? JSON.parse(form.get("resource_types")) : [];
181
+ const since = form.get("sync_token");
182
+ requests.push({ method: init?.method ?? "GET", path, ...(since ? { token: since } : {}), resources, commands: sent.length });
183
+ if (init?.headers?.["authorization"] !== `Bearer ${token}`)
184
+ return answer(401, { error_tag: "UNAUTHORIZED", error_code: 477, error: "Unauthorized", http_code: 401 });
185
+ if (limited > 0) {
186
+ limited -= 1;
187
+ return answer(429, { error_tag: "LIMITS_REACHED", error: "Too many requests", error_extra: { retry_after: retryAfter } }, { "retry-after": String(retryAfter) });
188
+ }
189
+ try {
190
+ if (path === "/sync") {
191
+ if (resources.includes("items") && failing > 0) {
192
+ failing -= 1;
193
+ throw new TypeError("fetch failed");
194
+ }
195
+ if (dropping && dropping.count > 0 && sent.some((one) => one.type === dropping.type)) {
196
+ dropping.count -= 1;
197
+ throw new TypeError("fetch failed");
198
+ }
199
+ if (sent.length > 0 && refused > 0) {
200
+ refused -= 1;
201
+ throw new Refusal("INVALID_ARGUMENT", "Bad request");
202
+ }
203
+ if (sent.length > 100)
204
+ throw new Refusal("MAX_COMMANDS", "Too many commands");
205
+ const status = {};
206
+ const mapping = {};
207
+ if (sent.length > 0) {
208
+ const act = before;
209
+ before = undefined;
210
+ act?.();
211
+ }
212
+ for (const command of sent) {
213
+ let done = executed.get(command.uuid);
214
+ if (!done) {
215
+ try {
216
+ commands.push({ type: command.type, args: structuredClone(command.args) });
217
+ const result = run(command.type, command.args);
218
+ done = { status: "ok", ...(command.temp_id && result ? { temp: command.temp_id, id: String(result["id"]) } : {}) };
219
+ }
220
+ catch (error) {
221
+ if (!(error instanceof Refusal))
222
+ throw error;
223
+ done = { status: { error_tag: error.tag, error_code: 20, error: error.message, http_code: error.http } };
224
+ }
225
+ executed.set(command.uuid, done);
226
+ }
227
+ status[command.uuid] = done.status;
228
+ if (done.temp)
229
+ mapping[done.temp] = done.id;
230
+ }
231
+ if (sent.length > 0 && losing > 0) {
232
+ losing -= 1;
233
+ throw new TypeError("fetch failed");
234
+ }
235
+ return answer(200, { ...(since ? read(since, resources) : { sync_token: `t${seq}` }), ...(sent.length > 0 ? { sync_status: status, temp_id_mapping: mapping } : {}) });
236
+ }
237
+ const one = /^\/tasks\/([^/]+)$/.exec(path);
238
+ if (one) {
239
+ const item = items.get(decodeURIComponent(one[1]));
240
+ if (!item || item["checked"] === true || forgotten.has(String(item["id"])) || item["is_deleted"] === true)
241
+ return answer(404, { error_tag: "NOT_FOUND", error: "Task not found" });
242
+ return answer(200, item);
243
+ }
244
+ if (path === "/tasks/completed/by_completion_date") {
245
+ const within = [...items.values()].filter((item) => item["checked"] === true && item["is_deleted"] !== true && !forgotten.has(String(item["id"])) && item["project_id"] === at.searchParams.get("project_id") && String(item["completed_at"]) >= at.searchParams.get("since") && String(item["completed_at"]) < at.searchParams.get("until"));
246
+ const size = Number(at.searchParams.get("limit") ?? "50");
247
+ const from = Number(at.searchParams.get("cursor") ?? "0");
248
+ return answer(200, { items: within.slice(from, from + size), next_cursor: from + size < within.length ? String(from + size) : null });
249
+ }
250
+ return answer(404, { error_tag: "NOT_FOUND", error: "Not found" });
251
+ }
252
+ catch (error) {
253
+ if (!(error instanceof Refusal))
254
+ throw error;
255
+ return answer(error.http, { error_tag: error.tag, error: error.message, http_code: error.http });
256
+ }
257
+ };
258
+ return {
259
+ fetch,
260
+ token,
261
+ requests,
262
+ commands,
263
+ project(name) {
264
+ const there = [...projects.values()].find((one) => one["name"] === name);
265
+ if (there)
266
+ return String(there["id"]);
267
+ const one = { id: id("P"), name, is_deleted: false, is_archived: false };
268
+ projects.set(String(one["id"]), touch(one));
269
+ return String(one["id"]);
270
+ },
271
+ section(projectId, name) {
272
+ const one = { id: id("S"), name, project_id: projectId, is_deleted: false, is_archived: false };
273
+ sections.set(String(one["id"]), touch(one));
274
+ return String(one["id"]);
275
+ },
276
+ person(name, email, projectId) {
277
+ const one = { id: String(2000 + (made += 1)), full_name: name, email };
278
+ people.set(String(one["id"]), touch(one));
279
+ states.push({ project_id: projectId, user_id: one["id"], state: "active", is_deleted: false });
280
+ return String(one["id"]);
281
+ },
282
+ add: (projectId, values) => {
283
+ const item = add({ project_id: projectId, ...values });
284
+ return structuredClone(item);
285
+ },
286
+ edit(itemId, values) {
287
+ const item = found(itemId);
288
+ if (values["project_id"] || values["section_id"])
289
+ place(item, values);
290
+ assign(item, values);
291
+ return structuredClone(touch(item));
292
+ },
293
+ complete: (itemId) => complete(found(itemId)),
294
+ reopen: (itemId) => reopen(found(itemId)),
295
+ remove: (itemId) => remove(found(itemId)),
296
+ task: (itemId) => structuredClone(items.get(itemId)),
297
+ tasks: (projectId) => structuredClone([...items.values()].filter((item) => item["checked"] !== true && item["is_deleted"] !== true && (!projectId || item["project_id"] === projectId))),
298
+ sectionOf: (task) => sections.get(String(task["section_id"]))?.["name"],
299
+ forget: (itemId) => void forgotten.add(itemId),
300
+ forgetTokens() {
301
+ seq += 1;
302
+ oldest = seq;
303
+ },
304
+ limit(count, after = 1) {
305
+ limited = count;
306
+ retryAfter = after;
307
+ },
308
+ loseAnswers: (count) => void (losing = count),
309
+ failReads: (count) => void (failing = count),
310
+ dropWrites: (type, count) => void (dropping = { type, count }),
311
+ refuseRequests: (count) => void (refused = count),
312
+ refuseOnce: (type) => void (refusing = type),
313
+ onWrite: (act) => void (before = act),
314
+ };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AAE,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAC9D,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;QACjD,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;QAC5C,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC;KACtC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
1
+ /** A task's parts, and the field types each may be held in. `parent` is not here: it is one of the kind's relations. */
2
+ export declare const TODOIST_FITS: {
3
+ readonly content: readonly ["string", "text"];
4
+ readonly description: readonly ["string", "text"];
5
+ readonly due: readonly ["date", "datetime"];
6
+ readonly deadline: readonly ["date"];
7
+ readonly priority: readonly ["integer", "number", "enum"];
8
+ readonly labels: readonly ["list"];
9
+ readonly section: readonly ["string", "enum"];
10
+ readonly assignee: readonly ["string", "email"];
11
+ readonly completed: readonly ["boolean"];
12
+ };
13
+ export type TodoistPart = keyof typeof TODOIST_FITS;
14
+ /**
15
+ * The priority an option names, as people see it in Todoist: 1 (p1, the most
16
+ * urgent) to 4 (p4, no priority). Todoist's API numbers them the other way
17
+ * ("p1 will return 4 in the API", developer.todoist.com/api/v1/sync/tasks.md);
18
+ * the transport turns them over.
19
+ */
20
+ export declare function todoistPriorityOf(option: string): number | undefined;
21
+ /** An enum's options by priority, when they name each of the four once; undefined when they do not. */
22
+ export declare function todoistPriorities(options: readonly string[]): ReadonlyMap<number, string> | undefined;
23
+ /** A personal API token as Todoist writes one (40 hexadecimal characters): never in a document. */
24
+ export declare const TODOIST_SECRET: RegExp;
25
+ /** The environment prefix a Todoist connection's token is read under: `<prefix>_TOKEN`. */
26
+ export declare const TODOIST_AUTH_ENV = "TODOIST";
27
+ //# sourceMappingURL=todoist-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"todoist-types.d.ts","sourceRoot":"","sources":["../../src/sync/todoist-types.ts"],"names":[],"mappings":"AAMA,wHAAwH;AACxH,eAAO,MAAM,YAAY;;;;;;;;;;CAUuC,CAAC;AAEjE,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,YAAY,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKpE;AAED,uGAAuG;AACvG,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAQrG;AAED,mGAAmG;AACnG,eAAO,MAAM,cAAc,QAAmD,CAAC;AAE/E,2FAA2F;AAC3F,eAAO,MAAM,gBAAgB,YAAY,CAAC"}
@@ -0,0 +1,46 @@
1
+ /*
2
+ * What the parts of a Todoist task are to a Graview kind, apart from the
3
+ * transport — so the checker (`graview check`) judges a declared mapping and
4
+ * the connection runs it by one table.
5
+ */
6
+ /** A task's parts, and the field types each may be held in. `parent` is not here: it is one of the kind's relations. */
7
+ export const TODOIST_FITS = {
8
+ content: ["string", "text"],
9
+ description: ["string", "text"],
10
+ due: ["date", "datetime"],
11
+ deadline: ["date"],
12
+ priority: ["integer", "number", "enum"],
13
+ labels: ["list"],
14
+ section: ["string", "enum"],
15
+ assignee: ["string", "email"],
16
+ completed: ["boolean"],
17
+ };
18
+ /**
19
+ * The priority an option names, as people see it in Todoist: 1 (p1, the most
20
+ * urgent) to 4 (p4, no priority). Todoist's API numbers them the other way
21
+ * ("p1 will return 4 in the API", developer.todoist.com/api/v1/sync/tasks.md);
22
+ * the transport turns them over.
23
+ */
24
+ export function todoistPriorityOf(option) {
25
+ const word = option.toLowerCase().replace(/[^a-z0-9]/g, "");
26
+ const said = /^p?([1-4])$/.exec(word);
27
+ if (said)
28
+ return Number(said[1]);
29
+ return { urgent: 1, veryurgent: 1, high: 2, medium: 3, low: 4, normal: 4, none: 4 }[word];
30
+ }
31
+ /** An enum's options by priority, when they name each of the four once; undefined when they do not. */
32
+ export function todoistPriorities(options) {
33
+ const named = new Map();
34
+ for (const option of options) {
35
+ const priority = todoistPriorityOf(option);
36
+ if (priority === undefined || named.has(priority))
37
+ return undefined;
38
+ named.set(priority, option);
39
+ }
40
+ return named.size === 4 ? named : undefined;
41
+ }
42
+ /** A personal API token as Todoist writes one (40 hexadecimal characters): never in a document. */
43
+ export const TODOIST_SECRET = /(?:^|[^A-Za-z0-9])[0-9a-f]{40}(?![A-Za-z0-9])/i;
44
+ /** The environment prefix a Todoist connection's token is read under: `<prefix>_TOKEN`. */
45
+ export const TODOIST_AUTH_ENV = "TODOIST";
46
+ //# sourceMappingURL=todoist-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"todoist-types.js","sourceRoot":"","sources":["../../src/sync/todoist-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wHAAwH;AACxH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC/B,GAAG,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC;IACzB,QAAQ,EAAE,CAAC,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC;IACvC,MAAM,EAAE,CAAC,MAAM,CAAC;IAChB,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC7B,SAAS,EAAE,CAAC,SAAS,CAAC;CACwC,CAAC;AAIjE;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAC5D,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,IAAI;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,OAAQ,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAA6B,CAAC,IAAI,CAAC,CAAC;AACxH,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,iBAAiB,CAAC,OAA0B;IAC1D,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC;YAAE,OAAO,SAAS,CAAC;QACpE,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9C,CAAC;AAED,mGAAmG;AACnG,MAAM,CAAC,MAAM,cAAc,GAAG,gDAAgD,CAAC;AAE/E,2FAA2F;AAC3F,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAC"}
@@ -0,0 +1,112 @@
1
+ import type { Fetcher } from "./google-calendar.js";
2
+ import type { RemoteSystem } from "./types.js";
3
+ /**
4
+ * A Todoist project, as a transport.
5
+ *
6
+ * Todoist's API v1 and its `/sync` endpoint (developer.todoist.com/api/v1,
7
+ * read 2026-11-25; the pages relied on are named where they are). One
8
+ * project, or one section or label of it, is one resource (`tasks`), and
9
+ * each of its tasks one record. Everything Todoist-specific is here; the
10
+ * engine sees plain values keyed by a task's parts (`content`, `due`, …):
11
+ *
12
+ * - A PULL sends the last sync token and is answered what changed since
13
+ * (sync/overview.md, "Incremental sync"); `*` answers "all active resource
14
+ * data", so a whole read does not list a completed task. A task is
15
+ * `checked` when completed and `is_deleted` when deleted (sync/tasks.md).
16
+ * - COMPLETED IS NEVER GONE. A completed task is a task whose `completed`
17
+ * is true. A task this sync knew that a whole read does not list is looked
18
+ * for among the completed ones, then asked for by id; one neither answers
19
+ * for is left as it is, and said. Only `is_deleted`, or a task moved out
20
+ * of what the connection keeps, takes a record away.
21
+ * - A VERSION is a hash of the parts kept, so our own write coming back is
22
+ * an echo exactly when it holds what was sent, and an edit in the same
23
+ * second is still news.
24
+ * - A PUSH sends only the parts that changed (`RemoteWrite.changed`) as
25
+ * commands, up to 100 to a request (request-limits.md): `item_add`,
26
+ * `item_update`, `item_move` (its section or parent, which
27
+ * `item_update` does not change), `item_uncomplete`, `item_delete`, and
28
+ * then `item_close`, which completes a task and moves one that repeats to
29
+ * its next date. It goes last and alone, so it is never sent twice for
30
+ * another part's refusal. Every command carries a `uuid` Todoist executes
31
+ * once, so a request whose answer was lost is made again as it was.
32
+ * - THE CONNECTION'S LABEL is put on every task sent and left out of what a
33
+ * record's labels say.
34
+ * - A RECORD SET ASIDE leaves its task as it is (`aside`): nothing is sent
35
+ * for it, and no task above it is deleted while it is, for a delete takes
36
+ * "all its sub-tasks" (sync/tasks.md) and nothing undoes one.
37
+ * - A PART THAT CANNOT BE SENT is held, and said ("held unsent"): a due
38
+ * date whose repeat there are no words for, a section there is not. The
39
+ * rest of a task already there goes; one not made yet waits whole. A part
40
+ * held in conflict is never read as empty.
41
+ * - Todoist asking us to slow down (429) is waited out as its `Retry-After`
42
+ * says, within a bound; a refused token (401) and a project it cannot
43
+ * find are said as sentences that say what to do.
44
+ */
45
+ export declare const TODOIST_API = "https://api.todoist.com/api/v1";
46
+ /** A task's parts as the mapping names them, each with the field type that holds it; `@relation` for a parent. */
47
+ export type TodoistRefs = Readonly<Record<string, string | undefined>>;
48
+ /** A value that Todoist cannot be told, and why: the write that says it is held unsent. */
49
+ export interface Unsayable {
50
+ readonly held: string;
51
+ }
52
+ export declare const isUnsayable: (value: unknown) => value is Unsayable;
53
+ export interface TodoistOptions {
54
+ /** The project, by its id or its name. */
55
+ readonly projectId: string;
56
+ /** Only the tasks of this section of it, by its id or its name. */
57
+ readonly section?: string;
58
+ /** Only the tasks that carry this label. */
59
+ readonly label?: string;
60
+ /** The parts kept, each with the type of the field that holds it. */
61
+ readonly refs: TodoistRefs;
62
+ /** The app's time zone, when the due date repeats at a time there: a repeat in an account of another zone is left alone. */
63
+ readonly zone?: string;
64
+ /** The personal API token, asked before every request. */
65
+ token(): Promise<string> | string;
66
+ /** What the token is called where it is kept (`TODOIST_TOKEN`), for the sentence a refusal says. Never its value. */
67
+ readonly secretName?: string;
68
+ readonly fetch?: Fetcher;
69
+ readonly baseUrl?: string;
70
+ /** The tasks this sync has linked, by Todoist's id, whether each is completed here, and whether its record is removed here. */
71
+ known?(): readonly {
72
+ readonly id: string;
73
+ readonly completed?: boolean;
74
+ readonly removed?: boolean;
75
+ }[];
76
+ /** The tasks of the records set aside here, with what each is called and, where it is mapped, its parent as last agreed. */
77
+ aside?(): readonly {
78
+ readonly id: string;
79
+ readonly localId: string;
80
+ readonly label: string;
81
+ readonly parent?: string;
82
+ readonly completed?: boolean;
83
+ }[];
84
+ /** The tasks of every record set aside in the app, whichever connection keeps it. */
85
+ asideElsewhere?(): readonly string[];
86
+ /** Whether another connection keeps this task. */
87
+ keptElsewhere?(id: string): boolean;
88
+ /** Whether another connection keeps this task and will move it out from under one removed here. */
89
+ movedElsewhere?(id: string): boolean;
90
+ /** Whether a record of ours is set aside, linked or not. */
91
+ isAside?(localId: string): boolean;
92
+ /** The longest a run waits out Todoist's rate limit, in ms (60 seconds by default). */
93
+ readonly maxWait?: number;
94
+ /** A note said once. */
95
+ say?(line: string): void;
96
+ now?(): number;
97
+ sleep?(ms: number): Promise<void>;
98
+ /** A command's id; `crypto.randomUUID` by default. */
99
+ uuid?(): string;
100
+ }
101
+ /** What Todoist answered, when it was not a yes. */
102
+ export declare class TodoistError extends Error {
103
+ readonly status: number;
104
+ readonly tag?: string | undefined;
105
+ constructor(message: string, status: number, tag?: string | undefined);
106
+ }
107
+ type Json = Record<string, unknown>;
108
+ /** A short, stable hash of a task's parts: what makes it the one last agreed, or news. */
109
+ export declare function todoistVersion(values: Json): string;
110
+ export declare function todoist(options: TodoistOptions): RemoteSystem;
111
+ export {};
112
+ //# sourceMappingURL=todoist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"todoist.d.ts","sourceRoot":"","sources":["../../src/sync/todoist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,KAAK,EAA2B,YAAY,EAAe,MAAM,YAAY,CAAC;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,eAAO,MAAM,WAAW,mCAAmC,CAAC;AAS5D,kHAAkH;AAClH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;AAEvE,2FAA2F;AAC3F,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AACD,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,SAAyG,CAAC;AAEhK,MAAM,WAAW,cAAc;IAC7B,0CAA0C;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,mEAAmE;IACnE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IAC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