@critical-path/svelte 0.16.3 → 0.17.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/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @critical-path/svelte
2
2
 
3
+ ## 0.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fd79762: **BREAKING:** strict request bodies, no identity in payloads, and CORS off by default.
8
+
9
+ **@critical-path/core**
10
+ - Request schemas are strict: unknown keys, server-assigned fields and identity fields are rejected instead of stripped.
11
+ - Identity is never read from payloads. `updateTask` no longer reads `actorId`/`actorName`/`actorType`/`actor` from the update object; pass them as the third `options` argument or use `withActor`. `addComment`, `addCommentReaction`, `removeCommentReaction` and `createAttachment` take the actor from `withActor`, falling back to an optional `authorId`/`userId`/`uploaderId`, then `'system'`.
12
+ - Schemas export request body types (`CreateTaskBody`, `UpdateTaskBody`, ...).
13
+
14
+ **@critical-path/server**
15
+ - Bodies containing unknown, server-assigned or identity fields return `400`.
16
+ - Every request runs as the `getContext` user, or `ANONYMOUS_ACTOR` (`anonymous`). Authors of comments, reactions, attachments and time entries are no longer accepted from bodies.
17
+ - `DELETE /comments/:id/reactions` takes `?emoji=` only.
18
+ - CORS is off by default (`cors: false`). Pass `cors: { origins: [...] }` to allow cross-origin browsers.
19
+
20
+ **@critical-path/client**
21
+ - Method parameters use the server's body types, so identity fields no longer type-check. `addCommentReaction`/`removeCommentReaction` take `{ emoji }`; `addTodo`/`toggleTodo` drop the actor options argument.
22
+ - New `updateProject`, `deleteProject` and `addDependency`. `uploadAttachmentFile` base64-encodes binary data (previously it sent unusable JSON for `Uint8Array`/`ArrayBuffer`).
23
+ - CLI: `--author`, `--actor-id`, `--actor-name`, `--agent-name` and `CRITICAL_PATH_AUTHOR_ID`/`ACTOR_ID`/`AGENT_NAME` are removed; identity comes from the `--key` token via the server's `getContext`.
24
+
25
+ **@critical-path/mcp**
26
+ - Tool arguments are strict: undeclared arguments return an `isError` result.
27
+ - `add_comment` no longer takes `authorId`. With an `engine`, writes are attributed to the new `actor` server option (default `DEFAULT_MCP_ACTOR`).
28
+
29
+ **@critical-path/react / @critical-path/svelte**
30
+ - `addReaction`/`removeReaction` take `(commentId, emoji)`; comment and attachment inputs no longer accept `authorId`/`uploaderId`. Task, comment and deliverable update parameters use the schema body types.
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [fd79762]
35
+ - @critical-path/core@0.25.0
36
+ - @critical-path/client@0.15.0
37
+ - @critical-path/mcp@0.10.0
38
+
3
39
  ## 0.16.3
4
40
 
5
41
  ### Patch Changes
