@tashks/core 0.1.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.
@@ -0,0 +1,100 @@
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ import {
5
+ type Task,
6
+ type TaskCreateInput,
7
+ type TaskPatch,
8
+ type WorkLogCreateInput,
9
+ type WorkLogEntry,
10
+ type WorkLogPatch,
11
+ } from "./schema.js";
12
+ export interface ListTasksFilters {
13
+ readonly status?: Task["status"];
14
+ readonly area?: Task["area"];
15
+ readonly project?: string;
16
+ readonly tags?: ReadonlyArray<string>;
17
+ readonly due_before?: string;
18
+ readonly due_after?: string;
19
+ readonly unblocked_only?: boolean;
20
+ readonly date?: string;
21
+ }
22
+ export interface ListWorkLogFilters {
23
+ readonly date?: string;
24
+ }
25
+ export interface DeleteResult {
26
+ readonly deleted: true;
27
+ }
28
+ export type HookEvent = "create" | "modify" | "complete" | "delete";
29
+ export interface HookDiscoveryOptions {
30
+ readonly hooksDir?: string;
31
+ readonly env?: NodeJS.ProcessEnv;
32
+ }
33
+ export declare const discoverHooksForEvent: (
34
+ event: HookEvent,
35
+ options?: HookDiscoveryOptions,
36
+ ) => Effect.Effect<Array<string>, string>;
37
+ export interface TaskRepositoryService {
38
+ readonly listTasks: (
39
+ filters?: ListTasksFilters,
40
+ ) => Effect.Effect<Array<Task>, string>;
41
+ readonly getTask: (id: string) => Effect.Effect<Task, string>;
42
+ readonly createTask: (input: TaskCreateInput) => Effect.Effect<Task, string>;
43
+ readonly updateTask: (
44
+ id: string,
45
+ patch: TaskPatch,
46
+ ) => Effect.Effect<Task, string>;
47
+ readonly completeTask: (id: string) => Effect.Effect<Task, string>;
48
+ readonly generateNextRecurrence: (id: string) => Effect.Effect<Task, string>;
49
+ readonly processDueRecurrences: (now: Date) => Effect.Effect<
50
+ {
51
+ readonly created: Array<Task>;
52
+ readonly replaced: Array<string>;
53
+ },
54
+ string
55
+ >;
56
+ readonly deleteTask: (id: string) => Effect.Effect<DeleteResult, string>;
57
+ readonly setDailyHighlight: (id: string) => Effect.Effect<Task, string>;
58
+ readonly listStale: (days: number) => Effect.Effect<Array<Task>, string>;
59
+ readonly listWorkLog: (
60
+ filters?: ListWorkLogFilters,
61
+ ) => Effect.Effect<Array<WorkLogEntry>, string>;
62
+ readonly createWorkLogEntry: (
63
+ input: WorkLogCreateInput,
64
+ ) => Effect.Effect<WorkLogEntry, string>;
65
+ readonly updateWorkLogEntry: (
66
+ id: string,
67
+ patch: WorkLogPatch,
68
+ ) => Effect.Effect<WorkLogEntry, string>;
69
+ readonly deleteWorkLogEntry: (
70
+ id: string,
71
+ ) => Effect.Effect<DeleteResult, string>;
72
+ }
73
+ declare const TaskRepository_base: Context.TagClass<
74
+ TaskRepository,
75
+ "TaskRepository",
76
+ TaskRepositoryService
77
+ >;
78
+ export declare class TaskRepository extends TaskRepository_base {}
79
+ export interface TaskRepositoryLiveOptions {
80
+ readonly dataDir?: string;
81
+ readonly hooksDir?: string;
82
+ readonly hookEnv?: NodeJS.ProcessEnv;
83
+ }
84
+ export declare const TaskRepositoryLive: (
85
+ options?: TaskRepositoryLiveOptions,
86
+ ) => Layer.Layer<TaskRepository>;
87
+ export declare const generateTaskId: (title: string) => string;
88
+ export declare const todayIso: () => string;
89
+ export declare const parseTaskRecord: (record: unknown) => Task | null;
90
+ export declare const parseWorkLogRecord: (
91
+ record: unknown,
92
+ ) => WorkLogEntry | null;
93
+ export declare const createTaskFromInput: (input: TaskCreateInput) => Task;
94
+ export declare const applyTaskPatch: (task: Task, patch: TaskPatch) => Task;
95
+ export declare const applyWorkLogPatch: (
96
+ entry: WorkLogEntry,
97
+ patch: WorkLogPatch,
98
+ ) => WorkLogEntry;
99
+ export {};
100
+ //# sourceMappingURL=repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/repository.ts"],"names":[],"mappings":"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