@critical-path/core 0.36.0 → 0.36.1

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 (185) hide show
  1. package/package.json +5 -1
  2. package/CHANGELOG.md +0 -593
  3. package/dist/deliverables.test.d.ts +0 -2
  4. package/dist/deliverables.test.d.ts.map +0 -1
  5. package/dist/deliverables.test.js +0 -232
  6. package/dist/deliverables.test.js.map +0 -1
  7. package/dist/domain/calendar.test.d.ts +0 -2
  8. package/dist/domain/calendar.test.d.ts.map +0 -1
  9. package/dist/domain/calendar.test.js +0 -181
  10. package/dist/domain/calendar.test.js.map +0 -1
  11. package/dist/domain/cpm.test.d.ts +0 -2
  12. package/dist/domain/cpm.test.d.ts.map +0 -1
  13. package/dist/domain/cpm.test.js +0 -166
  14. package/dist/domain/cpm.test.js.map +0 -1
  15. package/dist/domain/ddd.test.d.ts +0 -2
  16. package/dist/domain/ddd.test.d.ts.map +0 -1
  17. package/dist/domain/ddd.test.js +0 -349
  18. package/dist/domain/ddd.test.js.map +0 -1
  19. package/dist/domain/ladder.test.d.ts +0 -2
  20. package/dist/domain/ladder.test.d.ts.map +0 -1
  21. package/dist/domain/ladder.test.js +0 -213
  22. package/dist/domain/ladder.test.js.map +0 -1
  23. package/dist/domain/metrics.test.d.ts +0 -2
  24. package/dist/domain/metrics.test.d.ts.map +0 -1
  25. package/dist/domain/metrics.test.js +0 -252
  26. package/dist/domain/metrics.test.js.map +0 -1
  27. package/dist/domain/task-duration.test.d.ts +0 -2
  28. package/dist/domain/task-duration.test.d.ts.map +0 -1
  29. package/dist/domain/task-duration.test.js +0 -307
  30. package/dist/domain/task-duration.test.js.map +0 -1
  31. package/dist/domain/workload.test.d.ts +0 -2
  32. package/dist/domain/workload.test.d.ts.map +0 -1
  33. package/dist/domain/workload.test.js +0 -261
  34. package/dist/domain/workload.test.js.map +0 -1
  35. package/dist/engine/actor.test.d.ts +0 -2
  36. package/dist/engine/actor.test.d.ts.map +0 -1
  37. package/dist/engine/actor.test.js +0 -54
  38. package/dist/engine/actor.test.js.map +0 -1
  39. package/dist/engine/authorization.test.d.ts +0 -2
  40. package/dist/engine/authorization.test.d.ts.map +0 -1
  41. package/dist/engine/authorization.test.js +0 -154
  42. package/dist/engine/authorization.test.js.map +0 -1
  43. package/dist/engine/cascade.test.d.ts +0 -2
  44. package/dist/engine/cascade.test.d.ts.map +0 -1
  45. package/dist/engine/cascade.test.js +0 -99
  46. package/dist/engine/cascade.test.js.map +0 -1
  47. package/dist/engine/config.test.d.ts +0 -2
  48. package/dist/engine/config.test.d.ts.map +0 -1
  49. package/dist/engine/config.test.js +0 -46
  50. package/dist/engine/config.test.js.map +0 -1
  51. package/dist/engine/entity-events.test.d.ts +0 -2
  52. package/dist/engine/entity-events.test.d.ts.map +0 -1
  53. package/dist/engine/entity-events.test.js +0 -61
  54. package/dist/engine/entity-events.test.js.map +0 -1
  55. package/dist/index.test.d.ts +0 -2
  56. package/dist/index.test.d.ts.map +0 -1
  57. package/dist/index.test.js +0 -429
  58. package/dist/index.test.js.map +0 -1
  59. package/dist/plugins/plugins.test.d.ts +0 -2
  60. package/dist/plugins/plugins.test.d.ts.map +0 -1
  61. package/dist/plugins/plugins.test.js +0 -137
  62. package/dist/plugins/plugins.test.js.map +0 -1
  63. package/dist/schemas/schemas.test.d.ts +0 -2
  64. package/dist/schemas/schemas.test.d.ts.map +0 -1
  65. package/dist/schemas/schemas.test.js +0 -58
  66. package/dist/schemas/schemas.test.js.map +0 -1
  67. package/dist/status.test.d.ts +0 -2
  68. package/dist/status.test.d.ts.map +0 -1
  69. package/dist/status.test.js +0 -295
  70. package/dist/status.test.js.map +0 -1
  71. package/dist/storage/storage.test.d.ts +0 -2
  72. package/dist/storage/storage.test.d.ts.map +0 -1
  73. package/dist/storage/storage.test.js +0 -236
  74. package/dist/storage/storage.test.js.map +0 -1
  75. package/dist/storage/upload-limits.test.d.ts +0 -2
  76. package/dist/storage/upload-limits.test.d.ts.map +0 -1
  77. package/dist/storage/upload-limits.test.js +0 -31
  78. package/dist/storage/upload-limits.test.js.map +0 -1
  79. package/dist/store/conformance.test.d.ts +0 -2
  80. package/dist/store/conformance.test.d.ts.map +0 -1
  81. package/dist/store/conformance.test.js +0 -15
  82. package/dist/store/conformance.test.js.map +0 -1
  83. package/dist/store/firebase.test.d.ts +0 -2
  84. package/dist/store/firebase.test.d.ts.map +0 -1
  85. package/dist/store/firebase.test.js +0 -103
  86. package/dist/store/firebase.test.js.map +0 -1
  87. package/dist/store/query.test.d.ts +0 -2
  88. package/dist/store/query.test.d.ts.map +0 -1
  89. package/dist/store/query.test.js +0 -89
  90. package/dist/store/query.test.js.map +0 -1
  91. package/dist/store/sqlite.test.d.ts +0 -2
  92. package/dist/store/sqlite.test.d.ts.map +0 -1
  93. package/dist/store/sqlite.test.js +0 -177
  94. package/dist/store/sqlite.test.js.map +0 -1
  95. package/dist/task-state.test.d.ts +0 -2
  96. package/dist/task-state.test.d.ts.map +0 -1
  97. package/dist/task-state.test.js +0 -423
  98. package/dist/task-state.test.js.map +0 -1
  99. package/dist/use-case-validation.test.d.ts +0 -2
  100. package/dist/use-case-validation.test.d.ts.map +0 -1
  101. package/dist/use-case-validation.test.js +0 -281
  102. package/dist/use-case-validation.test.js.map +0 -1
  103. package/dist/utils/fractional-index.test.d.ts +0 -2
  104. package/dist/utils/fractional-index.test.d.ts.map +0 -1
  105. package/dist/utils/fractional-index.test.js +0 -182
  106. package/dist/utils/fractional-index.test.js.map +0 -1
  107. package/dist/utils/key.test.d.ts +0 -2
  108. package/dist/utils/key.test.d.ts.map +0 -1
  109. package/dist/utils/key.test.js +0 -65
  110. package/dist/utils/key.test.js.map +0 -1
  111. package/dist/utils/mentions.test.d.ts +0 -2
  112. package/dist/utils/mentions.test.d.ts.map +0 -1
  113. package/dist/utils/mentions.test.js +0 -114
  114. package/dist/utils/mentions.test.js.map +0 -1
  115. package/dist/webhooks/webhooks.test.d.ts +0 -2
  116. package/dist/webhooks/webhooks.test.d.ts.map +0 -1
  117. package/dist/webhooks/webhooks.test.js +0 -154
  118. package/dist/webhooks/webhooks.test.js.map +0 -1
  119. package/src/deliverables.test.ts +0 -284
  120. package/src/domain/authorization.ts +0 -82
  121. package/src/domain/calendar.test.ts +0 -216
  122. package/src/domain/calendar.ts +0 -502
  123. package/src/domain/cpm.test.ts +0 -189
  124. package/src/domain/cpm.ts +0 -258
  125. package/src/domain/custom-fields.ts +0 -172
  126. package/src/domain/ddd.test.ts +0 -442
  127. package/src/domain/entities.ts +0 -798
  128. package/src/domain/errors.ts +0 -38
  129. package/src/domain/events.ts +0 -369
  130. package/src/domain/graph.ts +0 -70
  131. package/src/domain/index.ts +0 -12
  132. package/src/domain/ladder.test.ts +0 -251
  133. package/src/domain/ladder.ts +0 -474
  134. package/src/domain/metrics.test.ts +0 -288
  135. package/src/domain/metrics.ts +0 -497
  136. package/src/domain/task-duration.test.ts +0 -354
  137. package/src/domain/workload.test.ts +0 -311
  138. package/src/domain/workload.ts +0 -457
  139. package/src/engine/actor.test.ts +0 -63
  140. package/src/engine/authorization.test.ts +0 -199
  141. package/src/engine/cascade.test.ts +0 -121
  142. package/src/engine/config.test.ts +0 -51
  143. package/src/engine/entity-events.test.ts +0 -67
  144. package/src/engine/index.ts +0 -2495
  145. package/src/index.test.ts +0 -514
  146. package/src/index.ts +0 -9
  147. package/src/plugins/index.ts +0 -103
  148. package/src/plugins/plugins.test.ts +0 -161
  149. package/src/schemas/index.ts +0 -402
  150. package/src/schemas/schemas.test.ts +0 -116
  151. package/src/status.test.ts +0 -354
  152. package/src/storage/file-storage.ts +0 -200
  153. package/src/storage/firebase-storage.ts +0 -209
  154. package/src/storage/index.ts +0 -3
  155. package/src/storage/s3.ts +0 -151
  156. package/src/storage/storage.test.ts +0 -274
  157. package/src/storage/upload-limits.test.ts +0 -41
  158. package/src/store/conformance.test.ts +0 -15
  159. package/src/store/firebase.test.ts +0 -131
  160. package/src/store/firebase.ts +0 -658
  161. package/src/store/index.ts +0 -623
  162. package/src/store/query.test.ts +0 -110
  163. package/src/store/query.ts +0 -113
  164. package/src/store/sqlite.test.ts +0 -218
  165. package/src/store/sqlite.ts +0 -1480
  166. package/src/task-state.test.ts +0 -506
  167. package/src/testing/conformance.ts +0 -319
  168. package/src/testing/index.ts +0 -1
  169. package/src/types/index.ts +0 -871
  170. package/src/use-case-validation.test.ts +0 -324
  171. package/src/utils/fractional-index.test.ts +0 -228
  172. package/src/utils/fractional-index.ts +0 -254
  173. package/src/utils/index.ts +0 -7
  174. package/src/utils/key.test.ts +0 -76
  175. package/src/utils/key.ts +0 -62
  176. package/src/utils/mentions.test.ts +0 -132
  177. package/src/utils/mentions.ts +0 -131
  178. package/src/utils/status.ts +0 -419
  179. package/src/utils/workflow.ts +0 -306
  180. package/src/webhooks/dispatcher.ts +0 -190
  181. package/src/webhooks/index.ts +0 -2
  182. package/src/webhooks/signature.ts +0 -57
  183. package/src/webhooks/webhooks.test.ts +0 -201
  184. package/tsconfig.json +0 -8
  185. package/tsconfig.tsbuildinfo +0 -1
