terse-types 0.0.31 → 0.0.33
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/ApiRouteBuilder.d.ts +5 -0
- package/dist/ApiRoutes.json +6 -1
- package/dist/Configs.d.ts +102 -1
- package/dist/Configs.js +63 -4
- package/dist/Integrations.d.ts +13 -0
- package/dist/Integrations.js +11 -1
- package/dist/Tools.d.ts +6 -3
- package/dist/Tools.js +16 -2
- package/dist/TriggerPresenters.js +62 -0
- package/dist/Triggers.d.ts +2201 -0
- package/dist/Triggers.js +111 -2
- package/dist/json-schema/terse-types.schema.json +15994 -0
- package/dist/types.d.ts +4612 -56
- package/package.json +1 -1
- package/dist/ACL.d.ts +0 -375
- package/dist/ACL.js +0 -105
- package/dist/ACLPolicy.d.ts +0 -17
- package/dist/ACLPolicy.js +0 -18
- package/dist/getConfigACLRules.d.ts +0 -10
- package/dist/getConfigACLRules.js +0 -313
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
import { ConfigType } from "./Configs.js";
|
|
2
|
-
import { IntegrationType } from "./Integrations.js";
|
|
3
|
-
function assertNever(value) {
|
|
4
|
-
throw new Error(`Unhandled config type: ${JSON.stringify(value)}`);
|
|
5
|
-
}
|
|
6
|
-
// Slack
|
|
7
|
-
function getSlackOutputConfigACLRules(config) {
|
|
8
|
-
const rules = [];
|
|
9
|
-
if (config.channelId) {
|
|
10
|
-
rules.push({
|
|
11
|
-
integrationType: IntegrationType.SLACK,
|
|
12
|
-
integrationId: config.integrationId,
|
|
13
|
-
resourceType: "channel",
|
|
14
|
-
resourceId: config.channelId
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
for (const userId of config.userIds ?? []) {
|
|
18
|
-
rules.push({
|
|
19
|
-
integrationType: IntegrationType.SLACK,
|
|
20
|
-
integrationId: config.integrationId,
|
|
21
|
-
resourceType: "dm_user",
|
|
22
|
-
resourceId: userId
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return rules;
|
|
26
|
-
}
|
|
27
|
-
function getSlackInputConfigACLRules(config) {
|
|
28
|
-
const rules = [];
|
|
29
|
-
if (config.channelId) {
|
|
30
|
-
rules.push({
|
|
31
|
-
integrationType: IntegrationType.SLACK,
|
|
32
|
-
integrationId: config.integrationId,
|
|
33
|
-
resourceType: "channel",
|
|
34
|
-
resourceId: config.channelId
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
for (const userId of config.userIds ?? []) {
|
|
38
|
-
rules.push({
|
|
39
|
-
integrationType: IntegrationType.SLACK,
|
|
40
|
-
integrationId: config.integrationId,
|
|
41
|
-
resourceType: "dm_user",
|
|
42
|
-
resourceId: userId
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return rules;
|
|
46
|
-
}
|
|
47
|
-
// Notion
|
|
48
|
-
function getNotionConfigACLRules(config) {
|
|
49
|
-
return [
|
|
50
|
-
...(config.pageIds ?? []).map((pageId) => ({
|
|
51
|
-
integrationType: IntegrationType.NOTION,
|
|
52
|
-
integrationId: config.integrationId,
|
|
53
|
-
resourceType: "page",
|
|
54
|
-
resourceId: pageId
|
|
55
|
-
})),
|
|
56
|
-
...(config.databaseIds ?? []).map((databaseId) => ({
|
|
57
|
-
integrationType: IntegrationType.NOTION,
|
|
58
|
-
integrationId: config.integrationId,
|
|
59
|
-
resourceType: "database",
|
|
60
|
-
resourceId: databaseId
|
|
61
|
-
}))
|
|
62
|
-
];
|
|
63
|
-
}
|
|
64
|
-
// Gmail
|
|
65
|
-
function getGmailOutputConfigACLRules(config) {
|
|
66
|
-
return [
|
|
67
|
-
{
|
|
68
|
-
integrationType: IntegrationType.GMAIL,
|
|
69
|
-
integrationId: config.integrationId,
|
|
70
|
-
resourceType: "send",
|
|
71
|
-
resourceId: "send"
|
|
72
|
-
}
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
function getGmailDraftOutputConfigACLRules(config) {
|
|
76
|
-
return [
|
|
77
|
-
{
|
|
78
|
-
integrationType: IntegrationType.GMAIL,
|
|
79
|
-
integrationId: config.integrationId,
|
|
80
|
-
resourceType: "draft",
|
|
81
|
-
resourceId: "draft"
|
|
82
|
-
}
|
|
83
|
-
];
|
|
84
|
-
}
|
|
85
|
-
// Terse built-in capabilities
|
|
86
|
-
function getWebConfigACLRules(config) {
|
|
87
|
-
return [
|
|
88
|
-
{
|
|
89
|
-
integrationType: IntegrationType.TERSE,
|
|
90
|
-
integrationId: config.integrationId,
|
|
91
|
-
resourceType: "web_capability",
|
|
92
|
-
resourceId: "system"
|
|
93
|
-
}
|
|
94
|
-
];
|
|
95
|
-
}
|
|
96
|
-
function getImageEditConfigACLRules(config) {
|
|
97
|
-
return [
|
|
98
|
-
{
|
|
99
|
-
integrationType: IntegrationType.TERSE,
|
|
100
|
-
integrationId: config.integrationId,
|
|
101
|
-
resourceType: "image_edit_capability",
|
|
102
|
-
resourceId: "system"
|
|
103
|
-
}
|
|
104
|
-
];
|
|
105
|
-
}
|
|
106
|
-
// Linear
|
|
107
|
-
function getLinearInputConfigACLRules(config) {
|
|
108
|
-
const rules = [
|
|
109
|
-
{
|
|
110
|
-
integrationType: IntegrationType.LINEAR,
|
|
111
|
-
integrationId: config.integrationId,
|
|
112
|
-
resourceType: "integration",
|
|
113
|
-
resourceId: config.integrationId
|
|
114
|
-
}
|
|
115
|
-
];
|
|
116
|
-
if (config.teamId) {
|
|
117
|
-
rules.push({
|
|
118
|
-
integrationType: IntegrationType.LINEAR,
|
|
119
|
-
integrationId: config.integrationId,
|
|
120
|
-
resourceType: "team",
|
|
121
|
-
resourceId: config.teamId
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
if (config.projectId) {
|
|
125
|
-
rules.push({
|
|
126
|
-
integrationType: IntegrationType.LINEAR,
|
|
127
|
-
integrationId: config.integrationId,
|
|
128
|
-
resourceType: "project",
|
|
129
|
-
resourceId: config.projectId
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
return rules;
|
|
133
|
-
}
|
|
134
|
-
function getLinearOutputConfigACLRules(config) {
|
|
135
|
-
const rules = [
|
|
136
|
-
{
|
|
137
|
-
integrationType: IntegrationType.LINEAR,
|
|
138
|
-
integrationId: config.integrationId,
|
|
139
|
-
resourceType: "integration",
|
|
140
|
-
resourceId: config.integrationId
|
|
141
|
-
}
|
|
142
|
-
];
|
|
143
|
-
if (config.teamId) {
|
|
144
|
-
rules.push({
|
|
145
|
-
integrationType: IntegrationType.LINEAR,
|
|
146
|
-
integrationId: config.integrationId,
|
|
147
|
-
resourceType: "team",
|
|
148
|
-
resourceId: config.teamId
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
if (config.projectId) {
|
|
152
|
-
rules.push({
|
|
153
|
-
integrationType: IntegrationType.LINEAR,
|
|
154
|
-
integrationId: config.integrationId,
|
|
155
|
-
resourceType: "project",
|
|
156
|
-
resourceId: config.projectId
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
return rules;
|
|
160
|
-
}
|
|
161
|
-
// PostHog
|
|
162
|
-
function getPosthogConfigACLRules(config) {
|
|
163
|
-
return [
|
|
164
|
-
{
|
|
165
|
-
integrationType: IntegrationType.POSTHOG,
|
|
166
|
-
integrationId: config.integrationId,
|
|
167
|
-
resourceType: "project",
|
|
168
|
-
resourceId: config.projectId
|
|
169
|
-
}
|
|
170
|
-
];
|
|
171
|
-
}
|
|
172
|
-
// Datadog
|
|
173
|
-
function getDatadogConfigACLRules(config) {
|
|
174
|
-
const rules = [
|
|
175
|
-
{
|
|
176
|
-
integrationType: IntegrationType.DATADOG,
|
|
177
|
-
integrationId: config.integrationId,
|
|
178
|
-
resourceType: "integration",
|
|
179
|
-
resourceId: config.integrationId
|
|
180
|
-
}
|
|
181
|
-
];
|
|
182
|
-
for (const indexName of config.defaultIndexes ?? []) {
|
|
183
|
-
rules.push({
|
|
184
|
-
integrationType: IntegrationType.DATADOG,
|
|
185
|
-
integrationId: config.integrationId,
|
|
186
|
-
resourceType: "index",
|
|
187
|
-
resourceId: indexName
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
return rules;
|
|
191
|
-
}
|
|
192
|
-
// LaunchDarkly
|
|
193
|
-
function getLaunchDarklyConfigACLRules(config) {
|
|
194
|
-
const rules = [
|
|
195
|
-
{
|
|
196
|
-
integrationType: IntegrationType.LAUNCHDARKLY,
|
|
197
|
-
integrationId: config.integrationId,
|
|
198
|
-
resourceType: "project",
|
|
199
|
-
resourceId: config.projectKey
|
|
200
|
-
}
|
|
201
|
-
];
|
|
202
|
-
for (const envKey of config.environmentKeys) {
|
|
203
|
-
rules.push({
|
|
204
|
-
integrationType: IntegrationType.LAUNCHDARKLY,
|
|
205
|
-
integrationId: config.integrationId,
|
|
206
|
-
resourceType: "environment",
|
|
207
|
-
resourceId: `${config.projectKey}:${envKey}`
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
return rules;
|
|
211
|
-
}
|
|
212
|
-
// WorkOS
|
|
213
|
-
function getWorkOSInputConfigACLRules(config) {
|
|
214
|
-
return [
|
|
215
|
-
{
|
|
216
|
-
integrationType: IntegrationType.WORKOS,
|
|
217
|
-
integrationId: config.integrationId,
|
|
218
|
-
resourceType: "integration",
|
|
219
|
-
resourceId: config.integrationId
|
|
220
|
-
}
|
|
221
|
-
];
|
|
222
|
-
}
|
|
223
|
-
function getWorkOSOutputConfigACLRules(config) {
|
|
224
|
-
return [
|
|
225
|
-
{
|
|
226
|
-
integrationType: IntegrationType.WORKOS,
|
|
227
|
-
integrationId: config.integrationId,
|
|
228
|
-
resourceType: "integration",
|
|
229
|
-
resourceId: config.integrationId
|
|
230
|
-
}
|
|
231
|
-
];
|
|
232
|
-
}
|
|
233
|
-
// Attio
|
|
234
|
-
function getAttioOutputConfigACLRules(config) {
|
|
235
|
-
const rules = [
|
|
236
|
-
{
|
|
237
|
-
integrationType: IntegrationType.ATTIO,
|
|
238
|
-
integrationId: config.integrationId,
|
|
239
|
-
resourceType: "integration",
|
|
240
|
-
resourceId: config.integrationId
|
|
241
|
-
}
|
|
242
|
-
];
|
|
243
|
-
if (config.objectSlug) {
|
|
244
|
-
rules.push({
|
|
245
|
-
integrationType: IntegrationType.ATTIO,
|
|
246
|
-
integrationId: config.integrationId,
|
|
247
|
-
resourceType: "object",
|
|
248
|
-
resourceId: config.objectSlug
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
return rules;
|
|
252
|
-
}
|
|
253
|
-
// Snowflake
|
|
254
|
-
function getSnowflakeOutputConfigACLRules(config) {
|
|
255
|
-
return [
|
|
256
|
-
{
|
|
257
|
-
integrationType: IntegrationType.SNOWFLAKE,
|
|
258
|
-
integrationId: config.integrationId,
|
|
259
|
-
resourceType: "integration",
|
|
260
|
-
resourceId: config.integrationId
|
|
261
|
-
}
|
|
262
|
-
];
|
|
263
|
-
}
|
|
264
|
-
export function getConfigACLRules(config) {
|
|
265
|
-
switch (config.configType) {
|
|
266
|
-
// Input/trigger-only configs do not grant model-selected output tool ACL.
|
|
267
|
-
case ConfigType.GMAIL:
|
|
268
|
-
case ConfigType.TIME_TRIGGER:
|
|
269
|
-
case ConfigType.WEBHOOK_INPUT:
|
|
270
|
-
case ConfigType.WEBMONITOR:
|
|
271
|
-
return [];
|
|
272
|
-
case ConfigType.SLACK:
|
|
273
|
-
return getSlackInputConfigACLRules(config);
|
|
274
|
-
case ConfigType.SLACK_OUTPUT:
|
|
275
|
-
return getSlackOutputConfigACLRules(config);
|
|
276
|
-
case ConfigType.NOTION:
|
|
277
|
-
return getNotionConfigACLRules(config);
|
|
278
|
-
case ConfigType.LINEAR_INPUT:
|
|
279
|
-
return getLinearInputConfigACLRules(config);
|
|
280
|
-
case ConfigType.LINEAR_OUTPUT:
|
|
281
|
-
return getLinearOutputConfigACLRules(config);
|
|
282
|
-
case ConfigType.GITHUB:
|
|
283
|
-
// GitHub repository IDs require backend hydration to owner/repo names.
|
|
284
|
-
return [];
|
|
285
|
-
case ConfigType.GMAIL_OUTPUT:
|
|
286
|
-
return getGmailOutputConfigACLRules(config);
|
|
287
|
-
case ConfigType.GMAIL_DRAFT_OUTPUT:
|
|
288
|
-
return getGmailDraftOutputConfigACLRules(config);
|
|
289
|
-
case ConfigType.POSTHOG:
|
|
290
|
-
return getPosthogConfigACLRules(config);
|
|
291
|
-
case ConfigType.DATADOG:
|
|
292
|
-
return getDatadogConfigACLRules(config);
|
|
293
|
-
case ConfigType.LAUNCHDARKLY:
|
|
294
|
-
return getLaunchDarklyConfigACLRules(config);
|
|
295
|
-
case ConfigType.WEB:
|
|
296
|
-
return getWebConfigACLRules(config);
|
|
297
|
-
case ConfigType.IMAGE_EDIT:
|
|
298
|
-
return getImageEditConfigACLRules(config);
|
|
299
|
-
case ConfigType.WORKOS_INPUT:
|
|
300
|
-
return getWorkOSInputConfigACLRules(config);
|
|
301
|
-
case ConfigType.WORKOS_OUTPUT:
|
|
302
|
-
return getWorkOSOutputConfigACLRules(config);
|
|
303
|
-
case ConfigType.ATTIO_OUTPUT:
|
|
304
|
-
return getAttioOutputConfigACLRules(config);
|
|
305
|
-
case ConfigType.SNOWFLAKE_OUTPUT:
|
|
306
|
-
return getSnowflakeOutputConfigACLRules(config);
|
|
307
|
-
default:
|
|
308
|
-
return assertNever(config);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
export function getMergedACLRules(configs) {
|
|
312
|
-
return configs.flatMap(getConfigACLRules);
|
|
313
|
-
}
|