create-substrat 0.8.6 → 0.9.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/index.js CHANGED
@@ -36,11 +36,11 @@ const TEMPLATE = join(HERE, 'template');
36
36
  // The runtime packages release together off one version line (the changesets `fixed`
37
37
  // group), so one constant is right for all of them. Engines do NOT share a line —
38
38
  // each versions on its own, so one pin per engine, deliberately.
39
- const SUBSTRAT = '^0.98.0';
40
- const ENGINE_WORKORDER = '^0.10.6';
41
- const ENGINE_INVOICING = '^0.9.14';
42
- const BOUNDARY_LINT = '^0.4.0';
43
- const DEV_ISSUER = '^0.1.13';
39
+ const SUBSTRAT = '^0.100.0';
40
+ const ENGINE_WORKORDER = '^0.10.8';
41
+ const ENGINE_INVOICING = '^0.9.16';
42
+ const BOUNDARY_LINT = '^0.4.2';
43
+ const DEV_ISSUER = '^0.1.15';
44
44
 
45
45
  const DOCS = 'https://substrat.net';
46
46
 
@@ -101,21 +101,10 @@ function packageJson(name) {
101
101
  { binding: 'CONFIG', class: 'ConfigDO' },
102
102
  ],
103
103
  },
104
- // The declared per-instance settings — MIRRORED from src/manifest.ts
105
- // (`SHOP_ENV`), because `substrat push` reads JSON, not TS. The dashboard
106
- // renders its Settings form from this; keep the two in sync.
107
- envSpec: [
108
- {
109
- key: 'SHOP_NAME',
110
- label: 'Workshop name',
111
- description: 'The workshop name shown to customers. Set per install.',
112
- placeholder: 'Söder Cykel & Service',
113
- default: 'Substrat Bike Shop',
114
- required: false,
115
- secret: false,
116
- group: 'General',
117
- },
118
- ],
104
+ // No envSpec copy here (#1206): the declared per-instance settings live in
105
+ // src/manifest.ts (`SHOP_ENV`), re-exported as `envSpec` from the permissions
106
+ // entry — `substrat push` reads them off that same import. The dashboard
107
+ // renders its Settings form from what the push uploads.
119
108
  devServers: DEV_SERVERS,
120
109
  },
121
110
  scripts: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-substrat",
3
- "version": "0.8.6",
3
+ "version": "0.9.1",
4
4
  "description": "Scaffold a Substrat vertical — `npm create substrat <dir>`.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -87,9 +87,9 @@ dashboard reports `delivered: false`, and the app never sees it. That includes t
87
87
  back through `resolveScopedEnvSpec` (`instanceConfig`). Read settings that way and
88
88
  never off `env` directly: an `envSpec` default rides as a worker binding shared by
89
89
  every install of one serving script, so `env.FOO` is the same string for every
90
- tenant no matter what any of them saved. Declare a setting in **both**
91
- `src/manifest.ts` (`SHOP_ENV`) and package.json `substrat.envSpec` — `substrat
92
- push` reads the JSON, not the TypeScript.
90
+ tenant no matter what any of them saved. Declare a setting once, in
91
+ `src/manifest.ts` (`SHOP_ENV`) — `src/provision.ts` re-exports it as `envSpec`,
92
+ which is what `substrat push` uploads; package.json carries no copy.
93
93
 
94
94
  ## The rules (non-negotiable)
95
95
 
@@ -112,10 +112,14 @@ consumers). Rules 1–5 are enforced mechanically by `boundary-lint`.
112
112
  `@substrat-run/kernel` rather than a `SELECT` of your own: both take an `EntityRef`,
113
113
  page like a list read, and decode the envelope for you. `readHistory` also returns the
114
114
  payload, the authorization chain (which checks the operation passed, and under which
115
- grant), the impersonation stamp and the PII class. On the first three, a `null` is a
116
- *fact* rather than data you failed to fetch — the payload was erased, the row predates
117
- authorization recording, nobody was impersonating — so render it as that. Neither
118
- helper checks a permission; you do, before you call it.
115
+ grant), the impersonation stamp, the PII class, the `operation` the event was emitted
116
+ from (the exact `invoke()` string) and the `version` the emitting code was deployed as.
117
+ On all but the PII class, a `null` is a *fact* rather than data you failed to fetch —
118
+ the payload was erased, the row predates authorization recording, nobody was
119
+ impersonating, a consumer emitted it (or the row predates the column), no version
120
+ identity was present — so render it as that. `version` comes from the outbox column
121
+ only, never the envelope, so this helper is the one way to join an event to the push
122
+ that wrote it. Neither helper checks a permission; you do, before you call it.
119
123
  4. **Another module's tables are private.** Never `SELECT` from `workorder_*` etc. — use
120
124
  the engine's exported in-scope functions. This is the rule with no runtime equivalent:
121
125
  the shortcut *works* and silently welds you to an engine's private schema forever. Need
@@ -29,8 +29,8 @@ export const SHOP_PERM = {
29
29
  * value one tenant saved for one install — a spec `default` rides as a worker binding
30
30
  * shared by every install of the serving script.
31
31
  *
32
- * MIRRORED in package.json `substrat.envSpec` (what `substrat push` carries — it reads
33
- * JSON, not TS); keep the two in sync.
32
+ * The single declaration (#1206): `src/provision.ts` re-exports this as `envSpec`, which
33
+ * is what `substrat push` uploads — package.json carries no copy.
34
34
  */
35
35
  export const SHOP_ENV: EnvVarSpec[] = [
36
36
  {
@@ -8,6 +8,11 @@ import { invoicingModule, INVOICING_PERM as INV } from '@substrat-run/engine-inv
8
8
  import { bikeShopModule } from './module.js';
9
9
  import { SHOP_PERM } from './manifest.js';
10
10
 
11
+ // The manifest's config surface rides the same import `substrat push` already makes for
12
+ // `permissions` (#1206): this export is what the push uploads, so `src/manifest.ts` is the
13
+ // single envSpec declaration and package.json carries no copy.
14
+ export { SHOP_ENV as envSpec } from './manifest.js';
15
+
11
16
  // ============================================================================
12
17
  // The vertical's PROVISIONING surface — everything a deployment needs to know
13
18
  // about modules, roles and grant shapes, with NO node imports. Split from
@@ -73,6 +73,8 @@ export { ConfigDO };
73
73
  * `/internal/delete-scope` removes them. Costs nothing while the roster is empty.
74
74
  */
75
75
  export const SweeperDO = defineScopeSweeperDO<Env>({
76
+ // #1232: the pass reports the version whose code actually ran (the deploy-injected binding).
77
+ versionId: (env) => env.SUBSTRAT_VERSION_ID ?? null,
76
78
  intervalMs: 120_000,
77
79
  host: hostFor,
78
80
  });
@@ -102,6 +104,8 @@ const DEV_NODE: Node = {
102
104
  };
103
105
 
104
106
  interface Env {
107
+ /** Injected at deploy (#1242); absent locally — the sweep record then reads NULL. */
108
+ SUBSTRAT_VERSION_ID?: string;
105
109
  /** One DO per scope — the vertical's only durable store (sandbox-clean). */
106
110
  SCOPE: DurableObjectNamespace;
107
111
  /** The roster-keeping sweep singleton — the deployment's own timer (#461). */