@substrat-run/engine-workorder 0.7.3 → 0.8.0
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/dist/index.d.ts +39 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +75 -25
- package/dist/index.js.map +1 -1
- package/dist/lifecycle.d.ts +117 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +76 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/model.d.ts +15 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +18 -0
- package/dist/model.js.map +1 -0
- package/dist/operations.d.ts +11 -3
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +16 -2
- package/dist/operations.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type Money } from '@substrat-run/contracts';
|
|
2
|
+
import { type Page, type Money } from '@substrat-run/contracts';
|
|
3
|
+
import type { PageParams } from '@substrat-run/kernel';
|
|
3
4
|
/**
|
|
4
5
|
* The conflict reasons this engine raises — its own vocabulary, narrowing the platform's
|
|
5
6
|
* `conflict` code (#113). Exported so a vertical can branch on WHY a refusal happened
|
|
@@ -9,12 +10,13 @@ import { type Money } from '@substrat-run/contracts';
|
|
|
9
10
|
* Additive only, like every other engine surface: new reasons may appear, existing ones
|
|
10
11
|
* do not change spelling.
|
|
11
12
|
*/
|
|
12
|
-
export declare const WORKORDER_CONFLICT_REASONS: readonly [
|
|
13
|
+
export declare const WORKORDER_CONFLICT_REASONS: readonly ["invalid_transition"];
|
|
13
14
|
export type WorkorderConflictReason = (typeof WORKORDER_CONFLICT_REASONS)[number];
|
|
14
15
|
import { type BillableLine, type WorkOrder, type TimeEntry, type MaterialLine } from './schemas.js';
|
|
15
16
|
export { workorderEntities, workorderRow } from './entities.js';
|
|
16
17
|
export { billableLine, decimal, workOrder, timeEntry, materialLine, type BillableLine, type WorkOrder, type TimeEntry, type MaterialLine, } from './schemas.js';
|
|
17
18
|
export { workorderOperations, WORKORDER_PERMISSIONS } from './operations.js';
|
|
19
|
+
export { workorderLifecycles, workorderLifecycle } from './lifecycle.js';
|
|
18
20
|
import { type ModuleRegistration, type OperationContext } from '@substrat-run/kernel';
|
|
19
21
|
export declare const PERM: {
|
|
20
22
|
create: string & z.$brand<"PermissionKey">;
|
|
@@ -92,6 +94,13 @@ export declare const workorderManifest: {
|
|
|
92
94
|
idColumn?: string | undefined;
|
|
93
95
|
tokenizer?: "prefix" | "substring" | undefined;
|
|
94
96
|
}[] | undefined;
|
|
97
|
+
lists?: {
|
|
98
|
+
entityType: string;
|
|
99
|
+
sortable: string[];
|
|
100
|
+
filterable?: string[] | undefined;
|
|
101
|
+
table?: string | undefined;
|
|
102
|
+
idColumn?: string | undefined;
|
|
103
|
+
}[] | undefined;
|
|
95
104
|
ui?: {
|
|
96
105
|
routes?: {
|
|
97
106
|
path: string;
|
|
@@ -143,7 +152,34 @@ export declare function getReportedLines(ctx: OperationContext, orderId: string)
|
|
|
143
152
|
time: TimeEntry[];
|
|
144
153
|
material: MaterialLine[];
|
|
145
154
|
};
|
|
146
|
-
|
|
155
|
+
/**
|
|
156
|
+
* A page of work orders (#811).
|
|
157
|
+
*
|
|
158
|
+
* The `WHERE`, the `ORDER BY`, the keyset comparison and the `LIMIT` are the
|
|
159
|
+
* kernel's, composed from this operation's declared `paged.over` vocabulary and
|
|
160
|
+
* running over indexes it provisioned. What stays here is the projection — a
|
|
161
|
+
* stored row is not a `WorkOrder` — which is why `mapPage` exists: it re-shapes
|
|
162
|
+
* the entries and leaves the walk alone.
|
|
163
|
+
*
|
|
164
|
+
* The old positional `status?` is gone rather than kept beside this. It filtered
|
|
165
|
+
* on one hard-coded column with a hand-written `ORDER BY number DESC` and no
|
|
166
|
+
* bound at all, which is the shape #811 was filed against; a vertical wanting a
|
|
167
|
+
* different sort had no path but to fork.
|
|
168
|
+
*/
|
|
169
|
+
export declare function listOrders(ctx: OperationContext, page: PageParams): Page<WorkOrder>;
|
|
170
|
+
/**
|
|
171
|
+
* One work order, by id (#811).
|
|
172
|
+
*
|
|
173
|
+
* Added because paging exposed two verticals doing `listOrders(ctx).find(o => o.id
|
|
174
|
+
* === …)` — reading every row in the scope to return one, which was wasteful when
|
|
175
|
+
* the list was unbounded and is WRONG once it is a page: the row you want is
|
|
176
|
+
* simply not on page one. There was no exported single-order read to reach for,
|
|
177
|
+
* which is why both reached for the list.
|
|
178
|
+
*
|
|
179
|
+
* Throws rather than returning undefined, like every other read here: an id that
|
|
180
|
+
* names nothing is a caller's mistake, and `getRow` already refuses it.
|
|
181
|
+
*/
|
|
182
|
+
export declare function getWorkOrder(ctx: OperationContext, orderId: string): WorkOrder;
|
|
147
183
|
export declare function completeWorkOrder(ctx: OperationContext, input: {
|
|
148
184
|
orderId: string;
|
|
149
185
|
billable: BillableLine[];
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAaL,KAAK,IAAI,EAET,KAAK,KAAK,EAEX,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,iCAI7B,CAAC;AACX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAElF,OAAO,EAML,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,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AAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,CAEnF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAE9E;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,GACnD;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CA4BpC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAY3F;AA6HD,eAAO,MAAM,eAAe,EAAE,kBAa7B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { addMoney, dataSubjectId, entityRef, money, moduleManifest, moneyOf, permissionKey, substratError, } from '@substrat-run/contracts';
|
|
2
|
+
import { addMoney, assertTransition, INVALID_TRANSITION, dataSubjectId, entityRef, money, mapPage, moduleManifest, moneyOf, permissionKey, listsDeclaredBy, substratError, } from '@substrat-run/contracts';
|
|
3
3
|
/**
|
|
4
4
|
* The conflict reasons this engine raises — its own vocabulary, narrowing the platform's
|
|
5
5
|
* `conflict` code (#113). Exported so a vertical can branch on WHY a refusal happened
|
|
@@ -10,18 +10,23 @@ import { addMoney, dataSubjectId, entityRef, money, moduleManifest, moneyOf, per
|
|
|
10
10
|
* do not change spelling.
|
|
11
11
|
*/
|
|
12
12
|
export const WORKORDER_CONFLICT_REASONS = [
|
|
13
|
-
|
|
13
|
+
// Raised by `assertTransition` from the declared lifecycle (#844), not by this
|
|
14
|
+
// file — so it is the shared constant rather than a second spelling of it.
|
|
15
|
+
INVALID_TRANSITION,
|
|
14
16
|
];
|
|
15
|
-
/** `conflict(reason, message)` — reason first, so the classification reads before the prose. */
|
|
16
|
-
const conflict = (reason, message) => substratError('conflict', message, { reason });
|
|
17
17
|
import { billableLine, decimal, workOrder, timeEntry, materialLine, } from './schemas.js';
|
|
18
18
|
import { workorderEntities } from './entities.js';
|
|
19
|
+
import { workorderOperations } from './operations.js';
|
|
20
|
+
import { workorderLifecycle } from './lifecycle.js';
|
|
19
21
|
// The entity registry is PUBLIC: a composing vertical imports it to check
|
|
20
22
|
// relation edges naming this engine's entities, and to declare an operation's
|
|
21
23
|
// output without transcribing this engine's shape.
|
|
22
24
|
export { workorderEntities, workorderRow } from './entities.js';
|
|
23
25
|
export { billableLine, decimal, workOrder, timeEntry, materialLine, } from './schemas.js';
|
|
24
26
|
export { workorderOperations, WORKORDER_PERMISSIONS } from './operations.js';
|
|
27
|
+
// The declared state machine (#844). PUBLIC: a composing vertical reads it to
|
|
28
|
+
// render available actions, and `substrat.model` emits it into `model.json`.
|
|
29
|
+
export { workorderLifecycles, workorderLifecycle } from './lifecycle.js';
|
|
25
30
|
import { assertAllowed, ulid, } from '@substrat-run/kernel';
|
|
26
31
|
// ============================================================================
|
|
27
32
|
// The work-order engine (demos/callout/spec/testrun.md §4.2/§5.2). Owns the state
|
|
@@ -63,6 +68,10 @@ export const workorderManifest = moduleManifest.parse({
|
|
|
63
68
|
migrations: { journalDir: './migrations', compatibleFrom: '0.0.1' },
|
|
64
69
|
attachmentTargets: [{ entityType: 'workorder', readPermission: 'workorder:read' }],
|
|
65
70
|
entityRelations: [{ entityType: 'workorder', parentType: 'facility' }],
|
|
71
|
+
// #811: DERIVED from the operations' own `paged.over`, never written twice —
|
|
72
|
+
// the index the kernel provisions and the vocabulary the operation offers are
|
|
73
|
+
// one fact. `table` and `idColumn` come from the entity registry.
|
|
74
|
+
lists: listsDeclaredBy(workorderOperations, workorderEntities),
|
|
66
75
|
entitlementKey: 'workorder',
|
|
67
76
|
ui: {
|
|
68
77
|
routes: [
|
|
@@ -160,10 +169,21 @@ function getRow(ctx, orderId) {
|
|
|
160
169
|
throw substratError('not_found', `work order not found: ${orderId}`);
|
|
161
170
|
return row;
|
|
162
171
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
172
|
+
/**
|
|
173
|
+
* The declared machine, applied (#844).
|
|
174
|
+
*
|
|
175
|
+
* This used to be a guard taking the states that admitted the verb, restated at
|
|
176
|
+
* each of its six call sites and held to the `status` enum by nothing. The
|
|
177
|
+
* states now live in `lifecycle.ts`, where the compiler holds them to that enum,
|
|
178
|
+
* and each call site names the VERB instead of re-deriving the set permitting it.
|
|
179
|
+
*
|
|
180
|
+
* The throw is the platform's own `conflict` carrying `reason:
|
|
181
|
+
* 'invalid_transition'` — the same code, the same reason and the same
|
|
182
|
+
* `invalid transition: ...` prefix this engine raised before, now raised from
|
|
183
|
+
* one place for every module that adopts a lifecycle.
|
|
184
|
+
*/
|
|
185
|
+
function requireTransition(row, operation) {
|
|
186
|
+
assertTransition(workorderLifecycle, `work order ${row.number}`, row.status, operation);
|
|
167
187
|
}
|
|
168
188
|
// ---------------------------------------------------------------------------
|
|
169
189
|
// In-scope functions (K-16) — composable from vertical operations, same
|
|
@@ -175,11 +195,11 @@ export function createWorkOrder(ctx, rawInput) {
|
|
|
175
195
|
const number = ctx.sql.query('SELECT COALESCE(MAX(number), 0) + 1 AS n FROM workorder_orders')[0]
|
|
176
196
|
?.n ?? 1;
|
|
177
197
|
const id = ulid();
|
|
178
|
-
const createdAt =
|
|
198
|
+
const createdAt = ctx.now();
|
|
179
199
|
ctx.sql.exec(`INSERT INTO workorder_orders
|
|
180
200
|
(id, number, facility_type, facility_id, customer_type, customer_id,
|
|
181
201
|
kind, title, description, status, created_by, created_at)
|
|
182
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,
|
|
202
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
183
203
|
id,
|
|
184
204
|
number,
|
|
185
205
|
input.facility.entityType,
|
|
@@ -189,6 +209,9 @@ export function createWorkOrder(ctx, rawInput) {
|
|
|
189
209
|
input.kind,
|
|
190
210
|
input.title,
|
|
191
211
|
input.description ?? null,
|
|
212
|
+
// Not the literal `'planned'`: the declaration owns where a row starts, so
|
|
213
|
+
// the machine and the INSERT cannot disagree about it.
|
|
214
|
+
workorderLifecycle.initial,
|
|
192
215
|
ctx.principal,
|
|
193
216
|
createdAt,
|
|
194
217
|
]);
|
|
@@ -215,18 +238,44 @@ export function getReportedLines(ctx, orderId) {
|
|
|
215
238
|
material: ctx.sql.query('SELECT * FROM workorder_material_lines WHERE order_id = ? ORDER BY id', [orderId]),
|
|
216
239
|
};
|
|
217
240
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
241
|
+
/**
|
|
242
|
+
* A page of work orders (#811).
|
|
243
|
+
*
|
|
244
|
+
* The `WHERE`, the `ORDER BY`, the keyset comparison and the `LIMIT` are the
|
|
245
|
+
* kernel's, composed from this operation's declared `paged.over` vocabulary and
|
|
246
|
+
* running over indexes it provisioned. What stays here is the projection — a
|
|
247
|
+
* stored row is not a `WorkOrder` — which is why `mapPage` exists: it re-shapes
|
|
248
|
+
* the entries and leaves the walk alone.
|
|
249
|
+
*
|
|
250
|
+
* The old positional `status?` is gone rather than kept beside this. It filtered
|
|
251
|
+
* on one hard-coded column with a hand-written `ORDER BY number DESC` and no
|
|
252
|
+
* bound at all, which is the shape #811 was filed against; a vertical wanting a
|
|
253
|
+
* different sort had no path but to fork.
|
|
254
|
+
*/
|
|
255
|
+
export function listOrders(ctx, page) {
|
|
256
|
+
return mapPage(ctx.page('workorder', page), toWorkOrder);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* One work order, by id (#811).
|
|
260
|
+
*
|
|
261
|
+
* Added because paging exposed two verticals doing `listOrders(ctx).find(o => o.id
|
|
262
|
+
* === …)` — reading every row in the scope to return one, which was wasteful when
|
|
263
|
+
* the list was unbounded and is WRONG once it is a page: the row you want is
|
|
264
|
+
* simply not on page one. There was no exported single-order read to reach for,
|
|
265
|
+
* which is why both reached for the list.
|
|
266
|
+
*
|
|
267
|
+
* Throws rather than returning undefined, like every other read here: an id that
|
|
268
|
+
* names nothing is a caller's mistake, and `getRow` already refuses it.
|
|
269
|
+
*/
|
|
270
|
+
export function getWorkOrder(ctx, orderId) {
|
|
271
|
+
return toWorkOrder(getRow(ctx, orderId));
|
|
223
272
|
}
|
|
224
273
|
export function completeWorkOrder(ctx, input) {
|
|
225
274
|
const row = getRow(ctx, input.orderId);
|
|
226
|
-
|
|
275
|
+
requireTransition(row, 'workorder/complete');
|
|
227
276
|
const billable = z.array(billableLine).parse(input.billable);
|
|
228
277
|
const total = billable.reduce((sum, line) => addMoney(sum, line.lineTotal), moneyOf('0', billable[0]?.lineTotal.currency ?? 'SEK'));
|
|
229
|
-
const completedAt =
|
|
278
|
+
const completedAt = ctx.now();
|
|
230
279
|
ctx.sql.exec(`UPDATE workorder_orders SET status = 'completed', completed_at = ? WHERE id = ?`, [
|
|
231
280
|
completedAt,
|
|
232
281
|
row.id,
|
|
@@ -255,7 +304,7 @@ export function completeWorkOrder(ctx, input) {
|
|
|
255
304
|
*/
|
|
256
305
|
export function closeWorkOrder(ctx, input) {
|
|
257
306
|
const row = getRow(ctx, input.orderId);
|
|
258
|
-
|
|
307
|
+
requireTransition(row, 'workorder/close');
|
|
259
308
|
ctx.sql.exec(`UPDATE workorder_orders SET status = 'closed' WHERE id = ?`, [row.id]);
|
|
260
309
|
ctx.emit({
|
|
261
310
|
type: 'workorder.closed',
|
|
@@ -276,12 +325,13 @@ const getOp = async (ctx, input) => {
|
|
|
276
325
|
};
|
|
277
326
|
const listOp = async (ctx, input) => {
|
|
278
327
|
assertAllowed(await ctx.check(PERM.read));
|
|
279
|
-
|
|
328
|
+
// `input` is genuinely absent when invoked with no body at all (`inputOptional`).
|
|
329
|
+
return listOrders(ctx, { ...input, filters: { status: input?.status } });
|
|
280
330
|
};
|
|
281
331
|
const assignOp = async (ctx, input) => {
|
|
282
332
|
assertAllowed(await ctx.check(PERM.assign));
|
|
283
333
|
const row = getRow(ctx, input.orderId);
|
|
284
|
-
|
|
334
|
+
requireTransition(row, 'workorder/assign');
|
|
285
335
|
ctx.sql.exec('UPDATE workorder_orders SET assigned_to = ? WHERE id = ?', [
|
|
286
336
|
input.technician,
|
|
287
337
|
row.id,
|
|
@@ -299,7 +349,7 @@ const assignOp = async (ctx, input) => {
|
|
|
299
349
|
const startOp = async (ctx, input) => {
|
|
300
350
|
assertAllowed(await ctx.check(PERM.report));
|
|
301
351
|
const row = getRow(ctx, input.orderId);
|
|
302
|
-
|
|
352
|
+
requireTransition(row, 'workorder/start');
|
|
303
353
|
ctx.sql.exec(`UPDATE workorder_orders SET status = 'in_progress' WHERE id = ?`, [row.id]);
|
|
304
354
|
ctx.emit({
|
|
305
355
|
type: 'workorder.started',
|
|
@@ -314,10 +364,10 @@ const reportTimeOp = async (ctx, input) => {
|
|
|
314
364
|
assertAllowed(await ctx.check(PERM.report));
|
|
315
365
|
const hours = decimal.parse(input.hours);
|
|
316
366
|
const row = getRow(ctx, input.orderId);
|
|
317
|
-
|
|
367
|
+
requireTransition(row, 'workorder/report-time');
|
|
318
368
|
const id = ulid();
|
|
319
369
|
ctx.sql.exec(`INSERT INTO workorder_time_entries (id, order_id, technician, hours, note, reported_at)
|
|
320
|
-
VALUES (?, ?, ?, ?, ?, ?)`, [id, row.id, ctx.principal, hours, input.note ?? null,
|
|
370
|
+
VALUES (?, ?, ?, ?, ?, ?)`, [id, row.id, ctx.principal, hours, input.note ?? null, ctx.now()]);
|
|
321
371
|
ctx.emit({
|
|
322
372
|
type: 'workorder.time-reported',
|
|
323
373
|
schemaVersion: 1,
|
|
@@ -332,10 +382,10 @@ const reportMaterialOp = async (ctx, input) => {
|
|
|
332
382
|
assertAllowed(await ctx.check(PERM.report));
|
|
333
383
|
const qty = decimal.parse(input.qty);
|
|
334
384
|
const row = getRow(ctx, input.orderId);
|
|
335
|
-
|
|
385
|
+
requireTransition(row, 'workorder/report-material');
|
|
336
386
|
const id = ulid();
|
|
337
387
|
ctx.sql.exec(`INSERT INTO workorder_material_lines (id, order_id, article, qty, note, reported_by, reported_at)
|
|
338
|
-
VALUES (?, ?, ?, ?, ?, ?, ?)`, [id, row.id, input.article, qty, input.note ?? null, ctx.principal,
|
|
388
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)`, [id, row.id, input.article, qty, input.note ?? null, ctx.principal, ctx.now()]);
|
|
339
389
|
ctx.emit({
|
|
340
390
|
type: 'workorder.material-reported',
|
|
341
391
|
schemaVersion: 1,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,QAAQ,EACR,aAAa,EACb,SAAS,EACT,KAAK,EACL,cAAc,EACd,OAAO,EACP,aAAa,EAIb,aAAa,GACd,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,oBAAoB;CACZ,CAAC;AAGX,gGAAgG;AAChG,MAAM,QAAQ,GAAG,CAAC,MAA+B,EAAE,OAAe,EAAE,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAEtH,OAAO,EACL,YAAY,EACZ,OAAO,EACP,SAAS,EACT,SAAS,EACT,YAAY,GAKb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,0EAA0E;AAC1E,8EAA8E;AAC9E,mDAAmD;AACnD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM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,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE;KACtE,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,CAAe,qDAAqD,EAAE;QACxF,EAAE;KACH,CAAC,CAAC,CAAC,CAAE,CAAC;AACT,CAAC,CAAC;AAEF,MAAM,UAAU,GAGZ,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;IACvB,aAAa,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9C,OAAO,iBAAiB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,MAAM,OAAO,GAAqD,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;IACrF,aAAa,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3C,OAAO,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAuB;IACjD,QAAQ,EAAE,iBAAiB;IAC3B,UAAU,EAAE,mBAAmB;IAC/B,UAAU,EAAE;QACV,eAAe,EAAE,KAAyC;QAC1D,gBAAgB,EAAE,MAA0C;QAC5D,kBAAkB,EAAE,QAA4C;QAChE,iBAAiB,EAAE,OAA2C;QAC9D,uBAAuB,EAAE,YAAgD;QACzE,2BAA2B,EAAE,gBAAoD;QACjF,oBAAoB,EAAE,UAA8C;QACpE,iBAAiB,EAAE,OAA2C;KAC/D;CACF,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The work order's state machine, declared (#844).
|
|
3
|
+
*
|
|
4
|
+
* It was already here — as `requireStatus(row, 'planned', 'in_progress')` at six
|
|
5
|
+
* call sites, held to the `status` enum in `entities.ts` by nothing. This is the
|
|
6
|
+
* same machine, in one place the compiler checks: a state the column cannot
|
|
7
|
+
* hold, a value the column CAN hold with no state declared for it, an edge to
|
|
8
|
+
* nowhere, or an operation this engine does not declare are all refused.
|
|
9
|
+
*
|
|
10
|
+
* ## Composed by call — so the lifecycle governs the in-scope functions
|
|
11
|
+
*
|
|
12
|
+
* This engine is composed **by call** (`startWorkOrder`, `completeWorkOrder`,
|
|
13
|
+
* …), and a vertical wraps those inside its own transaction. So the check lives
|
|
14
|
+
* with the in-scope function, not with the registered operation: a vertical that
|
|
15
|
+
* composes `completeWorkOrder` gets the invariant, and one that only calls the
|
|
16
|
+
* operation gets the same invariant by the same route.
|
|
17
|
+
*
|
|
18
|
+
* Edges are named by the operation id even where the caller is the in-scope
|
|
19
|
+
* function, because the operation is the stable public name for the verb and
|
|
20
|
+
* the join key everything else uses — `manifest.guards[].before`, the emitted
|
|
21
|
+
* XState machine, the docs diagram.
|
|
22
|
+
*
|
|
23
|
+
* ## What is deliberately not here
|
|
24
|
+
*
|
|
25
|
+
* `workorder/get` and `workorder/list` are reads and no state gates them.
|
|
26
|
+
* **Absence from this declaration means "not governed", never "forbidden"** —
|
|
27
|
+
* the machine describes which mutations a state admits, and an operation it has
|
|
28
|
+
* never heard of is simply not its business.
|
|
29
|
+
*
|
|
30
|
+
* `guards` are also absent, and that is K-38 holding: a guard is wired in the
|
|
31
|
+
* manifest as `{ before, predicate, config }` and evaluated by the kernel. Every
|
|
32
|
+
* edge below names its operation, so a guard on the operation already is a guard
|
|
33
|
+
* on the edge — the emitters join the two rather than making anyone declare it
|
|
34
|
+
* twice.
|
|
35
|
+
*/
|
|
36
|
+
export declare const workorderLifecycles: {
|
|
37
|
+
readonly workorder: {
|
|
38
|
+
readonly field: "status";
|
|
39
|
+
readonly initial: "planned";
|
|
40
|
+
readonly states: {
|
|
41
|
+
/** Scheduled, not yet touched. Assignment and early reporting are legal; neither moves it. */
|
|
42
|
+
readonly planned: {
|
|
43
|
+
readonly on: {
|
|
44
|
+
readonly 'workorder/start': "in_progress";
|
|
45
|
+
};
|
|
46
|
+
readonly allow: readonly ["workorder/assign", "workorder/report-time", "workorder/report-material"];
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* The one state that admits substates (K-17).
|
|
50
|
+
*
|
|
51
|
+
* This is where the FSM incumbents' status nuance lives —
|
|
52
|
+
* `awaiting_parts`, `pending_customer_approval` — and where "the vertical
|
|
53
|
+
* is not powerful enough" would otherwise materialise first. The other
|
|
54
|
+
* three admit none: `completed` and `closed` carry billing invariants, and
|
|
55
|
+
* refining `planned` has no case behind it yet.
|
|
56
|
+
*/
|
|
57
|
+
readonly in_progress: {
|
|
58
|
+
readonly on: {
|
|
59
|
+
readonly 'workorder/complete': "completed";
|
|
60
|
+
};
|
|
61
|
+
readonly allow: readonly ["workorder/report-time", "workorder/report-material"];
|
|
62
|
+
readonly extensible: true;
|
|
63
|
+
};
|
|
64
|
+
/** Work done and totalled. The billable lines are fixed; only closing remains. */
|
|
65
|
+
readonly completed: {
|
|
66
|
+
readonly on: {
|
|
67
|
+
readonly 'workorder/close': "closed";
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
/** Terminal, and terminal for a reason: closing is what hands the order to invoicing. */
|
|
71
|
+
readonly closed: {
|
|
72
|
+
readonly terminal: true;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
/** The machine for the `workorder` entity — the shape the evaluator takes. */
|
|
78
|
+
export declare const workorderLifecycle: {
|
|
79
|
+
readonly field: "status";
|
|
80
|
+
readonly initial: "planned";
|
|
81
|
+
readonly states: {
|
|
82
|
+
/** Scheduled, not yet touched. Assignment and early reporting are legal; neither moves it. */
|
|
83
|
+
readonly planned: {
|
|
84
|
+
readonly on: {
|
|
85
|
+
readonly 'workorder/start': "in_progress";
|
|
86
|
+
};
|
|
87
|
+
readonly allow: readonly ["workorder/assign", "workorder/report-time", "workorder/report-material"];
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* The one state that admits substates (K-17).
|
|
91
|
+
*
|
|
92
|
+
* This is where the FSM incumbents' status nuance lives —
|
|
93
|
+
* `awaiting_parts`, `pending_customer_approval` — and where "the vertical
|
|
94
|
+
* is not powerful enough" would otherwise materialise first. The other
|
|
95
|
+
* three admit none: `completed` and `closed` carry billing invariants, and
|
|
96
|
+
* refining `planned` has no case behind it yet.
|
|
97
|
+
*/
|
|
98
|
+
readonly in_progress: {
|
|
99
|
+
readonly on: {
|
|
100
|
+
readonly 'workorder/complete': "completed";
|
|
101
|
+
};
|
|
102
|
+
readonly allow: readonly ["workorder/report-time", "workorder/report-material"];
|
|
103
|
+
readonly extensible: true;
|
|
104
|
+
};
|
|
105
|
+
/** Work done and totalled. The billable lines are fixed; only closing remains. */
|
|
106
|
+
readonly completed: {
|
|
107
|
+
readonly on: {
|
|
108
|
+
readonly 'workorder/close': "closed";
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
/** Terminal, and terminal for a reason: closing is what hands the order to invoicing. */
|
|
112
|
+
readonly closed: {
|
|
113
|
+
readonly terminal: true;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,mBAAmB;;;;;YAQ1B,8FAA8F;;;;;;;YAK9F;;;;;;;;eAQG;;;;;;;;YAMH,kFAAkF;;;;;;YAIlF,yFAAyF;;;;;;CAM7F,CAAC;AAEH,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB;;;;QAhCzB,8FAA8F;;;;;;;QAK9F;;;;;;;;WAQG;;;;;;;;QAMH,kFAAkF;;;;;;QAIlF,yFAAyF;;;;;CAShC,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { defineLifecycles } from '@substrat-run/contracts';
|
|
2
|
+
import { workorderEntities } from './entities.js';
|
|
3
|
+
import { workorderOperations } from './operations.js';
|
|
4
|
+
/**
|
|
5
|
+
* The work order's state machine, declared (#844).
|
|
6
|
+
*
|
|
7
|
+
* It was already here — as `requireStatus(row, 'planned', 'in_progress')` at six
|
|
8
|
+
* call sites, held to the `status` enum in `entities.ts` by nothing. This is the
|
|
9
|
+
* same machine, in one place the compiler checks: a state the column cannot
|
|
10
|
+
* hold, a value the column CAN hold with no state declared for it, an edge to
|
|
11
|
+
* nowhere, or an operation this engine does not declare are all refused.
|
|
12
|
+
*
|
|
13
|
+
* ## Composed by call — so the lifecycle governs the in-scope functions
|
|
14
|
+
*
|
|
15
|
+
* This engine is composed **by call** (`startWorkOrder`, `completeWorkOrder`,
|
|
16
|
+
* …), and a vertical wraps those inside its own transaction. So the check lives
|
|
17
|
+
* with the in-scope function, not with the registered operation: a vertical that
|
|
18
|
+
* composes `completeWorkOrder` gets the invariant, and one that only calls the
|
|
19
|
+
* operation gets the same invariant by the same route.
|
|
20
|
+
*
|
|
21
|
+
* Edges are named by the operation id even where the caller is the in-scope
|
|
22
|
+
* function, because the operation is the stable public name for the verb and
|
|
23
|
+
* the join key everything else uses — `manifest.guards[].before`, the emitted
|
|
24
|
+
* XState machine, the docs diagram.
|
|
25
|
+
*
|
|
26
|
+
* ## What is deliberately not here
|
|
27
|
+
*
|
|
28
|
+
* `workorder/get` and `workorder/list` are reads and no state gates them.
|
|
29
|
+
* **Absence from this declaration means "not governed", never "forbidden"** —
|
|
30
|
+
* the machine describes which mutations a state admits, and an operation it has
|
|
31
|
+
* never heard of is simply not its business.
|
|
32
|
+
*
|
|
33
|
+
* `guards` are also absent, and that is K-38 holding: a guard is wired in the
|
|
34
|
+
* manifest as `{ before, predicate, config }` and evaluated by the kernel. Every
|
|
35
|
+
* edge below names its operation, so a guard on the operation already is a guard
|
|
36
|
+
* on the edge — the emitters join the two rather than making anyone declare it
|
|
37
|
+
* twice.
|
|
38
|
+
*/
|
|
39
|
+
export const workorderLifecycles = defineLifecycles(workorderEntities, workorderOperations)({
|
|
40
|
+
workorder: {
|
|
41
|
+
field: 'status',
|
|
42
|
+
initial: 'planned',
|
|
43
|
+
states: {
|
|
44
|
+
/** Scheduled, not yet touched. Assignment and early reporting are legal; neither moves it. */
|
|
45
|
+
planned: {
|
|
46
|
+
on: { 'workorder/start': 'in_progress' },
|
|
47
|
+
allow: ['workorder/assign', 'workorder/report-time', 'workorder/report-material'],
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* The one state that admits substates (K-17).
|
|
51
|
+
*
|
|
52
|
+
* This is where the FSM incumbents' status nuance lives —
|
|
53
|
+
* `awaiting_parts`, `pending_customer_approval` — and where "the vertical
|
|
54
|
+
* is not powerful enough" would otherwise materialise first. The other
|
|
55
|
+
* three admit none: `completed` and `closed` carry billing invariants, and
|
|
56
|
+
* refining `planned` has no case behind it yet.
|
|
57
|
+
*/
|
|
58
|
+
in_progress: {
|
|
59
|
+
on: { 'workorder/complete': 'completed' },
|
|
60
|
+
allow: ['workorder/report-time', 'workorder/report-material'],
|
|
61
|
+
extensible: true,
|
|
62
|
+
},
|
|
63
|
+
/** Work done and totalled. The billable lines are fixed; only closing remains. */
|
|
64
|
+
completed: {
|
|
65
|
+
on: { 'workorder/close': 'closed' },
|
|
66
|
+
},
|
|
67
|
+
/** Terminal, and terminal for a reason: closing is what hands the order to invoicing. */
|
|
68
|
+
closed: {
|
|
69
|
+
terminal: true,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
/** The machine for the `workorder` entity — the shape the evaluator takes. */
|
|
75
|
+
export const workorderLifecycle = workorderLifecycles.workorder;
|
|
76
|
+
//# sourceMappingURL=lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CACjD,iBAAiB,EACjB,mBAAmB,CACpB,CAAC;IACA,SAAS,EAAE;QACT,KAAK,EAAE,QAAQ;QACf,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE;YACN,8FAA8F;YAC9F,OAAO,EAAE;gBACP,EAAE,EAAE,EAAE,iBAAiB,EAAE,aAAa,EAAE;gBACxC,KAAK,EAAE,CAAC,kBAAkB,EAAE,uBAAuB,EAAE,2BAA2B,CAAC;aAClF;YACD;;;;;;;;eAQG;YACH,WAAW,EAAE;gBACX,EAAE,EAAE,EAAE,oBAAoB,EAAE,WAAW,EAAE;gBACzC,KAAK,EAAE,CAAC,uBAAuB,EAAE,2BAA2B,CAAC;gBAC7D,UAAU,EAAE,IAAI;aACjB;YACD,kFAAkF;YAClF,SAAS,EAAE;gBACT,EAAE,EAAE,EAAE,iBAAiB,EAAE,QAAQ,EAAE;aACpC;YACD,yFAAyF;YACzF,MAAM,EAAE;gBACN,QAAQ,EAAE,IAAI;aACf;SACF;KACF;CACF,CAAC,CAAC;AAEH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,SAAS,CAAC"}
|
package/dist/model.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The artifact of record for this engine (#697/#844).
|
|
3
|
+
*
|
|
4
|
+
* It lives here rather than beside the entities because the lifecycle needs the
|
|
5
|
+
* operations and the operations need the entities: `entities.ts` importing the
|
|
6
|
+
* lifecycle would close that loop into a cycle. A third file that imports both
|
|
7
|
+
* and is imported by neither is the shape that does not.
|
|
8
|
+
*
|
|
9
|
+
* `pnpm lint:model --check` re-emits this into `engines/workorder/model.json`,
|
|
10
|
+
* so a state added to the machine, an edge redirected, or a state that stops
|
|
11
|
+
* admitting substates all have to appear in a PR diff. That gate is the whole
|
|
12
|
+
* reason the declaration is worth more than the six guards it replaced.
|
|
13
|
+
*/
|
|
14
|
+
export declare const workorderModel: import("@substrat-run/contracts").EmittedModel;
|
|
15
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,gDAAoE,CAAC"}
|
package/dist/model.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { emitModel } from '@substrat-run/contracts';
|
|
2
|
+
import { workorderEntities } from './entities.js';
|
|
3
|
+
import { workorderLifecycles } from './lifecycle.js';
|
|
4
|
+
/**
|
|
5
|
+
* The artifact of record for this engine (#697/#844).
|
|
6
|
+
*
|
|
7
|
+
* It lives here rather than beside the entities because the lifecycle needs the
|
|
8
|
+
* operations and the operations need the entities: `entities.ts` importing the
|
|
9
|
+
* lifecycle would close that loop into a cycle. A third file that imports both
|
|
10
|
+
* and is imported by neither is the shape that does not.
|
|
11
|
+
*
|
|
12
|
+
* `pnpm lint:model --check` re-emits this into `engines/workorder/model.json`,
|
|
13
|
+
* so a state added to the machine, an edge redirected, or a state that stops
|
|
14
|
+
* admitting substates all have to appear in a PR diff. That gate is the whole
|
|
15
|
+
* reason the declaration is worth more than the six guards it replaced.
|
|
16
|
+
*/
|
|
17
|
+
export const workorderModel = emitModel(workorderEntities, { lifecycles: workorderLifecycles });
|
|
18
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,iBAAiB,EAAE,EAAE,UAAU,EAAE,mBAAmB,EAAE,CAAC,CAAC"}
|
package/dist/operations.d.ts
CHANGED
|
@@ -78,13 +78,13 @@ export declare const workorderOperations: {
|
|
|
78
78
|
}, z.core.$strip>;
|
|
79
79
|
};
|
|
80
80
|
readonly 'workorder/list': {
|
|
81
|
-
readonly summary: "Work orders, optionally filtered by status";
|
|
81
|
+
readonly summary: "Work orders, newest first, optionally filtered by status";
|
|
82
82
|
readonly permission: "workorder:read";
|
|
83
83
|
readonly input: z.ZodObject<{
|
|
84
84
|
status: z.ZodOptional<z.ZodString>;
|
|
85
85
|
}, z.core.$strip>;
|
|
86
86
|
readonly inputOptional: true;
|
|
87
|
-
readonly output: z.
|
|
87
|
+
readonly output: z.ZodObject<{
|
|
88
88
|
id: z.ZodString;
|
|
89
89
|
number: z.ZodNumber;
|
|
90
90
|
facility: z.ZodObject<{
|
|
@@ -108,7 +108,15 @@ export declare const workorderOperations: {
|
|
|
108
108
|
createdBy: z.ZodString;
|
|
109
109
|
createdAt: z.ZodString;
|
|
110
110
|
completedAt: z.ZodNullable<z.ZodString>;
|
|
111
|
-
}, z.core.$strip
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
readonly paged: {
|
|
113
|
+
readonly over: {
|
|
114
|
+
readonly entity: "workorder";
|
|
115
|
+
readonly sortable: readonly ["number", "status", "created_at"];
|
|
116
|
+
readonly filterable: readonly ["status", "assigned_to", "kind"];
|
|
117
|
+
};
|
|
118
|
+
readonly order: "desc";
|
|
119
|
+
};
|
|
112
120
|
};
|
|
113
121
|
readonly 'workorder/assign': {
|
|
114
122
|
readonly summary: "Assign a technician";
|
package/dist/operations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAoB,CAAC,EAAE,MAAM,yBAAyB,CAAC;AAI9D,mEAAmE;AACnE,eAAO,MAAM,qBAAqB,YAChC,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,CACT,CAAC;AAIX,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAoB,CAAC,EAAE,MAAM,yBAAyB,CAAC;AAI9D,mEAAmE;AACnE,eAAO,MAAM,qBAAqB,YAChC,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,CACT,CAAC;AAIX,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2E9B,CAAC"}
|
package/dist/operations.js
CHANGED
|
@@ -43,11 +43,25 @@ export const workorderOperations = defineOperations(workorderEntities, WORKORDER
|
|
|
43
43
|
}),
|
|
44
44
|
},
|
|
45
45
|
'workorder/list': {
|
|
46
|
-
summary: 'Work orders, optionally filtered by status',
|
|
46
|
+
summary: 'Work orders, newest first, optionally filtered by status',
|
|
47
47
|
permission: 'workorder:read',
|
|
48
48
|
input: z.object({ status: z.string().optional() }),
|
|
49
49
|
inputOptional: true,
|
|
50
|
-
|
|
50
|
+
// The ENTRY, not the envelope — `paged` is what wraps it, here and in the
|
|
51
|
+
// emitted document.
|
|
52
|
+
output: workOrder,
|
|
53
|
+
// #811. `number` first, so the default walk is the one this list shipped
|
|
54
|
+
// with: newest work order at the top. `status` is offered as a sort as well
|
|
55
|
+
// as a filter — a board grouped by state is the second thing an office asks
|
|
56
|
+
// for, and the alternative is a vertical forking the engine to get it.
|
|
57
|
+
paged: {
|
|
58
|
+
over: {
|
|
59
|
+
entity: 'workorder',
|
|
60
|
+
sortable: ['number', 'status', 'created_at'],
|
|
61
|
+
filterable: ['status', 'assigned_to', 'kind'],
|
|
62
|
+
},
|
|
63
|
+
order: 'desc',
|
|
64
|
+
},
|
|
51
65
|
},
|
|
52
66
|
'workorder/assign': {
|
|
53
67
|
summary: 'Assign a technician',
|
package/dist/operations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,gBAAgB,EAAE,CAAC,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhF,mEAAmE;AACnE,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,kBAAkB;IAClB,gBAAgB;IAChB,kBAAkB;IAClB,kBAAkB;IAClB,oBAAoB;IACpB,iBAAiB;CACT,CAAC;AAEX,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAA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K,EAAE,OAAO;QACd,MAAM,EAAE,SAAS;KAClB;IAED,uBAAuB,EAAE;QACvB,OAAO,EAAE,+BAA+B;QACxC,UAAU,EAAE,kBAAkB;QAC9B,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;QACzE,MAAM,EAAE,SAAS;KAClB;IAED,2BAA2B,EAAE;QAC3B,OAAO,EAAE,mCAAmC;QAC5C,UAAU,EAAE,kBAAkB;QAC9B,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC5F,MAAM,EAAE,YAAY;KACrB;IAED,oBAAoB,EAAE;QACpB,OAAO,EAAE,4CAA4C;QACrD,UAAU,EAAE,oBAAoB;QAChC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;QAC1D,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;KAC1D;IAED,iBAAiB,EAAE;QACjB,OAAO,EAAE,8BAA8B;QACvC,UAAU,EAAE,iBAAiB;QAC7B,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,SAAS;KAClB;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substrat-run/engine-workorder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Substrat engine: work orders + time + material — one engine, one state machine, append-only reporting",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@substrat-run/contracts": "^0.
|
|
29
|
-
"@substrat-run/kernel": "^0.
|
|
28
|
+
"@substrat-run/contracts": "^0.84.0",
|
|
29
|
+
"@substrat-run/kernel": "^0.84.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"typescript": "^7.0.0",
|
|
33
33
|
"vitest": "^3.2.7",
|
|
34
34
|
"zod": "^4.4.3",
|
|
35
|
-
"@substrat-run/
|
|
36
|
-
"@substrat-run/
|
|
37
|
-
"@substrat-run/
|
|
35
|
+
"@substrat-run/engine-test-kit": "^0.3.11",
|
|
36
|
+
"@substrat-run/model-emit": "0.7.0",
|
|
37
|
+
"@substrat-run/contract-tests": "^0.84.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"zod": "^4.4.0"
|