@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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,66 @@
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
+
39
+ ## 0.16.3
40
+
41
+ ### Patch Changes
42
+
43
+ - b54e22c: Validate request bodies with shared zod schemas and publish an OpenAPI document.
44
+
45
+ **@critical-path/core**
46
+ - New `@critical-path/core/schemas` subpath with create/update schemas for every resource and `parsePayload(schema, data)`. Kept off the package root so browser bundles do not include zod. `zod` is now a dependency of core.
47
+ - `ValidationError` carries an optional `issues: { path, message }[]`.
48
+
49
+ **@critical-path/server**
50
+ - All request bodies are validated. Invalid bodies return `400` with `issues`. Server-assigned fields (`id`, `createdAt`, `updatedAt`, task `key`, owning `projectId` on updates) and unknown keys are stripped, so a `PATCH` can no longer move a task to another project.
51
+ - Comments, reactions and attachments require an author unless `getContext` resolves the caller. Attachment `mimeType` and `sizeBytes` default to `application/octet-stream` and `0` for linked files.
52
+ - New `GET /openapi.json` and `buildOpenApiDocument()` (OpenAPI 3.1, request bodies generated from the validation schemas).
53
+
54
+ **@critical-path/mcp**
55
+ - Tool `inputSchema`s are generated from their zod schemas via the new `defineTool`, removing the hand-written JSON copies.
56
+
57
+ **@critical-path/svelte**
58
+ - Rebuilt with the bundled `@critical-path/mcp` changes.
59
+ - Updated dependencies [b54e22c]
60
+ - @critical-path/core@0.24.0
61
+ - @critical-path/mcp@0.9.0
62
+ - @critical-path/client@0.14.9
63
+
3
64
  ## 0.16.2
4
65
 
5
66
  ### 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,8BAA8B,EAAE,CAAC;CAC3C;AAED,qBAAa,iBAAiB;IA6ChB,OAAO,CAAC,MAAM;IAA6B,MAAM,CAAC,EAAE,MAAM;IA5CtE,QAAQ,YAAyB;IACjC,WAAW,eAA4B;IACvC,OAAO,UAA0B;IACjC,KAAK,eAA8B;IAEnC,OAAO,mCAiCJ;IAEH,qBAAqB,eAElB;gBAEiB,MAAM,EAAE,kBAAkB,EAAS,MAAM,CAAC,EAAE,MAAM,YAAA;IAEhE,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM;IAwBrB,UAAU,CACd,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,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AC,EAAE,MAAM;IA5CtE,QAAQ,YAAyB;IACjC,WAAW,eAA4B;IACvC,OAAO,UAA0B;IACjC,KAAK,eAA8B;IAEnC,OAAO,mCAiCJ;IAEH,qBAAqB,eAElB;gBAEiB,MAAM,EAAE,kBAAkB,EAAS,MAAM,CAAC,EAAE,MAAM,YAAA;IAEhE,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM;IAwBrB,UAAU,CACd,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,EACxC,gBAAgB,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE,QAAQ,GAAG,WAAW,CAAC,CAAC;;;;IAiCxE,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC;IAelF,aAAa,CAAC,EAAE,EAAE,MAAM;IAaxB,gBAAgB,CAAC,EAAE,EAAE,MAAM;IAa3B,WAAW,CACf,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM;IAcT,cAAc,CAClB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM;CAahB;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,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,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,OAAO,EAAE,IAAI,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC;IAe5E,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;IAYnD,aAAa,CAAC,EAAE,EAAE,MAAM;I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axB,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.svelte.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEnG,qBAAa,gBAAgB;IAKf,OAAO,CAAC,MAAM;IAA6B,SAAS,CAAC,EAAE,MAAM;IAJzE,IAAI,gBAA6B;IACjC,OAAO,UAA0B;IACjC,KAAK,eAA8B;gBAEf,MAAM,EAAE,kBAAkB,EAAS,SAAS,CAAC,EAAE,MAAM,YAAA;IAEnE,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM;IAiBxB,iBAAiB,CAAC,KA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