@automate.ax/api-contract 0.13.0 → 0.14.0

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/dist/index.d.ts CHANGED
@@ -782,16 +782,38 @@ export declare const contract: {
782
782
  slot: import("zod").ZodNumber;
783
783
  }, import("zod/v4/core").$strip>>>;
784
784
  }, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
785
- completeInvocation: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
785
+ completeInvocation: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
786
+ status: import("zod").ZodLiteral<"closed">;
787
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
788
+ failure: import("zod").ZodObject<{
789
+ message: import("zod").ZodString;
790
+ name: import("zod").ZodString;
791
+ }, import("zod/v4/core").$strip>;
792
+ status: import("zod").ZodLiteral<"failed">;
793
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
786
794
  output: import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
787
- }, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
795
+ status: import("zod").ZodLiteral<"succeeded">;
796
+ }, import("zod/v4/core").$strip>], "status">, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
788
797
  loadInvocation: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, import("zod").ZodObject<{
789
798
  context: import("zod").ZodObject<{
790
- actionOutputs: import("zod").ZodArray<import("zod").ZodObject<{
799
+ actionOutputs: import("zod").ZodArray<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
800
+ actionInvocationId: import("zod").ZodString;
801
+ slot: import("zod").ZodNumber;
802
+ status: import("zod").ZodLiteral<"closed">;
803
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
804
+ actionInvocationId: import("zod").ZodString;
805
+ failure: import("zod").ZodObject<{
806
+ message: import("zod").ZodString;
807
+ name: import("zod").ZodString;
808
+ }, import("zod/v4/core").$strip>;
809
+ slot: import("zod").ZodNumber;
810
+ status: import("zod").ZodLiteral<"failed">;
811
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
791
812
  actionInvocationId: import("zod").ZodString;
792
813
  output: import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
793
814
  slot: import("zod").ZodNumber;
794
- }, import("zod/v4/core").$strip>>;
815
+ status: import("zod").ZodLiteral<"succeeded">;
816
+ }, import("zod/v4/core").$strip>], "status">>;
795
817
  contextId: import("zod").ZodString;
796
818
  events: import("zod").ZodArray<import("zod").ZodObject<{
797
819
  automationEventId: import("zod").ZodString;
@@ -811,6 +833,11 @@ export declare const contract: {
811
833
  inputHash: import("zod").ZodString;
812
834
  name: import("zod").ZodString;
813
835
  slot: import("zod").ZodNumber;
836
+ status: import("zod").ZodEnum<{
837
+ succeeded: "succeeded";
838
+ failed: "failed";
839
+ closed: "closed";
840
+ }>;
814
841
  }, import("zod/v4/core").$strip>>;
815
842
  contextId: import("zod").ZodString;
816
843
  events: import("zod").ZodArray<import("zod").ZodObject<{
package/dist/runtime.d.ts CHANGED
@@ -10,16 +10,38 @@ export declare const runtimeContract: {
10
10
  slot: z.ZodNumber;
11
11
  }, z.core.$strip>>>;
12
12
  }, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
13
- completeInvocation: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
13
+ completeInvocation: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodDiscriminatedUnion<[z.ZodObject<{
14
+ status: z.ZodLiteral<"closed">;
15
+ }, z.core.$strip>, z.ZodObject<{
16
+ failure: z.ZodObject<{
17
+ message: z.ZodString;
18
+ name: z.ZodString;
19
+ }, z.core.$strip>;
20
+ status: z.ZodLiteral<"failed">;
21
+ }, z.core.$strip>, z.ZodObject<{
14
22
  output: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
15
- }, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
23
+ status: z.ZodLiteral<"succeeded">;
24
+ }, z.core.$strip>], "status">, z.ZodVoid, Record<never, never>, Record<never, never>>;
16
25
  loadInvocation: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
17
26
  context: z.ZodObject<{
18
- actionOutputs: z.ZodArray<z.ZodObject<{
27
+ actionOutputs: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
28
+ actionInvocationId: z.ZodString;
29
+ slot: z.ZodNumber;
30
+ status: z.ZodLiteral<"closed">;
31
+ }, z.core.$strip>, z.ZodObject<{
32
+ actionInvocationId: z.ZodString;
33
+ failure: z.ZodObject<{
34
+ message: z.ZodString;
35
+ name: z.ZodString;
36
+ }, z.core.$strip>;
37
+ slot: z.ZodNumber;
38
+ status: z.ZodLiteral<"failed">;
39
+ }, z.core.$strip>, z.ZodObject<{
19
40
  actionInvocationId: z.ZodString;
20
41
  output: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
21
42
  slot: z.ZodNumber;
22
- }, z.core.$strip>>;
43
+ status: z.ZodLiteral<"succeeded">;
44
+ }, z.core.$strip>], "status">>;
23
45
  contextId: z.ZodString;
