@automate.ax/api-contract 0.14.0 → 0.16.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.
@@ -1,8 +1,58 @@
1
1
  import { z } from "zod";
2
+ export declare const integrationConnectionManifestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ description: z.ZodOptional<z.ZodString>;
4
+ id: z.ZodString;
5
+ name: z.ZodString;
6
+ type: z.ZodLiteral<"redirect">;
7
+ }, z.core.$strip>, z.ZodObject<{
8
+ description: z.ZodOptional<z.ZodString>;
9
+ fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
10
+ description: z.ZodOptional<z.ZodString>;
11
+ label: z.ZodString;
12
+ name: z.ZodString;
13
+ required: z.ZodBoolean;
14
+ default: z.ZodOptional<z.ZodString>;
15
+ input: z.ZodEnum<{
16
+ email: "email";
17
+ text: "text";
18
+ url: "url";
19
+ }>;
20
+ placeholder: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strip>, z.ZodObject<{
22
+ description: z.ZodOptional<z.ZodString>;
23
+ label: z.ZodString;
24
+ name: z.ZodString;
25
+ required: z.ZodBoolean;
26
+ input: z.ZodLiteral<"password">;
27
+ placeholder: z.ZodOptional<z.ZodString>;
28
+ }, z.core.$strip>, z.ZodObject<{
29
+ description: z.ZodOptional<z.ZodString>;
30
+ label: z.ZodString;
31
+ name: z.ZodString;
32
+ required: z.ZodBoolean;
33
+ default: z.ZodOptional<z.ZodNumber>;
34
+ input: z.ZodLiteral<"number">;
35
+ placeholder: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strip>, z.ZodObject<{
37
+ description: z.ZodOptional<z.ZodString>;
38
+ label: z.ZodString;
39
+ name: z.ZodString;
40
+ required: z.ZodBoolean;
41
+ default: z.ZodOptional<z.ZodBoolean>;
42
+ input: z.ZodLiteral<"boolean">;
43
+ }, z.core.$strip>], "input">>;
44
+ id: z.ZodString;
45
+ name: z.ZodString;
46
+ type: z.ZodLiteral<"form">;
47
+ }, z.core.$strip>], "type">;
2
48
  export declare const integrationServiceManifestSchema: z.ZodObject<{
3
- connection: z.ZodDiscriminatedUnion<[z.ZodObject<{
49
+ connections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
50
+ description: z.ZodOptional<z.ZodString>;
51
+ id: z.ZodString;
52
+ name: z.ZodString;
4
53
  type: z.ZodLiteral<"redirect">;
5
54
  }, z.core.$strip>, z.ZodObject<{
55
+ description: z.ZodOptional<z.ZodString>;
6
56
  fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
7
57
  description: z.ZodOptional<z.ZodString>;
8
58
  label: z.ZodString;
@@ -38,12 +88,15 @@ export declare const integrationServiceManifestSchema: z.ZodObject<{
38
88
  default: z.ZodOptional<z.ZodBoolean>;
39
89
  input: z.ZodLiteral<"boolean">;
40
90
  }, z.core.$strip>], "input">>;
91
+ id: z.ZodString;
92
+ name: z.ZodString;
41
93
  type: z.ZodLiteral<"form">;
42
- }, z.core.$strip>], "type">;
94
+ }, z.core.$strip>], "type">>;
43
95
  description: z.ZodOptional<z.ZodString>;
44
96
  name: z.ZodString;
45
97
  }, z.core.$strip>;
46
98
  export type IntegrationServiceManifest = z.infer<typeof integrationServiceManifestSchema>;
