@automate.ax/api-contract 0.44.0 → 0.46.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.
@@ -0,0 +1,106 @@
1
+ import { z } from "zod";
2
+ export declare const automationExecutionStatusSchema: z.ZodEnum<{
3
+ failed: "failed";
4
+ running: "running";
5
+ completed: "completed";
6
+ }>;
7
+ export declare const automationContract: {
8
+ get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
9
+ automationId: z.ZodString;
10
+ projectId: z.ZodString;
11
+ }, z.core.$strip>, z.ZodObject<{
12
+ activeDeployment: z.ZodObject<{
13
+ createdAt: z.ZodDate;
14
+ git: z.ZodNullable<z.ZodObject<{
15
+ commitSha: z.ZodString;
16
+ dirty: z.ZodBoolean;
17
+ repositoryUrl: z.ZodString;
18
+ }, z.core.$strip>>;
19
+ id: z.ZodString;
20
+ }, z.core.$strip>;
21
+ createdAt: z.ZodDate;
22
+ description: z.ZodString;
23
+ id: z.ZodString;
24
+ identityKey: z.ZodString;
25
+ triggers: z.ZodArray<z.ZodObject<{
26
+ details: z.ZodArray<z.ZodObject<{
27
+ label: z.ZodString;
28
+ value: z.ZodString;
29
+ }, z.core.$strip>>;
30
+ name: z.ZodString;
31
+ type: z.ZodString;
32
+ }, z.core.$strip>>;
33
+ updatedAt: z.ZodDate;
34
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
35
+ getExecution: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
36
+ automationId: z.ZodString;
37
+ executionId: z.ZodString;
38
+ projectId: z.ZodString;
39
+ }, z.core.$strip>, z.ZodObject<{
40
+ id: z.ZodString;
41
+ status: z.ZodEnum<{
42
+ failed: "failed";
43
+ running: "running";
44
+ completed: "completed";
45
+ }>;
46
+ createdAt: z.ZodDate;
47
+ completedAt: z.ZodNullable<z.ZodDate>;
48
+ failure: z.ZodNullable<z.ZodObject<{
49
+ message: z.ZodString;
50
+ name: z.ZodString;
51
+ }, z.core.$strip>>;
52
+ actions: z.ZodArray<z.ZodObject<{
53
+ completedAt: z.ZodNullable<z.ZodDate>;
54
+ createdAt: z.ZodDate;
55
+ description: z.ZodNullable<z.ZodString>;
56
+ failure: z.ZodNullable<z.ZodObject<{
57
+ message: z.ZodString;
58
+ name: z.ZodString;
59
+ }, z.core.$strip>>;
60
+ hasOutput: z.ZodBoolean;
61
+ id: z.ZodString;
62
+ name: z.ZodString;
63
+ output: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
64
+ slot: z.ZodNumber;
65
+ status: z.ZodEnum<{
66
+ pending: "pending";
67
+ succeeded: "succeeded";
68
+ failed: "failed";
69
+ skipped: "skipped";
70
+ }>;
71
+ }, z.core.$strip>>;
72
+ events: z.ZodArray<z.ZodObject<{
73
+ createdAt: z.ZodDate;
74
+ id: z.ZodString;
75
+ payload: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
76
+ type: z.ZodString;
77
+ }, z.core.$strip>>;
78
+ outputs: z.ZodArray<z.ZodObject<{
79
+ actionInvocationId: z.ZodString;
80
+ createdAt: z.ZodDate;
81
+ data: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
82
+ id: z.ZodString;
83
+ outputIndex: z.ZodNumber;
84
+ type: z.ZodString;
85
+ }, z.core.$strip>>;
86
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
87
+ listExecutions: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
88
+ automationId: z.ZodString;
89
+ limit: z.ZodDefault<z.ZodNumber>;
90
+ projectId: z.ZodString;
91
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
92
+ completedAt: z.ZodNullable<z.ZodDate>;
93
+ createdAt: z.ZodDate;
94
+ eventTypes: z.ZodArray<z.ZodString>;
95
+ failure: z.ZodNullable<z.ZodObject<{
96
+ message: z.ZodString;
97
+ name: z.ZodString;
98
+ }, z.core.$strip>>;
99
+ id: z.ZodString;
100
+ status: z.ZodEnum<{
101
+ failed: "failed";
102
+ running: "running";
103
+ completed: "completed";
104
+ }>;
105
+ }, z.core.$strip>>, Record<never, never>, Record<never, never>>;
106
+ };
@@ -0,0 +1,94 @@
1
+ import { encodableSchema } from "@automate.ax/codec";
2
+ import { oc } from "@orpc/contract";
3
+ import { z } from "zod";
4
+ import { deploymentTriggerInfoSchema } from "./deployment.js";
5
+ export const automationExecutionStatusSchema = z.enum([
6
+ "running",
7
+ "completed",
8
+ "failed",
9
+ ]);
10
+ const EXECUTION_FAILURE_SCHEMA = z.object({
11
+ message: z.string(),
12
+ name: z.string(),
13
+ });
14
+ const EXECUTION_SUMMARY_SCHEMA = z.object({
15
+ completedAt: z.date().nullable(),
16
+ createdAt: z.date(),
17
+ eventTypes: z.string().array(),
18
+ failure: EXECUTION_FAILURE_SCHEMA.nullable(),
19
+ id: z.string(),
20
+ status: automationExecutionStatusSchema,
21
+ });
22
+ export const automationContract = {
23
+ get: oc
24
+ .input(z.object({
25
+ automationId: z.string(),
26
+ projectId: z.string(),
27
+ }))
28
+ .output(z.object({
29
+ activeDeployment: z.object({
30
+ createdAt: z.date(),
31
+ git: z
32
+ .object({
33
+ commitSha: z.string(),
34
+ dirty: z.boolean(),
35
+ repositoryUrl: z.string(),
36
+ })
37
+ .nullable(),
38
+ id: z.string(),
39
+ }),
40
+ createdAt: z.date(),
41
+ description: z.string(),
42
+ id: z.string(),
43
+ identityKey: z.string(),
44
+ triggers: deploymentTriggerInfoSchema.array(),
45
+ updatedAt: z.date(),
46
+ })),
47
+ getExecution: oc
48
+ .input(z.object({
49
+ automationId: z.string(),
50
+ executionId: z.string(),
51
+ projectId: z.string(),
52
+ }))
53
+ .output(EXECUTION_SUMMARY_SCHEMA.omit({ eventTypes: true }).extend({
54
+ actions: z
55
+ .object({
56
+ completedAt: z.date().nullable(),
57
+ createdAt: z.date(),
58
+ description: z.string().nullable(),
59
+ failure: EXECUTION_FAILURE_SCHEMA.nullable(),
60
+ hasOutput: z.boolean(),
61
+ id: z.string(),
62
+ name: z.string(),
63
+ output: encodableSchema,
64
+ slot: z.number().int().nonnegative(),
65
+ status: z.enum(["pending", "succeeded", "skipped", "failed"]),
66
+ })
67
+ .array(),
68
+ events: z
69
+ .object({
70
+ createdAt: z.date(),
71
+ id: z.string(),
72
+ payload: encodableSchema,
73
+ type: z.string(),
74
+ })
75
+ .array(),
76
+ outputs: z
77
+ .object({
78
+ actionInvocationId: z.string(),
79
+ createdAt: z.date(),
80
+ data: encodableSchema,
81
+ id: z.string(),
82
+ outputIndex: z.number().int().nonnegative(),
83
+ type: z.string(),
84
+ })
85
+ .array(),
86
+ })),
87
+ listExecutions: oc
88
+ .input(z.object({
89
+ automationId: z.string(),
90
+ limit: z.number().int().min(1).max(100).default(50),
91
+ projectId: z.string(),
92
+ }))
93
+ .output(EXECUTION_SUMMARY_SCHEMA.array()),
94
+ };
@@ -58,6 +58,7 @@ export declare const deploymentContract: {
58
58
  }, z.core.$strip>, z.ZodObject<{
59
59
  automations: z.ZodArray<z.ZodObject<{
60
60
  description: z.ZodString;
61
+ id: z.ZodString;
61
62
  identityKey: z.ZodString;
62
63
  triggers: z.ZodArray<z.ZodObject<{
63
64
  details: z.ZodArray<z.ZodObject<{
@@ -68,6 +69,7 @@ export declare const deploymentContract: {
68
69
  type: z.ZodString;
69
70
  }, z.core.$strip>>;
70
71
  }, z.core.$strip>>;
72
+ createdAt: z.ZodDate;
71
73
  id: z.ZodString;
72
74
  git: z.ZodNullable<z.ZodObject<{
73
75
  commitSha: z.ZodString;
@@ -79,10 +79,12 @@ export const deploymentContract = {
79
79
  automations: z
80
80
  .object({
81
81
  description: z.string(),
82
+ id: z.string(),
82
83
  identityKey: z.string(),
83
84
  triggers: deploymentTriggerInfoSchema.array(),
84
85
  })
85
86
  .array(),
87
+ createdAt: z.date(),
86
88
  id: z.string(),
87
89
  git: GIT_SOURCE_SCHEMA.nullable(),
88
90
  job: z