@mestra-dev/contract 0.0.99 → 0.0.101

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 +616 -88
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1751,6 +1751,133 @@ declare const routes: import("hono/hono-base").HonoBase<{
1751
1751
  };
1752
1752
  };
1753
1753
  };
1754
+ readonly UploadToCustomerRequest: {
1755
+ readonly type: "object";
1756
+ readonly required: readonly [
1757
+ "filename",
1758
+ "contentType",
1759
+ "contentLength",
1760
+ "workspace",
1761
+ "customerId"
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: "contract.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.";
1779
+ };
1780
+ readonly workspace: {
1781
+ readonly type: "string";
1782
+ readonly format: "uuid";
1783
+ readonly description: "Workspace identifier.";
1784
+ };
1785
+ readonly customerId: {
1786
+ readonly type: "string";
1787
+ readonly format: "uuid";
1788
+ readonly description: "Customer the file is attached to.";
1789
+ };
1790
+ };
1791
+ };
1792
+ readonly UploadToCustomerSuccess: {
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}_customers/{customerId}/{filename}.tmp`).";
1820
+ };
1821
+ readonly maxSize: {
1822
+ readonly type: "integer";
1823
+ readonly description: "Exact requested upload size in bytes.";
1824
+ };
1825
+ };
1826
+ };
1827
+ readonly ConfirmCustomerFileRequest: {
1828
+ readonly type: "object";
1829
+ readonly required: readonly [
1830
+ "filename",
1831
+ "workspace",
1832
+ "customerId"
1833
+ ];
1834
+ readonly properties: {
1835
+ readonly filename: {
1836
+ readonly type: "string";
1837
+ readonly minLength: 1;
1838
+ readonly maxLength: 200;
1839
+ readonly description: "Original file name used for `/files/upload-to-customer`.";
1840
+ readonly example: "contract.pdf";
1841
+ };
1842
+ readonly workspace: {
1843
+ readonly type: "string";
1844
+ readonly format: "uuid";
1845
+ readonly description: "Workspace identifier.";
1846
+ };
1847
+ readonly customerId: {
1848
+ readonly type: "string";
1849
+ readonly format: "uuid";
1850
+ readonly description: "Customer the file is attached to.";
1851
+ };
1852
+ };
1853
+ };
1854
+ readonly DeleteCustomerFileRequest: {
1855
+ readonly type: "object";
1856
+ readonly required: readonly [
1857
+ "filename",
1858
+ "workspace",
1859
+ "customerId"
1860
+ ];
1861
+ readonly properties: {
1862
+ readonly filename: {
1863
+ readonly type: "string";
1864
+ readonly minLength: 1;
1865
+ readonly maxLength: 200;
1866
+ readonly description: "Safe file name (no path separators, not `.tmp`).";
1867
+ readonly example: "contract.pdf";
1868
+ };
1869
+ readonly workspace: {
1870
+ readonly type: "string";
1871
+ readonly format: "uuid";
1872
+ readonly description: "Workspace identifier.";
1873
+ };
1874
+ readonly customerId: {
1875
+ readonly type: "string";
1876
+ readonly format: "uuid";
1877
+ readonly description: "Customer the file is attached to.";
1878
+ };
1879
+ };
1880
+ };
1754
1881
  readonly UploadToServiceRequest: {
1755
1882
  readonly type: "object";
1756
1883
  readonly required: readonly [
@@ -1992,6 +2119,59 @@ declare const routes: import("hono/hono-base").HonoBase<{
1992
2119
  };
1993
2120
  };
1994
2121
  };
2122
+ readonly CustomerFile: {
2123
+ readonly type: "object";
2124
+ readonly required: readonly [
2125
+ "key",
2126
+ "filename",
2127
+ "size",
2128
+ "downloadUrl"
2129
+ ];
2130
+ readonly properties: {
2131
+ readonly key: {
2132
+ readonly type: "string";
2133
+ readonly description: "Full S3 object key (`{workspace}_customers/{customerId}/{filename}`).";
2134
+ };
2135
+ readonly filename: {
2136
+ readonly type: "string";
2137
+ readonly description: "File name under `{workspace}_customers/{customerId}/`.";
2138
+ };
2139
+ readonly size: {
2140
+ readonly type: "integer";
2141
+ readonly description: "Object size in bytes.";
2142
+ };
2143
+ readonly lastModified: {
2144
+ readonly type: "string";
2145
+ readonly format: "date-time";
2146
+ readonly nullable: true;
2147
+ readonly description: "Last modified timestamp from S3 (ISO string).";
2148
+ };
2149
+ readonly downloadUrl: {
2150
+ readonly type: "string";
2151
+ readonly description: "Presigned GET URL (5-minute expiry).";
2152
+ };
2153
+ };
2154
+ };
2155
+ readonly ListCustomerFilesSuccess: {
2156
+ readonly type: "object";
2157
+ readonly required: readonly [
2158
+ "success",
2159
+ "files"
2160
+ ];
2161
+ readonly properties: {
2162
+ readonly success: {
2163
+ readonly type: "boolean";
2164
+ readonly const: true;
2165
+ };
2166
+ readonly files: {
2167
+ readonly type: "array";
2168
+ readonly items: {
2169
+ readonly $ref: "#/components/schemas/CustomerFile";
2170
+ };
2171
+ readonly description: "All non-prefix, non-`.tmp` objects under `{workspace}_customers/{customerId}/`.";
2172
+ };
2173
+ };
2174
+ };
1995
2175
  readonly UploadProfilePictureRequest: {
1996
2176
  readonly type: "object";
1997
2177
  readonly required: readonly [
@@ -2250,6 +2430,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
2250
2430
  "usedBytes",
2251
2431
  "filesBytes",
2252
2432
  "commentsBytes",
2433
+ "customerBytes",
2253
2434
  "servicesBytes",
2254
2435
  "limitBytes"
2255
2436
  ];
@@ -2260,7 +2441,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
2260
2441
  };
2261
2442
  readonly usedBytes: {
2262
2443
  readonly type: "integer";
2263
- readonly description: "Total finalized storage in bytes (`filesBytes` + `commentsBytes` + `servicesBytes`). Excludes `.tmp` objects.";
2444
+ readonly description: "Total finalized storage in bytes (`filesBytes` + `commentsBytes` + `customerBytes` + `servicesBytes`). Excludes `.tmp` objects.";
2264
2445
  readonly example: 348320;
2265
2446
  };
2266
2447
  readonly filesBytes: {
@@ -2273,6 +2454,11 @@ declare const routes: import("hono/hono-base").HonoBase<{
2273
2454
  readonly description: "Finalized comment attachment storage under `{workspace}_comments/`. Excludes `.tmp`.";
2274
2455
  readonly example: 100000;
2275
2456
  };
2457
+ readonly customerBytes: {
2458
+ readonly type: "integer";
2459
+ readonly description: "Finalized customer file storage under `{workspace}_customers/`. Excludes `.tmp`.";
2460
+ readonly example: 50000;
2461
+ };
2276
2462
  readonly servicesBytes: {
2277
2463
  readonly type: "integer";
2278
2464
  readonly description: "Finalized service file storage under `{workspace}_services/`. Excludes `.tmp`.";
@@ -2764,7 +2950,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
2764
2950
  };
2765
2951
  readonly customer: {
2766
2952
  readonly nullable: true;
2767
- readonly description: "Customer associated with the task, if any.";
2953
+ readonly description: "Customer associated with the task, if any. Real-estate workspaces return the customer_real_estates lead.";
2768
2954
  readonly allOf: readonly [
2769
2955
  {
2770
2956
  readonly $ref: "#/components/schemas/Customer";
@@ -8150,7 +8336,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
8150
8336
  "Tasks"
8151
8337
  ];
8152
8338
  readonly summary: "Assign a customer to a task";
8153
- readonly description: "Assigns a customer to an existing task in the specified workspace. Requires workspace access and write access to crm::tasks resource.";
8339
+ readonly description: "Assigns a category-specific customer to an existing task in the specified workspace. Real-estate workspaces resolve the customer from customer_real_estates. Requires workspace access and write access to crm::tasks resource.";
8154
8340
  readonly security: readonly [
8155
8341
  never
8156
8342
  ];
@@ -8187,7 +8373,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
8187
8373
  };
8188
8374
  };
8189
8375
  readonly responses: {
8190
- readonly 201: {
8376
+ readonly 200: {
8191
8377
  readonly description: "Customer assigned to task successfully.";
8192
8378
  readonly content: {
8193
8379
  readonly "application/json": {
@@ -8198,7 +8384,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
8198
8384
  };
8199
8385
  };
8200
8386
  readonly 400: {
8201
- readonly description: "Invalid request payload.";
8387
+ readonly description: "Invalid request payload or unsupported workspace category.";
8202
8388
  readonly content: {
8203
8389
  readonly "application/json": {
8204
8390
  readonly schema: {
@@ -8228,7 +8414,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
8228
8414
  };
8229
8415
  };
8230
8416
  readonly 404: {
8231
- readonly description: "Customer or task not found.";
8417
+ readonly description: "Workspace, customer, or task not found.";
8232
8418
  readonly content: {
8233
8419
  readonly "application/json": {
8234
8420
  readonly schema: {
@@ -8246,7 +8432,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
8246
8432
  "Tasks"
8247
8433
  ];
8248
8434
  readonly summary: "Remove a customer from a task";
8249
- readonly description: "Removes the customer association from an existing task in the specified workspace. Requires workspace access and write access to crm::tasks resource.";
8435
+ readonly description: "Removes the customer association from an existing task in the specified workspace. Real-estate workspaces resolve the customer from customer_real_estates. Requires workspace access and write access to crm::tasks resource.";
8250
8436
  readonly security: readonly [
8251
8437
  never
8252
8438
  ];
@@ -8294,7 +8480,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
8294
8480
  };
8295
8481
  };
8296
8482
  readonly 400: {
8297
- readonly description: "Invalid request payload.";
8483
+ readonly description: "Invalid request payload or unsupported workspace category.";
8298
8484
  readonly content: {
8299
8485
  readonly "application/json": {
8300
8486
  readonly schema: {
@@ -8324,7 +8510,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
8324
8510
  };
8325
8511
  };
8326
8512
  readonly 404: {
8327
- readonly description: "Customer or task not found.";
8513
+ readonly description: "Workspace, customer, or task not found.";
8328
8514
  readonly content: {
8329
8515
  readonly "application/json": {
8330
8516
  readonly schema: {
@@ -11882,7 +12068,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
11882
12068
  "Tags"
11883
12069
  ];
11884
12070
  readonly summary: "Assign a tag to a customer";
11885
- readonly description: "Links an existing workspace tag to a customer. Requires workspace access and write access to crm::customers resource.";
12071
+ readonly description: "Links an existing workspace tag to a category-specific customer. Real-estate workspaces resolve the customer from customer_real_estates. Requires workspace access and write access to crm::customers resource.";
11886
12072
  readonly security: readonly [
11887
12073
  never
11888
12074
  ];
@@ -11930,7 +12116,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
11930
12116
  };
11931
12117
  };
11932
12118
  readonly 400: {
11933
- readonly description: "Invalid request payload.";
12119
+ readonly description: "Invalid request payload or unsupported workspace category.";
11934
12120
  readonly content: {
11935
12121
  readonly "application/json": {
11936
12122
  readonly schema: {
@@ -11960,7 +12146,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
11960
12146
  };
11961
12147
  };
11962
12148
  readonly 404: {
11963
- readonly description: "Tag not found.";
12149
+ readonly description: "Workspace, tag, or customer not found.";
11964
12150
  readonly content: {
11965
12151
  readonly "application/json": {
11966
12152
  readonly schema: {
@@ -11978,7 +12164,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
11978
12164
  "Tags"
11979
12165
  ];
11980
12166
  readonly summary: "Remove a tag from a customer";
11981
- readonly description: "Unlinks a tag from a customer. Requires workspace access and write access to crm::customers resource.";
12167
+ readonly description: "Unlinks a tag from a category-specific customer. Real-estate workspaces resolve the customer from customer_real_estates. Requires workspace access and write access to crm::customers resource.";
11982
12168
  readonly security: readonly [
11983
12169
  never
11984
12170
  ];
@@ -12026,7 +12212,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
12026
12212
  };
12027
12213
  };
12028
12214
  readonly 400: {
12029
- readonly description: "Invalid request payload.";
12215
+ readonly description: "Invalid request payload or unsupported workspace category.";
12030
12216
  readonly content: {
12031
12217
  readonly "application/json": {
12032
12218
  readonly schema: {
@@ -12056,7 +12242,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
12056
12242
  };
12057
12243
  };
12058
12244
  readonly 404: {
12059
- readonly description: "Tag not found.";
12245
+ readonly description: "Workspace, tag, or customer not found.";
12060
12246
  readonly content: {
12061
12247
  readonly "application/json": {
12062
12248
  readonly schema: {
@@ -12542,7 +12728,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
12542
12728
  "Files"
12543
12729
  ];
12544
12730
  readonly summary: "Get workspace storage usage";
12545
- readonly description: "Returns finalized storage usage broken down by workspace files (`filesBytes`), comment attachments (`commentsBytes`), and service files (`servicesBytes`), plus the combined total and plan limit. Temporary `.tmp` objects are excluded. Requires workspace access and read access to crm::files.";
12731
+ readonly description: "Returns finalized storage usage broken down by workspace files (`filesBytes`), comment attachments (`commentsBytes`), customer files (`customerBytes`), and service files (`servicesBytes`), plus the combined total and plan limit. Temporary `.tmp` objects are excluded. Requires workspace access and read access to crm::files.";
12546
12732
  readonly security: readonly [
12547
12733
  never
12548
12734
  ];
@@ -13375,13 +13561,13 @@ declare const routes: import("hono/hono-base").HonoBase<{
13375
13561
  };
13376
13562
  };
13377
13563
  };
13378
- readonly "/files/delete-comment-file": {
13564
+ readonly "/files/upload-to-customer": {
13379
13565
  readonly post: {
13380
13566
  readonly tags: readonly [
13381
13567
  "Files"
13382
13568
  ];
13383
- readonly summary: "Delete a comment attachment";
13384
- 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.";
13569
+ readonly summary: "Create presigned upload for a customer file";
13570
+ readonly description: "Returns a presigned POST for `{workspace}_customers/{customerId}/{filename}.tmp`. JPEG, PNG, WebP, and PDF files up to 15 MB are supported. The customer must belong to a real-estate workspace. Confirm the upload with `/files/confirm-customer-file`.";
13385
13571
  readonly security: readonly [
13386
13572
  never
13387
13573
  ];
@@ -13390,24 +13576,24 @@ declare const routes: import("hono/hono-base").HonoBase<{
13390
13576
  readonly content: {
13391
13577
  readonly "application/json": {
13392
13578
  readonly schema: {
13393
- readonly $ref: "#/components/schemas/DeleteCommentFileRequest";
13579
+ readonly $ref: "#/components/schemas/UploadToCustomerRequest";
13394
13580
  };
13395
13581
  };
13396
13582
  };
13397
13583
  };
13398
13584
  readonly responses: {
13399
13585
  readonly 200: {
13400
- readonly description: "Comment file deleted successfully.";
13586
+ readonly description: "Presigned customer upload created.";
13401
13587
  readonly content: {
13402
13588
  readonly "application/json": {
13403
13589
  readonly schema: {
13404
- readonly $ref: "#/components/schemas/DeleteFileSuccess";
13590
+ readonly $ref: "#/components/schemas/UploadToCustomerSuccess";
13405
13591
  };
13406
13592
  };
13407
13593
  };
13408
13594
  };
13409
13595
  readonly 400: {
13410
- readonly description: "Invalid request payload.";
13596
+ readonly description: "Invalid payload or unsupported workspace category.";
13411
13597
  readonly content: {
13412
13598
  readonly "application/json": {
13413
13599
  readonly schema: {
@@ -13416,8 +13602,8 @@ declare const routes: import("hono/hono-base").HonoBase<{
13416
13602
  };
13417
13603
  };
13418
13604
  };
13419
- readonly 401: {
13420
- readonly description: "Unauthorized - Missing or invalid access token.";
13605
+ readonly 404: {
13606
+ readonly description: "Real-estate customer not found.";
13421
13607
  readonly content: {
13422
13608
  readonly "application/json": {
13423
13609
  readonly schema: {
@@ -13426,32 +13612,46 @@ declare const routes: import("hono/hono-base").HonoBase<{
13426
13612
  };
13427
13613
  };
13428
13614
  };
13429
- readonly 403: {
13430
- readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access, or user lacks write access to crm::tasks.";
13431
- readonly content: {
13432
- readonly "application/json": {
13433
- readonly schema: {
13434
- readonly $ref: "#/components/schemas/ErrorResponse";
13435
- };
13615
+ };
13616
+ };
13617
+ };
13618
+ readonly "/files/confirm-customer-file": {
13619
+ readonly post: {
13620
+ readonly tags: readonly [
13621
+ "Files"
13622
+ ];
13623
+ readonly summary: "Confirm a customer file upload";
13624
+ readonly description: "Validates and promotes `{workspace}_customers/{customerId}/{filename}.tmp` to its finalized key. Confirmed bytes contribute to `customerBytes`.";
13625
+ readonly security: readonly [
13626
+ never
13627
+ ];
13628
+ readonly requestBody: {
13629
+ readonly required: true;
13630
+ readonly content: {
13631
+ readonly "application/json": {
13632
+ readonly schema: {
13633
+ readonly $ref: "#/components/schemas/ConfirmCustomerFileRequest";
13436
13634
  };
13437
13635
  };
13438
13636
  };
13439
- readonly 404: {
13440
- readonly description: "File not found at the given comment attachment key.";
13637
+ };
13638
+ readonly responses: {
13639
+ readonly 200: {
13640
+ readonly description: "Customer file confirmed.";
13441
13641
  readonly content: {
13442
13642
  readonly "application/json": {
13443
13643
  readonly schema: {
13444
- readonly $ref: "#/components/schemas/DeleteFileFailure";
13644
+ readonly $ref: "#/components/schemas/ConfirmFileSuccess";
13445
13645
  };
13446
13646
  };
13447
13647
  };
13448
13648
  };
13449
- readonly 500: {
13450
- readonly description: "Delete command ran but the object still exists.";
13649
+ readonly 400: {
13650
+ readonly description: "Invalid request, missing temporary object, oversized file, or invalid file type.";
13451
13651
  readonly content: {
13452
13652
  readonly "application/json": {
13453
13653
  readonly schema: {
13454
- readonly $ref: "#/components/schemas/DeleteFileFailure";
13654
+ readonly $ref: "#/components/schemas/ErrorResponse";
13455
13655
  };
13456
13656
  };
13457
13657
  };
@@ -13459,13 +13659,13 @@ declare const routes: import("hono/hono-base").HonoBase<{
13459
13659
  };
13460
13660
  };
13461
13661
  };
13462
- readonly "/files/download-from-task/{workspace}/{taskId}": {
13662
+ readonly "/files/download-from-customer/{workspace}/{customerId}": {
13463
13663
  readonly get: {
13464
13664
  readonly tags: readonly [
13465
13665
  "Files"
13466
13666
  ];
13467
- readonly summary: "List comment files for a task";
13468
- readonly description: "Lists all comment attachment objects under `{workspace}_comments/{taskId}/` and returns each with a 5-minute presigned download URL. Requires workspace access and read access to crm::tasks.";
13667
+ readonly summary: "List files for a customer";
13668
+ readonly description: "Lists finalized objects under `{workspace}_customers/{customerId}/`, each with a 5-minute presigned download URL. Requires workspace access and read access to crm::customers.";
13469
13669
  readonly security: readonly [
13470
13670
  never
13471
13671
  ];
@@ -13481,29 +13681,29 @@ declare const routes: import("hono/hono-base").HonoBase<{
13481
13681
  readonly description: "Workspace identifier.";
13482
13682
  },
13483
13683
  {
13484
- readonly name: "taskId";
13684
+ readonly name: "customerId";
13485
13685
  readonly in: "path";
13486
13686
  readonly required: true;
13487
13687
  readonly schema: {
13488
13688
  readonly type: "string";
13489
13689
  readonly format: "uuid";
13490
13690
  };
13491
- readonly description: "Task identifier whose comment attachments are listed.";
13691
+ readonly description: "Customer identifier.";
13492
13692
  }
13493
13693
  ];
13494
13694
  readonly responses: {
13495
13695
  readonly 200: {
13496
- readonly description: "Task comment files listed successfully.";
13696
+ readonly description: "Customer files listed.";
13497
13697
  readonly content: {
13498
13698
  readonly "application/json": {
13499
13699
  readonly schema: {
13500
- readonly $ref: "#/components/schemas/ListTaskCommentFilesSuccess";
13700
+ readonly $ref: "#/components/schemas/ListCustomerFilesSuccess";
13501
13701
  };
13502
13702
  };
13503
13703
  };
13504
13704
  };
13505
- readonly 400: {
13506
- readonly description: "Invalid workspace or task id.";
13705
+ readonly 403: {
13706
+ readonly description: "Workspace or customer read access is missing.";
13507
13707
  readonly content: {
13508
13708
  readonly "application/json": {
13509
13709
  readonly schema: {
@@ -13512,18 +13712,202 @@ declare const routes: import("hono/hono-base").HonoBase<{
13512
13712
  };
13513
13713
  };
13514
13714
  };
13515
- readonly 401: {
13516
- readonly description: "Unauthorized - Missing or invalid access token.";
13715
+ };
13716
+ };
13717
+ };
13718
+ readonly "/files/delete-customer-file": {
13719
+ readonly post: {
13720
+ readonly tags: readonly [
13721
+ "Files"
13722
+ ];
13723
+ readonly summary: "Delete a customer file";
13724
+ readonly description: "Deletes `{workspace}_customers/{customerId}/{filename}`. Requires workspace access, write access to crm::customers, and billing access.";
13725
+ readonly security: readonly [
13726
+ never
13727
+ ];
13728
+ readonly requestBody: {
13729
+ readonly required: true;
13730
+ readonly content: {
13731
+ readonly "application/json": {
13732
+ readonly schema: {
13733
+ readonly $ref: "#/components/schemas/DeleteCustomerFileRequest";
13734
+ };
13735
+ };
13736
+ };
13737
+ };
13738
+ readonly responses: {
13739
+ readonly 200: {
13740
+ readonly description: "Customer file deleted.";
13517
13741
  readonly content: {
13518
13742
  readonly "application/json": {
13519
13743
  readonly schema: {
13520
- readonly $ref: "#/components/schemas/ErrorResponse";
13744
+ readonly $ref: "#/components/schemas/DeleteFileSuccess";
13521
13745
  };
13522
13746
  };
13523
13747
  };
13524
13748
  };
13525
- readonly 403: {
13526
- readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access, or user lacks read access to crm::tasks.";
13749
+ readonly 404: {
13750
+ readonly description: "File not found.";
13751
+ readonly content: {
13752
+ readonly "application/json": {
13753
+ readonly schema: {
13754
+ readonly $ref: "#/components/schemas/DeleteFileFailure";
13755
+ };
13756
+ };
13757
+ };
13758
+ };
13759
+ };
13760
+ };
13761
+ };
13762
+ readonly "/files/delete-comment-file": {
13763
+ readonly post: {
13764
+ readonly tags: readonly [
13765
+ "Files"
13766
+ ];
13767
+ readonly summary: "Delete a comment attachment";
13768
+ 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.";
13769
+ readonly security: readonly [
13770
+ never
13771
+ ];
13772
+ readonly requestBody: {
13773
+ readonly required: true;
13774
+ readonly content: {
13775
+ readonly "application/json": {
13776
+ readonly schema: {
13777
+ readonly $ref: "#/components/schemas/DeleteCommentFileRequest";
13778
+ };
13779
+ };
13780
+ };
13781
+ };
13782
+ readonly responses: {
13783
+ readonly 200: {
13784
+ readonly description: "Comment file deleted successfully.";
13785
+ readonly content: {
13786
+ readonly "application/json": {
13787
+ readonly schema: {
13788
+ readonly $ref: "#/components/schemas/DeleteFileSuccess";
13789
+ };
13790
+ };
13791
+ };
13792
+ };
13793
+ readonly 400: {
13794
+ readonly description: "Invalid request payload.";
13795
+ readonly content: {
13796
+ readonly "application/json": {
13797
+ readonly schema: {
13798
+ readonly $ref: "#/components/schemas/ErrorResponse";
13799
+ };
13800
+ };
13801
+ };
13802
+ };
13803
+ readonly 401: {
13804
+ readonly description: "Unauthorized - Missing or invalid access token.";
13805
+ readonly content: {
13806
+ readonly "application/json": {
13807
+ readonly schema: {
13808
+ readonly $ref: "#/components/schemas/ErrorResponse";
13809
+ };
13810
+ };
13811
+ };
13812
+ };
13813
+ readonly 403: {
13814
+ readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access, or user lacks write access to crm::tasks.";
13815
+ readonly content: {
13816
+ readonly "application/json": {
13817
+ readonly schema: {
13818
+ readonly $ref: "#/components/schemas/ErrorResponse";
13819
+ };
13820
+ };
13821
+ };
13822
+ };
13823
+ readonly 404: {
13824
+ readonly description: "File not found at the given comment attachment key.";
13825
+ readonly content: {
13826
+ readonly "application/json": {
13827
+ readonly schema: {
13828
+ readonly $ref: "#/components/schemas/DeleteFileFailure";
13829
+ };
13830
+ };
13831
+ };
13832
+ };
13833
+ readonly 500: {
13834
+ readonly description: "Delete command ran but the object still exists.";
13835
+ readonly content: {
13836
+ readonly "application/json": {
13837
+ readonly schema: {
13838
+ readonly $ref: "#/components/schemas/DeleteFileFailure";
13839
+ };
13840
+ };
13841
+ };
13842
+ };
13843
+ };
13844
+ };
13845
+ };
13846
+ readonly "/files/download-from-task/{workspace}/{taskId}": {
13847
+ readonly get: {
13848
+ readonly tags: readonly [
13849
+ "Files"
13850
+ ];
13851
+ readonly summary: "List comment files for a task";
13852
+ readonly description: "Lists all comment attachment objects under `{workspace}_comments/{taskId}/` and returns each with a 5-minute presigned download URL. Requires workspace access and read access to crm::tasks.";
13853
+ readonly security: readonly [
13854
+ never
13855
+ ];
13856
+ readonly parameters: readonly [
13857
+ {
13858
+ readonly name: "workspace";
13859
+ readonly in: "path";
13860
+ readonly required: true;
13861
+ readonly schema: {
13862
+ readonly type: "string";
13863
+ readonly format: "uuid";
13864
+ };
13865
+ readonly description: "Workspace identifier.";
13866
+ },
13867
+ {
13868
+ readonly name: "taskId";
13869
+ readonly in: "path";
13870
+ readonly required: true;
13871
+ readonly schema: {
13872
+ readonly type: "string";
13873
+ readonly format: "uuid";
13874
+ };
13875
+ readonly description: "Task identifier whose comment attachments are listed.";
13876
+ }
13877
+ ];
13878
+ readonly responses: {
13879
+ readonly 200: {
13880
+ readonly description: "Task comment files listed successfully.";
13881
+ readonly content: {
13882
+ readonly "application/json": {
13883
+ readonly schema: {
13884
+ readonly $ref: "#/components/schemas/ListTaskCommentFilesSuccess";
13885
+ };
13886
+ };
13887
+ };
13888
+ };
13889
+ readonly 400: {
13890
+ readonly description: "Invalid workspace or task id.";
13891
+ readonly content: {
13892
+ readonly "application/json": {
13893
+ readonly schema: {
13894
+ readonly $ref: "#/components/schemas/ErrorResponse";
13895
+ };
13896
+ };
13897
+ };
13898
+ };
13899
+ readonly 401: {
13900
+ readonly description: "Unauthorized - Missing or invalid access token.";
13901
+ readonly content: {
13902
+ readonly "application/json": {
13903
+ readonly schema: {
13904
+ readonly $ref: "#/components/schemas/ErrorResponse";
13905
+ };
13906
+ };
13907
+ };
13908
+ };
13909
+ readonly 403: {
13910
+ readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access, or user lacks read access to crm::tasks.";
13527
13911
  readonly content: {
13528
13912
  readonly "application/json": {
13529
13913
  readonly schema: {
@@ -15596,11 +15980,38 @@ declare const routes: import("hono/hono-base").HonoBase<{
15596
15980
  profilePicture: string | null;
15597
15981
  }[];
15598
15982
  customer: {
15983
+ updated_at: string | null;
15984
+ deleted_at: string | null;
15985
+ verified_at: string | null;
15986
+ suspended_at: string | null;
15987
+ created_at: string;
15599
15988
  id: string;
15989
+ workspaceId: string;
15990
+ type: string | null;
15600
15991
  name: string;
15601
- email: string | null;
15992
+ companyName: string | null;
15602
15993
  phone: string | null;
15603
- address: string | null;
15994
+ telegram: string | null;
15995
+ whatsapp: string | null;
15996
+ email: string | null;
15997
+ leadSource: string | null;
15998
+ budgetMin: number | null;
15999
+ budgetMax: number | null;
16000
+ inHandBudget: number | null;
16001
+ installmentBudget: number | null;
16002
+ minArea: number | null;
16003
+ maxArea: number | null;
16004
+ roomsCount: number | null;
16005
+ preferredDistricts: string[] | null;
16006
+ propertyType: string | null;
16007
+ maxMetroDistance: number | null;
16008
+ dealStatus: string | null;
16009
+ preferredPaymentMethod: string | null;
16010
+ childrenCount: number | null;
16011
+ hasPets: boolean | null;
16012
+ carsCount: number | null;
16013
+ birthDate: string | null;
16014
+ notes: string | null;
15604
16015
  }[];
15605
16016
  };
15606
16017
  outputFormat: "json";
@@ -15656,25 +16067,25 @@ declare const routes: import("hono/hono-base").HonoBase<{
15656
16067
  input: {};
15657
16068
  output: {
15658
16069
  success: false;
15659
- error: never;
16070
+ error: string;
15660
16071
  };
15661
16072
  outputFormat: "json";
15662
- status: 400;
16073
+ status: 404;
15663
16074
  } | {
15664
16075
  input: {};
15665
16076
  output: {
15666
- success: false;
15667
- error: string;
16077
+ success: true;
15668
16078
  };
15669
16079
  outputFormat: "json";
15670
- status: 404;
16080
+ status: 200;
15671
16081
  } | {
15672
16082
  input: {};
15673
16083
  output: {
15674
- success: true;
16084
+ success: false;
16085
+ error: string;
15675
16086
  };
15676
16087
  outputFormat: "json";
15677
- status: 201;
16088
+ status: 400;
15678
16089
  };
15679
16090
  };
15680
16091
  } & {
@@ -15683,25 +16094,25 @@ declare const routes: import("hono/hono-base").HonoBase<{
15683
16094
  input: {};
15684
16095
  output: {
15685
16096
  success: false;
15686
- error: never;
16097
+ error: string;
15687
16098
  };
15688
16099
  outputFormat: "json";
15689
- status: 400;
16100
+ status: 404;
15690
16101
  } | {
15691
16102
  input: {};
15692
16103
  output: {
15693
- success: false;
15694
- error: string;
16104
+ success: true;
15695
16105
  };
15696
16106
  outputFormat: "json";
15697
- status: 404;
16107
+ status: 200;
15698
16108
  } | {
15699
16109
  input: {};
15700
16110
  output: {
15701
- success: true;
16111
+ success: false;
16112
+ error: string;
15702
16113
  };
15703
16114
  outputFormat: "json";
15704
- status: 200;
16115
+ status: 400;
15705
16116
  };
15706
16117
  };
15707
16118
  }, "/tasks"> | import("hono/types").MergeSchemaPath<{
@@ -16203,7 +16614,6 @@ declare const routes: import("hono/hono-base").HonoBase<{
16203
16614
  verified_at: string | null;
16204
16615
  suspended_at: string | null;
16205
16616
  phone: string | null;
16206
- birthDate: string | null;
16207
16617
  telegram: string | null;
16208
16618
  whatsapp: string | null;
16209
16619
  leadSource: string | null;
@@ -16222,6 +16632,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
16222
16632
  childrenCount: number | null;
16223
16633
  hasPets: boolean | null;
16224
16634
  carsCount: number | null;
16635
+ birthDate: string | null;
16225
16636
  notes: string | null;
16226
16637
  }[];
16227
16638
  };
@@ -16394,18 +16805,18 @@ declare const routes: import("hono/hono-base").HonoBase<{
16394
16805
  } | {
16395
16806
  input: {};
16396
16807
  output: {
16397
- success: true;
16808
+ success: false;
16809
+ error: string;
16398
16810
  };
16399
16811
  outputFormat: "json";
16400
- status: 200;
16812
+ status: 400;
16401
16813
  } | {
16402
16814
  input: {};
16403
16815
  output: {
16404
- success: false;
16405
- error: string;
16816
+ success: true;
16406
16817
  };
16407
16818
  outputFormat: "json";
16408
- status: 400;
16819
+ status: 200;
16409
16820
  };
16410
16821
  };
16411
16822
  } & {
@@ -17010,25 +17421,25 @@ declare const routes: import("hono/hono-base").HonoBase<{
17010
17421
  input: {};
17011
17422
  output: {
17012
17423
  success: false;
17013
- error: never;
17424
+ error: string;
17014
17425
  };
17015
17426
  outputFormat: "json";
17016
- status: 400;
17427
+ status: 404;
17017
17428
  } | {
17018
17429
  input: {};
17019
17430
  output: {
17020
- success: false;
17021
- error: string;
17431
+ success: true;
17022
17432
  };
17023
17433
  outputFormat: "json";
17024
- status: 404;
17434
+ status: 200;
17025
17435
  } | {
17026
17436
  input: {};
17027
17437
  output: {
17028
- success: true;
17438
+ success: false;
17439
+ error: string;
17029
17440
  };
17030
17441
  outputFormat: "json";
17031
- status: 200;
17442
+ status: 400;
17032
17443
  };
17033
17444
  };
17034
17445
  } & {
@@ -17037,25 +17448,25 @@ declare const routes: import("hono/hono-base").HonoBase<{
17037
17448
  input: {};
17038
17449
  output: {
17039
17450
  success: false;
17040
- error: never;
17451
+ error: string;
17041
17452
  };
17042
17453
  outputFormat: "json";
17043
- status: 400;
17454
+ status: 404;
17044
17455
  } | {
17045
17456
  input: {};
17046
17457
  output: {
17047
- success: false;
17048
- error: string;
17458
+ success: true;
17049
17459
  };
17050
17460
  outputFormat: "json";
17051
- status: 404;
17461
+ status: 200;
17052
17462
  } | {
17053
17463
  input: {};
17054
17464
  output: {
17055
- success: true;
17465
+ success: false;
17466
+ error: string;
17056
17467
  };
17057
17468
  outputFormat: "json";
17058
- status: 200;
17469
+ status: 400;
17059
17470
  };
17060
17471
  };
17061
17472
  } & {
@@ -20377,6 +20788,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
20377
20788
  usedBytes: number;
20378
20789
  filesBytes: number;
20379
20790
  commentsBytes: number;
20791
+ customerBytes: number;
20380
20792
  servicesBytes: number;
20381
20793
  limitBytes: number | null;
20382
20794
  };
@@ -20908,6 +21320,122 @@ declare const routes: import("hono/hono-base").HonoBase<{
20908
21320
  status: import("hono/utils/http-status").ContentfulStatusCode;
20909
21321
  };
20910
21322
  };
21323
+ } & {
21324
+ "/upload-to-customer": {
21325
+ $post: {
21326
+ input: {};
21327
+ output: {
21328
+ success: false;
21329
+ error: string;
21330
+ };
21331
+ outputFormat: "json";
21332
+ status: 404;
21333
+ } | {
21334
+ input: {};
21335
+ output: {
21336
+ success: false;
21337
+ error: string;
21338
+ };
21339
+ outputFormat: "json";
21340
+ status: 400;
21341
+ } | {
21342
+ input: {};
21343
+ output: {
21344
+ success: true;
21345
+ url: string;
21346
+ fields: {
21347
+ [x: string]: string;
21348
+ };
21349
+ key: string;
21350
+ maxSize: number;
21351
+ };
21352
+ outputFormat: "json";
21353
+ status: import("hono/utils/http-status").ContentfulStatusCode;
21354
+ };
21355
+ };
21356
+ } & {
21357
+ "/confirm-customer-file": {
21358
+ $post: {
21359
+ input: {};
21360
+ output: {
21361
+ success: true;
21362
+ key: string;
21363
+ };
21364
+ outputFormat: "json";
21365
+ status: import("hono/utils/http-status").ContentfulStatusCode;
21366
+ } | {
21367
+ input: {};
21368
+ output: {
21369
+ success: false;
21370
+ error: string;
21371
+ };
21372
+ outputFormat: "json";
21373
+ status: 400;
21374
+ };
21375
+ };
21376
+ } & {
21377
+ "/download-from-customer/:workspace/:customerId": {
21378
+ $get: {
21379
+ input: {
21380
+ param: {
21381
+ workspace: string;
21382
+ } & {
21383
+ customerId: string;
21384
+ };
21385
+ };
21386
+ output: {
21387
+ success: true;
21388
+ files: {
21389
+ key: string;
21390
+ filename: string;
21391
+ size: number;
21392
+ lastModified: string | null;
21393
+ downloadUrl: string;
21394
+ }[];
21395
+ };
21396
+ outputFormat: "json";
21397
+ status: import("hono/utils/http-status").ContentfulStatusCode;
21398
+ };
21399
+ };
21400
+ } & {
21401
+ "/delete-customer-file": {
21402
+ $post: {
21403
+ input: {};
21404
+ output: {
21405
+ success: false;
21406
+ error: never;
21407
+ };
21408
+ outputFormat: "json";
21409
+ status: 400;
21410
+ } | {
21411
+ input: {};
21412
+ output: {
21413
+ success: false;
21414
+ message: string;
21415
+ key: string;
21416
+ };
21417
+ outputFormat: "json";
21418
+ status: 404;
21419
+ } | {
21420
+ input: {};
21421
+ output: {
21422
+ success: false;
21423
+ message: string;
21424
+ key: string;
21425
+ };
21426
+ outputFormat: "json";
21427
+ status: 500;
21428
+ } | {
21429
+ input: {};
21430
+ output: {
21431
+ success: true;
21432
+ message: string;
21433
+ key: string;
21434
+ };
21435
+ outputFormat: "json";
21436
+ status: import("hono/utils/http-status").ContentfulStatusCode;
21437
+ };
21438
+ };
20911
21439
  }, "/files"> | import("hono/types").MergeSchemaPath<{
20912
21440
  "/start": {
20913
21441
  $post: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mestra-dev/contract",
3
- "version": "0.0.99",
3
+ "version": "0.0.101",
4
4
  "description": "Types-only Hono AppType contract for the Mestra auth API",
5
5
  "type": "module",
6
6
  "sideEffects": false,