99
+ export type IntegrationConnectionManifest = z.infer<typeof integrationConnectionManifestSchema>;
47
100
  type ScopeRequirement = string | {
48
101
  requirements: ScopeRequirement[];
49
102
  type: "and" | "or";
@@ -51,6 +104,7 @@ type ScopeRequirement = string | {
51
104
  export declare const authorizationContract: {
52
105
  beginConnection: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
53
106
  binding: z.ZodString;
107
+ connectionId: z.ZodString;
54
108
  deploymentId: z.ZodString;
55
109
  serviceId: z.ZodString;
56
110
  }, z.core.$strip>, z.ZodObject<{
@@ -64,6 +118,7 @@ export declare const authorizationContract: {
64
118
  }, z.core.$strip>, z.ZodObject<{
65
119
  accounts: z.ZodArray<z.ZodObject<{
66
120
  checkedAt: z.ZodNullable<z.ZodDate>;
121
+ connectionId: z.ZodString;
67
122
  error: z.ZodNullable<z.ZodObject<{
68
123
  code: z.ZodString;
69
124
  message: z.ZodString;
@@ -77,16 +132,23 @@ export declare const authorizationContract: {
77
132
  requirements: z.ZodArray<z.ZodObject<{
78
133
  accountId: z.ZodNullable<z.ZodString>;
79
134
  binding: z.ZodString;
135
+ connections: z.ZodArray<z.ZodObject<{
136
+ connectionId: z.ZodString;
137
+ minimalScopes: z.ZodArray<z.ZodString>;
138
+ requiredScopes: z.ZodArray<z.ZodType<ScopeRequirement, unknown, z.core.$ZodTypeInternals<ScopeRequirement, unknown>>>;
139
+ }, z.core.$strip>>;
80
140
  eligibleAccountIds: z.ZodArray<z.ZodString>;
81
- minimalScopes: z.ZodArray<z.ZodString>;
82
- requiredScopes: z.ZodArray<z.ZodType<ScopeRequirement, unknown, z.core.$ZodTypeInternals<ScopeRequirement, unknown>>>;
83
141
  satisfied: z.ZodBoolean;
84
142
  serviceId: z.ZodString;
85
143
  }, z.core.$strip>>;
86
144
  services: z.ZodArray<z.ZodObject<{
87
- connection: z.ZodDiscriminatedUnion<[z.ZodObject<{
145
+ connections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
146
+ description: z.ZodOptional<z.ZodString>;
147
+ id: z.ZodString;
148
+ name: z.ZodString;
88
149
  type: z.ZodLiteral<"redirect">;
89
150
  }, z.core.$strip>, z.ZodObject<{
151
+ description: z.ZodOptional<z.ZodString>;
90
152
  fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
91
153
  description: z.ZodOptional<z.ZodString>;
92
154
  label: z.ZodString;
@@ -122,8 +184,10 @@ export declare const authorizationContract: {
122
184
  default: z.ZodOptional<z.ZodBoolean>;
123
185
  input: z.ZodLiteral<"boolean">;
124
186
  }, z.core.$strip>], "input">>;
187
+ id: z.ZodString;
188
+ name: z.ZodString;
125
189
  type: z.ZodLiteral<"form">;
126
- }, z.core.$strip>], "type">;
190
+ }, z.core.$strip>], "type">>;
127
191
  description: z.ZodOptional<z.ZodString>;
128
192
  name: z.ZodString;
129
193
  id: z.ZodString;
@@ -131,6 +195,7 @@ export declare const authorizationContract: {
131
195
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
132
196
  submitCredentials: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
133
197
  binding: z.ZodString;
198
+ connectionId: z.ZodString;
134
199
  data: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
135
200
  deploymentId: z.ZodString;
136
201
  serviceId: z.ZodString;
@@ -26,16 +26,23 @@ const INTEGRATION_FORM_FIELD_SCHEMA = z.discriminatedUnion("input", [
26
26
  input: z.literal("boolean"),
27
27
  }),
28
28
  ]);
29
+ export const integrationConnectionManifestSchema = z.discriminatedUnion("type", [
30
+ z.object({
31
+ description: z.string().optional(),
32
+ id: z.string().min(1),
33
+ name: z.string().min(1),
34
+ type: z.literal("redirect"),
35
+ }),
36
+ z.object({
37
+ description: z.string().optional(),
38
+ fields: INTEGRATION_FORM_FIELD_SCHEMA.array().min(1),
39
+ id: z.string().min(1),
40
+ name: z.string().min(1),
41
+ type: z.literal("form"),
42
+ }),
43
+ ]);
29
44
  export const integrationServiceManifestSchema = z.object({
30
- connection: z.discriminatedUnion("type", [
31
- z.object({
32
- type: z.literal("redirect"),
33
- }),
34
- z.object({
35
- fields: INTEGRATION_FORM_FIELD_SCHEMA.array().min(1),
36
- type: z.literal("form"),
37
- }),
38
- ]),
45
+ connections: integrationConnectionManifestSchema.array().min(1),
39
46
  description: z.string().optional(),
40
47
  name: z.string().min(1),
41
48
  });
@@ -50,6 +57,7 @@ export const authorizationContract = {
50
57
  beginConnection: oc
51
58
  .input(z.object({
52
59
  binding: z.string().min(1),
60
+ connectionId: z.string().min(1),
53
61
  deploymentId: z.string(),
54
62
  serviceId: z.string().min(1),
55
63
  }))
@@ -73,6 +81,7 @@ export const authorizationContract = {
73
81
  accounts: z
74
82
  .object({
75
83
  checkedAt: z.date().nullable(),
84
+ connectionId: z.string().min(1),
76
85
  error: z
77
86
  .object({
78
87
  code: z.string(),
@@ -90,11 +99,17 @@ export const authorizationContract = {
90
99
  .object({
91
100
  accountId: z.string().nullable(),
92
101
  binding: z.string(),
102
+ connections: z
103
+ .object({
104
+ connectionId: z.string().min(1),
105
+ minimalScopes: z.string().array(),
106
+ requiredScopes: SCOPE_REQUIREMENT_SCHEMA.array(),
107
+ })
108
+ .array()
109
+ .min(1),
93
110
  eligibleAccountIds: z.string().array(),
94
- minimalScopes: z.string().array(),
95
- requiredScopes: SCOPE_REQUIREMENT_SCHEMA.array(),
96
111
  satisfied: z.boolean(),
97
- serviceId: z.string(),
112
+ serviceId: z.string().min(1),
98
113
  })
99
114
  .array(),
100
115
  services: integrationServiceManifestSchema
@@ -106,6 +121,7 @@ export const authorizationContract = {
106
121
  submitCredentials: oc
107
122
  .input(z.object({
108
123
  binding: z.string().min(1),
124
+ connectionId: z.string().min(1),
109
125
  data: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])),
110
126
  deploymentId: z.string(),
111
127
  serviceId: z.string().min(1),
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ export declare const asanaEventsContract: {
3
+ asanaEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4
+ callbackToken: z.ZodString;
5
+ events: z.ZodPrefault<z.ZodArray<z.ZodJSONSchema>>;
6
+ sourceId: z.ZodString;
7
+ }, z.core.$loose>, z.ZodVoid, Record<never, never>, Record<never, never>>;
8
+ };
@@ -0,0 +1,23 @@
1
+ import { oc } from "@orpc/contract";
2
+ import { z } from "zod";
3
+ export const asanaEventsContract = {
4
+ asanaEvent: oc
5
+ .route({
6
+ method: "POST",
7
+ path: "/events/asana/{sourceId}/{callbackToken}",
8
+ operationId: "receiveAsanaEvent",
9
+ summary: "Receive an Asana event",
10
+ description: "Completes Asana webhook handshakes and authenticates event callbacks.",
11
+ tags: ["Events"],
12
+ successStatus: 204,
13
+ })
14
+ .input(z.looseObject({
15
+ /** Per-webhook token encoded in the provider callback URL. */
16
+ callbackToken: z.string(),
17
+ /** Compact events included in a provider delivery. */
18
+ events: z.json().array().prefault([]),
19
+ /** Event source encoded in the provider callback URL. */
20
+ sourceId: z.string(),
21
+ }))
22
+ .output(z.void()),
23
+ };
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ export declare const brevoEventsContract: {
3
+ brevoEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4
+ event: z.ZodString;
5
+ id: z.ZodNumber;
6
+ sourceId: z.ZodString;
7
+ }, z.core.$loose>, z.ZodVoid, Record<never, never>, Record<never, never>>;
8
+ };
@@ -0,0 +1,23 @@
1
+ import { oc } from "@orpc/contract";
2
+ import { z } from "zod";
3
+ export const brevoEventsContract = {
4
+ brevoEvent: oc
5
+ .route({
6
+ method: "POST",
7
+ path: "/events/brevo/{sourceId}",
8
+ operationId: "receiveBrevoEvent",
9
+ summary: "Receive a Brevo event",
10
+ description: "Receives and authenticates callbacks delivered by Brevo webhooks.",
11
+ tags: ["Events"],
12
+ successStatus: 204,
13
+ })
14
+ .input(z.looseObject({
15
+ /** Brevo webhook event category. */
16
+ event: z.string(),
17
+ /** Brevo webhook ID. */
18
+ id: z.number(),
19
+ /** Event source encoded in the provider callback URL. */
20
+ sourceId: z.string(),
21
+ }))
22
+ .output(z.void()),
23
+ };
@@ -1,9 +1,51 @@
1
1
  export declare const eventsContract: {
2
+ trelloEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
3
+ sourceId: import("zod").ZodString;
4
+ action: import("zod").ZodObject<{
5
+ data: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodJSONSchema>;
6
+ date: import("zod").ZodString;
7
+ id: import("zod").ZodString;
8
+ type: import("zod").ZodString;
9
+ }, import("zod/v4/core").$loose>;
10
+ model: import("zod").ZodObject<{
11
+ id: import("zod").ZodString;
12
+ }, import("zod/v4/core").$loose>;
13
+ webhook: import("zod").ZodObject<{
14
+ id: import("zod").ZodString;
15
+ }, import("zod/v4/core").$loose>;
16
+ }, import("zod/v4/core").$loose>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
17
+ trelloWebhookProbe: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
18
+ sourceId: import("zod").ZodString;
19
+ }, import("zod/v4/core").$loose>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
2
20
  slackEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
3
21
  type: import("zod").ZodString;
4
22
  }, import("zod/v4/core").$loose>, import("zod").ZodObject<{
5
23
  challenge: import("zod").ZodOptional<import("zod").ZodString>;
6
24
  }, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
25
+ resendEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
26
+ sourceId: import("zod").ZodString;
27
+ }, import("zod/v4/core").$loose>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
28
+ microsoftGraphNotification: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
29
+ sourceId: import("zod").ZodString;
30
+ value: import("zod").ZodArray<import("zod").ZodObject<{
31
+ clientState: import("zod").ZodString;
32
+ changeType: import("zod").ZodLiteral<"created">;
33
+ id: import("zod").ZodOptional<import("zod").ZodString>;
34
+ resource: import("zod").ZodString;
35
+ resourceData: import("zod").ZodOptional<import("zod").ZodObject<{
36
+ "@odata.etag": import("zod").ZodOptional<import("zod").ZodString>;
37
+ id: import("zod").ZodOptional<import("zod").ZodString>;
38
+ }, import("zod/v4/core").$loose>>;
39
+ subscriptionId: import("zod").ZodString;
40
+ subscriptionExpirationDateTime: import("zod").ZodOptional<import("zod").ZodString>;
41
+ }, import("zod/v4/core").$loose>>;
42
+ }, import("zod/v4/core").$loose>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
43
+ linearEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
44
+ action: import("zod").ZodString;
45
+ organizationId: import("zod").ZodString;
46
+ type: import("zod").ZodString;
47
+ webhookTimestamp: import("zod").ZodNumber;
48
+ }, import("zod/v4/core").$loose>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
7
49
  gmailPush: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
8
50
  message: import("zod").ZodObject<{
9
51
  data: import("zod").ZodString;
@@ -27,4 +69,14 @@ export declare const eventsContract: {
27
69
  subscription: import("zod").ZodLiteral<"projects/opkitty/subscriptions/automate-ax-google-forms-push">;
28
70
  }, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
29
71
  googleCalendarPush: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodVoid, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
72
+ brevoEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
73
+ event: import("zod").ZodString;
74
+ id: import("zod").ZodNumber;
75
+ sourceId: import("zod").ZodString;
76
+ }, import("zod/v4/core").$loose>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
77
+ asanaEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
78
+ callbackToken: import("zod").ZodString;
79
+ events: import("zod").ZodPrefault<import("zod").ZodArray<import("zod").ZodJSONSchema>>;
80
+ sourceId: import("zod").ZodString;
81
+ }, import("zod/v4/core").$loose>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
30
82
  };
@@ -1,10 +1,22 @@
1
+ import { asanaEventsContract } from "./asana.js";
2
+ import { brevoEventsContract } from "./brevo.js";
1
3
  import { googleCalendarEventsContract } from "./google-calendar.js";
2
4
  import { googleFormsEventsContract } from "./google-forms.js";
3
5
  import { gmailEventsContract } from "./gmail.js";
6
+ import { linearEventsContract } from "./linear.js";
7
+ import { microsoftEventsContract } from "./microsoft.js";
8
+ import { resendEventsContract } from "./resend.js";
4
9
  import { slackEventsContract } from "./slack.js";
10
+ import { trelloEventsContract } from "./trello.js";
5
11
  export const eventsContract = {
12
+ ...asanaEventsContract,
13
+ ...brevoEventsContract,
6
14
  ...googleCalendarEventsContract,
7
15
  ...googleFormsEventsContract,
8
16
  ...gmailEventsContract,
17
+ ...linearEventsContract,
18
+ ...microsoftEventsContract,
19
+ ...resendEventsContract,
9
20
  ...slackEventsContract,
21
+ ...trelloEventsContract,
10
22
  };
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ export declare const linearEventsContract: {
3
+ linearEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4
+ action: z.ZodString;
5
+ organizationId: z.ZodString;
6
+ type: z.ZodString;
7
+ webhookTimestamp: z.ZodNumber;
8
+ }, z.core.$loose>, z.ZodObject<{}, z.core.$strip>, Record<never, never>, Record<never, never>>;
9
+ };
@@ -0,0 +1,25 @@
1
+ import { oc } from "@orpc/contract";
2
+ import { z } from "zod";
3
+ export const linearEventsContract = {
4
+ linearEvent: oc
5
+ .route({
6
+ method: "POST",
7
+ path: "/events/linear",
8
+ operationId: "receiveLinearEvent",
9
+ summary: "Receive a Linear event",
10
+ description: "Receives and authenticates callbacks delivered by Linear webhooks.",
11
+ tags: ["Events"],
12
+ successStatus: 200,
13
+ })
14
+ .input(z.looseObject({
15
+ /** Linear webhook action. */
16
+ action: z.string(),
17
+ /** Stable Linear workspace ID. */
18
+ organizationId: z.string(),
19
+ /** Linear webhook resource type. */
20
+ type: z.string(),
21
+ /** Unix timestamp in milliseconds when Linear sent the webhook. */
22
+ webhookTimestamp: z.number(),
23
+ }))
24
+ .output(z.object({})),
25
+ };
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ export declare const microsoftEventsContract: {
3
+ microsoftGraphNotification: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4
+ sourceId: z.ZodString;
5
+ value: z.ZodArray<z.ZodObject<{
6
+ clientState: z.ZodString;
7
+ changeType: z.ZodLiteral<"created">;
8
+ id: z.ZodOptional<z.ZodString>;
9
+ resource: z.ZodString;
10
+ resourceData: z.ZodOptional<z.ZodObject<{
11
+ "@odata.etag": z.ZodOptional<z.ZodString>;
12
+ id: z.ZodOptional<z.ZodString>;
13
+ }, z.core.$loose>>;
14
+ subscriptionId: z.ZodString;
15
+ subscriptionExpirationDateTime: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$loose>>;
17
+ }, z.core.$loose>, z.ZodVoid, Record<never, never>, Record<never, never>>;
18
+ };
@@ -0,0 +1,41 @@
1
+ import { oc } from "@orpc/contract";
2
+ import { z } from "zod";
3
+ export const microsoftEventsContract = {
4
+ microsoftGraphNotification: oc
5
+ .route({
6
+ method: "POST",
7
+ path: "/events/microsoft/{sourceId}",
8
+ operationId: "receiveMicrosoftGraphNotification",
9
+ summary: "Receive a Microsoft Graph notification",
10
+ description: "Receives and authenticates Outlook and Teams change notifications delivered by Microsoft Graph.",
11
+ tags: ["Events"],
12
+ successStatus: 204,
13
+ })
14
+ .input(z.looseObject({
15
+ sourceId: z.string(),
16
+ value: z
17
+ .looseObject({
18
+ /** Per-subscription value used to authenticate the callback. */
19
+ clientState: z.string(),
20
+ /** Provider change category. */
21
+ changeType: z.literal("created"),
22
+ /** Provider notification identifier, when Graph supplies one. */
23
+ id: z.string().optional(),
24
+ /** Graph resource path for the changed object. */
25
+ resource: z.string(),
26
+ /** Sparse identity and version fields supplied by Graph. */
27
+ resourceData: z
28
+ .looseObject({
29
+ "@odata.etag": z.string().optional(),
30
+ id: z.string().optional(),
31
+ })
32
+ .optional(),
33
+ /** Provider subscription that emitted the notification. */
34
+ subscriptionId: z.string(),
35
+ /** Provider subscription expiration echoed with the notification. */
36
+ subscriptionExpirationDateTime: z.string().optional(),
37
+ })
38
+ .array(),
39
+ }))
40
+ .output(z.void()),
41
+ };
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export declare const resendEventsContract: {
3
+ resendEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4
+ sourceId: z.ZodString;
5
+ }, z.core.$loose>, z.ZodVoid, Record<never, never>, Record<never, never>>;
6
+ };
@@ -0,0 +1,16 @@
1
+ import { oc } from "@orpc/contract";
2
+ import { z } from "zod";
3
+ export const resendEventsContract = {
4
+ resendEvent: oc
5
+ .route({
6
+ method: "POST",
7
+ path: "/events/resend/{sourceId}",
8
+ operationId: "receiveResendEvent",
9
+ summary: "Receive a Resend event",
10
+ description: "Receives and authenticates callbacks delivered by Resend webhooks.",
11
+ tags: ["Events"],
12
+ successStatus: 204,
13
+ })
14
+ .input(z.looseObject({ sourceId: z.string() }))
15
+ .output(z.void()),
16
+ };
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+ export declare const trelloEventsContract: {
3
+ trelloEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4
+ sourceId: z.ZodString;
5
+ action: z.ZodObject<{
6
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
7
+ date: z.ZodString;
8
+ id: z.ZodString;
9
+ type: z.ZodString;
10
+ }, z.core.$loose>;
11
+ model: z.ZodObject<{
12
+ id: z.ZodString;
13
+ }, z.core.$loose>;
14
+ webhook: z.ZodObject<{
15
+ id: z.ZodString;
16
+ }, z.core.$loose>;
17
+ }, z.core.$loose>, z.ZodVoid, Record<never, never>, Record<never, never>>;
18
+ trelloWebhookProbe: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
19
+ sourceId: z.ZodString;
20
+ }, z.core.$loose>, z.ZodVoid, Record<never, never>, Record<never, never>>;
21
+ };
@@ -0,0 +1,39 @@
1
+ import { oc } from "@orpc/contract";
2
+ import { z } from "zod";
3
+ /** Source path shared by Trello's callback probe and event delivery. */
4
+ const trelloWebhookPathInput = z.looseObject({ sourceId: z.string() });
5
+ export const trelloEventsContract = {
6
+ trelloEvent: oc
7
+ .route({
8
+ method: "POST",
9
+ path: "/events/trello/{sourceId}",
10
+ operationId: "receiveTrelloEvent",
11
+ summary: "Receive a Trello board event",
12
+ description: "Receives and authenticates callbacks delivered by Trello webhooks.",
13
+ tags: ["Events"],
14
+ successStatus: 204,
15
+ })
16
+ .input(trelloWebhookPathInput.extend({
17
+ action: z.looseObject({
18
+ data: z.record(z.string(), z.json()),
19
+ date: z.string(),
20
+ id: z.string(),
21
+ type: z.string(),
22
+ }),
23
+ model: z.looseObject({ id: z.string() }),
24
+ webhook: z.looseObject({ id: z.string() }),
25
+ }))
26
+ .output(z.void()),
27
+ trelloWebhookProbe: oc
28
+ .route({
29
+ method: "HEAD",
30
+ path: "/events/trello/{sourceId}",
31
+ operationId: "probeTrelloWebhook",
32
+ summary: "Probe a Trello webhook callback",
33
+ description: "Answers Trello's callback availability check before webhook creation.",
34
+ tags: ["Events"],
35
+ successStatus: 200,
36
+ })
37
+ .input(trelloWebhookPathInput)
38
+ .output(z.void()),
39
+ };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { AUTOMATION_SDK_VERSION, deploymentTriggerInfoSchema, type DeploymentTriggerInfo, } from "./deployment.js";
2
2
  export { runtimeContract } from "./runtime.js";
