@mestra-dev/contract 0.0.87 → 0.0.88

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 +354 -3
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1751,6 +1751,135 @@ declare const routes: import("hono/hono-base").HonoBase<{
1751
1751
  };
1752
1752
  };
1753
1753
  };
1754
+ readonly UploadToServiceRequest: {
1755
+ readonly type: "object";
1756
+ readonly required: readonly [
1757
+ "filename",
1758
+ "contentType",
1759
+ "contentLength",
1760
+ "workspace",
1761
+ "serviceId"
1762
+ ];
1763
+ readonly properties: {
1764
+ readonly filename: {
1765
+ readonly type: "string";
1766
+ readonly minLength: 1;
1767
+ readonly maxLength: 200;
1768
+ readonly description: "Safe file name (no path separators, not `.tmp`).";
1769
+ readonly example: "floor-plan.pdf";
1770
+ };
1771
+ readonly contentType: {
1772
+ readonly $ref: "#/components/schemas/FileContentType";
1773
+ };
1774
+ readonly contentLength: {
1775
+ readonly type: "integer";
1776
+ readonly minimum: 1;
1777
+ readonly maximum: 15728640;
1778
+ readonly description: "Exact file byte length. The S3 upload policy rejects a different size.";
1779
+ };
1780
+ readonly workspace: {
1781
+ readonly type: "string";
1782
+ readonly format: "uuid";
1783
+ readonly description: "Workspace identifier.";
1784
+ };
1785
+ readonly serviceId: {
1786
+ readonly type: "string";
1787
+ readonly format: "uuid";
1788
+ readonly description: "Service the file is attached to.";
1789
+ };
1790
+ };
1791
+ };
1792
+ readonly UploadToServiceSuccess: {
1793
+ readonly type: "object";
1794
+ readonly required: readonly [
1795
+ "success",
1796
+ "url",
1797
+ "fields",
1798
+ "key",
1799
+ "maxSize"
1800
+ ];
1801
+ readonly properties: {
1802
+ readonly success: {
1803
+ readonly type: "boolean";
1804
+ readonly const: true;
1805
+ };
1806
+ readonly url: {
1807
+ readonly type: "string";
1808
+ readonly description: "S3 presigned POST URL.";
1809
+ };
1810
+ readonly fields: {
1811
+ readonly type: "object";
1812
+ readonly additionalProperties: {
1813
+ readonly type: "string";
1814
+ };
1815
+ readonly description: "Form fields to include in the multipart upload POST.";
1816
+ };
1817
+ readonly key: {
1818
+ readonly type: "string";
1819
+ readonly description: "Temporary S3 object key (`{workspace}_services/{serviceId}/{filename}.tmp`). Call `/files/confirm-service-file` after upload.";
1820
+ readonly example: "550e8400-e29b-41d4-a716-446655440000_services/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/floor-plan.pdf.tmp";
1821
+ };
1822
+ readonly maxSize: {
1823
+ readonly type: "integer";
1824
+ readonly description: "Exact requested upload size in bytes; it cannot exceed 15 MB.";
1825
+ readonly example: 15728640;
1826
+ };
1827
+ };
1828
+ };
1829
+ readonly ConfirmServiceFileRequest: {
1830
+ readonly type: "object";
1831
+ readonly required: readonly [
1832
+ "filename",
1833
+ "workspace",
1834
+ "serviceId"
1835
+ ];
1836
+ readonly properties: {
1837
+ readonly filename: {
1838
+ readonly type: "string";
1839
+ readonly minLength: 1;
1840
+ readonly maxLength: 200;
1841
+ readonly description: "Original file name used for `/files/upload-to-service` (without the `.tmp` suffix).";
1842
+ readonly example: "floor-plan.pdf";
1843
+ };
1844
+ readonly workspace: {
1845
+ readonly type: "string";
1846
+ readonly format: "uuid";
1847
+ readonly description: "Workspace identifier.";
1848
+ };
1849
+ readonly serviceId: {
1850
+ readonly type: "string";
1851
+ readonly format: "uuid";
1852
+ readonly description: "Service the file is attached to.";
1853
+ };
1854
+ };
1855
+ };
1856
+ readonly DeleteServiceFileRequest: {
1857
+ readonly type: "object";
1858
+ readonly required: readonly [
1859
+ "filename",
1860
+ "workspace",
1861
+ "serviceId"
1862
+ ];
1863
+ readonly properties: {
1864
+ readonly filename: {
1865
+ readonly type: "string";
1866
+ readonly minLength: 1;
1867
+ readonly maxLength: 200;
1868
+ readonly description: "Safe file name (no path separators, not `.tmp`).";
1869
+ readonly example: "floor-plan.pdf";
1870
+ };
1871
+ readonly workspace: {
1872
+ readonly type: "string";
1873
+ readonly format: "uuid";
1874
+ readonly description: "Workspace identifier.";
1875
+ };
1876
+ readonly serviceId: {
1877
+ readonly type: "string";
1878
+ readonly format: "uuid";
1879
+ readonly description: "Service the file is attached to.";
1880
+ };
1881
+ };
1882
+ };
1754
1883
  readonly TaskCommentFile: {
1755
1884
  readonly type: "object";
1756
1885
  readonly required: readonly [
@@ -12360,6 +12489,228 @@ declare const routes: import("hono/hono-base").HonoBase<{
12360
12489
  };
12361
12490
  };
12362
12491
  };
