create-substrat 0.6.2 → 0.6.3
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/index.js +17 -10
- package/package.json +1 -1
- package/template/src/worker.ts +9 -2
- package/template/test/scenario.test.ts +11 -7
package/index.js
CHANGED
|
@@ -21,16 +21,23 @@ import { DEV_SERVERS } from './dev-servers.js';
|
|
|
21
21
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
22
22
|
const TEMPLATE = join(HERE, 'template');
|
|
23
23
|
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
// Substrat is 0.x, so these are caret ranges on the current minor — a caret on 0.x
|
|
25
|
+
// locks the minor, which is what makes a stale pin here a scaffold four minors behind
|
|
26
|
+
// rather than a scaffold that quietly upgrades.
|
|
27
|
+
//
|
|
28
|
+
// EMITTED, NOT EDITED. `pnpm lint:pins` writes this block from each package's own
|
|
29
|
+
// version and `--check` fails CI on drift; `version-packages` runs the write, so a
|
|
30
|
+
// bump and its pins land in the same PR. Hand-maintained, they went stale twice: once
|
|
31
|
+
// resolving nothing (`^0.3.37` after workorder moved to 0.4.x), and once resolving
|
|
32
|
+
// fine but freezing the template against packages nobody ships, which is worse — the
|
|
33
|
+
// scaffold's own tests stayed green while the surface moved underneath them.
|
|
34
|
+
//
|
|
35
|
+
// The runtime packages release together off one version line (the changesets `fixed`
|
|
36
|
+
// group), so one constant is right for all of them. Engines do NOT share a line —
|
|
37
|
+
// each versions on its own, so one pin per engine, deliberately.
|
|
38
|
+
const SUBSTRAT = '^0.76.0';
|
|
39
|
+
const ENGINE_WORKORDER = '^0.6.3';
|
|
40
|
+
const ENGINE_INVOICING = '^0.7.3';
|
|
34
41
|
const BOUNDARY_LINT = '^0.0.7';
|
|
35
42
|
|
|
36
43
|
const DOCS = 'https://substrat.net';
|
package/package.json
CHANGED
package/template/src/worker.ts
CHANGED
|
@@ -164,8 +164,15 @@ mountPlatformSurface<Env>(app, {
|
|
|
164
164
|
hostFor,
|
|
165
165
|
roles: ROLES,
|
|
166
166
|
ownerRoleKey: OWNER_ROLE_KEY,
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
// Both hooks are `Promise<void>`: the roster's own count is its business, and
|
|
168
|
+
// returning it here would make the platform's response shape depend on what a
|
|
169
|
+
// vertical happens to hand back. Await, discard.
|
|
170
|
+
onProvision: async (env, b) => {
|
|
171
|
+
await sweeper(env).noteScope(b.tenantId, b.scopeId);
|
|
172
|
+
},
|
|
173
|
+
onDeleteScope: async (env, s) => {
|
|
174
|
+
await sweeper(env).forgetScope(s);
|
|
175
|
+
},
|
|
169
176
|
});
|
|
170
177
|
|
|
171
178
|
// Unmatched /api/* fails as JSON; everything else gets a pointer, not a UI —
|
|
@@ -160,14 +160,18 @@ describe('bike-shop scenario', () => {
|
|
|
160
160
|
expect(underlag[0]!.status).toBe('open');
|
|
161
161
|
expect(underlag[0]!.total).toBe('336.5');
|
|
162
162
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
// Provenance is two-level: `document_*` is which delivery produced the line
|
|
164
|
+
// (this work order), `source_*` is what the line itself is (time vs material).
|
|
165
|
+
// Both come from the engine's own event payload — the vertical never joins
|
|
166
|
+
// into invoicing's tables to find out.
|
|
167
|
+
const detail = await greta.invoke<
|
|
168
|
+
{ lines: { document_id: string; document_type: string; source_type: string | null }[] }
|
|
169
|
+
>('invoicing/get', { underlagId: underlag[0]!.id });
|
|
167
170
|
expect(detail.lines).toHaveLength(2);
|
|
168
|
-
expect(
|
|
169
|
-
|
|
170
|
-
);
|
|
171
|
+
expect(
|
|
172
|
+
detail.lines.every((l) => l.document_type === 'workorder' && l.document_id === repairId),
|
|
173
|
+
).toBe(true);
|
|
174
|
+
expect(detail.lines.map((l) => l.source_type).sort()).toEqual(['material', 'time']);
|
|
171
175
|
});
|
|
172
176
|
|
|
173
177
|
it('7. portal isolation: Lisbeth sees her repair, Otto sees nothing', async () => {
|