@automate.ax/catalog 0.63.0 → 0.64.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/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { airtableService, anthropicService, apolloService, asanaService, brevoService, cerebrasService, cloudflareService, cohereService, deepinfraService, deepseekService, firecrawlService, fireworksService, getIntegrationService, githubService, googleGenaiService, googleService, groqService, huggingfaceService, integrationCatalog, linearService, microsoftService, millionverifierService, mistralService, openaiService, openrouterService, perplexityService, postgresService, resendService, scrapflyService, slackService, tidycalService, togetheraiService, trelloService, vercelAiGatewayService, vercelService, whatsappService, xaiService, type IntegrationServiceId, } from "./catalog.js";
2
2
  export { defineIntegrationCatalog, defineIntegrationService, integrationScope, type IntegrationAccountConnectionOption, type IntegrationAccountRequirement, type IntegrationConnectionDefinition, type IntegrationFormField, type IntegrationScopeRequirement, type IntegrationServiceDefinition, type ScopeRequirementGroup, type TriggerDefinition, type TriggerPresentation, type TriggerPresentationContext, type TriggerPresentationDetail, type TriggerScopePresentation, type TriggerPresentationValue, } from "./types.js";
3
- export { getDashboardRunEndpoint, getDashboardRunEndpointKey, getHttpTriggerEndpoint, getHttpTriggerEndpointKey, DASHBOARD_RUN_CONFIG_SCHEMA, getTriggerDefinition, getTriggerName, getTriggerPresentation, isTriggerVisible, triggerCatalog, triggerDefinitions, type DashboardRunConfig, type DashboardRunEndpointOptions, type DashboardRunField, type HttpTriggerEndpointOptions, type HttpTriggerScope, type TriggerType, } from "./triggers/index.js";
3
+ export { getDashboardRunEndpoint, getDashboardRunEndpointKey, getHttpTriggerEndpoint, getHttpTriggerEndpointKey, getMailhookAddress, getMailhookAddressKey, DASHBOARD_RUN_CONFIG_SCHEMA, getTriggerDefinition, getTriggerName, getTriggerPresentation, isTriggerVisible, PLATFORM_EMAIL_DOMAIN, triggerCatalog, triggerDefinitions, type DashboardRunConfig, type DashboardRunEndpointOptions, type DashboardRunField, type HttpTriggerEndpointOptions, type HttpTriggerScope, type MailhookAddressOptions, type MailhookScope, type TriggerType, } from "./triggers/index.js";
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export { airtableService, anthropicService, apolloService, asanaService, brevoService, cerebrasService, cloudflareService, cohereService, deepinfraService, deepseekService, firecrawlService, fireworksService, getIntegrationService, githubService, googleGenaiService, googleService, groqService, huggingfaceService, integrationCatalog, linearService, microsoftService, millionverifierService, mistralService, openaiService, openrouterService, perplexityService, postgresService, resendService, scrapflyService, slackService, tidycalService, togetheraiService, trelloService, vercelAiGatewayService, vercelService, whatsappService, xaiService, } from "./catalog.js";
2
2
  export { defineIntegrationCatalog, defineIntegrationService, integrationScope, } from "./types.js";
3
- export { getDashboardRunEndpoint, getDashboardRunEndpointKey, getHttpTriggerEndpoint, getHttpTriggerEndpointKey, DASHBOARD_RUN_CONFIG_SCHEMA, getTriggerDefinition, getTriggerName, getTriggerPresentation, isTriggerVisible, triggerCatalog, triggerDefinitions, } from "./triggers/index.js";
3
+ export { getDashboardRunEndpoint, getDashboardRunEndpointKey, getHttpTriggerEndpoint, getHttpTriggerEndpointKey, getMailhookAddress, getMailhookAddressKey, DASHBOARD_RUN_CONFIG_SCHEMA, getTriggerDefinition, getTriggerName, getTriggerPresentation, isTriggerVisible, PLATFORM_EMAIL_DOMAIN, triggerCatalog, triggerDefinitions, } from "./triggers/index.js";
@@ -70,6 +70,15 @@ export declare const coreTriggerDefinitions: {
70
70
  readonly name: "HTTP request";
71
71
  readonly type: "http.request";
72
72
  };
