sinfactura-types 1.10.415 → 1.10.417

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.
@@ -195,6 +195,28 @@ declare global {
195
195
  rescheduledTo?: string;
196
196
  /** On a replacement row: the `RESCHEDULED` appointment it superseded. */
197
197
  rescheduledFrom?: string;
198
+ /**
199
+ * The service ticket (`ServiceOrder.serviceOrderId`) staff opened FOR this
200
+ * visit. One ticket per visit, or none; the ticket points back through
201
+ * `ServiceOrder.appointmentId`.
202
+ *
203
+ * ⚠️ **Written only by a staff click** — `POST /services` `mode: 'create'`
204
+ * carrying `appointment`, on a `RECURRING_VISIT` that is not `CANCELLED`,
205
+ * `NO_SHOW` or `RESCHEDULED`. Nothing mints a ticket on its own: not the
206
+ * series expansion, not a sweep, not a future occurrence. Every other
207
+ * booking never carries the field. A second click returns the ticket
208
+ * already linked rather than minting another.
209
+ *
210
+ * ⚠️ **A reschedule carries it onto the replacement row** and re-points the
211
+ * ticket at the new booking; the `RESCHEDULED` row keeps its copy as
212
+ * history. **Cancelling, skipping («omitir fechas») or marking `NO_SHOW`
213
+ * keeps it here too, but unlinks the ticket**: the ticket's own
214
+ * `appointmentId` is removed so it no longer claims a visit that will not
215
+ * happen, and it stays open for the operator to close or keep. So the
216
+ * link is live only when BOTH sides name each other — read the ticket's
217
+ * `appointmentId`, not this field alone, to know whether it still holds.
218
+ */
219
+ serviceOrderId?: string;
198
220
  cancelledAt?: number;
199
221
  cancelledBy?: string;
200
222
  /**
package/dist/cash.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  declare global {
2
- interface Cash {
2
+ interface Cash extends CurrencyRateProvenance {
3
3
  storeId: string;
4
4
  cashId: string;
5
5
  createdAt: number;
@@ -199,6 +199,15 @@ exports.MAX_SERVICE_PICTURES = 20;
199
199
  * (Ley 24.240 art. 23 sets 30). `0` means "not stated" and is accepted. The
200
200
  * same refusal, from the same rule, is answered by `/service-templates`
201
201
  * create and edit.
202
+ * - `APPOINTMENT_*` — `mode: 'create'` with `appointment` (a ticket opened
203
+ * from a maintenance visit). `APPOINTMENT_NOT_FOUND` (404) — no booking at
204
+ * that id/date/startTime. `APPOINTMENT_NOT_LINKABLE` (409) — the booking is
205
+ * not a `RECURRING_VISIT`. `APPOINTMENT_NOT_OPEN` (409) — it is `CANCELLED`,
206
+ * `NO_SHOW` or `RESCHEDULED`; reload and open the ticket from the live
207
+ * booking. `APPOINTMENT_CUSTOMER_MISMATCH` (409) — `customerId` is not the
208
+ * booking's customer. `APPOINTMENT_VERSION_CONFLICT` (409) — the booking
209
+ * changed while the ticket was being opened; nothing was linked, reload and
210
+ * retry, and a retry after a concurrent click returns that click's ticket.
202
211
  * - `VALIDATION_FAILED` · 400 — the body or query failed its schema.
203
212
  *
204
213
  * ⚠️ `ROLE_FORBIDDEN` here is the router's own role check (a print agent, or a
@@ -231,6 +240,12 @@ exports.SERVICE_ORDER_ERROR_CODES = [
231
240
  'SERVICE_ORDER_BILLABLE_FROZEN',
232
241
  'SERVICE_ORDER_EDIT_CHANGED',
233
242
  'SERVICE_ORDER_DISABLED_STATE_UNCHANGED',
243
+ // Intake from a maintenance visit (`appointment`)
244
+ 'APPOINTMENT_NOT_FOUND',
245
+ 'APPOINTMENT_NOT_LINKABLE',
246
+ 'APPOINTMENT_NOT_OPEN',
247
+ 'APPOINTMENT_CUSTOMER_MISMATCH',
248
+ 'APPOINTMENT_VERSION_CONFLICT',
234
249
  // Lifecycle
235
250
  'SERVICE_ORDER_TERMINAL',
236
251
  'SERVICE_ORDER_DISABLED',
@@ -56,6 +56,28 @@ declare global {
56
56
  afipCode?: 'PES' | 'DOL' | null;
57
57
  decimals?: number;
58
58
  }
59
+ /**
60
+ * Where a money row's `currencyValue` came from, stamped BESIDE the
61
+ * `{ currency, currencyValue, currencyValueAt }` triple by the shared stamp
62
+ * seam (`stacks/helpers/rateStamp.ts`, `stampRate`).
63
+ *
64
+ * - `currencyValueSourceId` — the rate record's `sourceId`: a
65
+ * `PlatformFxSource.id`, or `'manual'` for an operator-typed subscription.
66
+ * - `currencyValueObservedAt` — the day that rate was true UPSTREAM, in
67
+ * `YYYYMMDD` America/Argentina/Buenos_Aires. ⚠️ NOT the Unix ms of
68
+ * `currencyValueAt`, which keeps its own meaning (write instant, or the
69
+ * document's date — the writer's choice).
70
+ *
71
+ * Both ABSENT means the provenance is UNKNOWN — a row written before this
72
+ * existed, a rate whose subscription carried none, a peso row (rate 1 by
73
+ * definition, nothing observed), or a rate the operator typed onto the
74
+ * document itself. Forward-only; no writer invents a placeholder. Server-set
75
+ * only: a client-supplied value is never persisted.
76
+ */
77
+ interface CurrencyRateProvenance {
78
+ currencyValueSourceId?: string;
79
+ currencyValueObservedAt?: number;
80
+ }
59
81
  interface Currency {
60
82
  createdAt: number;
61
83
  dated: number;
package/dist/invoice.d.ts CHANGED
@@ -54,7 +54,7 @@ declare global {
54
54
  /** The AUTHORITATIVE amount, as declared — never re-derived from `baseImp × alic`. */
55
55
  importe: number;
56
56
  }
57
- interface Invoice {
57
+ interface Invoice extends CurrencyRateProvenance {
58
58
  storeId: string;
59
59
  invoiceId: string;
60
60
  customerId: string;
package/dist/order.d.ts CHANGED
@@ -180,7 +180,7 @@ declare global {
180
180
  */
181
181
  warehouseId?: string;
182
182
  }
183
- interface Order {
183
+ interface Order extends CurrencyRateProvenance {
184
184
  storeId: string;
185
185
  orderId: string;
186
186
  /**
package/dist/pricing.d.ts CHANGED
@@ -6,7 +6,7 @@ declare global {
6
6
  * while entity stamps stay `string`; do NOT retrofit onto SupplierInvoice /
7
7
  * SupplierAccount (optional-currency by design).
8
8
  */
9
- interface CurrencyStamp {
9
+ interface CurrencyStamp extends CurrencyRateProvenance {
10
10
  currency: string;
11
11
  currencyValue: number;
12
12
  currencyValueAt: number;
package/dist/product.d.ts CHANGED
@@ -40,7 +40,7 @@ declare global {
40
40
  * pricing decisions on it; it is a counting-frequency and attention signal.
41
41
  */
42
42
  type ABCClassification = 'A' | 'B' | 'C';
43
- interface Product {
43
+ interface Product extends CurrencyRateProvenance {
44
44
  storeId: string;
45
45
  productId: string;
46
46
  createdAt: number;
@@ -964,6 +964,32 @@ declare global {
964
964
  * linkage.
965
965
  */
966
966
  parentServiceOrderId?: string;
967
+ /**
968
+ * The visit (`Appointment.appointmentId`) this ticket was opened from —
969
+ * staff clicked «abrir orden» on a `RECURRING_VISIT`, and the booking
970
+ * carries this ticket back as `Appointment.serviceOrderId`.
971
+ *
972
+ * ⚠️ A ticket opened this way always starts `custody: 'pending_receipt'`:
973
+ * the equipment is still at the customer's site, and intake refuses
974
+ * `equipmentReceived: true` beside an `appointment`.
975
+ *
976
+ * ⚠️ **Live, not provenance.** A reschedule re-points all three fields at
977
+ * the replacement booking; cancelling, skipping or a `NO_SHOW` REMOVES all
978
+ * three, so a ticket never claims a visit that will not happen. Absent
979
+ * means "not tied to a visit" — including a ticket whose visit was
980
+ * called off.
981
+ */
982
+ appointmentId?: string;
983
+ /**
984
+ * The visit's `Appointment.date` (`YYYYMMDD`, Buenos Aires) — with
985
+ * {@link ServiceOrder.appointmentTime}, the pair that ADDRESSES the booking
986
+ * row, since `GET /appointments/{appointmentId}` needs both. Same stamp as
987
+ * `Order.appointmentDate`. Written and removed together with
988
+ * {@link ServiceOrder.appointmentId}.
989
+ */
990
+ appointmentDate?: number;
991
+ /** The visit's `Appointment.startTime` (`HHmm`). See {@link ServiceOrder.appointmentDate}. */
992
+ appointmentTime?: string;
967
993
  /**
968
994
  * A recorded fact only — nothing branches on it. `POST /services
969
995
  * {mode:'create'}` accepts it and stamps it when supplied, and no handler,
@@ -1216,12 +1242,21 @@ export declare const MAX_SERVICE_PICTURES = 20;
1216
1242
  * (Ley 24.240 art. 23 sets 30). `0` means "not stated" and is accepted. The
1217
1243
  * same refusal, from the same rule, is answered by `/service-templates`
1218
1244
  * create and edit.
1245
+ * - `APPOINTMENT_*` — `mode: 'create'` with `appointment` (a ticket opened
1246
+ * from a maintenance visit). `APPOINTMENT_NOT_FOUND` (404) — no booking at
1247
+ * that id/date/startTime. `APPOINTMENT_NOT_LINKABLE` (409) — the booking is
1248
+ * not a `RECURRING_VISIT`. `APPOINTMENT_NOT_OPEN` (409) — it is `CANCELLED`,
1249
+ * `NO_SHOW` or `RESCHEDULED`; reload and open the ticket from the live
1250
+ * booking. `APPOINTMENT_CUSTOMER_MISMATCH` (409) — `customerId` is not the
1251
+ * booking's customer. `APPOINTMENT_VERSION_CONFLICT` (409) — the booking
1252
+ * changed while the ticket was being opened; nothing was linked, reload and
1253
+ * retry, and a retry after a concurrent click returns that click's ticket.
1219
1254
  * - `VALIDATION_FAILED` · 400 — the body or query failed its schema.
1220
1255
  *
1221
1256
  * ⚠️ `ROLE_FORBIDDEN` here is the router's own role check (a print agent, or a
1222
1257
  * role no mode admits); the cross-cutting wrapper refusals are NOT repeated —
1223
1258
  * check `GATING_ERROR_CODES` in addition.
1224
1259
  */
1225
- export declare const SERVICE_ORDER_ERROR_CODES: readonly ["ROLE_FORBIDDEN", "PARENT_FILTER_CONFLICT", "VALIDATION_FAILED", "INVALID_CURSOR", "INVALID_FROM_DATE", "INVALID_TO_DATE", "INVALID_DATE_RANGE", "REWORK_INDEX_UNAVAILABLE", "STORE_NOT_FOUND", "SERVICE_ORDER_NOT_FOUND", "CUSTOMER_NOT_FOUND", "PARENT_SERVICE_ORDER_NOT_FOUND", "SERVICE_TEMPLATE_NOT_FOUND", "SERVICE_TYPE_REQUIRED", "INVALID_IMAGE_REFERENCE", "MISSING_STORE_CONTEXT", "WARRANTY_BELOW_LEGAL_MINIMUM", "TECHNICIAN_NOT_FOUND", "TECHNICIAN_NOT_ELIGIBLE", "CUSTODY_ILLEGAL_TRANSITION", "SERVICE_ORDER_BILLABLE_FROZEN", "SERVICE_ORDER_EDIT_CHANGED", "SERVICE_ORDER_DISABLED_STATE_UNCHANGED", "SERVICE_ORDER_TERMINAL", "SERVICE_ORDER_DISABLED", "SERVICE_ORDER_ILLEGAL_TRANSITION", "SERVICE_ORDER_STATUS_CHANGED", "SERVICE_ORDER_OUTCOME_REQUIRED", "SERVICE_ORDER_OUTCOME_NOT_ALLOWED", "SERVICE_ORDER_CUSTODY_NOT_RECEIVED", "SERVICE_ORDER_BILLABLE_NOT_AT_THIS_TRANSITION", "PAYMENT_METHODS_NOT_CONFIGURED", "PAYMENT_METHOD_NOT_FOUND", "SERVICE_ORDER_DEPOSIT_CHANGED", "SERVICE_BILLING_PRODUCTS_UNAVAILABLE", "SERVICE_BILLING_PRODUCT_IN_BASKET", "SERVICE_DELIVERY_BASKET_DECISION_REQUIRED", "PRODUCT_NOT_AVAILABLE", "FX_CONVERSION_UNAVAILABLE", "TRANSACT_ITEMS_LIMIT_EXCEEDED", "SERVICE_PARTS_RESTORE_EXCEEDS_CONSUMED", "SERVICE_PARTS_RESTORE_EXCEEDS_AMOUNT", "SERVICE_PARTS_STOCK_INSUFFICIENT", "SERVICE_PARTS_PRODUCT_NOT_FOUND", "SERVICE_PARTS_LEDGER_FULL", "SERVICE_PARTS_TOO_MANY", "SERVICE_ORDER_PARTS_CHANGED", "SERVICE_QUOTE_NOT_FOUND", "SERVICE_QUOTE_NOT_OFFERABLE", "SERVICE_QUOTE_HOLDS_TOO_MANY", "SERVICE_QUOTE_SUPERSEDED", "SERVICE_QUOTE_ALREADY_RESOLVED", "SERVICE_QUOTE_LAPSED", "SERVICE_QUOTE_CHANNEL_RESERVED", "SERVICE_QUOTE_CHANNEL_NOT_APPLICABLE", "SERVICE_QUOTE_REASON_NOT_APPLICABLE", "SERVICE_ORDER_QUOTE_CHANGED", "SERVICE_ORDER_NOT_READY", "SERVICE_RENOTIFY_IMPERSONATED", "SERVICE_RENOTIFY_TOO_SOON", "SERVICE_RENOTIFY_CONFLICT", "SERVICE_RENOTIFY_NOT_RECORDED", "SERVICE_RENOTIFY_LEDGER_UNREADABLE", "SERVICE_RENOTIFY_NOT_DISPATCHED", "SERVICE_TIMER_ALREADY_RUNNING", "SERVICE_TIMER_NOT_RUNNING", "SERVICE_TIMER_STOP_CONFLICT", "TECHNICIAN_NOT_CLOCKED_IN", "SERVICE_ORDER_GONE", "SERVICE_WORKLOG_NOT_FOUND", "SERVICE_WORKLOG_NOT_REVERSIBLE", "SERVICE_WORKLOG_ALREADY_REVERSED", "SERVICE_ORDER_WORKLOG_CHANGED"];
1260
+ export declare const SERVICE_ORDER_ERROR_CODES: readonly ["ROLE_FORBIDDEN", "PARENT_FILTER_CONFLICT", "VALIDATION_FAILED", "INVALID_CURSOR", "INVALID_FROM_DATE", "INVALID_TO_DATE", "INVALID_DATE_RANGE", "REWORK_INDEX_UNAVAILABLE", "STORE_NOT_FOUND", "SERVICE_ORDER_NOT_FOUND", "CUSTOMER_NOT_FOUND", "PARENT_SERVICE_ORDER_NOT_FOUND", "SERVICE_TEMPLATE_NOT_FOUND", "SERVICE_TYPE_REQUIRED", "INVALID_IMAGE_REFERENCE", "MISSING_STORE_CONTEXT", "WARRANTY_BELOW_LEGAL_MINIMUM", "TECHNICIAN_NOT_FOUND", "TECHNICIAN_NOT_ELIGIBLE", "CUSTODY_ILLEGAL_TRANSITION", "SERVICE_ORDER_BILLABLE_FROZEN", "SERVICE_ORDER_EDIT_CHANGED", "SERVICE_ORDER_DISABLED_STATE_UNCHANGED", "APPOINTMENT_NOT_FOUND", "APPOINTMENT_NOT_LINKABLE", "APPOINTMENT_NOT_OPEN", "APPOINTMENT_CUSTOMER_MISMATCH", "APPOINTMENT_VERSION_CONFLICT", "SERVICE_ORDER_TERMINAL", "SERVICE_ORDER_DISABLED", "SERVICE_ORDER_ILLEGAL_TRANSITION", "SERVICE_ORDER_STATUS_CHANGED", "SERVICE_ORDER_OUTCOME_REQUIRED", "SERVICE_ORDER_OUTCOME_NOT_ALLOWED", "SERVICE_ORDER_CUSTODY_NOT_RECEIVED", "SERVICE_ORDER_BILLABLE_NOT_AT_THIS_TRANSITION", "PAYMENT_METHODS_NOT_CONFIGURED", "PAYMENT_METHOD_NOT_FOUND", "SERVICE_ORDER_DEPOSIT_CHANGED", "SERVICE_BILLING_PRODUCTS_UNAVAILABLE", "SERVICE_BILLING_PRODUCT_IN_BASKET", "SERVICE_DELIVERY_BASKET_DECISION_REQUIRED", "PRODUCT_NOT_AVAILABLE", "FX_CONVERSION_UNAVAILABLE", "TRANSACT_ITEMS_LIMIT_EXCEEDED", "SERVICE_PARTS_RESTORE_EXCEEDS_CONSUMED", "SERVICE_PARTS_RESTORE_EXCEEDS_AMOUNT", "SERVICE_PARTS_STOCK_INSUFFICIENT", "SERVICE_PARTS_PRODUCT_NOT_FOUND", "SERVICE_PARTS_LEDGER_FULL", "SERVICE_PARTS_TOO_MANY", "SERVICE_ORDER_PARTS_CHANGED", "SERVICE_QUOTE_NOT_FOUND", "SERVICE_QUOTE_NOT_OFFERABLE", "SERVICE_QUOTE_HOLDS_TOO_MANY", "SERVICE_QUOTE_SUPERSEDED", "SERVICE_QUOTE_ALREADY_RESOLVED", "SERVICE_QUOTE_LAPSED", "SERVICE_QUOTE_CHANNEL_RESERVED", "SERVICE_QUOTE_CHANNEL_NOT_APPLICABLE", "SERVICE_QUOTE_REASON_NOT_APPLICABLE", "SERVICE_ORDER_QUOTE_CHANGED", "SERVICE_ORDER_NOT_READY", "SERVICE_RENOTIFY_IMPERSONATED", "SERVICE_RENOTIFY_TOO_SOON", "SERVICE_RENOTIFY_CONFLICT", "SERVICE_RENOTIFY_NOT_RECORDED", "SERVICE_RENOTIFY_LEDGER_UNREADABLE", "SERVICE_RENOTIFY_NOT_DISPATCHED", "SERVICE_TIMER_ALREADY_RUNNING", "SERVICE_TIMER_NOT_RUNNING", "SERVICE_TIMER_STOP_CONFLICT", "TECHNICIAN_NOT_CLOCKED_IN", "SERVICE_ORDER_GONE", "SERVICE_WORKLOG_NOT_FOUND", "SERVICE_WORKLOG_NOT_REVERSIBLE", "SERVICE_WORKLOG_ALREADY_REVERSED", "SERVICE_ORDER_WORKLOG_CHANGED"];
1226
1261
  export type ServiceOrderErrorCode = (typeof SERVICE_ORDER_ERROR_CODES)[number];
1227
1262
  export {};
@@ -196,6 +196,15 @@ export const MAX_SERVICE_PICTURES = 20;
196
196
  * (Ley 24.240 art. 23 sets 30). `0` means "not stated" and is accepted. The
197
197
  * same refusal, from the same rule, is answered by `/service-templates`
198
198
  * create and edit.
199
+ * - `APPOINTMENT_*` — `mode: 'create'` with `appointment` (a ticket opened
200
+ * from a maintenance visit). `APPOINTMENT_NOT_FOUND` (404) — no booking at
201
+ * that id/date/startTime. `APPOINTMENT_NOT_LINKABLE` (409) — the booking is
202
+ * not a `RECURRING_VISIT`. `APPOINTMENT_NOT_OPEN` (409) — it is `CANCELLED`,
203
+ * `NO_SHOW` or `RESCHEDULED`; reload and open the ticket from the live
204
+ * booking. `APPOINTMENT_CUSTOMER_MISMATCH` (409) — `customerId` is not the
205
+ * booking's customer. `APPOINTMENT_VERSION_CONFLICT` (409) — the booking
206
+ * changed while the ticket was being opened; nothing was linked, reload and
207
+ * retry, and a retry after a concurrent click returns that click's ticket.
199
208
  * - `VALIDATION_FAILED` · 400 — the body or query failed its schema.
200
209
  *
201
210
  * ⚠️ `ROLE_FORBIDDEN` here is the router's own role check (a print agent, or a
@@ -228,6 +237,12 @@ export const SERVICE_ORDER_ERROR_CODES = [
228
237
  'SERVICE_ORDER_BILLABLE_FROZEN',
229
238
  'SERVICE_ORDER_EDIT_CHANGED',
230
239
  'SERVICE_ORDER_DISABLED_STATE_UNCHANGED',
240
+ // Intake from a maintenance visit (`appointment`)
241
+ 'APPOINTMENT_NOT_FOUND',
242
+ 'APPOINTMENT_NOT_LINKABLE',
243
+ 'APPOINTMENT_NOT_OPEN',
244
+ 'APPOINTMENT_CUSTOMER_MISMATCH',
245
+ 'APPOINTMENT_VERSION_CONFLICT',
231
246
  // Lifecycle
232
247
  'SERVICE_ORDER_TERMINAL',
233
248
  'SERVICE_ORDER_DISABLED',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.415",
3
+ "version": "1.10.417",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",