package/README.md CHANGED
@@ -102,8 +102,8 @@ Combines threaded comments with inline attachments (`attachment.commentId === co
102
102
 
103
103
  async function handleSend(text: string, fileUrl?: string) {
104
104
  await activityState.addComment(
105
- { content: text, authorId: 'user_1', authorType: 'user' },
106
- fileUrl ? [{ filename: 'upload.png', url: fileUrl, uploaderId: 'user_1', mimeType: 'image/png', sizeBytes: 1024 }] : []
105
+ { content: text },
106
+ fileUrl ? [{ filename: 'upload.png', url: fileUrl, mimeType: 'image/png', sizeBytes: 1024 }] : []
107
107
  );
108
108
  }
109
109
  </script>
@@ -123,8 +123,8 @@ Combines threaded comments with inline attachments (`attachment.commentId === co
123
123
 
124
124
  <!-- Emoji Reactions -->
125
125
  <div class="reactions">
126
- <button on:click={() => activityState.addReaction(thread.id, '👍', 'user_1')}>👍</button>
127
- <button on:click={() => activityState.addReaction(thread.id, '🚀', 'user_1')}>🚀</button>
126
+ <button on:click={() => activityState.addReaction(thread.id, '👍')}>👍</button>
127
+ <button on:click={() => activityState.addReaction(thread.id, '🚀')}>🚀</button>
128
128
  <span>{thread.reactions?.length || 0} reactions</span>
129
129
  </div>
130
130
 
@@ -1,3 +1,4 @@
1
+ import type { CreateAttachmentBody, CreateCommentBody } from '@critical-path/core/schemas';
1
2
  import type { CriticalPathClient } from '@critical-path/client';
2
3
  import type { Comment, Attachment } from '@critical-path/core';
3
4
  export interface ThreadedCommentWithAttachments extends Comment {
@@ -15,21 +16,15 @@ export declare class TaskActivityState {
15
16
  standaloneAttachments: Attachment[];
16
17
  constructor(client: CriticalPathClient, taskId?: string | undefined);
17
18
  fetch(taskId?: string): Promise<void>;
18
- addComment(input: Omit<Comment, 'id' | 'taskId' | 'createdAt' | 'updatedAt'>, attachmentInputs?: Array<Omit<Attachment, 'id' | 'taskId' | 'commentId' | 'createdAt' | 'updatedAt'>>): Promise<{
19
+ addComment(input: Omit<CreateCommentBody, 'taskId'>, attachmentInputs?: Array<Omit<CreateAttachmentBody, 'taskId' | 'commentId'>>): Promise<{
19
20
  comment: Comment;
20
21
  attachments: Attachment[];
21
22
  }>;
22
23
  addAttachment(input: Omit<Attachment, 'id' | 'taskId' | 'createdAt' | 'updatedAt'>): Promise<Attachment>;
23
24
  deleteComment(id: string): Promise<void>;
24
25
  deleteAttachment(id: string): Promise<void>;
25
- addReaction(commentId: string, reactionOrEmoji: {
26
- emoji: string;
27
- userId: string;
28
- } | string, maybeUserId?: string): Promise<Comment>;
29
- removeReaction(commentId: string, reactionOrEmoji: {
30
- emoji: string;
31
- userId: string;
32
- } | string, maybeUserId?: string): Promise<Comment>;
26
+ addReaction(commentId: string, emoji: string): Promise<Comment>;
27
+ removeReaction(commentId: string, emoji: string): Promise<Comment>;
33
28
  }
34
29
  export declare function createTaskActivityState(client: CriticalPathClient, taskId?: string): TaskActivityState;
35
30
  //# sourceMappingURL=activity-state.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"activity-state.svelte.d.ts","sourceRoot":"","sources":["../src/activity-state.svelte.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,WAAW,8BAA+B,SAAQ,OAAO;IAC7D,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,OAAO,EAAE,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AE,MAAM,GAAG,iBAAiB,CAEtG"}
@@ -1,3 +1,4 @@
1
+ import type { CreateCommentBody, UpdateCommentBody } from '@critical-path/core/schemas';
1
2
  import type { CriticalPathClient } from '@critical-path/client';
2
3
  import type { Comment } from '@critical-path/core';
3
4
  export interface ThreadedComment extends Comment {
@@ -12,17 +13,11 @@ export declare class CommentState {
12
13
  threads: ThreadedComment[];
13
14
  constructor(client: CriticalPathClient, taskId?: string | undefined);
14
15
  fetch(taskId?: string): Promise<void>;
15
- addComment(input: Omit<Comment, 'id' | 'taskId' | 'createdAt' | 'updatedAt'>): Promise<Comment>;
16
- updateComment(id: string, updates: Partial<Comment>): Promise<Comment>;
16
+ addComment(input: Omit<CreateCommentBody, 'taskId'>): Promise<Comment>;
17
+ updateComment(id: string, updates: UpdateCommentBody): Promise<Comment>;
17
18
  deleteComment(id: string): Promise<void>;
18
- addReaction(commentId: string, reactionOrEmoji: {
19
- emoji: string;
20
- userId: string;
21
- } | string, maybeUserId?: string): Promise<Comment>;
22
- removeReaction(commentId: string, reactionOrEmoji: {
23
- emoji: string;
24
- userId: string;
25
- } | string, maybeUserId?: string): Promise<Comment>;
19
+ addReaction(commentId: string, emoji: string): Promise<Comment>;
20
+ removeReaction(commentId: string, emoji: string): Promise<Comment>;
26
21
  }
27
22
  export declare function createCommentState(client: CriticalPathClient, taskId?: string): CommentState;
28
23
  //# sourceMappingURL=comment-state.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"comment-state.svelte.d.ts","sourceRoot":"","sources":["../src/comment-state.svelte.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC9C,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,qBAAa,YAAY;IAyBX,OAAO,CAAC,MAAM;IAA6B,MAA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qBAAa,YAAY;IAyBX,OAAO,CAAC,MAAM;IAA6B,MAAM,CAAC,EAAE,MAAM;IAxBtE,IAAI,YAAyB;IAC7B,OAAO,UAA0B;IACjC,KAAK,eAA8B;IAEnC,OAAO,oBAkBJ;gBAEiB,MAAM,EAAE,kBAAkB,EAAS,MAAM,CAAC,EAAE,MAAM,YAAA;IAEhE,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM;IAkBrB,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC;IAenD,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB;IAYpD,aAAa,CAAC,EAAE,EAAE,MAAM;IAaxB,WAAW,CACf,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM;IAcT,cAAc,CAClB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM;CAahB;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,CAE5F"}
@@ -1,3 +1,4 @@
1
+ import type { UpdateDeliverableBody } from '@critical-path/core/schemas';
1
2
  import type { CriticalPathClient } from '@critical-path/client';
2
3
  import type { Deliverable, DeliverableSummary, CreateDeliverableInput } from '@critical-path/core';
3
4
  export declare class DeliverableState {
@@ -9,7 +10,7 @@ export declare class DeliverableState {
9
10
  constructor(client: CriticalPathClient, projectId?: string | undefined);
10
11
  fetch(projectId?: string): Promise<void>;
11
12
  createDeliverable(input: CreateDeliverableInput): Promise<Deliverable>;
12
- updateDeliverable(id: string, updates: Partial<Deliverable>): Promise<Deliverable>;
13
+ updateDeliverable(id: string, updates: UpdateDeliverableBody): Promise<Deliverable>;
13
14
  deleteDeliverable(id: string): Promise<void>;
14
15
  getSummary(deliverableId: string): Promise<DeliverableSummary>;
15
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"deliverable-state.svelte.d.ts","sourceRoot":"","sources":["../src/deliverable-state.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AAE,MAAM,YAAA;IAEnE,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM;IAiBxB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB;IAY/C,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB;IAe5D,iBAAiB,CAAC,EAAE,EAAE,MAAM;IAa5B,UAAU,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAGrE;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAE9G"}
package/dist/index.js CHANGED
@@ -103,6 +103,8 @@ var o = class {
103
103
  async createTask(e) {
104
104
  let t = `temp_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`, n = (/* @__PURE__ */ new Date()).toISOString(), r = {
105
105
  ...e,
106
+ status: e.status ?? "todo",
107
+ priority: e.priority ?? "medium",
106
108
  id: t,
107
109
  createdAt: n,
108
110
  updatedAt: n
@@ -359,25 +361,19 @@ var te = class {
359
361
  throw this.error = n, n;
360
362
  }
361
363
  }
362
- async addReaction(e, t, n) {
364
+ async addReaction(e, t) {
363
365
  try {
364
- let r = typeof t == "string" ? {
365
- emoji: t,
366
- userId: n
367
- } : t, i = await this.client.addCommentReaction(e, r);
368
- return this.data = this.data.map((t) => t.id === e ? i : t), i;
366
+ let n = { emoji: t }, r = await this.client.addCommentReaction(e, n);
367
+ return this.data = this.data.map((t) => t.id === e ? r : t), r;
369
368
  } catch (e) {
370
369
  let t = e instanceof Error ? e : Error(String(e));
371
370
  throw this.error = t, t;
372
371
  }
373
372
  }
374
- async removeReaction(e, t, n) {
373
+ async removeReaction(e, t) {
375
374
  try {
376
- let r = typeof t == "string" ? {
377
- emoji: t,
378
- userId: n
379
- } : t, i = await this.client.removeCommentReaction(e, r);
380
- return this.data = this.data.map((t) => t.id === e ? i : t), i;
375
+ let n = { emoji: t }, r = await this.client.removeCommentReaction(e, n);
376
+ return this.data = this.data.map((t) => t.id === e ? r : t), r;
381
377
  } catch (e) {
382
378
  let t = e instanceof Error ? e : Error(String(e));
383
379
  throw this.error = t, t;
@@ -584,25 +580,19 @@ var ae = class {
584
580
  throw this.error = n, n;
585
581
  }
586
582
  }
587
- async addReaction(e, t, n) {
583
+ async addReaction(e, t) {
588
584
  try {
589
- let r = typeof t == "string" ? {
590
- emoji: t,
591
- userId: n
592
- } : t, i = await this.client.addCommentReaction(e, r);
593
- return this.comments = this.comments.map((t) => t.id === e ? i : t), i;
585
+ let n = { emoji: t }, r = await this.client.addCommentReaction(e, n);
586
+ return this.comments = this.comments.map((t) => t.id === e ? r : t), r;
594
587
  } catch (e) {
595
588
  let t = e instanceof Error ? e : Error(String(e));
596
589
  throw this.error = t, t;
597
590
  }
598
591
  }
599
- async removeReaction(e, t, n) {
592
+ async removeReaction(e, t) {
600
593
  try {
601
- let r = typeof t == "string" ? {
602
- emoji: t,
603
- userId: n
604
- } : t, i = await this.client.removeCommentReaction(e, r);
605
- return this.comments = this.comments.map((t) => t.id === e ? i : t), i;
594
+ let n = { emoji: t }, r = await this.client.removeCommentReaction(e, n);
595
+ return this.comments = this.comments.map((t) => t.id === e ? r : t), r;
606
596
  } catch (e) {
607
597
  let t = e instanceof Error ? e : Error(String(e));
608
598
  throw this.error = t, t;
@@ -4493,7 +4483,7 @@ var gn = class extends Error {
4493
4483
  }
4494
4484
  };
4495
4485
  function _n(e, t) {
4496
- let n = e.zodSchema.safeParse(t ?? {});
4486
+ let n = e.zodSchema.strict().safeParse(t ?? {});
4497
4487
  if (!n.success) {
4498
4488
  let t = n.error.issues.map((e) => `${e.path.join(".") || "(root)"}: ${e.message}`).join("; ");
4499
4489
  throw new gn(e.name, t);
@@ -4681,16 +4671,14 @@ var vn = [
4681
4671
  $({
4682
4672
  name: "add_comment",
4683
4673
  title: "Add Comment",
4684
- description: "Add a comment to a task.",
4674
+ description: "Add a comment to a task. The comment is attributed to the identity this MCP server runs as.",
4685
4675
  zodSchema: G({
4686
4676
  taskId: W().describe("The task ID"),
4687
- content: W().describe("Comment body/markdown"),
4688
- authorId: W().describe("Author user ID")
4677
+ content: W().describe("Comment body/markdown")
4689
4678
  }),
4690
4679
  execute: async (e, t) => t.addComment({
4691
4680
  taskId: e.taskId,
4692
- content: e.content,
4693
- authorId: e.authorId
4681
+ content: e.content
4694
4682
  })
4695
4683
  }),
4696
4684
  $({
@@ -1,3 +1,4 @@
1
+ import type { CreateTaskBody } from '@critical-path/core/schemas';
1
2
  import type { CriticalPathClient } from '@critical-path/client';
2
3
  import type { Task, TaskStatus, StatusDefinition } from '@critical-path/core';
3
4
  export interface KanbanStateOptions {
@@ -15,7 +16,7 @@ export declare class KanbanState {
15
16
  columns: Record<string, Task[]>;
16
17
  constructor(client: CriticalPathClient, projectId?: string | undefined, options?: KanbanStateOptions);
17
18
  fetch(): Promise<void>;
18
- createTask(input: Omit<Task, 'id' | 'createdAt' | 'updatedAt'>): Promise<Task>;
19
+ createTask(input: CreateTaskBody): Promise<Task>;
19
20
  moveTask(taskId: string, targetStatus: TaskStatus): Promise<Task>;
20
21
  updateTaskStatus(taskId: string, status: TaskStatus): Promise<Task>;
21
22
  deleteTask(taskId: string): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"kanban-state.svelte.d.ts","sourceRoot":"","sources":["../src/kanban-state.svelte.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAkB,MAAM,qBAAqB,CAAC;AAI9F,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IAClC,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACxC;AAED,qBAAa,WAAW;IAmEb,SAAS,CAAC,EAAE,MAAM;IAClB,OAAO,EAAE,kBAAkB;IAnEpC,OAAO,CAAC,SAA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,IAAI,IAAI,EAAE,CAEjB;IAED,IAAI,KAAK,IAAI,IAAI,EAAE,CAElB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,KAAK,IAAI,KAAK,GAAG,IAAI,CAExB;IAED,OAAO,yBA4CJ;gBAGD,MAAM,EAAE,kBAAkB,EACnB,SAAS,CAAC,EAAE,MAAM,YAAA,EAClB,OAAO,GAAE,kBAAuB;IAKnC,KAAK;IAIL,UAAU,CAAC,KAAK,EAAE,cAAc;IAIhC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU;IAIjD,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU;IAInD,UAAU,CAAC,MAAM,EAAE,MAAM;CAGhC;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,kBAAkB,EAC1B,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,WAAW,CAEb"}
@@ -1,3 +1,4 @@
1
+ import type { CreateTaskBody, UpdateTaskBody } from '@critical-path/core/schemas';
1
2
  import type { CriticalPathClient } from '@critical-path/client';
2
3
  import { type Task, type TaskStatus } from '@critical-path/core';
3
4
  export declare class TaskState {
@@ -10,8 +11,8 @@ export declare class TaskState {
10
11
  private tempToRealIdMap;
11
12
  constructor(client: CriticalPathClient, projectId?: string | undefined);
12
13
  fetch(): Promise<void>;
13
- createTask(input: Omit<Task, 'id' | 'createdAt' | 'updatedAt'>): Promise<Task>;
14
- updateTask(taskId: string, updates: Partial<Task>): Promise<Task>;
14
+ createTask(input: CreateTaskBody): Promise<Task>;
15
+ updateTask(taskId: string, updates: UpdateTaskBody): Promise<Task>;
15
16
  updateTaskStatus(taskId: string, status: TaskStatus): Promise<Task>;
16
17
  deleteTask(taskId: string): Promise<void>;
17
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"task-state.svelte.d.ts","sourceRoot":"","sources":["../src/task-state.svelte.ts"],"names":[],"mapp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BAAgB,CAAoC;IAC5D,OAAO,CAAC,eAAe,CAA6B;gBAG1C,MAAM,EAAE,kBAAkB,EAC3B,SAAS,CAAC,EAAE,MAAM,YAAA;IAGrB,KAAK;IAYL,UAAU,CAAC,KAAK,EAAE,cAAc;IAoChC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc;IAyElD,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU;IAInD,UAAU,CAAC,MAAM,EAAE,MAAM;CA4ChC;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,kBAAkB,EAC1B,SAAS,CAAC,EAAE,MAAM,GACjB,SAAS,CAEX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@critical-path/svelte",
3
- "version": "0.16.3",
3
+ "version": "0.17.0",
4
4
  "description": "Svelte 5 Runes state and reactive integrations for Critical Path headless project management framework",
5
5
  "author": "Jack James",
6
6
  "license": "MIT",
@@ -18,9 +18,9 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "@critical-path/client": "0.14.9",
22
- "@critical-path/core": "0.24.0",
23
- "@critical-path/mcp": "0.9.0"
21
+ "@critical-path/mcp": "0.10.0",
22
+ "@critical-path/client": "0.15.0",
23
+ "@critical-path/core": "0.25.0"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "svelte": "^5.0.0"
@@ -1,4 +1,5 @@
1
1
  /// <reference types="svelte" />
2
+ import type { CreateAttachmentBody, CreateCommentBody } from '@critical-path/core/schemas';
2
3
  import type { CriticalPathClient } from '@critical-path/client';
3
4
  import type { Comment, Attachment } from '@critical-path/core';
4
5
 
@@ -79,8 +80,8 @@ export class TaskActivityState {
79
80
  }
80
81
 
81
82
  async addComment(
82
- input: Omit<Comment, 'id' | 'taskId' | 'createdAt' | 'updatedAt'>,
83
- attachmentInputs?: Array<Omit<Attachment, 'id' | 'taskId' | 'commentId' | 'createdAt' | 'updatedAt'>>
83
+ input: Omit<CreateCommentBody, 'taskId'>,
84
+ attachmentInputs?: Array<Omit<CreateAttachmentBody, 'taskId' | 'commentId'>>
84
85
  ) {
85
86
  if (!this.taskId) {
86
87
  throw new Error('TaskActivityState requires a taskId to add comments.');
@@ -156,14 +157,10 @@ export class TaskActivityState {
156
157
 
157
158
  async addReaction(
158
159
  commentId: string,
159
- reactionOrEmoji: { emoji: string; userId: string } | string,
160
- maybeUserId?: string
160
+ emoji: string
161
161
  ) {
162
162
  try {
163
- const payload =
164
- typeof reactionOrEmoji === 'string'
165
- ? { emoji: reactionOrEmoji, userId: maybeUserId! }
166
- : reactionOrEmoji;
163
+ const payload = { emoji };
167
164
  const updated = await this.client.addCommentReaction(commentId, payload);
168
165
  this.comments = this.comments.map((c) => (c.id === commentId ? updated : c));
169
166
  return updated;
@@ -176,14 +173,10 @@ export class TaskActivityState {
176
173
 
177
174
  async removeReaction(
178
175
  commentId: string,
179
- reactionOrEmoji: { emoji: string; userId: string } | string,
180
- maybeUserId?: string
176
+ emoji: string
181
177
  ) {
182
178
  try {
183
- const payload =
184
- typeof reactionOrEmoji === 'string'
185
- ? { emoji: reactionOrEmoji, userId: maybeUserId! }
186
- : reactionOrEmoji;
179
+ const payload = { emoji };
187
180
  const updated = await this.client.removeCommentReaction(commentId, payload);
188
181
  this.comments = this.comments.map((c) => (c.id === commentId ? updated : c));
189
182
  return updated;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="svelte" />
2
+ import type { CreateCommentBody, UpdateCommentBody } from '@critical-path/core/schemas';
2
3
  import type { CriticalPathClient } from '@critical-path/client';
3
4
  import type { Comment } from '@critical-path/core';
4
5
 
@@ -51,7 +52,7 @@ export class CommentState {
51
52
  }
52
53
  }
53
54
 
54
- async addComment(input: Omit<Comment, 'id' | 'taskId' | 'createdAt' | 'updatedAt'>) {
55
+ async addComment(input: Omit<CreateCommentBody, 'taskId'>) {
55
56
  if (!this.taskId) {
56
57
  throw new Error('CommentState requires a taskId to add comments.');
57
58
  }
@@ -66,7 +67,7 @@ export class CommentState {
66
67
  }
67
68
  }
68
69
 
69
- async updateComment(id: string, updates: Partial<Comment>) {
70
+ async updateComment(id: string, updates: UpdateCommentBody) {
70
71
  try {
71
72
  const updated = await this.client.updateComment(id, updates);
72
73
  this.data = this.data.map((c) => (c.id === id ? updated : c));
@@ -93,14 +94,10 @@ export class CommentState {
93
94
 
94
95
  async addReaction(
95
96
  commentId: string,
96
- reactionOrEmoji: { emoji: string; userId: string } | string,
97
- maybeUserId?: string
97
+ emoji: string
98
98
  ) {
99
99
  try {
100
- const payload =
101
- typeof reactionOrEmoji === 'string'
102
- ? { emoji: reactionOrEmoji, userId: maybeUserId! }
103
- : reactionOrEmoji;
100
+ const payload = { emoji };
104
101
  const updated = await this.client.addCommentReaction(commentId, payload);
105
102
  this.data = this.data.map((c) => (c.id === commentId ? updated : c));
106
103
  return updated;
@@ -113,14 +110,10 @@ export class CommentState {
113
110
 
114
111
  async removeReaction(
115
112
  commentId: string,
116
- reactionOrEmoji: { emoji: string; userId: string } | string,
117
- maybeUserId?: string
113
+ emoji: string
118
114
  ) {
119
115
  try {
120
- const payload =
121
- typeof reactionOrEmoji === 'string'
122
- ? { emoji: reactionOrEmoji, userId: maybeUserId! }
123
- : reactionOrEmoji;
116
+ const payload = { emoji };
124
117
  const updated = await this.client.removeCommentReaction(commentId, payload);
125
118
  this.data = this.data.map((c) => (c.id === commentId ? updated : c));
126
119
  return updated;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="svelte" />
2
+ import type { UpdateDeliverableBody } from '@critical-path/core/schemas';
2
3
  import type { CriticalPathClient } from '@critical-path/client';
3
4
  import type { Deliverable, DeliverableSummary, CreateDeliverableInput } from '@critical-path/core';
4
5
 
@@ -38,7 +39,7 @@ export class DeliverableState {
38
39
  }
39
40
  }
40
41
 
41
- async updateDeliverable(id: string, updates: Partial<Deliverable>) {
42
+ async updateDeliverable(id: string, updates: UpdateDeliverableBody) {
42
43
  const previous = this.data;
43
44
  this.data = this.data.map((d) => (d.id === id ? { ...d, ...updates } : d));
44
45
  try {
package/src/index.test.ts CHANGED
@@ -335,11 +335,11 @@ describe('@critical-path/svelte Svelte 5 Runes Test Suite', () => {
335
335
  await commentState.updateComment('cmt_1', { content: 'Updated comment' });
336
336
  expect(commentState.data[0].content).toBe('Updated comment');
337
337
 
338
- await commentState.addReaction('cmt_1', '🔥', 'u2');
338
+ await commentState.addReaction('cmt_1', '🔥');
339
339
  expect(commentState.data[0].reactions).toHaveLength(1);
340
340
  expect(commentState.data[0].reactions?.[0].emoji).toBe('🔥');
341
341
 
342
- await commentState.removeReaction('cmt_1', '🔥', 'u2');
342
+ await commentState.removeReaction('cmt_1', '🔥');
343
343
  expect(commentState.data[0].reactions).toBeUndefined();
344
344
 
345
345
  await commentState.deleteComment('cmt_1');
@@ -1,4 +1,5 @@
1
1
  /// <reference types="svelte" />
2
+ import type { CreateTaskBody } from '@critical-path/core/schemas';
2
3
  import type { CriticalPathClient } from '@critical-path/client';
3
4
  import type { Task, TaskStatus, StatusDefinition, SemanticStatus } from '@critical-path/core';
4
5
  import { resolveStatusDefinition } from '@critical-path/core';
@@ -86,7 +87,7 @@ export class KanbanState {
86
87
  return this.taskState.fetch();
87
88
  }
88
89
 
89
- async createTask(input: Omit<Task, 'id' | 'createdAt' | 'updatedAt'>) {
90
+ async createTask(input: CreateTaskBody) {
90
91
  return this.taskState.createTask(input);
91
92
  }
92
93
 
@@ -1,4 +1,5 @@
1
1
  /// <reference types="svelte" />
2
+ import type { CreateTaskBody, UpdateTaskBody } from '@critical-path/core/schemas';
2
3
  import type { CriticalPathClient } from '@critical-path/client';
3
4
  import { type Task, type TaskStatus, isTempTaskId } from '@critical-path/core';
4
5
 
@@ -27,11 +28,14 @@ export class TaskState {
27
28
  }
28
29
  }
29
30
 
30
- async createTask(input: Omit<Task, 'id' | 'createdAt' | 'updatedAt'>) {
31
+ async createTask(input: CreateTaskBody) {
31
32
  const tempId = `temp_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`;
32
33
  const now = new Date().toISOString();
33
34
  const tempTask: Task = {
34
35
  ...input,
36
+ // Placeholders until the server responds with the workflow's real defaults
37
+ status: input.status ?? 'todo',
38
+ priority: input.priority ?? 'medium',
35
39
  id: tempId,
36
40
  createdAt: now,
37
41
  updatedAt: now
@@ -60,7 +64,7 @@ export class TaskState {
60
64
  }
61
65
  }
62
66
 
63
- async updateTask(taskId: string, updates: Partial<Task>) {
67
+ async updateTask(taskId: string, updates: UpdateTaskBody) {
64
68
  let targetId = taskId;
65
69
  if (this.tempToRealIdMap.has(taskId)) {
66
70
  targetId = this.tempToRealIdMap.get(taskId)!;