@automate.ax/catalog 0.56.0 → 0.57.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 +2 -2
- package/dist/index.js +2 -2
- package/dist/triggers/core.d.ts +3 -3
- package/dist/triggers/core.js +15 -14
- package/dist/triggers/google.d.ts +9 -0
- package/dist/triggers/google.js +9 -0
- package/dist/triggers/index.d.ts +30 -7
- package/dist/triggers/index.js +16 -0
- package/dist/types.d.ts +18 -5
- package/dist/types.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -1
- package/src/triggers/core.ts +23 -14
- package/src/triggers/google.ts +9 -0
- package/src/triggers/index.ts +25 -0
- package/src/types.ts +21 -5
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
|
-
export { defineIntegrationCatalog, defineIntegrationService,
|
|
3
|
-
export { getHttpTriggerEndpoint, getHttpTriggerEndpointKey, getTriggerDefinition, getTriggerName, getTriggerPresentation, triggerCatalog, triggerDefinitions, type HttpTriggerEndpointOptions, type HttpTriggerScope, type TriggerType, } from "./triggers/index.js";
|
|
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 { getHttpTriggerEndpoint, getHttpTriggerEndpointKey, getTriggerDefinition, getTriggerName, getTriggerPresentation, isTriggerVisible, triggerCatalog, triggerDefinitions, type HttpTriggerEndpointOptions, type HttpTriggerScope, 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
|
-
export { defineIntegrationCatalog, defineIntegrationService,
|
|
3
|
-
export { getHttpTriggerEndpoint, getHttpTriggerEndpointKey, getTriggerDefinition, getTriggerName, getTriggerPresentation, triggerCatalog, triggerDefinitions, } from "./triggers/index.js";
|
|
2
|
+
export { defineIntegrationCatalog, defineIntegrationService, integrationScope, } from "./types.js";
|
|
3
|
+
export { getHttpTriggerEndpoint, getHttpTriggerEndpointKey, getTriggerDefinition, getTriggerName, getTriggerPresentation, isTriggerVisible, triggerCatalog, triggerDefinitions, } from "./triggers/index.js";
|
package/dist/triggers/core.d.ts
CHANGED
|
@@ -18,11 +18,10 @@ export declare const coreTriggerDefinitions: {
|
|
|
18
18
|
readonly type: "cron.tick";
|
|
19
19
|
};
|
|
20
20
|
readonly httpRequest: {
|
|
21
|
-
readonly
|
|
21
|
+
readonly getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId, scopePath, }: import("..").TriggerPresentationContext) => {
|
|
22
22
|
copyable: true;
|
|
23
|
-
label: string;
|
|
24
23
|
value: string;
|
|
25
|
-
}
|
|
24
|
+
};
|
|
26
25
|
readonly icon: "webhook";
|
|
27
26
|
readonly name: "HTTP request";
|
|
28
27
|
readonly type: "http.request";
|
|
@@ -35,6 +34,7 @@ export interface HttpTriggerEndpointOptions {
|
|
|
35
34
|
hookSlot: number;
|
|
36
35
|
projectId: string;
|
|
37
36
|
scope: HttpTriggerScope;
|
|
37
|
+
scopePath?: readonly number[];
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* Returns the public URL for one deployed HTTP trigger.
|
package/dist/triggers/core.js
CHANGED
|
@@ -34,19 +34,17 @@ export const coreTriggerDefinitions = {
|
|
|
34
34
|
type: "cron.tick",
|
|
35
35
|
},
|
|
36
36
|
httpRequest: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
],
|
|
37
|
+
getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId, scopePath, }) => ({
|
|
38
|
+
copyable: true,
|
|
39
|
+
value: getHttpTriggerEndpoint({
|
|
40
|
+
appOrigin,
|
|
41
|
+
automationId,
|
|
42
|
+
hookSlot,
|
|
43
|
+
projectId,
|
|
44
|
+
scope: HTTP_PRESENTATION_CONFIG_SCHEMA.parse(config).scope,
|
|
45
|
+
scopePath,
|
|
46
|
+
}),
|
|
47
|
+
}),
|
|
50
48
|
icon: "webhook",
|
|
51
49
|
name: "HTTP request",
|
|
52
50
|
type: "http.request",
|
|
@@ -70,5 +68,8 @@ export function getHttpTriggerEndpointKey(options) {
|
|
|
70
68
|
return options.projectId;
|
|
71
69
|
if (options.scope === "automation")
|
|
72
70
|
return options.automationId;
|
|
73
|
-
return `${options.automationId}:${
|
|
71
|
+
return `${options.automationId}:${[
|
|
72
|
+
...(options.scopePath ?? []),
|
|
73
|
+
options.hookSlot,
|
|
74
|
+
].join(".")}`;
|
|
74
75
|
}
|
|
@@ -9,6 +9,7 @@ export declare const googleTriggerDefinitions: {
|
|
|
9
9
|
}];
|
|
10
10
|
readonly serviceId: "google";
|
|
11
11
|
};
|
|
12
|
+
readonly icon: "gmail";
|
|
12
13
|
readonly type: "gmail.label.added";
|
|
13
14
|
};
|
|
14
15
|
readonly gmailLabelRemoved: {
|
|
@@ -21,6 +22,7 @@ export declare const googleTriggerDefinitions: {
|
|
|
21
22
|
}];
|
|
22
23
|
readonly serviceId: "google";
|
|
23
24
|
};
|
|
25
|
+
readonly icon: "gmail";
|
|
24
26
|
readonly type: "gmail.label.removed";
|
|
25
27
|
};
|
|
26
28
|
readonly gmailMessageReceived: {
|
|
@@ -33,6 +35,7 @@ export declare const googleTriggerDefinitions: {
|
|
|
33
35
|
}];
|
|
34
36
|
readonly serviceId: "google";
|
|
35
37
|
};
|
|
38
|
+
readonly icon: "gmail";
|
|
36
39
|
readonly name: "Gmail email received";
|
|
37
40
|
readonly type: "gmail.message.received";
|
|
38
41
|
};
|
|
@@ -46,6 +49,7 @@ export declare const googleTriggerDefinitions: {
|
|
|
46
49
|
}];
|
|
47
50
|
readonly serviceId: "google";
|
|
48
51
|
};
|
|
52
|
+
readonly icon: "gmail";
|
|
49
53
|
readonly name: "Gmail email sent";
|
|
50
54
|
readonly type: "gmail.message.sent";
|
|
51
55
|
};
|
|
@@ -59,6 +63,7 @@ export declare const googleTriggerDefinitions: {
|
|
|
59
63
|
}];
|
|
60
64
|
readonly serviceId: "google";
|
|
61
65
|
};
|
|
66
|
+
readonly icon: "google-calendar";
|
|
62
67
|
readonly name: "Google Calendar event created";
|
|
63
68
|
readonly type: "googleCalendar.event.created";
|
|
64
69
|
};
|
|
@@ -72,6 +77,7 @@ export declare const googleTriggerDefinitions: {
|
|
|
72
77
|
}];
|
|
73
78
|
readonly serviceId: "google";
|
|
74
79
|
};
|
|
80
|
+
readonly icon: "google-calendar";
|
|
75
81
|
readonly name: "Google Calendar event deleted";
|
|
76
82
|
readonly type: "googleCalendar.event.deleted";
|
|
77
83
|
};
|
|
@@ -85,6 +91,7 @@ export declare const googleTriggerDefinitions: {
|
|
|
85
91
|
}];
|
|
86
92
|
readonly serviceId: "google";
|
|
87
93
|
};
|
|
94
|
+
readonly icon: "google-calendar";
|
|
88
95
|
readonly name: "Google Calendar event updated";
|
|
89
96
|
readonly type: "googleCalendar.event.updated";
|
|
90
97
|
};
|
|
@@ -98,6 +105,7 @@ export declare const googleTriggerDefinitions: {
|
|
|
98
105
|
}];
|
|
99
106
|
readonly serviceId: "google";
|
|
100
107
|
};
|
|
108
|
+
readonly icon: "google-forms";
|
|
101
109
|
readonly name: "Google Form changed";
|
|
102
110
|
readonly type: "googleForms.form.changed";
|
|
103
111
|
};
|
|
@@ -120,6 +128,7 @@ export declare const googleTriggerDefinitions: {
|
|
|
120
128
|
}];
|
|
121
129
|
readonly serviceId: "google";
|
|
122
130
|
};
|
|
131
|
+
readonly icon: "google-forms";
|
|
123
132
|
readonly name: "Google Form response submitted";
|
|
124
133
|
readonly type: "googleForms.response.submitted";
|
|
125
134
|
};
|
package/dist/triggers/google.js
CHANGED
|
@@ -99,44 +99,53 @@ const GOOGLE_FORM_RESPONSES_ACCOUNT = {
|
|
|
99
99
|
export const googleTriggerDefinitions = {
|
|
100
100
|
gmailLabelAdded: {
|
|
101
101
|
account: GMAIL_ACCOUNT,
|
|
102
|
+
icon: "gmail",
|
|
102
103
|
type: "gmail.label.added",
|
|
103
104
|
},
|
|
104
105
|
gmailLabelRemoved: {
|
|
105
106
|
account: GMAIL_ACCOUNT,
|
|
107
|
+
icon: "gmail",
|
|
106
108
|
type: "gmail.label.removed",
|
|
107
109
|
},
|
|
108
110
|
gmailMessageReceived: {
|
|
109
111
|
account: GMAIL_ACCOUNT,
|
|
112
|
+
icon: "gmail",
|
|
110
113
|
name: "Gmail email received",
|
|
111
114
|
type: "gmail.message.received",
|
|
112
115
|
},
|
|
113
116
|
gmailMessageSent: {
|
|
114
117
|
account: GMAIL_ACCOUNT,
|
|
118
|
+
icon: "gmail",
|
|
115
119
|
name: "Gmail email sent",
|
|
116
120
|
type: "gmail.message.sent",
|
|
117
121
|
},
|
|
118
122
|
googleCalendarEventCreated: {
|
|
119
123
|
account: GOOGLE_CALENDAR_ACCOUNT,
|
|
124
|
+
icon: "google-calendar",
|
|
120
125
|
name: "Google Calendar event created",
|
|
121
126
|
type: "googleCalendar.event.created",
|
|
122
127
|
},
|
|
123
128
|
googleCalendarEventDeleted: {
|
|
124
129
|
account: GOOGLE_CALENDAR_ACCOUNT,
|
|
130
|
+
icon: "google-calendar",
|
|
125
131
|
name: "Google Calendar event deleted",
|
|
126
132
|
type: "googleCalendar.event.deleted",
|
|
127
133
|
},
|
|
128
134
|
googleCalendarEventUpdated: {
|
|
129
135
|
account: GOOGLE_CALENDAR_ACCOUNT,
|
|
136
|
+
icon: "google-calendar",
|
|
130
137
|
name: "Google Calendar event updated",
|
|
131
138
|
type: "googleCalendar.event.updated",
|
|
132
139
|
},
|
|
133
140
|
googleFormsFormChanged: {
|
|
134
141
|
account: GOOGLE_FORMS_ACCOUNT,
|
|
142
|
+
icon: "google-forms",
|
|
135
143
|
name: "Google Form changed",
|
|
136
144
|
type: "googleForms.form.changed",
|
|
137
145
|
},
|
|
138
146
|
googleFormsResponseSubmitted: {
|
|
139
147
|
account: GOOGLE_FORM_RESPONSES_ACCOUNT,
|
|
148
|
+
icon: "google-forms",
|
|
140
149
|
name: "Google Form response submitted",
|
|
141
150
|
type: "googleForms.response.submitted",
|
|
142
151
|
},
|
package/dist/triggers/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TriggerDefinition, TriggerPresentation, TriggerPresentationContext } from "../types.js";
|
|
1
|
+
import type { TriggerDefinition, TriggerPresentation, TriggerPresentationContext, TriggerScopePresentation } from "../types.js";
|
|
2
2
|
export { getHttpTriggerEndpoint, getHttpTriggerEndpointKey, type HttpTriggerEndpointOptions, type HttpTriggerScope, } from "./core.js";
|
|
3
3
|
/** Plain shared definitions for every public trigger type. */
|
|
4
4
|
export declare const triggerDefinitions: {
|
|
@@ -699,6 +699,7 @@ export declare const triggerDefinitions: {
|
|
|
699
699
|
}];
|
|
700
700
|
readonly serviceId: "google";
|
|
701
701
|
};
|
|
702
|
+
readonly icon: "gmail";
|
|
702
703
|
readonly type: "gmail.label.added";
|
|
703
704
|
};
|
|
704
705
|
readonly gmailLabelRemoved: {
|
|
@@ -711,6 +712,7 @@ export declare const triggerDefinitions: {
|
|
|
711
712
|
}];
|
|
712
713
|
readonly serviceId: "google";
|
|
713
714
|
};
|
|
715
|
+
readonly icon: "gmail";
|
|
714
716
|
readonly type: "gmail.label.removed";
|
|
715
717
|
};
|
|
716
718
|
readonly gmailMessageReceived: {
|
|
@@ -723,6 +725,7 @@ export declare const triggerDefinitions: {
|
|
|
723
725
|
}];
|
|
724
726
|
readonly serviceId: "google";
|
|
725
727
|
};
|
|
728
|
+
readonly icon: "gmail";
|
|
726
729
|
readonly name: "Gmail email received";
|
|
727
730
|
readonly type: "gmail.message.received";
|
|
728
731
|
};
|
|
@@ -736,6 +739,7 @@ export declare const triggerDefinitions: {
|
|
|
736
739
|
}];
|
|
737
740
|
readonly serviceId: "google";
|
|
738
741
|
};
|
|
742
|
+
readonly icon: "gmail";
|
|
739
743
|
readonly name: "Gmail email sent";
|
|
740
744
|
readonly type: "gmail.message.sent";
|
|
741
745
|
};
|
|
@@ -749,6 +753,7 @@ export declare const triggerDefinitions: {
|
|
|
749
753
|
}];
|
|
750
754
|
readonly serviceId: "google";
|
|
751
755
|
};
|
|
756
|
+
readonly icon: "google-calendar";
|
|
752
757
|
readonly name: "Google Calendar event created";
|
|
753
758
|
readonly type: "googleCalendar.event.created";
|
|
754
759
|
};
|
|
@@ -762,6 +767,7 @@ export declare const triggerDefinitions: {
|
|
|
762
767
|
}];
|
|
763
768
|
readonly serviceId: "google";
|
|
764
769
|
};
|
|
770
|
+
readonly icon: "google-calendar";
|
|
765
771
|
readonly name: "Google Calendar event deleted";
|
|
766
772
|
readonly type: "googleCalendar.event.deleted";
|
|
767
773
|
};
|
|
@@ -775,6 +781,7 @@ export declare const triggerDefinitions: {
|
|
|
775
781
|
}];
|
|
776
782
|
readonly serviceId: "google";
|
|
777
783
|
};
|
|
784
|
+
readonly icon: "google-calendar";
|
|
778
785
|
readonly name: "Google Calendar event updated";
|
|
779
786
|
readonly type: "googleCalendar.event.updated";
|
|
780
787
|
};
|
|
@@ -788,6 +795,7 @@ export declare const triggerDefinitions: {
|
|
|
788
795
|
}];
|
|
789
796
|
readonly serviceId: "google";
|
|
790
797
|
};
|
|
798
|
+
readonly icon: "google-forms";
|
|
791
799
|
readonly name: "Google Form changed";
|
|
792
800
|
readonly type: "googleForms.form.changed";
|
|
793
801
|
};
|
|
@@ -810,6 +818,7 @@ export declare const triggerDefinitions: {
|
|
|
810
818
|
}];
|
|
811
819
|
readonly serviceId: "google";
|
|
812
820
|
};
|
|
821
|
+
readonly icon: "google-forms";
|
|
813
822
|
readonly name: "Google Form response submitted";
|
|
814
823
|
readonly type: "googleForms.response.submitted";
|
|
815
824
|
};
|
|
@@ -1058,11 +1067,10 @@ export declare const triggerDefinitions: {
|
|
|
1058
1067
|
readonly type: "cron.tick";
|
|
1059
1068
|
};
|
|
1060
1069
|
readonly httpRequest: {
|
|
1061
|
-
readonly
|
|
1070
|
+
readonly getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId, scopePath, }: TriggerPresentationContext) => {
|
|
1062
1071
|
copyable: true;
|
|
1063
|
-
label: string;
|
|
1064
1072
|
value: string;
|
|
1065
|
-
}
|
|
1073
|
+
};
|
|
1066
1074
|
readonly icon: "webhook";
|
|
1067
1075
|
readonly name: "HTTP request";
|
|
1068
1076
|
readonly type: "http.request";
|
|
@@ -1541,11 +1549,10 @@ export declare const triggerCatalog: ({
|
|
|
1541
1549
|
type: "cron.tick";
|
|
1542
1550
|
} | {
|
|
1543
1551
|
name: string;
|
|
1544
|
-
|
|
1552
|
+
getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId, scopePath, }: TriggerPresentationContext) => {
|
|
1545
1553
|
copyable: true;
|
|
1546
|
-
label: string;
|
|
1547
1554
|
value: string;
|
|
1548
|
-
}
|
|
1555
|
+
};
|
|
1549
1556
|
icon: "webhook";
|
|
1550
1557
|
type: "http.request";
|
|
1551
1558
|
} | {
|
|
@@ -1784,6 +1791,7 @@ export declare const triggerCatalog: ({
|
|
|
1784
1791
|
}];
|
|
1785
1792
|
readonly serviceId: "google";
|
|
1786
1793
|
};
|
|
1794
|
+
icon: "gmail";
|
|
1787
1795
|
type: "gmail.label.added";
|
|
1788
1796
|
} | {
|
|
1789
1797
|
name: string;
|
|
@@ -1796,6 +1804,7 @@ export declare const triggerCatalog: ({
|
|
|
1796
1804
|
}];
|
|
1797
1805
|
readonly serviceId: "google";
|
|
1798
1806
|
};
|
|
1807
|
+
icon: "gmail";
|
|
1799
1808
|
type: "gmail.label.removed";
|
|
1800
1809
|
} | {
|
|
1801
1810
|
name: string;
|
|
@@ -1808,6 +1817,7 @@ export declare const triggerCatalog: ({
|
|
|
1808
1817
|
}];
|
|
1809
1818
|
readonly serviceId: "google";
|
|
1810
1819
|
};
|
|
1820
|
+
icon: "gmail";
|
|
1811
1821
|
type: "gmail.message.received";
|
|
1812
1822
|
} | {
|
|
1813
1823
|
name: string;
|
|
@@ -1820,6 +1830,7 @@ export declare const triggerCatalog: ({
|
|
|
1820
1830
|
}];
|
|
1821
1831
|
readonly serviceId: "google";
|
|
1822
1832
|
};
|
|
1833
|
+
icon: "gmail";
|
|
1823
1834
|
type: "gmail.message.sent";
|
|
1824
1835
|
} | {
|
|
1825
1836
|
name: string;
|
|
@@ -1832,6 +1843,7 @@ export declare const triggerCatalog: ({
|
|
|
1832
1843
|
}];
|
|
1833
1844
|
readonly serviceId: "google";
|
|
1834
1845
|
};
|
|
1846
|
+
icon: "google-calendar";
|
|
1835
1847
|
type: "googleCalendar.event.created";
|
|
1836
1848
|
} | {
|
|
1837
1849
|
name: string;
|
|
@@ -1844,6 +1856,7 @@ export declare const triggerCatalog: ({
|
|
|
1844
1856
|
}];
|
|
1845
1857
|
readonly serviceId: "google";
|
|
1846
1858
|
};
|
|
1859
|
+
icon: "google-calendar";
|
|
1847
1860
|
type: "googleCalendar.event.deleted";
|
|
1848
1861
|
} | {
|
|
1849
1862
|
name: string;
|
|
@@ -1856,6 +1869,7 @@ export declare const triggerCatalog: ({
|
|
|
1856
1869
|
}];
|
|
1857
1870
|
readonly serviceId: "google";
|
|
1858
1871
|
};
|
|
1872
|
+
icon: "google-calendar";
|
|
1859
1873
|
type: "googleCalendar.event.updated";
|
|
1860
1874
|
} | {
|
|
1861
1875
|
name: string;
|
|
@@ -1868,6 +1882,7 @@ export declare const triggerCatalog: ({
|
|
|
1868
1882
|
}];
|
|
1869
1883
|
readonly serviceId: "google";
|
|
1870
1884
|
};
|
|
1885
|
+
icon: "google-forms";
|
|
1871
1886
|
type: "googleForms.form.changed";
|
|
1872
1887
|
} | {
|
|
1873
1888
|
name: string;
|
|
@@ -1889,6 +1904,7 @@ export declare const triggerCatalog: ({
|
|
|
1889
1904
|
}];
|
|
1890
1905
|
readonly serviceId: "google";
|
|
1891
1906
|
};
|
|
1907
|
+
icon: "google-forms";
|
|
1892
1908
|
type: "googleForms.response.submitted";
|
|
1893
1909
|
} | {
|
|
1894
1910
|
name: string;
|
|
@@ -2596,3 +2612,10 @@ export declare function getTriggerName(type: string): string;
|
|
|
2596
2612
|
export declare function getTriggerPresentation(context: TriggerPresentationContext & {
|
|
2597
2613
|
eventType: string;
|
|
2598
2614
|
}): TriggerPresentation;
|
|
2615
|
+
/**
|
|
2616
|
+
* Returns whether a trigger should be shown outside its enclosing scopes.
|
|
2617
|
+
*
|
|
2618
|
+
* @param scopePath - The trigger's enclosing scope path.
|
|
2619
|
+
* @param scopes - The automation's planned scope presentation.
|
|
2620
|
+
*/
|
|
2621
|
+
export declare function isTriggerVisible(scopePath: readonly number[], scopes: readonly TriggerScopePresentation[]): boolean;
|
package/dist/triggers/index.js
CHANGED
|
@@ -62,12 +62,28 @@ export function getTriggerName(type) {
|
|
|
62
62
|
*/
|
|
63
63
|
export function getTriggerPresentation(context) {
|
|
64
64
|
const definition = getTriggerDefinition(context.eventType);
|
|
65
|
+
const primary = definition?.getPrimary?.(context) ??
|
|
66
|
+
(definition?.account && context.accountLabel
|
|
67
|
+
? { value: context.accountLabel }
|
|
68
|
+
: undefined);
|
|
65
69
|
return {
|
|
66
70
|
details: definition?.getDetails?.(context) ?? [],
|
|
67
71
|
name: definition?.name ?? getTriggerName(context.eventType),
|
|
72
|
+
...(primary ? { primary } : {}),
|
|
68
73
|
type: context.eventType,
|
|
69
74
|
};
|
|
70
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Returns whether a trigger should be shown outside its enclosing scopes.
|
|
78
|
+
*
|
|
79
|
+
* @param scopePath - The trigger's enclosing scope path.
|
|
80
|
+
* @param scopes - The automation's planned scope presentation.
|
|
81
|
+
*/
|
|
82
|
+
export function isTriggerVisible(scopePath, scopes) {
|
|
83
|
+
return !scopes.some((scope) => scope.presentation !== "expanded" &&
|
|
84
|
+
scope.path.length <= scopePath.length &&
|
|
85
|
+
scope.path.every((segment, index) => scopePath[index] === segment));
|
|
86
|
+
}
|
|
71
87
|
/**
|
|
72
88
|
* Infers presentation copy from a trigger's stable event type.
|
|
73
89
|
*
|
package/dist/types.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export interface ScopeRequirementGroup {
|
|
|
50
50
|
type: "and" | "or";
|
|
51
51
|
}
|
|
52
52
|
/** Combinators for declaring recursive integration scope requirements. */
|
|
53
|
-
export declare const
|
|
53
|
+
export declare const integrationScope: {
|
|
54
54
|
/**
|
|
55
55
|
* Requires every scope or nested group.
|
|
56
56
|
*
|
|
@@ -80,8 +80,10 @@ export interface IntegrationAccountRequirement<TServiceId extends string = strin
|
|
|
80
80
|
export interface TriggerDefinition<TType extends string = string, TServiceId extends string = string> {
|
|
81
81
|
account?: IntegrationAccountRequirement<TServiceId>;
|
|
82
82
|
description?: string;
|
|
83
|
-
/** Adds
|
|
83
|
+
/** Adds labeled secondary details to this trigger's presentation. */
|
|
84
84
|
getDetails?(context: TriggerPresentationContext): TriggerPresentationDetail[];
|
|
85
|
+
/** Adds an unlabeled primary value to this trigger's presentation. */
|
|
86
|
+
getPrimary?(context: TriggerPresentationContext): TriggerPresentationValue;
|
|
85
87
|
/**
|
|
86
88
|
* Overrides the connected service icon.
|
|
87
89
|
*
|
|
@@ -99,22 +101,33 @@ export interface TriggerDefinition<TType extends string = string, TServiceId ext
|
|
|
99
101
|
}
|
|
100
102
|
/** Runtime-neutral context used to describe one configured trigger. */
|
|
101
103
|
export interface TriggerPresentationContext {
|
|
104
|
+
accountLabel?: string;
|
|
102
105
|
appOrigin: string;
|
|
103
106
|
automationId: string;
|
|
104
107
|
config: unknown;
|
|
105
108
|
hookSlot: number;
|
|
106
109
|
projectId: string;
|
|
110
|
+
scopePath?: readonly number[];
|
|
107
111
|
}
|
|
108
|
-
/**
|
|
109
|
-
export interface
|
|
112
|
+
/** Presentation metadata for one nested automation scope. */
|
|
113
|
+
export interface TriggerScopePresentation {
|
|
114
|
+
path: readonly number[];
|
|
115
|
+
presentation: "collapsed" | "expanded" | "hidden";
|
|
116
|
+
}
|
|
117
|
+
/** One user-facing value in a configured trigger's presentation. */
|
|
118
|
+
export interface TriggerPresentationValue {
|
|
110
119
|
copyable?: boolean;
|
|
111
|
-
label: string;
|
|
112
120
|
value: string;
|
|
113
121
|
}
|
|
122
|
+
/** One labeled secondary property of a configured trigger. */
|
|
123
|
+
export interface TriggerPresentationDetail extends TriggerPresentationValue {
|
|
124
|
+
label: string;
|
|
125
|
+
}
|
|
114
126
|
/** Client-safe presentation of one configured trigger. */
|
|
115
127
|
export interface TriggerPresentation {
|
|
116
128
|
details: TriggerPresentationDetail[];
|
|
117
129
|
name: string;
|
|
130
|
+
primary?: TriggerPresentationValue;
|
|
118
131
|
type: string;
|
|
119
132
|
}
|
|
120
133
|
/**
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -41,7 +41,7 @@ export {
|
|
|
41
41
|
export {
|
|
42
42
|
defineIntegrationCatalog,
|
|
43
43
|
defineIntegrationService,
|
|
44
|
-
|
|
44
|
+
integrationScope,
|
|
45
45
|
type IntegrationAccountConnectionOption,
|
|
46
46
|
type IntegrationAccountRequirement,
|
|
47
47
|
type IntegrationConnectionDefinition,
|
|
@@ -53,6 +53,8 @@ export {
|
|
|
53
53
|
type TriggerPresentation,
|
|
54
54
|
type TriggerPresentationContext,
|
|
55
55
|
type TriggerPresentationDetail,
|
|
56
|
+
type TriggerScopePresentation,
|
|
57
|
+
type TriggerPresentationValue,
|
|
56
58
|
} from "./types"
|
|
57
59
|
export {
|
|
58
60
|
getHttpTriggerEndpoint,
|
|
@@ -60,6 +62,7 @@ export {
|
|
|
60
62
|
getTriggerDefinition,
|
|
61
63
|
getTriggerName,
|
|
62
64
|
getTriggerPresentation,
|
|
65
|
+
isTriggerVisible,
|
|
63
66
|
triggerCatalog,
|
|
64
67
|
triggerDefinitions,
|
|
65
68
|
type HttpTriggerEndpointOptions,
|
package/src/triggers/core.ts
CHANGED
|
@@ -38,19 +38,24 @@ export const coreTriggerDefinitions = {
|
|
|
38
38
|
type: "cron.tick",
|
|
39
39
|
},
|
|
40
40
|
httpRequest: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
getPrimary: ({
|
|
42
|
+
appOrigin,
|
|
43
|
+
automationId,
|
|
44
|
+
config,
|
|
45
|
+
hookSlot,
|
|
46
|
+
projectId,
|
|
47
|
+
scopePath,
|
|
48
|
+
}) => ({
|
|
49
|
+
copyable: true,
|
|
50
|
+
value: getHttpTriggerEndpoint({
|
|
51
|
+
appOrigin,
|
|
52
|
+
automationId,
|
|
53
|
+
hookSlot,
|
|
54
|
+
projectId,
|
|
55
|
+
scope: HTTP_PRESENTATION_CONFIG_SCHEMA.parse(config).scope,
|
|
56
|
+
scopePath,
|
|
57
|
+
}),
|
|
58
|
+
}),
|
|
54
59
|
icon: "webhook",
|
|
55
60
|
name: "HTTP request",
|
|
56
61
|
type: "http.request",
|
|
@@ -65,6 +70,7 @@ export interface HttpTriggerEndpointOptions {
|
|
|
65
70
|
hookSlot: number
|
|
66
71
|
projectId: string
|
|
67
72
|
scope: HttpTriggerScope
|
|
73
|
+
scopePath?: readonly number[]
|
|
68
74
|
}
|
|
69
75
|
|
|
70
76
|
/**
|
|
@@ -89,5 +95,8 @@ export function getHttpTriggerEndpointKey(
|
|
|
89
95
|
) {
|
|
90
96
|
if (options.scope === "project") return options.projectId
|
|
91
97
|
if (options.scope === "automation") return options.automationId
|
|
92
|
-
return `${options.automationId}:${
|
|
98
|
+
return `${options.automationId}:${[
|
|
99
|
+
...(options.scopePath ?? []),
|
|
100
|
+
options.hookSlot,
|
|
101
|
+
].join(".")}`
|
|
93
102
|
}
|
package/src/triggers/google.ts
CHANGED
|
@@ -105,44 +105,53 @@ const GOOGLE_FORM_RESPONSES_ACCOUNT = {
|
|
|
105
105
|
export const googleTriggerDefinitions = {
|
|
106
106
|
gmailLabelAdded: {
|
|
107
107
|
account: GMAIL_ACCOUNT,
|
|
108
|
+
icon: "gmail",
|
|
108
109
|
type: "gmail.label.added",
|
|
109
110
|
},
|
|
110
111
|
gmailLabelRemoved: {
|
|
111
112
|
account: GMAIL_ACCOUNT,
|
|
113
|
+
icon: "gmail",
|
|
112
114
|
type: "gmail.label.removed",
|
|
113
115
|
},
|
|
114
116
|
gmailMessageReceived: {
|
|
115
117
|
account: GMAIL_ACCOUNT,
|
|
118
|
+
icon: "gmail",
|
|
116
119
|
name: "Gmail email received",
|
|
117
120
|
type: "gmail.message.received",
|
|
118
121
|
},
|
|
119
122
|
gmailMessageSent: {
|
|
120
123
|
account: GMAIL_ACCOUNT,
|
|
124
|
+
icon: "gmail",
|
|
121
125
|
name: "Gmail email sent",
|
|
122
126
|
type: "gmail.message.sent",
|
|
123
127
|
},
|
|
124
128
|
googleCalendarEventCreated: {
|
|
125
129
|
account: GOOGLE_CALENDAR_ACCOUNT,
|
|
130
|
+
icon: "google-calendar",
|
|
126
131
|
name: "Google Calendar event created",
|
|
127
132
|
type: "googleCalendar.event.created",
|
|
128
133
|
},
|
|
129
134
|
googleCalendarEventDeleted: {
|
|
130
135
|
account: GOOGLE_CALENDAR_ACCOUNT,
|
|
136
|
+
icon: "google-calendar",
|
|
131
137
|
name: "Google Calendar event deleted",
|
|
132
138
|
type: "googleCalendar.event.deleted",
|
|
133
139
|
},
|
|
134
140
|
googleCalendarEventUpdated: {
|
|
135
141
|
account: GOOGLE_CALENDAR_ACCOUNT,
|
|
142
|
+
icon: "google-calendar",
|
|
136
143
|
name: "Google Calendar event updated",
|
|
137
144
|
type: "googleCalendar.event.updated",
|
|
138
145
|
},
|
|
139
146
|
googleFormsFormChanged: {
|
|
140
147
|
account: GOOGLE_FORMS_ACCOUNT,
|
|
148
|
+
icon: "google-forms",
|
|
141
149
|
name: "Google Form changed",
|
|
142
150
|
type: "googleForms.form.changed",
|
|
143
151
|
},
|
|
144
152
|
googleFormsResponseSubmitted: {
|
|
145
153
|
account: GOOGLE_FORM_RESPONSES_ACCOUNT,
|
|
154
|
+
icon: "google-forms",
|
|
146
155
|
name: "Google Form response submitted",
|
|
147
156
|
type: "googleForms.response.submitted",
|
|
148
157
|
},
|
package/src/triggers/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
TriggerDefinition,
|
|
17
17
|
TriggerPresentation,
|
|
18
18
|
TriggerPresentationContext,
|
|
19
|
+
TriggerScopePresentation,
|
|
19
20
|
} from "../types"
|
|
20
21
|
|
|
21
22
|
export {
|
|
@@ -87,14 +88,38 @@ export function getTriggerPresentation(
|
|
|
87
88
|
context: TriggerPresentationContext & { eventType: string },
|
|
88
89
|
): TriggerPresentation {
|
|
89
90
|
const definition = getTriggerDefinition(context.eventType)
|
|
91
|
+
const primary =
|
|
92
|
+
definition?.getPrimary?.(context) ??
|
|
93
|
+
(definition?.account && context.accountLabel
|
|
94
|
+
? { value: context.accountLabel }
|
|
95
|
+
: undefined)
|
|
90
96
|
|
|
91
97
|
return {
|
|
92
98
|
details: definition?.getDetails?.(context) ?? [],
|
|
93
99
|
name: definition?.name ?? getTriggerName(context.eventType),
|
|
100
|
+
...(primary ? { primary } : {}),
|
|
94
101
|
type: context.eventType,
|
|
95
102
|
}
|
|
96
103
|
}
|
|
97
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Returns whether a trigger should be shown outside its enclosing scopes.
|
|
107
|
+
*
|
|
108
|
+
* @param scopePath - The trigger's enclosing scope path.
|
|
109
|
+
* @param scopes - The automation's planned scope presentation.
|
|
110
|
+
*/
|
|
111
|
+
export function isTriggerVisible(
|
|
112
|
+
scopePath: readonly number[],
|
|
113
|
+
scopes: readonly TriggerScopePresentation[],
|
|
114
|
+
) {
|
|
115
|
+
return !scopes.some(
|
|
116
|
+
(scope) =>
|
|
117
|
+
scope.presentation !== "expanded" &&
|
|
118
|
+
scope.path.length <= scopePath.length &&
|
|
119
|
+
scope.path.every((segment, index) => scopePath[index] === segment),
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
98
123
|
/**
|
|
99
124
|
* Infers presentation copy from a trigger's stable event type.
|
|
100
125
|
*
|
package/src/types.ts
CHANGED
|
@@ -64,7 +64,7 @@ export interface ScopeRequirementGroup {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/** Combinators for declaring recursive integration scope requirements. */
|
|
67
|
-
export const
|
|
67
|
+
export const integrationScope = {
|
|
68
68
|
/**
|
|
69
69
|
* Requires every scope or nested group.
|
|
70
70
|
*
|
|
@@ -108,9 +108,12 @@ export interface TriggerDefinition<
|
|
|
108
108
|
account?: IntegrationAccountRequirement<TServiceId>
|
|
109
109
|
description?: string
|
|
110
110
|
|
|
111
|
-
/** Adds
|
|
111
|
+
/** Adds labeled secondary details to this trigger's presentation. */
|
|
112
112
|
getDetails?(context: TriggerPresentationContext): TriggerPresentationDetail[]
|
|
113
113
|
|
|
114
|
+
/** Adds an unlabeled primary value to this trigger's presentation. */
|
|
115
|
+
getPrimary?(context: TriggerPresentationContext): TriggerPresentationValue
|
|
116
|
+
|
|
114
117
|
/**
|
|
115
118
|
* Overrides the connected service icon.
|
|
116
119
|
*
|
|
@@ -130,24 +133,37 @@ export interface TriggerDefinition<
|
|
|
130
133
|
|
|
131
134
|
/** Runtime-neutral context used to describe one configured trigger. */
|
|
132
135
|
export interface TriggerPresentationContext {
|
|
136
|
+
accountLabel?: string
|
|
133
137
|
appOrigin: string
|
|
134
138
|
automationId: string
|
|
135
139
|
config: unknown
|
|
136
140
|
hookSlot: number
|
|
137
141
|
projectId: string
|
|
142
|
+
scopePath?: readonly number[]
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** Presentation metadata for one nested automation scope. */
|
|
146
|
+
export interface TriggerScopePresentation {
|
|
147
|
+
path: readonly number[]
|
|
148
|
+
presentation: "collapsed" | "expanded" | "hidden"
|
|
138
149
|
}
|
|
139
150
|
|
|
140
|
-
/** One user-facing
|
|
141
|
-
export interface
|
|
151
|
+
/** One user-facing value in a configured trigger's presentation. */
|
|
152
|
+
export interface TriggerPresentationValue {
|
|
142
153
|
copyable?: boolean
|
|
143
|
-
label: string
|
|
144
154
|
value: string
|
|
145
155
|
}
|
|
146
156
|
|
|
157
|
+
/** One labeled secondary property of a configured trigger. */
|
|
158
|
+
export interface TriggerPresentationDetail extends TriggerPresentationValue {
|
|
159
|
+
label: string
|
|
160
|
+
}
|
|
161
|
+
|
|
147
162
|
/** Client-safe presentation of one configured trigger. */
|
|
148
163
|
export interface TriggerPresentation {
|
|
149
164
|
details: TriggerPresentationDetail[]
|
|
150
165
|
name: string
|
|
166
|
+
primary?: TriggerPresentationValue
|
|
151
167
|
type: string
|
|
152
168
|
}
|
|
153
169
|
|