@gjermundgaraba/wtf-api 0.13.0 → 0.14.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/dist/tasks.d.ts CHANGED
@@ -16,16 +16,35 @@ export declare const Task: Schema.Struct<{
16
16
  readonly parentTaskId: Schema.NullOr<Schema.brand<Schema.String, "TaskId">>;
17
17
  readonly goalIds: Schema.$Array<Schema.brand<Schema.String, "GoalId">>;
18
18
  readonly inheritedGoalIds: Schema.$Array<Schema.brand<Schema.String, "GoalId">>;
19
- readonly sortKey: Schema.String;
20
19
  readonly createdAt: Schema.String;
21
20
  readonly updatedAt: Schema.String;
22
21
  readonly archivedAt: Schema.NullOr<Schema.String>;
23
22
  }>;
24
23
  export type Task = typeof Task.Type;
24
+ export declare const TaskPlacement: Schema.TaggedUnion<{
25
+ readonly Root: Schema.TaggedStruct<"Root", {
26
+ readonly areaId: Schema.brand<Schema.String, "AreaId">;
27
+ }>;
28
+ readonly Under: Schema.TaggedStruct<"Under", {
29
+ readonly parentTaskId: Schema.brand<Schema.String, "TaskId">;
30
+ }>;
31
+ }>;
32
+ export type TaskPlacement = typeof TaskPlacement.Type;
25
33
  export declare const TaskCreate: Schema.Struct<{
26
- readonly areaId: Schema.optionalKey<Schema.brand<Schema.String, "AreaId">>;
27
- readonly parentTaskId: Schema.optionalKey<Schema.NullOr<Schema.brand<Schema.String, "TaskId">>>;
28
- readonly beforeId: Schema.optionalKey<Schema.NullOr<Schema.brand<Schema.String, "TaskId">>>;
34
+ readonly placement: Schema.optionalKey<Schema.TaggedUnion<{
35
+ readonly Root: Schema.TaggedStruct<"Root", {
36
+ readonly areaId: Schema.brand<Schema.String, "AreaId">;
37
+ }>;
38
+ readonly Under: Schema.TaggedStruct<"Under", {
39
+ readonly parentTaskId: Schema.brand<Schema.String, "TaskId">;
40
+ }>;
41
+ }>>;
42
+ readonly position: Schema.optionalKey<Schema.TaggedUnion<{
43
+ readonly Before: Schema.TaggedStruct<"Before", {
44
+ readonly id: Schema.brand<Schema.String, "TaskId">;
45
+ }>;
46
+ readonly End: Schema.TaggedStruct<"End", {}>;
47
+ }>>;
29
48
  readonly description: Schema.optionalKey<Schema.String>;
30
49
  readonly status: Schema.optionalKey<Schema.Literals<readonly ["inbox", "backlog", "todo", "in_progress", "done", "cancelled"]>>;
31
50
  readonly focus: Schema.optionalKey<Schema.Boolean>;
@@ -38,9 +57,20 @@ export declare const TaskCreate: Schema.Struct<{
38
57
  export interface TaskCreate extends Schema.Schema.Type<typeof TaskCreate> {
39
58
  }
40
59
  export declare const TaskUpdate: Schema.Struct<{
41
- readonly areaId: Schema.optionalKey<Schema.brand<Schema.String, "AreaId">>;
42
- readonly parentTaskId: Schema.optionalKey<Schema.NullOr<Schema.brand<Schema.String, "TaskId">>>;
43
- readonly beforeId: Schema.optionalKey<Schema.NullOr<Schema.brand<Schema.String, "TaskId">>>;
60
+ readonly placement: Schema.optionalKey<Schema.TaggedUnion<{
61
+ readonly Root: Schema.TaggedStruct<"Root", {
62
+ readonly areaId: Schema.brand<Schema.String, "AreaId">;
63
+ }>;
64
+ readonly Under: Schema.TaggedStruct<"Under", {
65
+ readonly parentTaskId: Schema.brand<Schema.String, "TaskId">;
66
+ }>;
67
+ }>>;
68
+ readonly position: Schema.optionalKey<Schema.TaggedUnion<{
69
+ readonly Before: Schema.TaggedStruct<"Before", {
70
+ readonly id: Schema.brand<Schema.String, "TaskId">;
71
+ }>;
72
+ readonly End: Schema.TaggedStruct<"End", {}>;
73
+ }>>;
44
74
  readonly title: Schema.optionalKey<Schema.String>;
45
75
  readonly description: Schema.optionalKey<Schema.String>;
46
76
  readonly status: Schema.optionalKey<Schema.Literals<readonly ["inbox", "backlog", "todo", "in_progress", "done", "cancelled"]>>;
@@ -86,7 +116,6 @@ export declare const TaskActions: readonly [Action.Action<"tasks_list", Schema.S
86
116
  readonly parentTaskId: Schema.NullOr<Schema.brand<Schema.String, "TaskId">>;
87
117
  readonly goalIds: Schema.$Array<Schema.brand<Schema.String, "GoalId">>;
88
118
  readonly inheritedGoalIds: Schema.$Array<Schema.brand<Schema.String, "GoalId">>;
89
- readonly sortKey: Schema.String;
90
119
  readonly createdAt: Schema.String;
91
120
  readonly updatedAt: Schema.String;
92
121
  readonly archivedAt: Schema.NullOr<Schema.String>;
@@ -105,14 +134,24 @@ export declare const TaskActions: readonly [Action.Action<"tasks_list", Schema.S
105
134
  readonly parentTaskId: Schema.NullOr<Schema.brand<Schema.String, "TaskId">>;
106
135
  readonly goalIds: Schema.$Array<Schema.brand<Schema.String, "GoalId">>;
107
136
  readonly inheritedGoalIds: Schema.$Array<Schema.brand<Schema.String, "GoalId">>;
108
- readonly sortKey: Schema.String;
109
137
  readonly createdAt: Schema.String;
110
138
  readonly updatedAt: Schema.String;
111
139
  readonly archivedAt: Schema.NullOr<Schema.String>;
112
140
  }>, readonly (typeof NotFound | typeof StorageError)[], true, typeof Action.Anyone, undefined, undefined>, Action.Action<"tasks_create", Schema.Struct<{
113
- readonly areaId: Schema.optionalKey<Schema.brand<Schema.String, "AreaId">>;
114
- readonly parentTaskId: Schema.optionalKey<Schema.NullOr<Schema.brand<Schema.String, "TaskId">>>;
115
- readonly beforeId: Schema.optionalKey<Schema.NullOr<Schema.brand<Schema.String, "TaskId">>>;
141
+ readonly placement: Schema.optionalKey<Schema.TaggedUnion<{
142
+ readonly Root: Schema.TaggedStruct<"Root", {
143
+ readonly areaId: Schema.brand<Schema.String, "AreaId">;
144
+ }>;
145
+ readonly Under: Schema.TaggedStruct<"Under", {
146
+ readonly parentTaskId: Schema.brand<Schema.String, "TaskId">;
147
+ }>;
148
+ }>>;
149
+ readonly position: Schema.optionalKey<Schema.TaggedUnion<{
150
+ readonly Before: Schema.TaggedStruct<"Before", {
151
+ readonly id: Schema.brand<Schema.String, "TaskId">;
152
+ }>;
153
+ readonly End: Schema.TaggedStruct<"End", {}>;
154
+ }>>;
116
155
  readonly description: Schema.optionalKey<Schema.String>;
117
156
  readonly status: Schema.optionalKey<Schema.Literals<readonly ["inbox", "backlog", "todo", "in_progress", "done", "cancelled"]>>;
118
157
  readonly focus: Schema.optionalKey<Schema.Boolean>;
@@ -134,14 +173,24 @@ export declare const TaskActions: readonly [Action.Action<"tasks_list", Schema.S
134
173
  readonly parentTaskId: Schema.NullOr<Schema.brand<Schema.String, "TaskId">>;
135
174
  readonly goalIds: Schema.$Array<Schema.brand<Schema.String, "GoalId">>;
136
175
  readonly inheritedGoalIds: Schema.$Array<Schema.brand<Schema.String, "GoalId">>;
137
- readonly sortKey: Schema.String;
138
176
  readonly createdAt: Schema.String;
139
177
  readonly updatedAt: Schema.String;
140
178
  readonly archivedAt: Schema.NullOr<Schema.String>;
141
179
  }>, readonly (typeof NotFound | typeof PlacementRefused | typeof NoArea | typeof StorageError)[], false, typeof Action.Anyone, undefined, undefined>, Action.Action<"tasks_update", Schema.Struct<{
142
- readonly areaId: Schema.optionalKey<Schema.brand<Schema.String, "AreaId">>;
143
- readonly parentTaskId: Schema.optionalKey<Schema.NullOr<Schema.brand<Schema.String, "TaskId">>>;
144
- readonly beforeId: Schema.optionalKey<Schema.NullOr<Schema.brand<Schema.String, "TaskId">>>;
180
+ readonly placement: Schema.optionalKey<Schema.TaggedUnion<{
181
+ readonly Root: Schema.TaggedStruct<"Root", {
182
+ readonly areaId: Schema.brand<Schema.String, "AreaId">;
183
+ }>;
184
+ readonly Under: Schema.TaggedStruct<"Under", {
185
+ readonly parentTaskId: Schema.brand<Schema.String, "TaskId">;
186
+ }>;
187
+ }>>;
188
+ readonly position: Schema.optionalKey<Schema.TaggedUnion<{
189
+ readonly Before: Schema.TaggedStruct<"Before", {
190
+ readonly id: Schema.brand<Schema.String, "TaskId">;
191
+ }>;
192
+ readonly End: Schema.TaggedStruct<"End", {}>;
193
+ }>>;
145
194
  readonly title: Schema.optionalKey<Schema.String>;
146
195
  readonly description: Schema.optionalKey<Schema.String>;
147
196
  readonly status: Schema.optionalKey<Schema.Literals<readonly ["inbox", "backlog", "todo", "in_progress", "done", "cancelled"]>>;
@@ -164,7 +213,6 @@ export declare const TaskActions: readonly [Action.Action<"tasks_list", Schema.S
164
213
  readonly parentTaskId: Schema.NullOr<Schema.brand<Schema.String, "TaskId">>;
165
214
  readonly goalIds: Schema.$Array<Schema.brand<Schema.String, "GoalId">>;
166
215
  readonly inheritedGoalIds: Schema.$Array<Schema.brand<Schema.String, "GoalId">>;
167
- readonly sortKey: Schema.String;
168
216
  readonly createdAt: Schema.String;
169
217
  readonly updatedAt: Schema.String;
170
218
  readonly archivedAt: Schema.NullOr<Schema.String>;
@@ -183,7 +231,6 @@ export declare const TaskActions: readonly [Action.Action<"tasks_list", Schema.S
183
231
  readonly parentTaskId: Schema.NullOr<Schema.brand<Schema.String, "TaskId">>;
184
232
  readonly goalIds: Schema.$Array<Schema.brand<Schema.String, "GoalId">>;
185
233
  readonly inheritedGoalIds: Schema.$Array<Schema.brand<Schema.String, "GoalId">>;
186
- readonly sortKey: Schema.String;
187
234
  readonly createdAt: Schema.String;
188
235
  readonly updatedAt: Schema.String;
189
236
  readonly archivedAt: Schema.NullOr<Schema.String>;
@@ -202,7 +249,6 @@ export declare const TaskActions: readonly [Action.Action<"tasks_list", Schema.S
202
249
  readonly parentTaskId: Schema.NullOr<Schema.brand<Schema.String, "TaskId">>;
203
250
  readonly goalIds: Schema.$Array<Schema.brand<Schema.String, "GoalId">>;
204
251
  readonly inheritedGoalIds: Schema.$Array<Schema.brand<Schema.String, "GoalId">>;
205
- readonly sortKey: Schema.String;
206
252
  readonly createdAt: Schema.String;
207
253
  readonly updatedAt: Schema.String;
208
254
  readonly archivedAt: Schema.NullOr<Schema.String>;
package/dist/tasks.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as Action from "@gjermundgaraba/effect-actions/Action";
2
2
  import { Schema } from "effect";
3
- import { AreaId, CalendarDate, Description, GoalId, NoArea, NotFound, PlacementRefused, StorageError, TaskId, Title, } from "./shared.js";
3
+ import { AreaId, CalendarDate, Description, GoalId, NoArea, NotFound, PlacementRefused, StorageError, TaskId, TaskPosition, Title, } from "./shared.js";
4
4
  export const TaskStatus = Schema.Literals([
5
5
  "inbox",
6
6
  "backlog",
@@ -25,15 +25,19 @@ export const Task = Schema.Struct({
25
25
  ...content,
26
26
  goalIds: Schema.Array(GoalId),
27
27
  inheritedGoalIds: Schema.Array(GoalId),
28
- sortKey: Schema.String,
29
28
  createdAt: Schema.String,
30
29
  updatedAt: Schema.String,
31
30
  archivedAt: Schema.NullOr(Schema.String),
32
31
  });
33
- const placement = {
34
- areaId: Schema.optionalKey(AreaId),
35
- parentTaskId: Schema.optionalKey(Schema.NullOr(TaskId)),
36
- beforeId: Schema.optionalKey(Schema.NullOr(TaskId)),
32
+ export const TaskPlacement = Schema.TaggedUnion({
33
+ Root: { areaId: AreaId },
34
+ Under: { parentTaskId: TaskId },
35
+ }).annotate({
36
+ description: "Where a task sits: at the Root of the area whose id is given, or Under the parent task whose id is given, in that parent's area.",
37
+ });
38
+ const place = {
39
+ placement: Schema.optionalKey(TaskPlacement),
40
+ position: Schema.optionalKey(TaskPosition),
37
41
  };
38
42
  const edits = {
39
43
  title: Schema.optionalKey(Title),
@@ -48,9 +52,9 @@ const edits = {
48
52
  export const TaskCreate = Schema.Struct({
49
53
  ...edits,
50
54
  title: Title,
51
- ...placement,
55
+ ...place,
52
56
  });
53
- export const TaskUpdate = Schema.Struct({ id: TaskId, ...edits, ...placement });
57
+ export const TaskUpdate = Schema.Struct({ id: TaskId, ...edits, ...place });
54
58
  export const TaskList = Schema.Struct({
55
59
  areaId: Schema.optionalKey(AreaId),
56
60
  statuses: Schema.optionalKey(Schema.Array(TaskStatus)),
@@ -79,7 +83,7 @@ export const TaskActions = [
79
83
  Action.make("tasks_create", {
80
84
  caller: Action.Anyone,
81
85
  error: [NotFound, PlacementRefused, NoArea, StorageError],
82
- description: "Capture a task, defaulting to inbox in the first area. A parent supplies its area and must not be archived. goalIds links it to goals in any area; it also serves every goal its ancestors link, listed in inheritedGoalIds.",
86
+ description: "Capture a task, defaulting to inbox. placement Root captures it at an area's root; Under captures it under a parent task, in the parent's area, and the parent must not be archived. Omitted placement captures it at the first area's root, refused with NoArea while no area exists. position orders it among its siblings; omitted, it goes at the End. goalIds links it to goals in any area; it also serves every goal its ancestors link, listed in inheritedGoalIds.",
83
87
  readOnly: false,
84
88
  input: TaskCreate,
85
89
  success: Task,
@@ -87,7 +91,7 @@ export const TaskActions = [
87
91
  Action.make("tasks_update", {
88
92
  caller: Action.Anyone,
89
93
  error: [NotFound, PlacementRefused, StorageError],
90
- description: "Update task content, goal links, and placement atomically, carrying its subtree to the destination area. goalIds replaces the task's own links, to goals in any area, archived ones included; inheritedGoalIds is derived from its ancestors and changes when they or its place change. Null clears wakeOn, dueOn, or owedTo. Omitted parentTaskId preserves it, except that a move to another areaId lands at that area's root; null means area root. A parent supplies its area; an explicit area must agree with an explicit parent. Omitted beforeId preserves order within the same siblings and appends when changing groups; null explicitly appends. A task that is not archived cannot move under an archived parent.",
94
+ description: "Update task content, goal links, and place atomically, carrying its subtree to the destination area. goalIds replaces the task's own links, to goals in any area, archived ones included; inheritedGoalIds is derived from its ancestors and changes when they or its place change. Null clears wakeOn, dueOn, or owedTo. placement Root moves it to an area's root; Under moves it under a parent task and into that parent's area. Omitted placement keeps it where it is. position orders it among its siblings; omitted, it keeps its order when placement names its current group, and goes at the End of a new group. A task cannot move under itself or its own subtree, and a task that is not archived cannot move under an archived parent.",
91
95
  readOnly: false,
92
96
  input: TaskUpdate,
93
97
  success: Task,
package/dist/values.d.ts CHANGED
@@ -8,7 +8,8 @@ export type Values = typeof Values.Type;
8
8
  export declare const ValuesUpdate: Schema.Struct<{
9
9
  readonly text: Schema.String;
10
10
  }>;
11
- export type ValuesUpdate = typeof ValuesUpdate.Type;
11
+ export interface ValuesUpdate extends Schema.Schema.Type<typeof ValuesUpdate> {
12
+ }
12
13
  export declare const ValuesActions: readonly [Action.Action<"values_get", Schema.$Record<Schema.String, Schema.Never>, Schema.Struct<{
13
14
  readonly text: Schema.String;
14
15
  }>, readonly (typeof StorageError)[], true, typeof Action.Anyone, undefined, undefined>, Action.Action<"values_update", Schema.Struct<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjermundgaraba/wtf-api",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "The wtf wire contract: the area, goal and task actions, their inputs, records and errors, for a typed HTTP or MCP client.",
5
5
  "license": "MIT",
6
6
  "repository": {