3
3
  export { createdOrganizationApiKeyOutputSchema, organizationApiKeyOutputSchema, } from "./api-key.js";
4
- export { integrationServiceManifestSchema, type IntegrationServiceManifest, } from "./authorization.js";
4
+ export { integrationConnectionManifestSchema, integrationServiceManifestSchema, type IntegrationConnectionManifest, type IntegrationServiceManifest, } from "./authorization.js";
5
5
  export { activeSubscriptionOutputSchema, createdInvitationOutputSchema, organizationDetailsOutputSchema, organizationInvitationOutputSchema, organizationMemberOutputSchema, organizationProjectOutputSchema, organizationRoleSchema, organizationSummaryOutputSchema, publicOrganizationOutputSchema, } from "./org.js";
6
6
  export { projectOutputSchema, projectWithOrganizationOutputSchema, } from "./project.js";
7
7
  export { reasonableNameSchema } from "./schemas.js";
@@ -250,6 +250,7 @@ export declare const firstPartyContract: {
250
250
  authorization: {
251
251
  beginConnection: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
252
252
  binding: import("zod").ZodString;
253
+ connectionId: import("zod").ZodString;
253
254
  deploymentId: import("zod").ZodString;
254
255
  serviceId: import("zod").ZodString;
255
256
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
@@ -260,6 +261,7 @@ export declare const firstPartyContract: {
260
261
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
261
262
  accounts: import("zod").ZodArray<import("zod").ZodObject<{
262
263
  checkedAt: import("zod").ZodNullable<import("zod").ZodDate>;
264
+ connectionId: import("zod").ZodString;
263
265
  error: import("zod").ZodNullable<import("zod").ZodObject<{
264
266
  code: import("zod").ZodString;
265
267
  message: import("zod").ZodString;
@@ -273,22 +275,29 @@ export declare const firstPartyContract: {
273
275
  requirements: import("zod").ZodArray<import("zod").ZodObject<{
274
276
  accountId: import("zod").ZodNullable<import("zod").ZodString>;
275
277
  binding: import("zod").ZodString;
278
+ connections: import("zod").ZodArray<import("zod").ZodObject<{
279
+ connectionId: import("zod").ZodString;
280
+ minimalScopes: import("zod").ZodArray<import("zod").ZodString>;
281
+ requiredScopes: import("zod").ZodArray<import("zod").ZodType<string | {
282
+ requirements: (string | /*elided*/ any)[];
283
+ type: "and" | "or";
284
+ }, unknown, import("zod/v4/core").$ZodTypeInternals<string | {
285
+ requirements: (string | /*elided*/ any)[];
286
+ type: "and" | "or";
287
+ }, unknown>>>;
288
+ }, import("zod/v4/core").$strip>>;
276
289
  eligibleAccountIds: import("zod").ZodArray<import("zod").ZodString>;
277
- minimalScopes: import("zod").ZodArray<import("zod").ZodString>;
278
- requiredScopes: import("zod").ZodArray<import("zod").ZodType<string | {
279
- requirements: (string | /*elided*/ any)[];
280
- type: "and" | "or";
281
- }, unknown, import("zod/v4/core").$ZodTypeInternals<string | {
282
- requirements: (string | /*elided*/ any)[];
283
- type: "and" | "or";
284
- }, unknown>>>;
285
290
  satisfied: import("zod").ZodBoolean;
286
291
  serviceId: import("zod").ZodString;
287
292
  }, import("zod/v4/core").$strip>>;
288
293
  services: import("zod").ZodArray<import("zod").ZodObject<{
289
- connection: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
294
+ connections: import("zod").ZodArray<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
295
+ description: import("zod").ZodOptional<import("zod").ZodString>;
296
+ id: import("zod").ZodString;
297
+ name: import("zod").ZodString;
290
298
  type: import("zod").ZodLiteral<"redirect">;
291
299
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
300
+ description: import("zod").ZodOptional<import("zod").ZodString>;
292
301
  fields: import("zod").ZodArray<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
293
302
  description: import("zod").ZodOptional<import("zod").ZodString>;
294
303
  label: import("zod").ZodString;
@@ -324,8 +333,10 @@ export declare const firstPartyContract: {
324
333
  default: import("zod").ZodOptional<import("zod").ZodBoolean>;
325
334
  input: import("zod").ZodLiteral<"boolean">;
326
335
  }, import("zod/v4/core").$strip>], "input">>;
336
+ id: import("zod").ZodString;
337
+ name: import("zod").ZodString;
327
338
  type: import("zod").ZodLiteral<"form">;
328
- }, import("zod/v4/core").$strip>], "type">;
339
+ }, import("zod/v4/core").$strip>], "type">>;
329
340
  description: import("zod").ZodOptional<import("zod").ZodString>;
330
341
  name: import("zod").ZodString;
331
342
  id: import("zod").ZodString;
@@ -338,6 +349,7 @@ export declare const firstPartyContract: {
338
349
  }, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
339
350
  submitCredentials: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
340
351
  binding: import("zod").ZodString;
352
+ connectionId: import("zod").ZodString;
341
353
  data: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber, import("zod").ZodBoolean]>>;
342
354
  deploymentId: import("zod").ZodString;
343
355
  serviceId: import("zod").ZodString;
@@ -648,6 +660,7 @@ export declare const contract: {
648
660
  }, import("zod/v4/core").$strip>, import("zod").ZodString, Record<never, never>, Record<never, never>>;
649
661
  beginConnection: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
650
662
  binding: import("zod").ZodString;
663
+ connectionId: import("zod").ZodString;
651
664
  deploymentId: import("zod").ZodString;
652
665
  serviceId: import("zod").ZodString;
653
666
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
@@ -658,6 +671,7 @@ export declare const contract: {
658
671
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
659
672
  accounts: import("zod").ZodArray<import("zod").ZodObject<{
660
673
  checkedAt: import("zod").ZodNullable<import("zod").ZodDate>;
674
+ connectionId: import("zod").ZodString;
661
675
  error: import("zod").ZodNullable<import("zod").ZodObject<{
662
676
  code: import("zod").ZodString;
663
677
  message: import("zod").ZodString;
@@ -671,22 +685,29 @@ export declare const contract: {
671
685
  requirements: import("zod").ZodArray<import("zod").ZodObject<{
672
686
  accountId: import("zod").ZodNullable<import("zod").ZodString>;
673
687
  binding: import("zod").ZodString;
688
+ connections: import("zod").ZodArray<import("zod").ZodObject<{
689
+ connectionId: import("zod").ZodString;
690
+ minimalScopes: import("zod").ZodArray<import("zod").ZodString>;
691
+ requiredScopes: import("zod").ZodArray<import("zod").ZodType<string | {
692
+ requirements: (string | /*elided*/ any)[];
693
+ type: "and" | "or";
694
+ }, unknown, import("zod/v4/core").$ZodTypeInternals<string | {
695
+ requirements: (string | /*elided*/ any)[];
696
+ type: "and" | "or";
697
+ }, unknown>>>;
698
+ }, import("zod/v4/core").$strip>>;
674
699
  eligibleAccountIds: import("zod").ZodArray<import("zod").ZodString>;
675
- minimalScopes: import("zod").ZodArray<import("zod").ZodString>;
676
- requiredScopes: import("zod").ZodArray<import("zod").ZodType<string | {
677
- requirements: (string | /*elided*/ any)[];
678
- type: "and" | "or";
679
- }, unknown, import("zod/v4/core").$ZodTypeInternals<string | {
680
- requirements: (string | /*elided*/ any)[];
681
- type: "and" | "or";
682
- }, unknown>>>;
683
700
  satisfied: import("zod").ZodBoolean;
684
701
  serviceId: import("zod").ZodString;
685
702
  }, import("zod/v4/core").$strip>>;
686
703
  services: import("zod").ZodArray<import("zod").ZodObject<{
687
- connection: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
704
+ connections: import("zod").ZodArray<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
705
+ description: import("zod").ZodOptional<import("zod").ZodString>;
706
+ id: import("zod").ZodString;
707
+ name: import("zod").ZodString;
688
708
  type: import("zod").ZodLiteral<"redirect">;
689
709
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
710
+ description: import("zod").ZodOptional<import("zod").ZodString>;
690
711
  fields: import("zod").ZodArray<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
691
712
  description: import("zod").ZodOptional<import("zod").ZodString>;
692
713
  label: import("zod").ZodString;
@@ -722,8 +743,10 @@ export declare const contract: {
722
743
  default: import("zod").ZodOptional<import("zod").ZodBoolean>;
723
744
  input: import("zod").ZodLiteral<"boolean">;
724
745
  }, import("zod/v4/core").$strip>], "input">>;
746
+ id: import("zod").ZodString;
747
+ name: import("zod").ZodString;
725
748
  type: import("zod").ZodLiteral<"form">;
726
- }, import("zod/v4/core").$strip>], "type">;
749
+ }, import("zod/v4/core").$strip>], "type">>;
727
750
  description: import("zod").ZodOptional<import("zod").ZodString>;
728
751
  name: import("zod").ZodString;
729
752
  id: import("zod").ZodString;
@@ -736,17 +759,60 @@ export declare const contract: {
736
759
  }, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
737
760
  submitCredentials: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
738
761
  binding: import("zod").ZodString;
762
+ connectionId: import("zod").ZodString;
739
763
  data: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber, import("zod").ZodBoolean]>>;
