sinfactura-types 1.10.281 → 1.10.283

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.
@@ -36,6 +36,10 @@ declare global {
36
36
  * fail at the database rather than at a read-then-write the second tap can
37
37
  * race. Disposable state, not audit: it is DELETED on clock-out rather than
38
38
  * corrected — the ledger already holds what happened.
39
+ *
40
+ * Written by clock-in, and by `POST /attendance/correction` when a correction
41
+ * leaves TODAY's Buenos Aires day open and the employee holds none. Never for
42
+ * a past day, and never over an existing one.
39
43
  */
40
44
  interface OpenShift {
41
45
  storeId: string;
@@ -48,11 +52,24 @@ declare global {
48
52
  * Soft anomaly markers surfaced for supervisor review. Never hard gates —
49
53
  * none of these may block a punch or withhold a shift.
50
54
  *
51
- * ⚠️ **Membership here is not evidence the api sets it.** Three of the four
55
+ * ⚠️ **Membership here is not evidence the api sets it.** Four of the five
52
56
  * are written; one is published ahead of any emitter:
53
57
  *
54
58
  * - `OVERTIME` — LIVE, from `attendance/_postClockOut.ts`.
55
59
  * - `MISSED_CLOCK_OUT` — LIVE, from `attendanceSweep/index.ts`.
60
+ * - `NO_CLOCK_IN` — LIVE, DERIVED by `projectShiftFromClockEvents`
61
+ * (`services/attendance.ts`), so the live and correction paths share one
62
+ * implementation. It marks a day whose effective punches hold no
63
+ * `CLOCK_IN` at all — only a break pair, or a clock-out that closes
64
+ * nothing — which yields no hours and would otherwise surface nowhere: the
65
+ * missed-clock-out sweep reads the `OpenShift` sentinel, and such a day has
66
+ * none because no clock-in ever claimed one. The day stays `OPEN`, and the
67
+ * flag is what puts it in `GET /attendance/flagged`. ⚠️ It CLEARS the
68
+ * moment a clock-in is supplied — by re-derivation on the correction path,
69
+ * and by subtraction at clock-in, which is the one merging writer that
70
+ * takes a flag away (the punch it is writing is the flag's own refutation).
71
+ * Read its absence as "the day has a clock-in", never as "the day is
72
+ * complete".
56
73
  * - `LATE` — LIVE, from `attendance/_postClockIn.ts` via
57
74
  * `resolveClockInFlagFields`, which resolves the employee's expected start
58
75
  * from the api-local `SCHED#`/`SCHEDEX#` schedule config and compares
@@ -72,7 +89,7 @@ declare global {
72
89
  * believe the anomaly surface is covered. It has already cost one
73
90
  * cross-repo investigation.
74
91
  */
75
- type AttendanceShiftFlag = 'LATE' | 'MISSED_CLOCK_OUT' | 'OUTSIDE_GEOFENCE' | 'OVERTIME';
92
+ type AttendanceShiftFlag = 'LATE' | 'MISSED_CLOCK_OUT' | 'NO_CLOCK_IN' | 'OUTSIDE_GEOFENCE' | 'OVERTIME';
76
93
  /**
77
94
  * The derived daily roll-up — one per employee per day. PK `STORE#{storeId}`,
78
95
  * SK `SHIFT#{date}#{userId}`. The composite id mirrors `CashShift`'s
@@ -107,6 +124,27 @@ declare global {
107
124
  status: AttendanceShiftStatus;
108
125
  clockInAt: number;
109
126
  clockOutAt?: number;
127
+ /**
128
+ * ms epoch. The start of the day's still-open period, as the api pairs the
129
+ * day's effective clock-ins and clock-outs. DERIVED and read-only: no
130
+ * request body can set it.
131
+ *
132
+ * Present ONLY while the day's last period has no clock-out. That is a row
133
+ * with `status: 'OPEN'`, or `'FLAGGED'` when the missed-clock-out sweep has
134
+ * flagged a day that is still open. It is removed by every write that closes
135
+ * the day, so it never outlives an open period.
136
+ *
137
+ * Not the same as `clockInAt`, which stays the day's FIRST clock-in: on a
138
+ * day worked 09:00–12:00 and reopened at 13:00, `clockInAt` is 09:00 and
139
+ * this is 13:00. Unlike `OpenShift.clockInAt`, it also exists for a PAST
140
+ * day left open, which never gets a sentinel.
141
+ *
142
+ * ⚠️ Forward-only: an open row written before this field existed does not
143
+ * carry it until something re-derives the day. A `status: 'OPEN'` row
144
+ * without it is either such a row, or a day with no clock-in at all (only
145
+ * a break or an unpaired clock-out recorded).
146
+ */
147
+ openPeriodStartAt?: number;
110
148
  totalMinutes?: number;
111
149
  breakMinutes?: number;
112
150
  overtimeMinutes?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.281",
3
+ "version": "1.10.283",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",