@automate.ax/api-contract 0.15.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.
@@ -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
@@ -766,11 +766,53 @@ export declare const contract: {
766
766
  }, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
767
767
  };
768
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>>;
769
787
  slackEvent: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
770
788
  type: import("zod").ZodString;
771
789
  }, import("zod/v4/core").$loose>, import("zod").ZodObject<{
772
790
  challenge: import("zod").ZodOptional<import("zod").ZodString>;
773
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>>;
774
816
  gmailPush: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
775
817
  message: import("zod").ZodObject<{
776
818
  data: import("zod").ZodString;
@@ -794,6 +836,16 @@ export declare const contract: {
794
836
  subscription: import("zod").ZodLiteral<"projects/opkitty/subscriptions/automate-ax-google-forms-push">;
795
837
  }, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
796
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>>;
797
849
  };
798
850
  runtime: {
799
851
  commit: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/api-contract",
3
- "version": "0.15.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.15.0",
29
+ "@automate.ax/codec": "0.16.0",
30
30
  "@orpc/contract": "1.13.14",
31
31
  "zod": "^4.3.6"
32
32
  },
@@ -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
+ }