740
764
  deploymentId: import("zod").ZodString;
741
765
  serviceId: import("zod").ZodString;
742
766
  }, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
743
767
  };
744
768
  events: {
769
+ trelloEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
770
+ sourceId: import("zod").ZodString;
771
+ action: import("zod").ZodObject<{
772
+ data: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodJSONSchema>;
773
+ date: import("zod").ZodString;
774
+ id: import("zod").ZodString;
775
+ type: import("zod").ZodString;
776
+ }, import("zod/v4/core").$loose>;
777
+ model: import("zod").ZodObject<{
778
+ id: import("zod").ZodString;
779
+ }, import("zod/v4/core").$loose>;
780
+ webhook: import("zod").ZodObject<{
781
+ id: import("zod").ZodString;
782
+ }, import("zod/v4/core").$loose>;
783
+ }, import("zod/v4/core").$loose>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
784
+ trelloWebhookProbe: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
785
+ sourceId: import("zod").ZodString;
786
+ }, import("zod/v4/core").$loose>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
745
787
  slackEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
746
788
  type: import("zod").ZodString;
747
789
  }, import("zod/v4/core").$loose>, import("zod").ZodObject<{
748
790
  challenge: import("zod").ZodOptional<import("zod").ZodString>;
749
791
  }, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
792
+ resendEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
793
+ sourceId: import("zod").ZodString;
794
+ }, import("zod/v4/core").$loose>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
795
+ microsoftGraphNotification: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
796
+ sourceId: import("zod").ZodString;
797
+ value: import("zod").ZodArray<import("zod").ZodObject<{
798
+ clientState: import("zod").ZodString;
799
+ changeType: import("zod").ZodLiteral<"created">;
800
+ id: import("zod").ZodOptional<import("zod").ZodString>;
801
+ resource: import("zod").ZodString;
802
+ resourceData: import("zod").ZodOptional<import("zod").ZodObject<{
803
+ "@odata.etag": import("zod").ZodOptional<import("zod").ZodString>;
804
+ id: import("zod").ZodOptional<import("zod").ZodString>;
805
+ }, import("zod/v4/core").$loose>>;
806
+ subscriptionId: import("zod").ZodString;
807
+ subscriptionExpirationDateTime: import("zod").ZodOptional<import("zod").ZodString>;
808
+ }, import("zod/v4/core").$loose>>;
809
+ }, import("zod/v4/core").$loose>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
810
+ linearEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
811
+ action: import("zod").ZodString;
812
+ organizationId: import("zod").ZodString;
813
+ type: import("zod").ZodString;
814
+ webhookTimestamp: import("zod").ZodNumber;
815
+ }, import("zod/v4/core").$loose>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
750
816
  gmailPush: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
