@automate.ax/api-contract 0.81.0 → 0.82.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/execution-data.d.ts +3 -3
- package/dist/execution-data.js +1 -1
- package/dist/index.d.ts +496 -6
- package/dist/org.d.ts +10 -1
- package/dist/org.js +14 -3
- package/dist/runtime.d.ts +630 -0
- package/dist/runtime.js +52 -2
- package/package.json +2 -2
- package/src/execution-data.ts +1 -1
- package/src/org.ts +19 -4
- package/src/runtime.ts +59 -2
package/dist/runtime.js
CHANGED
|
@@ -93,8 +93,55 @@ export const automationInvocationInputSchema = z
|
|
|
93
93
|
}),
|
|
94
94
|
]))
|
|
95
95
|
.and(automationInvocationScheduleSchema);
|
|
96
|
+
const SIGNAL_DERIVATION_NODE_SCHEMA = z.discriminatedUnion("type", [
|
|
97
|
+
z.object({
|
|
98
|
+
id: z.string().min(1),
|
|
99
|
+
source: z.enum(["action", "event", "signal"]),
|
|
100
|
+
type: z.literal("source"),
|
|
101
|
+
}),
|
|
102
|
+
z.object({
|
|
103
|
+
inputs: z.number().int().nonnegative().array().min(1),
|
|
104
|
+
property: z.string(),
|
|
105
|
+
type: z.literal("property"),
|
|
106
|
+
}),
|
|
107
|
+
z.object({
|
|
108
|
+
inputs: z.number().int().nonnegative().array().min(1),
|
|
109
|
+
type: z.literal("transform"),
|
|
110
|
+
}),
|
|
111
|
+
]);
|
|
112
|
+
/** Compact concrete derivation graph persisted for one durable consumer. */
|
|
113
|
+
export const signalDerivationSchema = z
|
|
114
|
+
.object({
|
|
115
|
+
nodes: SIGNAL_DERIVATION_NODE_SCHEMA.array().min(1),
|
|
116
|
+
roots: z.number().int().nonnegative().array().min(1),
|
|
117
|
+
})
|
|
118
|
+
.superRefine(({ nodes, roots }, context) => {
|
|
119
|
+
for (const [index, node] of nodes.entries()) {
|
|
120
|
+
if (node.type === "source")
|
|
121
|
+
continue;
|
|
122
|
+
for (const input of node.inputs) {
|
|
123
|
+
if (input >= index) {
|
|
124
|
+
context.addIssue({
|
|
125
|
+
code: "custom",
|
|
126
|
+
message: "Derivation inputs must reference preceding nodes.",
|
|
127
|
+
path: ["nodes", index, "inputs"],
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
for (const [index, root] of roots.entries()) {
|
|
133
|
+
if (root >= nodes.length) {
|
|
134
|
+
context.addIssue({
|
|
135
|
+
code: "custom",
|
|
136
|
+
message: "Derivation roots must reference an existing node.",
|
|
137
|
+
path: ["roots", index],
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
});
|
|
96
142
|
const ACTION_INVOCATION_BASE_SCHEMA = z.object({
|
|
97
143
|
actionDependencyIds: z.string().array(),
|
|
144
|
+
derivation: signalDerivationSchema.nullable(),
|
|
98
145
|
description: z.string().nullable(),
|
|
99
146
|
eventDependencyIds: z.string().array(),
|
|
100
147
|
inputHash: z.string(),
|
|
@@ -142,13 +189,16 @@ const ACTION_RUN_INVOCATION_SCHEMA = z.union([
|
|
|
142
189
|
status: z.literal("succeeded"),
|
|
143
190
|
}),
|
|
144
191
|
]);
|
|
145
|
-
const
|
|
192
|
+
const SIGNAL_DEPENDENCIES_SCHEMA = z.object({
|
|
146
193
|
actionDependencyIds: z.string().array(),
|
|
147
194
|
eventDependencyIds: z.string().array(),
|
|
148
195
|
scopePath: HOOK_SCOPE_PATH_SCHEMA,
|
|
149
196
|
signalDependencyIds: z.string().array(),
|
|
150
197
|
slot: z.number().int().nonnegative(),
|
|
151
198
|
});
|
|
199
|
+
const SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA = SIGNAL_DEPENDENCIES_SCHEMA.extend({
|
|
200
|
+
derivation: signalDerivationSchema.nullable(),
|
|
201
|
+
});
|
|
152
202
|
const COORDINATION_PRIMARY_POSITION_SCHEMA = z.enum(["first", "last"]);
|
|
153
203
|
const COORDINATION_DURATION_SCHEMA = z.union([
|
|
154
204
|
z.string().min(1),
|
|
@@ -624,7 +674,7 @@ export const runtimeContract = {
|
|
|
624
674
|
targetAction: TARGET_ACTION_SCHEMA.optional(),
|
|
625
675
|
})),
|
|
626
676
|
loadValues: oc
|
|
627
|
-
.input(
|
|
677
|
+
.input(SIGNAL_DEPENDENCIES_SCHEMA.omit({
|
|
628
678
|
scopePath: true,
|
|
629
679
|
slot: true,
|
|
630
680
|
}))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automate.ax/api-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.0",
|
|
4
4
|
"description": "Public oRPC contract for the Automate.ax API.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@ai-sdk/gateway": "^4.0.46",
|
|
33
|
-
"@automate.ax/codec": "0.
|
|
33
|
+
"@automate.ax/codec": "0.82.0",
|
|
34
34
|
"@orpc/contract": "1.15.0",
|
|
35
35
|
"fast-json-stable-stringify": "^2.1.0",
|
|
36
36
|
"zod": "^4.3.6"
|
package/src/execution-data.ts
CHANGED
package/src/org.ts
CHANGED
|
@@ -32,10 +32,12 @@ export const organizationSummaryOutputSchema = z.object({
|
|
|
32
32
|
pendingInvitationCount: z.number(),
|
|
33
33
|
projectCount: z.number(),
|
|
34
34
|
activeSubscription: activeSubscriptionOutputSchema.nullable(),
|
|
35
|
+
executionRetentionDays: z.number().int().positive(),
|
|
35
36
|
plan: z.enum(["free", "pro", "enterprise"]),
|
|
36
37
|
limits: z.object({
|
|
37
38
|
aiSpendUsd: z.number(),
|
|
38
39
|
emailSends: z.number(),
|
|
40
|
+
executionRetentionDays: z.number().int().positive(),
|
|
39
41
|
projects: z.number(),
|
|
40
42
|
seats: z.number(),
|
|
41
43
|
}),
|
|
@@ -225,10 +227,23 @@ export const orgContract = {
|
|
|
225
227
|
tags: ["Organizations"],
|
|
226
228
|
})
|
|
227
229
|
.input(
|
|
228
|
-
z
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
z
|
|
231
|
+
.object({
|
|
232
|
+
executionRetentionDays: z
|
|
233
|
+
.number()
|
|
234
|
+
.int()
|
|
235
|
+
.positive()
|
|
236
|
+
.nullable()
|
|
237
|
+
.optional(),
|
|
238
|
+
organizationId: z.string(),
|
|
239
|
+
name: reasonableNameSchema.optional(),
|
|
240
|
+
})
|
|
241
|
+
.refine(
|
|
242
|
+
(input) =>
|
|
243
|
+
input.executionRetentionDays !== undefined ||
|
|
244
|
+
input.name !== undefined,
|
|
245
|
+
"Provide an organization setting to update.",
|
|
246
|
+
),
|
|
232
247
|
)
|
|
233
248
|
.output(z.void()),
|
|
234
249
|
}
|
package/src/runtime.ts
CHANGED
|
@@ -110,8 +110,59 @@ export const automationInvocationInputSchema = z
|
|
|
110
110
|
)
|
|
111
111
|
.and(automationInvocationScheduleSchema)
|
|
112
112
|
|
|
113
|
+
const SIGNAL_DERIVATION_NODE_SCHEMA = z.discriminatedUnion("type", [
|
|
114
|
+
z.object({
|
|
115
|
+
id: z.string().min(1),
|
|
116
|
+
source: z.enum(["action", "event", "signal"]),
|
|
117
|
+
type: z.literal("source"),
|
|
118
|
+
}),
|
|
119
|
+
z.object({
|
|
120
|
+
inputs: z.number().int().nonnegative().array().min(1),
|
|
121
|
+
property: z.string(),
|
|
122
|
+
type: z.literal("property"),
|
|
123
|
+
}),
|
|
124
|
+
z.object({
|
|
125
|
+
inputs: z.number().int().nonnegative().array().min(1),
|
|
126
|
+
type: z.literal("transform"),
|
|
127
|
+
}),
|
|
128
|
+
])
|
|
129
|
+
|
|
130
|
+
/** Compact concrete derivation graph persisted for one durable consumer. */
|
|
131
|
+
export const signalDerivationSchema = z
|
|
132
|
+
.object({
|
|
133
|
+
nodes: SIGNAL_DERIVATION_NODE_SCHEMA.array().min(1),
|
|
134
|
+
roots: z.number().int().nonnegative().array().min(1),
|
|
135
|
+
})
|
|
136
|
+
.superRefine(({ nodes, roots }, context) => {
|
|
137
|
+
for (const [index, node] of nodes.entries()) {
|
|
138
|
+
if (node.type === "source") continue
|
|
139
|
+
for (const input of node.inputs) {
|
|
140
|
+
if (input >= index) {
|
|
141
|
+
context.addIssue({
|
|
142
|
+
code: "custom",
|
|
143
|
+
message: "Derivation inputs must reference preceding nodes.",
|
|
144
|
+
path: ["nodes", index, "inputs"],
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
for (const [index, root] of roots.entries()) {
|
|
150
|
+
if (root >= nodes.length) {
|
|
151
|
+
context.addIssue({
|
|
152
|
+
code: "custom",
|
|
153
|
+
message: "Derivation roots must reference an existing node.",
|
|
154
|
+
path: ["roots", index],
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
/** Persisted source, property, and opaque transform derivation graph. */
|
|
161
|
+
export type SignalDerivation = z.infer<typeof signalDerivationSchema>
|
|
162
|
+
|
|
113
163
|
const ACTION_INVOCATION_BASE_SCHEMA = z.object({
|
|
114
164
|
actionDependencyIds: z.string().array(),
|
|
165
|
+
derivation: signalDerivationSchema.nullable(),
|
|
115
166
|
description: z.string().nullable(),
|
|
116
167
|
eventDependencyIds: z.string().array(),
|
|
117
168
|
inputHash: z.string(),
|
|
@@ -163,7 +214,7 @@ const ACTION_RUN_INVOCATION_SCHEMA = z.union([
|
|
|
163
214
|
}),
|
|
164
215
|
])
|
|
165
216
|
|
|
166
|
-
const
|
|
217
|
+
const SIGNAL_DEPENDENCIES_SCHEMA = z.object({
|
|
167
218
|
actionDependencyIds: z.string().array(),
|
|
168
219
|
eventDependencyIds: z.string().array(),
|
|
169
220
|
scopePath: HOOK_SCOPE_PATH_SCHEMA,
|
|
@@ -171,6 +222,12 @@ const SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA = z.object({
|
|
|
171
222
|
slot: z.number().int().nonnegative(),
|
|
172
223
|
})
|
|
173
224
|
|
|
225
|
+
const SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA = SIGNAL_DEPENDENCIES_SCHEMA.extend(
|
|
226
|
+
{
|
|
227
|
+
derivation: signalDerivationSchema.nullable(),
|
|
228
|
+
},
|
|
229
|
+
)
|
|
230
|
+
|
|
174
231
|
const COORDINATION_PRIMARY_POSITION_SCHEMA = z.enum(["first", "last"])
|
|
175
232
|
const COORDINATION_DURATION_SCHEMA = z.union([
|
|
176
233
|
z.string().min(1),
|
|
@@ -722,7 +779,7 @@ export const runtimeContract = {
|
|
|
722
779
|
),
|
|
723
780
|
loadValues: oc
|
|
724
781
|
.input(
|
|
725
|
-
|
|
782
|
+
SIGNAL_DEPENDENCIES_SCHEMA.omit({
|
|
726
783
|
scopePath: true,
|
|
727
784
|
slot: true,
|
|
728
785
|
}),
|