@mestra-dev/contract 0.0.209 → 0.0.210

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 +1601 -216
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { JwtVariables } from 'hono/jwt';
3
3
 
4
4
  type GrowthDirection = "positive" | "negative" | "none";
5
5
  type FinanceCurrency = "ruble" | "dollar" | "euro";
6
+ type FinanceTransactionType = "refund" | "income" | "expense" | "transfer";
6
7
  type Variables = JwtVariables;
7
8
  /** Shared error body for middleware / HTTPException responses (typed into AppType). */
8
9
  export type ApiError = {
@@ -116,7 +117,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
116
117
  },
117
118
  {
118
119
  readonly name: "Files";
119
- readonly description: "S3 file upload (presigned POST to a temporary `.tmp` key), confirm (magic-byte validation then promote to final key), optional nested folder destination under `{workspace}/folders/{path}/`, profile and workspace picture upload/confirm/delete, comment attachment upload/confirm, list task comment files with download URLs, service file upload/confirm/delete, list service files with download URLs, folder create/delete (nested paths), list (includes pin metadata; excludes `.tmp` objects), storage usage, pin/unpin, download by relative path, move, 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; service files require crm::services write/read.";
120
+ readonly description: "S3 file upload (presigned POST to a temporary `.tmp` key), confirm (magic-byte validation then promote to final key), optional nested folder destination under `{workspace}/folders/{path}/`, profile and workspace picture upload/confirm/delete, comment attachment upload/confirm, list task comment files with download URLs, service file upload/confirm/delete, list service files with download URLs, customer file upload/confirm/delete, finance receipt upload/confirm/delete, folder create/delete (nested paths), list (includes pin metadata; excludes `.tmp` objects), storage usage, pin/unpin, download by relative path, move, 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; service files require crm::services write/read; customer files require crm::customers write/read; finance receipts require crm::finance write/read.";
120
121
  },
121
122
  {
122
123
  readonly name: "Chat";
@@ -128,7 +129,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
128
129
  },
129
130
  {
130
131
  readonly name: "Finance";
131
- readonly description: "Workspace finance accounts (ordered cards with name, color, currency, and opening balance) and a numbers-visibility toggle for the default finance view. Requires workspace access and crm::finance read or write.";
132
+ readonly description: "Workspace finance accounts (ordered cards with name, color, currency, and opening balance), ledger transactions (income, expense, refund, transfer), and a numbers-visibility toggle for the default finance view. Requires workspace access and crm::finance read or write.";
132
133
  }
133
134
  ];
134
135
  readonly components: {
@@ -2377,6 +2378,186 @@ declare const routes: import("hono/hono-base").HonoBase<{
2377
2378
  };
2378
2379
  };
2379
2380
  };