751
817
  message: import("zod").ZodObject<{
752
818
  data: import("zod").ZodString;
@@ -770,6 +836,16 @@ export declare const contract: {
770
836
  subscription: import("zod").ZodLiteral<"projects/opkitty/subscriptions/automate-ax-google-forms-push">;
771
837
  }, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
772
838
  googleCalendarPush: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodVoid, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
839
+ brevoEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
840
+ event: import("zod").ZodString;
841
+ id: import("zod").ZodNumber;
842
+ sourceId: import("zod").ZodString;
843
+ }, import("zod/v4/core").$loose>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
844
+ asanaEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
845
+ callbackToken: import("zod").ZodString;
846
+ events: import("zod").ZodPrefault<import("zod").ZodArray<import("zod").ZodJSONSchema>>;
847
+ sourceId: import("zod").ZodString;
848
+ }, import("zod/v4/core").$loose>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
773
849
  };
774
850
  runtime: {
775
851
  commit: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
@@ -850,6 +926,7 @@ export declare const contract: {
850
926
  binding: import("zod").ZodString;
851
927
  serviceId: import("zod").ZodString;
852
928
  }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
929
+ connectionId: import("zod").ZodString;
853
930
  secret: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
854
931
  serviceId: import("zod").ZodString;
855
932
  }, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { runtimeContract } from "./runtime.js";
