@mestra-dev/contract 0.0.27 → 0.0.28

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 +290 -5
  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), profile and workspace picture upload/confirm/delete, comment attachment upload, list task comment files with download URLs, folder create/delete, list (includes pin metadata), 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, 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).";
98
98
  },
99
99
  {
100
100
  readonly name: "Chat";
@@ -1422,6 +1422,43 @@ declare const routes: import("hono/hono-base").HonoBase<{
1422
1422
  };
1423
1423
  };
1424
1424
  };
1425
+ readonly ConfirmFileRequest: {
1426
+ readonly type: "object";
1427
+ readonly required: readonly [
1428
+ "filename",
1429
+ "workspace"
1430
+ ];
1431
+ readonly properties: {
1432
+ readonly filename: {
1433
+ readonly type: "string";
1434
+ readonly description: "Original file name used for `/files/upload` (without the `.tmp` suffix).";
1435
+ readonly example: "invoice-2026.pdf";
1436
+ };
1437
+ readonly workspace: {
1438
+ readonly type: "string";
1439
+ readonly format: "uuid";
1440
+ readonly description: "Workspace identifier.";
1441
+ };
1442
+ };
1443
+ };
1444
+ readonly ConfirmFileSuccess: {
1445
+ readonly type: "object";
1446
+ readonly required: readonly [
1447
+ "success",
1448
+ "key"
1449
+ ];
1450
+ readonly properties: {
1451
+ readonly success: {
1452
+ readonly type: "boolean";
1453
+ readonly const: true;
1454
+ };
1455
+ readonly key: {
1456
+ readonly type: "string";
1457
+ readonly description: "Final S3 object key after promotion (`{workspace}/{filename}`).";
1458
+ readonly example: "550e8400-e29b-41d4-a716-446655440000/invoice-2026.pdf";
1459
+ };
1460
+ };
1461
+ };
1425
1462
  readonly PresignedUploadSuccess: {
1426
1463
  readonly type: "object";
1427
1464
  readonly required: readonly [
@@ -1444,8 +1481,8 @@ declare const routes: import("hono/hono-base").HonoBase<{
1444
1481
  };
1445
1482
  readonly key: {
1446
1483
  readonly type: "string";
1447
- readonly description: "S3 object key where the file will be stored (`{workspace}/{filename}`).";
1448
- readonly example: "550e8400-e29b-41d4-a716-446655440000/invoice-2026.pdf";
1484
+ readonly description: "Temporary S3 object key (`{workspace}/{filename}.tmp`). Call `/files/confirm` after upload.";
1485
+ readonly example: "550e8400-e29b-41d4-a716-446655440000/invoice-2026.pdf.tmp";
1449
1486
  };
1450
1487
  readonly maxSize: {
1451
1488
  readonly type: "integer";
@@ -1526,6 +1563,37 @@ declare const routes: import("hono/hono-base").HonoBase<{
1526
1563
  };
1527
1564
  };
1528
1565
  };
1566
+ readonly DeleteCommentFileRequest: {
1567
+ readonly type: "object";
1568
+ readonly required: readonly [
1569
+ "filename",
1570
+ "workspace",
1571
+ "taskId",
1572
+ "commentId"
1573
+ ];
1574
+ readonly properties: {
1575
+ readonly filename: {
1576
+ readonly type: "string";
1577
+ readonly description: "Original file name (trimmed).";
1578
+ readonly example: "receipt.pdf";
1579
+ };
1580
+ readonly workspace: {
1581
+ readonly type: "string";
1582
+ readonly format: "uuid";
1583
+ readonly description: "Workspace identifier.";
1584
+ };
1585
+ readonly taskId: {
1586
+ readonly type: "string";
1587
+ readonly format: "uuid";
1588
+ readonly description: "Task the comment belongs to.";
1589
+ };
1590
+ readonly commentId: {
1591
+ readonly type: "string";
1592
+ readonly format: "uuid";
1593
+ readonly description: "Comment the file is attached to.";
1594
+ };
1595
+ };
1596
+ };
1529
1597
  readonly TaskCommentFile: {
1530
1598
  readonly type: "object";
1531
1599
  readonly required: readonly [
@@ -9660,7 +9728,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
9660
9728
  "Files"
9661
9729
  ];
9662
9730
  readonly summary: "Create presigned S3 upload";
9663
- 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}`. Only JPEG, PNG, WebP, and PDF content types are accepted. Requires workspace access.";
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.";
9664
9732
  readonly security: readonly [
9665
9733
  never
9666
9734
  ];
@@ -9728,6 +9796,80 @@ declare const routes: import("hono/hono-base").HonoBase<{
9728
9796
  };
9729
9797
  };
9730
9798
  };
9799
+ readonly "/files/confirm": {
9800
+ readonly post: {
9801
+ readonly tags: readonly [
9802
+ "Files"
9803
+ ];
9804
+ readonly summary: "Confirm and promote a temporary upload";
9805
+ readonly description: "Reads the temporary object at `{workspace}/{filename}.tmp`, verifies size (<= 15 MB) and real file type (JPEG, PNG, WebP, or PDF), copies it to `{workspace}/{filename}`, and deletes the temporary object. On failure, the temporary object is deleted. Requires workspace access.";
9806
+ readonly security: readonly [
9807
+ never
9808
+ ];
9809
+ readonly requestBody: {
9810
+ readonly required: true;
9811
+ readonly content: {
9812
+ readonly "application/json": {
9813
+ readonly schema: {
9814
+ readonly $ref: "#/components/schemas/ConfirmFileRequest";
9815
+ };
9816
+ };
9817
+ };
9818
+ };
9819
+ readonly responses: {
9820
+ readonly 200: {
9821
+ readonly description: "File confirmed and promoted successfully.";
9822
+ readonly content: {
9823
+ readonly "application/json": {
9824
+ readonly schema: {
9825
+ readonly $ref: "#/components/schemas/ConfirmFileSuccess";
9826
+ };
9827
+ };
9828
+ };
9829
+ };
9830
+ readonly 400: {
9831
+ readonly description: "Temporary object missing, file too large, invalid file type, or processing failed.";
9832
+ readonly content: {
9833
+ readonly "application/json": {
9834
+ readonly schema: {
9835
+ readonly $ref: "#/components/schemas/ErrorResponse";
9836
+ };
9837
+ };
9838
+ };
9839
+ };
9840
+ readonly 401: {
9841
+ readonly description: "Unauthorized - Missing or invalid access token.";
9842
+ readonly content: {
9843
+ readonly "application/json": {
9844
+ readonly schema: {
9845
+ readonly $ref: "#/components/schemas/ErrorResponse";
9846
+ };
9847
+ };
9848
+ };
9849
+ };
9850
+ readonly 403: {
9851
+ readonly description: "Forbidden - Token issuer is not 'access' or user lacks workspace access.";
9852
+ readonly content: {
9853
+ readonly "application/json": {
9854
+ readonly schema: {
9855
+ readonly $ref: "#/components/schemas/ErrorResponse";
9856
+ };
9857
+ };
9858
+ };
9859
+ };
9860
+ readonly 404: {
9861
+ readonly description: "Workspace not found.";
9862
+ readonly content: {
9863
+ readonly "application/json": {
9864
+ readonly schema: {
9865
+ readonly $ref: "#/components/schemas/ErrorResponse";
9866
+ };
9867
+ };
9868
+ };
9869
+ };
9870
+ };
9871
+ };
9872
+ };
9731
9873
  readonly "/files/create-folder": {
9732
9874
  readonly post: {
9733
9875
  readonly tags: readonly [
@@ -9882,7 +10024,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
9882
10024
  "Files"
9883
10025
  ];
9884
10026
  readonly summary: "List workspace files";
9885
- readonly description: "Lists up to 50 S3 objects under the workspace prefix. Each item includes `pin` from S3 object user metadata. Requires workspace access.";
10027
+ readonly description: "Lists up to 50 S3 objects under the workspace prefix. Temporary uploads ending in `.tmp` are excluded. Each item includes `pin` from S3 object user metadata. Requires workspace access.";
9886
10028
  readonly security: readonly [
9887
10029
  never
9888
10030
  ];
@@ -10269,6 +10411,90 @@ declare const routes: import("hono/hono-base").HonoBase<{
10269
10411
  };
10270
10412
  };
10271
10413
  };
10414
+ readonly "/files/delete-comment-file": {
10415
+ readonly post: {
10416
+ readonly tags: readonly [
10417
+ "Files"
10418
+ ];
10419
+ readonly summary: "Delete a comment attachment";
10420
+ readonly description: "Deletes the S3 object at `{workspace}_comments/{taskId}/{commentId}/{filename}`. Verifies the object exists before deletion and confirms removal afterward. Requires workspace access and write access to crm::tasks.";
10421
+ readonly security: readonly [
10422
+ never
10423
+ ];
10424
+ readonly requestBody: {
10425
+ readonly required: true;
10426
+ readonly content: {
10427
+ readonly "application/json": {
10428
+ readonly schema: {
10429
+ readonly $ref: "#/components/schemas/DeleteCommentFileRequest";
10430
+ };
10431
+ };
10432
+ };
10433
+ };
10434
+ readonly responses: {
10435
+ readonly 200: {
10436
+ readonly description: "Comment file deleted successfully.";
10437
+ readonly content: {
10438
+ readonly "application/json": {
10439
+ readonly schema: {
10440
+ readonly $ref: "#/components/schemas/DeleteFileSuccess";
10441
+ };
10442
+ };
10443
+ };
10444
+ };
10445
+ readonly 400: {
10446
+ readonly description: "Invalid request payload.";
10447
+ readonly content: {
10448
+ readonly "application/json": {
10449
+ readonly schema: {
10450
+ readonly $ref: "#/components/schemas/ErrorResponse";
10451
+ };
10452
+ };
10453
+ };
10454
+ };
10455
+ readonly 401: {
10456
+ readonly description: "Unauthorized - Missing or invalid access token.";
10457
+ readonly content: {
10458
+ readonly "application/json": {
10459
+ readonly schema: {
10460
+ readonly $ref: "#/components/schemas/ErrorResponse";
10461
+ };
10462
+ };
10463
+ };
10464
+ };
10465
+ readonly 403: {
10466
+ readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access, or user lacks write access to crm::tasks.";
10467
+ readonly content: {
10468
+ readonly "application/json": {
10469
+ readonly schema: {
10470
+ readonly $ref: "#/components/schemas/ErrorResponse";
10471
+ };
10472
+ };
10473
+ };
10474
+ };
10475
+ readonly 404: {
10476
+ readonly description: "File not found at the given comment attachment key.";
10477
+ readonly content: {
10478
+ readonly "application/json": {
10479
+ readonly schema: {
10480
+ readonly $ref: "#/components/schemas/DeleteFileFailure";
10481
+ };
10482
+ };
10483
+ };
10484
+ };
10485
+ readonly 500: {
10486
+ readonly description: "Delete command ran but the object still exists.";
10487
+ readonly content: {
10488
+ readonly "application/json": {
10489
+ readonly schema: {
10490
+ readonly $ref: "#/components/schemas/DeleteFileFailure";
10491
+ };
10492
+ };
10493
+ };
10494
+ };
10495
+ };
10496
+ };
10497
+ };
10272
10498
  readonly "/files/download-from-task/{workspace}/{taskId}": {
10273
10499
  readonly get: {
10274
10500
  readonly tags: readonly [
@@ -16456,6 +16682,26 @@ declare const routes: import("hono/hono-base").HonoBase<{
16456
16682
  status: import("hono/utils/http-status").ContentfulStatusCode;
16457
16683
  };
16458
16684
  };
16685
+ } & {
16686
+ "/confirm": {
16687
+ $post: {
16688
+ input: {};
16689
+ output: {
16690
+ success: true;
16691
+ key: string;
16692
+ };
16693
+ outputFormat: "json";
16694
+ status: import("hono/utils/http-status").ContentfulStatusCode;
16695
+ } | {
16696
+ input: {};
16697
+ output: {
16698
+ success: false;
16699
+ error: string;
16700
+ };
16701
+ outputFormat: "json";
16702
+ status: 400;
16703
+ };
16704
+ };
16459
16705
  } & {
16460
16706
  "/create-folder": {
16461
16707
  $post: {
@@ -16622,6 +16868,45 @@ declare const routes: import("hono/hono-base").HonoBase<{
16622
16868
  status: import("hono/utils/http-status").ContentfulStatusCode;
16623
16869
  };
16624
16870
  };
16871
+ } & {
16872
+ "/delete-comment-file": {
16873
+ $post: {
16874
+ input: {};
16875
+ output: {
16876
+ success: false;
16877
+ error: never;
16878
+ };
16879
+ outputFormat: "json";
16880
+ status: 400;
16881
+ } | {
16882
+ input: {};
16883
+ output: {
16884
+ success: false;
16885
+ message: string;
16886
+ key: string;
16887
+ };
16888
+ outputFormat: "json";
16889
+ status: 404;
16890
+ } | {
16891
+ input: {};
16892
+ output: {
16893
+ success: false;
16894
+ message: string;
16895
+ key: string;
16896
+ };
16897
+ outputFormat: "json";
16898
+ status: 500;
16899
+ } | {
16900
+ input: {};
16901
+ output: {
16902
+ success: true;
16903
+ message: string;
16904
+ key: string;
16905
+ };
16906
+ outputFormat: "json";
16907
+ status: import("hono/utils/http-status").ContentfulStatusCode;
16908
+ };
16909
+ };
16625
16910
  } & {
16626
16911
  "/download-from-task/:workspace/:taskId": {
16627
16912
  $get: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mestra-dev/contract",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "description": "Types-only Hono AppType contract for the Mestra auth API",
5
5
  "type": "module",
6
6
  "sideEffects": false,