73
+ readonly mailhookEmailReceived: {
74
+ readonly getPrimary: ({ automationId, config, hookSlot, projectId, scopePath }: import("..").TriggerPresentationContext) => {
75
+ copyable: true;
76
+ value: string;
77
+ };
78
+ readonly icon: "webhook";
79
+ readonly name: "Mailhook";
80
+ readonly type: "mailhook.email.received";
81
+ };
73
82
  readonly dashboardRun: {
74
83
  readonly getDetails: ({ config }: import("..").TriggerPresentationContext) => {
75
84
  label: string;
@@ -127,6 +136,8 @@ export interface DashboardRunEndpointOptions {
127
136
  scopePath?: readonly number[];
128
137
  }
129
138
  export type HttpTriggerScope = "trigger" | "automation" | "project";
139
+ export type MailhookScope = HttpTriggerScope;
140
+ export declare const PLATFORM_EMAIL_DOMAIN = "automations.automate.ax";
130
141
  export interface HttpTriggerEndpointOptions {
131
142
  appOrigin: string;
132
143
  automationId: string;
@@ -135,6 +146,14 @@ export interface HttpTriggerEndpointOptions {
135
146
  scope: HttpTriggerScope;
136
147
  scopePath?: readonly number[];
137
148
  }
149
+ export interface MailhookAddressOptions {
150
+ automationId: string;
151
+ hookSlot: number;
152
+ plusPath?: string;
153
+ projectId: string;
154
+ scope: MailhookScope;
155
+ scopePath?: readonly number[];
156
+ }
138
157
  /**
139
158
  * Returns the public URL for one deployed HTTP trigger.
140
159
  *
@@ -147,6 +166,21 @@ export declare function getHttpTriggerEndpoint(options: HttpTriggerEndpointOptio
147
166
  * @param options - Trigger and owning resource identity.
148
167
  */
149
168
  export declare function getHttpTriggerEndpointKey(options: Omit<HttpTriggerEndpointOptions, "appOrigin">): string;
169
+ /**
170
+ * Returns the unique inbound address for one deployed mailhook.
171
+ *
172
+ * Add `+suffix` before the `@` to carry a routing value into the event.
173
+ *
174
+ * @param options - Mailhook identity and sharing scope.
175
+ * @throws When the generated local part exceeds the email size limit.
176
+ */
177
+ export declare function getMailhookAddress(options: MailhookAddressOptions): string;
178
+ /**
179
+ * Returns the local-part router key for one configured mailhook scope.
180
+ *
181
+ * @param options - Mailhook identity and sharing scope.
182
+ */
183
+ export declare function getMailhookAddressKey(options: MailhookAddressOptions): string;
150
184
  /**
151
185
  * Returns the organization-authenticated submission endpoint for one dashboard
152
186
  * run.
@@ -1,4 +1,6 @@
1
1
  import * as z from "zod/mini";
2
+ const MAX_EMAIL_LOCAL_PART_BYTES = 64;
3
+ const EMAIL_SCHEMA = z.email();
2
4
  const CRON_PRESENTATION_CONFIG_SCHEMA = z.object({
3
5
  schedule: z.string(),
4
6
  timeZone: z.prefault(z.string(), "UTC"),
@@ -6,6 +8,9 @@ const CRON_PRESENTATION_CONFIG_SCHEMA = z.object({
6
8
  const HTTP_PRESENTATION_CONFIG_SCHEMA = z.object({
7
9
  scope: z.prefault(z.enum(["trigger", "automation", "project"]), "trigger"),
8
10
  });
11
+ const MAILHOOK_PRESENTATION_CONFIG_SCHEMA = z.object({
12
+ scope: z.prefault(z.enum(["trigger", "automation", "project"]), "trigger"),
13
+ });
9
14
  const INVOCATION_PRESENTATION_CONFIG_SCHEMA = z.object({
10
15
  entrypoint: z.string(),
11
16
  });
@@ -103,6 +108,21 @@ export const coreTriggerDefinitions = {
103
108
  name: "HTTP request",
104
109
  type: "http.request",
105
110
  },
111
+ mailhookEmailReceived: {
112
+ getPrimary: ({ automationId, config, hookSlot, projectId, scopePath }) => ({
113
+ copyable: true,
114
+ value: getMailhookAddress({
115
+ automationId,
116
+ hookSlot,
117
+ projectId,
118
+ scope: MAILHOOK_PRESENTATION_CONFIG_SCHEMA.parse(config).scope,
119
+ scopePath,
120
+ }),
121
+ }),
122
+ icon: "webhook",
123
+ name: "Mailhook",
124
+ type: "mailhook.email.received",
125
+ },
106
126
  dashboardRun: {
107
127
  getDetails: ({ config }) => [
108
128
  {
@@ -115,6 +135,7 @@ export const coreTriggerDefinitions = {
115
135
  type: "dashboard.run",
116
136
  },
117
137
  };
138
+ export const PLATFORM_EMAIL_DOMAIN = "automations.automate.ax";
118
139
  /**
119
140
  * Returns the public URL for one deployed HTTP trigger.
120
141
  *
@@ -138,6 +159,39 @@ export function getHttpTriggerEndpointKey(options) {
138
159
  options.hookSlot,
139
160
  ].join(".")}`;
140
161
  }
162
+ /**
163
+ * Returns the unique inbound address for one deployed mailhook.
164
+ *
165
+ * Add `+suffix` before the `@` to carry a routing value into the event.
166
+ *
167
+ * @param options - Mailhook identity and sharing scope.
168
+ * @throws When the generated local part exceeds the email size limit.
169
+ */
170
+ export function getMailhookAddress(options) {
171
+ const localPart = `${getMailhookAddressKey(options)}${options.plusPath ? `+${options.plusPath}` : ""}`;
172
+ if (new TextEncoder().encode(localPart).length > MAX_EMAIL_LOCAL_PART_BYTES) {
173
+ throw new RangeError("Mailhook address local part exceeds 64 bytes.");
174
+ }
175
+ return EMAIL_SCHEMA.parse(`${localPart}@${PLATFORM_EMAIL_DOMAIN}`);
176
+ }
177
+ /**
178
+ * Returns the local-part router key for one configured mailhook scope.
179
+ *
180
+ * @param options - Mailhook identity and sharing scope.
181
+ */
182
+ export function getMailhookAddressKey(options) {
183
+ if (options.scope === "project")
184
+ return `p${typeIdSuffix(options.projectId)}`;
185
+ if (options.scope === "automation") {
186
+ return `a${typeIdSuffix(options.automationId)}`;
187
+ }
188
+ return `a${typeIdSuffix(options.automationId)}.${[
189
+ ...(options.scopePath ?? []),
190
+ options.hookSlot,
191
+ ]
192
+ .map((segment) => segment.toString(36))
193
+ .join(".")}`;
194
+ }
141
195
  /**
142
196
  * Returns the organization-authenticated submission endpoint for one dashboard
143
197
  * run.
@@ -158,3 +212,11 @@ export function getDashboardRunEndpointKey(options) {
158
212
  options.hookSlot,
159
213
  ].join(".")}`;
160
214
  }
215
+ /**
216
+ * Removes the redundant TypeID prefix from an address router.
217
+ *
218
+ * @param id - Project or automation TypeID.
219
+ */
220
+ function typeIdSuffix(id) {
221
+ return id.includes("_") ? id.slice(id.indexOf("_") + 1) : id;
222
+ }
@@ -1,5 +1,5 @@
1
1
  import type { TriggerDefinition, TriggerPresentation, TriggerPresentationContext, TriggerScopePresentation } from "../types.js";
2
- export { getDashboardRunEndpoint, getDashboardRunEndpointKey, getHttpTriggerEndpoint, getHttpTriggerEndpointKey, DASHBOARD_RUN_CONFIG_SCHEMA, type DashboardRunConfig, type DashboardRunEndpointOptions, type DashboardRunField, type HttpTriggerEndpointOptions, type HttpTriggerScope, } from "./core.js";
2
+ export { getDashboardRunEndpoint, getDashboardRunEndpointKey, getHttpTriggerEndpoint, getHttpTriggerEndpointKey, getMailhookAddress, getMailhookAddressKey, PLATFORM_EMAIL_DOMAIN, DASHBOARD_RUN_CONFIG_SCHEMA, type DashboardRunConfig, type DashboardRunEndpointOptions, type DashboardRunField, type HttpTriggerEndpointOptions, type HttpTriggerScope, type MailhookAddressOptions, type MailhookScope, } from "./core.js";
3
3
  /** Plain shared definitions for every public trigger type. */
4
4
  export declare const triggerDefinitions: {
5
5
  readonly whatsappMessageDelivered: {
@@ -1075,6 +1075,15 @@ export declare const triggerDefinitions: {
1075
1075
  readonly name: "HTTP request";
1076
1076
  readonly type: "http.request";
1077
1077
  };
1078
+ readonly mailhookEmailReceived: {
1079
+ readonly getPrimary: ({ automationId, config, hookSlot, projectId, scopePath }: TriggerPresentationContext) => {
1080
+ copyable: true;
1081
+ value: string;
1082
+ };
1083
+ readonly icon: "webhook";
1084
+ readonly name: "Mailhook";
1085
+ readonly type: "mailhook.email.received";
1086
+ };
1078
1087
  readonly dashboardRun: {
1079
1088
  readonly getDetails: ({ config }: TriggerPresentationContext) => {
1080
1089
  label: string;
@@ -1564,6 +1573,14 @@ export declare const triggerCatalog: ({
1564
1573
  };
1565
1574
  icon: "webhook";
1566
1575
  type: "http.request";
1576
+ } | {
1577
+ name: string;
1578
+ getPrimary: ({ automationId, config, hookSlot, projectId, scopePath }: TriggerPresentationContext) => {
1579
+ copyable: true;
1580
+ value: string;
1581
+ };
1582
+ icon: "webhook";
1583
+ type: "mailhook.email.received";
1567
1584
  } | {
1568
1585
  name: string;
1569
1586
  getDetails: ({ config }: TriggerPresentationContext) => {
@@ -12,7 +12,7 @@ import { trelloTriggerDefinitions } from "./trello.js";
12
12
  import { vercelTriggerDefinitions } from "./vercel.js";
13
13
  import { whatsappTriggerDefinitions } from "./whatsapp.js";
14
14
  import { getIntegrationService } from "../catalog.js";
15
- export { getDashboardRunEndpoint, getDashboardRunEndpointKey, getHttpTriggerEndpoint, getHttpTriggerEndpointKey, DASHBOARD_RUN_CONFIG_SCHEMA, } from "./core.js";
15
+ export { getDashboardRunEndpoint, getDashboardRunEndpointKey, getHttpTriggerEndpoint, getHttpTriggerEndpointKey, getMailhookAddress, getMailhookAddressKey, PLATFORM_EMAIL_DOMAIN, DASHBOARD_RUN_CONFIG_SCHEMA, } from "./core.js";
16
16
  /** Plain shared definitions for every public trigger type. */
17
17
  export const triggerDefinitions = {
18
18
  ...airtableTriggerDefinitions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/catalog",
3
- "version": "0.63.0",
3
+ "version": "0.64.0",
4
4
  "description": "Shared integration service and trigger definitions for Automate.ax.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -61,11 +61,14 @@ export {
61
61
  getDashboardRunEndpointKey,
62
62
  getHttpTriggerEndpoint,
63
63
  getHttpTriggerEndpointKey,
64
+ getMailhookAddress,
65
+ getMailhookAddressKey,
64
66
  DASHBOARD_RUN_CONFIG_SCHEMA,
65
67
  getTriggerDefinition,
66
68
  getTriggerName,
67
69
  getTriggerPresentation,
68
70
  isTriggerVisible,
71
+ PLATFORM_EMAIL_DOMAIN,
69
72
  triggerCatalog,
70
73
  triggerDefinitions,
71
74
  type DashboardRunConfig,
@@ -73,5 +76,7 @@ export {
73
76
  type DashboardRunField,
74
77
  type HttpTriggerEndpointOptions,
75
78
  type HttpTriggerScope,
79
+ type MailhookAddressOptions,
80
+ type MailhookScope,
76
81
  type TriggerType,
77
82
  } from "./triggers"
@@ -1,6 +1,8 @@
1
1
  import type { TriggerDefinition } from "../types"
2
2
  import * as z from "zod/mini"
3
3
 
4
+ const MAX_EMAIL_LOCAL_PART_BYTES = 64
5
+ const EMAIL_SCHEMA = z.email()
4
6
  const CRON_PRESENTATION_CONFIG_SCHEMA = z.object({
5
7
  schedule: z.string(),
6
8
  timeZone: z.prefault(z.string(), "UTC"),
@@ -8,6 +10,9 @@ const CRON_PRESENTATION_CONFIG_SCHEMA = z.object({
8
10
  const HTTP_PRESENTATION_CONFIG_SCHEMA = z.object({
9
11
  scope: z.prefault(z.enum(["trigger", "automation", "project"]), "trigger"),
10
12
  })
13
+ const MAILHOOK_PRESENTATION_CONFIG_SCHEMA = z.object({
14
+ scope: z.prefault(z.enum(["trigger", "automation", "project"]), "trigger"),
15
+ })
11
16
  const INVOCATION_PRESENTATION_CONFIG_SCHEMA = z.object({
12
17
  entrypoint: z.string(),
13
18
  })
@@ -123,6 +128,21 @@ export const coreTriggerDefinitions = {
123
128
  name: "HTTP request",
124
129
  type: "http.request",
125
130
  },
131
+ mailhookEmailReceived: {
132
+ getPrimary: ({ automationId, config, hookSlot, projectId, scopePath }) => ({
133
+ copyable: true,
134
+ value: getMailhookAddress({
135
+ automationId,
136
+ hookSlot,
137
+ projectId,
138
+ scope: MAILHOOK_PRESENTATION_CONFIG_SCHEMA.parse(config).scope,
139
+ scopePath,
140
+ }),
141
+ }),
142
+ icon: "webhook",
143
+ name: "Mailhook",
144
+ type: "mailhook.email.received",
145
+ },
126
146
  dashboardRun: {
127
147
  getDetails: ({ config }) => [
128
148
  {
@@ -199,6 +219,9 @@ export interface DashboardRunEndpointOptions {
199
219
  }
200
220
 
201
221
  export type HttpTriggerScope = "trigger" | "automation" | "project"
222
+ export type MailhookScope = HttpTriggerScope
223
+
224
+ export const PLATFORM_EMAIL_DOMAIN = "automations.automate.ax"
202
225
 
203
226
  export interface HttpTriggerEndpointOptions {
204
227
  appOrigin: string
@@ -209,6 +232,15 @@ export interface HttpTriggerEndpointOptions {
209
232
  scopePath?: readonly number[]
210
233
  }
211
234
 
235
+ export interface MailhookAddressOptions {
236
+ automationId: string
237
+ hookSlot: number
238
+ plusPath?: string
239
+ projectId: string
240
+ scope: MailhookScope
241
+ scopePath?: readonly number[]
242
+ }
243
+
212
244
  /**
213
245
  * Returns the public URL for one deployed HTTP trigger.
214
246
  *
@@ -237,6 +269,42 @@ export function getHttpTriggerEndpointKey(
237
269
  ].join(".")}`
238
270
  }
239
271
 
272
+ /**
273
+ * Returns the unique inbound address for one deployed mailhook.
274
+ *
275
+ * Add `+suffix` before the `@` to carry a routing value into the event.
276
+ *
277
+ * @param options - Mailhook identity and sharing scope.
278
+ * @throws When the generated local part exceeds the email size limit.
279
+ */
280
+ export function getMailhookAddress(options: MailhookAddressOptions) {
281
+ const localPart = `${getMailhookAddressKey(options)}${options.plusPath ? `+${options.plusPath}` : ""}`
282
+ if (new TextEncoder().encode(localPart).length > MAX_EMAIL_LOCAL_PART_BYTES) {
283
+ throw new RangeError("Mailhook address local part exceeds 64 bytes.")
284
+ }
285
+
286
+ return EMAIL_SCHEMA.parse(`${localPart}@${PLATFORM_EMAIL_DOMAIN}`)
287
+ }
288
+
289
+ /**
290
+ * Returns the local-part router key for one configured mailhook scope.
291
+ *
292
+ * @param options - Mailhook identity and sharing scope.
293
+ */
294
+ export function getMailhookAddressKey(options: MailhookAddressOptions) {
295
+ if (options.scope === "project") return `p${typeIdSuffix(options.projectId)}`
296
+ if (options.scope === "automation") {
297
+ return `a${typeIdSuffix(options.automationId)}`
298
+ }
299
+
300
+ return `a${typeIdSuffix(options.automationId)}.${[
301
+ ...(options.scopePath ?? []),
302
+ options.hookSlot,
303
+ ]
304
+ .map((segment) => segment.toString(36))
305
+ .join(".")}`
306
+ }
307
+
240
308
  /**
241
309
  * Returns the organization-authenticated submission endpoint for one dashboard
242
310
  * run.
@@ -263,3 +331,12 @@ export function getDashboardRunEndpointKey(
263
331
  options.hookSlot,
264
332
  ].join(".")}`
265
333
  }
334
+
335
+ /**
336
+ * Removes the redundant TypeID prefix from an address router.
337
+ *
338
+ * @param id - Project or automation TypeID.
339
+ */
340
+ function typeIdSuffix(id: string) {
341
+ return id.includes("_") ? id.slice(id.indexOf("_") + 1) : id
342
+ }
@@ -24,12 +24,17 @@ export {
24
24
  getDashboardRunEndpointKey,
25
25
  getHttpTriggerEndpoint,
26
26
  getHttpTriggerEndpointKey,
27
+ getMailhookAddress,
28
+ getMailhookAddressKey,
29
+ PLATFORM_EMAIL_DOMAIN,
27
30
  DASHBOARD_RUN_CONFIG_SCHEMA,
28
31
  type DashboardRunConfig,
29
32
  type DashboardRunEndpointOptions,
30
33
  type DashboardRunField,
31
34
  type HttpTriggerEndpointOptions,
32
35
  type HttpTriggerScope,
36
+ type MailhookAddressOptions,
37
+ type MailhookScope,
33
38
  } from "./core"
34
39
 
35
40
  /** Plain shared definitions for every public trigger type. */