@atlastodo/shared 0.0.0-stage → 0.1.11-rc.5

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 (67) hide show
  1. package/LICENSE +661 -0
  2. package/dist/activity.d.ts +23 -0
  3. package/dist/avatarColor.d.ts +15 -0
  4. package/dist/boardMove.d.ts +14 -0
  5. package/dist/bugReport.d.ts +47 -0
  6. package/dist/calendar.d.ts +23 -0
  7. package/dist/comments.d.ts +14 -0
  8. package/dist/countdown.d.ts +14 -0
  9. package/dist/cursor.d.ts +6 -0
  10. package/dist/dataTransfer.d.ts +19 -0
  11. package/dist/duplicateProject.d.ts +19 -0
  12. package/dist/duplicateSection.d.ts +15 -0
  13. package/dist/filterQuery.d.ts +64 -0
  14. package/dist/focus.d.ts +17 -0
  15. package/dist/format.d.ts +30 -0
  16. package/dist/fuzzy.d.ts +14 -0
  17. package/dist/grouping.d.ts +24 -0
  18. package/dist/habitGroups.d.ts +46 -0
  19. package/dist/habitSchedule.d.ts +4 -0
  20. package/dist/habits.d.ts +115 -0
  21. package/dist/hotkeys.d.ts +50 -0
  22. package/dist/i18n.d.ts +14796 -0
  23. package/dist/ids.d.ts +7 -0
  24. package/dist/importTicktick.d.ts +34 -0
  25. package/dist/importTodoist.d.ts +60 -0
  26. package/dist/index.d.ts +62 -0
  27. package/dist/index.js +21446 -0
  28. package/dist/members.d.ts +26 -0
  29. package/dist/planDay.d.ts +31 -0
  30. package/dist/pomodoro.d.ts +49 -0
  31. package/dist/priority.d.ts +2 -0
  32. package/dist/projectMapper.d.ts +15 -0
  33. package/dist/projectStyle.d.ts +14 -0
  34. package/dist/projectTree.d.ts +40 -0
  35. package/dist/quickAddLexicons.d.ts +64 -0
  36. package/dist/quickAddLexiconsWire.d.ts +11 -0
  37. package/dist/quickAddParse.d.ts +44 -0
  38. package/dist/quickSchedule.d.ts +9 -0
  39. package/dist/rank.d.ts +9 -0
  40. package/dist/recurrence.d.ts +60 -0
  41. package/dist/regions.d.ts +6 -0
  42. package/dist/reminderSchedule.d.ts +42 -0
  43. package/dist/reminders.d.ts +28 -0
  44. package/dist/reorder.d.ts +21 -0
  45. package/dist/sectionMapper.d.ts +8 -0
  46. package/dist/sectionOps.d.ts +5 -0
  47. package/dist/serverUrl.d.ts +12 -0
  48. package/dist/smartLists.d.ts +11 -0
  49. package/dist/stats.d.ts +28 -0
  50. package/dist/swipe.d.ts +29 -0
  51. package/dist/taskClipboard.d.ts +19 -0
  52. package/dist/taskListTree.d.ts +33 -0
  53. package/dist/taskMapper.d.ts +3 -0
  54. package/dist/taskOps.d.ts +49 -0
  55. package/dist/taskSearch.d.ts +11 -0
  56. package/dist/taskTree.d.ts +53 -0
  57. package/dist/theme.d.ts +14 -0
  58. package/dist/toast.d.ts +26 -0
  59. package/dist/trash.d.ts +24 -0
  60. package/dist/views.d.ts +8 -0
  61. package/dist/zonedTime.d.ts +30 -0
  62. package/package.json +55 -4
  63. package/test-vectors/filter_vectors.json +1613 -0
  64. package/test-vectors/quick_add_vectors.json +1656 -0
  65. package/test-vectors/recurrence_vectors.json +779 -0
  66. package/test-vectors/task_rules_vectors.json +729 -0
  67. package/README.md +0 -3