9
9
  export { AUTOMATION_SDK_VERSION, deploymentTriggerInfoSchema, } from "./deployment.js";
10
10
  export { runtimeContract } from "./runtime.js";
11
11
  export { createdOrganizationApiKeyOutputSchema, organizationApiKeyOutputSchema, } from "./api-key.js";
12
- export { integrationServiceManifestSchema, } from "./authorization.js";
12
+ export { integrationConnectionManifestSchema, integrationServiceManifestSchema, } from "./authorization.js";
13
13
  export { activeSubscriptionOutputSchema, createdInvitationOutputSchema, organizationDetailsOutputSchema, organizationInvitationOutputSchema, organizationMemberOutputSchema, organizationProjectOutputSchema, organizationRoleSchema, organizationSummaryOutputSchema, publicOrganizationOutputSchema, } from "./org.js";
14
14
  export { projectOutputSchema, projectWithOrganizationOutputSchema, } from "./project.js";
15
15
  export { reasonableNameSchema } from "./schemas.js";
package/dist/runtime.d.ts CHANGED
@@ -78,6 +78,7 @@ export declare const runtimeContract: {
78
78
  binding: z.ZodString;
79
79
  serviceId: z.ZodString;
80
80
  }, z.core.$strict>, z.ZodObject<{
81
+ connectionId: z.ZodString;
81
82
  secret: z.ZodRecord<z.ZodString, z.ZodUnknown>;
82
83
  serviceId: z.ZodString;
83
84
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
package/dist/runtime.js CHANGED
@@ -98,6 +98,7 @@ export const runtimeContract = {
98
98
  serviceId: z.string().min(1),
99
99
  }))
