sinfactura-types 1.10.308 → 1.10.310

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.
@@ -121,6 +121,45 @@ declare global {
121
121
  recurrenceRule?: string;
122
122
  /** The parent row a generated occurrence was expanded from. */
123
123
  recurrenceId?: string;
124
+ /**
125
+ * Dates the operator EXCLUDED from this series — «omitir fechas».
126
+ *
127
+ * ⚠️ **`YYYY-MM-DD`, America/Argentina/Buenos_Aires (fixed UTC-3, no DST),
128
+ * and that spelling is a DECISION, not a copy of any other field here.**
129
+ * The expander walks in `YYYYMMDD` NUMBERS ({@link Appointment.date}'s own
130
+ * form) and this list is `YYYY-MM-DD` STRINGS; the api converts
131
+ * string → number at exactly one place
132
+ * (`recurrenceExceptionToLocalDate`, `stacks/lambdas/appointments/_shared.ts`)
133
+ * and **never back**. That is the same one-directional rule
134
+ * {@link Appointment.startTimestamp} states for the local pair, and it is
135
+ * here because this field's previous publication named three incompatible
136
+ * formats at once (`string[]` "matching `Appointment.date`'s format", which
137
+ * is a number) and a consumer had no way to choose between `'2026-09-10'`,
138
+ * `'20260910'` and `20260910`.
139
+ *
140
+ * ⚠️ **PARENT ROW ONLY** — the row whose {@link Appointment.recurrenceId}
141
+ * equals its own `appointmentId`. A generated occurrence never carries the
142
+ * list, so reading it off an arbitrary occurrence answers `undefined` for a
143
+ * series that has exclusions. Read it from the parent, which
144
+ * `GET /appointments?recurrenceId=<id>` returns alongside its children.
145
+ *
146
+ * ⚠️ **Sorted ascending and duplicate-free, and the api REFUSES anything
147
+ * else rather than normalising it** (`400 VALIDATION_FAILED`, max 60
148
+ * entries — a series cannot exceed `MAX_OCCURRENCES` occurrences, so no
149
+ * exception list usefully can either). Silently sorting a caller's list
150
+ * would hand back a different list than the one they sent, which is how a
151
+ * client diff loops forever.
152
+ *
153
+ * ⚠️ **Editable ONLY through `POST /appointments/{appointmentId}` with
154
+ * `scope: 'series'`, as a WHOLE-LIST replace** — there is no incremental
155
+ * add/remove verb and no create-time input (`POST /appointments` refuses
156
+ * the key by name). Adding a date CANCELS the occurrence standing on it
157
+ * (status `CANCELLED`, slot count freed, one transaction); removing one
158
+ * re-creates the occurrence only if the date is today-or-later in ART AND
159
+ * the series' `recurrenceRule` still generates it — a past date is never
160
+ * re-created. → `docs/APPOINTMENTS.md`.
161
+ */
162
+ recurrenceExceptions?: string[];
124
163
  /**
125
164
  * On a `RESCHEDULED` row: the appointment that replaced it.
126
165
  * On the replacement: {@link Appointment.rescheduledFrom}.
@@ -320,6 +359,27 @@ declare global {
320
359
  * `occurrences: 9, skipped: []` and no field said twelve. {@link unchanged}
321
360
  * exists to close that, and nothing else on the wire can: the api resolved a
322
361
  * scope the response could not describe.
362
+ *
363
+ * ⚠️ **A `scope: 'series'` request carrying
364
+ * {@link Appointment.recurrenceExceptions} answers this SAME shape, with the
365
+ * three buckets counting the DIFF rather than the series.** `data` is the
366
+ * PARENT row carrying the list as stored; every date the request added or
367
+ * removed lands in one of the three, so
368
+ * `occurrences + skipped.length + unchanged.length` is the size of the diff —
369
+ * ⚠️ with one exception worth knowing: `occurrences` counts ROWS WRITTEN, so a
370
+ * date carrying more than one live occurrence (a day rebooked after a
371
+ * reschedule) can push the sum above the diff. `skipped`/`unchanged` are
372
+ * deduped by date; `occurrences` is not, because it is a write count:
373
+ *
374
+ * - `occurrences` — rows actually written: an added date's occurrence
375
+ * cancelled, or a removed date's occurrence re-created.
376
+ * - `skipped` — asked for and not given: a re-created occurrence that lost
377
+ * the slot race, a cancel that lost a version race, or a removed date that
378
+ * is in the past or that the `recurrenceRule` no longer generates (the
379
+ * exclusion is lifted, but no row comes back).
380
+ * - `unchanged` — already in the requested state: an added date whose
381
+ * occurrence was already terminal or never existed, or a removed date that
382
+ * already has a live occurrence standing on it.
323
383
  */
324
384
  interface ScopedAppointmentEditResponse {
325
385
  /** The occurrence the request addressed — see the warning above. */
@@ -672,12 +732,20 @@ declare global {
672
732
  * belongs to another store, or was minted for a different query. The
673
733
  * envelope is opaque and pins the facets it was minted under, so a
674
734
  * replayed one is refused rather than resumed against the wrong index.
675
- * - `RECURRENCE_EXCEPTIONS_UNSUPPORTED` · 400 — a create or update body
676
- * carrying `recurrenceExceptions`. The api honours no exception list; the
677
- * key is refused by name rather than stripped, which is what it used to be
678
- * (a `200` that silently discarded the dates). Cancel the occurrence
679
- * instead. ⚠️ Refused on PRESENCE, not shape — `[]` and `null` too, since a
680
- * caller sending either still believes the server understands the field.
735
+ * - `RECURRENCE_EXCEPTIONS_UNSUPPORTED` · 400 — a **CREATE** body carrying
736
+ * `recurrenceExceptions`. The list is a series-scoped EDIT, never a
737
+ * create-time input: a series has no occurrences to exclude until it has been
738
+ * minted. ⚠️ **This code no longer reaches the UPDATE route** — it used to
739
+ * refuse both, when the api honoured no exception list at all. Refused on
740
+ * PRESENCE, not shape — `[]` and `null` too, since a caller sending either
741
+ * still believes create understands the field.
742
+ * - `RECURRENCE_EXCEPTIONS_SCOPE_REQUIRED` · 400 — an update carrying
743
+ * `recurrenceExceptions` with `scope` absent, `'this'` or `'this-and-future'`.
744
+ * The list lives on the PARENT row and describes the whole series, so only
745
+ * `scope: 'series'` addresses it. Refused rather than silently narrowed, for
746
+ * the same reason `APPOINTMENT_NOT_IN_SERIES` is: "I asked to change the
747
+ * series and it changed one" is indistinguishable from success above this
748
+ * layer.
681
749
  * - `VALIDATION_FAILED` · 400 — `stacks/helpers/validateRequest.ts`.
682
750
  * - `ROLE_FORBIDDEN` · 403
683
751
  * - `APPOINTMENT_FEED_SECRET_NOT_CONFIGURED` · 503 — the calendar feed's
@@ -709,7 +777,7 @@ declare global {
709
777
  * `GET /availability`, an operator queuing a party against a full slot rather
710
778
  * than configuring the schedule — so its five refusals are listed above.
711
779
  */
712
- export declare const APPOINTMENT_ERROR_CODES: readonly ["APPOINTMENT_NOT_FOUND", "APPOINTMENT_ID_REQUIRED", "APPOINTMENT_TYPE_DISABLED", "APPOINTMENT_SLOT_UNAVAILABLE", "APPOINTMENT_LEAD_TIME_NOT_MET", "APPOINTMENT_CANCEL_CUTOFF_PASSED", "APPOINTMENT_STATUS_TRANSITION_ILLEGAL", "APPOINTMENT_VERSION_CONFLICT", "APPOINTMENT_RESCHEDULE_NOOP", "APPOINTMENT_WAITLIST_PARTY_REQUIRED", "APPOINTMENT_WAITLIST_SLOT_AVAILABLE", "APPOINTMENT_WAITLIST_ALREADY_JOINED", "APPOINTMENT_WAITLIST_FULL", "APPOINTMENT_WAITLIST_ENTRY_NOT_FOUND", "INVALID_CURSOR", "RECURRENCE_RULE_MALFORMED", "RECURRENCE_RULE_UNSUPPORTED", "RECURRENCE_UNBOUNDED", "RECURRENCE_TOO_MANY", "APPOINTMENT_NOT_IN_SERIES", "RECURRENCE_SCOPE_REQUIRES_RULE_EDIT", "APPOINTMENT_STATUS_NOT_SCOPEABLE", "RECURRENCE_EXCEPTIONS_UNSUPPORTED", "VALIDATION_FAILED", "ROLE_FORBIDDEN", "APPOINTMENT_FEED_SECRET_NOT_CONFIGURED", "APPOINTMENT_FEED_IDENTITY_INVALID"];
780
+ export declare const APPOINTMENT_ERROR_CODES: readonly ["APPOINTMENT_NOT_FOUND", "APPOINTMENT_ID_REQUIRED", "APPOINTMENT_TYPE_DISABLED", "APPOINTMENT_SLOT_UNAVAILABLE", "APPOINTMENT_LEAD_TIME_NOT_MET", "APPOINTMENT_CANCEL_CUTOFF_PASSED", "APPOINTMENT_STATUS_TRANSITION_ILLEGAL", "APPOINTMENT_VERSION_CONFLICT", "APPOINTMENT_RESCHEDULE_NOOP", "APPOINTMENT_WAITLIST_PARTY_REQUIRED", "APPOINTMENT_WAITLIST_SLOT_AVAILABLE", "APPOINTMENT_WAITLIST_ALREADY_JOINED", "APPOINTMENT_WAITLIST_FULL", "APPOINTMENT_WAITLIST_ENTRY_NOT_FOUND", "INVALID_CURSOR", "RECURRENCE_RULE_MALFORMED", "RECURRENCE_RULE_UNSUPPORTED", "RECURRENCE_UNBOUNDED", "RECURRENCE_TOO_MANY", "APPOINTMENT_NOT_IN_SERIES", "RECURRENCE_SCOPE_REQUIRES_RULE_EDIT", "APPOINTMENT_STATUS_NOT_SCOPEABLE", "RECURRENCE_EXCEPTIONS_UNSUPPORTED", "RECURRENCE_EXCEPTIONS_SCOPE_REQUIRED", "VALIDATION_FAILED", "ROLE_FORBIDDEN", "APPOINTMENT_FEED_SECRET_NOT_CONFIGURED", "APPOINTMENT_FEED_IDENTITY_INVALID"];
713
781
  export type AppointmentErrorCode = (typeof APPOINTMENT_ERROR_CODES)[number];
714
782
  /**
715
783
  * Which occurrences of a recurring booking an edit applies to —
@@ -35,12 +35,20 @@
35
35
  * belongs to another store, or was minted for a different query. The
36
36
  * envelope is opaque and pins the facets it was minted under, so a
37
37
  * replayed one is refused rather than resumed against the wrong index.
38
- * - `RECURRENCE_EXCEPTIONS_UNSUPPORTED` · 400 — a create or update body
39
- * carrying `recurrenceExceptions`. The api honours no exception list; the
40
- * key is refused by name rather than stripped, which is what it used to be
41
- * (a `200` that silently discarded the dates). Cancel the occurrence
42
- * instead. ⚠️ Refused on PRESENCE, not shape — `[]` and `null` too, since a
43
- * caller sending either still believes the server understands the field.
38
+ * - `RECURRENCE_EXCEPTIONS_UNSUPPORTED` · 400 — a **CREATE** body carrying
39
+ * `recurrenceExceptions`. The list is a series-scoped EDIT, never a
40
+ * create-time input: a series has no occurrences to exclude until it has been
41
+ * minted. ⚠️ **This code no longer reaches the UPDATE route** — it used to
42
+ * refuse both, when the api honoured no exception list at all. Refused on
43
+ * PRESENCE, not shape — `[]` and `null` too, since a caller sending either
44
+ * still believes create understands the field.
45
+ * - `RECURRENCE_EXCEPTIONS_SCOPE_REQUIRED` · 400 — an update carrying
46
+ * `recurrenceExceptions` with `scope` absent, `'this'` or `'this-and-future'`.
47
+ * The list lives on the PARENT row and describes the whole series, so only
48
+ * `scope: 'series'` addresses it. Refused rather than silently narrowed, for
49
+ * the same reason `APPOINTMENT_NOT_IN_SERIES` is: "I asked to change the
50
+ * series and it changed one" is indistinguishable from success above this
51
+ * layer.
44
52
  * - `VALIDATION_FAILED` · 400 — `stacks/helpers/validateRequest.ts`.
45
53
  * - `ROLE_FORBIDDEN` · 403
46
54
  * - `APPOINTMENT_FEED_SECRET_NOT_CONFIGURED` · 503 — the calendar feed's
@@ -96,6 +104,7 @@ export const APPOINTMENT_ERROR_CODES = [
96
104
  'RECURRENCE_SCOPE_REQUIRES_RULE_EDIT',
97
105
  'APPOINTMENT_STATUS_NOT_SCOPEABLE',
98
106
  'RECURRENCE_EXCEPTIONS_UNSUPPORTED',
107
+ 'RECURRENCE_EXCEPTIONS_SCOPE_REQUIRED',
99
108
  'VALIDATION_FAILED',
100
109
  'ROLE_FORBIDDEN',
101
110
  'APPOINTMENT_FEED_SECRET_NOT_CONFIGURED',
@@ -38,12 +38,20 @@ exports.APPOINTMENT_ICS_FEED_DAYS_AHEAD = exports.APPOINTMENT_ICS_FEED_DAYS_BACK
38
38
  * belongs to another store, or was minted for a different query. The
39
39
  * envelope is opaque and pins the facets it was minted under, so a
40
40
  * replayed one is refused rather than resumed against the wrong index.
41
- * - `RECURRENCE_EXCEPTIONS_UNSUPPORTED` · 400 — a create or update body
42
- * carrying `recurrenceExceptions`. The api honours no exception list; the
43
- * key is refused by name rather than stripped, which is what it used to be
44
- * (a `200` that silently discarded the dates). Cancel the occurrence
45
- * instead. ⚠️ Refused on PRESENCE, not shape — `[]` and `null` too, since a
46
- * caller sending either still believes the server understands the field.
41
+ * - `RECURRENCE_EXCEPTIONS_UNSUPPORTED` · 400 — a **CREATE** body carrying
42
+ * `recurrenceExceptions`. The list is a series-scoped EDIT, never a
43
+ * create-time input: a series has no occurrences to exclude until it has been
44
+ * minted. ⚠️ **This code no longer reaches the UPDATE route** — it used to
45
+ * refuse both, when the api honoured no exception list at all. Refused on
46
+ * PRESENCE, not shape — `[]` and `null` too, since a caller sending either
47
+ * still believes create understands the field.
48
+ * - `RECURRENCE_EXCEPTIONS_SCOPE_REQUIRED` · 400 — an update carrying
49
+ * `recurrenceExceptions` with `scope` absent, `'this'` or `'this-and-future'`.
50
+ * The list lives on the PARENT row and describes the whole series, so only
51
+ * `scope: 'series'` addresses it. Refused rather than silently narrowed, for
52
+ * the same reason `APPOINTMENT_NOT_IN_SERIES` is: "I asked to change the
53
+ * series and it changed one" is indistinguishable from success above this
54
+ * layer.
47
55
  * - `VALIDATION_FAILED` · 400 — `stacks/helpers/validateRequest.ts`.
48
56
  * - `ROLE_FORBIDDEN` · 403
49
57
  * - `APPOINTMENT_FEED_SECRET_NOT_CONFIGURED` · 503 — the calendar feed's
@@ -99,6 +107,7 @@ exports.APPOINTMENT_ERROR_CODES = [
99
107
  'RECURRENCE_SCOPE_REQUIRES_RULE_EDIT',
100
108
  'APPOINTMENT_STATUS_NOT_SCOPEABLE',
101
109
  'RECURRENCE_EXCEPTIONS_UNSUPPORTED',
110
+ 'RECURRENCE_EXCEPTIONS_SCOPE_REQUIRED',
102
111
  'VALIDATION_FAILED',
103
112
  'ROLE_FORBIDDEN',
104
113
  'APPOINTMENT_FEED_SECRET_NOT_CONFIGURED',
@@ -34,7 +34,7 @@
34
34
  * A cancelled order can still have the device on the shelf.
35
35
  */
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.SERVICE_TERMINAL_STATUSES = exports.SERVICE_STATUSES = exports.SERVICE_TRANSITIONS = void 0;
37
+ exports.SERVICE_CUSTODIES = exports.SERVICE_CUSTODY_TRANSITIONS = exports.SERVICE_TERMINAL_STATUSES = exports.SERVICE_STATUSES = exports.SERVICE_TRANSITIONS = void 0;
38
38
  /**
39
39
  * The legal moves on a service order. Exhaustive over `ServiceStatus` by
40
40
  * construction — adding a status to the union without a row here is a typecheck
@@ -106,3 +106,39 @@ exports.SERVICE_TERMINAL_STATUSES = [
106
106
  'returned_unrepaired',
107
107
  'abandoned_disposed',
108
108
  ];
109
+ /**
110
+ * Which custody moves are legal, keyed by the state being left.
111
+ *
112
+ * Declared HERE rather than in the api's service layer for the reason
113
+ * `SERVICE_TRANSITIONS` is: a client decides which options to OFFER, and a
114
+ * client that hand-pins the list keeps offering the old set after the api
115
+ * changes an edge — the operator then gets a refusal they cannot act on. One
116
+ * declaration, consumed by the api and published to the frontends.
117
+ *
118
+ * ⚠️ **`pending_receipt` is entered at intake and never re-entered.** It is
119
+ * absent from every other row's list on purpose: equipment that has arrived
120
+ * cannot un-arrive, and a ticket cannot be walked back to "not here yet" to
121
+ * hide that it was received. That is the only new constraint this table adds.
122
+ *
123
+ * ⚠️ **`returned` and `disposed` are NOT terminal, deliberately.** Custody is a
124
+ * statement about physical fact, not a workflow, and the operator UI presents
125
+ * this field as the correction surface for a closed ticket — it is the one
126
+ * field an already-delivered order can still edit. A mis-stamped `returned`
127
+ * (the status machine sets it automatically on `delivered`) would otherwise be
128
+ * uncorrectable, because `delivered` is itself a terminal STATUS with no way
129
+ * back. Locking these rows would turn one wrong click into permanent bad data
130
+ * about where someone else's property is.
131
+ */
132
+ exports.SERVICE_CUSTODY_TRANSITIONS = {
133
+ pending_receipt: ['in_shop'],
134
+ in_shop: ['returned', 'disposed'],
135
+ returned: ['in_shop', 'disposed'],
136
+ disposed: ['in_shop', 'returned'],
137
+ };
138
+ /**
139
+ * Every custody state. DERIVED from the table's keys for the same reason
140
+ * `SERVICE_STATUSES` is — a hand-written list proves each member valid but
141
+ * never proves the list complete, so a new state would compile clean while a
142
+ * validator built on the array silently 400s it.
143
+ */
144
+ exports.SERVICE_CUSTODIES = Object.keys(exports.SERVICE_CUSTODY_TRANSITIONS);
@@ -124,8 +124,16 @@ declare global {
124
124
  * and meaningless on any other.
125
125
  */
126
126
  type ServiceOutcome = 'declined' | 'unrepairable' | 'no_fault_found';
127
- /** Where the customer's property physically is, independent of `status`. */
128
- type ServiceCustody = 'in_shop' | 'returned' | 'disposed';
127
+ /**
128
+ * Where the customer's property physically is, independent of `status`.
129
+ *
130
+ * ⚠️ `pending_receipt` means the TICKET exists and the equipment does not —
131
+ * a job opened from a phone call to hold a queue slot, or one whose pickup
132
+ * has not run yet. It is a starting state only: `equipmentReceived: false`
133
+ * at intake is the one way to reach it, and NO transition leads back into
134
+ * it, because equipment that has arrived cannot un-arrive.
135
+ */
136
+ type ServiceCustody = 'pending_receipt' | 'in_shop' | 'returned' | 'disposed';
129
137
  /** Operator-set urgency, used for Kanban ordering and SLA hints. */
130
138
  type ServicePriority = 'low' | 'normal' | 'high' | 'urgent';
131
139
  /**
@@ -723,9 +731,15 @@ declare global {
723
731
  */
724
732
  hold?: ServiceHold;
725
733
  /**
726
- * Custody of the customer's property, independent of `status`. Stamped
727
- * `in_shop` at intake. This is what answers "which cancelled orders still
728
- * have equipment here?".
734
+ * Custody of the customer's property, independent of `status`. This is
735
+ * what answers "which cancelled orders still have equipment here?".
736
+ *
737
+ * Two starting states, chosen at intake by `equipmentReceived`: the
738
+ * default `in_shop` (the customer handed the equipment over), and
739
+ * `pending_receipt` (the ticket was opened first — a phone booking, or a
740
+ * pickup that has not run). ⚠️ A `pending_receipt` row is NOT holding
741
+ * anything, so a report answering "what is on our shelves" must filter
742
+ * to `in_shop` rather than to "not returned and not disposed".
729
743
  */
730
744
  custody: ServiceCustody;
731
745
  /**
@@ -1062,4 +1076,35 @@ export declare const SERVICE_STATUSES: [ServiceStatus, ...ServiceStatus[]];
1062
1076
  * type.
1063
1077
  */
1064
1078
  export declare const SERVICE_TERMINAL_STATUSES: readonly ["delivered", "cancelled", "returned_unrepaired", "abandoned_disposed"];
1079
+ /**
1080
+ * Which custody moves are legal, keyed by the state being left.
1081
+ *
1082
+ * Declared HERE rather than in the api's service layer for the reason
1083
+ * `SERVICE_TRANSITIONS` is: a client decides which options to OFFER, and a
1084
+ * client that hand-pins the list keeps offering the old set after the api
1085
+ * changes an edge — the operator then gets a refusal they cannot act on. One
1086
+ * declaration, consumed by the api and published to the frontends.
1087
+ *
1088
+ * ⚠️ **`pending_receipt` is entered at intake and never re-entered.** It is
1089
+ * absent from every other row's list on purpose: equipment that has arrived
1090
+ * cannot un-arrive, and a ticket cannot be walked back to "not here yet" to
1091
+ * hide that it was received. That is the only new constraint this table adds.
1092
+ *
1093
+ * ⚠️ **`returned` and `disposed` are NOT terminal, deliberately.** Custody is a
1094
+ * statement about physical fact, not a workflow, and the operator UI presents
1095
+ * this field as the correction surface for a closed ticket — it is the one
1096
+ * field an already-delivered order can still edit. A mis-stamped `returned`
1097
+ * (the status machine sets it automatically on `delivered`) would otherwise be
1098
+ * uncorrectable, because `delivered` is itself a terminal STATUS with no way
1099
+ * back. Locking these rows would turn one wrong click into permanent bad data
1100
+ * about where someone else's property is.
1101
+ */
1102
+ export declare const SERVICE_CUSTODY_TRANSITIONS: Readonly<Record<ServiceCustody, readonly ServiceCustody[]>>;
1103
+ /**
1104
+ * Every custody state. DERIVED from the table's keys for the same reason
1105
+ * `SERVICE_STATUSES` is — a hand-written list proves each member valid but
1106
+ * never proves the list complete, so a new state would compile clean while a
1107
+ * validator built on the array silently 400s it.
1108
+ */
1109
+ export declare const SERVICE_CUSTODIES: [ServiceCustody, ...ServiceCustody[]];
1065
1110
  export {};
@@ -103,3 +103,39 @@ export const SERVICE_TERMINAL_STATUSES = [
103
103
  'returned_unrepaired',
104
104
  'abandoned_disposed',
105
105
  ];
106
+ /**
107
+ * Which custody moves are legal, keyed by the state being left.
108
+ *
109
+ * Declared HERE rather than in the api's service layer for the reason
110
+ * `SERVICE_TRANSITIONS` is: a client decides which options to OFFER, and a
111
+ * client that hand-pins the list keeps offering the old set after the api
112
+ * changes an edge — the operator then gets a refusal they cannot act on. One
113
+ * declaration, consumed by the api and published to the frontends.
114
+ *
115
+ * ⚠️ **`pending_receipt` is entered at intake and never re-entered.** It is
116
+ * absent from every other row's list on purpose: equipment that has arrived
117
+ * cannot un-arrive, and a ticket cannot be walked back to "not here yet" to
118
+ * hide that it was received. That is the only new constraint this table adds.
119
+ *
120
+ * ⚠️ **`returned` and `disposed` are NOT terminal, deliberately.** Custody is a
121
+ * statement about physical fact, not a workflow, and the operator UI presents
122
+ * this field as the correction surface for a closed ticket — it is the one
123
+ * field an already-delivered order can still edit. A mis-stamped `returned`
124
+ * (the status machine sets it automatically on `delivered`) would otherwise be
125
+ * uncorrectable, because `delivered` is itself a terminal STATUS with no way
126
+ * back. Locking these rows would turn one wrong click into permanent bad data
127
+ * about where someone else's property is.
128
+ */
129
+ export const SERVICE_CUSTODY_TRANSITIONS = {
130
+ pending_receipt: ['in_shop'],
131
+ in_shop: ['returned', 'disposed'],
132
+ returned: ['in_shop', 'disposed'],
133
+ disposed: ['in_shop', 'returned'],
134
+ };
135
+ /**
136
+ * Every custody state. DERIVED from the table's keys for the same reason
137
+ * `SERVICE_STATUSES` is — a hand-written list proves each member valid but
138
+ * never proves the list complete, so a new state would compile clean while a
139
+ * validator built on the array silently 400s it.
140
+ */
141
+ export const SERVICE_CUSTODIES = Object.keys(SERVICE_CUSTODY_TRANSITIONS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.308",
3
+ "version": "1.10.310",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",