@mestra-dev/contract 0.0.28 → 0.0.29

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 (2) hide show
  1. package/dist/index.d.ts +198 -11
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -94,7 +94,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
94
94
  },
95
95
  {
96
96
  readonly name: "Files";
97
- readonly description: "S3 file upload (presigned POST to a temporary `.tmp` key), confirm (magic-byte validation then promote to final key), profile and workspace picture upload/confirm/delete, comment attachment upload, list task comment files with download URLs, folder create/delete, list (includes pin metadata; excludes `.tmp` objects), pin/unpin, download, and file delete. General uploads accept JPEG/PNG/WebP/PDF; profile/workspace pictures accept JPEG/PNG only (0.5 MB).";
97
+ readonly description: "S3 file upload (presigned POST to a temporary `.tmp` key), confirm (magic-byte validation then promote to final key), profile and workspace picture upload/confirm/delete, comment attachment upload/confirm, list task comment files with download URLs, folder create/delete, list (includes pin metadata; excludes `.tmp` objects), pin/unpin, download, and file delete. General uploads accept JPEG/PNG/WebP/PDF; profile/workspace pictures accept JPEG/PNG only (0.5 MB). Workspace file routes require active collaborator status and crm::files access; comment attachments require crm::tasks write/read.";
98
98
  },
