@automate.ax/catalog 0.74.0 → 0.76.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/authoring.d.ts +1 -0
- package/dist/authoring.js +1 -0
- package/dist/triggers/airtable.js +1 -2
- package/dist/triggers/asana.js +1 -2
- package/dist/triggers/brevo.js +1 -2
- package/dist/triggers/core-dashboard.d.ts +374 -0
- package/dist/triggers/core-dashboard.js +202 -0
- package/dist/triggers/core-http.d.ts +30 -0
- package/dist/triggers/core-http.js +43 -0
- package/dist/triggers/core-invocation.d.ts +9 -0
- package/dist/triggers/core-invocation.js +15 -0
- package/dist/triggers/core-mailhook.d.ts +35 -0
- package/dist/triggers/core-mailhook.js +63 -0
- package/dist/triggers/core-schedule.d.ts +9 -0
- package/dist/triggers/core-schedule.js +17 -0
- package/dist/triggers/core.d.ts +15 -426
- package/dist/triggers/core.js +16 -346
- package/dist/triggers/github.js +4 -5
- package/dist/triggers/google.js +4 -5
- package/dist/triggers/index.d.ts +20 -20
- package/dist/triggers/index.js +2 -1
- package/dist/triggers/linear.js +1 -2
- package/dist/triggers/microsoft.js +3 -4
- package/dist/triggers/name.d.ts +13 -0
- package/dist/triggers/name.js +31 -0
- package/dist/triggers/resend.js +1 -2
- package/dist/triggers/slack.js +3 -4
- package/dist/triggers/trello.js +1 -2
- package/dist/triggers/vercel.js +5 -6
- package/dist/triggers/whatsapp.js +1 -2
- package/package.json +118 -5
- package/src/authoring.ts +8 -0
- package/src/triggers/airtable.ts +1 -2
- package/src/triggers/asana.ts +1 -2
- package/src/triggers/brevo.ts +1 -2
- package/src/triggers/core-dashboard.ts +361 -0
- package/src/triggers/core-http.ts +69 -0
- package/src/triggers/core-invocation.ts +18 -0
- package/src/triggers/core-mailhook.ts +83 -0
- package/src/triggers/core-schedule.ts +21 -0
- package/src/triggers/core.ts +38 -544
- package/src/triggers/github.ts +4 -5
- package/src/triggers/google.ts +4 -5
- package/src/triggers/index.ts +2 -1
- package/src/triggers/linear.ts +1 -2
- package/src/triggers/microsoft.ts +3 -4
- package/src/triggers/name.ts +37 -0
- package/src/triggers/resend.ts +1 -2
- package/src/triggers/slack.ts +3 -4
- package/src/triggers/trello.ts +1 -2
- package/src/triggers/vercel.ts +5 -6
- package/src/triggers/whatsapp.ts +1 -2
package/dist/triggers/core.js
CHANGED
|
@@ -1,348 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
const MAILHOOK_PRESENTATION_CONFIG_SCHEMA = z.object({
|
|
13
|
-
scope: z.prefault(z.enum(["trigger", "automation", "project"]), "trigger"),
|
|
14
|
-
});
|
|
15
|
-
const INVOCATION_PRESENTATION_CONFIG_SCHEMA = z.object({
|
|
16
|
-
entrypoint: z.string(),
|
|
17
|
-
});
|
|
18
|
-
const FIELD_NAME_SCHEMA = z
|
|
19
|
-
.string()
|
|
20
|
-
.check(z.trim(), z.minLength(1), z.maxLength(100));
|
|
21
|
-
const FIELD_LABEL_SCHEMA = z
|
|
22
|
-
.string()
|
|
23
|
-
.check(z.trim(), z.minLength(1), z.maxLength(255));
|
|
24
|
-
const FIELD_DESCRIPTION_SCHEMA = z.string().check(z.maxLength(2_000));
|
|
25
|
-
const FIELD_LENGTH_SCHEMA = z.int().check(z.nonnegative());
|
|
26
|
-
const DASHBOARD_RUN_FIELD_BASE_SCHEMA = {
|
|
27
|
-
description: z.optional(FIELD_DESCRIPTION_SCHEMA),
|
|
28
|
-
label: z.optional(FIELD_LABEL_SCHEMA),
|
|
29
|
-
name: FIELD_NAME_SCHEMA,
|
|
30
|
-
};
|
|
31
|
-
const DASHBOARD_RUN_TEXT_FIELD_SCHEMA = z.object({
|
|
32
|
-
...DASHBOARD_RUN_FIELD_BASE_SCHEMA,
|
|
33
|
-
defaultValue: z.optional(z.string()),
|
|
34
|
-
maxLength: z.optional(FIELD_LENGTH_SCHEMA),
|
|
35
|
-
minLength: z.optional(FIELD_LENGTH_SCHEMA),
|
|
36
|
-
placeholder: z.optional(z.string()),
|
|
37
|
-
required: z.prefault(z.boolean(), true),
|
|
38
|
-
type: z.enum(["email", "phone", "text", "textarea", "url"]),
|
|
39
|
-
});
|
|
40
|
-
const DASHBOARD_RUN_NUMBER_FIELD_SCHEMA = z.object({
|
|
41
|
-
...DASHBOARD_RUN_FIELD_BASE_SCHEMA,
|
|
42
|
-
defaultValue: z.optional(z.number()),
|
|
43
|
-
max: z.optional(z.number()),
|
|
44
|
-
min: z.optional(z.number()),
|
|
45
|
-
placeholder: z.optional(z.string()),
|
|
46
|
-
required: z.prefault(z.boolean(), true),
|
|
47
|
-
step: z.prefault(z.number().check(z.positive()), 1),
|
|
48
|
-
type: z.literal("number"),
|
|
49
|
-
});
|
|
50
|
-
const DASHBOARD_RUN_DATE_FIELD_SCHEMA = z.object({
|
|
51
|
-
...DASHBOARD_RUN_FIELD_BASE_SCHEMA,
|
|
52
|
-
defaultValue: z.optional(z.iso.date()),
|
|
53
|
-
max: z.optional(z.iso.date()),
|
|
54
|
-
min: z.optional(z.iso.date()),
|
|
55
|
-
required: z.prefault(z.boolean(), true),
|
|
56
|
-
step: z.prefault(z.int().check(z.positive()), 1),
|
|
57
|
-
type: z.literal("date"),
|
|
58
|
-
});
|
|
59
|
-
const DASHBOARD_RUN_DATETIME_FIELD_SCHEMA = z.object({
|
|
60
|
-
...DASHBOARD_RUN_FIELD_BASE_SCHEMA,
|
|
61
|
-
defaultValue: z.optional(z.iso.datetime({ local: true })),
|
|
62
|
-
max: z.optional(z.iso.datetime({ local: true })),
|
|
63
|
-
min: z.optional(z.iso.datetime({ local: true })),
|
|
64
|
-
required: z.prefault(z.boolean(), true),
|
|
65
|
-
step: z.prefault(z.number().check(z.positive()), 60),
|
|
66
|
-
type: z.literal("datetime"),
|
|
67
|
-
});
|
|
68
|
-
const DASHBOARD_RUN_CHOICE_FIELD_SCHEMA = {
|
|
69
|
-
...DASHBOARD_RUN_FIELD_BASE_SCHEMA,
|
|
70
|
-
defaultValue: z.optional(FIELD_NAME_SCHEMA),
|
|
71
|
-
options: z
|
|
72
|
-
.array(z.object({
|
|
73
|
-
label: FIELD_LABEL_SCHEMA,
|
|
74
|
-
value: FIELD_NAME_SCHEMA,
|
|
75
|
-
}))
|
|
76
|
-
.check(z.minLength(1)),
|
|
77
|
-
placeholder: z.optional(z.string()),
|
|
78
|
-
required: z.prefault(z.boolean(), true),
|
|
79
|
-
};
|
|
80
|
-
const DASHBOARD_RUN_SELECT_FIELD_SCHEMA = z.object({
|
|
81
|
-
...DASHBOARD_RUN_CHOICE_FIELD_SCHEMA,
|
|
82
|
-
type: z.literal("select"),
|
|
83
|
-
});
|
|
84
|
-
const DASHBOARD_RUN_RADIO_FIELD_SCHEMA = z.object({
|
|
85
|
-
...DASHBOARD_RUN_CHOICE_FIELD_SCHEMA,
|
|
86
|
-
type: z.literal("radio"),
|
|
87
|
-
});
|
|
88
|
-
const DASHBOARD_RUN_MULTI_SELECT_FIELD_SCHEMA = z.object({
|
|
89
|
-
...DASHBOARD_RUN_FIELD_BASE_SCHEMA,
|
|
90
|
-
defaultValue: z.optional(z.array(FIELD_NAME_SCHEMA)),
|
|
91
|
-
options: z
|
|
92
|
-
.array(z.object({
|
|
93
|
-
label: FIELD_LABEL_SCHEMA,
|
|
94
|
-
value: FIELD_NAME_SCHEMA,
|
|
95
|
-
}))
|
|
96
|
-
.check(z.minLength(1)),
|
|
97
|
-
placeholder: z.optional(z.string()),
|
|
98
|
-
required: z.prefault(z.boolean(), true),
|
|
99
|
-
type: z.literal("multi-select"),
|
|
100
|
-
});
|
|
101
|
-
const DASHBOARD_RUN_CHECKBOX_FIELD_SCHEMA = z.object({
|
|
102
|
-
...DASHBOARD_RUN_FIELD_BASE_SCHEMA,
|
|
103
|
-
defaultValue: z.prefault(z.boolean(), false),
|
|
104
|
-
required: z.prefault(z.boolean(), false),
|
|
105
|
-
type: z.literal("checkbox"),
|
|
106
|
-
});
|
|
107
|
-
const DASHBOARD_RUN_FIELD_SCHEMA = z.pipe(z.discriminatedUnion("type", [
|
|
108
|
-
DASHBOARD_RUN_TEXT_FIELD_SCHEMA,
|
|
109
|
-
DASHBOARD_RUN_NUMBER_FIELD_SCHEMA,
|
|
110
|
-
DASHBOARD_RUN_DATE_FIELD_SCHEMA,
|
|
111
|
-
DASHBOARD_RUN_DATETIME_FIELD_SCHEMA,
|
|
112
|
-
DASHBOARD_RUN_SELECT_FIELD_SCHEMA,
|
|
113
|
-
DASHBOARD_RUN_RADIO_FIELD_SCHEMA,
|
|
114
|
-
DASHBOARD_RUN_MULTI_SELECT_FIELD_SCHEMA,
|
|
115
|
-
DASHBOARD_RUN_CHECKBOX_FIELD_SCHEMA,
|
|
116
|
-
]), z.transform((field) => ({
|
|
117
|
-
...field,
|
|
118
|
-
label: field.label ??
|
|
119
|
-
`${sentenceCase(field.name)}${field.type === "checkbox" ? "?" : ""}`,
|
|
120
|
-
})));
|
|
121
|
-
const DASHBOARD_RUN_FIELDS_SCHEMA = z.array(DASHBOARD_RUN_FIELD_SCHEMA).check(z.refine((fields) => new Set(fields.map((field) => field.name)).size === fields.length, "Dashboard run field names must be unique."), z.refine((fields) => fields.every(isDashboardRunFieldDefaultValid), "Dashboard run field defaults must satisfy their field constraints."));
|
|
122
|
-
export const DASHBOARD_RUN_CONFIG_SCHEMA = z.object({
|
|
123
|
-
description: z.optional(FIELD_DESCRIPTION_SCHEMA),
|
|
124
|
-
fields: z.prefault(DASHBOARD_RUN_FIELDS_SCHEMA, []),
|
|
125
|
-
submitLabel: z.prefault(z.string().check(z.trim(), z.minLength(1), z.maxLength(100)), "Run"),
|
|
126
|
-
title: z.string().check(z.trim(), z.minLength(1), z.maxLength(255)),
|
|
127
|
-
});
|
|
1
|
+
import { dashboardRunTriggerDefinition } from "./core-dashboard.js";
|
|
2
|
+
import { httpRequestTriggerDefinition } from "./core-http.js";
|
|
3
|
+
import { automationInvokedTriggerDefinition } from "./core-invocation.js";
|
|
4
|
+
import { mailhookEmailReceivedTriggerDefinition } from "./core-mailhook.js";
|
|
5
|
+
import { cronTickTriggerDefinition } from "./core-schedule.js";
|
|
6
|
+
export { DASHBOARD_RUN_CONFIG_SCHEMA, dashboardRunTriggerDefinition, getDashboardRunEndpoint, getDashboardRunEndpointKey, } from "./core-dashboard.js";
|
|
7
|
+
export { getHttpTriggerEndpoint, getHttpTriggerEndpointKey, httpRequestTriggerDefinition, } from "./core-http.js";
|
|
8
|
+
export { automationInvokedTriggerDefinition } from "./core-invocation.js";
|
|
9
|
+
export { getMailhookAddress, getMailhookAddressKey, mailhookEmailReceivedTriggerDefinition, PLATFORM_EMAIL_DOMAIN, } from "./core-mailhook.js";
|
|
10
|
+
export { cronTickTriggerDefinition } from "./core-schedule.js";
|
|
11
|
+
export { sentenceCase } from "./name.js";
|
|
128
12
|
export const coreTriggerDefinitions = {
|
|
129
|
-
automationInvoked:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
],
|
|
136
|
-
icon: "automation",
|
|
137
|
-
name: "Invocation",
|
|
138
|
-
type: "automation.invoked",
|
|
139
|
-
},
|
|
140
|
-
cronTick: {
|
|
141
|
-
getDetails: ({ config }) => {
|
|
142
|
-
const parsedConfig = CRON_PRESENTATION_CONFIG_SCHEMA.parse(config);
|
|
143
|
-
return [
|
|
144
|
-
{ label: "Schedule", value: parsedConfig.schedule },
|
|
145
|
-
{ label: "Time zone", value: parsedConfig.timeZone },
|
|
146
|
-
];
|
|
147
|
-
},
|
|
148
|
-
icon: "schedule",
|
|
149
|
-
name: "Cron schedule",
|
|
150
|
-
type: "cron.tick",
|
|
151
|
-
},
|
|
152
|
-
httpRequest: {
|
|
153
|
-
getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId, scopePath, }) => ({
|
|
154
|
-
copyable: true,
|
|
155
|
-
value: getHttpTriggerEndpoint({
|
|
156
|
-
appOrigin,
|
|
157
|
-
automationId,
|
|
158
|
-
hookSlot,
|
|
159
|
-
projectId,
|
|
160
|
-
scope: HTTP_PRESENTATION_CONFIG_SCHEMA.parse(config).scope,
|
|
161
|
-
scopePath,
|
|
162
|
-
}),
|
|
163
|
-
}),
|
|
164
|
-
icon: "webhook",
|
|
165
|
-
name: "HTTP request",
|
|
166
|
-
type: "http.request",
|
|
167
|
-
},
|
|
168
|
-
mailhookEmailReceived: {
|
|
169
|
-
getPrimary: ({ automationId, config, hookSlot, projectId, scopePath }) => ({
|
|
170
|
-
copyable: true,
|
|
171
|
-
value: getMailhookAddress({
|
|
172
|
-
automationId,
|
|
173
|
-
hookSlot,
|
|
174
|
-
projectId,
|
|
175
|
-
scope: MAILHOOK_PRESENTATION_CONFIG_SCHEMA.parse(config).scope,
|
|
176
|
-
scopePath,
|
|
177
|
-
}),
|
|
178
|
-
}),
|
|
179
|
-
icon: "webhook",
|
|
180
|
-
name: "Mailhook",
|
|
181
|
-
type: "mailhook.email.received",
|
|
182
|
-
},
|
|
183
|
-
dashboardRun: {
|
|
184
|
-
getDetails: ({ config }) => [
|
|
185
|
-
{
|
|
186
|
-
label: "Run form",
|
|
187
|
-
value: DASHBOARD_RUN_CONFIG_SCHEMA.parse(config).title,
|
|
188
|
-
},
|
|
189
|
-
],
|
|
190
|
-
icon: "automation",
|
|
191
|
-
name: "Dashboard run",
|
|
192
|
-
type: "dashboard.run",
|
|
193
|
-
},
|
|
13
|
+
automationInvoked: automationInvokedTriggerDefinition,
|
|
14
|
+
cronTick: cronTickTriggerDefinition,
|
|
15
|
+
dashboardRun: dashboardRunTriggerDefinition,
|
|
16
|
+
httpRequest: httpRequestTriggerDefinition,
|
|
17
|
+
mailhookEmailReceived: mailhookEmailReceivedTriggerDefinition,
|
|
194
18
|
};
|
|
195
|
-
export const PLATFORM_EMAIL_DOMAIN = "automations.automate.ax";
|
|
196
|
-
/**
|
|
197
|
-
* Returns the public URL for one deployed HTTP trigger.
|
|
198
|
-
*
|
|
199
|
-
* @param options - Public origin and trigger identity.
|
|
200
|
-
*/
|
|
201
|
-
export function getHttpTriggerEndpoint(options) {
|
|
202
|
-
return new URL(`/x/${getHttpTriggerEndpointKey(options)}/`, options.appOrigin).toString();
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Returns the durable endpoint identity for one configured HTTP scope.
|
|
206
|
-
*
|
|
207
|
-
* @param options - Trigger and owning resource identity.
|
|
208
|
-
*/
|
|
209
|
-
export function getHttpTriggerEndpointKey(options) {
|
|
210
|
-
if (options.scope === "project")
|
|
211
|
-
return options.projectId;
|
|
212
|
-
if (options.scope === "automation")
|
|
213
|
-
return options.automationId;
|
|
214
|
-
return `${options.automationId}:${[
|
|
215
|
-
...(options.scopePath ?? []),
|
|
216
|
-
options.hookSlot,
|
|
217
|
-
].join(".")}`;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Returns the unique inbound address for one deployed mailhook.
|
|
221
|
-
*
|
|
222
|
-
* Add `+suffix` before the `@` to carry a routing value into the event.
|
|
223
|
-
*
|
|
224
|
-
* @param options - Mailhook identity and sharing scope.
|
|
225
|
-
* @throws When the generated local part exceeds the email size limit.
|
|
226
|
-
*/
|
|
227
|
-
export function getMailhookAddress(options) {
|
|
228
|
-
const localPart = `${getMailhookAddressKey(options)}${options.plusPath ? `+${options.plusPath}` : ""}`;
|
|
229
|
-
if (new TextEncoder().encode(localPart).length > MAX_EMAIL_LOCAL_PART_BYTES) {
|
|
230
|
-
throw new RangeError("Mailhook address local part exceeds 64 bytes.");
|
|
231
|
-
}
|
|
232
|
-
return EMAIL_SCHEMA.parse(`${localPart}@${PLATFORM_EMAIL_DOMAIN}`);
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Returns the local-part router key for one configured mailhook scope.
|
|
236
|
-
*
|
|
237
|
-
* @param options - Mailhook identity and sharing scope.
|
|
238
|
-
*/
|
|
239
|
-
export function getMailhookAddressKey(options) {
|
|
240
|
-
if (options.scope === "project")
|
|
241
|
-
return `p${typeIdSuffix(options.projectId)}`;
|
|
242
|
-
if (options.scope === "automation") {
|
|
243
|
-
return `a${typeIdSuffix(options.automationId)}`;
|
|
244
|
-
}
|
|
245
|
-
return `a${typeIdSuffix(options.automationId)}.${[
|
|
246
|
-
...(options.scopePath ?? []),
|
|
247
|
-
options.hookSlot,
|
|
248
|
-
]
|
|
249
|
-
.map((segment) => segment.toString(36))
|
|
250
|
-
.join(".")}`;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Returns the organization-authenticated submission endpoint for one dashboard
|
|
254
|
-
* run.
|
|
255
|
-
*
|
|
256
|
-
* @param options - Public origin and trigger identity.
|
|
257
|
-
*/
|
|
258
|
-
export function getDashboardRunEndpoint(options) {
|
|
259
|
-
return new URL(`/api/dashboard-runs/${getDashboardRunEndpointKey(options)}`, options.appOrigin).toString();
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Returns the durable endpoint identity for one dashboard run trigger.
|
|
263
|
-
*
|
|
264
|
-
* @param options - Trigger and owning automation identity.
|
|
265
|
-
*/
|
|
266
|
-
export function getDashboardRunEndpointKey(options) {
|
|
267
|
-
return `${options.automationId}:${[
|
|
268
|
-
...(options.scopePath ?? []),
|
|
269
|
-
options.hookSlot,
|
|
270
|
-
].join(".")}`;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Checks a configured default against the same constraints as submitted data.
|
|
274
|
-
*
|
|
275
|
-
* @param field - Field definition to validate.
|
|
276
|
-
*/
|
|
277
|
-
function isDashboardRunFieldDefaultValid(field) {
|
|
278
|
-
if (field.type === "checkbox" || field.defaultValue === undefined)
|
|
279
|
-
return true;
|
|
280
|
-
if (field.type === "multi-select") {
|
|
281
|
-
if (field.required !== false && field.defaultValue.length === 0)
|
|
282
|
-
return false;
|
|
283
|
-
return field.defaultValue.every((value) => field.options.some((option) => option.value === value));
|
|
284
|
-
}
|
|
285
|
-
if (field.type === "radio" || field.type === "select") {
|
|
286
|
-
return field.options.some((option) => option.value === field.defaultValue);
|
|
287
|
-
}
|
|
288
|
-
if (field.type === "number") {
|
|
289
|
-
return ((field.min === undefined || field.defaultValue >= field.min) &&
|
|
290
|
-
(field.max === undefined || field.defaultValue <= field.max) &&
|
|
291
|
-
!isDashboardRunStepMismatch(field.defaultValue, field.min ?? field.defaultValue, field.step ?? 1));
|
|
292
|
-
}
|
|
293
|
-
if (field.type === "date" || field.type === "datetime") {
|
|
294
|
-
const defaultValue = parseDashboardRunDateValue(field.type, field.defaultValue);
|
|
295
|
-
return ((field.min === undefined ||
|
|
296
|
-
defaultValue >= parseDashboardRunDateValue(field.type, field.min)) &&
|
|
297
|
-
(field.max === undefined ||
|
|
298
|
-
defaultValue <= parseDashboardRunDateValue(field.type, field.max)) &&
|
|
299
|
-
!isDashboardRunStepMismatch(defaultValue, parseDashboardRunDateValue(field.type, field.min ?? field.defaultValue), (field.step ?? (field.type === "date" ? 1 : 60)) *
|
|
300
|
-
(field.type === "date" ? 86_400_000 : 1_000)));
|
|
301
|
-
}
|
|
302
|
-
const defaultValue = field.defaultValue.trim();
|
|
303
|
-
return ((defaultValue.length > 0 || field.required === false) &&
|
|
304
|
-
(field.minLength === undefined || defaultValue.length >= field.minLength) &&
|
|
305
|
-
(field.maxLength === undefined || defaultValue.length <= field.maxLength) &&
|
|
306
|
-
(field.type !== "email" || EMAIL_SCHEMA.safeParse(defaultValue).success) &&
|
|
307
|
-
(field.type !== "url" || URL_SCHEMA.safeParse(defaultValue).success));
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Checks whether a value falls outside an allowed step interval.
|
|
311
|
-
*
|
|
312
|
-
* @param value - Configured default value.
|
|
313
|
-
* @param base - Value from which step intervals begin.
|
|
314
|
-
* @param step - Allowed interval size.
|
|
315
|
-
*/
|
|
316
|
-
function isDashboardRunStepMismatch(value, base, step) {
|
|
317
|
-
const intervals = (value - base) / step;
|
|
318
|
-
return Math.abs(intervals - Math.round(intervals)) > 1e-9;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Converts a validated local date or date-time string to a UTC number.
|
|
322
|
-
*
|
|
323
|
-
* @param type - Temporal field type.
|
|
324
|
-
* @param value - Local ISO value to convert.
|
|
325
|
-
*/
|
|
326
|
-
function parseDashboardRunDateValue(type, value) {
|
|
327
|
-
return Date.parse(type === "date" ? `${value}T00:00:00Z` : `${value}Z`);
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Converts a stable identifier to a sentence-cased display name.
|
|
331
|
-
*
|
|
332
|
-
* @param value - Stable identifier to format.
|
|
333
|
-
*/
|
|
334
|
-
export function sentenceCase(value) {
|
|
335
|
-
const words = value
|
|
336
|
-
.replaceAll(/([a-z\d])([A-Z])/g, "$1 $2")
|
|
337
|
-
.replaceAll(/[._-]+/g, " ")
|
|
338
|
-
.toLowerCase();
|
|
339
|
-
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Removes the redundant TypeID prefix from an address router.
|
|
343
|
-
*
|
|
344
|
-
* @param id - Project or automation TypeID.
|
|
345
|
-
*/
|
|
346
|
-
function typeIdSuffix(id) {
|
|
347
|
-
return id.includes("_") ? id.slice(id.indexOf("_") + 1) : id;
|
|
348
|
-
}
|
package/dist/triggers/github.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { githubService } from "../catalog.js";
|
|
2
1
|
const GITHUB_ISSUES_ACCOUNT = {
|
|
3
2
|
connectionOptions: [
|
|
4
3
|
{
|
|
5
4
|
requiredScopes: ["issues:read"],
|
|
6
5
|
},
|
|
7
6
|
],
|
|
8
|
-
serviceId:
|
|
7
|
+
serviceId: "github",
|
|
9
8
|
};
|
|
10
9
|
const GITHUB_PULL_REQUESTS_ACCOUNT = {
|
|
11
10
|
connectionOptions: [
|
|
@@ -13,7 +12,7 @@ const GITHUB_PULL_REQUESTS_ACCOUNT = {
|
|
|
13
12
|
requiredScopes: ["pull_requests:read"],
|
|
14
13
|
},
|
|
15
14
|
],
|
|
16
|
-
serviceId:
|
|
15
|
+
serviceId: "github",
|
|
17
16
|
};
|
|
18
17
|
const GITHUB_CONTENTS_ACCOUNT = {
|
|
19
18
|
connectionOptions: [
|
|
@@ -21,7 +20,7 @@ const GITHUB_CONTENTS_ACCOUNT = {
|
|
|
21
20
|
requiredScopes: ["contents:read"],
|
|
22
21
|
},
|
|
23
22
|
],
|
|
24
|
-
serviceId:
|
|
23
|
+
serviceId: "github",
|
|
25
24
|
};
|
|
26
25
|
const GITHUB_ACTIONS_ACCOUNT = {
|
|
27
26
|
connectionOptions: [
|
|
@@ -29,7 +28,7 @@ const GITHUB_ACTIONS_ACCOUNT = {
|
|
|
29
28
|
requiredScopes: ["actions:read"],
|
|
30
29
|
},
|
|
31
30
|
],
|
|
32
|
-
serviceId:
|
|
31
|
+
serviceId: "github",
|
|
33
32
|
};
|
|
34
33
|
export const githubTriggerDefinitions = {
|
|
35
34
|
githubIssueClosed: {
|
package/dist/triggers/google.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { googleService } from "../catalog.js";
|
|
2
1
|
const GMAIL_ACCOUNT = {
|
|
3
2
|
connectionOptions: [
|
|
4
3
|
{
|
|
@@ -14,7 +13,7 @@ const GMAIL_ACCOUNT = {
|
|
|
14
13
|
],
|
|
15
14
|
},
|
|
16
15
|
],
|
|
17
|
-
serviceId:
|
|
16
|
+
serviceId: "google",
|
|
18
17
|
};
|
|
19
18
|
const GOOGLE_CALENDAR_ACCOUNT = {
|
|
20
19
|
connectionOptions: [
|
|
@@ -33,7 +32,7 @@ const GOOGLE_CALENDAR_ACCOUNT = {
|
|
|
33
32
|
],
|
|
34
33
|
},
|
|
35
34
|
],
|
|
36
|
-
serviceId:
|
|
35
|
+
serviceId: "google",
|
|
37
36
|
};
|
|
38
37
|
const GOOGLE_FORMS_ACCOUNT = {
|
|
39
38
|
connectionOptions: [
|
|
@@ -52,7 +51,7 @@ const GOOGLE_FORMS_ACCOUNT = {
|
|
|
52
51
|
],
|
|
53
52
|
},
|
|
54
53
|
],
|
|
55
|
-
serviceId:
|
|
54
|
+
serviceId: "google",
|
|
56
55
|
};
|
|
57
56
|
const GOOGLE_FORM_RESPONSES_ACCOUNT = {
|
|
58
57
|
connectionOptions: [
|
|
@@ -94,7 +93,7 @@ const GOOGLE_FORM_RESPONSES_ACCOUNT = {
|
|
|
94
93
|
],
|
|
95
94
|
},
|
|
96
95
|
],
|
|
97
|
-
serviceId:
|
|
96
|
+
serviceId: "google",
|
|
98
97
|
};
|
|
99
98
|
export const googleTriggerDefinitions = {
|
|
100
99
|
gmailLabelAdded: {
|
package/dist/triggers/index.d.ts
CHANGED
|
@@ -1066,6 +1066,15 @@ export declare const triggerDefinitions: {
|
|
|
1066
1066
|
readonly name: "Cron schedule";
|
|
1067
1067
|
readonly type: "cron.tick";
|
|
1068
1068
|
};
|
|
1069
|
+
readonly dashboardRun: {
|
|
1070
|
+
readonly getDetails: ({ config }: TriggerPresentationContext) => {
|
|
1071
|
+
label: string;
|
|
1072
|
+
value: string;
|
|
1073
|
+
}[];
|
|
1074
|
+
readonly icon: "automation";
|
|
1075
|
+
readonly name: "Dashboard run";
|
|
1076
|
+
readonly type: "dashboard.run";
|
|
1077
|
+
};
|
|
1069
1078
|
readonly httpRequest: {
|
|
1070
1079
|
readonly getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId, scopePath, }: TriggerPresentationContext) => {
|
|
1071
1080
|
copyable: true;
|
|
@@ -1084,15 +1093,6 @@ export declare const triggerDefinitions: {
|
|
|
1084
1093
|
readonly name: "Mailhook";
|
|
1085
1094
|
readonly type: "mailhook.email.received";
|
|
1086
1095
|
};
|
|
1087
|
-
readonly dashboardRun: {
|
|
1088
|
-
readonly getDetails: ({ config }: TriggerPresentationContext) => {
|
|
1089
|
-
label: string;
|
|
1090
|
-
value: string;
|
|
1091
|
-
}[];
|
|
1092
|
-
readonly icon: "automation";
|
|
1093
|
-
readonly name: "Dashboard run";
|
|
1094
|
-
readonly type: "dashboard.run";
|
|
1095
|
-
};
|
|
1096
1096
|
readonly brevoTransactionalBlocked: {
|
|
1097
1097
|
readonly account: {
|
|
1098
1098
|
readonly connectionOptions: readonly [{
|
|
@@ -1556,15 +1556,7 @@ export declare const triggerCatalog: ({
|
|
|
1556
1556
|
value: string;
|
|
1557
1557
|
}[];
|
|
1558
1558
|
icon: "automation";
|
|
1559
|
-
type: "
|
|
1560
|
-
} | {
|
|
1561
|
-
name: string;
|
|
1562
|
-
getDetails: ({ config }: TriggerPresentationContext) => {
|
|
1563
|
-
label: string;
|
|
1564
|
-
value: string;
|
|
1565
|
-
}[];
|
|
1566
|
-
icon: "schedule";
|
|
1567
|
-
type: "cron.tick";
|
|
1559
|
+
type: "dashboard.run";
|
|
1568
1560
|
} | {
|
|
1569
1561
|
name: string;
|
|
1570
1562
|
getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId, scopePath, }: TriggerPresentationContext) => {
|
|
@@ -1573,6 +1565,14 @@ export declare const triggerCatalog: ({
|
|
|
1573
1565
|
};
|
|
1574
1566
|
icon: "webhook";
|
|
1575
1567
|
type: "http.request";
|
|
1568
|
+
} | {
|
|
1569
|
+
name: string;
|
|
1570
|
+
getDetails: ({ config }: TriggerPresentationContext) => {
|
|
1571
|
+
label: string;
|
|
1572
|
+
value: string;
|
|
1573
|
+
}[];
|
|
1574
|
+
icon: "automation";
|
|
1575
|
+
type: "automation.invoked";
|
|
1576
1576
|
} | {
|
|
1577
1577
|
name: string;
|
|
1578
1578
|
getPrimary: ({ automationId, config, hookSlot, projectId, scopePath }: TriggerPresentationContext) => {
|
|
@@ -1587,8 +1587,8 @@ export declare const triggerCatalog: ({
|
|
|
1587
1587
|
label: string;
|
|
1588
1588
|
value: string;
|
|
1589
1589
|
}[];
|
|
1590
|
-
icon: "
|
|
1591
|
-
type: "
|
|
1590
|
+
icon: "schedule";
|
|
1591
|
+
type: "cron.tick";
|
|
1592
1592
|
} | {
|
|
1593
1593
|
name: string;
|
|
1594
1594
|
account: {
|
package/dist/triggers/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { airtableTriggerDefinitions } from "./airtable.js";
|
|
2
2
|
import { asanaTriggerDefinitions } from "./asana.js";
|
|
3
3
|
import { brevoTriggerDefinitions } from "./brevo.js";
|
|
4
|
-
import { coreTriggerDefinitions
|
|
4
|
+
import { coreTriggerDefinitions } from "./core.js";
|
|
5
5
|
import { githubTriggerDefinitions } from "./github.js";
|
|
6
6
|
import { googleTriggerDefinitions } from "./google.js";
|
|
7
7
|
import { linearTriggerDefinitions } from "./linear.js";
|
|
@@ -11,6 +11,7 @@ import { slackTriggerDefinitions } from "./slack.js";
|
|
|
11
11
|
import { trelloTriggerDefinitions } from "./trello.js";
|
|
12
12
|
import { vercelTriggerDefinitions } from "./vercel.js";
|
|
13
13
|
import { whatsappTriggerDefinitions } from "./whatsapp.js";
|
|
14
|
+
import { sentenceCase } from "./name.js";
|
|
14
15
|
import { getIntegrationService } from "../catalog.js";
|
|
15
16
|
export { getDashboardRunEndpoint, getDashboardRunEndpointKey, getHttpTriggerEndpoint, getHttpTriggerEndpointKey, getMailhookAddress, getMailhookAddressKey, PLATFORM_EMAIL_DOMAIN, DASHBOARD_RUN_CONFIG_SCHEMA, } from "./core.js";
|
|
16
17
|
/** Plain shared definitions for every public trigger type. */
|
package/dist/triggers/linear.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { linearService } from "../catalog.js";
|
|
2
1
|
const LINEAR_ACCOUNT = {
|
|
3
2
|
connectionOptions: [
|
|
4
3
|
{
|
|
5
4
|
requiredScopes: ["read"],
|
|
6
5
|
},
|
|
7
6
|
],
|
|
8
|
-
serviceId:
|
|
7
|
+
serviceId: "linear",
|
|
9
8
|
};
|
|
10
9
|
export const linearTriggerDefinitions = {
|
|
11
10
|
linearCommentCreated: {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { microsoftService } from "../catalog.js";
|
|
2
1
|
const OUTLOOK_ACCOUNT = {
|
|
3
2
|
connectionOptions: [
|
|
4
3
|
{
|
|
@@ -10,7 +9,7 @@ const OUTLOOK_ACCOUNT = {
|
|
|
10
9
|
],
|
|
11
10
|
},
|
|
12
11
|
],
|
|
13
|
-
serviceId:
|
|
12
|
+
serviceId: "microsoft",
|
|
14
13
|
};
|
|
15
14
|
const TEAMS_CHANNEL_MESSAGE_ACCOUNT = {
|
|
16
15
|
connectionOptions: [
|
|
@@ -27,7 +26,7 @@ const TEAMS_CHANNEL_MESSAGE_ACCOUNT = {
|
|
|
27
26
|
],
|
|
28
27
|
},
|
|
29
28
|
],
|
|
30
|
-
serviceId:
|
|
29
|
+
serviceId: "microsoft",
|
|
31
30
|
};
|
|
32
31
|
const TEAMS_CHAT_MESSAGE_ACCOUNT = {
|
|
33
32
|
connectionOptions: [
|
|
@@ -40,7 +39,7 @@ const TEAMS_CHAT_MESSAGE_ACCOUNT = {
|
|
|
40
39
|
],
|
|
41
40
|
},
|
|
42
41
|
],
|
|
43
|
-
serviceId:
|
|
42
|
+
serviceId: "microsoft",
|
|
44
43
|
};
|
|
45
44
|
export const microsoftTriggerDefinitions = {
|
|
46
45
|
outlookEmailReceived: {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TriggerDefinition } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves a definition's display name without loading the global catalog.
|
|
4
|
+
*
|
|
5
|
+
* @param definition - Trigger definition to name.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getTriggerDefinitionName(definition: TriggerDefinition): string;
|
|
8
|
+
/**
|
|
9
|
+
* Converts a stable identifier to a sentence-cased display name.
|
|
10
|
+
*
|
|
11
|
+
* @param value - Stable identifier to format.
|
|
12
|
+
*/
|
|
13
|
+
export declare function sentenceCase(value: string): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const NAMESPACE_DISPLAY_NAMES = {
|
|
2
|
+
github: "GitHub",
|
|
3
|
+
whatsapp: "WhatsApp",
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Resolves a definition's display name without loading the global catalog.
|
|
7
|
+
*
|
|
8
|
+
* @param definition - Trigger definition to name.
|
|
9
|
+
*/
|
|
10
|
+
export function getTriggerDefinitionName(definition) {
|
|
11
|
+
if (definition.name)
|
|
12
|
+
return definition.name;
|
|
13
|
+
const [namespace = definition.type] = definition.type.split(".");
|
|
14
|
+
const inferredName = sentenceCase(definition.type);
|
|
15
|
+
const namespaceDisplayName = NAMESPACE_DISPLAY_NAMES[namespace];
|
|
16
|
+
return namespaceDisplayName
|
|
17
|
+
? inferredName.replace(sentenceCase(namespace), namespaceDisplayName)
|
|
18
|
+
: inferredName;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Converts a stable identifier to a sentence-cased display name.
|
|
22
|
+
*
|
|
23
|
+
* @param value - Stable identifier to format.
|
|
24
|
+
*/
|
|
25
|
+
export function sentenceCase(value) {
|
|
26
|
+
const words = value
|
|
27
|
+
.replaceAll(/([a-z\d])([A-Z])/g, "$1 $2")
|
|
28
|
+
.replaceAll(/[._-]+/g, " ")
|
|
29
|
+
.toLowerCase();
|
|
30
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
31
|
+
}
|
package/dist/triggers/resend.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { resendService } from "../catalog.js";
|
|
2
1
|
const RESEND_ACCOUNT = {
|
|
3
2
|
connectionOptions: [
|
|
4
3
|
{
|
|
5
4
|
requiredScopes: [],
|
|
6
5
|
},
|
|
7
6
|
],
|
|
8
|
-
serviceId:
|
|
7
|
+
serviceId: "resend",
|
|
9
8
|
};
|
|
10
9
|
export const resendTriggerDefinitions = {
|
|
11
10
|
resendEmailBounced: {
|
package/dist/triggers/slack.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { slackService } from "../catalog.js";
|
|
2
1
|
const SLACK_APP_MENTION_ACCOUNT = {
|
|
3
2
|
connectionOptions: [
|
|
4
3
|
{
|
|
5
4
|
requiredScopes: ["app_mentions:read"],
|
|
6
5
|
},
|
|
7
6
|
],
|
|
8
|
-
serviceId:
|
|
7
|
+
serviceId: "slack",
|
|
9
8
|
};
|
|
10
9
|
const SLACK_MESSAGE_ACCOUNT = {
|
|
11
10
|
connectionOptions: [
|
|
@@ -23,7 +22,7 @@ const SLACK_MESSAGE_ACCOUNT = {
|
|
|
23
22
|
],
|
|
24
23
|
},
|
|
25
24
|
],
|
|
26
|
-
serviceId:
|
|
25
|
+
serviceId: "slack",
|
|
27
26
|
};
|
|
28
27
|
const SLACK_REACTION_ACCOUNT = {
|
|
29
28
|
connectionOptions: [
|
|
@@ -31,7 +30,7 @@ const SLACK_REACTION_ACCOUNT = {
|
|
|
31
30
|
requiredScopes: ["reactions:read"],
|
|
32
31
|
},
|
|
33
32
|
],
|
|
34
|
-
serviceId:
|
|
33
|
+
serviceId: "slack",
|
|
35
34
|
};
|
|
36
35
|
export const slackTriggerDefinitions = {
|
|
37
36
|
slackAppMentioned: {
|
package/dist/triggers/trello.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { trelloService } from "../catalog.js";
|
|
2
1
|
const TRELLO_ACCOUNT = {
|
|
3
2
|
connectionOptions: [
|
|
4
3
|
{
|
|
5
4
|
requiredScopes: [],
|
|
6
5
|
},
|
|
7
6
|
],
|
|
8
|
-
serviceId:
|
|
7
|
+
serviceId: "trello",
|
|
9
8
|
};
|
|
10
9
|
export const trelloTriggerDefinitions = {
|
|
11
10
|
trelloBoardEvent: {
|