@reventlessdev/reventless-spec 3.0.0-alpha.161 → 3.0.0-alpha.162

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 3.0.0-alpha.162 (2026-10-10)
7
+
8
+ * feat!: a command's rule is looked up by its name, without a cast ([5f02c40](https://github.com/ReventlessDev/reventless-core/commit/5f02c4081d077bf4a6951d8c9b2b16553a8ca87b))
9
+
10
+ ### BREAKING CHANGES
11
+
12
+ * a spec that writes `commandAuthorization` by hand writes
13
+ `authorizationOf = (name: string) => …` instead; the PPX refuses the old name.
14
+
15
+
16
+
6
17
  # 3.0.0-alpha.161 (2026-10-10)
7
18
 
8
19
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-spec",
3
- "version": "3.0.0-alpha.161",
3
+ "version": "3.0.0-alpha.162",
4
4
  "description": "Specifications for Reventless",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {
@@ -58,12 +58,13 @@ module type Spec = {
58
58
  /** The roles this spec's rules name: its plugin's `Roles.t`, which the PPX
59
59
  supplies; `Role.name` where the plugin declares none. */
60
60
  type role
61
- /** Authorization rule evaluated at the GraphQL resolver entry before any
62
- command is dispatched. Auto-injected by `@@reventless.spec` and on
63
- structurally-detected inline spec modules — defaults to
64
- `AllowAuthenticated`; override at the file/module level with
65
- `@@reventless.authorize(<rule>)`. */
66
- let commandAuthorization: command => Authorization.rule<role>
61
+ /** Who may issue the command with this constructor name, asked before any
62
+ command exists (API, published structure, resolvers). Total: a name the
63
+ spec does not know gets its default rule. Auto-injected by
64
+ `@@reventless.spec` and on structurally-detected inline spec modules from
65
+ `@authorize` / `@@reventless.authorize(<rule>)`; defaults to
66
+ `AllowAuthenticated`. */
67
+ let authorizationOf: string => Authorization.rule<role>
67
68
 
68
69
  /** The lifecycle enum this component's commands move a row through — the
69
70
  linked view's own, e.g. `type lifecycleState = Customers.accountStatus`.
@@ -698,8 +698,8 @@ Returns `true` if the given variant constructor (by name) carries a record
698
698
  payload (compiled to `{TAG, ...}`), `false` if payload-less (compiled to a
699
699
  bare string literal). Returns `false` for names not found in the schema.
700
700
 
701
- Used by resolver shims to synthesize the correct runtime shape when feeding
702
- a command value into the PPX-generated `commandAuthorization` switch.
701
+ Used to synthesize the correct runtime shape when feeding a stand-in command
702
+ into a spec's `commandTransition` switch.
703
703
  */
704
704
  let isVariantPayloadBearing = (schema: S.t<'a>, name: string): bool => {
705
705
  // Returns true iff a record-payload variant in the schema has TAG === name.
@@ -29,10 +29,11 @@ module type Spec = {
29
29
  /** The roles this spec's rules name: its plugin's `Roles.t`, which the PPX
30
30
  supplies; `Role.name` where the plugin declares none. */
31
31
  type role
32
- /** Each command's rule. The door admits a caller satisfying any command's
33
- rule; each command the input translates into is then checked against its
34
- own, and one refused refuses the whole input. Defaults to `AllowAuthenticated`. */
35
- let commandAuthorization: command => Authorization.rule<role>
32
+ /** Each command's rule, by constructor name. The door admits a caller
33
+ satisfying any command's rule; each command the input translates into is
34
+ then checked against its own, and one refused refuses the whole input.
35
+ Defaults to `AllowAuthenticated`. */
36
+ let authorizationOf: string => Authorization.rule<role>
36
37
  }
37
38
 
38
39
  /** The synchronous translate function. */
@@ -78,12 +78,13 @@ module type Spec = {
78
78
  /** The roles this spec's rules name: its plugin's `Roles.t`, which the PPX
79
79
  supplies; `Role.name` where the plugin declares none. */
80
80
  type role
81
- /** Authorization rule evaluated at the GraphQL resolver entry before any
82
- command is dispatched. Auto-injected by `@@reventless.spec` and on
83
- structurally-detected inline spec modules — defaults to
84
- `AllowAuthenticated`; override at the file/module level with
85
- `@@reventless.authorize(<rule>)`. */
86
- let commandAuthorization: command => Authorization.rule<role>
81
+ /** Who may issue the command with this constructor name, asked before any
82
+ command exists (API, published structure, resolvers). Total: a name the
83
+ spec does not know gets its default rule. Auto-injected by
84
+ `@@reventless.spec` and on structurally-detected inline spec modules from
85
+ `@authorize` / `@@reventless.authorize(<rule>)`; defaults to
86
+ `AllowAuthenticated`. */
87
+ let authorizationOf: string => Authorization.rule<role>
87
88
 
88
89
  /** The lifecycle enum this component's commands move a row through — the
89
90
  linked view's own, e.g. `type lifecycleState = Customers.accountStatus`.
@@ -29,8 +29,8 @@
29
29
  // generated module imports nothing from the view — which is also why it cannot
30
30
  // cycle: a view spec holds no reference back to the aggregate it projects.
31
31
  //
32
- // Read the same way `commandAuthorization` is: `Plugin_Structure.toCommandDef`
33
- // evaluates it against a synthetic value per constructor.
32
+ // `Plugin_Structure.toCommandDef` evaluates it against a synthetic value per
33
+ // constructor.
34
34
  //
35
35
  // No `@schema`: nothing serialises a transition. It is read once, while the
36
36
  // plugin structure is assembled, and what leaves is the pair of names the