24
46
  events: z.ZodArray<z.ZodObject<{
25
47
  automationEventId: z.ZodString;
@@ -39,6 +61,11 @@ export declare const runtimeContract: {
39
61
  inputHash: z.ZodString;
40
62
  name: z.ZodString;
41
63
  slot: z.ZodNumber;
64
+ status: z.ZodEnum<{
65
+ succeeded: "succeeded";
66
+ failed: "failed";
67
+ closed: "closed";
68
+ }>;
42
69
  }, z.core.$strip>>;
43
70
  contextId: z.ZodString;
44
71
  events: z.ZodArray<z.ZodObject<{
package/dist/runtime.js CHANGED
@@ -1,6 +1,11 @@
1
1
  import { encodableSchema } from "@automate.ax/codec";
2
2
  import { oc } from "@orpc/contract";
3
3
  import { z } from "zod";
4
+ const SIGNAL_FAILURE_SCHEMA = z.object({
5
+ message: z.string(),
6
+ name: z.string(),
7
+ });
8
+ const TERMINAL_ACTION_STATUS_SCHEMA = z.enum(["closed", "failed", "succeeded"]);
4
9
  export const runtimeContract = {
5
10
  commit: oc
6
11
  .input(z.object({
@@ -18,18 +23,40 @@ export const runtimeContract = {
18
23
  }))
19
24
  .output(z.void()),
20
25
  completeInvocation: oc
21
- .input(z.object({
22
- output: encodableSchema,
23
- }))
26
+ .input(z.discriminatedUnion("status", [
27
+ z.object({ status: z.literal("closed") }),
28
+ z.object({
29
+ failure: SIGNAL_FAILURE_SCHEMA,
30
+ status: z.literal("failed"),
31
+ }),
32
+ z.object({
33
+ output: encodableSchema,
34
+ status: z.literal("succeeded"),
35
+ }),
36
+ ]))
24
37
  .output(z.void()),
25
38
  loadInvocation: oc.output(z.object({
26
39
  context: z.object({
27
40
  actionOutputs: z
28
- .object({
29
- actionInvocationId: z.string(),
30
- output: encodableSchema,
31
- slot: z.number().int(),
32
- })
41
+ .discriminatedUnion("status", [
42
+ z.object({
43
+ actionInvocationId: z.string(),
44
+ slot: z.number().int(),
45
+ status: z.literal("closed"),
46
+ }),
47
+ z.object({
48
+ actionInvocationId: z.string(),
49
+ failure: SIGNAL_FAILURE_SCHEMA,
50
+ slot: z.number().int(),
51
+ status: z.literal("failed"),
52
+ }),
53
+ z.object({
54
+ actionInvocationId: z.string(),
55
+ output: encodableSchema,
56
+ slot: z.number().int(),
57
+ status: z.literal("succeeded"),
58
+ }),
59
+ ])
33
60
  .array(),
34
61
  contextId: z.string(),
35
62
  events: z
@@ -53,6 +80,7 @@ export const runtimeContract = {
53
80
  inputHash: z.string(),
54
81
  name: z.string(),
55
82
  slot: z.number().int(),
83
+ status: TERMINAL_ACTION_STATUS_SCHEMA,
56
84
  })
57
85
  .array(),
58
86
  contextId: z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/api-contract",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Public oRPC contract for the Automate.ax API.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,7 +26,7 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@automate.ax/codec": "0.13.0",
29
+ "@automate.ax/codec": "0.14.0",
30
30
  "@orpc/contract": "1.13.14",
31
31
  "zod": "^4.3.6"
32
32
  },
package/src/runtime.ts CHANGED
@@ -2,6 +2,13 @@ import { encodableSchema } from "@automate.ax/codec"
2
2
  import { oc } from "@orpc/contract"
3
3
  import { z } from "zod"
4
4
 
5
+ const SIGNAL_FAILURE_SCHEMA = z.object({
6
+ message: z.string(),
7
+ name: z.string(),
8
+ })
9
+
10
+ const TERMINAL_ACTION_STATUS_SCHEMA = z.enum(["closed", "failed", "succeeded"])
11
+
5
12
  export const runtimeContract = {
6
13
  commit: oc
7
14
  .input(
@@ -22,20 +29,42 @@ export const runtimeContract = {
22
29
  .output(z.void()),
23
30
  completeInvocation: oc
24
31
  .input(
25
- z.object({
26
- output: encodableSchema,
27
- }),
32
+ z.discriminatedUnion("status", [
33
+ z.object({ status: z.literal("closed") }),
34
+ z.object({
35
+ failure: SIGNAL_FAILURE_SCHEMA,
36
+ status: z.literal("failed"),
37
+ }),
38
+ z.object({
39
+ output: encodableSchema,
40
+ status: z.literal("succeeded"),
41
+ }),
42
+ ]),
28
43
  )
29
44
  .output(z.void()),
30
45
  loadInvocation: oc.output(
31
46
  z.object({
32
47
  context: z.object({
33
48
  actionOutputs: z
34
- .object({
35
- actionInvocationId: z.string(),
36
- output: encodableSchema,
37
- slot: z.number().int(),
38
- })
49
+ .discriminatedUnion("status", [
50
+ z.object({
51
+ actionInvocationId: z.string(),
52
+ slot: z.number().int(),
53
+ status: z.literal("closed"),
54
+ }),
55
+ z.object({
56
+ actionInvocationId: z.string(),
57
+ failure: SIGNAL_FAILURE_SCHEMA,
58
+ slot: z.number().int(),
59
+ status: z.literal("failed"),
60
+ }),
61
+ z.object({
62
+ actionInvocationId: z.string(),
63
+ output: encodableSchema,
64
+ slot: z.number().int(),
65
+ status: z.literal("succeeded"),
66
+ }),
67
+ ])
39
68
  .array(),
40
69
  contextId: z.string(),
41
70
  events: z
@@ -61,6 +90,7 @@ export const runtimeContract = {
61
90
  inputHash: z.string(),
62
91
  name: z.string(),
63
92
  slot: z.number().int(),
93
+ status: TERMINAL_ACTION_STATUS_SCHEMA,
64
94
  })
65
95
  .array(),
66
96
  contextId: z.string(),