@automate.ax/api-contract 0.6.0 → 0.7.1
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/README.md +2 -1
- package/dist/deployment.d.ts +10 -6
- package/dist/deployment.js +32 -7
- package/dist/events/google-calendar.d.ts +4 -0
- package/dist/events/google-calendar.js +16 -0
- package/dist/events/google-forms.d.ts +18 -0
- package/dist/events/google-forms.js +32 -0
- package/dist/events/index.d.ts +16 -0
- package/dist/events/index.js +4 -0
- package/dist/index.d.ts +757 -101
- package/dist/index.js +53 -5
- package/dist/runtime.d.ts +5 -0
- package/dist/runtime.js +5 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# `@automate.ax/api-contract`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared oRPC procedure contracts for the Automate.ax API. The public contract
|
|
4
|
+
used by `@automate.ax/client` excludes first-party and runtime procedures.
|
|
4
5
|
|
|
5
6
|
Most applications should install `@automate.ax/client` instead.
|
package/dist/deployment.d.ts
CHANGED
|
@@ -12,11 +12,16 @@ export declare const deploymentTriggerInfoSchema: z.ZodObject<{
|
|
|
12
12
|
export type DeploymentTriggerInfo = z.infer<typeof deploymentTriggerInfoSchema>;
|
|
13
13
|
export declare const deploymentContract: {
|
|
14
14
|
create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
artifact: z.ZodCustom<Blob, Blob>;
|
|
16
|
+
manifest: z.ZodArray<z.ZodObject<{
|
|
17
|
+
entrypoint: z.ZodString;
|
|
18
18
|
identityKey: z.ZodString;
|
|
19
19
|
}, z.core.$strip>>;
|
|
20
|
+
mode: z.ZodEnum<{
|
|
21
|
+
reconcile: "reconcile";
|
|
22
|
+
upsert: "upsert";
|
|
23
|
+
}>;
|
|
24
|
+
projectId: z.ZodString;
|
|
20
25
|
}, z.core.$strip>, z.ZodObject<{
|
|
21
26
|
id: z.ZodString;
|
|
22
27
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
@@ -51,9 +56,8 @@ export declare const deploymentContract: {
|
|
|
51
56
|
planning: "planning";
|
|
52
57
|
awaiting_authorization: "awaiting_authorization";
|
|
53
58
|
configuring: "configuring";
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
superseded: "superseded";
|
|
59
|
+
publishing: "publishing";
|
|
60
|
+
succeeded: "succeeded";
|
|
57
61
|
failed: "failed";
|
|
58
62
|
}>;
|
|
59
63
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
package/dist/deployment.js
CHANGED
|
@@ -15,14 +15,40 @@ export const deploymentTriggerInfoSchema = z.object({
|
|
|
15
15
|
export const deploymentContract = {
|
|
16
16
|
create: oc
|
|
17
17
|
.input(z.object({
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
artifact: z.instanceof(Blob),
|
|
19
|
+
manifest: z
|
|
20
20
|
.object({
|
|
21
|
-
|
|
21
|
+
entrypoint: z.string().min(1),
|
|
22
22
|
identityKey: z.string().min(1),
|
|
23
23
|
})
|
|
24
24
|
.array()
|
|
25
|
-
.min(1, "Deployment must include at least one automation.")
|
|
25
|
+
.min(1, "Deployment must include at least one automation.")
|
|
26
|
+
.superRefine((manifest, context) => {
|
|
27
|
+
const identityKeys = new Set();
|
|
28
|
+
for (const [index, entry] of manifest.entries()) {
|
|
29
|
+
if (identityKeys.has(entry.identityKey)) {
|
|
30
|
+
context.addIssue({
|
|
31
|
+
code: "custom",
|
|
32
|
+
message: "Automation identity keys must be unique.",
|
|
33
|
+
path: [index, "identityKey"],
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
identityKeys.add(entry.identityKey);
|
|
37
|
+
if (entry.entrypoint.includes("\\") ||
|
|
38
|
+
entry.entrypoint.startsWith("/") ||
|
|
39
|
+
entry.entrypoint
|
|
40
|
+
.split("/")
|
|
41
|
+
.some((segment) => segment === "" || segment === "." || segment === "..")) {
|
|
42
|
+
context.addIssue({
|
|
43
|
+
code: "custom",
|
|
44
|
+
message: "Entrypoint must be a safe relative POSIX path.",
|
|
45
|
+
path: [index, "entrypoint"],
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
mode: z.enum(["reconcile", "upsert"]),
|
|
51
|
+
projectId: z.string(),
|
|
26
52
|
}))
|
|
27
53
|
.output(z.object({ id: z.string() })),
|
|
28
54
|
get: oc
|
|
@@ -55,9 +81,8 @@ export const deploymentContract = {
|
|
|
55
81
|
"planning",
|
|
56
82
|
"awaiting_authorization",
|
|
57
83
|
"configuring",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"superseded",
|
|
84
|
+
"publishing",
|
|
85
|
+
"succeeded",
|
|
61
86
|
"failed",
|
|
62
87
|
]),
|
|
63
88
|
})),
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export const googleCalendarEventsContract = {
|
|
4
|
+
googleCalendarPush: oc
|
|
5
|
+
.route({
|
|
6
|
+
method: "POST",
|
|
7
|
+
path: "/events/google-calendar",
|
|
8
|
+
operationId: "receiveGoogleCalendarPush",
|
|
9
|
+
summary: "Receive a Google Calendar push notification",
|
|
10
|
+
description: "Receives header-only Google Calendar resource-change notifications.",
|
|
11
|
+
tags: ["Events"],
|
|
12
|
+
successStatus: 204,
|
|
13
|
+
})
|
|
14
|
+
.input(z.void())
|
|
15
|
+
.output(z.void()),
|
|
16
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const googleFormsEventsContract: {
|
|
3
|
+
googleFormsPush: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
4
|
+
message: z.ZodObject<{
|
|
5
|
+
attributes: z.ZodObject<{
|
|
6
|
+
eventType: z.ZodEnum<{
|
|
7
|
+
SCHEMA: "SCHEMA";
|
|
8
|
+
RESPONSES: "RESPONSES";
|
|
9
|
+
}>;
|
|
10
|
+
formId: z.ZodString;
|
|
11
|
+
watchId: z.ZodString;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
messageId: z.ZodString;
|
|
14
|
+
publishTime: z.ZodISODateTime;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
subscription: z.ZodLiteral<"projects/opkitty/subscriptions/automate-ax-google-forms-push">;
|
|
17
|
+
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export const googleFormsEventsContract = {
|
|
4
|
+
googleFormsPush: oc
|
|
5
|
+
.route({
|
|
6
|
+
method: "POST",
|
|
7
|
+
path: "/events/google-forms",
|
|
8
|
+
operationId: "receiveGoogleFormsPush",
|
|
9
|
+
summary: "Receive a Google Forms push notification",
|
|
10
|
+
description: "Receives and authenticates Google Forms notifications delivered by Google Cloud Pub/Sub.",
|
|
11
|
+
tags: ["Events"],
|
|
12
|
+
successStatus: 204,
|
|
13
|
+
})
|
|
14
|
+
.input(z.object({
|
|
15
|
+
/** Pub/Sub message containing Google Forms notification attributes. */
|
|
16
|
+
message: z.object({
|
|
17
|
+
/** Provider routing fields for the watched form. */
|
|
18
|
+
attributes: z.object({
|
|
19
|
+
eventType: z.enum(["SCHEMA", "RESPONSES"]),
|
|
20
|
+
formId: z.string().min(1),
|
|
21
|
+
watchId: z.string().min(1),
|
|
22
|
+
}),
|
|
23
|
+
/** Provider-assigned identifier used to deduplicate delivery. */
|
|
24
|
+
messageId: z.string().min(1),
|
|
25
|
+
/** RFC 3339 time at which Pub/Sub published the notification. */
|
|
26
|
+
publishTime: z.iso.datetime({ offset: true }),
|
|
27
|
+
}),
|
|
28
|
+
/** Pub/Sub subscription that delivered the message. */
|
|
29
|
+
subscription: z.literal("projects/opkitty/subscriptions/automate-ax-google-forms-push"),
|
|
30
|
+
}))
|
|
31
|
+
.output(z.void()),
|
|
32
|
+
};
|
package/dist/events/index.d.ts
CHANGED
|
@@ -6,4 +6,20 @@ export declare const eventsContract: {
|
|
|
6
6
|
}, import("zod/v4/core").$strip>;
|
|
7
7
|
subscription: import("zod").ZodLiteral<"projects/opkitty/subscriptions/automate-ax-gmail-push">;
|
|
8
8
|
}, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
|
|
9
|
+
googleFormsPush: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
|
|
10
|
+
message: import("zod").ZodObject<{
|
|
11
|
+
attributes: import("zod").ZodObject<{
|
|
12
|
+
eventType: import("zod").ZodEnum<{
|
|
13
|
+
SCHEMA: "SCHEMA";
|
|
14
|
+
RESPONSES: "RESPONSES";
|
|
15
|
+
}>;
|
|
16
|
+
formId: import("zod").ZodString;
|
|
17
|
+
watchId: import("zod").ZodString;
|
|
18
|
+
}, import("zod/v4/core").$strip>;
|
|
19
|
+
messageId: import("zod").ZodString;
|
|
20
|
+
publishTime: import("zod").ZodISODateTime;
|
|
21
|
+
}, import("zod/v4/core").$strip>;
|
|
22
|
+
subscription: import("zod").ZodLiteral<"projects/opkitty/subscriptions/automate-ax-google-forms-push">;
|
|
23
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
|
|
24
|
+
googleCalendarPush: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodVoid, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
|
|
9
25
|
};
|
package/dist/events/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { googleCalendarEventsContract } from "./google-calendar.js";
|
|
2
|
+
import { googleFormsEventsContract } from "./google-forms.js";
|
|
1
3
|
import { gmailEventsContract } from "./gmail.js";
|
|
2
4
|
export const eventsContract = {
|
|
5
|
+
...googleCalendarEventsContract,
|
|
6
|
+
...googleFormsEventsContract,
|
|
3
7
|
...gmailEventsContract,
|
|
4
8
|
};
|