2381
+ readonly UploadToFinanceRequest: {
2382
+ readonly type: "object";
2383
+ readonly required: readonly [
2384
+ "filename",
2385
+ "contentType",
2386
+ "contentLength",
2387
+ "workspace",
2388
+ "transactionId"
2389
+ ];
2390
+ readonly properties: {
2391
+ readonly filename: {
2392
+ readonly type: "string";
2393
+ readonly minLength: 1;
2394
+ readonly maxLength: 200;
2395
+ readonly description: "Safe file name (no path separators, not `.tmp`).";
2396
+ readonly example: "receipt.pdf";
2397
+ };
2398
+ readonly contentType: {
2399
+ readonly $ref: "#/components/schemas/FileContentType";
2400
+ };
2401
+ readonly contentLength: {
2402
+ readonly type: "integer";
2403
+ readonly minimum: 1;
2404
+ readonly maximum: 15728640;
2405
+ readonly description: "Exact file byte length.";
2406
+ };
2407
+ readonly workspace: {
2408
+ readonly type: "string";
2409
+ readonly format: "uuid";
2410
+ readonly description: "Workspace identifier.";
2411
+ };
2412
+ readonly transactionId: {
2413
+ readonly type: "string";
2414
+ readonly format: "uuid";
2415
+ readonly description: "Finance transaction the receipt is attached to.";
2416
+ };
2417
+ };
2418
+ };
2419
+ readonly UploadToFinanceSuccess: {
2420
+ readonly type: "object";
2421
+ readonly required: readonly [
2422
+ "success",
2423
+ "url",
2424
+ "fields",
2425
+ "key",
2426
+ "maxSize"
2427
+ ];
2428
+ readonly properties: {
2429
+ readonly success: {
2430
+ readonly type: "boolean";
2431
+ readonly const: true;
2432
+ };
2433
+ readonly url: {
2434
+ readonly type: "string";
2435
+ readonly description: "S3 presigned POST URL.";
2436
+ };
2437
+ readonly fields: {
2438
+ readonly type: "object";
2439
+ readonly additionalProperties: {
2440
+ readonly type: "string";
2441
+ };
2442
+ readonly description: "Form fields to include in the multipart upload POST.";
2443
+ };
2444
+ readonly key: {
2445
+ readonly type: "string";
2446
+ readonly description: "Temporary S3 object key (`{workspace}_finance/{transactionId}/{filename}.tmp`).";
2447
+ };
2448
+ readonly maxSize: {
2449
+ readonly type: "integer";
2450
+ readonly description: "Exact requested upload size in bytes.";
2451
+ };
2452
+ };
2453
+ };
2454
+ readonly ConfirmFinanceFileRequest: {
2455
+ readonly type: "object";
2456
+ readonly required: readonly [
2457
+ "filename",
2458
+ "workspace",
2459
+ "transactionId"
2460
+ ];
2461
+ readonly properties: {
2462
+ readonly filename: {
2463
+ readonly type: "string";
2464
+ readonly minLength: 1;
2465
+ readonly maxLength: 200;
2466
+ readonly description: "Original file name used for `/files/upload-to-finance`.";
2467
+ readonly example: "receipt.pdf";
2468
+ };
2469
+ readonly workspace: {
2470
+ readonly type: "string";
2471
+ readonly format: "uuid";
2472
+ readonly description: "Workspace identifier.";
2473
+ };
2474
+ readonly transactionId: {
2475
+ readonly type: "string";
2476
+ readonly format: "uuid";
2477
+ readonly description: "Finance transaction the receipt is attached to.";
2478
+ };
2479
+ };
2480
+ };
2481
+ readonly DeleteFinanceFileRequest: {
2482
+ readonly type: "object";
2483
+ readonly required: readonly [
2484
+ "filename",
2485
+ "workspace",
2486
+ "transactionId"
2487
+ ];
2488
+ readonly properties: {
2489
+ readonly filename: {
2490
+ readonly type: "string";
2491
+ readonly minLength: 1;
2492
+ readonly maxLength: 200;
2493
+ readonly description: "Safe file name (no path separators, not `.tmp`).";
2494
+ readonly example: "receipt.pdf";
2495
+ };
2496
+ readonly workspace: {
2497
+ readonly type: "string";
2498
+ readonly format: "uuid";
2499
+ readonly description: "Workspace identifier.";
2500
+ };
2501
+ readonly transactionId: {
2502
+ readonly type: "string";
2503
+ readonly format: "uuid";
2504
+ readonly description: "Finance transaction the receipt is attached to.";
2505
+ };
2506
+ };
2507
+ };
2508
+ readonly FinanceFile: {
2509
+ readonly type: "object";
2510
+ readonly required: readonly [
2511
+ "key",
2512
+ "filename",
2513
+ "size",
2514
+ "downloadUrl"
2515
+ ];
2516
+ readonly properties: {
2517
+ readonly key: {
2518
+ readonly type: "string";
2519
+ readonly description: "Full S3 object key (`{workspace}_finance/{transactionId}/{filename}`).";
2520
+ };
2521
+ readonly filename: {
2522
+ readonly type: "string";
2523
+ readonly description: "File name under `{workspace}_finance/{transactionId}/`.";
2524
+ };
2525
+ readonly size: {
2526
+ readonly type: "integer";
2527
+ readonly description: "Object size in bytes.";
2528
+ };
2529
+ readonly lastModified: {
2530
+ readonly type: "string";
2531
+ readonly format: "date-time";
2532
+ readonly nullable: true;
2533
+ readonly description: "Last modified timestamp from S3 (ISO string).";
2534
+ };
2535
+ readonly downloadUrl: {
2536
+ readonly type: "string";
2537
+ readonly description: "Presigned GET URL (5-minute expiry).";
2538
+ };
2539
+ };
2540
+ };
2541
+ readonly ListFinanceFilesSuccess: {
2542
+ readonly type: "object";
2543
+ readonly required: readonly [
2544
+ "success",
2545
+ "files"
2546
+ ];
2547
+ readonly properties: {
2548
+ readonly success: {
2549
+ readonly type: "boolean";
2550
+ readonly const: true;
2551
+ };
2552
+ readonly files: {
2553
+ readonly type: "array";
2554
+ readonly items: {
2555
+ readonly $ref: "#/components/schemas/FinanceFile";
2556
+ };
2557
+ readonly description: "All non-prefix, non-`.tmp` objects under `{workspace}_finance/{transactionId}/`.";
2558
+ };
2559
+ };
2560
+ };
2380
2561
  readonly UploadProfilePictureRequest: {
2381
2562
  readonly type: "object";
2382
2563
  readonly required: readonly [
@@ -2637,6 +2818,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
2637
2818
  "commentsBytes",
2638
2819
  "customerBytes",
2639
2820
  "servicesBytes",
2821
+ "financeBytes",
2640
2822
  "limitBytes"
2641
2823
  ];
2642
2824
  readonly properties: {
@@ -2646,7 +2828,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
2646
2828
  };
2647
2829
  readonly usedBytes: {
2648
2830
  readonly type: "integer";
2649
- readonly description: "Total finalized storage in bytes (`filesBytes` + `commentsBytes` + `customerBytes` + `servicesBytes`). Excludes `.tmp` objects.";
2831
+ readonly description: "Total finalized storage in bytes (`filesBytes` + `commentsBytes` + `customerBytes` + `servicesBytes` + `financeBytes`). Excludes `.tmp` objects.";
2650
2832
  readonly example: 348320;
2651
2833
  };
2652
2834
  readonly filesBytes: {
@@ -2669,6 +2851,11 @@ declare const routes: import("hono/hono-base").HonoBase<{
2669
2851
  readonly description: "Finalized service file storage under `{workspace}_services/`. Excludes `.tmp`.";
2670
2852
  readonly example: 50000;
2671
2853
  };
2854
+ readonly financeBytes: {
2855
+ readonly type: "integer";
2856
+ readonly description: "Finalized finance receipt storage under `{workspace}_finance/`. Excludes `.tmp`.";
2857
+ readonly example: 25000;
2858
+ };
2672
2859
  readonly limitBytes: {
2673
2860
  readonly type: "integer";
2674
2861
  readonly nullable: true;
@@ -5907,87 +6094,212 @@ declare const routes: import("hono/hono-base").HonoBase<{
5907
6094
  };
5908
6095
  };
5909
6096
  };
5910
- };
5911
- };
5912
- readonly paths: {
5913
- readonly "/health": {
5914
- readonly get: {
5915
- readonly tags: readonly [
5916
- "System"
6097
+ readonly FinanceTransaction: {
6098
+ readonly type: "object";
6099
+ readonly required: readonly [
6100
+ "id",
6101
+ "workspaceId",
6102
+ "type",
6103
+ "amount",
6104
+ "date",
6105
+ "created_at"
5917
6106
  ];
5918
- readonly summary: "Service health check";
5919
- readonly responses: {
5920
- readonly 200: {
5921
- readonly description: "Service is healthy";
5922
- readonly content: {
5923
- readonly "application/json": {
5924
- readonly schema: {
5925
- readonly type: "object";
5926
- readonly required: readonly [
5927
- "status"
5928
- ];
5929
- readonly properties: {
5930
- readonly status: {
5931
- readonly type: "string";
5932
- readonly example: "ok";
5933
- };
5934
- };
5935
- };
5936
- };
5937
- };
6107
+ readonly properties: {
6108
+ readonly id: {
6109
+ readonly type: "string";
6110
+ readonly format: "uuid";
5938
6111
  };
5939
- };
5940
- };
5941
- };
5942
- readonly "/auth/vk": {
5943
- readonly get: {
5944
- readonly tags: readonly [
5945
- "Auth"
5946
- ];
5947
- readonly summary: "Start VK ID OAuth";
5948
- readonly description: "Redirects the browser to VK ID authorization. A PKCE code verifier is stored in Redis under the returned state parameter.";
5949
- readonly responses: {
5950
- readonly 302: {
5951
- readonly description: "Redirect to VK ID authorize URL.";
5952
- readonly headers: {
5953
- readonly Location: {
5954
- readonly schema: {
5955
- readonly type: "string";
5956
- };
5957
- readonly description: "VK ID authorization URL.";
5958
- };
5959
- };
6112
+ readonly workspaceId: {
6113
+ readonly type: "string";
6114
+ readonly format: "uuid";
5960
6115
  };
5961
- readonly 429: {
5962
- readonly description: "Too Many Requests - Rate limit exceeded.";
5963
- readonly content: {
5964
- readonly "application/json": {
5965
- readonly schema: {
5966
- readonly $ref: "#/components/schemas/ErrorResponse";
5967
- };
5968
- };
5969
- };
6116
+ readonly type: {
6117
+ readonly type: "string";
6118
+ readonly enum: readonly [
6119
+ "refund",
6120
+ "income",
6121
+ "expense",
6122
+ "transfer"
6123
+ ];
5970
6124
  };
5971
- };
5972
- };
5973
- };
5974
- readonly "/auth/vk/callback": {
5975
- readonly get: {
5976
- readonly tags: readonly [
5977
- "Auth"
5978
- ];
5979
- readonly summary: "VK ID OAuth callback";
5980
- readonly description: "Completes VK ID login; on success sets access (15 min) and refresh (7 days) cookies and redirects to the web app.";
5981
- readonly parameters: readonly [
5982
- {
5983
- readonly name: "code";
5984
- readonly in: "query";
5985
- readonly required: true;
5986
- readonly schema: {
5987
- readonly type: "string";
5988
- };
5989
- readonly description: "Authorization code from VK ID.";
5990
- },
6125
+ readonly customerId: {
6126
+ readonly type: "string";
6127
+ readonly format: "uuid";
6128
+ readonly nullable: true;
6129
+ };
6130
+ readonly serviceId: {
6131
+ readonly type: "string";
6132
+ readonly format: "uuid";
6133
+ readonly nullable: true;
6134
+ };
6135
+ readonly accountId: {
6136
+ readonly type: "string";
6137
+ readonly format: "uuid";
6138
+ readonly nullable: true;
6139
+ readonly description: "Source account. Required for transfers.";
6140
+ };
6141
+ readonly destinationAccountId: {
6142
+ readonly type: "string";
6143
+ readonly format: "uuid";
6144
+ readonly nullable: true;
6145
+ readonly description: "Destination account. Required for transfers; omitted for other types.";
6146
+ };
6147
+ readonly paymentMethod: {
6148
+ readonly type: "string";
6149
+ readonly nullable: true;
6150
+ };
6151
+ readonly amount: {
6152
+ readonly type: "number";
6153
+ readonly minimum: 0.01;
6154
+ readonly description: "Positive amount. Direction is implied by type.";
6155
+ };
6156
+ readonly description: {
6157
+ readonly type: "string";
6158
+ readonly nullable: true;
6159
+ };
6160
+ readonly date: {
6161
+ readonly type: "string";
6162
+ readonly format: "date-time";
6163
+ readonly description: "Transaction date; defaults to now on create when omitted.";
6164
+ };
6165
+ readonly vat: {
6166
+ readonly type: "integer";
6167
+ readonly nullable: true;
6168
+ readonly minimum: 0;
6169
+ readonly maximum: 100;
6170
+ readonly description: "VAT rate 0-100.";
6171
+ };
6172
+ readonly reason: {
6173
+ readonly type: "string";
6174
+ readonly nullable: true;
6175
+ };
6176
+ readonly created_at: {
6177
+ readonly type: "string";
6178
+ readonly format: "date-time";
6179
+ };
6180
+ readonly updated_at: {
6181
+ readonly type: "string";
6182
+ readonly format: "date-time";
6183
+ readonly nullable: true;
6184
+ };
6185
+ };
6186
+ };
6187
+ readonly FinanceTransactionSuccess: {
6188
+ readonly type: "object";
6189
+ readonly required: readonly [
6190
+ "success",
6191
+ "transaction"
6192
+ ];
6193
+ readonly properties: {
6194
+ readonly success: {
6195
+ readonly type: "boolean";
6196
+ readonly const: true;
6197
+ };
6198
+ readonly transaction: {
6199
+ readonly $ref: "#/components/schemas/FinanceTransaction";
6200
+ };
6201
+ };
6202
+ };
6203
+ readonly ListFinanceTransactionsSuccess: {
6204
+ readonly type: "object";
6205
+ readonly required: readonly [
6206
+ "success",
6207
+ "transactions"
6208
+ ];
6209
+ readonly properties: {
6210
+ readonly success: {
6211
+ readonly type: "boolean";
6212
+ readonly const: true;
6213
+ };
6214
+ readonly transactions: {
6215
+ readonly type: "array";
6216
+ readonly items: {
6217
+ readonly $ref: "#/components/schemas/FinanceTransaction";
6218
+ };
6219
+ };
6220
+ };
6221
+ };
6222
+ };
6223
+ };
6224
+ readonly paths: {
6225
+ readonly "/health": {
6226
+ readonly get: {
6227
+ readonly tags: readonly [
6228
+ "System"
6229
+ ];
6230
+ readonly summary: "Service health check";
6231
+ readonly responses: {
6232
+ readonly 200: {
6233
+ readonly description: "Service is healthy";
6234
+ readonly content: {
6235
+ readonly "application/json": {
6236
+ readonly schema: {
6237
+ readonly type: "object";
6238
+ readonly required: readonly [
6239
+ "status"
6240
+ ];
6241
+ readonly properties: {
6242
+ readonly status: {
6243
+ readonly type: "string";
6244
+ readonly example: "ok";
6245
+ };
6246
+ };
6247
+ };
6248
+ };
6249
+ };
6250
+ };
6251
+ };
6252
+ };
6253
+ };
6254
+ readonly "/auth/vk": {
6255
+ readonly get: {
6256
+ readonly tags: readonly [
6257
+ "Auth"
6258
+ ];
6259
+ readonly summary: "Start VK ID OAuth";
6260
+ readonly description: "Redirects the browser to VK ID authorization. A PKCE code verifier is stored in Redis under the returned state parameter.";
6261
+ readonly responses: {
6262
+ readonly 302: {
6263
+ readonly description: "Redirect to VK ID authorize URL.";
6264
+ readonly headers: {
6265
+ readonly Location: {
6266
+ readonly schema: {
6267
+ readonly type: "string";
6268
+ };
6269
+ readonly description: "VK ID authorization URL.";
6270
+ };
6271
+ };
6272
+ };
6273
+ readonly 429: {
6274
+ readonly description: "Too Many Requests - Rate limit exceeded.";
6275
+ readonly content: {
6276
+ readonly "application/json": {
6277
+ readonly schema: {
6278
+ readonly $ref: "#/components/schemas/ErrorResponse";
6279
+ };
6280
+ };
6281
+ };
6282
+ };
6283
+ };
6284
+ };
6285
+ };
6286
+ readonly "/auth/vk/callback": {
6287
+ readonly get: {
6288
+ readonly tags: readonly [
6289
+ "Auth"
6290
+ ];
6291
+ readonly summary: "VK ID OAuth callback";
6292
+ readonly description: "Completes VK ID login; on success sets access (15 min) and refresh (7 days) cookies and redirects to the web app.";
6293
+ readonly parameters: readonly [
6294
+ {
6295
+ readonly name: "code";
6296
+ readonly in: "query";
6297
+ readonly required: true;
6298
+ readonly schema: {
6299
+ readonly type: "string";
6300
+ };
6301
+ readonly description: "Authorization code from VK ID.";
6302
+ },
5991
6303
  {
5992
6304
  readonly name: "state";
5993
6305
  readonly in: "query";
@@ -17566,7 +17878,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
17566
17878
  "Files"
17567
17879
  ];
17568
17880
  readonly summary: "Get workspace storage usage";
17569
- 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.";
17881
+ readonly description: "Returns finalized storage usage broken down by workspace files (`filesBytes`), comment attachments (`commentsBytes`), customer files (`customerBytes`), service files (`servicesBytes`), and finance receipts (`financeBytes`), plus the combined total and plan limit. Temporary `.tmp` objects are excluded. Requires workspace access and read access to crm::files.";
17570
17882
  readonly security: readonly [
17571
17883
  never
17572
17884
  ];
@@ -18597,13 +18909,13 @@ declare const routes: import("hono/hono-base").HonoBase<{
18597
18909
  };
18598
18910
  };
18599
18911
  };
18600
- readonly "/files/delete-comment-file": {
18912
+ readonly "/files/upload-to-finance": {
18601
18913
  readonly post: {
18602
18914
  readonly tags: readonly [
18603
18915
  "Files"
18604
18916
  ];
18605
- readonly summary: "Delete a comment attachment";
18606
- 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. This deletion remains available for a frozen Free-trial workspace so it can reduce storage before selecting a paid plan.";
18917
+ readonly summary: "Create presigned upload for a finance receipt";
18918
+ readonly description: "Returns a presigned POST for `{workspace}_finance/{transactionId}/{filename}.tmp`. JPEG, PNG, WebP, and PDF files up to 15 MB are supported. The transaction must belong to the workspace. Confirm the upload with `/files/confirm-finance-file`. Requires crm::finance write access and an active billing grant.";
18607
18919
  readonly security: readonly [
18608
18920
  never
18609
18921
  ];
@@ -18612,24 +18924,24 @@ declare const routes: import("hono/hono-base").HonoBase<{
18612
18924
  readonly content: {
18613
18925
  readonly "application/json": {
18614
18926
  readonly schema: {
18615
- readonly $ref: "#/components/schemas/DeleteCommentFileRequest";
18927
+ readonly $ref: "#/components/schemas/UploadToFinanceRequest";
18616
18928
  };
18617
18929
  };
18618
18930
  };
18619
18931
  };
18620
18932
  readonly responses: {
18621
18933
  readonly 200: {
18622
- readonly description: "Comment file deleted successfully.";
18934
+ readonly description: "Presigned finance upload created.";
18623
18935
  readonly content: {
18624
18936
  readonly "application/json": {
18625
18937
  readonly schema: {
18626
- readonly $ref: "#/components/schemas/DeleteFileSuccess";
18938
+ readonly $ref: "#/components/schemas/UploadToFinanceSuccess";
18627
18939
  };
18628
18940
  };
18629
18941
  };
18630
18942
  };
18631
18943
  readonly 400: {
18632
- readonly description: "Invalid request payload.";
18944
+ readonly description: "Invalid payload.";
18633
18945
  readonly content: {
18634
18946
  readonly "application/json": {
18635
18947
  readonly schema: {
@@ -18638,8 +18950,8 @@ declare const routes: import("hono/hono-base").HonoBase<{
18638
18950
  };
18639
18951
  };
18640
18952
  };
18641
- readonly 401: {
18642
- readonly description: "Unauthorized - Missing or invalid access token.";
18953
+ readonly 404: {
18954
+ readonly description: "Transaction not found.";
18643
18955
  readonly content: {
18644
18956
  readonly "application/json": {
18645
18957
  readonly schema: {
@@ -18648,32 +18960,56 @@ declare const routes: import("hono/hono-base").HonoBase<{
18648
18960
  };
18649
18961
  };
18650
18962
  };
18651
- readonly 403: {
18652
- readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks.";
18963
+ };
18964
+ };
18965
+ };
18966
+ readonly "/files/confirm-finance-file": {
18967
+ readonly post: {
18968
+ readonly tags: readonly [
18969
+ "Files"
18970
+ ];
18971
+ readonly summary: "Confirm a finance receipt upload";
18972
+ readonly description: "Validates and promotes `{workspace}_finance/{transactionId}/{filename}.tmp` to its finalized key. Confirmed bytes contribute to `financeBytes`.";
18973
+ readonly security: readonly [
18974
+ never
18975
+ ];
18976
+ readonly requestBody: {
18977
+ readonly required: true;
18978
+ readonly content: {
18979
+ readonly "application/json": {
18980
+ readonly schema: {
18981
+ readonly $ref: "#/components/schemas/ConfirmFinanceFileRequest";
18982
+ };
18983
+ };
18984
+ };
18985
+ };
18986
+ readonly responses: {
18987
+ readonly 200: {
18988
+ readonly description: "Finance file confirmed.";
18653
18989
  readonly content: {
18654
18990
  readonly "application/json": {
18655
18991
  readonly schema: {
18656
- readonly $ref: "#/components/schemas/ErrorResponse";
18992
+ readonly $ref: "#/components/schemas/ConfirmFileSuccess";
18657
18993
  };
18658
18994
  };
18659
18995
  };
18660
18996
  };
18661
- readonly 404: {
18662
- readonly description: "File not found at the given comment attachment key.";
18997
+ readonly 400: {
18998
+ readonly description: "Invalid request, missing temporary object, oversized file, or invalid file type.";
18663
18999
  readonly content: {
18664
19000
  readonly "application/json": {
18665
19001
  readonly schema: {
18666
- readonly $ref: "#/components/schemas/DeleteFileFailure";
19002
+ readonly $ref: "#/components/schemas/ErrorResponse";
18667
19003
  };
18668
19004
  };
18669
19005
  };
18670
19006
  };
18671
- readonly 500: {
18672
- readonly description: "Delete command ran but the object still exists.";
19007
+ readonly 404: {
19008
+ readonly description: "Transaction not found.";
18673
19009
  readonly content: {
18674
19010
  readonly "application/json": {
18675
19011
  readonly schema: {
18676
- readonly $ref: "#/components/schemas/DeleteFileFailure";
19012
+ readonly $ref: "#/components/schemas/ErrorResponse";
18677
19013
  };
18678
19014
  };
18679
19015
  };
@@ -18681,13 +19017,13 @@ declare const routes: import("hono/hono-base").HonoBase<{
18681
19017
  };
18682
19018
  };
18683
19019
  };
18684
- readonly "/files/download-from-task/{workspace}/{taskId}": {
19020
+ readonly "/files/download-from-finance/{workspace}/{transactionId}": {
18685
19021
  readonly get: {
18686
19022
  readonly tags: readonly [
18687
19023
  "Files"
18688
19024
  ];
18689
- readonly summary: "List comment files for a task";
18690
- 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.";
19025
+ readonly summary: "List files for a finance transaction";
19026
+ readonly description: "Lists finalized objects under `{workspace}_finance/{transactionId}/`, each with a 5-minute presigned download URL. Requires workspace access and read access to crm::finance.";
18691
19027
  readonly security: readonly [
18692
19028
  never
18693
19029
  ];
@@ -18703,49 +19039,29 @@ declare const routes: import("hono/hono-base").HonoBase<{
18703
19039
  readonly description: "Workspace identifier.";
18704
19040
  },
18705
19041
  {
18706
- readonly name: "taskId";
19042
+ readonly name: "transactionId";
18707
19043
  readonly in: "path";
18708
19044
  readonly required: true;
18709
19045
  readonly schema: {
18710
19046
  readonly type: "string";
18711
19047
  readonly format: "uuid";
18712
19048
  };
18713
- readonly description: "Task identifier whose comment attachments are listed.";
19049
+ readonly description: "Finance transaction identifier.";
18714
19050
  }
18715
19051
  ];
18716
19052
  readonly responses: {
18717
19053
  readonly 200: {
18718
- readonly description: "Task comment files listed successfully.";
18719
- readonly content: {
18720
- readonly "application/json": {
18721
- readonly schema: {
18722
- readonly $ref: "#/components/schemas/ListTaskCommentFilesSuccess";
18723
- };
18724
- };
18725
- };
18726
- };
18727
- readonly 400: {
18728
- readonly description: "Invalid workspace or task id.";
18729
- readonly content: {
18730
- readonly "application/json": {
18731
- readonly schema: {
18732
- readonly $ref: "#/components/schemas/ErrorResponse";
18733
- };
18734
- };
18735
- };
18736
- };
18737
- readonly 401: {
18738
- readonly description: "Unauthorized - Missing or invalid access token.";
19054
+ readonly description: "Finance files listed.";
18739
19055
  readonly content: {
18740
19056
  readonly "application/json": {
18741
19057
  readonly schema: {
18742
- readonly $ref: "#/components/schemas/ErrorResponse";
19058
+ readonly $ref: "#/components/schemas/ListFinanceFilesSuccess";
18743
19059
  };
18744
19060
  };
18745
19061
  };
18746
19062
  };
18747
19063
  readonly 403: {
18748
- readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::tasks.";
19064
+ readonly description: "Workspace or finance read access is missing.";
18749
19065
  readonly content: {
18750
19066
  readonly "application/json": {
18751
19067
  readonly schema: {
@@ -18755,7 +19071,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
18755
19071
  };
18756
19072
  };
18757
19073
  readonly 404: {
18758
- readonly description: "Workspace not found.";
19074
+ readonly description: "Transaction not found.";
18759
19075
  readonly content: {
18760
19076
  readonly "application/json": {
18761
19077
  readonly schema: {
@@ -18767,13 +19083,13 @@ declare const routes: import("hono/hono-base").HonoBase<{
18767
19083
  };
18768
19084
  };
18769
19085
  };
18770
- readonly "/files/upload-profile-picture": {
19086
+ readonly "/files/delete-finance-file": {
18771
19087
  readonly post: {
18772
19088
  readonly tags: readonly [
18773
19089
  "Files"
18774
19090
  ];
18775
- readonly summary: "Create presigned upload for profile picture";
18776
- readonly description: "Returns a presigned POST URL and form fields for uploading a temporary profile picture to `profiles/clients/{userId}/temp` (max 0.5 MB, 5-minute expiry). Accepts JPEG and PNG. After the multipart upload succeeds, call `/files/confirm-profile-picture` to validate, optimize, and persist the image. Requires a valid access token (no workspace policy check).";
19091
+ readonly summary: "Delete a finance receipt";
19092
+ readonly description: "Deletes `{workspace}_finance/{transactionId}/{filename}`. Requires workspace access and write access to crm::finance. This deletion remains available for a frozen Free-trial workspace so it can reduce storage before selecting a paid plan.";
18777
19093
  readonly security: readonly [
18778
19094
  never
18779
19095
  ];
@@ -18782,41 +19098,255 @@ declare const routes: import("hono/hono-base").HonoBase<{
18782
19098
  readonly content: {
18783
19099
  readonly "application/json": {
18784
19100
  readonly schema: {
18785
- readonly $ref: "#/components/schemas/UploadProfilePictureRequest";
19101
+ readonly $ref: "#/components/schemas/DeleteFinanceFileRequest";
18786
19102
  };
18787
19103
  };
18788
19104
  };
18789
19105
  };
18790
19106
  readonly responses: {
18791
19107
  readonly 200: {
18792
- readonly description: "Presigned profile picture upload created.";
19108
+ readonly description: "Finance file deleted.";
18793
19109
  readonly content: {
18794
19110
  readonly "application/json": {
18795
19111
  readonly schema: {
18796
- readonly allOf: readonly [
18797
- {
18798
- readonly $ref: "#/components/schemas/PresignedUploadSuccess";
18799
- }
18800
- ];
18801
- readonly description: "key is `profiles/clients/{userId}/temp`; maxSize is 524288 (0.5 MB).";
19112
+ readonly $ref: "#/components/schemas/DeleteFileSuccess";
18802
19113
  };
18803
19114
  };
18804
19115
  };
18805
19116
  };
18806
- readonly 400: {
18807
- readonly description: "Invalid request payload or unsupported content type.";
19117
+ readonly 404: {
19118
+ readonly description: "File or transaction not found.";
18808
19119
  readonly content: {
18809
19120
  readonly "application/json": {
18810
19121
  readonly schema: {
18811
- readonly $ref: "#/components/schemas/ErrorResponse";
19122
+ readonly $ref: "#/components/schemas/DeleteFileFailure";
18812
19123
  };
18813
19124
  };
18814
19125
  };
18815
19126
  };
18816
- readonly 401: {
18817
- readonly description: "Unauthorized - Missing or invalid access token.";
18818
- readonly content: {
18819
- readonly "application/json": {
19127
+ };
19128
+ };
19129
+ };
19130
+ readonly "/files/delete-comment-file": {
19131
+ readonly post: {
19132
+ readonly tags: readonly [
19133
+ "Files"
19134
+ ];
19135
+ readonly summary: "Delete a comment attachment";
19136
+ 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. This deletion remains available for a frozen Free-trial workspace so it can reduce storage before selecting a paid plan.";
19137
+ readonly security: readonly [
19138
+ never
19139
+ ];
19140
+ readonly requestBody: {
19141
+ readonly required: true;
19142
+ readonly content: {
19143
+ readonly "application/json": {
19144
+ readonly schema: {
19145
+ readonly $ref: "#/components/schemas/DeleteCommentFileRequest";
19146
+ };
19147
+ };
19148
+ };
19149
+ };
19150
+ readonly responses: {
19151
+ readonly 200: {
19152
+ readonly description: "Comment file deleted successfully.";
19153
+ readonly content: {
19154
+ readonly "application/json": {
19155
+ readonly schema: {
19156
+ readonly $ref: "#/components/schemas/DeleteFileSuccess";
19157
+ };
19158
+ };
19159
+ };
19160
+ };
19161
+ readonly 400: {
19162
+ readonly description: "Invalid request payload.";
19163
+ readonly content: {
19164
+ readonly "application/json": {
19165
+ readonly schema: {
19166
+ readonly $ref: "#/components/schemas/ErrorResponse";
19167
+ };
19168
+ };
19169
+ };
19170
+ };
19171
+ readonly 401: {
19172
+ readonly description: "Unauthorized - Missing or invalid access token.";
19173
+ readonly content: {
19174
+ readonly "application/json": {
19175
+ readonly schema: {
19176
+ readonly $ref: "#/components/schemas/ErrorResponse";
19177
+ };
19178
+ };
19179
+ };
19180
+ };
19181
+ readonly 403: {
19182
+ readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks.";
19183
+ readonly content: {
19184
+ readonly "application/json": {
19185
+ readonly schema: {
19186
+ readonly $ref: "#/components/schemas/ErrorResponse";
19187
+ };
19188
+ };
19189
+ };
19190
+ };
19191
+ readonly 404: {
19192
+ readonly description: "File not found at the given comment attachment key.";
19193
+ readonly content: {
19194
+ readonly "application/json": {
19195
+ readonly schema: {
19196
+ readonly $ref: "#/components/schemas/DeleteFileFailure";
19197
+ };
19198
+ };
19199
+ };
19200
+ };
19201
+ readonly 500: {
19202
+ readonly description: "Delete command ran but the object still exists.";
19203
+ readonly content: {
19204
+ readonly "application/json": {
19205
+ readonly schema: {
19206
+ readonly $ref: "#/components/schemas/DeleteFileFailure";
19207
+ };
19208
+ };
19209
+ };
19210
+ };
19211
+ };
19212
+ };
19213
+ };
19214
+ readonly "/files/download-from-task/{workspace}/{taskId}": {
19215
+ readonly get: {
19216
+ readonly tags: readonly [
19217
+ "Files"
19218
+ ];
19219
+ readonly summary: "List comment files for a task";
19220
+ 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.";
19221
+ readonly security: readonly [
19222
+ never
19223
+ ];
19224
+ readonly parameters: readonly [
19225
+ {
19226
+ readonly name: "workspace";
19227
+ readonly in: "path";
19228
+ readonly required: true;
19229
+ readonly schema: {
19230
+ readonly type: "string";
19231
+ readonly format: "uuid";
19232
+ };
19233
+ readonly description: "Workspace identifier.";
19234
+ },
19235
+ {
19236
+ readonly name: "taskId";
19237
+ readonly in: "path";
19238
+ readonly required: true;
19239
+ readonly schema: {
19240
+ readonly type: "string";
19241
+ readonly format: "uuid";
19242
+ };
19243
+ readonly description: "Task identifier whose comment attachments are listed.";
19244
+ }
19245
+ ];
19246
+ readonly responses: {
19247
+ readonly 200: {
19248
+ readonly description: "Task comment files listed successfully.";
19249
+ readonly content: {
19250
+ readonly "application/json": {
19251
+ readonly schema: {
19252
+ readonly $ref: "#/components/schemas/ListTaskCommentFilesSuccess";
19253
+ };
19254
+ };
19255
+ };
19256
+ };
19257
+ readonly 400: {
19258
+ readonly description: "Invalid workspace or task id.";
19259
+ readonly content: {
19260
+ readonly "application/json": {
19261
+ readonly schema: {
19262
+ readonly $ref: "#/components/schemas/ErrorResponse";
19263
+ };
19264
+ };
19265
+ };
19266
+ };
19267
+ readonly 401: {
19268
+ readonly description: "Unauthorized - Missing or invalid access token.";
19269
+ readonly content: {
19270
+ readonly "application/json": {
19271
+ readonly schema: {
19272
+ readonly $ref: "#/components/schemas/ErrorResponse";
19273
+ };
19274
+ };
19275
+ };
19276
+ };
19277
+ readonly 403: {
19278
+ readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::tasks.";
19279
+ readonly content: {
19280
+ readonly "application/json": {
19281
+ readonly schema: {
19282
+ readonly $ref: "#/components/schemas/ErrorResponse";
19283
+ };
19284
+ };
19285
+ };
19286
+ };
19287
+ readonly 404: {
19288
+ readonly description: "Workspace not found.";
19289
+ readonly content: {
19290
+ readonly "application/json": {
19291
+ readonly schema: {
19292
+ readonly $ref: "#/components/schemas/ErrorResponse";
19293
+ };
19294
+ };
19295
+ };
19296
+ };
19297
+ };
19298
+ };
19299
+ };
19300
+ readonly "/files/upload-profile-picture": {
19301
+ readonly post: {
19302
+ readonly tags: readonly [
19303
+ "Files"
19304
+ ];
19305
+ readonly summary: "Create presigned upload for profile picture";
19306
+ readonly description: "Returns a presigned POST URL and form fields for uploading a temporary profile picture to `profiles/clients/{userId}/temp` (max 0.5 MB, 5-minute expiry). Accepts JPEG and PNG. After the multipart upload succeeds, call `/files/confirm-profile-picture` to validate, optimize, and persist the image. Requires a valid access token (no workspace policy check).";
19307
+ readonly security: readonly [
19308
+ never
19309
+ ];
19310
+ readonly requestBody: {
19311
+ readonly required: true;
19312
+ readonly content: {
19313
+ readonly "application/json": {
19314
+ readonly schema: {
19315
+ readonly $ref: "#/components/schemas/UploadProfilePictureRequest";
19316
+ };
19317
+ };
19318
+ };
19319
+ };
19320
+ readonly responses: {
19321
+ readonly 200: {
19322
+ readonly description: "Presigned profile picture upload created.";
19323
+ readonly content: {
19324
+ readonly "application/json": {
19325
+ readonly schema: {
19326
+ readonly allOf: readonly [
19327
+ {
19328
+ readonly $ref: "#/components/schemas/PresignedUploadSuccess";
19329
+ }
19330
+ ];
19331
+ readonly description: "key is `profiles/clients/{userId}/temp`; maxSize is 524288 (0.5 MB).";
19332
+ };
19333
+ };
19334
+ };
19335
+ };
19336
+ readonly 400: {
19337
+ readonly description: "Invalid request payload or unsupported content type.";
19338
+ readonly content: {
19339
+ readonly "application/json": {
19340
+ readonly schema: {
19341
+ readonly $ref: "#/components/schemas/ErrorResponse";
19342
+ };
19343
+ };
19344
+ };
19345
+ };
19346
+ readonly 401: {
19347
+ readonly description: "Unauthorized - Missing or invalid access token.";
19348
+ readonly content: {
19349
+ readonly "application/json": {
18820
19350
  readonly schema: {
18821
19351
  readonly $ref: "#/components/schemas/ErrorResponse";
18822
19352
  };
@@ -19764,20 +20294,403 @@ declare const routes: import("hono/hono-base").HonoBase<{
19764
20294
  };
19765
20295
  };
19766
20296
  };
19767
- };
19768
- readonly responses: {
19769
- readonly 201: {
19770
- readonly description: "Account created successfully.";
20297
+ };
20298
+ readonly responses: {
20299
+ readonly 201: {
20300
+ readonly description: "Account created successfully.";
20301
+ readonly content: {
20302
+ readonly "application/json": {
20303
+ readonly schema: {
20304
+ readonly $ref: "#/components/schemas/FinanceAccountSuccess";
20305
+ };
20306
+ };
20307
+ };
20308
+ };
20309
+ readonly 400: {
20310
+ readonly description: "Invalid request payload.";
20311
+ readonly content: {
20312
+ readonly "application/json": {
20313
+ readonly schema: {
20314
+ readonly $ref: "#/components/schemas/ErrorResponse";
20315
+ };
20316
+ };
20317
+ };
20318
+ };
20319
+ readonly 401: {
20320
+ readonly description: "Unauthorized.";
20321
+ readonly content: {
20322
+ readonly "application/json": {
20323
+ readonly schema: {
20324
+ readonly $ref: "#/components/schemas/ErrorResponse";
20325
+ };
20326
+ };
20327
+ };
20328
+ };
20329
+ readonly 403: {
20330
+ readonly description: "Forbidden - missing workspace or crm::finance write access.";
20331
+ readonly content: {
20332
+ readonly "application/json": {
20333
+ readonly schema: {
20334
+ readonly $ref: "#/components/schemas/ErrorResponse";
20335
+ };
20336
+ };
20337
+ };
20338
+ };
20339
+ };
20340
+ };
20341
+ };
20342
+ readonly "/finance/accounts/update": {
20343
+ readonly post: {
20344
+ readonly tags: readonly [
20345
+ "Finance"
20346
+ ];
20347
+ readonly summary: "Update a finance account";
20348
+ readonly description: "Updates name, card color, currency, and/or opening balance. Requires crm::finance write access.";
20349
+ readonly security: readonly [
20350
+ never
20351
+ ];
20352
+ readonly requestBody: {
20353
+ readonly required: true;
20354
+ readonly content: {
20355
+ readonly "application/json": {
20356
+ readonly schema: {
20357
+ readonly type: "object";
20358
+ readonly required: readonly [
20359
+ "accountId",
20360
+ "workspace"
20361
+ ];
20362
+ readonly properties: {
20363
+ readonly accountId: {
20364
+ readonly type: "string";
20365
+ readonly format: "uuid";
20366
+ };
20367
+ readonly workspace: {
20368
+ readonly type: "string";
20369
+ readonly format: "uuid";
20370
+ };
20371
+ readonly name: {
20372
+ readonly type: "string";
20373
+ };
20374
+ readonly cardColor: {
20375
+ readonly type: "string";
20376
+ };
20377
+ readonly currency: {
20378
+ readonly type: "string";
20379
+ readonly enum: readonly [
20380
+ "ruble",
20381
+ "dollar",
20382
+ "euro"
20383
+ ];
20384
+ };
20385
+ readonly openingBalance: {
20386
+ readonly type: "number";
20387
+ };
20388
+ };
20389
+ };
20390
+ };
20391
+ };
20392
+ };
20393
+ readonly responses: {
20394
+ readonly 200: {
20395
+ readonly description: "Account updated successfully.";
20396
+ readonly content: {
20397
+ readonly "application/json": {
20398
+ readonly schema: {
20399
+ readonly $ref: "#/components/schemas/FinanceAccountSuccess";
20400
+ };
20401
+ };
20402
+ };
20403
+ };
20404
+ readonly 400: {
20405
+ readonly description: "Invalid request payload.";
20406
+ readonly content: {
20407
+ readonly "application/json": {
20408
+ readonly schema: {
20409
+ readonly $ref: "#/components/schemas/ErrorResponse";
20410
+ };
20411
+ };
20412
+ };
20413
+ };
20414
+ readonly 401: {
20415
+ readonly description: "Unauthorized.";
20416
+ readonly content: {
20417
+ readonly "application/json": {
20418
+ readonly schema: {
20419
+ readonly $ref: "#/components/schemas/ErrorResponse";
20420
+ };
20421
+ };
20422
+ };
20423
+ };
20424
+ readonly 403: {
20425
+ readonly description: "Forbidden - missing workspace or crm::finance write access.";
20426
+ readonly content: {
20427
+ readonly "application/json": {
20428
+ readonly schema: {
20429
+ readonly $ref: "#/components/schemas/ErrorResponse";
20430
+ };
20431
+ };
20432
+ };
20433
+ };
20434
+ readonly 404: {
20435
+ readonly description: "Account not found.";
20436
+ readonly content: {
20437
+ readonly "application/json": {
20438
+ readonly schema: {
20439
+ readonly $ref: "#/components/schemas/ErrorResponse";
20440
+ };
20441
+ };
20442
+ };
20443
+ };
20444
+ };
20445
+ };
20446
+ };
20447
+ readonly "/finance/accounts/reorder": {
20448
+ readonly post: {
20449
+ readonly tags: readonly [
20450
+ "Finance"
20451
+ ];
20452
+ readonly summary: "Reorder finance accounts";
20453
+ readonly description: "Sets display order to 1..n from the given accountIds list. The list must contain every workspace account exactly once. Requires crm::finance write access.";
20454
+ readonly security: readonly [
20455
+ never
20456
+ ];
20457
+ readonly requestBody: {
20458
+ readonly required: true;
20459
+ readonly content: {
20460
+ readonly "application/json": {
20461
+ readonly schema: {
20462
+ readonly type: "object";
20463
+ readonly required: readonly [
20464
+ "workspace",
20465
+ "accountIds"
20466
+ ];
20467
+ readonly properties: {
20468
+ readonly workspace: {
20469
+ readonly type: "string";
20470
+ readonly format: "uuid";
20471
+ };
20472
+ readonly accountIds: {
20473
+ readonly type: "array";
20474
+ readonly items: {
20475
+ readonly type: "string";
20476
+ readonly format: "uuid";
20477
+ };
20478
+ readonly minItems: 1;
20479
+ };
20480
+ };
20481
+ };
20482
+ };
20483
+ };
20484
+ };
20485
+ readonly responses: {
20486
+ readonly 200: {
20487
+ readonly description: "Accounts reordered successfully.";
20488
+ readonly content: {
20489
+ readonly "application/json": {
20490
+ readonly schema: {
20491
+ readonly $ref: "#/components/schemas/ListFinanceAccountsSuccess";
20492
+ };
20493
+ };
20494
+ };
20495
+ };
20496
+ readonly 400: {
20497
+ readonly description: "Invalid request payload or incomplete accountIds list.";
20498
+ readonly content: {
20499
+ readonly "application/json": {
20500
+ readonly schema: {
20501
+ readonly $ref: "#/components/schemas/ErrorResponse";
20502
+ };
20503
+ };
20504
+ };
20505
+ };
20506
+ readonly 401: {
20507
+ readonly description: "Unauthorized.";
20508
+ readonly content: {
20509
+ readonly "application/json": {
20510
+ readonly schema: {
20511
+ readonly $ref: "#/components/schemas/ErrorResponse";
20512
+ };
20513
+ };
20514
+ };
20515
+ };
20516
+ readonly 403: {
20517
+ readonly description: "Forbidden - missing workspace or crm::finance write access.";
20518
+ readonly content: {
20519
+ readonly "application/json": {
20520
+ readonly schema: {
20521
+ readonly $ref: "#/components/schemas/ErrorResponse";
20522
+ };
20523
+ };
20524
+ };
20525
+ };
20526
+ };
20527
+ };
20528
+ };
20529
+ readonly "/finance/accounts/delete": {
20530
+ readonly post: {
20531
+ readonly tags: readonly [
20532
+ "Finance"
20533
+ ];
20534
+ readonly summary: "Delete a finance account";
20535
+ readonly description: "Deletes an account and compact remaining display orders. Requires crm::finance write access. Available in frozen Free-trial workspaces.";
20536
+ readonly security: readonly [
20537
+ never
20538
+ ];
20539
+ readonly requestBody: {
20540
+ readonly required: true;
20541
+ readonly content: {
20542
+ readonly "application/json": {
20543
+ readonly schema: {
20544
+ readonly type: "object";
20545
+ readonly required: readonly [
20546
+ "accountId",
20547
+ "workspace"
20548
+ ];
20549
+ readonly properties: {
20550
+ readonly accountId: {
20551
+ readonly type: "string";
20552
+ readonly format: "uuid";
20553
+ };
20554
+ readonly workspace: {
20555
+ readonly type: "string";
20556
+ readonly format: "uuid";
20557
+ };
20558
+ };
20559
+ };
20560
+ };
20561
+ };
20562
+ };
20563
+ readonly responses: {
20564
+ readonly 200: {
20565
+ readonly description: "Account deleted successfully.";
20566
+ readonly content: {
20567
+ readonly "application/json": {
20568
+ readonly schema: {
20569
+ readonly $ref: "#/components/schemas/SimpleSuccess";
20570
+ };
20571
+ };
20572
+ };
20573
+ };
20574
+ readonly 400: {
20575
+ readonly description: "Invalid request payload.";
20576
+ readonly content: {
20577
+ readonly "application/json": {
20578
+ readonly schema: {
20579
+ readonly $ref: "#/components/schemas/ErrorResponse";
20580
+ };
20581
+ };
20582
+ };
20583
+ };
20584
+ readonly 401: {
20585
+ readonly description: "Unauthorized.";
20586
+ readonly content: {
20587
+ readonly "application/json": {
20588
+ readonly schema: {
20589
+ readonly $ref: "#/components/schemas/ErrorResponse";
20590
+ };
20591
+ };
20592
+ };
20593
+ };
20594
+ readonly 403: {
20595
+ readonly description: "Forbidden - missing workspace or crm::finance write access.";
20596
+ readonly content: {
20597
+ readonly "application/json": {
20598
+ readonly schema: {
20599
+ readonly $ref: "#/components/schemas/ErrorResponse";
20600
+ };
20601
+ };
20602
+ };
20603
+ };
20604
+ readonly 404: {
20605
+ readonly description: "Account not found.";
20606
+ readonly content: {
20607
+ readonly "application/json": {
20608
+ readonly schema: {
20609
+ readonly $ref: "#/components/schemas/ErrorResponse";
20610
+ };
20611
+ };
20612
+ };
20613
+ };
20614
+ };
20615
+ };
20616
+ };
20617
+ readonly "/finance/transactions/list/{workspace}": {
20618
+ readonly get: {
20619
+ readonly tags: readonly [
20620
+ "Finance"
20621
+ ];
20622
+ readonly summary: "List finance transactions";
20623
+ readonly description: "Returns workspace finance transactions newest first. Optional `accountId` matches source or destination account; optional `type` filters by transaction type. Requires crm::finance read access.";
20624
+ readonly security: readonly [
20625
+ never
20626
+ ];
20627
+ readonly parameters: readonly [
20628
+ {
20629
+ readonly name: "workspace";
20630
+ readonly in: "path";
20631
+ readonly required: true;
20632
+ readonly schema: {
20633
+ readonly type: "string";
20634
+ readonly format: "uuid";
20635
+ };
20636
+ },
20637
+ {
20638
+ readonly name: "accountId";
20639
+ readonly in: "query";
20640
+ readonly required: false;
20641
+ readonly schema: {
20642
+ readonly type: "string";
20643
+ readonly format: "uuid";
20644
+ };
20645
+ },
20646
+ {
20647
+ readonly name: "type";
20648
+ readonly in: "query";
20649
+ readonly required: false;
20650
+ readonly schema: {
20651
+ readonly type: "string";
20652
+ readonly enum: readonly [
20653
+ "refund",
20654
+ "income",
20655
+ "expense",
20656
+ "transfer"
20657
+ ];
20658
+ };
20659
+ }
20660
+ ];
20661
+ readonly responses: {
20662
+ readonly 200: {
20663
+ readonly description: "Transactions fetched successfully.";
20664
+ readonly content: {
20665
+ readonly "application/json": {
20666
+ readonly schema: {
20667
+ readonly $ref: "#/components/schemas/ListFinanceTransactionsSuccess";
20668
+ };
20669
+ };
20670
+ };
20671
+ };
20672
+ readonly 400: {
20673
+ readonly description: "Invalid query.";
20674
+ readonly content: {
20675
+ readonly "application/json": {
20676
+ readonly schema: {
20677
+ readonly $ref: "#/components/schemas/ErrorResponse";
20678
+ };
20679
+ };
20680
+ };
20681
+ };
20682
+ readonly 401: {
20683
+ readonly description: "Unauthorized.";
19771
20684
  readonly content: {
19772
20685
  readonly "application/json": {
19773
20686
  readonly schema: {
19774
- readonly $ref: "#/components/schemas/FinanceAccountSuccess";
20687
+ readonly $ref: "#/components/schemas/ErrorResponse";
19775
20688
  };
19776
20689
  };
19777
20690
  };
19778
20691
  };
19779
- readonly 400: {
19780
- readonly description: "Invalid request payload.";
20692
+ readonly 403: {
20693
+ readonly description: "Forbidden - missing workspace or crm::finance access.";
19781
20694
  readonly content: {
19782
20695
  readonly "application/json": {
19783
20696
  readonly schema: {
@@ -19786,6 +20699,50 @@ declare const routes: import("hono/hono-base").HonoBase<{
19786
20699
  };
19787
20700
  };
19788
20701
  };
20702
+ };
20703
+ };
20704
+ };
20705
+ readonly "/finance/transactions/get/{workspace}/{transactionId}": {
20706
+ readonly get: {
20707
+ readonly tags: readonly [
20708
+ "Finance"
20709
+ ];
20710
+ readonly summary: "Get a finance transaction";
20711
+ readonly description: "Returns a single finance transaction. Requires crm::finance read access.";
20712
+ readonly security: readonly [
20713
+ never
20714
+ ];
20715
+ readonly parameters: readonly [
20716
+ {
20717
+ readonly name: "workspace";
20718
+ readonly in: "path";
20719
+ readonly required: true;
20720
+ readonly schema: {
20721
+ readonly type: "string";
20722
+ readonly format: "uuid";
20723
+ };
20724
+ },
20725
+ {
20726
+ readonly name: "transactionId";
20727
+ readonly in: "path";
20728
+ readonly required: true;
20729
+ readonly schema: {
20730
+ readonly type: "string";
20731
+ readonly format: "uuid";
20732
+ };
20733
+ }
20734
+ ];
20735
+ readonly responses: {
20736
+ readonly 200: {
20737
+ readonly description: "Transaction fetched successfully.";
20738
+ readonly content: {
20739
+ readonly "application/json": {
20740
+ readonly schema: {
20741
+ readonly $ref: "#/components/schemas/FinanceTransactionSuccess";
20742
+ };
20743
+ };
20744
+ };
20745
+ };
19789
20746
  readonly 401: {
19790
20747
  readonly description: "Unauthorized.";
19791
20748
  readonly content: {
@@ -19797,7 +20754,17 @@ declare const routes: import("hono/hono-base").HonoBase<{
19797
20754
  };
19798
20755
  };
19799
20756
  readonly 403: {
19800
- readonly description: "Forbidden - missing workspace or crm::finance write access.";
20757
+ readonly description: "Forbidden - missing workspace or crm::finance access.";
20758
+ readonly content: {
20759
+ readonly "application/json": {
20760
+ readonly schema: {
20761
+ readonly $ref: "#/components/schemas/ErrorResponse";
20762
+ };
20763
+ };
20764
+ };
20765
+ };
20766
+ readonly 404: {
20767
+ readonly description: "Transaction not found.";
19801
20768
  readonly content: {
19802
20769
  readonly "application/json": {
19803
20770
  readonly schema: {
@@ -19809,13 +20776,13 @@ declare const routes: import("hono/hono-base").HonoBase<{
19809
20776
  };
19810
20777
  };
19811
20778
  };
19812
- readonly "/finance/accounts/update": {
20779
+ readonly "/finance/transactions/create": {
19813
20780
  readonly post: {
19814
20781
  readonly tags: readonly [
19815
20782
  "Finance"
19816
20783
  ];
19817
- readonly summary: "Update a finance account";
19818
- readonly description: "Updates name, card color, currency, and/or opening balance. Requires crm::finance write access.";
20784
+ readonly summary: "Create a finance transaction";
20785
+ readonly description: "Creates a ledger transaction. Transfers require distinct source `accountId` and `destinationAccountId`. Optional customerId/serviceId are validated against the workspace CRM. Opening balances are not rewritten. Requires crm::finance write access.";
19819
20786
  readonly security: readonly [
19820
20787
  never
19821
20788
  ];
@@ -19826,34 +20793,61 @@ declare const routes: import("hono/hono-base").HonoBase<{
19826
20793
  readonly schema: {
19827
20794
  readonly type: "object";
19828
20795
  readonly required: readonly [
19829
- "accountId",
19830
- "workspace"
20796
+ "workspace",
20797
+ "type",
20798
+ "amount"
19831
20799
  ];
19832
20800
  readonly properties: {
19833
- readonly accountId: {
20801
+ readonly workspace: {
19834
20802
  readonly type: "string";
19835
20803
  readonly format: "uuid";
19836
20804
  };
19837
- readonly workspace: {
20805
+ readonly type: {
20806
+ readonly type: "string";
20807
+ readonly enum: readonly [
20808
+ "refund",
20809
+ "income",
20810
+ "expense",
20811
+ "transfer"
20812
+ ];
20813
+ };
20814
+ readonly customerId: {
19838
20815
  readonly type: "string";
19839
20816
  readonly format: "uuid";
19840
20817
  };
19841
- readonly name: {
20818
+ readonly serviceId: {
19842
20819
  readonly type: "string";
20820
+ readonly format: "uuid";
19843
20821
  };
19844
- readonly cardColor: {
20822
+ readonly accountId: {
19845
20823
  readonly type: "string";
20824
+ readonly format: "uuid";
19846
20825
  };
19847
- readonly currency: {
20826
+ readonly destinationAccountId: {
19848
20827
  readonly type: "string";
19849
- readonly enum: readonly [
19850
- "ruble",
19851
- "dollar",
19852
- "euro"
19853
- ];
20828
+ readonly format: "uuid";
19854
20829
  };
19855
- readonly openingBalance: {
20830
+ readonly paymentMethod: {
20831
+ readonly type: "string";
20832
+ };
20833
+ readonly amount: {
19856
20834
  readonly type: "number";
20835
+ readonly minimum: 0.01;
20836
+ };
20837
+ readonly description: {
20838
+ readonly type: "string";
20839
+ };
20840
+ readonly date: {
20841
+ readonly type: "string";
20842
+ readonly format: "date-time";
20843
+ };
20844
+ readonly vat: {
20845
+ readonly type: "integer";
20846
+ readonly minimum: 0;
20847
+ readonly maximum: 100;
20848
+ };
20849
+ readonly reason: {
20850
+ readonly type: "string";
19857
20851
  };
19858
20852
  };
19859
20853
  };
@@ -19861,18 +20855,18 @@ declare const routes: import("hono/hono-base").HonoBase<{
19861
20855
  };
19862
20856
  };
19863
20857
  readonly responses: {
19864
- readonly 200: {
19865
- readonly description: "Account updated successfully.";
20858
+ readonly 201: {
20859
+ readonly description: "Transaction created successfully.";
19866
20860
  readonly content: {
19867
20861
  readonly "application/json": {
19868
20862
  readonly schema: {
19869
- readonly $ref: "#/components/schemas/FinanceAccountSuccess";
20863
+ readonly $ref: "#/components/schemas/FinanceTransactionSuccess";
19870
20864
  };
19871
20865
  };
19872
20866
  };
19873
20867
  };
19874
20868
  readonly 400: {
19875
- readonly description: "Invalid request payload.";
20869
+ readonly description: "Invalid request payload or transfer pairing.";
19876
20870
  readonly content: {
19877
20871
  readonly "application/json": {
19878
20872
  readonly schema: {
@@ -19902,7 +20896,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
19902
20896
  };
19903
20897
  };
19904
20898
  readonly 404: {
19905
- readonly description: "Account not found.";
20899
+ readonly description: "Account, customer, or service not found.";
19906
20900
  readonly content: {
19907
20901
  readonly "application/json": {
19908
20902
  readonly schema: {
@@ -19914,13 +20908,13 @@ declare const routes: import("hono/hono-base").HonoBase<{
19914
20908
  };
19915
20909
  };
19916
20910
  };
19917
- readonly "/finance/accounts/reorder": {
20911
+ readonly "/finance/transactions/update": {
19918
20912
  readonly post: {
19919
20913
  readonly tags: readonly [
19920
20914
  "Finance"
19921
20915
  ];
19922
- readonly summary: "Reorder finance accounts";
19923
- readonly description: "Sets display order to 1..n from the given accountIds list. The list must contain every workspace account exactly once. Requires crm::finance write access.";
20916
+ readonly summary: "Update a finance transaction";
20917
+ readonly description: "Updates transaction fields. Changing type away from transfer clears destinationAccountId. Requires crm::finance write access.";
19924
20918
  readonly security: readonly [
19925
20919
  never
19926
20920
  ];
@@ -19931,21 +20925,64 @@ declare const routes: import("hono/hono-base").HonoBase<{
19931
20925
  readonly schema: {
19932
20926
  readonly type: "object";
19933
20927
  readonly required: readonly [
19934
- "workspace",
19935
- "accountIds"
20928
+ "transactionId",
20929
+ "workspace"
19936
20930
  ];
19937
20931
  readonly properties: {
20932
+ readonly transactionId: {
20933
+ readonly type: "string";
20934
+ readonly format: "uuid";
20935
+ };
19938
20936
  readonly workspace: {
19939
20937
  readonly type: "string";
19940
20938
  readonly format: "uuid";
19941
20939
  };
19942
- readonly accountIds: {
19943
- readonly type: "array";
19944
- readonly items: {
19945
- readonly type: "string";
19946
- readonly format: "uuid";
19947
- };
19948
- readonly minItems: 1;
20940
+ readonly type: {
20941
+ readonly type: "string";
20942
+ readonly enum: readonly [
20943
+ "refund",
20944
+ "income",
20945
+ "expense",
20946
+ "transfer"
20947
+ ];
20948
+ };
20949
+ readonly customerId: {
20950
+ readonly type: "string";
20951
+ readonly format: "uuid";
20952
+ };
20953
+ readonly serviceId: {
20954
+ readonly type: "string";
20955
+ readonly format: "uuid";
20956
+ };
20957
+ readonly accountId: {
20958
+ readonly type: "string";
20959
+ readonly format: "uuid";
20960
+ };
20961
+ readonly destinationAccountId: {
20962
+ readonly type: "string";
20963
+ readonly format: "uuid";
20964
+ };
20965
+ readonly paymentMethod: {
20966
+ readonly type: "string";
20967
+ };
20968
+ readonly amount: {
20969
+ readonly type: "number";
20970
+ readonly minimum: 0.01;
20971
+ };
20972
+ readonly description: {
20973
+ readonly type: "string";
20974
+ };
20975
+ readonly date: {
20976
+ readonly type: "string";
20977
+ readonly format: "date-time";
20978
+ };
20979
+ readonly vat: {
20980
+ readonly type: "integer";
20981
+ readonly minimum: 0;
20982
+ readonly maximum: 100;
20983
+ };
20984
+ readonly reason: {
20985
+ readonly type: "string";
19949
20986
  };
19950
20987
  };
19951
20988
  };
@@ -19954,17 +20991,17 @@ declare const routes: import("hono/hono-base").HonoBase<{
19954
20991
  };
19955
20992
  readonly responses: {
19956
20993
  readonly 200: {
19957
- readonly description: "Accounts reordered successfully.";
20994
+ readonly description: "Transaction updated successfully.";
19958
20995
  readonly content: {
19959
20996
  readonly "application/json": {
19960
20997
  readonly schema: {
19961
- readonly $ref: "#/components/schemas/ListFinanceAccountsSuccess";
20998
+ readonly $ref: "#/components/schemas/FinanceTransactionSuccess";
19962
20999
  };
19963
21000
  };
19964
21001
  };
19965
21002
  };
19966
21003
  readonly 400: {
19967
- readonly description: "Invalid request payload or incomplete accountIds list.";
21004
+ readonly description: "Invalid request payload or transfer pairing.";
19968
21005
  readonly content: {
19969
21006
  readonly "application/json": {
19970
21007
  readonly schema: {
@@ -19993,16 +21030,26 @@ declare const routes: import("hono/hono-base").HonoBase<{
19993
21030
  };
19994
21031
  };
19995
21032
  };
21033
+ readonly 404: {
21034
+ readonly description: "Transaction, account, customer, or service not found.";
21035
+ readonly content: {
21036
+ readonly "application/json": {
21037
+ readonly schema: {
21038
+ readonly $ref: "#/components/schemas/ErrorResponse";
21039
+ };
21040
+ };
21041
+ };
21042
+ };
19996
21043
  };
19997
21044
  };
19998
21045
  };
19999
- readonly "/finance/accounts/delete": {
21046
+ readonly "/finance/transactions/delete": {
20000
21047
  readonly post: {
20001
21048
  readonly tags: readonly [
20002
21049
  "Finance"
20003
21050
  ];
20004
- readonly summary: "Delete a finance account";
20005
- readonly description: "Deletes an account and compact remaining display orders. Requires crm::finance write access. Available in frozen Free-trial workspaces.";
21051
+ readonly summary: "Delete a finance transaction";
21052
+ readonly description: "Deletes a transaction and its receipt prefix `{workspace}_finance/{transactionId}/`. Requires crm::finance write access. Available in frozen Free-trial workspaces.";
20006
21053
  readonly security: readonly [
20007
21054
  never
20008
21055
  ];
@@ -20013,11 +21060,11 @@ declare const routes: import("hono/hono-base").HonoBase<{
20013
21060
  readonly schema: {
20014
21061
  readonly type: "object";
20015
21062
  readonly required: readonly [
20016
- "accountId",
21063
+ "transactionId",
20017
21064
  "workspace"
20018
21065
  ];
20019
21066
  readonly properties: {
20020
- readonly accountId: {
21067
+ readonly transactionId: {
20021
21068
  readonly type: "string";
20022
21069
  readonly format: "uuid";
20023
21070
  };
@@ -20032,7 +21079,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
20032
21079
  };
20033
21080
  readonly responses: {
20034
21081
  readonly 200: {
20035
- readonly description: "Account deleted successfully.";
21082
+ readonly description: "Transaction deleted successfully.";
20036
21083
  readonly content: {
20037
21084
  readonly "application/json": {
20038
21085
  readonly schema: {
@@ -20072,7 +21119,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
20072
21119
  };
20073
21120
  };
20074
21121
  readonly 404: {
20075
- readonly description: "Account not found.";
21122
+ readonly description: "Transaction not found.";
20076
21123
  readonly content: {
20077
21124
  readonly "application/json": {
20078
21125
  readonly schema: {
@@ -27461,6 +28508,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
27461
28508
  commentsBytes: number;
27462
28509
  customerBytes: number;
27463
28510
  servicesBytes: number;
28511
+ financeBytes: number;
27464
28512
  limitBytes: number | null;
27465
28513
  };
27466
28514
  outputFormat: "json";
@@ -27804,18 +28852,99 @@ declare const routes: import("hono/hono-base").HonoBase<{
27804
28852
  };
27805
28853
  };
27806
28854
  } & {
27807
- "/upload-workspace-picture": {
28855
+ "/upload-workspace-picture": {
28856
+ $post: {
28857
+ input: {};
28858
+ output: {
28859
+ success: false;
28860
+ error: never;
28861
+ };
28862
+ outputFormat: "json";
28863
+ status: 400;
28864
+ } | {
28865
+ input: {};
28866
+ output: {
28867
+ url: string;
28868
+ fields: {
28869
+ [x: string]: string;
28870
+ };
28871
+ key: string;
28872
+ maxSize: number;
28873
+ };
28874
+ outputFormat: "json";
28875
+ status: import("hono/utils/http-status").ContentfulStatusCode;
28876
+ };
28877
+ };
28878
+ } & {
28879
+ "/confirm-workspace-picture": {
28880
+ $post: {
28881
+ input: {};
28882
+ output: {
28883
+ success: true;
28884
+ url: string;
28885
+ };
28886
+ outputFormat: "json";
28887
+ status: import("hono/utils/http-status").ContentfulStatusCode;
28888
+ } | {
28889
+ input: {};
28890
+ output: {
28891
+ success: false;
28892
+ error: string;
28893
+ };
28894
+ outputFormat: "json";
28895
+ status: 400;
28896
+ };
28897
+ };
28898
+ } & {
28899
+ "/delete-workspace-picture": {
28900
+ $post: {
28901
+ input: {};
28902
+ output: {
28903
+ success: false;
28904
+ error: never;
28905
+ };
28906
+ outputFormat: "json";
28907
+ status: 400;
28908
+ } | {
28909
+ input: {};
28910
+ output: {
28911
+ success: true;
28912
+ message: string;
28913
+ };
28914
+ outputFormat: "json";
28915
+ status: import("hono/utils/http-status").ContentfulStatusCode;
28916
+ } | {
28917
+ input: {};
28918
+ output: {
28919
+ success: false;
28920
+ error: string;
28921
+ };
28922
+ outputFormat: "json";
28923
+ status: 500;
28924
+ };
28925
+ };
28926
+ } & {
28927
+ "/upload-to-service": {
27808
28928
  $post: {
27809
28929
  input: {};
27810
28930
  output: {
27811
28931
  success: false;
27812
- error: never;
28932
+ error: string;
27813
28933
  };
27814
28934
  outputFormat: "json";
27815
28935
  status: 400;
27816
28936
  } | {
27817
28937
  input: {};
27818
28938
  output: {
28939
+ success: false;
28940
+ error: string;
28941
+ };
28942
+ outputFormat: "json";
28943
+ status: 404;
28944
+ } | {
28945
+ input: {};
28946
+ output: {
28947
+ success: true;
27819
28948
  url: string;
27820
28949
  fields: {
27821
28950
  [x: string]: string;
@@ -27828,12 +28957,12 @@ declare const routes: import("hono/hono-base").HonoBase<{
27828
28957
  };
27829
28958
  };
27830
28959
  } & {
27831
- "/confirm-workspace-picture": {
28960
+ "/confirm-service-file": {
27832
28961
  $post: {
27833
28962
  input: {};
27834
28963
  output: {
27835
28964
  success: true;
27836
- url: string;
28965
+ key: string;
27837
28966
  };
27838
28967
  outputFormat: "json";
27839
28968
  status: import("hono/utils/http-status").ContentfulStatusCode;
@@ -27848,7 +28977,31 @@ declare const routes: import("hono/hono-base").HonoBase<{
27848
28977
  };
27849
28978
  };
27850
28979
  } & {
27851
- "/delete-workspace-picture": {
28980
+ "/download-from-service/:workspace/:serviceId": {
28981
+ $get: {
28982
+ input: {
28983
+ param: {
28984
+ workspace: string;
28985
+ } & {
28986
+ serviceId: string;
28987
+ };
28988
+ };
28989
+ output: {
28990
+ success: true;
28991
+ files: {
28992
+ key: string;
28993
+ filename: string;
28994
+ size: number;
28995
+ lastModified: string | null;
28996
+ downloadUrl: string;
28997
+ }[];
28998
+ };
28999
+ outputFormat: "json";
29000
+ status: import("hono/utils/http-status").ContentfulStatusCode;
29001
+ };
29002
+ };
29003
+ } & {
29004
+ "/delete-service-file": {
27852
29005
  $post: {
27853
29006
  input: {};
27854
29007
  output: {
@@ -27860,23 +29013,34 @@ declare const routes: import("hono/hono-base").HonoBase<{
27860
29013
  } | {
27861
29014
  input: {};
27862
29015
  output: {
27863
- success: true;
29016
+ success: false;
27864
29017
  message: string;
29018
+ key: string;
27865
29019
  };
27866
29020
  outputFormat: "json";
27867
- status: import("hono/utils/http-status").ContentfulStatusCode;
29021
+ status: 404;
27868
29022
  } | {
27869
29023
  input: {};
27870
29024
  output: {
27871
29025
  success: false;
27872
- error: string;
29026
+ message: string;
29027
+ key: string;
27873
29028
  };
27874
29029
  outputFormat: "json";
27875
29030
  status: 500;
29031
+ } | {
29032
+ input: {};
29033
+ output: {
29034
+ success: true;
29035
+ message: string;
29036
+ key: string;
29037
+ };
29038
+ outputFormat: "json";
29039
+ status: import("hono/utils/http-status").ContentfulStatusCode;
27876
29040
  };
27877
29041
  };
27878
29042
  } & {
27879
- "/upload-to-service": {
29043
+ "/upload-to-customer": {
27880
29044
  $post: {
27881
29045
  input: {};
27882
29046
  output: {
@@ -27909,7 +29073,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
27909
29073
  };
27910
29074
  };
27911
29075
  } & {
27912
- "/confirm-service-file": {
29076
+ "/confirm-customer-file": {
27913
29077
  $post: {
27914
29078
  input: {};
27915
29079
  output: {
@@ -27929,13 +29093,13 @@ declare const routes: import("hono/hono-base").HonoBase<{
27929
29093
  };
27930
29094
  };
27931
29095
  } & {
27932
- "/download-from-service/:workspace/:serviceId": {
29096
+ "/download-from-customer/:workspace/:customerId": {
27933
29097
  $get: {
27934
29098
  input: {
27935
29099
  param: {
27936
29100
  workspace: string;
27937
29101
  } & {
27938
- serviceId: string;
29102
+ customerId: string;
27939
29103
  };
27940
29104
  };
27941
29105
  output: {
@@ -27953,7 +29117,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
27953
29117
  };
27954
29118
  };
27955
29119
  } & {
27956
- "/delete-service-file": {
29120
+ "/delete-customer-file": {
27957
29121
  $post: {
27958
29122
  input: {};
27959
29123
  output: {
@@ -27992,12 +29156,12 @@ declare const routes: import("hono/hono-base").HonoBase<{
27992
29156
  };
27993
29157
  };
27994
29158
  } & {
27995
- "/upload-to-customer": {
29159
+ "/upload-to-finance": {
27996
29160
  $post: {
27997
29161
  input: {};
27998
29162
  output: {
27999
29163
  success: false;
28000
- error: string;
29164
+ error: never;
28001
29165
  };
28002
29166
  outputFormat: "json";
28003
29167
  status: 400;
@@ -28025,8 +29189,16 @@ declare const routes: import("hono/hono-base").HonoBase<{
28025
29189
  };
28026
29190
  };
28027
29191
  } & {
28028
- "/confirm-customer-file": {
29192
+ "/confirm-finance-file": {
28029
29193
  $post: {
29194
+ input: {};
29195
+ output: {
29196
+ success: false;
29197
+ error: string;
29198
+ };
29199
+ outputFormat: "json";
29200
+ status: 404;
29201
+ } | {
28030
29202
  input: {};
28031
29203
  output: {
28032
29204
  success: true;
@@ -28045,13 +29217,27 @@ declare const routes: import("hono/hono-base").HonoBase<{
28045
29217
  };
28046
29218
  };
28047
29219
  } & {
28048
- "/download-from-customer/:workspace/:customerId": {
29220
+ "/download-from-finance/:workspace/:transactionId": {
28049
29221
  $get: {
28050
29222
  input: {
28051
29223
  param: {
28052
29224
  workspace: string;
28053
29225
  } & {
28054
- customerId: string;
29226
+ transactionId: string;
29227
+ };
29228
+ };
29229
+ output: {
29230
+ success: false;
29231
+ error: string;
29232
+ };
29233
+ outputFormat: "json";
29234
+ status: 404;
29235
+ } | {
29236
+ input: {
29237
+ param: {
29238
+ workspace: string;
29239
+ } & {
29240
+ transactionId: string;
28055
29241
  };
28056
29242
  };
28057
29243
  output: {
@@ -28069,7 +29255,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
28069
29255
  };
28070
29256
  };
28071
29257
  } & {
28072
- "/delete-customer-file": {
29258
+ "/delete-finance-file": {
28073
29259
  $post: {
28074
29260
  input: {};
28075
29261
  output: {
@@ -28078,6 +29264,14 @@ declare const routes: import("hono/hono-base").HonoBase<{
28078
29264
  };
28079
29265
  outputFormat: "json";
28080
29266
  status: 400;
29267
+ } | {
29268
+ input: {};
29269
+ output: {
29270
+ success: false;
29271
+ error: string;
29272
+ };
29273
+ outputFormat: "json";
29274
+ status: 404;
28081
29275
  } | {
28082
29276
  input: {};
28083
29277
  output: {
@@ -29230,6 +30424,197 @@ declare const routes: import("hono/hono-base").HonoBase<{
29230
30424
  status: 200;
29231
30425
  };
29232
30426
  };
30427
+ } & {
30428
+ "/transactions/list/:workspace": {
30429
+ $get: {
30430
+ input: {
30431
+ param: {
30432
+ workspace: string;
30433
+ };
30434
+ };
30435
+ output: {
30436
+ success: false;
30437
+ error: string;
30438
+ };
30439
+ outputFormat: "json";
30440
+ status: 400;
30441
+ } | {
30442
+ input: {
30443
+ param: {
30444
+ workspace: string;
30445
+ };
30446
+ };
30447
+ output: {
30448
+ success: true;
30449
+ transactions: {
30450
+ id: string;
30451
+ workspaceId: string;
30452
+ type: FinanceTransactionType;
30453
+ customerId: string | null;
30454
+ serviceId: string | null;
30455
+ accountId: string | null;
30456
+ destinationAccountId: string | null;
30457
+ paymentMethod: string | null;
30458
+ amount: number;
30459
+ description: string | null;
30460
+ date: string;
30461
+ vat: number | null;
30462
+ reason: string | null;
30463
+ created_at: string;
30464
+ updated_at: string | null;
30465
+ }[];
30466
+ };
30467
+ outputFormat: "json";
30468
+ status: 200;
30469
+ };
30470
+ };
30471
+ } & {
30472
+ "/transactions/get/:workspace/:transactionId": {
30473
+ $get: {
30474
+ input: {
30475
+ param: {
30476
+ workspace: string;
30477
+ } & {
30478
+ transactionId: string;
30479
+ };
30480
+ };
30481
+ output: {
30482
+ success: false;
30483
+ error: string;
30484
+ };
30485
+ outputFormat: "json";
30486
+ status: 404;
30487
+ } | {
30488
+ input: {
30489
+ param: {
30490
+ workspace: string;
30491
+ } & {
30492
+ transactionId: string;
30493
+ };
30494
+ };
30495
+ output: {
30496
+ success: true;
30497
+ transaction: {
30498
+ id: string;
30499
+ workspaceId: string;
30500
+ type: FinanceTransactionType;
30501
+ customerId: string | null;
30502
+ serviceId: string | null;
30503
+ accountId: string | null;
30504
+ destinationAccountId: string | null;
30505
+ paymentMethod: string | null;
30506
+ amount: number;
30507
+ description: string | null;
30508
+ date: string;
30509
+ vat: number | null;
30510
+ reason: string | null;
30511
+ created_at: string;
30512
+ updated_at: string | null;
30513
+ };
30514
+ };
30515
+ outputFormat: "json";
30516
+ status: 200;
30517
+ };
30518
+ };
30519
+ } & {
30520
+ "/transactions/create": {
30521
+ $post: {
30522
+ input: {};
30523
+ output: {
30524
+ success: false;
30525
+ error: string;
30526
+ };
30527
+ outputFormat: "json";
30528
+ status: 400 | 404;
30529
+ } | {
30530
+ input: {};
30531
+ output: {
30532
+ success: true;
30533
+ transaction: {
30534
+ id: string;
30535
+ workspaceId: string;
30536
+ type: FinanceTransactionType;
30537
+ customerId: string | null;
30538
+ serviceId: string | null;
30539
+ accountId: string | null;
30540
+ destinationAccountId: string | null;
30541
+ paymentMethod: string | null;
30542
+ amount: number;
30543
+ description: string | null;
30544
+ date: string;
30545
+ vat: number | null;
30546
+ reason: string | null;
30547
+ created_at: string;
30548
+ updated_at: string | null;
30549
+ };
30550
+ };
30551
+ outputFormat: "json";
30552
+ status: 201;
30553
+ };
30554
+ };
30555
+ } & {
30556
+ "/transactions/update": {
30557
+ $post: {
30558
+ input: {};
30559
+ output: {
30560
+ success: false;
30561
+ error: string;
30562
+ };
30563
+ outputFormat: "json";
30564
+ status: 400 | 404;
30565
+ } | {
30566
+ input: {};
30567
+ output: {
30568
+ success: true;
30569
+ transaction: {
30570
+ id: string;
30571
+ workspaceId: string;
30572
+ type: FinanceTransactionType;
30573
+ customerId: string | null;
30574
+ serviceId: string | null;
30575
+ accountId: string | null;
30576
+ destinationAccountId: string | null;
30577
+ paymentMethod: string | null;
30578
+ amount: number;
30579
+ description: string | null;
30580
+ date: string;
30581
+ vat: number | null;
30582
+ reason: string | null;
30583
+ created_at: string;
30584
+ updated_at: string | null;
30585
+ };
30586
+ };
30587
+ outputFormat: "json";
30588
+ status: 200;
30589
+ };
30590
+ };
30591
+ } & {
30592
+ "/transactions/delete": {
30593
+ $post: {
30594
+ input: {};
30595
+ output: {
30596
+ success: false;
30597
+ error: never;
30598
+ };
30599
+ outputFormat: "json";
30600
+ status: 400;
30601
+ } | {
30602
+ input: {};
30603
+ output: {
30604
+ success: false;
30605
+ error: string;
30606
+ };
30607
+ outputFormat: "json";
30608
+ status: 404;
30609
+ } | {
30610
+ input: {};
30611
+ output: {
30612
+ success: true;
30613
+ };
30614
+ outputFormat: "json";
30615
+ status: 200;
30616
+ };
30617
+ };
29233
30618
  } & {
29234
30619
  "/visibility/:workspace": {
29235
30620
  $get: {