@reventlessdev/reventless-spec 3.0.0-alpha.171 → 3.0.0-alpha.172

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,19 @@
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.172 (2026-10-21)
7
+
8
+ * feat!: a rejected command says whether the model, the access check or the platform said no ([6a8a6b0](https://github.com/ReventlessDev/reventless-core/commit/6a8a6b0f2f31e766ae26a944c23b0904e51a5865))
9
+
10
+ ### BREAKING CHANGES
11
+
12
+ * a type error variant with one of those names fails to
13
+ compile; rename it for what the model means, such as AlreadyBooked. On
14
+ AWS, rebuild every plugin against this release before a client selects
15
+ cause: a plugin built earlier answers it with a non-null error.
16
+
17
+
18
+
6
19
  # 3.0.0-alpha.171 (2026-10-21)
7
20
 
8
21
  * feat!: a state view's row key is module Id ([08c9726](https://github.com/ReventlessDev/reventless-core/commit/08c972659a3d689a39fd5e2f2026597155e92210))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-spec",
3
- "version": "3.0.0-alpha.171",
3
+ "version": "3.0.0-alpha.172",
4
4
  "description": "Specifications for Reventless",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {
@@ -9,11 +9,18 @@ type CommandPending {
9
9
  }
10
10
 
11
11
  type CommandRejected {
12
+ cause: CommandRejectionCause!
12
13
  errorCode: String!
13
14
  errorDetail: String
14
15
  msgId: ID!
15
16
  }
16
17
 
18
+ enum CommandRejectionCause {
19
+ ACCESS
20
+ DOMAIN
21
+ INFRASTRUCTURE
22
+ }
23
+
17
24
  union CommandResult = CommandAccepted | CommandPending | CommandRejected
18
25
 
19
26
  type Mutation {
@@ -0,0 +1,54 @@
1
+ /**
2
+ The codes the platform itself puts on a rejected command, as opposed to the
3
+ error names a spec declares.
4
+
5
+ A spec may not name an error like one of these: the PPX refuses it, so a
6
+ client reading only `errorCode` can still tell a platform code from the
7
+ model's. The PPX holds a copy of `platformErrorCodes` (it cannot read this
8
+ file); a spec test keeps the two equal.
9
+ */
10
+ type platformErrorCode =
11
+ /** The caller may not act: an `@authorize` rule or an ownership check refused. */
12
+ | Forbidden
13
+ /** Contention the retries could not absorb, or a handler that failed outright. */
14
+ | Conflict
15
+ /** The event log refused the append. */
16
+ | AppendFailed
17
+ /** The plugin is disconnected; retry later. */
18
+ | PluginUnavailable
19
+ /** An administrator deactivated the plugin. */
20
+ | PluginInactive
21
+ /** The plugin version was retired. */
22
+ | PluginRetired
23
+ /** An inbound translation's commands could not be published. */
24
+ | PublishFailed
25
+ /** An inbound translation refused its input. */
26
+ | TranslationFailed
27
+
28
+ let code = (c: platformErrorCode): string =>
29
+ switch c {
30
+ | Forbidden => "Forbidden"
31
+ | Conflict => "Conflict"
32
+ | AppendFailed => "AppendFailed"
33
+ | PluginUnavailable => "PluginUnavailable"
34
+ | PluginInactive => "PluginInactive"
35
+ | PluginRetired => "PluginRetired"
36
+ | PublishFailed => "PublishFailed"
37
+ | TranslationFailed => "TranslationFailed"
38
+ }
39
+
40
+ /** Every constructor, in declaration order. */
41
+ let all = [
42
+ Forbidden,
43
+ Conflict,
44
+ AppendFailed,
45
+ PluginUnavailable,
46
+ PluginInactive,
47
+ PluginRetired,
48
+ PublishFailed,
49
+ TranslationFailed,
50
+ ]
51
+
52
+ let platformErrorCodes = all->Array.map(code)
53
+
54
+ let isPlatformErrorCode = (name: string): bool => platformErrorCodes->Array.includes(name)
@@ -0,0 +1,48 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+
4
+ function code(c) {
5
+ switch (c) {
6
+ case "Forbidden" :
7
+ return "Forbidden";
8
+ case "Conflict" :
9
+ return "Conflict";
10
+ case "AppendFailed" :
11
+ return "AppendFailed";
12
+ case "PluginUnavailable" :
13
+ return "PluginUnavailable";
14
+ case "PluginInactive" :
15
+ return "PluginInactive";
16
+ case "PluginRetired" :
17
+ return "PluginRetired";
18
+ case "PublishFailed" :
19
+ return "PublishFailed";
20
+ case "TranslationFailed" :
21
+ return "TranslationFailed";
22
+ }
23
+ }
24
+
25
+ let all = [
26
+ "Forbidden",
27
+ "Conflict",
28
+ "AppendFailed",
29
+ "PluginUnavailable",
30
+ "PluginInactive",
31
+ "PluginRetired",
32
+ "PublishFailed",
33
+ "TranslationFailed"
34
+ ];
35
+
36
+ let platformErrorCodes = all.map(code);
37
+
38
+ function isPlatformErrorCode(name) {
39
+ return platformErrorCodes.includes(name);
40
+ }
41
+
42
+ export {
43
+ code,
44
+ all,
45
+ platformErrorCodes,
46
+ isPlatformErrorCode,
47
+ }
48
+ /* platformErrorCodes Not a pure module */