12492
+ readonly "/files/upload-to-service": {
12493
+ readonly post: {
12494
+ readonly tags: readonly [
12495
+ "Files"
12496
+ ];
12497
+ readonly summary: "Create presigned upload for a service file";
12498
+ readonly description: "Returns a presigned POST URL and form fields for uploading a file attached to a CRM service. Object key is `{workspace}_services/{serviceId}/{filename}.tmp` (max 15 MB, 5-minute expiry). Accepts JPEG, PNG, WebP, and PDF. After upload, call `/files/confirm-service-file` to validate magic bytes and promote the object. Currently supported for real-estate workspaces; verifies the service belongs to the workspace. Requires active workspace access, write access to crm::services, and an active billing grant.";
12499
+ readonly security: readonly [
12500
+ never
12501
+ ];
12502
+ readonly requestBody: {
12503
+ readonly required: true;
12504
+ readonly content: {
12505
+ readonly "application/json": {
12506
+ readonly schema: {
12507
+ readonly $ref: "#/components/schemas/UploadToServiceRequest";
12508
+ };
12509
+ };
12510
+ };
12511
+ };
12512
+ readonly responses: {
12513
+ readonly 200: {
12514
+ readonly description: "Presigned service upload created.";
12515
+ readonly content: {
12516
+ readonly "application/json": {
12517
+ readonly schema: {
12518
+ readonly $ref: "#/components/schemas/UploadToServiceSuccess";
12519
+ };
12520
+ };
12521
+ };
12522
+ };
12523
+ readonly 400: {
12524
+ readonly description: "Invalid request payload, unsupported content type, or unsupported workspace category.";
12525
+ readonly content: {
12526
+ readonly "application/json": {
12527
+ readonly schema: {
12528
+ readonly $ref: "#/components/schemas/ErrorResponse";
12529
+ };
12530
+ };
12531
+ };
12532
+ };
12533
+ readonly 401: {
12534
+ readonly description: "Unauthorized - Missing or invalid access token.";
12535
+ readonly content: {
12536
+ readonly "application/json": {
12537
+ readonly schema: {
12538
+ readonly $ref: "#/components/schemas/ErrorResponse";
12539
+ };
12540
+ };
12541
+ };
12542
+ };
12543
+ readonly 403: {
12544
+ readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access, user lacks write access to crm::services, or billing access is missing.";
12545
+ readonly content: {
12546
+ readonly "application/json": {
12547
+ readonly schema: {
12548
+ readonly $ref: "#/components/schemas/ErrorResponse";
12549
+ };
12550
+ };
12551
+ };
12552
+ };
12553
+ readonly 404: {
12554
+ readonly description: "Workspace or real-estate service not found.";
12555
+ readonly content: {
12556
+ readonly "application/json": {
12557
+ readonly schema: {
12558
+ readonly $ref: "#/components/schemas/ErrorResponse";
12559
+ };
12560
+ };
12561
+ };
12562
+ };
12563
+ };
12564
+ };
12565
+ };
12566
+ readonly "/files/confirm-service-file": {
12567
+ readonly post: {
12568
+ readonly tags: readonly [
12569
+ "Files"
12570
+ ];
12571
+ readonly summary: "Confirm a service file upload";
12572
+ readonly description: "Reads the temporary object at `{workspace}_services/{serviceId}/{filename}.tmp`, verifies size (<= 15 MB) and real file type (JPEG, PNG, WebP, or PDF), promotes it to `{workspace}_services/{serviceId}/{filename}`, and deletes the temporary object. Confirmed bytes count toward workspace storage usage (`servicesBytes`). Requires active workspace access, write access to crm::services, and an active billing grant.";
12573
+ readonly security: readonly [
12574
+ never
12575
+ ];
12576
+ readonly requestBody: {
12577
+ readonly required: true;
12578
+ readonly content: {
12579
+ readonly "application/json": {
12580
+ readonly schema: {
12581
+ readonly $ref: "#/components/schemas/ConfirmServiceFileRequest";
12582
+ };
12583
+ };
12584
+ };
12585
+ };
12586
+ readonly responses: {
12587
+ readonly 200: {
12588
+ readonly description: "Service file confirmed and promoted.";
12589
+ readonly content: {
12590
+ readonly "application/json": {
12591
+ readonly schema: {
12592
+ readonly $ref: "#/components/schemas/ConfirmFileSuccess";
12593
+ };
12594
+ };
12595
+ };
12596
+ };
12597
+ readonly 400: {
12598
+ readonly description: "Invalid request payload, missing temp object, oversized file, or invalid file type.";
12599
+ readonly content: {
12600
+ readonly "application/json": {
12601
+ readonly schema: {
12602
+ readonly $ref: "#/components/schemas/ErrorResponse";
12603
+ };
12604
+ };
12605
+ };
12606
+ };
12607
+ readonly 401: {
12608
+ readonly description: "Unauthorized - Missing or invalid access token.";
12609
+ readonly content: {
12610
+ readonly "application/json": {
12611
+ readonly schema: {
12612
+ readonly $ref: "#/components/schemas/ErrorResponse";
12613
+ };
12614
+ };
12615
+ };
12616
+ };
12617
+ readonly 403: {
12618
+ readonly description: "Forbidden - Token issuer is not 'access', invite not accepted, user lacks workspace access, user lacks write access to crm::services, or billing access is missing.";
12619
+ readonly content: {
12620
+ readonly "application/json": {
12621
+ readonly schema: {
12622
+ readonly $ref: "#/components/schemas/ErrorResponse";
12623
+ };
12624
+ };
12625
+ };
12626
+ };
12627
+ };
12628
+ };
12629
+ };
12630
+ readonly "/files/delete-service-file": {
12631
+ readonly post: {
12632
+ readonly tags: readonly [
12633
+ "Files"
12634
+ ];
12635
+ readonly summary: "Delete a service file";
12636
+ readonly description: "Deletes the S3 object at `{workspace}_services/{serviceId}/{filename}`. Verifies the object exists before deletion and confirms removal afterward. Requires workspace access, write access to crm::services, and an active billing grant.";
12637
+ readonly security: readonly [
12638
+ never
12639
+ ];
12640
+ readonly requestBody: {
12641
+ readonly required: true;
12642
+ readonly content: {
12643
+ readonly "application/json": {
12644
+ readonly schema: {
12645
+ readonly $ref: "#/components/schemas/DeleteServiceFileRequest";
12646
+ };
12647
+ };
12648
+ };
12649
+ };
12650
+ readonly responses: {
12651
+ readonly 200: {
12652
+ readonly description: "Service file deleted successfully.";
12653
+ readonly content: {
12654
+ readonly "application/json": {
12655
+ readonly schema: {
12656
+ readonly $ref: "#/components/schemas/DeleteFileSuccess";
12657
+ };
12658
+ };
12659
+ };
12660
+ };
12661
+ readonly 400: {
12662
+ readonly description: "Invalid request payload.";
12663
+ readonly content: {
12664
+ readonly "application/json": {
12665
+ readonly schema: {
12666
+ readonly $ref: "#/components/schemas/ErrorResponse";
12667
+ };
12668
+ };
12669
+ };
12670
+ };
12671
+ readonly 401: {
12672
+ readonly description: "Unauthorized - Missing or invalid access token.";
12673
+ readonly content: {
12674
+ readonly "application/json": {
12675
+ readonly schema: {
12676
+ readonly $ref: "#/components/schemas/ErrorResponse";
12677
+ };
12678
+ };
12679
+ };
12680
+ };
12681
+ readonly 403: {
12682
+ readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access, user lacks write access to crm::services, or billing access is missing.";
12683
+ readonly content: {
12684
+ readonly "application/json": {
12685
+ readonly schema: {
12686
+ readonly $ref: "#/components/schemas/ErrorResponse";
12687
+ };
12688
+ };
12689
+ };
12690
+ };
12691
+ readonly 404: {
12692
+ readonly description: "File not found at the given service file key.";
12693
+ readonly content: {
12694
+ readonly "application/json": {
12695
+ readonly schema: {
12696
+ readonly $ref: "#/components/schemas/DeleteFileFailure";
12697
+ };
12698
+ };
12699
+ };
12700
+ };
12701
+ readonly 500: {
12702
+ readonly description: "Delete command ran but the object still exists.";
12703
+ readonly content: {
12704
+ readonly "application/json": {
12705
+ readonly schema: {
12706
+ readonly $ref: "#/components/schemas/DeleteFileFailure";
12707
+ };
12708
+ };
12709
+ };
12710
+ };
12711
+ };
12712
+ };
12713
+ };
12363
12714
  readonly "/files/delete-comment-file": {
12364
12715
  readonly post: {
12365
12716
  readonly tags: readonly [
@@ -19573,10 +19924,10 @@ declare const routes: import("hono/hono-base").HonoBase<{
19573
19924
  input: {};
19574
19925
  output: {
19575
19926
  success: false;
19576
- error: never;
19927
+ error: string;
19577
19928
  };
19578
19929
  outputFormat: "json";
19579
- status: 400;
19930
+ status: 404;
19580
19931
  } | {
19581
19932
  input: {};
19582
19933
  output: {
@@ -19584,7 +19935,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
19584
19935
  error: string;
19585
19936
  };
19586
19937
  outputFormat: "json";
19587
- status: 404;
19938
+ status: 400;
19588
19939
  } | {
19589
19940
  input: {};
19590
19941
  output: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mestra-dev/contract",
3
- "version": "0.0.87",
3
+ "version": "0.0.88",
4
4
  "description": "Types-only Hono AppType contract for the Mestra auth API",
5
5
  "type": "module",
6
6
  "sideEffects": false,