create-substrat 0.8.0 → 0.8.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.89.0';
40
- const ENGINE_WORKORDER = '^0.9.0';
41
- const ENGINE_INVOICING = '^0.9.5';
39
+ const SUBSTRAT = '^0.91.1';
40
+ const ENGINE_WORKORDER = '^0.9.2';
41
+ const ENGINE_INVOICING = '^0.9.7';
42
42
  const BOUNDARY_LINT = '^0.2.0';
43
- const DEV_ISSUER = '^0.1.3';
43
+ const DEV_ISSUER = '^0.1.5';
44
44
 
45
45
  const DOCS = 'https://substrat.net';
46
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-substrat",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Scaffold a Substrat vertical — `npm create substrat <dir>`.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -71,7 +71,13 @@ Every vertical gets this whether or not it uses a single engine:
71
71
  - **Tenancy** — tenants and scopes, isolated at the database level. A scope is one
72
72
  SQLite/DO database. Cross-tenant access is not a bug you avoid; there is no API for it.
73
73
  - **Permissions** — roles, grants, entity-narrowed grants, and every decision carries a
74
- proof path (why it was allowed).
74
+ proof path (why it was allowed). **Sharing is a kernel verb, not a table you design**:
75
+ an operation narrows a permission it already holds onto one entity, and withdraws it,
76
+ with `ctx.grant(principal, perm, entityRef)` / `ctx.revoke(principal, perm, entityRef)`
77
+ — entity-required, delegating (re-checks the caller's own decision), transactional with
78
+ the operation. Neither alternative is this: a `ctx.link` edge is permanent (not
79
+ revocable at all), and org membership is revocable but coarse-grained. Never mint an
80
+ org per domain row to get a revoke.
75
81
  - **Events + audit** — every mutation emits a kernel-stamped event. Origin fields (tenant,
76
82
  scope, actor, time) are stamped by the kernel; your code cannot mislabel one.
77
83
  - **Migrations** — journaled per module, applied lazily per scope.
@@ -392,7 +398,10 @@ await host.provisionScope(actor, { tenantId: tenant, scopeId: scope, jurisdictio
392
398
 
393
399
  Define roles **per tenant** from the engines' `PERM` + your keys, assign them, create seed
394
400
  entities via `stub.invoke` (**never raw SQL**), give portal principals entity-narrowed
395
- grants. Make it idempotent.
401
+ grants. Make it idempotent. Seed-time grants are the platform actor's verb; sharing a
402
+ **user** initiates at runtime is `ctx.grant` / `ctx.revoke` inside an operation (see the
403
+ `AGENTS.md` section on sharing, and the [todo demo](https://github.com/substrat-run/substrat/tree/main/demos/todo)'s
404
+ `src/module.ts` for the two calls in place).
396
405
 
397
406
  ### `test/scenario.test.ts`
398
407
 
@@ -142,6 +142,28 @@ consumers). Rules 1–5 are enforced mechanically by `boundary-lint`.
142
142
  adapter **rejects** a `ctx.link` for an undeclared edge, so a missing one fails loudly.
143
143
  This is also what lets a portal permission-walk reach the owner.
144
144
 
145
+ ## Sharing is `ctx.grant` / `ctx.revoke`, not a table
146
+
147
+ When a person shares their own record with another person — and takes them off it again —
148
+ the operation narrows a permission it already holds onto that one entity:
149
+
150
+ ```ts
151
+ await ctx.grant(principal, PERM.listContribute, listRef(listId)); // share
152
+ await ctx.revoke(principal, PERM.listContribute, listRef(listId)); // un-share
153
+ ```
154
+
155
+ Entity-required (module code can never write a scope- or tenant-wide grant), delegating
156
+ (the caller's own decision on that entity is re-checked, so an operation can never hand out
157
+ more than it holds), and transactional with the operation. Every later `ctx.check` reads
158
+ the grant, so nothing else has to remember who may touch what.
159
+
160
+ Neither alternative is this, so you can tell a real absence from this one: a `ctx.link`
161
+ edge is **not revocable at all** — it is permanent — and org membership is revocable but
162
+ coarse-grained — a whole org, not one record. Never mint an org per domain row, or a
163
+ membership table consulted by hand in every handler, to get a revoke. The two-line
164
+ reference is the [todo demo](https://github.com/substrat-run/substrat/tree/main/demos/todo)
165
+ (`src/module.ts`, `todo/share-list` and `todo/revoke-share`).
166
+
145
167
  ## The gates — run them, believe them
146
168
 
147
169
  ```sh