@happyvertical/smrt-timesheets 0.56.0 → 0.56.2
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 +34 -0
- package/README.md +34 -1
- package/dist/attendance.js +2 -2
- package/dist/chunks/{attendance-DGVy-iHI.js → attendance-CDfhph1R.js} +3 -3
- package/dist/chunks/{attendance-DGVy-iHI.js.map → attendance-CDfhph1R.js.map} +1 -1
- package/dist/chunks/{attendance-B1jCbqSb.js → attendance-mk6nqJhX.js} +3 -3
- package/dist/chunks/{attendance-B1jCbqSb.js.map → attendance-mk6nqJhX.js.map} +1 -1
- package/dist/chunks/{models-0-YD5F_o.js → models-C1krjn40.js} +2 -2
- package/dist/chunks/{models-0-YD5F_o.js.map → models-C1krjn40.js.map} +1 -1
- package/dist/chunks/{rollup-CDqzCxI2.js → rollup-C8p1PAXX.js} +3 -3
- package/dist/chunks/{rollup-CDqzCxI2.js.map → rollup-C8p1PAXX.js.map} +1 -1
- package/dist/chunks/service-time-entry-Cxh0pt0J.js +286 -0
- package/dist/chunks/service-time-entry-Cxh0pt0J.js.map +1 -0
- package/dist/chunks/time-entry-actions-Bp--TxUD.js +576 -0
- package/dist/chunks/time-entry-actions-Bp--TxUD.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +113 -334
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +373 -17
- package/dist/models/service-snapshots.d.ts.map +1 -1
- package/dist/models/service-time-entry.d.ts +36 -1
- package/dist/models/service-time-entry.d.ts.map +1 -1
- package/dist/recipes.d.ts +124 -0
- package/dist/recipes.d.ts.map +1 -0
- package/dist/rollup.js +1 -1
- package/dist/services/action-principal.d.ts +54 -0
- package/dist/services/action-principal.d.ts.map +1 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/time-entry-actions.d.ts +83 -0
- package/dist/services/time-entry-actions.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +230 -34
- package/package.json +8 -7
- package/dist/chunks/service-time-entry-t7P-bkOQ.js +0 -227
- package/dist/chunks/service-time-entry-t7P-bkOQ.js.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -48,6 +48,40 @@ files.
|
|
|
48
48
|
through a `ServiceCommercialResolver`), and corrects. `smrt-projects` supplies
|
|
49
49
|
`SubscriptionServiceCommercialResolver` for #1925 pricing.
|
|
50
50
|
|
|
51
|
+
## Generated write actions (#4001)
|
|
52
|
+
|
|
53
|
+
Generated CRUD writes stay closed. `ServiceTimeEntryCollection` hosts the only
|
|
54
|
+
generated writes, `record` / `submit` / `approve` (`POST
|
|
55
|
+
/servicetimeentries/<action>`, body `{ entryId }` for submit/approve), on REST
|
|
56
|
+
only; MCP and CLI stay read-only until per-operation MCP authorization (#4004).
|
|
57
|
+
`services/time-entry-actions.ts` delegates each to `ServiceEvidenceService`, so
|
|
58
|
+
the trail and snapshots are set in one place. `services/action-principal.ts`
|
|
59
|
+
takes identity from the tenancy ALS, then the smrt-users session ALS, never the
|
|
60
|
+
body; authorizes `servicetimeentries.<action>` with `assertOperationPermission`
|
|
61
|
+
(system context never bypasses; `approve` refuses super-admin bypass); and
|
|
62
|
+
stamps the user's linked profile. Only the participant records/submits their
|
|
63
|
+
own time unless the caller holds `approve`. `approve` prices with the host's
|
|
64
|
+
`setServiceTimeEntryCommercialResolver()` — a factory called per request with
|
|
65
|
+
the collection's options, so a writing resolver shares the request executor;
|
|
66
|
+
without one it is a 409 and writes nothing. The runtime REST transport gates
|
|
67
|
+
a collection-hosted action on the ITEM's `api.include`, SvelteKit on the
|
|
68
|
+
collection's, so both list the actions;
|
|
69
|
+
a consumer closing them overrides both registrations. The collection and both
|
|
70
|
+
snapshot collections carry their own `@smrt()` surface: undecorated, they
|
|
71
|
+
published generated create/update/delete MCP tools. `reject` waits for #3994.
|
|
72
|
+
|
|
73
|
+
## Recipe
|
|
74
|
+
|
|
75
|
+
`src/recipes.ts` declares one `SmrtRecipe`, `timesheets.time-entries`
|
|
76
|
+
(label "Time entries", section `work`), emitted into the built
|
|
77
|
+
`manifest.json` and `smrt-knowledge.json` `recipes`. It shows
|
|
78
|
+
`ServiceTimeEntry` alone, with the generic work reference, evidence, agent
|
|
79
|
+
and approval-trail fields hidden; attendance and rollup models stay out of
|
|
80
|
+
it. `status` and its trail are hidden and locked, and the help never says to
|
|
81
|
+
set them: `save()` accepts a bare transition, so submit and approve must go
|
|
82
|
+
through `ServiceEvidenceService` (the recipe declares no surface for that). Help lives in `src/time-entries.recipe.md` (#3591); keep it and the recipe
|
|
83
|
+
in plain language. See [core recipes](../core/agents/recipes.md).
|
|
84
|
+
|
|
51
85
|
## Invariants
|
|
52
86
|
|
|
53
87
|
- **No domain foreign key on the base.** Work context is the generic
|
package/README.md
CHANGED
|
@@ -131,10 +131,41 @@ recording facade remains seconds-based; its shared entry view uses
|
|
|
131
131
|
`TimeEntryApprovalQueue` are props-driven: hosts load entries and pass plain
|
|
132
132
|
view objects (`TimeEntry`, `TimeEntryApprovalView`).
|
|
133
133
|
|
|
134
|
+
## Generated write actions
|
|
135
|
+
|
|
136
|
+
Generated CRUD writes are closed. The write path a generated app can call is
|
|
137
|
+
three service-backed REST actions on `ServiceTimeEntryCollection` (#4001):
|
|
138
|
+
|
|
139
|
+
| Route | Body | Permission |
|
|
140
|
+
|---|---|---|
|
|
141
|
+
| `POST /servicetimeentries/record` | work ref, `source` (`manual`/`timer`), times or `durationSeconds`/`durationHours`, optional `participantProfileId` | `servicetimeentries.record` |
|
|
142
|
+
| `POST /servicetimeentries/submit` | `{ entryId }` | `servicetimeentries.submit` |
|
|
143
|
+
| `POST /servicetimeentries/approve` | `{ entryId }` | `servicetimeentries.approve` (no super-admin bypass) |
|
|
144
|
+
|
|
145
|
+
Each delegates to `ServiceEvidenceService`, so `submittedAt`/`submittedBy`,
|
|
146
|
+
`approvedAt`/`approvedBy`/`approvalPath` (`operator`) and both snapshots are
|
|
147
|
+
set exactly as the service sets them. The tenant and the acting profile come
|
|
148
|
+
from the authenticated session, never the body. Recording or submitting
|
|
149
|
+
someone else's time needs `approve` as well. Install pricing for `approve`
|
|
150
|
+
as a factory, so a resolver that writes (client charges) runs on the request's
|
|
151
|
+
executor and transaction:
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import { setServiceTimeEntryCommercialResolver } from '@happyvertical/smrt-timesheets';
|
|
155
|
+
|
|
156
|
+
setServiceTimeEntryCommercialResolver(({ options }) =>
|
|
157
|
+
SubscriptionServiceCommercialResolver.create(options, provider),
|
|
158
|
+
);
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Without a resolver, `approve` answers 409 `approval_not_configured`. MCP and
|
|
162
|
+
CLI stay read-only; there is no `reject` action yet (#3994).
|
|
163
|
+
|
|
134
164
|
## Closing the generated surface
|
|
135
165
|
|
|
136
166
|
The entry and both snapshots expose generated `list` / `get` on REST, CLI,
|
|
137
|
-
and MCP, with optional tenant scoping
|
|
167
|
+
and MCP, with optional tenant scoping, and the entry's collection the write
|
|
168
|
+
actions above. An application that routes all time
|
|
138
169
|
and money through its own permission-gated services can close those surfaces
|
|
139
170
|
without declaring replacement models:
|
|
140
171
|
|
|
@@ -144,6 +175,8 @@ import '@happyvertical/smrt-timesheets';
|
|
|
144
175
|
|
|
145
176
|
for (const name of [
|
|
146
177
|
'ServiceTimeEntry',
|
|
178
|
+
// Hosts the record/submit/approve actions on generated SvelteKit routes.
|
|
179
|
+
'ServiceTimeEntryCollection',
|
|
147
180
|
'ServiceChargeSnapshot',
|
|
148
181
|
'ServiceCompensationSnapshot',
|
|
149
182
|
]) {
|
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-C1krjn40.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-CDfhph1R.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,5 +1,5 @@
|
|
|
1
|
-
import { i as ServiceTimeEntryCollection, o as parseTimesheetJson } from "./service-time-entry-
|
|
2
|
-
import { c as AttendanceSegmentCollection, d as persistAutoClose, f as persistCorrection, i as AttendancePunchCollection, l as deleteCorrection, n as AttendanceBreakCollection, o as AttendanceReplayCollection, r as AttendancePunch, s as AttendanceSegment, t as AttendanceBreak, u as isCorrectionWrite } from "./models-
|
|
1
|
+
import { i as ServiceTimeEntryCollection, o as parseTimesheetJson } from "./service-time-entry-Cxh0pt0J.js";
|
|
2
|
+
import { c as AttendanceSegmentCollection, d as persistAutoClose, f as persistCorrection, i as AttendancePunchCollection, l as deleteCorrection, n as AttendanceBreakCollection, o as AttendanceReplayCollection, r as AttendancePunch, s as AttendanceSegment, t as AttendanceBreak, u as isCorrectionWrite } from "./models-C1krjn40.js";
|
|
3
3
|
import { SmrtCollection, SmrtObject, crossPackageRef, field, foreignKey, isEmbeddedDatabase, isPostgresDatabase, smrt, withEmbeddedWriteTransaction } from "@happyvertical/smrt-core";
|
|
4
4
|
import { TenantScoped, getTenantId, tenantId, withTenant } from "@happyvertical/smrt-tenancy";
|
|
5
5
|
//#region src/attendance/correction-models.ts
|
|
@@ -1243,4 +1243,4 @@ var AttendanceCorrectionService = class {
|
|
|
1243
1243
|
//#endregion
|
|
1244
1244
|
export { continueSegment as a, openSegment as c, validateAttendanceWork as d, ATTENDANCE_CORRECTION_KINDS as f, closeOpenSegment as i, replaceSegment as l, AttendanceCorrectionCollection as m, AttendanceService as n, endSegment as o, AttendanceCorrection as p, beginSegment as r, listSegments as s, AttendanceCorrectionService as t, AttendanceConflict as u };
|
|
1245
1245
|
|
|
1246
|
-
//# sourceMappingURL=attendance-
|
|
1246
|
+
//# sourceMappingURL=attendance-CDfhph1R.js.map
|