100
100
  .output(z.object({
101
+ connectionId: z.string().min(1),
101
102
  secret: z.record(z.string(), z.unknown()),
102
103
  serviceId: z.string(),
103
104
  })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/api-contract",
3
- "version": "0.14.0",
3
+ "version": "0.16.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.14.0",
29
+ "@automate.ax/codec": "0.16.0",
30
30
  "@orpc/contract": "1.13.14",
31
31
  "zod": "^4.3.6"
32
32
  },
@@ -29,16 +29,27 @@ const INTEGRATION_FORM_FIELD_SCHEMA = z.discriminatedUnion("input", [
29
29
  }),
30
30
  ])
31
31
 
32
- export const integrationServiceManifestSchema = z.object({
33
- connection: z.discriminatedUnion("type", [
32
+ export const integrationConnectionManifestSchema = z.discriminatedUnion(
33
+ "type",
34
+ [
34
35
  z.object({
36
+ description: z.string().optional(),
37
+ id: z.string().min(1),
38
+ name: z.string().min(1),
35
39
  type: z.literal("redirect"),
36
40
  }),
37
41
  z.object({
42
+ description: z.string().optional(),
38
43
  fields: INTEGRATION_FORM_FIELD_SCHEMA.array().min(1),
44
+ id: z.string().min(1),
45
+ name: z.string().min(1),
39
46
  type: z.literal("form"),
40
47
  }),
41
- ]),
48
+ ],
49
+ )
50
+
51
+ export const integrationServiceManifestSchema = z.object({
52
+ connections: integrationConnectionManifestSchema.array().min(1),
42
53
  description: z.string().optional(),
43
54
  name: z.string().min(1),
44
55
  })
@@ -46,6 +57,9 @@ export const integrationServiceManifestSchema = z.object({
46
57
  export type IntegrationServiceManifest = z.infer<
47
58
  typeof integrationServiceManifestSchema
48
59
  >
60
+ export type IntegrationConnectionManifest = z.infer<
61
+ typeof integrationConnectionManifestSchema
62
+ >
49
63
 
50
64
  type ScopeRequirement =
51
65
  | string
@@ -68,6 +82,7 @@ export const authorizationContract = {
68
82
  .input(
69
83
  z.object({
70
84
  binding: z.string().min(1),
85
+ connectionId: z.string().min(1),
71
86
  deploymentId: z.string(),
72
87
  serviceId: z.string().min(1),
73
88
  }),
@@ -95,6 +110,7 @@ export const authorizationContract = {
95
110
  accounts: z
96
111
  .object({
97
112
  checkedAt: z.date().nullable(),
113
+ connectionId: z.string().min(1),
98
114
  error: z
99
115
  .object({
100
116
  code: z.string(),
@@ -112,11 +128,17 @@ export const authorizationContract = {
112
128
  .object({
113
129
  accountId: z.string().nullable(),
114
130
  binding: z.string(),
131
+ connections: z
132
+ .object({
133
+ connectionId: z.string().min(1),
134
+ minimalScopes: z.string().array(),
135
+ requiredScopes: SCOPE_REQUIREMENT_SCHEMA.array(),
136
+ })
137
+ .array()
138
+ .min(1),
115
139
  eligibleAccountIds: z.string().array(),
116
- minimalScopes: z.string().array(),
117
- requiredScopes: SCOPE_REQUIREMENT_SCHEMA.array(),
118
140
  satisfied: z.boolean(),
119
- serviceId: z.string(),
141
+ serviceId: z.string().min(1),
120
142
  })
121
143
  .array(),
122
144
  services: integrationServiceManifestSchema
@@ -130,6 +152,7 @@ export const authorizationContract = {
130
152
  .input(
131
153
  z.object({
132
154
  binding: z.string().min(1),
155
+ connectionId: z.string().min(1),
133
156
  data: z.record(
134
157
  z.string(),
135
158
  z.union([z.string(), z.number(), z.boolean()]),
@@ -0,0 +1,29 @@
1
+ import { oc } from "@orpc/contract"
2
+ import { z } from "zod"
3
+
4
+ export const asanaEventsContract = {
5
+ asanaEvent: oc
6
+ .route({
7
+ method: "POST",
8
+ path: "/events/asana/{sourceId}/{callbackToken}",
9
+ operationId: "receiveAsanaEvent",
10
+ summary: "Receive an Asana event",
11
+ description:
12
+ "Completes Asana webhook handshakes and authenticates event callbacks.",
13
+ tags: ["Events"],
14
+ successStatus: 204,
15
+ })
16
+ .input(
17
+ z.looseObject({
18
+ /** Per-webhook token encoded in the provider callback URL. */
19
+ callbackToken: z.string(),
20
+
21
+ /** Compact events included in a provider delivery. */
22
+ events: z.json().array().prefault([]),
23
+
24
+ /** Event source encoded in the provider callback URL. */
25
+ sourceId: z.string(),
26
+ }),
27
+ )
28
+ .output(z.void()),
29
+ }
@@ -0,0 +1,29 @@
1
+ import { oc } from "@orpc/contract"
2
+ import { z } from "zod"
3
+
4
+ export const brevoEventsContract = {
5
+ brevoEvent: oc
6
+ .route({
7
+ method: "POST",
8
+ path: "/events/brevo/{sourceId}",
9
+ operationId: "receiveBrevoEvent",
10
+ summary: "Receive a Brevo event",
11
+ description:
12
+ "Receives and authenticates callbacks delivered by Brevo webhooks.",
13
+ tags: ["Events"],
14
+ successStatus: 204,
15
+ })
16
+ .input(
17
+ z.looseObject({
18
+ /** Brevo webhook event category. */
19
+ event: z.string(),
20
+
21
+ /** Brevo webhook ID. */
22
+ id: z.number(),
23
+
24
+ /** Event source encoded in the provider callback URL. */
25
+ sourceId: z.string(),
26
+ }),
27
+ )
28
+ .output(z.void()),
29
+ }
@@ -1,11 +1,23 @@
1
+ import { asanaEventsContract } from "./asana"
2
+ import { brevoEventsContract } from "./brevo"
1
3
  import { googleCalendarEventsContract } from "./google-calendar"
2
4
  import { googleFormsEventsContract } from "./google-forms"
3
5
  import { gmailEventsContract } from "./gmail"
6
+ import { linearEventsContract } from "./linear"
7
+ import { microsoftEventsContract } from "./microsoft"
8
+ import { resendEventsContract } from "./resend"
4
9
  import { slackEventsContract } from "./slack"
10
+ import { trelloEventsContract } from "./trello"
5
11
 
6
12
  export const eventsContract = {
13
+ ...asanaEventsContract,
14
+ ...brevoEventsContract,
7
15
  ...googleCalendarEventsContract,
8
16
  ...googleFormsEventsContract,
9
17
  ...gmailEventsContract,
18
+ ...linearEventsContract,
19
+ ...microsoftEventsContract,
20
+ ...resendEventsContract,
10
21
  ...slackEventsContract,
22
+ ...trelloEventsContract,
11
23
  }
@@ -0,0 +1,32 @@
1
+ import { oc } from "@orpc/contract"
2
+ import { z } from "zod"
3
+
4
+ export const linearEventsContract = {
5
+ linearEvent: oc
6
+ .route({
7
+ method: "POST",
8
+ path: "/events/linear",
9
+ operationId: "receiveLinearEvent",
10
+ summary: "Receive a Linear event",
11
+ description:
12
+ "Receives and authenticates callbacks delivered by Linear webhooks.",
13
+ tags: ["Events"],
14
+ successStatus: 200,
15
+ })
16
+ .input(
17
+ z.looseObject({
18
+ /** Linear webhook action. */
19
+ action: z.string(),
20
+
21
+ /** Stable Linear workspace ID. */
22
+ organizationId: z.string(),
23
+
24
+ /** Linear webhook resource type. */
25
+ type: z.string(),
26
+
27
+ /** Unix timestamp in milliseconds when Linear sent the webhook. */
28
+ webhookTimestamp: z.number(),
29
+ }),
30
+ )
31
+ .output(z.object({})),
32
+ }
@@ -0,0 +1,51 @@
1
+ import { oc } from "@orpc/contract"
2
+ import { z } from "zod"
3
+
4
+ export const microsoftEventsContract = {
5
+ microsoftGraphNotification: oc
6
+ .route({
7
+ method: "POST",
8
+ path: "/events/microsoft/{sourceId}",
9
+ operationId: "receiveMicrosoftGraphNotification",
10
+ summary: "Receive a Microsoft Graph notification",
11
+ description:
12
+ "Receives and authenticates Outlook and Teams change notifications delivered by Microsoft Graph.",
13
+ tags: ["Events"],
14
+ successStatus: 204,
15
+ })
16
+ .input(
17
+ z.looseObject({
18
+ sourceId: z.string(),
19
+ value: z
20
+ .looseObject({
21
+ /** Per-subscription value used to authenticate the callback. */
22
+ clientState: z.string(),
23
+
24
+ /** Provider change category. */
25
+ changeType: z.literal("created"),
26
+
27
+ /** Provider notification identifier, when Graph supplies one. */
28
+ id: z.string().optional(),
29
+
30
+ /** Graph resource path for the changed object. */
31
+ resource: z.string(),
32
+
33
+ /** Sparse identity and version fields supplied by Graph. */
34
+ resourceData: z
35
+ .looseObject({
36
+ "@odata.etag": z.string().optional(),
37
+ id: z.string().optional(),
38
+ })
39
+ .optional(),
40
+
41
+ /** Provider subscription that emitted the notification. */
42
+ subscriptionId: z.string(),
43
+
44
+ /** Provider subscription expiration echoed with the notification. */
45
+ subscriptionExpirationDateTime: z.string().optional(),
46
+ })
47
+ .array(),
48
+ }),
49
+ )
50
+ .output(z.void()),
51
+ }
@@ -0,0 +1,18 @@
1
+ import { oc } from "@orpc/contract"
2
+ import { z } from "zod"
3
+
4
+ export const resendEventsContract = {
5
+ resendEvent: oc
6
+ .route({
7
+ method: "POST",
8
+ path: "/events/resend/{sourceId}",
9
+ operationId: "receiveResendEvent",
10
+ summary: "Receive a Resend event",
11
+ description:
12
+ "Receives and authenticates callbacks delivered by Resend webhooks.",
13
+ tags: ["Events"],
14
+ successStatus: 204,
15
+ })
16
+ .input(z.looseObject({ sourceId: z.string() }))
17
+ .output(z.void()),
18
+ }
@@ -0,0 +1,45 @@
1
+ import { oc } from "@orpc/contract"
2
+ import { z } from "zod"
3
+
4
+ /** Source path shared by Trello's callback probe and event delivery. */
5
+ const trelloWebhookPathInput = z.looseObject({ sourceId: z.string() })
6
+
7
+ export const trelloEventsContract = {
8
+ trelloEvent: oc
9
+ .route({
10
+ method: "POST",
11
+ path: "/events/trello/{sourceId}",
12
+ operationId: "receiveTrelloEvent",
13
+ summary: "Receive a Trello board event",
14
+ description:
15
+ "Receives and authenticates callbacks delivered by Trello webhooks.",
16
+ tags: ["Events"],
17
+ successStatus: 204,
18
+ })
19
+ .input(
20
+ trelloWebhookPathInput.extend({
21
+ action: z.looseObject({
22
+ data: z.record(z.string(), z.json()),
23
+ date: z.string(),
24
+ id: z.string(),
25
+ type: z.string(),
26
+ }),
27
+ model: z.looseObject({ id: z.string() }),
28
+ webhook: z.looseObject({ id: z.string() }),
29
+ }),
30
+ )
31
+ .output(z.void()),
32
+ trelloWebhookProbe: oc
33
+ .route({
34
+ method: "HEAD",
35
+ path: "/events/trello/{sourceId}",
36
+ operationId: "probeTrelloWebhook",
37
+ summary: "Probe a Trello webhook callback",
38
+ description:
39
+ "Answers Trello's callback availability check before webhook creation.",
40
+ tags: ["Events"],
41
+ successStatus: 200,
42
+ })
43
+ .input(trelloWebhookPathInput)
44
+ .output(z.void()),
45
+ }
package/src/index.ts CHANGED
@@ -18,7 +18,9 @@ export {
18
18
  organizationApiKeyOutputSchema,
19
19
  } from "./api-key"
20
20
  export {
21
+ integrationConnectionManifestSchema,
21
22
  integrationServiceManifestSchema,
23
+ type IntegrationConnectionManifest,
22
24
  type IntegrationServiceManifest,
23
25
  } from "./authorization"
24
26
  export {
package/src/runtime.ts CHANGED
@@ -112,6 +112,7 @@ export const runtimeContract = {
112
112
  )
113
113
  .output(
114
114
  z.object({
115
+ connectionId: z.string().min(1),
115
116
  secret: z.record(z.string(), z.unknown()),
116
117
  serviceId: z.string(),
117
118
  }),