package/dist/ids.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Entity ids. Every synced id must be a valid UUID: the server stores `entity_id` in a Postgres
3
+ * `UUID` column, so a non-UUID id makes `POST /sync/push` reject the whole batch with 422.
4
+ */
5
+ export declare const PREFERENCES_ID = "00000000-0000-4000-8000-000000000001";
6
+ export declare function derivedUuidV2(namespace: string, key: string): string;
7
+ export declare function derivedUuidV1(namespace: string, key: string): string;
@@ -0,0 +1,34 @@
1
+ import { type LocalStore } from "@atlastodo/client-core";
2
+ import type { ExportBundle } from "./dataTransfer.js";
3
+ export type TicktickKind = "project" | "section" | "label" | "task";
4
+ export interface TicktickImportOptions {
5
+ userId: string;
6
+ reuseLegacyId?: (kind: TicktickKind, id: string) => boolean;
7
+ timeZone?: string;
8
+ now?: number;
9
+ }
10
+ export interface TicktickImportCounts {
11
+ projects: number;
12
+ sections: number;
13
+ labels: number;
14
+ tasks: number;
15
+ notes: number;
16
+ subtasks: number;
17
+ completed: number;
18
+ abandoned: number;
19
+ }
20
+ export type TicktickWarningCode = "folder" | "noTaskId" | "missingParent" | "repeat" | "reminders" | "checklist" | "timezone";
21
+ export interface TicktickWarning {
22
+ code: TicktickWarningCode;
23
+ detail?: string;
24
+ }
25
+ export interface TicktickImportResult {
26
+ bundle: ExportBundle;
27
+ counts: TicktickImportCounts;
28
+ warnings: TicktickWarning[];
29
+ }
30
+ export declare function parseCsvRows(text: string): string[][];
31
+ export declare function ticktickUuid(kind: string, key: string): string;
32
+ export declare function ticktickUuidV2(userId: string, kind: string, key: string): string;
33
+ export declare function ticktickLegacyIdReusable(store: Pick<LocalStore, "get" | "list">): (kind: TicktickKind, id: string) => boolean;
34
+ export declare function ticktickToBundle(text: string, options: TicktickImportOptions): TicktickImportResult;
@@ -0,0 +1,60 @@
1
+ import type { ExportBundle } from "./dataTransfer.js";
2
+ /**
3
+ * Todoist import: one project's CSV export, or the backup zip (one CSV per project), converted to
4
+ * an `ExportBundle` that `importBundle` merges, as the TickTick import does.
5
+ *
6
+ * The CSV has no ids, so an entity's id is derived from the importing user and where it sits in
7
+ * the file (project, section, parent chain, title): importing the same file again updates what the
8
+ * first import created instead of duplicating it.
9
+ */
10
+ export type TodoistKind = "project" | "section" | "label" | "task" | "comment";
11
+ export interface TodoistFile {
12
+ name: string;
13
+ text: string;
14
+ }
15
+ export interface TodoistImportOptions {
16
+ userId: string;
17
+ timeZone?: string;
18
+ now?: number;
19
+ }
20
+ export interface TodoistImportCounts {
21
+ projects: number;
22
+ sections: number;
23
+ labels: number;
24
+ tasks: number;
25
+ subtasks: number;
26
+ comments: number;
27
+ }
28
+ export type TodoistWarningCode = "notTodoist" | "recurrence" | "date" | "deadline" | "duration" | "assignee" | "projectNote" | "timezone";
29
+ export interface TodoistWarning {
30
+ code: TodoistWarningCode;
31
+ detail?: string;
32
+ }
33
+ export interface TodoistImportResult {
34
+ bundle: ExportBundle;
35
+ counts: TodoistImportCounts;
36
+ warnings: TodoistWarning[];
37
+ }
38
+ export declare function todoistUuid(userId: string, kind: TodoistKind, key: string): string;
39
+ /** "Work [2203306141].csv" -> "Work": the backup appends the project id to each file name. */
40
+ export declare function todoistProjectName(fileName: string): string;
41
+ /**
42
+ * The CSV files of a picked file: every CSV in a backup zip, or the file itself. Decoded with
43
+ * fflate's own UTF-8 decoder, as Hermes has no `TextDecoder` everywhere.
44
+ */
45
+ export declare function readTodoistFiles(name: string, bytes: Uint8Array): TodoistFile[];
46
+ interface ParsedDate {
47
+ dueAt: number;
48
+ recurrence?: string;
49
+ }
50
+ type DateOutcome = ParsedDate | {
51
+ unsupported: "recurrence" | "date";
52
+ };
53
+ /**
54
+ * A Todoist due string ("every monday at 9am", "Oct 12", "2026-10-12") as a due instant, plus an
55
+ * Atlas rule when it repeats. A repeating task starts on its first occurrence from today, as a
56
+ * task typed into Todoist would.
57
+ */
58
+ export declare function parseTodoistDate(raw: string, now: number, timeZone?: string): DateOutcome | null;
59
+ export declare function todoistToBundle(files: TodoistFile[], options: TodoistImportOptions): TodoistImportResult;
60
+ export {};
@@ -0,0 +1,62 @@
1
+ /**
2
+ * `@atlastodo/shared`: portable, framework-free logic shared across clients. Pure logic only: no DOM,
3
+ * React or React Native; platform APIs belong in the owning app. May depend on `@atlastodo/client-core`,
4
+ * not the reverse. A pure rule goes here, something tied to sync/wire types goes in `client-core`,
5
+ * platform I/O goes in the app.
6
+ */
7
+ export * from "./theme.js";
8
+ export * from "./ids.js";
9
+ export * from "./i18n.js";
10
+ export * from "./serverUrl.js";
11
+ export * from "./views.js";
12
+ export * from "./zonedTime.js";
13
+ export * from "./format.js";
14
+ export * from "./regions.js";
15
+ export * from "./quickSchedule.js";
16
+ export * from "./cursor.js";
17
+ export * from "./smartLists.js";
18
+ export * from "./planDay.js";
19
+ export * from "./grouping.js";
20
+ export * from "./rank.js";
21
+ export * from "./reorder.js";
22
+ export * from "./boardMove.js";
23
+ export * from "./calendar.js";
24
+ export * from "./filterQuery.js";
25
+ export * from "./fuzzy.js";
26
+ export * from "./taskSearch.js";
27
+ export * from "./taskMapper.js";
28
+ export * from "./projectMapper.js";
29
+ export * from "./sectionMapper.js";
30
+ export * from "./activity.js";
31
+ export * from "./comments.js";
32
+ export * from "./members.js";
33
+ export * from "./taskOps.js";
34
+ export * from "./taskTree.js";
35
+ export * from "./taskListTree.js";
36
+ export * from "./projectTree.js";
37
+ export * from "./sectionOps.js";
38
+ export * from "./duplicateProject.js";
39
+ export * from "./duplicateSection.js";
40
+ export * from "./dataTransfer.js";
41
+ export * from "./importTicktick.js";
42
+ export * from "./importTodoist.js";
43
+ export * from "./recurrence.js";
44
+ export * from "./reminders.js";
45
+ export * from "./reminderSchedule.js";
46
+ export * from "./quickAddParse.js";
47
+ export * from "./habits.js";
48
+ export * from "./habitGroups.js";
49
+ export * from "./habitSchedule.js";
50
+ export * from "./stats.js";
51
+ export * from "./pomodoro.js";
52
+ export * from "./focus.js";
53
+ export * from "./countdown.js";
54
+ export * from "./swipe.js";
55
+ export * from "./hotkeys.js";
56
+ export * from "./avatarColor.js";
57
+ export * from "./priority.js";
58
+ export * from "./taskClipboard.js";
59
+ export * from "./toast.js";
60
+ export * from "./trash.js";
61
+ export * from "./projectStyle.js";
62
+ export * from "./bugReport.js";