@happyvertical/smrt-timesheets 0.56.2 → 0.57.1
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/AGENTS.md +9 -3
- package/README.md +34 -5
- package/agents/period-rollup.md +13 -0
- package/dist/attendance/correction-service.d.ts +50 -9
- package/dist/attendance/correction-service.d.ts.map +1 -1
- package/dist/attendance/models.d.ts +6 -0
- package/dist/attendance/models.d.ts.map +1 -1
- package/dist/attendance/segments.d.ts.map +1 -1
- package/dist/attendance/service.d.ts +7 -1
- package/dist/attendance/service.d.ts.map +1 -1
- package/dist/attendance.js +2 -2
- package/dist/chunks/{attendance-mk6nqJhX.js → attendance-DAitZkht.js} +6 -6
- package/dist/chunks/attendance-DAitZkht.js.map +1 -0
- package/dist/chunks/{attendance-CDfhph1R.js → attendance-UY7sTXFx.js} +192 -38
- package/dist/chunks/attendance-UY7sTXFx.js.map +1 -0
- package/dist/chunks/{models-C1krjn40.js → models-BJcnFMOL.js} +14 -3
- package/dist/chunks/models-BJcnFMOL.js.map +1 -0
- package/dist/chunks/{rollup-C8p1PAXX.js → rollup-B-qdcGDs.js} +15 -7
- package/dist/chunks/rollup-B-qdcGDs.js.map +1 -0
- package/dist/chunks/service-time-entry-CWAVYIID.js +286 -0
- package/dist/chunks/service-time-entry-CWAVYIID.js.map +1 -0
- package/dist/chunks/{time-entry-actions-Bp--TxUD.js → time-entry-actions-BgaZCLL4.js} +2 -2
- package/dist/chunks/{time-entry-actions-Bp--TxUD.js.map → time-entry-actions-BgaZCLL4.js.map} +1 -1
- package/dist/index.js +5 -5
- package/dist/manifest.json +58 -5
- package/dist/rollup/attendance.d.ts +2 -2
- package/dist/rollup/attendance.d.ts.map +1 -1
- package/dist/rollup/calculation.d.ts +7 -1
- package/dist/rollup/calculation.d.ts.map +1 -1
- package/dist/rollup/service.d.ts.map +1 -1
- package/dist/rollup/types.d.ts +10 -0
- package/dist/rollup/types.d.ts.map +1 -1
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.d.ts.map +1 -1
- package/dist/rollup.js +1 -1
- package/dist/smrt-knowledge.json +25 -10
- package/package.json +7 -7
- package/dist/chunks/attendance-CDfhph1R.js.map +0 -1
- package/dist/chunks/attendance-mk6nqJhX.js.map +0 -1
- package/dist/chunks/models-C1krjn40.js.map +0 -1
- package/dist/chunks/rollup-C8p1PAXX.js.map +0 -1
- package/dist/chunks/service-time-entry-Cxh0pt0J.js +0 -286
- package/dist/chunks/service-time-entry-Cxh0pt0J.js.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -25,12 +25,16 @@ per-instance capability (`attendance/write.ts`, not exported) that lifts the
|
|
|
25
25
|
models' closed-interval checks for one save, validates the whole punch layout,
|
|
26
26
|
recomputes durations and appends an `AttendanceCorrection` (append-only ledger,
|
|
27
27
|
no generated operations; only a first acknowledgement by the subject may update
|
|
28
|
-
a row). Never export `write.ts`. Punch `source`/`deviceRef*` and break `kind` are immutable except through corrections; `autoCloseReason` is write-once via `persistAutoClose`. A confirmed `PeriodTimecard` is honoured by the
|
|
28
|
+
a row). An open punch accepts only a `startedAt` correction, closed breaks/segments inside it, and `addPunch({ open: true })`; the open break/segment and closing stay `AttendanceService`'s. Never export `write.ts`. Punch `source`/`deviceRef*` and break `kind` are immutable except through corrections; `autoCloseReason` is write-once via `persistAutoClose`. A confirmed `PeriodTimecard` is honoured by the
|
|
29
29
|
opt-in `confirmedTimecardGuard` (`rollup/correction-guard.ts`), which refuses
|
|
30
30
|
while a card is submitted or confirmed. `PeriodRollupService.reopen()` returns
|
|
31
31
|
such a card to `open` and appends a `TimecardReopening` (`timecard_reopenings`,
|
|
32
32
|
append-only, service-only via `rollup/write.ts`); `submit()` is the optional
|
|
33
33
|
open -> submitted step (`requireSubmission` makes it mandatory) (#3950).
|
|
34
|
+
`PeriodRollupOptions.attribution` (`'clip'` default | `'start'`) decides crossing
|
|
35
|
+
sources: `'start'` keeps a punch (breaks and segments included) or bounded entry
|
|
36
|
+
whole in the period containing its start, unclipped, and excludes it from the
|
|
37
|
+
next (`attributeSource` in `rollup/calculation.ts`) (#4028).
|
|
34
38
|
Segment transitions live in `attendance/segments.ts`; compose them with other
|
|
35
39
|
attendance writes via `AttendanceService.withTransaction`. Any new attendance
|
|
36
40
|
table must be added to the `includeObjects` lists in the `*.optional.test.ts`
|
|
@@ -178,7 +182,9 @@ Timecards and adjustments have closed generated surfaces and service-only
|
|
|
178
182
|
model writes; never bypass the instance capability with generic persistence.
|
|
179
183
|
|
|
180
184
|
Replay hashes the tap AS SENT (action, device `at`, paid, work, and `source`/`device`/`kind` only when present, so older receipts still match) so retries match;
|
|
181
|
-
`replay(taps, { resolveAt, now, refusal })` only changes the stored time and
|
|
182
|
-
|
|
185
|
+
`replay(taps, { resolveAt, now, refusal })` only changes the stored time, reason and the
|
|
186
|
+
punch's `recordedOffline`/`reviewRequired` (both default true and stay set across
|
|
187
|
+
later taps; false never clears an earlier flag). A reviewed correction clears
|
|
188
|
+
`reviewRequired`. Never hash the resolved time. Work actions (`startWork`, `switchWork`,
|
|
183
189
|
`stopWork`, `resumeWork`) run in the tap's transaction via `apply()`. Refusals store
|
|
184
190
|
`code` from `AttendanceConflict.code`; give new conflicts a code.
|
package/README.md
CHANGED
|
@@ -366,6 +366,21 @@ Indexes on `(tenantId, workRefType, workRefId)` and `(tenantId, taskRefType,
|
|
|
366
366
|
taskRefId)` serve job costing; a unique `(tenantId, punchId, openSlot)` index
|
|
367
367
|
allows one open segment per punch. Segments never overlap each other or a break.
|
|
368
368
|
|
|
369
|
+
`profileId` is the person whose time it is: the services copy it from the
|
|
370
|
+
segment's punch when creating a segment (`startWork`, `switchWork`, `resumeWork`, replayed
|
|
371
|
+
work actions, and the correction service's `saveSegment` and `addPunch`
|
|
372
|
+
segments), it is immutable, and a write whose `profileId` differs from its
|
|
373
|
+
punch's is refused. Indexed `(tenantId, profileId, startedAt)`, so labour by
|
|
374
|
+
person needs no join. After adding the column through migrations, legacy rows
|
|
375
|
+
have SQL NULL (hydrated as `null`); older text columns may also contain `''`.
|
|
376
|
+
Closing or correcting those segments remains supported. Before reporting by
|
|
377
|
+
person, run this idempotent backfill on SQLite or PostgreSQL; it preserves
|
|
378
|
+
populated identities and matches the punch within the same tenant:
|
|
379
|
+
`UPDATE attendance_segments SET profile_id = (SELECT p.profile_id FROM
|
|
380
|
+
attendance_punches p WHERE p.id = attendance_segments.punch_id AND p.tenant_id = attendance_segments.tenant_id)
|
|
381
|
+
WHERE COALESCE(CAST(profile_id AS TEXT), '') = '' AND EXISTS (SELECT 1 FROM
|
|
382
|
+
attendance_punches p WHERE p.id = attendance_segments.punch_id AND p.tenant_id = attendance_segments.tenant_id)`.
|
|
383
|
+
|
|
369
384
|
```ts
|
|
370
385
|
await attendance.punchIn(t(8));
|
|
371
386
|
await attendance.startWork(t(8), { workRefType: '@acme:WorkOrder', workRefId: 'WO-1',
|
|
@@ -431,7 +446,8 @@ migrate them as `TEXT NOT NULL DEFAULT ''` (a NULL left on an older row is read
|
|
|
431
446
|
`punchIn`, `punchOut`, `startBreak`, `endBreak`, or a work action (`startWork`,
|
|
432
447
|
`switchWork` (both require `work`), `stopWork`, `resumeWork`). It sorts each batch by device
|
|
433
448
|
time, then client id. Client ids are durable and scoped to tenant/profile.
|
|
434
|
-
Successful taps set `recordedOffline` and `reviewRequired
|
|
449
|
+
Successful taps set `recordedOffline` and `reviewRequired` unless `resolveAt` says otherwise;
|
|
450
|
+
they never clear a flag set by an earlier tap. The conflict policy
|
|
435
451
|
is **committed attendance wins**: an event predating committed activity, or
|
|
436
452
|
invalid for the current state, gets a durable error outcome. Identical retries
|
|
437
453
|
return that outcome even after later shifts; changed payloads using the same id
|
|
@@ -458,8 +474,13 @@ await attendance.replay(taps, {
|
|
|
458
474
|
|
|
459
475
|
The receipt hashes the tap as sent, so a retry with the same `clientId` still
|
|
460
476
|
matches even though the stored time differs; the outcome then has `resolvedAt`.
|
|
461
|
-
|
|
462
|
-
|
|
477
|
+
The resolver decides which flags this tap adds to the punch: `recordedOffline`
|
|
478
|
+
and `reviewRequired` both default to `true`. Returning `false` leaves a fresh
|
|
479
|
+
online punch unflagged, but never clears a flag from an earlier tap on the same
|
|
480
|
+
punch. A device can therefore replay every tap while keeping any late tap under
|
|
481
|
+
review. Use `AttendanceCorrectionService.correctPunch` to clear the review flag
|
|
482
|
+
after a person reviews it; offline provenance remains set.
|
|
483
|
+
`reviewRequired: true` also flags the resulting work segment (`AttendanceSegment.reviewRequired`,
|
|
463
484
|
a new column). A refused outcome stores `{ error, code }`: `code` defaults to the
|
|
464
485
|
`AttendanceConflict.code` (`predates_committed`, `punch_open`, `no_open_punch`,
|
|
465
486
|
`break_open`, `no_open_break`, `during_break`, `work_open`, `no_open_work`,
|
|
@@ -514,8 +535,16 @@ the ledger. The ledger has no generated operations, and every ledger,
|
|
|
514
535
|
closed-break and closed-segment write (insert, acknowledge, delete) is
|
|
515
536
|
service-only: a generic `save()`, `delete()` or collection `create()` is refused. Notes:
|
|
516
537
|
|
|
517
|
-
-
|
|
518
|
-
|
|
538
|
+
- Moving a punch edge past a break or segment is refused: correct those first.
|
|
539
|
+
- **Open punches** accept three corrections, each with a ledger row and the
|
|
540
|
+
same lock: `correctPunch({ punchId, startedAt })` changes the start only (it
|
|
541
|
+
cannot close the punch or move past its earliest break or segment);
|
|
542
|
+
`saveBreak`/`removeBreak`/`saveSegment`/`removeSegment` work on *closed*
|
|
543
|
+
intervals inside it (the open break or segment stays `AttendanceService`'s:
|
|
544
|
+
`startBreak`, `startWork`, ...); and `addPunch({ open: true, startedAt,
|
|
545
|
+
breaks?, segments?, ... })` records a missed clock-in that is still running,
|
|
546
|
+
with its closed breaks and segments, refused if the subject already has an
|
|
547
|
+
open punch. An open punch's durations are set when it closes.
|
|
519
548
|
- `correctPunch` clears `reviewRequired` (a person reviewed it). A linked
|
|
520
549
|
*draft* `ServiceTimeEntry` is kept in step; a submitted or approved one
|
|
521
550
|
refuses the correction until it is corrected with `ServiceEvidenceService`.
|
package/agents/period-rollup.md
CHANGED
|
@@ -134,6 +134,19 @@ Outputs are reloaded on the root executor after commit. Rollup reads are an
|
|
|
134
134
|
application snapshot: subsequent source approvals/corrections appear on the
|
|
135
135
|
next open rollup, and confirmed cards require explicit adjustments.
|
|
136
136
|
|
|
137
|
+
## Boundary attribution (#4028)
|
|
138
|
+
|
|
139
|
+
By default (`attribution: 'clip'`) a source crossing a period boundary is
|
|
140
|
+
prorated across every period it overlaps. Pass `{ attribution: 'start' }` for a
|
|
141
|
+
pay rule where a shift counts wholly in the period it started: an attendance
|
|
142
|
+
punch (its breaks and segments follow it) or a bounded evidence entry belongs,
|
|
143
|
+
unclipped, to the period containing its start and is excluded from the period
|
|
144
|
+
it spills into. A Sunday 22:00 to Monday 06:00 shift with a Monday 00:00
|
|
145
|
+
boundary rolls up as 8 h / 0 h under `'start'` and 2 h / 6 h under `'clip'`.
|
|
146
|
+
Source `endsAt` may then lie past the period end. Use one attribution per
|
|
147
|
+
person: switching it for periods already confirmed does not re-roll them, and
|
|
148
|
+
confirmed or submitted cards behave as before (reopen, then roll up again).
|
|
149
|
+
|
|
137
150
|
## Lifecycle: submit, confirm, reopen (#3950)
|
|
138
151
|
|
|
139
152
|
`open` (draft) -> `submitted` (optional) -> `confirmed`. `submit(id)` freezes an
|
|
@@ -33,6 +33,32 @@ export interface CorrectPunchInput extends AttendanceCorrectionRequest {
|
|
|
33
33
|
export interface AddPunchInput extends AttendanceCorrectionRequest, AttendancePunchOptions {
|
|
34
34
|
startedAt: Date;
|
|
35
35
|
endedAt: Date;
|
|
36
|
+
open?: false;
|
|
37
|
+
}
|
|
38
|
+
/** A closed break to record inside an added open punch. */
|
|
39
|
+
export interface AddPunchBreak {
|
|
40
|
+
startedAt: Date;
|
|
41
|
+
endedAt: Date;
|
|
42
|
+
paid?: boolean;
|
|
43
|
+
kind?: string;
|
|
44
|
+
}
|
|
45
|
+
/** A closed work segment to record inside an added open punch. */
|
|
46
|
+
export interface AddPunchSegment {
|
|
47
|
+
startedAt: Date;
|
|
48
|
+
endedAt: Date;
|
|
49
|
+
work: AttendanceWork;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Adds a punch that is still open, with the closed breaks and segments that
|
|
53
|
+
* happened since it began. Refused if the subject already has an open punch.
|
|
54
|
+
* The open break or segment, if any, stays with `AttendanceService`.
|
|
55
|
+
*/
|
|
56
|
+
export interface AddOpenPunchInput extends AttendanceCorrectionRequest, AttendancePunchOptions {
|
|
57
|
+
open: true;
|
|
58
|
+
startedAt: Date;
|
|
59
|
+
endedAt?: undefined;
|
|
60
|
+
breaks?: readonly AddPunchBreak[];
|
|
61
|
+
segments?: readonly AddPunchSegment[];
|
|
36
62
|
}
|
|
37
63
|
/** Adds a break when `breakId` is absent; otherwise changes that break. */
|
|
38
64
|
export interface SaveBreakInput extends AttendanceCorrectionRequest {
|
|
@@ -73,7 +99,9 @@ export interface RemoveSegmentInput extends AttendanceCorrectionRequest {
|
|
|
73
99
|
* no segment across a break), recomputes `durationSeconds` and
|
|
74
100
|
* `unpaidBreakSeconds`, keeps a still-draft linked service entry in step, and
|
|
75
101
|
* appends an `AttendanceCorrection` row, all in one transaction serialized with
|
|
76
|
-
* the subject's own taps.
|
|
102
|
+
* the subject's own taps. An open punch accepts three corrections only: its
|
|
103
|
+
* `startedAt`, closed breaks and segments inside it, and `addPunch({ open:
|
|
104
|
+
* true })`; closing it and the open break or segment stay with
|
|
77
105
|
* `AttendanceService`.
|
|
78
106
|
*/
|
|
79
107
|
export declare class AttendanceCorrectionService {
|
|
@@ -81,17 +109,25 @@ export declare class AttendanceCorrectionService {
|
|
|
81
109
|
private readonly options;
|
|
82
110
|
private readonly actor;
|
|
83
111
|
constructor(db: DatabaseInterface, actor: AttendanceActor, options?: AttendanceCorrectionOptions);
|
|
84
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Change a closed punch's start and/or end. A reviewed punch no longer needs
|
|
114
|
+
* review. An open punch may change `startedAt` only: it cannot be closed
|
|
115
|
+
* here, and its start cannot move past its earliest break or segment.
|
|
116
|
+
*/
|
|
85
117
|
correctPunch(input: CorrectPunchInput): Promise<AttendanceCorrection>;
|
|
86
|
-
/**
|
|
87
|
-
|
|
88
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Record a missed punch retroactively: a closed interval, or with
|
|
120
|
+
* `{ open: true }` one that is still running, carrying its closed breaks and
|
|
121
|
+
* segments.
|
|
122
|
+
*/
|
|
123
|
+
addPunch(input: AddPunchInput | AddOpenPunchInput): Promise<AttendanceCorrection>;
|
|
124
|
+
/** Add a closed break to a punch, or change one (times and/or paid). */
|
|
89
125
|
saveBreak(input: SaveBreakInput): Promise<AttendanceCorrection>;
|
|
90
|
-
/** Remove a break from a
|
|
126
|
+
/** Remove a closed break from a punch. */
|
|
91
127
|
removeBreak(input: RemoveBreakInput): Promise<AttendanceCorrection>;
|
|
92
|
-
/** Add a work segment to a
|
|
128
|
+
/** Add a closed work segment to a punch, or change one (times and/or work attribution). */
|
|
93
129
|
saveSegment(input: SaveSegmentInput): Promise<AttendanceCorrection>;
|
|
94
|
-
/** Remove a work segment from a
|
|
130
|
+
/** Remove a closed work segment from a punch. */
|
|
95
131
|
removeSegment(input: RemoveSegmentInput): Promise<AttendanceCorrection>;
|
|
96
132
|
/**
|
|
97
133
|
* The subject confirms they have seen a correction that required it. Only
|
|
@@ -102,10 +138,15 @@ export declare class AttendanceCorrectionService {
|
|
|
102
138
|
listForPunch(punchId: string): Promise<AttendanceCorrection[]>;
|
|
103
139
|
/** Corrections of the actor's own time that still await their acknowledgement. */
|
|
104
140
|
pendingAcknowledgements(): Promise<AttendanceCorrection[]>;
|
|
141
|
+
/** The range a correction touches, for period-lock checks: an open punch runs to now. */
|
|
142
|
+
private span;
|
|
143
|
+
private openPunchOf;
|
|
144
|
+
private correctOpenStart;
|
|
145
|
+
private addOpenPunch;
|
|
105
146
|
private attendance;
|
|
106
147
|
private read;
|
|
107
148
|
private run;
|
|
108
|
-
private
|
|
149
|
+
private anyPunch;
|
|
109
150
|
private children;
|
|
110
151
|
private layout;
|
|
111
152
|
private attribute;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correction-service.d.ts","sourceRoot":"","sources":["../../src/attendance/correction-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EAKpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oBAAoB,EAGrB,MAAM,wBAAwB,CAAC;AAShC,wEAAwE;AACxE,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,IAAI,CAAC;IACf,MAAM,EAAE,IAAI,CAAC;CACd;AAED;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACtC,EAAE,EAAE,iBAAiB,EACrB,OAAO,EAAE,eAAe,EACxB,SAAS,EAAE,SAAS,4BAA4B,EAAE,KAC/C,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAE5B,MAAM,WAAW,2BAA2B;IAC1C,KAAK,CAAC,EAAE,yBAAyB,CAAC;CACnC;AAED,uCAAuC;AACvC,MAAM,WAAW,2BAA2B;IAC1C,qCAAqC;IACrC,gBAAgB,EAAE,MAAM,CAAC;IACzB,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,iBAAkB,SAAQ,2BAA2B;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB;AACD,MAAM,WAAW,aACf,SAAQ,2BAA2B,EACjC,sBAAsB;IACxB,SAAS,EAAE,IAAI,CAAC;IAChB,OAAO,EAAE,IAAI,CAAC;CACf;AACD,2EAA2E;AAC3E,MAAM,WAAW,cAAe,SAAQ,2BAA2B;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AACD,MAAM,WAAW,gBAAiB,SAAQ,2BAA2B;IACnE,OAAO,EAAE,MAAM,CAAC;CACjB;AACD;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,2BAA2B;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AACD,MAAM,WAAW,kBAAmB,SAAQ,2BAA2B;IACrE,SAAS,EAAE,MAAM,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"correction-service.d.ts","sourceRoot":"","sources":["../../src/attendance/correction-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EAKpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oBAAoB,EAGrB,MAAM,wBAAwB,CAAC;AAShC,wEAAwE;AACxE,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,IAAI,CAAC;IACf,MAAM,EAAE,IAAI,CAAC;CACd;AAED;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACtC,EAAE,EAAE,iBAAiB,EACrB,OAAO,EAAE,eAAe,EACxB,SAAS,EAAE,SAAS,4BAA4B,EAAE,KAC/C,OAAO,CAAC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A2F;IACrF,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA6EzE,iDAAiD;IAC3C,aAAa,CACjB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,oBAAoB,CAAC;IAmBhC;;;OAGG;IACG,WAAW,CACf,YAAY,EAAE,MAAM,EACpB,EAAE,GAAE,IAAiB,GACpB,OAAO,CAAC,oBAAoB,CAAC;IA+BhC,8CAA8C;IACxC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAYpE,kFAAkF;IAC5E,uBAAuB,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAgBhE,yFAAyF;IACzF,OAAO,CAAC,IAAI;YAQE,WAAW;YAkBX,gBAAgB;YA+ChB,YAAY;IA+G1B,OAAO,CAAC,UAAU;YAOJ,IAAI;YAUJ,GAAG;YAwDH,QAAQ;YAiBR,QAAQ;IAiBtB,OAAO,CAAC,MAAM;IAuBd,OAAO,CAAC,SAAS;YASH,KAAK;IASnB,sFAAsF;YACxE,aAAa;IAe3B,0FAA0F;YAC5E,MAAM;CA6BrB"}
|
|
@@ -49,6 +49,12 @@ export type AttendanceSegmentCloseReason = (typeof SEGMENT_CLOSE_REASONS)[number
|
|
|
49
49
|
export declare class AttendanceSegment extends SmrtObject {
|
|
50
50
|
tenantId: string;
|
|
51
51
|
punchId: string;
|
|
52
|
+
/**
|
|
53
|
+
* The person whose time this is: its punch's `profileId`, set by the
|
|
54
|
+
* attendance and correction services on creation and immutable. Rows
|
|
55
|
+
* written before the column existed may read `null` (see the README backfill).
|
|
56
|
+
*/
|
|
57
|
+
profileId: string;
|
|
52
58
|
/** Qualified class name of the work context (for example a work order). */
|
|
53
59
|
workRefType: string;
|
|
54
60
|
workRefId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/attendance/models.ts"],"names":[],"mappings":"A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AAiB,CAAC;IAChF,MAAM,CAAC,QAAQ,CAAC,UAAU,2BAAqB;CAChD;AACD,sCAAsC;AACtC,qBAAa,0BAA2B,SAAQ,cAAc,CAAC,gBAAgB,CAAC;IAC9E,MAAM,CAAC,QAAQ,CAAC,UAAU,0BAAoB;CAC/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../src/attendance/segments.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAEpB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AASrB,4CAA4C;AAC5C,wBAAsB,WAAW,CAC/B,EAAE,EAAE,iBAAiB,EACrB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAMnC;AAED,6CAA6C;AAC7C,wBAAsB,YAAY,CAChC,EAAE,EAAE,iBAAiB,EACrB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAK9B;AAED,sFAAsF;AACtF,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,iBAAiB,EACrB,KAAK,EAAE,eAAe,EACtB,EAAE,EAAE,IAAI,EACR,MAAM,EAAE,OAAO,CAAC,4BAA4B,EAAE,EAAE,CAAC,GAChD,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CASnC;AAED,wEAAwE;AACxE,wBAAsB,YAAY,CAChC,EAAE,EAAE,iBAAiB,EACrB,KAAK,EAAE,eAAe,EACtB,EAAE,EAAE,IAAI,EACR,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../src/attendance/segments.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,cAAc,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B"}
|
|
@@ -37,8 +37,14 @@ export interface AttendanceTimeInput {
|
|
|
37
37
|
/** The effective time a policy chose, and whether a person should look at it. */
|
|
38
38
|
export interface AttendanceResolvedTime {
|
|
39
39
|
at: Date;
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Whether a person should review the result. Applies to the punch (default
|
|
42
|
+
* true when omitted) and, when true, the resulting work segment. False does
|
|
43
|
+
* not clear a punch's existing review requirement; use a reviewed correction.
|
|
44
|
+
*/
|
|
41
45
|
reviewRequired?: boolean;
|
|
46
|
+
/** Marks the punch offline (default true); false never clears an earlier flag. */
|
|
47
|
+
recordedOffline?: boolean;
|
|
42
48
|
}
|
|
43
49
|
/** Why a consumer refuses or rewrites the stored reason of a refused tap. */
|
|
44
50
|
export interface AttendanceRefusal {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/attendance/service.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EAKpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,eAAe,EAGf,KAAK,uBAAuB,EAC5B,iBAAiB,EAElB,MAAM,aAAa,CAAC;AAsBrB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,cAAc,eAAe,CAAC;AAE9B,uFAAu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AE,MAAM,EACf,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,eAAe,CAAC;IAY3B;;;;;;;;OAQG;IACG,SAAS,CACb,GAAG,EAAE,IAAI,EACT,QAAQ,EAAE,2BAA2B,GACpC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IA+ClC;;;;;OAKG;IACG,MAAM,CACV,IAAI,EAAE,SAAS,aAAa,EAAE,EAC9B,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,uBAAuB,EAAE,CAAC;CAgKtC"}
|
package/dist/attendance.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as AttendanceReplay, c as AttendanceSegmentCollection, i as AttendancePunchCollection, n as AttendanceBreakCollection, o as AttendanceReplayCollection, r as AttendancePunch, s as AttendanceSegment, t as AttendanceBreak } from "./chunks/models-
|
|
2
|
-
import { a as continueSegment, c as openSegment, d as validateAttendanceWork, f as ATTENDANCE_CORRECTION_KINDS, i as closeOpenSegment, l as replaceSegment, m as AttendanceCorrectionCollection, n as AttendanceService, o as endSegment, p as AttendanceCorrection, r as beginSegment, s as listSegments, t as AttendanceCorrectionService, u as AttendanceConflict } from "./chunks/attendance-
|
|
1
|
+
import { a as AttendanceReplay, c as AttendanceSegmentCollection, i as AttendancePunchCollection, n as AttendanceBreakCollection, o as AttendanceReplayCollection, r as AttendancePunch, s as AttendanceSegment, t as AttendanceBreak } from "./chunks/models-BJcnFMOL.js";
|
|
2
|
+
import { a as continueSegment, c as openSegment, d as validateAttendanceWork, f as ATTENDANCE_CORRECTION_KINDS, i as closeOpenSegment, l as replaceSegment, m as AttendanceCorrectionCollection, n as AttendanceService, o as endSegment, p as AttendanceCorrection, r as beginSegment, s as listSegments, t as AttendanceCorrectionService, u as AttendanceConflict } from "./chunks/attendance-UY7sTXFx.js";
|
|
3
3
|
export { ATTENDANCE_CORRECTION_KINDS, AttendanceBreak, AttendanceBreakCollection, AttendanceConflict, AttendanceCorrection, AttendanceCorrectionCollection, AttendanceCorrectionService, AttendancePunch, AttendancePunchCollection, AttendanceReplay, AttendanceReplayCollection, AttendanceSegment, AttendanceSegmentCollection, AttendanceService, beginSegment, closeOpenSegment, continueSegment, endSegment, listSegments, openSegment, replaceSegment, validateAttendanceWork };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as AttendancePunchCollection, n as AttendanceBreakCollection } from "./models-
|
|
2
|
-
import { i as integer, n as
|
|
1
|
+
import { i as AttendancePunchCollection, n as AttendanceBreakCollection } from "./models-BJcnFMOL.js";
|
|
2
|
+
import { i as integer, n as attributeSource, r as instant } from "./rollup-B-qdcGDs.js";
|
|
3
3
|
//#region src/rollup/attendance.ts
|
|
4
|
-
async function attendanceSources(db, actor, period) {
|
|
4
|
+
async function attendanceSources(db, actor, period, attribution = "clip") {
|
|
5
5
|
const punches = await AttendancePunchCollection.create({ db });
|
|
6
6
|
const breaks = await AttendanceBreakCollection.create({ db });
|
|
7
7
|
const sources = [];
|
|
@@ -39,13 +39,13 @@ async function attendanceSources(db, actor, period) {
|
|
|
39
39
|
for (const [left, right] of spans) {
|
|
40
40
|
const seconds = Math.round((paidMs + right - left) / 1e3) - Math.round(paidMs / 1e3);
|
|
41
41
|
paidMs += right - left;
|
|
42
|
-
const source =
|
|
42
|
+
const source = attributeSource({
|
|
43
43
|
kind: "attendance",
|
|
44
44
|
id: String(punch.id),
|
|
45
45
|
startsAt: new Date(left).toISOString(),
|
|
46
46
|
endsAt: new Date(right).toISOString(),
|
|
47
47
|
seconds
|
|
48
|
-
}, period);
|
|
48
|
+
}, period, attribution, start);
|
|
49
49
|
if (source?.seconds) sources.push(source);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -57,4 +57,4 @@ async function attendanceSources(db, actor, period) {
|
|
|
57
57
|
//#endregion
|
|
58
58
|
export { attendanceSources };
|
|
59
59
|
|
|
60
|
-
//# sourceMappingURL=attendance-
|
|
60
|
+
//# sourceMappingURL=attendance-DAitZkht.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attendance-DAitZkht.js","names":[],"sources":["../../src/rollup/attendance.ts"],"sourcesContent":["import type { DatabaseInterface } from '@happyvertical/sql';\nimport {\n AttendanceBreakCollection,\n AttendancePunchCollection,\n} from '../attendance/models.js';\nimport { attributeSource, instant, integer } from './calculation.js';\nimport type {\n RollupAttribution,\n TimecardActor,\n TimecardPeriod,\n TimecardSource,\n} from './types.js';\n\n/** Optional attendance reader. Called on the rollup's transaction executor. */\nexport async function attendanceSources(\n db: DatabaseInterface,\n actor: TimecardActor,\n period: TimecardPeriod,\n attribution: RollupAttribution = 'clip',\n): Promise<{ sources: TimecardSource[]; linkedEntryIds: Set<string> }> {\n const punches = await AttendancePunchCollection.create({ db });\n const breaks = await AttendanceBreakCollection.create({ db });\n const sources: TimecardSource[] = [];\n const linkedEntryIds = new Set<string>();\n for (const punch of await punches.list({ where: { ...actor } })) {\n // A linked punch is authoritative even when pending review: never count its\n // evidence entry behind the review gate, or outside the punch's period.\n if (punch.serviceTimeEntryId) linkedEntryIds.add(punch.serviceTimeEntryId);\n if (!punch.endedAt || punch.reviewRequired) continue;\n const start = instant(punch.startedAt);\n const end = instant(punch.endedAt);\n if (end < start) throw new Error('Invalid attendance interval.');\n let cursor = start;\n let unpaidMs = 0;\n const spans: [number, number][] = [];\n for (const pause of await breaks.list({\n where: { tenantId: actor.tenantId, punchId: punch.id },\n orderBy: 'started_at ASC',\n })) {\n if (!pause.endedAt)\n throw new Error('Closed attendance has an open break.');\n const left = instant(pause.startedAt);\n const right = instant(pause.endedAt);\n if (left < cursor || right < left || right > end)\n throw new Error('Invalid or overlapping attendance breaks.');\n if (!pause.paid) {\n spans.push([cursor, left]);\n unpaidMs += right - left;\n } else {\n spans.push([cursor, right]);\n }\n cursor = right;\n }\n spans.push([cursor, end]);\n const net = Math.round((end - start - unpaidMs) / 1000);\n if (integer(punch.durationSeconds) !== net)\n throw new Error('Attendance duration does not match its breaks.');\n // Round elapsed paid prefixes once, preserving conservation across breaks.\n let paidMs = 0;\n for (const [left, right] of spans) {\n const seconds =\n Math.round((paidMs + right - left) / 1000) - Math.round(paidMs / 1000);\n paidMs += right - left;\n const source = attributeSource(\n {\n kind: 'attendance',\n id: String(punch.id),\n startsAt: new Date(left).toISOString(),\n endsAt: new Date(right).toISOString(),\n seconds,\n },\n period,\n attribution,\n start,\n );\n if (source?.seconds) sources.push(source);\n }\n }\n return { sources, linkedEntryIds };\n}\n"],"mappings":";;;AAcA,eAAsB,kBACpB,IACA,OACA,QACA,cAAiC,QACoC;CACrE,MAAM,UAAU,MAAM,0BAA0B,OAAO,EAAE,GAAG,CAAC;CAC7D,MAAM,SAAS,MAAM,0BAA0B,OAAO,EAAE,GAAG,CAAC;CAC5D,MAAM,UAA4B,CAAC;CACnC,MAAM,iCAAiB,IAAI,IAAY;CACvC,KAAA,MAAW,SAAS,MAAM,QAAQ,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC,GAAG;EAG/D,IAAI,MAAM,oBAAoB,eAAe,IAAI,MAAM,kBAAkB;EACzE,IAAI,CAAC,MAAM,WAAW,MAAM,gBAAgB;EAC5C,MAAM,QAAQ,QAAQ,MAAM,SAAS;EACrC,MAAM,MAAM,QAAQ,MAAM,OAAO;EACjC,IAAI,MAAM,OAAO,MAAM,IAAI,MAAM,8BAA8B;EAC/D,IAAI,SAAS;EACb,IAAI,WAAW;EACf,MAAM,QAA4B,CAAC;EACnC,KAAA,MAAW,SAAS,MAAM,OAAO,KAAK;GACpC,OAAO;IAAE,UAAU,MAAM;IAAU,SAAS,MAAM;GAAG;GACrD,SAAS;EACX,CAAC,GAAG;GACF,IAAI,CAAC,MAAM,SACT,MAAM,IAAI,MAAM,sCAAsC;GACxD,MAAM,OAAO,QAAQ,MAAM,SAAS;GACpC,MAAM,QAAQ,QAAQ,MAAM,OAAO;GACnC,IAAI,OAAO,UAAU,QAAQ,QAAQ,QAAQ,KAC3C,MAAM,IAAI,MAAM,2CAA2C;GAC7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