@vitrina/api 17.15.0 → 17.17.0

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.
package/dist/index.d.ts CHANGED
@@ -74448,6 +74448,7 @@ interface paths {
74448
74448
  query?: {
74449
74449
  q?: string;
74450
74450
  role?: "supplier" | "customer" | "both";
74451
+ sort?: "name" | "activity";
74451
74452
  limit?: number;
74452
74453
  offset?: number | null;
74453
74454
  };
@@ -74482,6 +74483,7 @@ interface paths {
74482
74483
  * "document_count": 6,
74483
74484
  * "merged_into_id": null,
74484
74485
  * "payment_terms_days": null,
74486
+ * "needs_name": false,
74485
74487
  * "payment_terms_source": null,
74486
74488
  * "created_at": "2026-10-01T14:03:00.000Z",
74487
74489
  * "updated_at": "2026-10-30T08:00:00.000Z"
@@ -74618,6 +74620,7 @@ interface paths {
74618
74620
  * "document_count": 6,
74619
74621
  * "merged_into_id": null,
74620
74622
  * "payment_terms_days": null,
74623
+ * "needs_name": false,
74621
74624
  * "payment_terms_source": null,
74622
74625
  * "created_at": "2026-10-01T14:03:00.000Z",
74623
74626
  * "updated_at": "2026-10-30T08:00:00.000Z"
@@ -74738,6 +74741,7 @@ interface paths {
74738
74741
  * "document_count": 6,
74739
74742
  * "merged_into_id": null,
74740
74743
  * "payment_terms_days": null,
74744
+ * "needs_name": false,
74741
74745
  * "payment_terms_source": null,
74742
74746
  * "created_at": "2026-10-01T14:03:00.000Z",
74743
74747
  * "updated_at": "2026-10-30T08:00:00.000Z"
@@ -74818,7 +74822,7 @@ interface paths {
74818
74822
  put?: never;
74819
74823
  /**
74820
74824
  * Merge a duplicate Contraparte into this one
74821
- * @description Merges `merge_id` into `{id}`: every movement, document and link moves to the survivor, which keeps its name and links and takes the other's links only where it has none; roles combine. When only `merge_id` has a RUT, that one is kept instead (`survivor.id` says which). Two different RUTs answer 409. Not undoable; audited. The merged one stays as a tombstone so the next sync resolves to the survivor and never recreates it. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:write`.
74825
+ * @description Merges `merge_id` into `{id}`: every movement, document and link moves to the survivor, which keeps its name and links and takes the other's links only where it has none; roles combine. When only `merge_id` has a RUT, that one is kept instead (`survivor.id` says which). Two different RUTs answer 409. Undoable: `merge_id` goes to `POST /finanzas/contrapartes/merges/{mergeId}/undo`; audited. The merged one stays as a tombstone so the next sync resolves to the survivor and never recreates it. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:write`.
74822
74826
  */
74823
74827
  post: {
74824
74828
  parameters: {
@@ -74868,11 +74872,13 @@ interface paths {
74868
74872
  * "document_count": 6,
74869
74873
  * "merged_into_id": null,
74870
74874
  * "payment_terms_days": null,
74875
+ * "needs_name": false,
74871
74876
  * "payment_terms_source": null,
74872
74877
  * "created_at": "2026-10-01T14:03:00.000Z",
74873
74878
  * "updated_at": "2026-10-30T08:00:00.000Z"
74874
74879
  * },
74875
74880
  * "merged_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a9e",
74881
+ * "merge_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4aaa",
74876
74882
  * "moved": {
74877
74883
  * "movements": 3,
74878
74884
  * "documents": 2
@@ -74947,6 +74953,673 @@ interface paths {
74947
74953
  patch?: never;
74948
74954
  trace?: never;
74949
74955
  };
74956
+ "/finanzas/contrapartes/duplicates": {
74957
+ parameters: {
74958
+ query?: never;
74959
+ header?: never;
74960
+ path?: never;
74961
+ cookie?: never;
74962
+ };
74963
+ /**
74964
+ * Proposed Contraparte duplicates («Unir duplicados»)
74965
+ * @description Pairs that look like one business or person: similar names where at least one has no RUT (same normalised name with a known RUT is merged automatically and appears in Hecho por Vitrina instead). `keep` is the one that stays (the one with a RUT, else the more active), `merge` is merged into it, `moves` says how many movements and documents move. Pairs already rejected (`dismiss`) or undone are not proposed. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`.
74966
+ */
74967
+ get: {
74968
+ parameters: {
74969
+ query?: never;
74970
+ header?: never;
74971
+ path?: never;
74972
+ cookie?: never;
74973
+ };
74974
+ requestBody?: never;
74975
+ responses: {
74976
+ /** @description The proposals */
74977
+ 200: {
74978
+ headers: {
74979
+ [name: string]: unknown;
74980
+ };
74981
+ content: {
74982
+ /**
74983
+ * @example {
74984
+ * "data": {
74985
+ * "total": 1,
74986
+ * "items": [
74987
+ * {
74988
+ * "keep": {
74989
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
74990
+ * "name": "ADOLFO CERDA ALVAREZ",
74991
+ * "rut": "14432869-8",
74992
+ * "rut_formatted": "14.432.869-8",
74993
+ * "movement_count": 1,
74994
+ * "document_count": 13
74995
+ * },
74996
+ * "merge": {
74997
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a9e",
74998
+ * "name": "Adolfo Cerda A",
74999
+ * "rut": null,
75000
+ * "rut_formatted": null,
75001
+ * "movement_count": 1,
75002
+ * "document_count": 0
75003
+ * },
75004
+ * "score": 0.9,
75005
+ * "moves": {
75006
+ * "movements": 1,
75007
+ * "documents": 0
75008
+ * }
75009
+ * }
75010
+ * ]
75011
+ * }
75012
+ * }
75013
+ */
75014
+ "application/json": {
75015
+ data: components["schemas"]["FinanzasContraparteDuplicates"];
75016
+ };
75017
+ };
75018
+ };
75019
+ /** @description Validation error */
75020
+ 400: {
75021
+ headers: {
75022
+ [name: string]: unknown;
75023
+ };
75024
+ content: {
75025
+ "application/json": components["schemas"]["Error"];
75026
+ };
75027
+ };
75028
+ /** @description Unauthorized */
75029
+ 401: {
75030
+ headers: {
75031
+ [name: string]: unknown;
75032
+ };
75033
+ content: {
75034
+ "application/json": components["schemas"]["Error"];
75035
+ };
75036
+ };
75037
+ /** @description Forbidden */
75038
+ 403: {
75039
+ headers: {
75040
+ [name: string]: unknown;
75041
+ };
75042
+ content: {
75043
+ "application/json": components["schemas"]["Error"];
75044
+ };
75045
+ };
75046
+ /** @description Not found */
75047
+ 404: {
75048
+ headers: {
75049
+ [name: string]: unknown;
75050
+ };
75051
+ content: {
75052
+ "application/json": components["schemas"]["Error"];
75053
+ };
75054
+ };
75055
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
75056
+ 409: {
75057
+ headers: {
75058
+ [name: string]: unknown;
75059
+ };
75060
+ content: {
75061
+ "application/json": components["schemas"]["Error"];
75062
+ };
75063
+ };
75064
+ /** @description Rate limited */
75065
+ 429: {
75066
+ headers: {
75067
+ [name: string]: unknown;
75068
+ };
75069
+ content: {
75070
+ "application/json": components["schemas"]["Error"];
75071
+ };
75072
+ };
75073
+ };
75074
+ };
75075
+ put?: never;
75076
+ post?: never;
75077
+ delete?: never;
75078
+ options?: never;
75079
+ head?: never;
75080
+ patch?: never;
75081
+ trace?: never;
75082
+ };
75083
+ "/finanzas/contrapartes/duplicates/merge": {
75084
+ parameters: {
75085
+ query?: never;
75086
+ header?: never;
75087
+ path?: never;
75088
+ cookie?: never;
75089
+ };
75090
+ get?: never;
75091
+ put?: never;
75092
+ /**
75093
+ * Accept a proposed duplicate: merge it (undoable)
75094
+ * @description Same as `POST /finanzas/contrapartes/{id}/merge` (`keep_id` = the path id) but recorded as a review merge. Reversible: it shows in Hecho por Vitrina with «Deshacer» and `merge_id` can be passed to `POST /finanzas/contrapartes/merges/{mergeId}/undo`. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:write`.
75095
+ */
75096
+ post: {
75097
+ parameters: {
75098
+ query?: never;
75099
+ header?: {
75100
+ /** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
75101
+ "Idempotency-Key"?: string;
75102
+ };
75103
+ path?: never;
75104
+ cookie?: never;
75105
+ };
75106
+ requestBody?: {
75107
+ content: {
75108
+ /**
75109
+ * @example {
75110
+ * "keep_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
75111
+ * "merge_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a9e"
75112
+ * }
75113
+ */
75114
+ "application/json": components["schemas"]["FinanzasContraparteDuplicateMergeBody"];
75115
+ };
75116
+ };
75117
+ responses: {
75118
+ /** @description The merge */
75119
+ 200: {
75120
+ headers: {
75121
+ [name: string]: unknown;
75122
+ };
75123
+ content: {
75124
+ /**
75125
+ * @example {
75126
+ * "data": {
75127
+ * "survivor": {
75128
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
75129
+ * "name": "Insumos Médicos Ejemplo SpA",
75130
+ * "rut": "76123456-7",
75131
+ * "rut_formatted": "76.123.456-7",
75132
+ * "roles": [
75133
+ * "supplier"
75134
+ * ],
75135
+ * "source": "movement",
75136
+ * "contact": null,
75137
+ * "clinic_patient": null,
75138
+ * "is_payroll": false,
75139
+ * "movement_count": 14,
75140
+ * "document_count": 6,
75141
+ * "merged_into_id": null,
75142
+ * "payment_terms_days": null,
75143
+ * "needs_name": false,
75144
+ * "payment_terms_source": null,
75145
+ * "created_at": "2026-10-01T14:03:00.000Z",
75146
+ * "updated_at": "2026-10-30T08:00:00.000Z"
75147
+ * },
75148
+ * "merged_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a9e",
75149
+ * "merge_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4aaa",
75150
+ * "moved": {
75151
+ * "movements": 1,
75152
+ * "documents": 0
75153
+ * }
75154
+ * }
75155
+ * }
75156
+ */
75157
+ "application/json": {
75158
+ data: components["schemas"]["FinanzasContraparteMergeResult"];
75159
+ };
75160
+ };
75161
+ };
75162
+ /** @description Validation error */
75163
+ 400: {
75164
+ headers: {
75165
+ [name: string]: unknown;
75166
+ };
75167
+ content: {
75168
+ "application/json": components["schemas"]["Error"];
75169
+ };
75170
+ };
75171
+ /** @description Unauthorized */
75172
+ 401: {
75173
+ headers: {
75174
+ [name: string]: unknown;
75175
+ };
75176
+ content: {
75177
+ "application/json": components["schemas"]["Error"];
75178
+ };
75179
+ };
75180
+ /** @description Forbidden */
75181
+ 403: {
75182
+ headers: {
75183
+ [name: string]: unknown;
75184
+ };
75185
+ content: {
75186
+ "application/json": components["schemas"]["Error"];
75187
+ };
75188
+ };
75189
+ /** @description Not found */
75190
+ 404: {
75191
+ headers: {
75192
+ [name: string]: unknown;
75193
+ };
75194
+ content: {
75195
+ "application/json": components["schemas"]["Error"];
75196
+ };
75197
+ };
75198
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
75199
+ 409: {
75200
+ headers: {
75201
+ [name: string]: unknown;
75202
+ };
75203
+ content: {
75204
+ "application/json": components["schemas"]["Error"];
75205
+ };
75206
+ };
75207
+ /** @description Rate limited */
75208
+ 429: {
75209
+ headers: {
75210
+ [name: string]: unknown;
75211
+ };
75212
+ content: {
75213
+ "application/json": components["schemas"]["Error"];
75214
+ };
75215
+ };
75216
+ };
75217
+ };
75218
+ delete?: never;
75219
+ options?: never;
75220
+ head?: never;
75221
+ patch?: never;
75222
+ trace?: never;
75223
+ };
75224
+ "/finanzas/contrapartes/duplicates/dismiss": {
75225
+ parameters: {
75226
+ query?: never;
75227
+ header?: never;
75228
+ path?: never;
75229
+ cookie?: never;
75230
+ };
75231
+ get?: never;
75232
+ put?: never;
75233
+ /**
75234
+ * Reject a proposed duplicate («No son la misma»)
75235
+ * @description The two are different: the pair is never proposed again and never merged automatically. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:write`.
75236
+ */
75237
+ post: {
75238
+ parameters: {
75239
+ query?: never;
75240
+ header?: {
75241
+ /** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
75242
+ "Idempotency-Key"?: string;
75243
+ };
75244
+ path?: never;
75245
+ cookie?: never;
75246
+ };
75247
+ requestBody?: {
75248
+ content: {
75249
+ /**
75250
+ * @example {
75251
+ * "a_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
75252
+ * "b_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a9e"
75253
+ * }
75254
+ */
75255
+ "application/json": components["schemas"]["FinanzasContraparteDuplicateDismissBody"];
75256
+ };
75257
+ };
75258
+ responses: {
75259
+ /** @description Dismissed */
75260
+ 200: {
75261
+ headers: {
75262
+ [name: string]: unknown;
75263
+ };
75264
+ content: {
75265
+ /**
75266
+ * @example {
75267
+ * "data": {
75268
+ * "a_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
75269
+ * "b_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a9e",
75270
+ * "dismissed": true
75271
+ * }
75272
+ * }
75273
+ */
75274
+ "application/json": {
75275
+ data: {
75276
+ a_id: string;
75277
+ b_id: string;
75278
+ dismissed: boolean;
75279
+ };
75280
+ };
75281
+ };
75282
+ };
75283
+ /** @description Validation error */
75284
+ 400: {
75285
+ headers: {
75286
+ [name: string]: unknown;
75287
+ };
75288
+ content: {
75289
+ "application/json": components["schemas"]["Error"];
75290
+ };
75291
+ };
75292
+ /** @description Unauthorized */
75293
+ 401: {
75294
+ headers: {
75295
+ [name: string]: unknown;
75296
+ };
75297
+ content: {
75298
+ "application/json": components["schemas"]["Error"];
75299
+ };
75300
+ };
75301
+ /** @description Forbidden */
75302
+ 403: {
75303
+ headers: {
75304
+ [name: string]: unknown;
75305
+ };
75306
+ content: {
75307
+ "application/json": components["schemas"]["Error"];
75308
+ };
75309
+ };
75310
+ /** @description Not found */
75311
+ 404: {
75312
+ headers: {
75313
+ [name: string]: unknown;
75314
+ };
75315
+ content: {
75316
+ "application/json": components["schemas"]["Error"];
75317
+ };
75318
+ };
75319
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
75320
+ 409: {
75321
+ headers: {
75322
+ [name: string]: unknown;
75323
+ };
75324
+ content: {
75325
+ "application/json": components["schemas"]["Error"];
75326
+ };
75327
+ };
75328
+ /** @description Rate limited */
75329
+ 429: {
75330
+ headers: {
75331
+ [name: string]: unknown;
75332
+ };
75333
+ content: {
75334
+ "application/json": components["schemas"]["Error"];
75335
+ };
75336
+ };
75337
+ };
75338
+ };
75339
+ delete?: never;
75340
+ options?: never;
75341
+ head?: never;
75342
+ patch?: never;
75343
+ trace?: never;
75344
+ };
75345
+ "/finanzas/contrapartes/merges": {
75346
+ parameters: {
75347
+ query?: never;
75348
+ header?: never;
75349
+ path?: never;
75350
+ cookie?: never;
75351
+ };
75352
+ /**
75353
+ * Contrapartes merged in a month («Contrapartes unidas»)
75354
+ * @description Every merge of the month (Santiago), automatic or by a person, newest first, with `undoable` and `undone_at`. The same list rides on `GET /finanzas/automatic-actions` as `contraparte_merges`. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`.
75355
+ */
75356
+ get: {
75357
+ parameters: {
75358
+ query: {
75359
+ month: string;
75360
+ };
75361
+ header?: never;
75362
+ path?: never;
75363
+ cookie?: never;
75364
+ };
75365
+ requestBody?: never;
75366
+ responses: {
75367
+ /** @description The merges */
75368
+ 200: {
75369
+ headers: {
75370
+ [name: string]: unknown;
75371
+ };
75372
+ content: {
75373
+ /**
75374
+ * @example {
75375
+ * "data": [
75376
+ * {
75377
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4aaa",
75378
+ * "origin": "same_name",
75379
+ * "actor": "system",
75380
+ * "label": "Alldental → ALLDENTAL SPA",
75381
+ * "survivor": {
75382
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
75383
+ * "name": "ALLDENTAL SPA"
75384
+ * },
75385
+ * "merged": {
75386
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a9e",
75387
+ * "name": "Alldental"
75388
+ * },
75389
+ * "moved": {
75390
+ * "movements": 0,
75391
+ * "documents": 1
75392
+ * },
75393
+ * "reason": "Mismo nombre y un RUT conocido",
75394
+ * "created_at": "2026-11-07T14:03:00.000Z",
75395
+ * "undone_at": null,
75396
+ * "undoable": true
75397
+ * }
75398
+ * ]
75399
+ * }
75400
+ */
75401
+ "application/json": {
75402
+ data: components["schemas"]["FinanzasContraparteMergeView"][];
75403
+ };
75404
+ };
75405
+ };
75406
+ /** @description Validation error */
75407
+ 400: {
75408
+ headers: {
75409
+ [name: string]: unknown;
75410
+ };
75411
+ content: {
75412
+ "application/json": components["schemas"]["Error"];
75413
+ };
75414
+ };
75415
+ /** @description Unauthorized */
75416
+ 401: {
75417
+ headers: {
75418
+ [name: string]: unknown;
75419
+ };
75420
+ content: {
75421
+ "application/json": components["schemas"]["Error"];
75422
+ };
75423
+ };
75424
+ /** @description Forbidden */
75425
+ 403: {
75426
+ headers: {
75427
+ [name: string]: unknown;
75428
+ };
75429
+ content: {
75430
+ "application/json": components["schemas"]["Error"];
75431
+ };
75432
+ };
75433
+ /** @description Not found */
75434
+ 404: {
75435
+ headers: {
75436
+ [name: string]: unknown;
75437
+ };
75438
+ content: {
75439
+ "application/json": components["schemas"]["Error"];
75440
+ };
75441
+ };
75442
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
75443
+ 409: {
75444
+ headers: {
75445
+ [name: string]: unknown;
75446
+ };
75447
+ content: {
75448
+ "application/json": components["schemas"]["Error"];
75449
+ };
75450
+ };
75451
+ /** @description Rate limited */
75452
+ 429: {
75453
+ headers: {
75454
+ [name: string]: unknown;
75455
+ };
75456
+ content: {
75457
+ "application/json": components["schemas"]["Error"];
75458
+ };
75459
+ };
75460
+ };
75461
+ };
75462
+ put?: never;
75463
+ post?: never;
75464
+ delete?: never;
75465
+ options?: never;
75466
+ head?: never;
75467
+ patch?: never;
75468
+ trace?: never;
75469
+ };
75470
+ "/finanzas/contrapartes/merges/{mergeId}/undo": {
75471
+ parameters: {
75472
+ query?: never;
75473
+ header?: never;
75474
+ path?: never;
75475
+ cookie?: never;
75476
+ };
75477
+ get?: never;
75478
+ put?: never;
75479
+ /**
75480
+ * Undo a Contraparte merge («Deshacer»)
75481
+ * @description Puts back on the original Contraparte exactly the movements, documents, rules and aliases the merge moved (not what a person moved since), restores its links, and makes it live again. The pair is not merged automatically again. 409 when already undone or when the survivor was merged away since (undo that one first). Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:write`.
75482
+ */
75483
+ post: {
75484
+ parameters: {
75485
+ query?: never;
75486
+ header?: {
75487
+ /** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
75488
+ "Idempotency-Key"?: string;
75489
+ };
75490
+ path: {
75491
+ mergeId: string;
75492
+ };
75493
+ cookie?: never;
75494
+ };
75495
+ requestBody?: never;
75496
+ responses: {
75497
+ /** @description The undo */
75498
+ 200: {
75499
+ headers: {
75500
+ [name: string]: unknown;
75501
+ };
75502
+ content: {
75503
+ /**
75504
+ * @example {
75505
+ * "data": {
75506
+ * "merge_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4aaa",
75507
+ * "survivor": {
75508
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
75509
+ * "name": "Insumos Médicos Ejemplo SpA",
75510
+ * "rut": "76123456-7",
75511
+ * "rut_formatted": "76.123.456-7",
75512
+ * "roles": [
75513
+ * "supplier"
75514
+ * ],
75515
+ * "source": "movement",
75516
+ * "contact": null,
75517
+ * "clinic_patient": null,
75518
+ * "is_payroll": false,
75519
+ * "movement_count": 14,
75520
+ * "document_count": 6,
75521
+ * "merged_into_id": null,
75522
+ * "payment_terms_days": null,
75523
+ * "needs_name": false,
75524
+ * "payment_terms_source": null,
75525
+ * "created_at": "2026-10-01T14:03:00.000Z",
75526
+ * "updated_at": "2026-10-30T08:00:00.000Z"
75527
+ * },
75528
+ * "restored": {
75529
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
75530
+ * "name": "Alldental",
75531
+ * "rut": "76123456-7",
75532
+ * "rut_formatted": "76.123.456-7",
75533
+ * "roles": [
75534
+ * "supplier"
75535
+ * ],
75536
+ * "source": "movement",
75537
+ * "contact": null,
75538
+ * "clinic_patient": null,
75539
+ * "is_payroll": false,
75540
+ * "movement_count": 14,
75541
+ * "document_count": 6,
75542
+ * "merged_into_id": null,
75543
+ * "payment_terms_days": null,
75544
+ * "needs_name": false,
75545
+ * "payment_terms_source": null,
75546
+ * "created_at": "2026-10-01T14:03:00.000Z",
75547
+ * "updated_at": "2026-10-30T08:00:00.000Z"
75548
+ * },
75549
+ * "moved_back": {
75550
+ * "movements": 0,
75551
+ * "documents": 1
75552
+ * }
75553
+ * }
75554
+ * }
75555
+ */
75556
+ "application/json": {
75557
+ data: components["schemas"]["FinanzasContraparteUndoMergeResult"];
75558
+ };
75559
+ };
75560
+ };
75561
+ /** @description Validation error */
75562
+ 400: {
75563
+ headers: {
75564
+ [name: string]: unknown;
75565
+ };
75566
+ content: {
75567
+ "application/json": components["schemas"]["Error"];
75568
+ };
75569
+ };
75570
+ /** @description Unauthorized */
75571
+ 401: {
75572
+ headers: {
75573
+ [name: string]: unknown;
75574
+ };
75575
+ content: {
75576
+ "application/json": components["schemas"]["Error"];
75577
+ };
75578
+ };
75579
+ /** @description Forbidden */
75580
+ 403: {
75581
+ headers: {
75582
+ [name: string]: unknown;
75583
+ };
75584
+ content: {
75585
+ "application/json": components["schemas"]["Error"];
75586
+ };
75587
+ };
75588
+ /** @description Not found */
75589
+ 404: {
75590
+ headers: {
75591
+ [name: string]: unknown;
75592
+ };
75593
+ content: {
75594
+ "application/json": components["schemas"]["Error"];
75595
+ };
75596
+ };
75597
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
75598
+ 409: {
75599
+ headers: {
75600
+ [name: string]: unknown;
75601
+ };
75602
+ content: {
75603
+ "application/json": components["schemas"]["Error"];
75604
+ };
75605
+ };
75606
+ /** @description Rate limited */
75607
+ 429: {
75608
+ headers: {
75609
+ [name: string]: unknown;
75610
+ };
75611
+ content: {
75612
+ "application/json": components["schemas"]["Error"];
75613
+ };
75614
+ };
75615
+ };
75616
+ };
75617
+ delete?: never;
75618
+ options?: never;
75619
+ head?: never;
75620
+ patch?: never;
75621
+ trace?: never;
75622
+ };
74950
75623
  "/finanzas/contrapartes/{id}/overview": {
74951
75624
  parameters: {
74952
75625
  query?: never;
@@ -83080,7 +83753,7 @@ interface paths {
83080
83753
  };
83081
83754
  /**
83082
83755
  * The «Por resolver» inbox: open cases, biggest first
83083
- * @description A case is the open money of one Contraparte that Vitrina could not resolve on its own: bank movements nothing explains, cost documents with no account, and money out classified with no document («Falta documento»). Cases are recomputed after every bank, Mercado Pago and SII sync and before every read; only cases whose inputs changed are rewritten. Sorted by the money at stake (`order=needs_person`: the cases a person must answer first). `kind`, `month` (`YYYY-MM`: a case belongs to ONE month, its oldest item's) and `period` (deprecated: `recent` / `history`) filter; `total` and `amount_at_stake_clp` cover every open case of that filter, `counts_by_month` lists every month with open cases (the month filter's options; months «Cerrado en Chipax» hold none), `counts` splits them (needs_person / ready) and `waiting` lists the payments «esperando factura» (no case yet). Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`.
83756
+ * @description A case is the open money of one Contraparte that Vitrina could not resolve on its own: bank movements nothing explains, cost documents with no account, and money out classified with no document («Falta documento»). Cases are recomputed after every bank, Mercado Pago and SII sync and before every read; only cases whose inputs changed are rewritten. Sorted by the money at stake (`order=needs_person`: the cases a person must answer first). `kind`, `month` (`YYYY-MM`: a case belongs to ONE month, its oldest item's) and `period` (deprecated: `recent` / `history`) filter; `total` and `amount_at_stake_clp` cover every open case of that filter, `counts_by_month` lists every month with open cases (the month filter's options; months «Cerrado antes de Vitrina» hold none), `counts` splits them (needs_person / ready) and `waiting` lists the payments «esperando factura» (no case yet). Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`.
83084
83757
  */
83085
83758
  get: {
83086
83759
  parameters: {
@@ -84600,7 +85273,7 @@ interface paths {
84600
85273
  };
84601
85274
  /**
84602
85275
  * Cierre de mes: each month and its state
84603
- * @description The month selector, newest first: `open` (a «Por resolver» case belongs to the month, or it has not ended), `ready_to_close` (ended, nothing open), `closed` (a person closed it) or `closed_imported` («Cerrado en Chipax»: the import closed it; it raises no cases and a change asks for a reason; `closed_source` `chipax`, `imported_at`). A case belongs to ONE month: the one of its oldest item (a movement, or a document to classify). Default: the current month and the 11 before; at most 24. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`.
85276
+ * @description The month selector, newest first: `open` (a «Por resolver» case belongs to the month, or it has not ended), `ready_to_close` (ended, nothing open), `closed` (a person closed it) or `closed_imported` («Cerrado antes de Vitrina»: the import closed it; it raises no cases and a change asks for a reason; `closed_source` `chipax`, `imported_at`). A case belongs to ONE month: the one of its oldest item (a movement, or a document to classify). Default: the current month and the 11 before; at most 24. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`.
84604
85277
  */
84605
85278
  get: {
84606
85279
  parameters: {
@@ -90349,6 +91022,10 @@ interface paths {
90349
91022
  state: "todo" | "done" | "problem";
90350
91023
  /** @description The workspace keeps a Mercado Pago account (e.g. from a Chipax import) or has a Mercado Pago connection: only then is the optional «Mercado Pago» row shown and counted. Never part of `onboarding.mode` `done`. */
90351
91024
  relevant: boolean;
91025
+ /** @description The workspace shows signs of using Mercado Pago: an account, a connection, or bank movements from any source naming it. With `state` `todo` and no `dismissed_at`, Resumen keeps a card with just this row. */
91026
+ evidence: boolean;
91027
+ /** @description When «Descartar» was pressed (`dismiss_mercado_pago`). Permanent per workspace; an unconnected, dismissed row is no longer `relevant`. */
91028
+ dismissed_at: string | null;
90352
91029
  nickname: string | null;
90353
91030
  connected_at: string | null;
90354
91031
  };
@@ -91117,6 +91794,10 @@ interface paths {
91117
91794
  state: "todo" | "done" | "problem";
91118
91795
  /** @description The workspace keeps a Mercado Pago account (e.g. from a Chipax import) or has a Mercado Pago connection: only then is the optional «Mercado Pago» row shown and counted. Never part of `onboarding.mode` `done`. */
91119
91796
  relevant: boolean;
91797
+ /** @description The workspace shows signs of using Mercado Pago: an account, a connection, or bank movements from any source naming it. With `state` `todo` and no `dismissed_at`, Resumen keeps a card with just this row. */
91798
+ evidence: boolean;
91799
+ /** @description When «Descartar» was pressed (`dismiss_mercado_pago`). Permanent per workspace; an unconnected, dismissed row is no longer `relevant`. */
91800
+ dismissed_at: string | null;
91120
91801
  nickname: string | null;
91121
91802
  connected_at: string | null;
91122
91803
  };
@@ -91254,7 +91935,7 @@ interface paths {
91254
91935
  put?: never;
91255
91936
  /**
91256
91937
  * Onboarding state: start, defer, or «no recibe boletas de honorarios»
91257
- * @description Per workspace. `start` keeps the guided start while things get connected; `defer` («Lo hago después») collapses it to the checklist on Resumen; `no_honorarios` marks the honorarios step skipped (409 while honorarios documents are on record); `has_honorarios` undoes it. Answers the setup. Requires the `finanzas` add-on (402 `ENTITLEMENT_NOT_ACTIVE` otherwise). Requires `finanzas_admin:write`.
91938
+ * @description Per workspace. `start` keeps the guided start while things get connected; `defer` («Lo hago después») collapses it to the checklist on Resumen; `no_honorarios` marks the honorarios step skipped (409 while honorarios documents are on record); `has_honorarios` undoes it; `dismiss_mercado_pago` hides the optional Mercado Pago card for good (per workspace, every device). Answers the setup. Requires the `finanzas` add-on (402 `ENTITLEMENT_NOT_ACTIVE` otherwise). Requires `finanzas_admin:write`.
91258
91939
  */
91259
91940
  post: {
91260
91941
  parameters: {
@@ -91275,7 +91956,7 @@ interface paths {
91275
91956
  */
91276
91957
  "application/json": {
91277
91958
  /** @enum {string} */
91278
- action: "start" | "defer" | "no_honorarios" | "has_honorarios";
91959
+ action: "start" | "defer" | "no_honorarios" | "has_honorarios" | "dismiss_mercado_pago";
91279
91960
  };
91280
91961
  };
91281
91962
  };
@@ -91371,6 +92052,10 @@ interface paths {
91371
92052
  state: "todo" | "done" | "problem";
91372
92053
  /** @description The workspace keeps a Mercado Pago account (e.g. from a Chipax import) or has a Mercado Pago connection: only then is the optional «Mercado Pago» row shown and counted. Never part of `onboarding.mode` `done`. */
91373
92054
  relevant: boolean;
92055
+ /** @description The workspace shows signs of using Mercado Pago: an account, a connection, or bank movements from any source naming it. With `state` `todo` and no `dismissed_at`, Resumen keeps a card with just this row. */
92056
+ evidence: boolean;
92057
+ /** @description When «Descartar» was pressed (`dismiss_mercado_pago`). Permanent per workspace; an unconnected, dismissed row is no longer `relevant`. */
92058
+ dismissed_at: string | null;
91374
92059
  nickname: string | null;
91375
92060
  connected_at: string | null;
91376
92061
  };
@@ -279297,6 +279982,8 @@ interface components {
279297
279982
  merged_into_id: string | null;
279298
279983
  /** @description Its own payment terms in days (0–365); null = the workspace default of each document class (Ajustes › Plazos de pago). */
279299
279984
  payment_terms_days: number | null;
279985
+ /** @description True while the name is only the RUT (no document has told us the razón social yet): show «Sin nombre aún» + the RUT, never the RUT as a title. */
279986
+ needs_name: boolean;
279300
279987
  /**
279301
279988
  * @description Where `payment_terms_days` came from: chipax (the importer read it) or manual (a person set it); null when it has no terms of its own.
279302
279989
  * @enum {string|null}
@@ -279315,6 +280002,8 @@ interface components {
279315
280002
  FinanzasContraparteMergeResult: {
279316
280003
  survivor: components["schemas"]["FinanzasContraparte"];
279317
280004
  merged_id: string;
280005
+ /** @description The merge ledger id: `POST /finanzas/contrapartes/merges/{mergeId}/undo` undoes it. */
280006
+ merge_id: string;
279318
280007
  moved: {
279319
280008
  movements: number;
279320
280009
  documents: number;
@@ -279327,6 +280016,89 @@ interface components {
279327
280016
  */
279328
280017
  merge_id: string;
279329
280018
  };
280019
+ FinanzasContraparteDuplicatePair: {
280020
+ /** @description The one that stays. */
280021
+ keep: {
280022
+ /** Format: uuid */
280023
+ id: string;
280024
+ name: string;
280025
+ rut: string | null;
280026
+ rut_formatted: string | null;
280027
+ movement_count: number;
280028
+ document_count: number;
280029
+ };
280030
+ /** @description The one that is merged into `keep`. */
280031
+ merge: {
280032
+ /** Format: uuid */
280033
+ id: string;
280034
+ name: string;
280035
+ rut: string | null;
280036
+ rut_formatted: string | null;
280037
+ movement_count: number;
280038
+ document_count: number;
280039
+ };
280040
+ score: number;
280041
+ /** @description What moves to `keep`. */
280042
+ moves: {
280043
+ movements: number;
280044
+ documents: number;
280045
+ };
280046
+ };
280047
+ FinanzasContraparteDuplicates: {
280048
+ /** @description Every proposed pair; `items` holds the first 200. */
280049
+ total: number;
280050
+ items: components["schemas"]["FinanzasContraparteDuplicatePair"][];
280051
+ };
280052
+ FinanzasContraparteDuplicateMergeBody: {
280053
+ /** Format: uuid */
280054
+ keep_id: string;
280055
+ /** Format: uuid */
280056
+ merge_id: string;
280057
+ };
280058
+ FinanzasContraparteDuplicateDismissBody: {
280059
+ /** Format: uuid */
280060
+ a_id: string;
280061
+ /** Format: uuid */
280062
+ b_id: string;
280063
+ };
280064
+ FinanzasContraparteMergeView: {
280065
+ /** Format: uuid */
280066
+ id: string;
280067
+ /** @enum {string} */
280068
+ origin: "same_rut" | "same_name" | "review" | "manual";
280069
+ /** @enum {string} */
280070
+ actor: "system" | "person";
280071
+ /** @example Adolfo Cerda A → ADOLFO CERDA ALVAREZ */
280072
+ label: string;
280073
+ survivor: {
280074
+ /** Format: uuid */
280075
+ id: string;
280076
+ name: string;
280077
+ };
280078
+ merged: {
280079
+ /** Format: uuid */
280080
+ id: string;
280081
+ name: string;
280082
+ };
280083
+ moved: {
280084
+ movements: number;
280085
+ documents: number;
280086
+ };
280087
+ reason: string | null;
280088
+ created_at: string;
280089
+ undone_at: string | null;
280090
+ undoable: boolean;
280091
+ };
280092
+ FinanzasContraparteUndoMergeResult: {
280093
+ /** Format: uuid */
280094
+ merge_id: string;
280095
+ survivor: components["schemas"]["FinanzasContraparte"];
280096
+ restored: components["schemas"]["FinanzasContraparte"];
280097
+ moved_back: {
280098
+ movements: number;
280099
+ documents: number;
280100
+ };
280101
+ };
279330
280102
  FinanzasContraparteTerms: {
279331
280103
  /** @description Its own terms; null = the workspace default per class. */
279332
280104
  days: number | null;
@@ -280637,7 +281409,7 @@ interface components {
280637
281409
  amount_at_stake_clp: number;
280638
281410
  /** @description First day of last month: `period=recent` keeps the cases touching it or later; older ones are «Historial». */
280639
281411
  since: string;
280640
- /** @description Open cases per month, newest first, all kinds, ignoring `kind`/`month`/`period`: the month filter’s options (the sum is the open total every surface shows). Months «Cerrado en Chipax» are never listed: they hold no case. */
281412
+ /** @description Open cases per month, newest first, all kinds, ignoring `kind`/`month`/`period`: the month filter’s options (the sum is the open total every surface shows). Months «Cerrado antes de Vitrina» are never listed: they hold no case. */
280641
281413
  counts_by_month: {
280642
281414
  /** @description `YYYY-MM`. */
280643
281415
  month: string;
@@ -280949,6 +281721,8 @@ interface components {
280949
281721
  match: number;
280950
281722
  ai: number;
280951
281723
  };
281724
+ /** @description Contrapartes Vitrina (or a person) merged this month, newest first: «Contrapartes unidas» with «Deshacer» (`undoable`) in Hecho por Vitrina. */
281725
+ contraparte_merges: components["schemas"]["FinanzasContraparteMergeView"][];
280952
281726
  rules_created: {
280953
281727
  /** Format: uuid */
280954
281728
  id: string;
@@ -281013,7 +281787,7 @@ interface components {
281013
281787
  /** @description «septiembre 2026». */
281014
281788
  label: string;
281015
281789
  /**
281016
- * @description open = abierto (cases touch it, or it has not ended); ready_to_close = listo para cerrar; closed = cerrado por una persona; closed_imported = «Cerrado en Chipax» (the import closed it: it raises no cases, a change asks for a reason, there is nothing to close).
281790
+ * @description open = abierto (cases touch it, or it has not ended); ready_to_close = listo para cerrar; closed = cerrado por una persona; closed_imported = «Cerrado antes de Vitrina» (the import closed it: it raises no cases, a change asks for a reason, there is nothing to close).
281017
281791
  * @enum {string}
281018
281792
  */
281019
281793
  state: "open" | "ready_to_close" | "closed" | "closed_imported";
@@ -281022,7 +281796,7 @@ interface components {
281022
281796
  closed_at: string | null;
281023
281797
  closed_by: string | null;
281024
281798
  /**
281025
- * @description Who closed the month: `person` («Cerrar mes») or `chipax` (the import: «Cerrado en Chipax»). Null while open.
281799
+ * @description Who closed the month: `person` («Cerrar mes») or `chipax` (the import: «Cerrado antes de Vitrina»). Null while open.
281026
281800
  * @enum {string|null}
281027
281801
  */
281028
281802
  closed_source: "person" | "chipax" | null;
@@ -281040,7 +281814,7 @@ interface components {
281040
281814
  /** @description «septiembre 2026». */
281041
281815
  label: string;
281042
281816
  /**
281043
- * @description open = abierto (cases touch it, or it has not ended); ready_to_close = listo para cerrar; closed = cerrado por una persona; closed_imported = «Cerrado en Chipax» (the import closed it: it raises no cases, a change asks for a reason, there is nothing to close).
281817
+ * @description open = abierto (cases touch it, or it has not ended); ready_to_close = listo para cerrar; closed = cerrado por una persona; closed_imported = «Cerrado antes de Vitrina» (the import closed it: it raises no cases, a change asks for a reason, there is nothing to close).
281044
281818
  * @enum {string}
281045
281819
  */
281046
281820
  state: "open" | "ready_to_close" | "closed" | "closed_imported";
@@ -281049,7 +281823,7 @@ interface components {
281049
281823
  closed_at: string | null;
281050
281824
  closed_by: string | null;
281051
281825
  /**
281052
- * @description Who closed the month: `person` («Cerrar mes») or `chipax` (the import: «Cerrado en Chipax»). Null while open.
281826
+ * @description Who closed the month: `person` («Cerrar mes») or `chipax` (the import: «Cerrado antes de Vitrina»). Null while open.
281053
281827
  * @enum {string|null}
281054
281828
  */
281055
281829
  closed_source: "person" | "chipax" | null;