@automate.ax/api-contract 0.75.0 → 0.77.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/account.d.ts +373 -8
- package/dist/account.js +245 -14
- package/dist/api-key.d.ts +17 -9
- package/dist/api-key.js +4 -4
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +1 -1
- package/dist/authorization.d.ts +5 -5
- package/dist/authorization.js +21 -5
- package/dist/automation.d.ts +171 -6
- package/dist/automation.js +83 -3
- package/dist/deployment.d.ts +166 -10
- package/dist/deployment.js +113 -44
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -1
- package/dist/events/airtable.d.ts +1 -1
- package/dist/events/airtable.js +1 -1
- package/dist/events/asana.d.ts +1 -1
- package/dist/events/asana.js +1 -1
- package/dist/events/brevo.d.ts +1 -1
- package/dist/events/brevo.js +1 -1
- package/dist/events/github.d.ts +1 -1
- package/dist/events/github.js +1 -1
- package/dist/events/gmail.d.ts +1 -1
- package/dist/events/gmail.js +1 -1
- package/dist/events/google-calendar.d.ts +1 -1
- package/dist/events/google-calendar.js +1 -1
- package/dist/events/google-forms.d.ts +1 -1
- package/dist/events/google-forms.js +1 -1
- package/dist/events/google-meet.d.ts +20 -0
- package/dist/events/google-meet.js +38 -0
- package/dist/events/index.d.ts +17 -0
- package/dist/events/index.js +2 -0
- package/dist/events/linear.d.ts +1 -1
- package/dist/events/linear.js +1 -1
- package/dist/events/mailhook.d.ts +1 -1
- package/dist/events/mailhook.js +1 -1
- package/dist/events/microsoft.d.ts +1 -1
- package/dist/events/microsoft.js +1 -1
- package/dist/events/resend.d.ts +1 -1
- package/dist/events/resend.js +1 -1
- package/dist/events/slack.d.ts +1 -1
- package/dist/events/slack.js +1 -1
- package/dist/events/trello.d.ts +1 -1
- package/dist/events/trello.js +1 -1
- package/dist/events/vercel.d.ts +1 -1
- package/dist/events/vercel.js +1 -1
- package/dist/events/whatsapp.d.ts +1 -1
- package/dist/events/whatsapp.js +1 -1
- package/dist/execution-data.d.ts +90 -0
- package/dist/execution-data.js +53 -0
- package/dist/index.d.ts +2022 -392
- package/dist/index.js +30 -9
- package/dist/org.d.ts +44 -36
- package/dist/org.js +6 -6
- package/dist/project.d.ts +24 -16
- package/dist/project.js +6 -6
- package/dist/runtime.d.ts +38 -3
- package/dist/runtime.js +54 -2
- package/dist/schemas.d.ts +21 -1
- package/dist/schemas.js +20 -1
- package/package.json +17 -6
- package/src/account.ts +263 -18
- package/src/api-key.ts +8 -4
- package/src/auth.ts +1 -1
- package/src/authorization.ts +23 -5
- package/src/automation.ts +90 -3
- package/src/deployment.ts +119 -44
- package/src/errors.ts +1 -1
- package/src/events/airtable.ts +1 -1
- package/src/events/asana.ts +1 -1
- package/src/events/brevo.ts +1 -1
- package/src/events/github.ts +1 -1
- package/src/events/gmail.ts +1 -1
- package/src/events/google-calendar.ts +1 -1
- package/src/events/google-forms.ts +1 -1
- package/src/events/google-meet.ts +48 -0
- package/src/events/index.ts +2 -0
- package/src/events/linear.ts +1 -1
- package/src/events/mailhook.ts +1 -1
- package/src/events/microsoft.ts +1 -1
- package/src/events/resend.ts +1 -1
- package/src/events/slack.ts +1 -1
- package/src/events/trello.ts +1 -1
- package/src/events/vercel.ts +1 -1
- package/src/events/whatsapp.ts +1 -1
- package/src/execution-data.ts +69 -0
- package/src/index.ts +61 -8
- package/src/org.ts +10 -6
- package/src/project.ts +10 -6
- package/src/runtime.ts +68 -2
- package/src/schemas.ts +23 -1
package/src/runtime.ts
CHANGED
|
@@ -2,14 +2,22 @@ import { encodableSchema } from "@automate.ax/codec"
|
|
|
2
2
|
import type { GatewayModelId } from "@ai-sdk/gateway"
|
|
3
3
|
import { oc } from "@orpc/contract"
|
|
4
4
|
import stableStringify from "fast-json-stable-stringify"
|
|
5
|
-
import
|
|
5
|
+
import * as z from "zod"
|
|
6
6
|
import { automationErrorSchema } from "./errors"
|
|
7
7
|
|
|
8
|
+
export type { GatewayModelId } from "@ai-sdk/gateway"
|
|
9
|
+
|
|
8
10
|
/** Default model used by the platform Vercel AI Gateway account. */
|
|
9
11
|
export const DEFAULT_GATEWAY_MODEL_ID =
|
|
10
12
|
"openai/gpt-4.1-nano" satisfies GatewayModelId
|
|
11
13
|
export const AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT = "default"
|
|
12
14
|
export const AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX = "__$"
|
|
15
|
+
export const AUTOMATION_LOG_MAX_ENTRIES = 1_000
|
|
16
|
+
export const AUTOMATION_TRACE_MAX_SPANS = 250
|
|
17
|
+
export const AUTOMATION_OBSERVABILITY_MAX_FIELDS = 64
|
|
18
|
+
export const AUTOMATION_OBSERVABILITY_MAX_ENCODED_BYTES = 64 * 1_024
|
|
19
|
+
export const AUTOMATION_LOG_MAX_MESSAGE_LENGTH = 16_384
|
|
20
|
+
export const AUTOMATION_TRACE_MAX_NAME_LENGTH = 256
|
|
13
21
|
|
|
14
22
|
const OUTCOME_SEQUENCE_SCHEMA = z.number().int().positive()
|
|
15
23
|
const HOOK_SCOPE_PATH_SCHEMA = z
|
|
@@ -18,6 +26,23 @@ const HOOK_SCOPE_PATH_SCHEMA = z
|
|
|
18
26
|
.nonnegative()
|
|
19
27
|
.array()
|
|
20
28
|
.default([])
|
|
29
|
+
const OBSERVABILITY_FIELDS_SCHEMA = z
|
|
30
|
+
.record(z.string().min(1).max(128), encodableSchema)
|
|
31
|
+
.refine(
|
|
32
|
+
(fields) =>
|
|
33
|
+
Object.keys(fields).length <= AUTOMATION_OBSERVABILITY_MAX_FIELDS,
|
|
34
|
+
`Observability fields may contain at most ${AUTOMATION_OBSERVABILITY_MAX_FIELDS} entries.`,
|
|
35
|
+
)
|
|
36
|
+
const LOG_INDEX_SCHEMA = z
|
|
37
|
+
.number()
|
|
38
|
+
.int()
|
|
39
|
+
.min(0)
|
|
40
|
+
.max(AUTOMATION_LOG_MAX_ENTRIES - 1)
|
|
41
|
+
const TRACE_SPAN_INDEX_SCHEMA = z
|
|
42
|
+
.number()
|
|
43
|
+
.int()
|
|
44
|
+
.min(0)
|
|
45
|
+
.max(AUTOMATION_TRACE_MAX_SPANS - 1)
|
|
21
46
|
|
|
22
47
|
const AUTOMATION_INVOCATION_RUN_AT_SCHEMA = z.union([
|
|
23
48
|
z.date(),
|
|
@@ -683,6 +708,24 @@ export const runtimeContract = {
|
|
|
683
708
|
]),
|
|
684
709
|
)
|
|
685
710
|
.output(z.void()),
|
|
711
|
+
completeTraceSpan: oc
|
|
712
|
+
.input(
|
|
713
|
+
z
|
|
714
|
+
.object({
|
|
715
|
+
completedAt: z.date(),
|
|
716
|
+
spanIndex: TRACE_SPAN_INDEX_SCHEMA,
|
|
717
|
+
})
|
|
718
|
+
.and(
|
|
719
|
+
z.union([
|
|
720
|
+
z.object({ status: z.literal("succeeded") }),
|
|
721
|
+
z.object({
|
|
722
|
+
failure: automationErrorSchema,
|
|
723
|
+
status: z.literal("failed"),
|
|
724
|
+
}),
|
|
725
|
+
]),
|
|
726
|
+
),
|
|
727
|
+
)
|
|
728
|
+
.output(z.void()),
|
|
686
729
|
generate: oc
|
|
687
730
|
.input(RUNTIME_GENERATION_INPUT_SCHEMA)
|
|
688
731
|
.output(generationResultSchema),
|
|
@@ -713,7 +756,7 @@ export const runtimeContract = {
|
|
|
713
756
|
)
|
|
714
757
|
.output(
|
|
715
758
|
z.object({
|
|
716
|
-
|
|
759
|
+
connectionMethodId: z.string().min(1),
|
|
717
760
|
secret: z.record(z.string(), z.unknown()),
|
|
718
761
|
serviceId: z.string(),
|
|
719
762
|
}),
|
|
@@ -729,6 +772,29 @@ export const runtimeContract = {
|
|
|
729
772
|
}),
|
|
730
773
|
)
|
|
731
774
|
.output(z.void()),
|
|
775
|
+
sendLog: oc
|
|
776
|
+
.input(
|
|
777
|
+
z.object({
|
|
778
|
+
fields: OBSERVABILITY_FIELDS_SCHEMA.optional(),
|
|
779
|
+
level: z.enum(["debug", "info", "warn", "error"]),
|
|
780
|
+
logIndex: LOG_INDEX_SCHEMA,
|
|
781
|
+
message: z.string().min(1).max(AUTOMATION_LOG_MAX_MESSAGE_LENGTH),
|
|
782
|
+
spanIndex: TRACE_SPAN_INDEX_SCHEMA.optional(),
|
|
783
|
+
timestamp: z.date(),
|
|
784
|
+
}),
|
|
785
|
+
)
|
|
786
|
+
.output(z.void()),
|
|
787
|
+
startTraceSpan: oc
|
|
788
|
+
.input(
|
|
789
|
+
z.object({
|
|
790
|
+
attributes: OBSERVABILITY_FIELDS_SCHEMA.optional(),
|
|
791
|
+
name: z.string().min(1).max(AUTOMATION_TRACE_MAX_NAME_LENGTH),
|
|
792
|
+
parentSpanIndex: TRACE_SPAN_INDEX_SCHEMA.optional(),
|
|
793
|
+
spanIndex: TRACE_SPAN_INDEX_SCHEMA,
|
|
794
|
+
startedAt: z.date(),
|
|
795
|
+
}),
|
|
796
|
+
)
|
|
797
|
+
.output(z.void()),
|
|
732
798
|
sendEmail: oc
|
|
733
799
|
.input(
|
|
734
800
|
z
|
package/src/schemas.ts
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
|
|
3
|
+
export const cursorPaginationInputSchema = z.object({
|
|
4
|
+
cursor: z.string().min(1).optional(),
|
|
5
|
+
limit: z.number().int().min(1).max(100).default(50),
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
export const cursorPageInfoSchema = z.object({
|
|
9
|
+
hasMore: z.boolean(),
|
|
10
|
+
nextCursor: z.string().nullable(),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Builds the common cursor-paginated collection response.
|
|
15
|
+
*
|
|
16
|
+
* @param itemSchema - Schema for one collection item.
|
|
17
|
+
*/
|
|
18
|
+
export function cursorPageOutputSchema<T extends z.ZodType>(itemSchema: T) {
|
|
19
|
+
return z.object({
|
|
20
|
+
items: itemSchema.array(),
|
|
21
|
+
pageInfo: cursorPageInfoSchema,
|
|
22
|
+
})
|
|
23
|
+
}
|
|
2
24
|
|
|
3
25
|
export const reasonableNameSchema = z.string().min(1).max(255).trim()
|