@@ -1,319 +0,0 @@
1
- /**
2
- * Storage adapter conformance suite. Run it against any `StorageAdapter` (including your own) to
3
- * check it behaves like the built-in adapters:
4
- *
5
- * import { describe, it, expect } from 'vitest';
6
- * import { runStorageAdapterConformance } from '@critical-path/core/testing';
7
- * runStorageAdapterConformance({ name: 'PostgresStore', createStore: () => new PostgresStore(...), describe, it, expect });
8
- *
9
- * The test runner functions are passed in so core has no test-framework dependency.
10
- */
11
- import type { StorageAdapter } from '../store/index.js';
12
- import type { Project, Task, Team, Workflow, Attachment, Deliverable, TaskContainer, Iteration, Comment } from '../types/index.js';
13
-
14
- type Describe = (name: string, fn: () => void) => void;
15
- type It = (name: string, fn: () => Promise<void> | void) => void;
16
- // Minimal expect surface used by the suite (compatible with vitest and jest)
17
- type Expect = (value: unknown) => {
18
- toEqual(expected: unknown): void;
19
- toBe(expected: unknown): void;
20
- toBeNull(): void;
21
- toBeUndefined(): void;
22
- toBeDefined(): void;
23
- toHaveLength(length: number): void;
24
- toMatchObject(expected: object): void;
25
- not: { toBeNull(): void; toHaveProperty(key: string): void };
26
- };
27
-
28
- export interface ConformanceOptions {
29
- name: string;
30
- createStore: () => StorageAdapter | Promise<StorageAdapter>;
31
- describe: Describe;
32
- it: It;
33
- expect: Expect;
34
- }
35
-
36
- const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
37
-
38
- const schedule = {
39
- name: 'Four-day week',
40
- timezone: 'Europe/London',
41
- defaultHoursPerDay: 8,
42
- days: [{ dayOfWeek: 1, isWorkingDay: true, hours: [{ start: '09:00', end: '17:00' }] }],
43
- holidays: [{ date: '2026-12-25', name: 'Christmas' }]
44
- };
45
-
46
- /** A project with every optional field set. */
47
- const fullProject = (): Omit<Project, 'id' | 'createdAt' | 'updatedAt'> => ({
48
- key: 'CONF',
49
- name: 'Conformance',
50
- description: 'Every field',
51
- ownerId: 'owner-1',
52
- members: [{ userId: 'u1', role: 'admin' }],
53
- teamIds: ['team-1'],
54
- workflowId: 'wf-1',
55
- taskTypes: [{ key: 'bug', label: 'Bug' }],
56
- statusDefinitions: [{ key: 'todo', label: 'To Do', category: 'not_started' }],
57
- priorityDefinitions: [{ key: 'p1', label: 'P1', level: 1 }],
58
- customFieldDefinitions: [{ id: 'f1', key: 'client', label: 'Client', type: 'text', required: false }],
59
- schedule,
60
- startDate: '2026-10-01',
61
- targetEndDate: '2026-12-31',
62
- tenantId: 'tenant-1'
63
- });
64
-
65
- /** A task with every optional field set. */
66
- const fullTask = (projectId: string): Omit<Task, 'id' | 'createdAt' | 'updatedAt'> => ({
67
- projectId,
68
- key: 'CONF-1',
69
- title: 'Every field',
70
- description: 'All of them',
71
- status: 'in_progress',
72
- semanticStatus: 'in_progress',
73
- priority: 'high',
74
- taskType: 'bug',
75
- assigneeId: 'u1',
76
- assignees: [{ id: 'u1', name: 'Ana', role: 'lead', type: 'user', avatarUrl: 'https://example.com/a.png' }],
77
- reporterId: 'u2',
78
- reviewerId: 'u3',
79
- iterationId: 'it-1',
80
- teamId: 'team-1',
81
- containerId: 'c-1',
82
- deliverableId: 'd-1',
83
- plannedStartDate: '2026-10-01',
84
- actualStartDate: '2026-10-02T09:00:00.000Z',
85
- dueDate: '2026-10-10',
86
- estimatedHours: 8,
87
- loggedHours: 2,
88
- actualHours: 2,
89
- billableHours: 1,
90
- estimatedDurationMinutes: 480,
91
- actualDurationMinutes: 120,
92
- billableDurationMinutes: 60,
93
- actualDurationSeconds: 7200,
94
- inProgressSince: '2026-10-02T09:00:00.000Z',
95
- blockedDurationSeconds: 60,
96
- progress: 25,
97
- isBlocked: false,
98
- tags: ['a', 'b'],
99
- todos: [{ id: 'todo-1', title: 'First', completed: false, createdAt: '2026-10-02T09:00:00.000Z' }],
100
- customFields: { client: 'Acme', nested: { level: 2 } },
101
- parentId: 'parent-1'
102
- });
103
-
104
- export function runStorageAdapterConformance({ name, createStore, describe, it, expect }: ConformanceOptions): void {
105
- describe(`StorageAdapter conformance: ${name}`, () => {
106
- it('round-trips every project field', async () => {
107
- const store = await createStore();
108
- const input = fullProject();
109
- const created = await store.createProject(input);
110
- expect(await store.getProject(created.id)).toMatchObject(input);
111
- expect(await store.getProjects()).toHaveLength(1);
112
- });
113
-
114
- it('round-trips every task field', async () => {
115
- const store = await createStore();
116
- const project = await store.createProject({ name: 'P' });
117
- const input = fullTask(project.id);
118
- const created = await store.createTask(input);
119
- expect(await store.getTask(created.id)).toMatchObject(input);
120
- });
121
-
122
- it('updates tasks partially, clears fields set to undefined, and replaces nested objects', async () => {
123
- const store = await createStore();
124
- const project = await store.createProject({ name: 'P' });
125
- const created = await store.createTask(fullTask(project.id));
126
-
127
- await store.updateTask(created.id, {
128
- title: 'Renamed',
129
- completedAt: undefined,
130
- parentId: undefined,
131
- iterationId: undefined,
132
- customFields: { client: 'Globex' }
133
- });
134
- const updated = (await store.getTask(created.id)) as unknown as Record<string, unknown>;
135
- expect(updated.title).toBe('Renamed');
136
- expect(updated.description).toBe('All of them');
137
- expect(updated.parentId).toBeUndefined();
138
- expect(updated.iterationId).toBeUndefined();
139
- expect(updated.customFields).toEqual({ client: 'Globex' });
140
- expect(updated.parentId === null).toBe(false);
141
- });
142
-
143
- it('returns copies, so mutating results or reused inputs does not change stored records', async () => {
144
- const store = await createStore();
145
- const project = await store.createProject({ name: 'P' });
146
- const input = { projectId: project.id, title: 'Original', status: 'todo', priority: 'medium', tags: ['a'] };
147
- const created = await store.createTask(input);
148
-
149
- input.tags.push('mutated-input');
150
- input.title = 'Mutated input';
151
- const fetched = (await store.getTask(created.id))!;
152
- fetched.tags!.push('mutated-result');
153
- fetched.title = 'Mutated result';
154
- (await store.getTasks(project.id))[0].title = 'Mutated list';
155
-
156
- const stored = await store.getTask(created.id);
157
- expect(stored?.title).toBe('Original');
158
- expect(stored?.tags).toEqual(['a']);
159
- });
160
-
161
- it('follows the not-found contract', async () => {
162
- const store = await createStore();
163
- expect(await store.getProject('missing')).toBeNull();
164
- expect(await store.getTask('missing')).toBeNull();
165
- expect(await store.updateTask('missing', { title: 'x' })).toBeNull();
166
- expect(await store.updateProject('missing', { name: 'x' })).toBeNull();
167
- expect(await store.deleteTask('missing')).toBe(false);
168
- expect(await store.deleteProject('missing')).toBe(false);
169
- expect(await store.getComment('missing')).toBeNull();
170
- expect(await store.deleteComment('missing')).toBe(false);
171
- expect(await store.getAttachment('missing')).toBeNull();
172
- expect(await store.deleteAttachment('missing')).toBe(false);
173
- expect(await store.getDependency('missing')).toBeNull();
174
- expect(await store.removeDependency('missing')).toBe(false);
175
- expect(await store.getWebhook('missing')).toBeNull();
176
- expect(await store.deleteWebhook('missing')).toBe(false);
177
- });
178
-
179
- it('round-trips teams, workflows, containers, iterations and deliverables', async () => {
180
- const store = await createStore();
181
- const project = await store.createProject({ name: 'P' });
182
-
183
- const team: Omit<Team, 'id' | 'createdAt' | 'updatedAt'> = {
184
- name: 'Core',
185
- description: 'Team',
186
- leaderId: 'u1',
187
- memberIds: ['u1', 'u2'],
188
- weeklyCapacityHours: 80,
189
- schedule,
190
- tenantId: 'tenant-1'
191
- };
192
- expect(await store.getTeam((await store.createTeam(team)).id)).toMatchObject(team);
193
-
194
- const workflow: Omit<Workflow, 'id' | 'createdAt' | 'updatedAt'> = {
195
- name: 'Flow',
196
- description: 'Workflow',
197
- statuses: [{ key: 'todo', label: 'To Do', category: 'not_started' }],
198
- transitions: [{ id: 't1', name: 'Start', fromStatusKey: '*', toStatusKey: 'todo' }],
199
- taskTypes: [{ key: 'bug', label: 'Bug' }],
200
- defaultStatusKey: 'todo',
201
- isDefault: true,
202
- tenantId: 'tenant-1'
203
- };
204
- expect(await store.getWorkflow((await store.createWorkflow(workflow)).id)).toMatchObject(workflow);
205
-
206
- const container: Omit<TaskContainer, 'id' | 'createdAt' | 'updatedAt'> = {
207
- projectId: project.id,
208
- name: 'Epic',
209
- description: 'Container',
210
- parentId: 'c-0',
211
- type: 'epic',
212
- color: '#ff0000'
213
- };
214
- expect(await store.getContainer((await store.createContainer(container)).id)).toMatchObject(container);
215
-
216
- const iteration: Omit<Iteration, 'id' | 'createdAt'> = {
217
- projectId: project.id,
218
- name: 'Sprint 1',
219
- goal: 'Ship',
220
- type: 'sprint',
221
- startDate: '2026-10-01',
222
- endDate: '2026-10-14',
223
- status: 'active'
224
- };
225
- expect(await store.getIteration((await store.createIteration(iteration)).id)).toMatchObject(iteration);
226
-
227
- const deliverable: Omit<Deliverable, 'id' | 'createdAt' | 'updatedAt'> = {
228
- projectId: project.id,
229
- title: 'Cut',
230
- description: 'Deliverable',
231
- status: 'planned',
232
- format: '4K',
233
- specs: { fps: 24 },
234
- leadId: 'u1',
235
- reviewerId: 'u2',
236
- dueDate: '2026-11-01',
237
- deliveredAt: '2026-11-02T00:00:00.000Z',
238
- outputUrls: ['https://example.com/cut.mov'],
239
- customFields: { client: 'Acme' }
240
- };
241
- expect(await store.getDeliverable((await store.createDeliverable(deliverable)).id)).toMatchObject(deliverable);
242
- });
243
-
244
- it('round-trips comments with reactions, ordered oldest first', async () => {
245
- const store = await createStore();
246
- const project = await store.createProject({ name: 'P' });
247
- const task = await store.createTask({ projectId: project.id, title: 'T', status: 'todo', priority: 'medium' });
248
- const input: Omit<Comment, 'id' | 'createdAt' | 'updatedAt'> = {
249
- taskId: task.id,
250
- authorId: 'u1',
251
- authorType: 'agent',
252
- content: 'First',
253
- mentions: ['u2'],
254
- metadata: { source: 'cli' }
255
- };
256
- const first = await store.addComment(input);
257
- await sleep(2);
258
- await store.addComment({ taskId: task.id, authorId: 'u2', content: 'Second' });
259
-
260
- expect(await store.getComment(first.id)).toMatchObject(input);
261
- expect((await store.getComments(task.id)).map((c) => c.content)).toEqual(['First', 'Second']);
262
- });
263
-
264
- it('round-trips attachments and applies every attachment filter together', async () => {
265
- const store = await createStore();
266
- const input: Omit<Attachment, 'id' | 'createdAt' | 'updatedAt'> = {
267
- taskId: 't1',
268
- projectId: 'p1',
269
- commentId: 'c1',
270
- uploaderId: 'u1',
271
- uploaderType: 'user',
272
- filename: 'spec.pdf',
273
- mimeType: 'application/pdf',
274
- sizeBytes: 1234,
275
- url: 'https://example.com/spec.pdf',
276
- storageKey: 'projects/p1/spec.pdf',
277
- artifactType: 'spec',
278
- metadata: { pages: 3 }
279
- };
280
- const created = await store.createAttachment(input);
281
- await store.createAttachment({ ...input, commentId: 'c2' });
282
- await store.createAttachment({ ...input, taskId: 't2' });
283
-
284
- expect(await store.getAttachment(created.id)).toMatchObject(input);
285
- expect(await store.getAttachments({ taskId: 't1', commentId: 'c1' })).toHaveLength(1);
286
- expect(await store.getAttachments({ taskId: 't1' })).toHaveLength(2);
287
- });
288
-
289
- it('returns activities newest first and applies every activity filter together', async () => {
290
- const store = await createStore();
291
- await store.logActivity({ projectId: 'p1', taskId: 't1', actorId: 'u1', action: 'first', details: { n: 1 } });
292
- await sleep(2);
293
- await store.logActivity({ projectId: 'p1', taskId: 't2', actorId: 'u1', action: 'second', details: {} });
294
- await sleep(2);
295
- await store.logActivity({ projectId: 'p2', taskId: 't1', actorId: 'u1', action: 'third', details: {} });
296
-
297
- expect((await store.getActivities({ projectId: 'p1' })).map((a) => a.action)).toEqual(['second', 'first']);
298
- expect((await store.getActivities({ projectId: 'p1', taskId: 't1' })).map((a) => a.action)).toEqual(['first']);
299
- expect((await store.getActivities()).map((a) => a.action)).toEqual(['third', 'second', 'first']);
300
- expect((await store.getActivities({ taskId: 't1' }))[1]).toMatchObject({ details: { n: 1 } });
301
- });
302
-
303
- it('round-trips dependencies, time entries and webhooks', async () => {
304
- const store = await createStore();
305
- const dep = await store.addDependency({ taskId: 'a', dependsOnTaskId: 'b', type: 'blocked_by' });
306
- expect(await store.getDependency(dep.id)).toEqual(dep);
307
- expect(await store.getDependencies('b')).toHaveLength(1);
308
- expect(await store.removeDependency(dep.id)).toBe(true);
309
-
310
- const entry = await store.logTime({ taskId: 't1', userId: 'u1', hours: 1.5, isBillable: false, description: 'Work', loggedAt: '2026-10-01T10:00:00.000Z' });
311
- expect((await store.getTimeEntries('t1'))[0]).toMatchObject({ id: entry.id, hours: 1.5, isBillable: false, description: 'Work', loggedAt: '2026-10-01T10:00:00.000Z' });
312
- expect(await store.deleteTimeEntry(entry.id)).toBe(true);
313
- expect(await store.getTimeEntries('t1')).toHaveLength(0);
314
-
315
- const webhook = await store.addWebhook({ name: 'Hook', url: 'https://example.com/h', secret: 'whsec_x', events: ['*'], active: true, tenantId: 'tenant-1' });
316
- expect(await store.getWebhook(webhook.id)).toMatchObject({ name: 'Hook', secret: 'whsec_x', events: ['*'], active: true, tenantId: 'tenant-1' });
317
- });
318
- });
319
- }
@@ -1 +0,0 @@
1
- export * from './conformance.js';