@critical-path/svelte 0.16.2 → 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.
@@ -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,SAAS,CAAY;IAE7B,IAAI,IAAI,IAAI,IAAI,EAAE,CAEjB;IAED,IAAI,KAAK,IAAI,IAAI,EAAE,CAElB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,KAAK,IAA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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":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,UAAU,EAAgB,MAAM,qBAAqB,CAAC;AAE/E,qBAA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,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.2",
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.8",
22
- "@critical-path/core": "0.23.0",
23
- "@critical-path/mcp": "0.8.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)!;