@vitrina/api 17.16.0 → 17.18.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.cts CHANGED
@@ -72493,6 +72493,7 @@ interface paths {
72493
72493
  * "description": null,
72494
72494
  * "kind": "gasto",
72495
72495
  * "behavior": "fijo",
72496
+ * "no_document": false,
72496
72497
  * "position": 2,
72497
72498
  * "depth": 1,
72498
72499
  * "path": "Gastos de administración",
@@ -72509,6 +72510,7 @@ interface paths {
72509
72510
  * "description": "Arriendo mensual de la oficina central.",
72510
72511
  * "kind": "gasto",
72511
72512
  * "behavior": "fijo",
72513
+ * "no_document": false,
72512
72514
  * "position": 0,
72513
72515
  * "depth": 2,
72514
72516
  * "path": "Gastos de administración > Arriendo de oficina",
@@ -72626,6 +72628,7 @@ interface paths {
72626
72628
  * "description": "Arriendo mensual de la oficina central.",
72627
72629
  * "kind": "gasto",
72628
72630
  * "behavior": "fijo",
72631
+ * "no_document": false,
72629
72632
  * "position": 0,
72630
72633
  * "depth": 2,
72631
72634
  * "path": "Gastos de administración > Arriendo de oficina",
@@ -72796,7 +72799,7 @@ interface paths {
72796
72799
  head?: never;
72797
72800
  /**
72798
72801
  * Rename, move or retag an account
72799
- * @description Change `name`, `description`, `behavior` (costo and gasto only), `position` (order among siblings) or move the account with `parent_id` (`null` = top level). A move keeps the account’s id, so every classification follows it; it is refused under itself or its sub-accounts (`cycle`), under another kind (`kind_mismatch`) or beyond 5 levels (`too_deep`). The kind itself never changes. An archived account cannot be edited. The plan de cuentas is a classification tree, not double-entry. Each account has a `kind` (`ingreso`, `costo`, `gasto` or `no_operacional`) and, on `costo` and `gasto` only, a `behavior` (`fijo` or `variable`). A sub-account has its parent’s kind. Rule breaks answer `422 FINANZAS_ACCOUNT_INVALID` and state conflicts `409 FINANZAS_ACCOUNT_CONFLICT`, both with `details.reason`. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas_admin:write`.
72802
+ * @description Change `name`, `description`, `behavior` (costo and gasto only), `no_document` («No lleva documento»: the account opens no «Falta documento» case and its money out is not counted in «Egresos sin documento»), `position` (order among siblings) or move the account with `parent_id` (`null` = top level). A move keeps the account’s id, so every classification follows it; it is refused under itself or its sub-accounts (`cycle`), under another kind (`kind_mismatch`) or beyond 5 levels (`too_deep`). The kind itself never changes. An archived account cannot be edited. The plan de cuentas is a classification tree, not double-entry. Each account has a `kind` (`ingreso`, `costo`, `gasto` or `no_operacional`) and, on `costo` and `gasto` only, a `behavior` (`fijo` or `variable`). A sub-account has its parent’s kind. Rule breaks answer `422 FINANZAS_ACCOUNT_INVALID` and state conflicts `409 FINANZAS_ACCOUNT_CONFLICT`, both with `details.reason`. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas_admin:write`.
72800
72803
  */
72801
72804
  patch: {
72802
72805
  parameters: {
@@ -72834,6 +72837,7 @@ interface paths {
72834
72837
  * "description": "Arriendo mensual de la oficina central.",
72835
72838
  * "kind": "gasto",
72836
72839
  * "behavior": "fijo",
72840
+ * "no_document": false,
72837
72841
  * "position": 1,
72838
72842
  * "depth": 2,
72839
72843
  * "path": "Gastos de administración > Arriendo de oficina",
@@ -72950,6 +72954,7 @@ interface paths {
72950
72954
  * "description": "Arriendo mensual de la oficina central.",
72951
72955
  * "kind": "gasto",
72952
72956
  * "behavior": "fijo",
72957
+ * "no_document": false,
72953
72958
  * "position": 0,
72954
72959
  * "depth": 2,
72955
72960
  * "path": "Gastos de administración > Arriendo de oficina",
@@ -73070,6 +73075,7 @@ interface paths {
73070
73075
  * "description": "Arriendo mensual de la oficina central.",
73071
73076
  * "kind": "gasto",
73072
73077
  * "behavior": "fijo",
73078
+ * "no_document": false,
73073
73079
  * "position": 0,
73074
73080
  * "depth": 2,
73075
73081
  * "path": "Gastos de administración > Arriendo de oficina",
@@ -74448,6 +74454,7 @@ interface paths {
74448
74454
  query?: {
74449
74455
  q?: string;
74450
74456
  role?: "supplier" | "customer" | "both";
74457
+ sort?: "name" | "activity";
74451
74458
  limit?: number;
74452
74459
  offset?: number | null;
74453
74460
  };
@@ -74482,6 +74489,7 @@ interface paths {
74482
74489
  * "document_count": 6,
74483
74490
  * "merged_into_id": null,
74484
74491
  * "payment_terms_days": null,
74492
+ * "needs_name": false,
74485
74493
  * "payment_terms_source": null,
74486
74494
  * "created_at": "2026-10-01T14:03:00.000Z",
74487
74495
  * "updated_at": "2026-10-30T08:00:00.000Z"
@@ -74618,6 +74626,7 @@ interface paths {
74618
74626
  * "document_count": 6,
74619
74627
  * "merged_into_id": null,
74620
74628
  * "payment_terms_days": null,
74629
+ * "needs_name": false,
74621
74630
  * "payment_terms_source": null,
74622
74631
  * "created_at": "2026-10-01T14:03:00.000Z",
74623
74632
  * "updated_at": "2026-10-30T08:00:00.000Z"
@@ -74738,6 +74747,7 @@ interface paths {
74738
74747
  * "document_count": 6,
74739
74748
  * "merged_into_id": null,
74740
74749
  * "payment_terms_days": null,
74750
+ * "needs_name": false,
74741
74751
  * "payment_terms_source": null,
74742
74752
  * "created_at": "2026-10-01T14:03:00.000Z",
74743
74753
  * "updated_at": "2026-10-30T08:00:00.000Z"
@@ -74818,7 +74828,7 @@ interface paths {
74818
74828
  put?: never;
74819
74829
  /**
74820
74830
  * 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`.
74831
+ * @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
74832
  */
74823
74833
  post: {
74824
74834
  parameters: {
@@ -74868,11 +74878,13 @@ interface paths {
74868
74878
  * "document_count": 6,
74869
74879
  * "merged_into_id": null,
74870
74880
  * "payment_terms_days": null,
74881
+ * "needs_name": false,
74871
74882
  * "payment_terms_source": null,
74872
74883
  * "created_at": "2026-10-01T14:03:00.000Z",
74873
74884
  * "updated_at": "2026-10-30T08:00:00.000Z"
74874
74885
  * },
74875
74886
  * "merged_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a9e",
74887
+ * "merge_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4aaa",
74876
74888
  * "moved": {
74877
74889
  * "movements": 3,
74878
74890
  * "documents": 2
@@ -74947,6 +74959,673 @@ interface paths {
74947
74959
  patch?: never;
74948
74960
  trace?: never;
74949
74961
  };
74962
+ "/finanzas/contrapartes/duplicates": {
74963
+ parameters: {
74964
+ query?: never;
74965
+ header?: never;
74966
+ path?: never;
74967
+ cookie?: never;
74968
+ };
74969
+ /**
74970
+ * Proposed Contraparte duplicates («Unir duplicados»)
74971
+ * @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`.
74972
+ */
74973
+ get: {
74974
+ parameters: {
74975
+ query?: never;
74976
+ header?: never;
74977
+ path?: never;
74978
+ cookie?: never;
74979
+ };
74980
+ requestBody?: never;
74981
+ responses: {
74982
+ /** @description The proposals */
74983
+ 200: {
74984
+ headers: {
74985
+ [name: string]: unknown;
74986
+ };
74987
+ content: {
74988
+ /**
74989
+ * @example {
74990
+ * "data": {
74991
+ * "total": 1,
74992
+ * "items": [
74993
+ * {
74994
+ * "keep": {
74995
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
74996
+ * "name": "ADOLFO CERDA ALVAREZ",
74997
+ * "rut": "14432869-8",
74998
+ * "rut_formatted": "14.432.869-8",
74999
+ * "movement_count": 1,
75000
+ * "document_count": 13
75001
+ * },
75002
+ * "merge": {
75003
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a9e",
75004
+ * "name": "Adolfo Cerda A",
75005
+ * "rut": null,
75006
+ * "rut_formatted": null,
75007
+ * "movement_count": 1,
75008
+ * "document_count": 0
75009
+ * },
75010
+ * "score": 0.9,
75011
+ * "moves": {
75012
+ * "movements": 1,
75013
+ * "documents": 0
75014
+ * }
75015
+ * }
75016
+ * ]
75017
+ * }
75018
+ * }
75019
+ */
75020
+ "application/json": {
75021
+ data: components["schemas"]["FinanzasContraparteDuplicates"];
75022
+ };
75023
+ };
75024
+ };
75025
+ /** @description Validation error */
75026
+ 400: {
75027
+ headers: {
75028
+ [name: string]: unknown;
75029
+ };
75030
+ content: {
75031
+ "application/json": components["schemas"]["Error"];
75032
+ };
75033
+ };
75034
+ /** @description Unauthorized */
75035
+ 401: {
75036
+ headers: {
75037
+ [name: string]: unknown;
75038
+ };
75039
+ content: {
75040
+ "application/json": components["schemas"]["Error"];
75041
+ };
75042
+ };
75043
+ /** @description Forbidden */
75044
+ 403: {
75045
+ headers: {
75046
+ [name: string]: unknown;
75047
+ };
75048
+ content: {
75049
+ "application/json": components["schemas"]["Error"];
75050
+ };
75051
+ };
75052
+ /** @description Not found */
75053
+ 404: {
75054
+ headers: {
75055
+ [name: string]: unknown;
75056
+ };
75057
+ content: {
75058
+ "application/json": components["schemas"]["Error"];
75059
+ };
75060
+ };
75061
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
75062
+ 409: {
75063
+ headers: {
75064
+ [name: string]: unknown;
75065
+ };
75066
+ content: {
75067
+ "application/json": components["schemas"]["Error"];
75068
+ };
75069
+ };
75070
+ /** @description Rate limited */
75071
+ 429: {
75072
+ headers: {
75073
+ [name: string]: unknown;
75074
+ };
75075
+ content: {
75076
+ "application/json": components["schemas"]["Error"];
75077
+ };
75078
+ };
75079
+ };
75080
+ };
75081
+ put?: never;
75082
+ post?: never;
75083
+ delete?: never;
75084
+ options?: never;
75085
+ head?: never;
75086
+ patch?: never;
75087
+ trace?: never;
75088
+ };
75089
+ "/finanzas/contrapartes/duplicates/merge": {
75090
+ parameters: {
75091
+ query?: never;
75092
+ header?: never;
75093
+ path?: never;
75094
+ cookie?: never;
75095
+ };
75096
+ get?: never;
75097
+ put?: never;
75098
+ /**
75099
+ * Accept a proposed duplicate: merge it (undoable)
75100
+ * @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`.
75101
+ */
75102
+ post: {
75103
+ parameters: {
75104
+ query?: never;
75105
+ header?: {
75106
+ /** @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. */
75107
+ "Idempotency-Key"?: string;
75108
+ };
75109
+ path?: never;
75110
+ cookie?: never;
75111
+ };
75112
+ requestBody?: {
75113
+ content: {
75114
+ /**
75115
+ * @example {
75116
+ * "keep_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
75117
+ * "merge_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a9e"
75118
+ * }
75119
+ */
75120
+ "application/json": components["schemas"]["FinanzasContraparteDuplicateMergeBody"];
75121
+ };
75122
+ };
75123
+ responses: {
75124
+ /** @description The merge */
75125
+ 200: {
75126
+ headers: {
75127
+ [name: string]: unknown;
75128
+ };
75129
+ content: {
75130
+ /**
75131
+ * @example {
75132
+ * "data": {
75133
+ * "survivor": {
75134
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
75135
+ * "name": "Insumos Médicos Ejemplo SpA",
75136
+ * "rut": "76123456-7",
75137
+ * "rut_formatted": "76.123.456-7",
75138
+ * "roles": [
75139
+ * "supplier"
75140
+ * ],
75141
+ * "source": "movement",
75142
+ * "contact": null,
75143
+ * "clinic_patient": null,
75144
+ * "is_payroll": false,
75145
+ * "movement_count": 14,
75146
+ * "document_count": 6,
75147
+ * "merged_into_id": null,
75148
+ * "payment_terms_days": null,
75149
+ * "needs_name": false,
75150
+ * "payment_terms_source": null,
75151
+ * "created_at": "2026-10-01T14:03:00.000Z",
75152
+ * "updated_at": "2026-10-30T08:00:00.000Z"
75153
+ * },
75154
+ * "merged_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a9e",
75155
+ * "merge_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4aaa",
75156
+ * "moved": {
75157
+ * "movements": 1,
75158
+ * "documents": 0
75159
+ * }
75160
+ * }
75161
+ * }
75162
+ */
75163
+ "application/json": {
75164
+ data: components["schemas"]["FinanzasContraparteMergeResult"];
75165
+ };
75166
+ };
75167
+ };
75168
+ /** @description Validation error */
75169
+ 400: {
75170
+ headers: {
75171
+ [name: string]: unknown;
75172
+ };
75173
+ content: {
75174
+ "application/json": components["schemas"]["Error"];
75175
+ };
75176
+ };
75177
+ /** @description Unauthorized */
75178
+ 401: {
75179
+ headers: {
75180
+ [name: string]: unknown;
75181
+ };
75182
+ content: {
75183
+ "application/json": components["schemas"]["Error"];
75184
+ };
75185
+ };
75186
+ /** @description Forbidden */
75187
+ 403: {
75188
+ headers: {
75189
+ [name: string]: unknown;
75190
+ };
75191
+ content: {
75192
+ "application/json": components["schemas"]["Error"];
75193
+ };
75194
+ };
75195
+ /** @description Not found */
75196
+ 404: {
75197
+ headers: {
75198
+ [name: string]: unknown;
75199
+ };
75200
+ content: {
75201
+ "application/json": components["schemas"]["Error"];
75202
+ };
75203
+ };
75204
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
75205
+ 409: {
75206
+ headers: {
75207
+ [name: string]: unknown;
75208
+ };
75209
+ content: {
75210
+ "application/json": components["schemas"]["Error"];
75211
+ };
75212
+ };
75213
+ /** @description Rate limited */
75214
+ 429: {
75215
+ headers: {
75216
+ [name: string]: unknown;
75217
+ };
75218
+ content: {
75219
+ "application/json": components["schemas"]["Error"];
75220
+ };
75221
+ };
75222
+ };
75223
+ };
75224
+ delete?: never;
75225
+ options?: never;
75226
+ head?: never;
75227
+ patch?: never;
75228
+ trace?: never;
75229
+ };
75230
+ "/finanzas/contrapartes/duplicates/dismiss": {
75231
+ parameters: {
75232
+ query?: never;
75233
+ header?: never;
75234
+ path?: never;
75235
+ cookie?: never;
75236
+ };
75237
+ get?: never;
75238
+ put?: never;
75239
+ /**
75240
+ * Reject a proposed duplicate («No son la misma»)
75241
+ * @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`.
75242
+ */
75243
+ post: {
75244
+ parameters: {
75245
+ query?: never;
75246
+ header?: {
75247
+ /** @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. */
75248
+ "Idempotency-Key"?: string;
75249
+ };
75250
+ path?: never;
75251
+ cookie?: never;
75252
+ };
75253
+ requestBody?: {
75254
+ content: {
75255
+ /**
75256
+ * @example {
75257
+ * "a_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
75258
+ * "b_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a9e"
75259
+ * }
75260
+ */
75261
+ "application/json": components["schemas"]["FinanzasContraparteDuplicateDismissBody"];
75262
+ };
75263
+ };
75264
+ responses: {
75265
+ /** @description Dismissed */
75266
+ 200: {
75267
+ headers: {
75268
+ [name: string]: unknown;
75269
+ };
75270
+ content: {
75271
+ /**
75272
+ * @example {
75273
+ * "data": {
75274
+ * "a_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
75275
+ * "b_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a9e",
75276
+ * "dismissed": true
75277
+ * }
75278
+ * }
75279
+ */
75280
+ "application/json": {
75281
+ data: {
75282
+ a_id: string;
75283
+ b_id: string;
75284
+ dismissed: boolean;
75285
+ };
75286
+ };
75287
+ };
75288
+ };
75289
+ /** @description Validation error */
75290
+ 400: {
75291
+ headers: {
75292
+ [name: string]: unknown;
75293
+ };
75294
+ content: {
75295
+ "application/json": components["schemas"]["Error"];
75296
+ };
75297
+ };
75298
+ /** @description Unauthorized */
75299
+ 401: {
75300
+ headers: {
75301
+ [name: string]: unknown;
75302
+ };
75303
+ content: {
75304
+ "application/json": components["schemas"]["Error"];
75305
+ };
75306
+ };
75307
+ /** @description Forbidden */
75308
+ 403: {
75309
+ headers: {
75310
+ [name: string]: unknown;
75311
+ };
75312
+ content: {
75313
+ "application/json": components["schemas"]["Error"];
75314
+ };
75315
+ };
75316
+ /** @description Not found */
75317
+ 404: {
75318
+ headers: {
75319
+ [name: string]: unknown;
75320
+ };
75321
+ content: {
75322
+ "application/json": components["schemas"]["Error"];
75323
+ };
75324
+ };
75325
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
75326
+ 409: {
75327
+ headers: {
75328
+ [name: string]: unknown;
75329
+ };
75330
+ content: {
75331
+ "application/json": components["schemas"]["Error"];
75332
+ };
75333
+ };
75334
+ /** @description Rate limited */
75335
+ 429: {
75336
+ headers: {
75337
+ [name: string]: unknown;
75338
+ };
75339
+ content: {
75340
+ "application/json": components["schemas"]["Error"];
75341
+ };
75342
+ };
75343
+ };
75344
+ };
75345
+ delete?: never;
75346
+ options?: never;
75347
+ head?: never;
75348
+ patch?: never;
75349
+ trace?: never;
75350
+ };
75351
+ "/finanzas/contrapartes/merges": {
75352
+ parameters: {
75353
+ query?: never;
75354
+ header?: never;
75355
+ path?: never;
75356
+ cookie?: never;
75357
+ };
75358
+ /**
75359
+ * Contrapartes merged in a month («Contrapartes unidas»)
75360
+ * @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`.
75361
+ */
75362
+ get: {
75363
+ parameters: {
75364
+ query: {
75365
+ month: string;
75366
+ };
75367
+ header?: never;
75368
+ path?: never;
75369
+ cookie?: never;
75370
+ };
75371
+ requestBody?: never;
75372
+ responses: {
75373
+ /** @description The merges */
75374
+ 200: {
75375
+ headers: {
75376
+ [name: string]: unknown;
75377
+ };
75378
+ content: {
75379
+ /**
75380
+ * @example {
75381
+ * "data": [
75382
+ * {
75383
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4aaa",
75384
+ * "origin": "same_name",
75385
+ * "actor": "system",
75386
+ * "label": "Alldental → ALLDENTAL SPA",
75387
+ * "survivor": {
75388
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
75389
+ * "name": "ALLDENTAL SPA"
75390
+ * },
75391
+ * "merged": {
75392
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a9e",
75393
+ * "name": "Alldental"
75394
+ * },
75395
+ * "moved": {
75396
+ * "movements": 0,
75397
+ * "documents": 1
75398
+ * },
75399
+ * "reason": "Mismo nombre y un RUT conocido",
75400
+ * "created_at": "2026-11-07T14:03:00.000Z",
75401
+ * "undone_at": null,
75402
+ * "undoable": true
75403
+ * }
75404
+ * ]
75405
+ * }
75406
+ */
75407
+ "application/json": {
75408
+ data: components["schemas"]["FinanzasContraparteMergeView"][];
75409
+ };
75410
+ };
75411
+ };
75412
+ /** @description Validation error */
75413
+ 400: {
75414
+ headers: {
75415
+ [name: string]: unknown;
75416
+ };
75417
+ content: {
75418
+ "application/json": components["schemas"]["Error"];
75419
+ };
75420
+ };
75421
+ /** @description Unauthorized */
75422
+ 401: {
75423
+ headers: {
75424
+ [name: string]: unknown;
75425
+ };
75426
+ content: {
75427
+ "application/json": components["schemas"]["Error"];
75428
+ };
75429
+ };
75430
+ /** @description Forbidden */
75431
+ 403: {
75432
+ headers: {
75433
+ [name: string]: unknown;
75434
+ };
75435
+ content: {
75436
+ "application/json": components["schemas"]["Error"];
75437
+ };
75438
+ };
75439
+ /** @description Not found */
75440
+ 404: {
75441
+ headers: {
75442
+ [name: string]: unknown;
75443
+ };
75444
+ content: {
75445
+ "application/json": components["schemas"]["Error"];
75446
+ };
75447
+ };
75448
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
75449
+ 409: {
75450
+ headers: {
75451
+ [name: string]: unknown;
75452
+ };
75453
+ content: {
75454
+ "application/json": components["schemas"]["Error"];
75455
+ };
75456
+ };
75457
+ /** @description Rate limited */
75458
+ 429: {
75459
+ headers: {
75460
+ [name: string]: unknown;
75461
+ };
75462
+ content: {
75463
+ "application/json": components["schemas"]["Error"];
75464
+ };
75465
+ };
75466
+ };
75467
+ };
75468
+ put?: never;
75469
+ post?: never;
75470
+ delete?: never;
75471
+ options?: never;
75472
+ head?: never;
75473
+ patch?: never;
75474
+ trace?: never;
75475
+ };
75476
+ "/finanzas/contrapartes/merges/{mergeId}/undo": {
75477
+ parameters: {
75478
+ query?: never;
75479
+ header?: never;
75480
+ path?: never;
75481
+ cookie?: never;
75482
+ };
75483
+ get?: never;
75484
+ put?: never;
75485
+ /**
75486
+ * Undo a Contraparte merge («Deshacer»)
75487
+ * @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`.
75488
+ */
75489
+ post: {
75490
+ parameters: {
75491
+ query?: never;
75492
+ header?: {
75493
+ /** @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. */
75494
+ "Idempotency-Key"?: string;
75495
+ };
75496
+ path: {
75497
+ mergeId: string;
75498
+ };
75499
+ cookie?: never;
75500
+ };
75501
+ requestBody?: never;
75502
+ responses: {
75503
+ /** @description The undo */
75504
+ 200: {
75505
+ headers: {
75506
+ [name: string]: unknown;
75507
+ };
75508
+ content: {
75509
+ /**
75510
+ * @example {
75511
+ * "data": {
75512
+ * "merge_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4aaa",
75513
+ * "survivor": {
75514
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
75515
+ * "name": "Insumos Médicos Ejemplo SpA",
75516
+ * "rut": "76123456-7",
75517
+ * "rut_formatted": "76.123.456-7",
75518
+ * "roles": [
75519
+ * "supplier"
75520
+ * ],
75521
+ * "source": "movement",
75522
+ * "contact": null,
75523
+ * "clinic_patient": null,
75524
+ * "is_payroll": false,
75525
+ * "movement_count": 14,
75526
+ * "document_count": 6,
75527
+ * "merged_into_id": null,
75528
+ * "payment_terms_days": null,
75529
+ * "needs_name": false,
75530
+ * "payment_terms_source": null,
75531
+ * "created_at": "2026-10-01T14:03:00.000Z",
75532
+ * "updated_at": "2026-10-30T08:00:00.000Z"
75533
+ * },
75534
+ * "restored": {
75535
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f4a5b",
75536
+ * "name": "Alldental",
75537
+ * "rut": "76123456-7",
75538
+ * "rut_formatted": "76.123.456-7",
75539
+ * "roles": [
75540
+ * "supplier"
75541
+ * ],
75542
+ * "source": "movement",
75543
+ * "contact": null,
75544
+ * "clinic_patient": null,
75545
+ * "is_payroll": false,
75546
+ * "movement_count": 14,
75547
+ * "document_count": 6,
75548
+ * "merged_into_id": null,
75549
+ * "payment_terms_days": null,
75550
+ * "needs_name": false,
75551
+ * "payment_terms_source": null,
75552
+ * "created_at": "2026-10-01T14:03:00.000Z",
75553
+ * "updated_at": "2026-10-30T08:00:00.000Z"
75554
+ * },
75555
+ * "moved_back": {
75556
+ * "movements": 0,
75557
+ * "documents": 1
75558
+ * }
75559
+ * }
75560
+ * }
75561
+ */
75562
+ "application/json": {
75563
+ data: components["schemas"]["FinanzasContraparteUndoMergeResult"];
75564
+ };
75565
+ };
75566
+ };
75567
+ /** @description Validation error */
75568
+ 400: {
75569
+ headers: {
75570
+ [name: string]: unknown;
75571
+ };
75572
+ content: {
75573
+ "application/json": components["schemas"]["Error"];
75574
+ };
75575
+ };
75576
+ /** @description Unauthorized */
75577
+ 401: {
75578
+ headers: {
75579
+ [name: string]: unknown;
75580
+ };
75581
+ content: {
75582
+ "application/json": components["schemas"]["Error"];
75583
+ };
75584
+ };
75585
+ /** @description Forbidden */
75586
+ 403: {
75587
+ headers: {
75588
+ [name: string]: unknown;
75589
+ };
75590
+ content: {
75591
+ "application/json": components["schemas"]["Error"];
75592
+ };
75593
+ };
75594
+ /** @description Not found */
75595
+ 404: {
75596
+ headers: {
75597
+ [name: string]: unknown;
75598
+ };
75599
+ content: {
75600
+ "application/json": components["schemas"]["Error"];
75601
+ };
75602
+ };
75603
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
75604
+ 409: {
75605
+ headers: {
75606
+ [name: string]: unknown;
75607
+ };
75608
+ content: {
75609
+ "application/json": components["schemas"]["Error"];
75610
+ };
75611
+ };
75612
+ /** @description Rate limited */
75613
+ 429: {
75614
+ headers: {
75615
+ [name: string]: unknown;
75616
+ };
75617
+ content: {
75618
+ "application/json": components["schemas"]["Error"];
75619
+ };
75620
+ };
75621
+ };
75622
+ };
75623
+ delete?: never;
75624
+ options?: never;
75625
+ head?: never;
75626
+ patch?: never;
75627
+ trace?: never;
75628
+ };
74950
75629
  "/finanzas/contrapartes/{id}/overview": {
74951
75630
  parameters: {
74952
75631
  query?: never;
@@ -83080,7 +83759,7 @@ interface paths {
83080
83759
  };
83081
83760
  /**
83082
83761
  * 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`.
83762
+ * @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
83763
  */
83085
83764
  get: {
83086
83765
  parameters: {
@@ -84600,7 +85279,7 @@ interface paths {
84600
85279
  };
84601
85280
  /**
84602
85281
  * 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`.
85282
+ * @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
85283
  */
84605
85284
  get: {
84606
85285
  parameters: {
@@ -279112,6 +279791,8 @@ interface components {
279112
279791
  description: string | null;
279113
279792
  kind: components["schemas"]["FinanzasAccountKind"];
279114
279793
  behavior: components["schemas"]["FinanzasAccountBehavior"];
279794
+ /** @description «No lleva documento»: money out classified here never has a legal document. It opens no «Falta documento» case and is not counted in «Egresos sin documento». */
279795
+ no_document: boolean;
279115
279796
  position: number;
279116
279797
  depth: number;
279117
279798
  path: string;
@@ -279130,12 +279811,14 @@ interface components {
279130
279811
  parent_id?: string | null;
279131
279812
  kind?: components["schemas"]["FinanzasAccountKind"];
279132
279813
  behavior?: components["schemas"]["FinanzasAccountBehavior"];
279814
+ no_document?: boolean;
279133
279815
  description?: string | null;
279134
279816
  };
279135
279817
  FinanzasAccountUpdateBody: {
279136
279818
  name?: string;
279137
279819
  description?: string | null;
279138
279820
  behavior?: components["schemas"]["FinanzasAccountBehavior"] & string;
279821
+ no_document?: boolean;
279139
279822
  /** Format: uuid */
279140
279823
  parent_id?: string | null;
279141
279824
  position?: number;
@@ -279309,6 +279992,8 @@ interface components {
279309
279992
  merged_into_id: string | null;
279310
279993
  /** @description Its own payment terms in days (0–365); null = the workspace default of each document class (Ajustes › Plazos de pago). */
279311
279994
  payment_terms_days: number | null;
279995
+ /** @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. */
279996
+ needs_name: boolean;
279312
279997
  /**
279313
279998
  * @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.
279314
279999
  * @enum {string|null}
@@ -279327,6 +280012,8 @@ interface components {
279327
280012
  FinanzasContraparteMergeResult: {
279328
280013
  survivor: components["schemas"]["FinanzasContraparte"];
279329
280014
  merged_id: string;
280015
+ /** @description The merge ledger id: `POST /finanzas/contrapartes/merges/{mergeId}/undo` undoes it. */
280016
+ merge_id: string;
279330
280017
  moved: {
279331
280018
  movements: number;
279332
280019
  documents: number;
@@ -279339,6 +280026,89 @@ interface components {
279339
280026
  */
279340
280027
  merge_id: string;
279341
280028
  };
280029
+ FinanzasContraparteDuplicatePair: {
280030
+ /** @description The one that stays. */
280031
+ keep: {
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
+ /** @description The one that is merged into `keep`. */
280041
+ merge: {
280042
+ /** Format: uuid */
280043
+ id: string;
280044
+ name: string;
280045
+ rut: string | null;
280046
+ rut_formatted: string | null;
280047
+ movement_count: number;
280048
+ document_count: number;
280049
+ };
280050
+ score: number;
280051
+ /** @description What moves to `keep`. */
280052
+ moves: {
280053
+ movements: number;
280054
+ documents: number;
280055
+ };
280056
+ };
280057
+ FinanzasContraparteDuplicates: {
280058
+ /** @description Every proposed pair; `items` holds the first 200. */
280059
+ total: number;
280060
+ items: components["schemas"]["FinanzasContraparteDuplicatePair"][];
280061
+ };
280062
+ FinanzasContraparteDuplicateMergeBody: {
280063
+ /** Format: uuid */
280064
+ keep_id: string;
280065
+ /** Format: uuid */
280066
+ merge_id: string;
280067
+ };
280068
+ FinanzasContraparteDuplicateDismissBody: {
280069
+ /** Format: uuid */
280070
+ a_id: string;
280071
+ /** Format: uuid */
280072
+ b_id: string;
280073
+ };
280074
+ FinanzasContraparteMergeView: {
280075
+ /** Format: uuid */
280076
+ id: string;
280077
+ /** @enum {string} */
280078
+ origin: "same_rut" | "same_name" | "review" | "manual";
280079
+ /** @enum {string} */
280080
+ actor: "system" | "person";
280081
+ /** @example Adolfo Cerda A → ADOLFO CERDA ALVAREZ */
280082
+ label: string;
280083
+ survivor: {
280084
+ /** Format: uuid */
280085
+ id: string;
280086
+ name: string;
280087
+ };
280088
+ merged: {
280089
+ /** Format: uuid */
280090
+ id: string;
280091
+ name: string;
280092
+ };
280093
+ moved: {
280094
+ movements: number;
280095
+ documents: number;
280096
+ };
280097
+ reason: string | null;
280098
+ created_at: string;
280099
+ undone_at: string | null;
280100
+ undoable: boolean;
280101
+ };
280102
+ FinanzasContraparteUndoMergeResult: {
280103
+ /** Format: uuid */
280104
+ merge_id: string;
280105
+ survivor: components["schemas"]["FinanzasContraparte"];
280106
+ restored: components["schemas"]["FinanzasContraparte"];
280107
+ moved_back: {
280108
+ movements: number;
280109
+ documents: number;
280110
+ };
280111
+ };
279342
280112
  FinanzasContraparteTerms: {
279343
280113
  /** @description Its own terms; null = the workspace default per class. */
279344
280114
  days: number | null;
@@ -280649,7 +281419,7 @@ interface components {
280649
281419
  amount_at_stake_clp: number;
280650
281420
  /** @description First day of last month: `period=recent` keeps the cases touching it or later; older ones are «Historial». */
280651
281421
  since: string;
280652
- /** @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. */
281422
+ /** @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. */
280653
281423
  counts_by_month: {
280654
281424
  /** @description `YYYY-MM`. */
280655
281425
  month: string;
@@ -280961,6 +281731,8 @@ interface components {
280961
281731
  match: number;
280962
281732
  ai: number;
280963
281733
  };
281734
+ /** @description Contrapartes Vitrina (or a person) merged this month, newest first: «Contrapartes unidas» with «Deshacer» (`undoable`) in Hecho por Vitrina. */
281735
+ contraparte_merges: components["schemas"]["FinanzasContraparteMergeView"][];
280964
281736
  rules_created: {
280965
281737
  /** Format: uuid */
280966
281738
  id: string;
@@ -281025,7 +281797,7 @@ interface components {
281025
281797
  /** @description «septiembre 2026». */
281026
281798
  label: string;
281027
281799
  /**
281028
- * @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).
281800
+ * @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).
281029
281801
  * @enum {string}
281030
281802
  */
281031
281803
  state: "open" | "ready_to_close" | "closed" | "closed_imported";
@@ -281034,7 +281806,7 @@ interface components {
281034
281806
  closed_at: string | null;
281035
281807
  closed_by: string | null;
281036
281808
  /**
281037
- * @description Who closed the month: `person` («Cerrar mes») or `chipax` (the import: «Cerrado en Chipax»). Null while open.
281809
+ * @description Who closed the month: `person` («Cerrar mes») or `chipax` (the import: «Cerrado antes de Vitrina»). Null while open.
281038
281810
  * @enum {string|null}
281039
281811
  */
281040
281812
  closed_source: "person" | "chipax" | null;
@@ -281052,7 +281824,7 @@ interface components {
281052
281824
  /** @description «septiembre 2026». */
281053
281825
  label: string;
281054
281826
  /**
281055
- * @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).
281827
+ * @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).
281056
281828
  * @enum {string}
281057
281829
  */
281058
281830
  state: "open" | "ready_to_close" | "closed" | "closed_imported";
@@ -281061,7 +281833,7 @@ interface components {
281061
281833
  closed_at: string | null;
281062
281834
  closed_by: string | null;
281063
281835
  /**
281064
- * @description Who closed the month: `person` («Cerrar mes») or `chipax` (the import: «Cerrado en Chipax»). Null while open.
281836
+ * @description Who closed the month: `person` («Cerrar mes») or `chipax` (the import: «Cerrado antes de Vitrina»). Null while open.
281065
281837
  * @enum {string|null}
281066
281838
  */
281067
281839
  closed_source: "person" | "chipax" | null;