sinfactura-types 1.10.307 → 1.10.309

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',
@@ -36,13 +36,27 @@ exports.SOCKET_ACTIONS = [
36
36
  // Entity upserts — mostly emitted by `dynamoUpdate`'s auto-broadcast.
37
37
  'account',
38
38
  /**
39
- * A scheduled booking created, updated or cancelled. Operator-only —
40
- * broadcast via `wsPostStore(..., { audience: 'operator' })`; Phase 1 is an
41
- * internal ops tool with no customer-facing booking surface.
39
+ * A scheduled booking created, updated or cancelled. TWO shapes now share
40
+ * this one action, keyed by the RECEIVING socket:
42
41
  *
43
- * `data` is the `Appointment` row. One action covers create, update AND
44
- * cancel: a cancellation is `status: 'CANCELLED'`, never a row delete, so a
45
- * separate delete frame would describe a transition that never happens.
42
+ * - **Operator frame** — the full `Appointment` row, via
43
+ * `wsPostStore(..., { audience: 'operator' })`. Unchanged since Phase 1.
44
+ * - **Customer frame** — a SEPARATE, allow-listed projection
45
+ * (`toPublicAppointment`, `stacks/services/appointments.ts`) via
46
+ * `wsPostCustomer`, sent only when the row carries a `customerId`. This
47
+ * is a second, independent frame — never `wsPostStore`'s
48
+ * `'operator-and-customer'` audience — because the hidden fields
49
+ * (`assignedTo`, `cancelledBy`, `supplierId`, `recurrenceRule`,
50
+ * `recurrenceId`, `version`) are per-entity and a generic scrub has no
51
+ * list to draw on. Sent for operator-initiated writes (create,
52
+ * status-change, reschedule, cancel — `stacks/lambdas/appointments/`);
53
+ * the customer's OWN web-surface writes stay operator-only, since their
54
+ * REST response already IS their confirmation. Not sent for a scoped
55
+ * series edit (`this-and-future`/`series`) or the waitlist action below.
56
+ *
57
+ * One action still covers create, update AND cancel: a cancellation is
58
+ * `status: 'CANCELLED'`, never a row delete, so a separate delete frame
59
+ * would describe a transition that never happens.
46
60
  */
47
61
  'appointments',
48
62
  /**
@@ -50,6 +64,8 @@ exports.SOCKET_ACTIONS = [
50
64
  * Operator-only, broadcast via `wsPostStore(..., { audience: 'operator' })`:
51
65
  * `/appointments/waitlist` is an internal ops surface with no customer-facing
52
66
  * side, and the queue discloses who else is waiting for the same window.
67
+ * ⚠️ Structurally excluded from a customer frame, not merely by policy —
68
+ * `AppointmentWaitlistChange` (below) carries no `customerId` at all.
53
69
  *
54
70
  * ⚠️ **`data` is `AppointmentWaitlistChange` — the slot address plus the new
55
71
  * queue depth — never an `AppointmentWaitlistEntry` and never the queue
package/dist/socket.js CHANGED
@@ -33,13 +33,27 @@ export const SOCKET_ACTIONS = [
33
33
  // Entity upserts — mostly emitted by `dynamoUpdate`'s auto-broadcast.
34
34
  'account',
35
35
  /**
36
- * A scheduled booking created, updated or cancelled. Operator-only —
37
- * broadcast via `wsPostStore(..., { audience: 'operator' })`; Phase 1 is an
38
- * internal ops tool with no customer-facing booking surface.
36
+ * A scheduled booking created, updated or cancelled. TWO shapes now share
37
+ * this one action, keyed by the RECEIVING socket:
39
38
  *
40
- * `data` is the `Appointment` row. One action covers create, update AND
41
- * cancel: a cancellation is `status: 'CANCELLED'`, never a row delete, so a
42
- * separate delete frame would describe a transition that never happens.
39
+ * - **Operator frame** — the full `Appointment` row, via
40
+ * `wsPostStore(..., { audience: 'operator' })`. Unchanged since Phase 1.
41
+ * - **Customer frame** — a SEPARATE, allow-listed projection
42
+ * (`toPublicAppointment`, `stacks/services/appointments.ts`) via
43
+ * `wsPostCustomer`, sent only when the row carries a `customerId`. This
44
+ * is a second, independent frame — never `wsPostStore`'s
45
+ * `'operator-and-customer'` audience — because the hidden fields
46
+ * (`assignedTo`, `cancelledBy`, `supplierId`, `recurrenceRule`,
47
+ * `recurrenceId`, `version`) are per-entity and a generic scrub has no
48
+ * list to draw on. Sent for operator-initiated writes (create,
49
+ * status-change, reschedule, cancel — `stacks/lambdas/appointments/`);
50
+ * the customer's OWN web-surface writes stay operator-only, since their
51
+ * REST response already IS their confirmation. Not sent for a scoped
52
+ * series edit (`this-and-future`/`series`) or the waitlist action below.
53
+ *
54
+ * One action still covers create, update AND cancel: a cancellation is
55
+ * `status: 'CANCELLED'`, never a row delete, so a separate delete frame
56
+ * would describe a transition that never happens.
43
57
  */
44
58
  'appointments',
45
59
  /**
@@ -47,6 +61,8 @@ export const SOCKET_ACTIONS = [
47
61
  * Operator-only, broadcast via `wsPostStore(..., { audience: 'operator' })`:
48
62
  * `/appointments/waitlist` is an internal ops surface with no customer-facing
49
63
  * side, and the queue discloses who else is waiting for the same window.
64
+ * ⚠️ Structurally excluded from a customer frame, not merely by policy —
65
+ * `AppointmentWaitlistChange` (below) carries no `customerId` at all.
50
66
  *
51
67
  * ⚠️ **`data` is `AppointmentWaitlistChange` — the slot address plus the new
52
68
  * queue depth — never an `AppointmentWaitlistEntry` and never the queue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.307",
3
+ "version": "1.10.309",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",