99
99
  {
100
100
  readonly name: "Chat";
@@ -1409,7 +1409,9 @@ declare const routes: import("hono/hono-base").HonoBase<{
1409
1409
  readonly properties: {
1410
1410
  readonly filename: {
1411
1411
  readonly type: "string";
1412
- readonly description: "Original file name (trimmed).";
1412
+ readonly minLength: 1;
1413
+ readonly maxLength: 200;
1414
+ readonly description: "Safe file name (no path separators, not `.tmp`).";
1413
1415
  readonly example: "invoice-2026.pdf";
1414
1416
  };
1415
1417
  readonly contentType: {
@@ -1431,6 +1433,8 @@ declare const routes: import("hono/hono-base").HonoBase<{
1431
1433
  readonly properties: {
1432
1434
  readonly filename: {
1433
1435
  readonly type: "string";
1436
+ readonly minLength: 1;
1437
+ readonly maxLength: 200;
1434
1438
  readonly description: "Original file name used for `/files/upload` (without the `.tmp` suffix).";
1435
1439
  readonly example: "invoice-2026.pdf";
1436
1440
  };
@@ -1503,7 +1507,9 @@ declare const routes: import("hono/hono-base").HonoBase<{
1503
1507
  readonly properties: {
1504
1508
  readonly filename: {
1505
1509
  readonly type: "string";
1506
- readonly description: "Original file name (trimmed).";
1510
+ readonly minLength: 1;
1511
+ readonly maxLength: 200;
1512
+ readonly description: "Safe file name (no path separators, not `.tmp`).";
1507
1513
  readonly example: "receipt.pdf";
1508
1514
  };
1509
1515
  readonly contentType: {
@@ -1553,8 +1559,8 @@ declare const routes: import("hono/hono-base").HonoBase<{
1553
1559
  };
1554
1560
  readonly key: {
1555
1561
  readonly type: "string";
1556
- readonly description: "S3 object key (`{workspace}_comments/{taskId}/{commentId}/{filename}`).";
1557
- readonly example: "550e8400-e29b-41d4-a716-446655440000_comments/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/ffffffff-1111-2222-3333-444444444444/receipt.pdf";
1562
+ readonly description: "Temporary S3 object key (`{workspace}_comments/{taskId}/{commentId}/{filename}.tmp`). Call `/files/confirm-comment-file` after upload.";
1563
+ readonly example: "550e8400-e29b-41d4-a716-446655440000_comments/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/ffffffff-1111-2222-3333-444444444444/receipt.pdf.tmp";
1558
1564
  };
1559
1565
  readonly maxSize: {
1560
1566
  readonly type: "integer";
@@ -1563,6 +1569,39 @@ declare const routes: import("hono/hono-base").HonoBase<{
1563
1569
  };
1564
1570
  };
1565
1571
  };
1572
+ readonly ConfirmCommentFileRequest: {
1573
+ readonly type: "object";
1574
+ readonly required: readonly [
1575
+ "filename",
1576
+ "workspace",
1577
+ "taskId",
1578
+ "commentId"
1579
+ ];
1580
+ readonly properties: {
1581
+ readonly filename: {
1582
+ readonly type: "string";
1583
+ readonly minLength: 1;
1584
+ readonly maxLength: 200;
1585
+ readonly description: "Original file name used for `/files/upload-to-comment` (without the `.tmp` suffix).";
1586
+ readonly example: "receipt.pdf";
1587
+ };
1588
+ readonly workspace: {
1589
+ readonly type: "string";
1590
+ readonly format: "uuid";
1591
+ readonly description: "Workspace identifier.";
1592
+ };
1593
+ readonly taskId: {
1594
+ readonly type: "string";
1595
+ readonly format: "uuid";
1596
+ readonly description: "Task the comment belongs to.";
1597
+ };
1598
+ readonly commentId: {
1599
+ readonly type: "string";
1600
+ readonly format: "uuid";
1601
+ readonly description: "Comment the file is attached to.";
1602
+ };
1603
+ };
1604
+ };
1566
1605
  readonly DeleteCommentFileRequest: {
1567
1606
  readonly type: "object";
1568
1607
  readonly required: readonly [
@@ -1574,7 +1613,9 @@ declare const routes: import("hono/hono-base").HonoBase<{
1574
1613
  readonly properties: {
1575
1614
  readonly filename: {
1576
1615
  readonly type: "string";
1577
- readonly description: "Original file name (trimmed).";
1616
+ readonly minLength: 1;
1617
+ readonly maxLength: 200;
1618
+ readonly description: "Safe file name (no path separators, not `.tmp`).";
1578
1619
  readonly example: "receipt.pdf";
1579
1620
  };
1580
1621
  readonly workspace: {
@@ -9728,7 +9769,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
9728
9769
  "Files"
9729
9770
  ];
9730
9771
  readonly summary: "Create presigned S3 upload";
9731
- readonly description: "Returns a presigned POST URL and form fields for uploading a file to S3 (max 15 MB, 5-minute expiry). Object key is `{workspace}/{filename}.tmp`. Only JPEG, PNG, WebP, and PDF content types are accepted. After the multipart upload succeeds, call `/files/confirm` to validate magic bytes and promote the object to `{workspace}/{filename}`. Temporary objects are excluded from list results. Requires workspace access.";
9772
+ readonly description: "Returns a presigned POST URL and form fields for uploading a file to S3 (max 15 MB, 5-minute expiry). Object key is `{workspace}/{filename}.tmp`. Only JPEG, PNG, WebP, and PDF content types are accepted. After the multipart upload succeeds, call `/files/confirm` to validate magic bytes and promote the object to `{workspace}/{filename}`. Temporary objects are excluded from list results. Requires active workspace access and write access to crm::files.";
9732
9773
  readonly security: readonly [
9733
9774
  never
9734
9775
  ];
@@ -10343,7 +10384,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
10343
10384
  "Files"
10344
10385
  ];
10345
10386
  readonly summary: "Create presigned upload for a comment attachment";
10346
- readonly description: "Returns a presigned POST URL and form fields for uploading a file attached to a task comment. Object key is `{workspace}_comments/{taskId}/{commentId}/{filename}` (max 15 MB, 5-minute expiry). Accepts JPEG, PNG, WebP, and PDF. Requires workspace access and write access to crm::tasks.";
10387
+ readonly description: "Returns a presigned POST URL and form fields for uploading a file attached to a task comment. Object key is `{workspace}_comments/{taskId}/{commentId}/{filename}.tmp` (max 15 MB, 5-minute expiry). Accepts JPEG, PNG, WebP, and PDF. After upload, call `/files/confirm-comment-file` to validate magic bytes and promote the object. Verifies the task and comment belong to the workspace. Requires active workspace access and write access to crm::tasks.";
10347
10388
  readonly security: readonly [
10348
10389
  never
10349
10390
  ];
@@ -10399,7 +10440,81 @@ declare const routes: import("hono/hono-base").HonoBase<{
10399
10440
  };
10400
10441
  };
10401
10442
  readonly 404: {
10402
- readonly description: "Workspace not found.";
10443
+ readonly description: "Workspace, task, or comment not found.";
10444
+ readonly content: {
10445
+ readonly "application/json": {
10446
+ readonly schema: {
10447
+ readonly $ref: "#/components/schemas/ErrorResponse";
10448
+ };
10449
+ };
10450
+ };
10451
+ };
10452
+ };
10453
+ };
10454
+ };
10455
+ readonly "/files/confirm-comment-file": {
10456
+ readonly post: {
10457
+ readonly tags: readonly [
10458
+ "Files"
10459
+ ];
10460
+ readonly summary: "Confirm a comment attachment upload";
10461
+ readonly description: "Reads the temporary object at `{workspace}_comments/{taskId}/{commentId}/{filename}.tmp`, verifies size (<= 15 MB) and real file type (JPEG, PNG, WebP, or PDF), promotes it to `{workspace}_comments/{taskId}/{commentId}/{filename}`, and deletes the temporary object. Verifies the task and comment belong to the workspace. Requires active workspace access and write access to crm::tasks.";
10462
+ readonly security: readonly [
10463
+ never
10464
+ ];
10465
+ readonly requestBody: {
10466
+ readonly required: true;
10467
+ readonly content: {
10468
+ readonly "application/json": {
10469
+ readonly schema: {
10470
+ readonly $ref: "#/components/schemas/ConfirmCommentFileRequest";
10471
+ };
10472
+ };
10473
+ };
10474
+ };
10475
+ readonly responses: {
10476
+ readonly 200: {
10477
+ readonly description: "Comment file confirmed and promoted.";
10478
+ readonly content: {
10479
+ readonly "application/json": {
10480
+ readonly schema: {
10481
+ readonly $ref: "#/components/schemas/ConfirmFileSuccess";
10482
+ };
10483
+ };
10484
+ };
10485
+ };
10486
+ readonly 400: {
10487
+ readonly description: "Invalid request payload, missing temp object, oversized file, or invalid file type.";
10488
+ readonly content: {
10489
+ readonly "application/json": {
10490
+ readonly schema: {
10491
+ readonly $ref: "#/components/schemas/ErrorResponse";
10492
+ };
10493
+ };
10494
+ };
10495
+ };
10496
+ readonly 401: {
10497
+ readonly description: "Unauthorized - Missing or invalid access token.";
10498
+ readonly content: {
10499
+ readonly "application/json": {
10500
+ readonly schema: {
10501
+ readonly $ref: "#/components/schemas/ErrorResponse";
10502
+ };
10503
+ };
10504
+ };
10505
+ };
10506
+ readonly 403: {
10507
+ readonly description: "Forbidden - Token issuer is not 'access', invite not accepted, user lacks workspace access, or user lacks write access to crm::tasks.";
10508
+ readonly content: {
10509
+ readonly "application/json": {
10510
+ readonly schema: {
10511
+ readonly $ref: "#/components/schemas/ErrorResponse";
10512
+ };
10513
+ };
10514
+ };
10515
+ };
10516
+ readonly 404: {
10517
+ readonly description: "Workspace, task, or comment not found.";
10403
10518
  readonly content: {
10404
10519
  readonly "application/json": {
10405
10520
  readonly schema: {
@@ -10656,7 +10771,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
10656
10771
  "Files"
10657
10772
  ];
10658
10773
  readonly summary: "Confirm and persist an uploaded profile picture";
10659
- readonly description: "Reads the temporary object at `profiles/clients/{userId}/temp`, verifies size (<= 0.5 MB) and real image type (JPEG, PNG, or WebP), resizes it to a 512x512 WebP avatar (cover fit, without enlargement, input pixel limit 4096x4096), stores it privately at `profiles/clients/{userId}/avatar.webp`, deletes the temporary object, creates a 7-day presigned GET URL for the avatar, and saves that URL on the user profile. On failure, the temporary object is deleted and the profile picture is cleared.";
10774
+ readonly description: "Reads the temporary object at `profiles/clients/{userId}/temp`, verifies size (<= 0.5 MB) and real image type (JPEG, PNG, or WebP), resizes it to a 512x512 WebP avatar (cover fit, without enlargement, input pixel limit 4096x4096), stores it privately at `profiles/clients/{userId}/avatar.webp`, deletes the temporary object, creates a 7-day presigned GET URL for the avatar, and saves that URL on the user profile. On failure, the temporary object is deleted; the existing profile picture is left unchanged.";
10660
10775
  readonly security: readonly [
10661
10776
  never
10662
10777
  ];
@@ -10843,7 +10958,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
10843
10958
  "Files"
10844
10959
  ];
10845
10960
  readonly summary: "Confirm and persist an uploaded workspace picture";
10846
- readonly description: "Reads the temporary object at `profiles/workspaces/{workspace}/temp`, verifies size (<= 0.5 MB) and real image type (JPEG, PNG, or WebP), resizes it to a 512x512 WebP avatar (cover fit, without enlargement, input pixel limit 4096x4096), stores it privately at `profiles/workspaces/{workspace}/avatar.webp`, deletes the temporary object, creates a 7-day presigned GET URL for the avatar, and saves that URL on the workspace. On failure, the temporary object is deleted and the workspace picture is cleared. Requires workspace access and write access to crm::general.";
10961
+ readonly description: "Reads the temporary object at `profiles/workspaces/{workspace}/temp`, verifies size (<= 0.5 MB) and real image type (JPEG, PNG, or WebP), resizes it to a 512x512 WebP avatar (cover fit, without enlargement, input pixel limit 4096x4096), stores it privately at `profiles/workspaces/{workspace}/avatar.webp`, deletes the temporary object, creates a 7-day presigned GET URL for the avatar, and saves that URL on the workspace. On failure, the temporary object is deleted; the existing workspace picture is left unchanged. Requires workspace access and write access to crm::general.";
10847
10962
  readonly security: readonly [
10848
10963
  never
10849
10964
  ];
@@ -16768,6 +16883,20 @@ declare const routes: import("hono/hono-base").HonoBase<{
16768
16883
  } & {
16769
16884
  "/download/:workspace/:fileKey": {
16770
16885
  $get: {
16886
+ input: {
16887
+ param: {
16888
+ workspace: string;
16889
+ } & {
16890
+ fileKey: string;
16891
+ };
16892
+ };
16893
+ output: {
16894
+ success: false;
16895
+ error: string;
16896
+ };
16897
+ outputFormat: "json";
16898
+ status: 400;
16899
+ } | {
16771
16900
  input: {
16772
16901
  param: {
16773
16902
  workspace: string;
@@ -16853,6 +16982,14 @@ declare const routes: import("hono/hono-base").HonoBase<{
16853
16982
  };
16854
16983
  outputFormat: "json";
16855
16984
  status: 400;
16985
+ } | {
16986
+ input: {};
16987
+ output: {
16988
+ success: false;
16989
+ error: string;
16990
+ };
16991
+ outputFormat: "json";
16992
+ status: 404;
16856
16993
  } | {
16857
16994
  input: {};
16858
16995
  output: {
@@ -16868,6 +17005,34 @@ declare const routes: import("hono/hono-base").HonoBase<{
16868
17005
  status: import("hono/utils/http-status").ContentfulStatusCode;
16869
17006
  };
16870
17007
  };
17008
+ } & {
17009
+ "/confirm-comment-file": {
17010
+ $post: {
17011
+ input: {};
17012
+ output: {
17013
+ success: false;
17014
+ error: string;
17015
+ };
17016
+ outputFormat: "json";
17017
+ status: 404;
17018
+ } | {
17019
+ input: {};
17020
+ output: {
17021
+ success: true;
17022
+ key: string;
17023
+ };
17024
+ outputFormat: "json";
17025
+ status: import("hono/utils/http-status").ContentfulStatusCode;
17026
+ } | {
17027
+ input: {};
17028
+ output: {
17029
+ success: false;
17030
+ error: string;
17031
+ };
17032
+ outputFormat: "json";
17033
+ status: 400;
17034
+ };
17035
+ };
16871
17036
  } & {
16872
17037
  "/delete-comment-file": {
16873
17038
  $post: {
@@ -16878,6 +17043,14 @@ declare const routes: import("hono/hono-base").HonoBase<{
16878
17043
  };
16879
17044
  outputFormat: "json";
16880
17045
  status: 400;
17046
+ } | {
17047
+ input: {};
17048
+ output: {
17049
+ success: false;
17050
+ error: string;
17051
+ };
17052
+ outputFormat: "json";
17053
+ status: 404;
16881
17054
  } | {
16882
17055
  input: {};
16883
17056
  output: {
@@ -16910,6 +17083,20 @@ declare const routes: import("hono/hono-base").HonoBase<{
16910
17083
  } & {
16911
17084
  "/download-from-task/:workspace/:taskId": {
16912
17085
  $get: {
17086
+ input: {
17087
+ param: {
17088
+ workspace: string;
17089
+ } & {
17090
+ taskId: string;
17091
+ };
17092
+ };
17093
+ output: {
17094
+ success: false;
17095
+ error: string;
17096
+ };
17097
+ outputFormat: "json";
17098
+ status: 404;
17099
+ } | {
16913
17100
  input: {
16914
17101
  param: {
16915
17102
  workspace: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mestra-dev/contract",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "Types-only Hono AppType contract for the Mestra auth API",
5
5
  "type": "module",
6
6
  "sideEffects": false,