@tashks/core 0.1.4 → 0.2.3

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.
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=schema.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.test.d.ts","sourceRoot":"","sources":["../../src/schema.test.ts"],"names":[],"mappings":""}
@@ -1,123 +0,0 @@
1
- import { describe, expect, it } from "bun:test";
2
- import * as Schema from "effect/Schema";
3
- import { Task, TaskCreateInput, TaskPatch, WorkLogCreateInput, WorkLogEntry, WorkLogPatch, } from "./schema.js";
4
- const isoDatePattern = /^\d{4}-\d{2}-\d{2}$/;
5
- describe("schema", () => {
6
- it("round-trips Task through decode + encode", () => {
7
- const encodedTask = {
8
- id: "revive-unzen",
9
- title: "Revive unzen server",
10
- status: "active",
11
- area: "infrastructure",
12
- project: "homelab",
13
- tags: ["hardware", "weekend"],
14
- created: "2026-02-16",
15
- updated: "2026-02-20",
16
- urgency: "high",
17
- energy: "high",
18
- due: "2026-03-01",
19
- context: "Mini-ITX build",
20
- subtasks: [
21
- { text: "Test PSU", done: true },
22
- { text: "Reassemble drives", done: false },
23
- ],
24
- blocked_by: [],
25
- estimated_minutes: 240,
26
- actual_minutes: null,
27
- completed_at: null,
28
- last_surfaced: "2026-02-19",
29
- defer_until: null,
30
- nudge_count: 2,
31
- recurrence: "FREQ=WEEKLY;BYDAY=MO",
32
- recurrence_trigger: "clock",
33
- recurrence_strategy: "replace",
34
- recurrence_last_generated: "2026-02-24T08:00:00Z",
35
- };
36
- const decode = Schema.decodeUnknownSync(Task);
37
- const encode = Schema.encodeSync(Task);
38
- const decodedTask = decode(encodedTask);
39
- expect(encode(decodedTask)).toEqual(encodedTask);
40
- });
41
- it("round-trips TaskCreateInput and applies defaults", () => {
42
- const decode = Schema.decodeUnknownSync(TaskCreateInput);
43
- const encode = Schema.encodeSync(TaskCreateInput);
44
- const decodedInput = decode({ title: "Capture outage notes" });
45
- expect(decodedInput).toMatchObject({
46
- title: "Capture outage notes",
47
- status: "active",
48
- area: "personal",
49
- project: null,
50
- tags: [],
51
- urgency: "medium",
52
- energy: "medium",
53
- due: null,
54
- context: "",
55
- subtasks: [],
56
- blocked_by: [],
57
- estimated_minutes: null,
58
- actual_minutes: null,
59
- completed_at: null,
60
- last_surfaced: null,
61
- defer_until: null,
62
- nudge_count: 0,
63
- recurrence: null,
64
- recurrence_trigger: "clock",
65
- recurrence_strategy: "replace",
66
- recurrence_last_generated: null,
67
- });
68
- expect(decodedInput.created).toMatch(isoDatePattern);
69
- expect(decodedInput.updated).toMatch(isoDatePattern);
70
- expect(decode(encode(decodedInput))).toEqual(decodedInput);
71
- });
72
- it("round-trips TaskPatch through decode + encode", () => {
73
- const encodedPatch = {
74
- title: "Repair array",
75
- project: "homelab",
76
- tags: ["hardware"],
77
- nudge_count: 3,
78
- recurrence: null,
79
- recurrence_trigger: "completion",
80
- };
81
- const decode = Schema.decodeUnknownSync(TaskPatch);
82
- const encode = Schema.encodeSync(TaskPatch);
83
- const decodedPatch = decode(encodedPatch);
84
- expect(encode(decodedPatch)).toEqual(encodedPatch);
85
- });
86
- it("round-trips WorkLogEntry through decode + encode", () => {
87
- const encodedEntry = {
88
- id: "revive-unzen-20260220T0900",
89
- task_id: "revive-unzen",
90
- started_at: "2026-02-20T09:00:00Z",
91
- ended_at: "2026-02-20T10:30:00Z",
92
- date: "2026-02-20",
93
- };
94
- const decode = Schema.decodeUnknownSync(WorkLogEntry);
95
- const encode = Schema.encodeSync(WorkLogEntry);
96
- const decodedEntry = decode(encodedEntry);
97
- expect(encode(decodedEntry)).toEqual(encodedEntry);
98
- });
99
- it("round-trips WorkLogCreateInput and applies defaults", () => {
100
- const decode = Schema.decodeUnknownSync(WorkLogCreateInput);
101
- const encode = Schema.encodeSync(WorkLogCreateInput);
102
- const decodedInput = decode({
103
- task_id: "revive-unzen",
104
- started_at: "2026-02-20T09:00:00Z",
105
- });
106
- expect(decodedInput).toEqual({
107
- task_id: "revive-unzen",
108
- started_at: "2026-02-20T09:00:00Z",
109
- ended_at: null,
110
- });
111
- expect(decode(encode(decodedInput))).toEqual(decodedInput);
112
- });
113
- it("round-trips WorkLogPatch through decode + encode", () => {
114
- const encodedPatch = {
115
- task_id: "revive-unzen",
116
- ended_at: "2026-02-20T10:30:00Z",
117
- };
118
- const decode = Schema.decodeUnknownSync(WorkLogPatch);
119
- const encode = Schema.encodeSync(WorkLogPatch);
120
- const decodedPatch = decode(encodedPatch);
121
- expect(encode(decodedPatch)).toEqual(encodedPatch);
122
- });
123
- });