@segmentstream/ontology 0.118.0 → 0.120.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/CHANGELOG.md +21 -0
- package/dist/analyze.d.ts +8 -1
- package/dist/analyze.js +41 -1
- package/dist/diagnostics.d.ts +3 -3
- package/dist/diagnostics.js +1 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +6 -0
- package/dist/manifest.d.ts +180 -112
- package/dist/manifest.js +6 -0
- package/dist/migrate/model.d.ts +116 -84
- package/dist/nitro-workflows.d.ts +29 -0
- package/dist/nitro-workflows.js +92 -5
- package/dist/ontology.d.ts +0 -5
- package/dist/ontology.js +8 -1
- package/dist/server.js +15 -7
- package/dist/service/chat/delivery.js +2 -0
- package/dist/service/errors.js +4 -3
- package/dist/service/schemas.d.ts +8 -0
- package/dist/service/schemas.js +2 -0
- package/dist/service/workflow-deployment.js +6 -0
- package/dist/service/workflows.d.ts +5 -0
- package/dist/service/workflows.js +150 -6
- package/dist/trigger-actions.d.ts +31 -0
- package/dist/trigger-actions.js +108 -0
- package/dist/trigger-run.d.ts +23 -0
- package/dist/trigger-run.js +49 -0
- package/dist/workflow-runtime.d.ts +15 -0
- package/dist/workflow.d.ts +42 -5
- package/dist/workflow.js +11 -0
- package/dist/workflows.d.ts +1 -0
- package/dist/workflows.js +1 -0
- package/package.json +1 -1
package/dist/migrate/model.d.ts
CHANGED
|
@@ -283,6 +283,18 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
283
283
|
readonly currentHash: Schema.optionalKey<Schema.String>;
|
|
284
284
|
readonly target: Schema.declareConstructor<{
|
|
285
285
|
readonly version: number;
|
|
286
|
+
readonly roles: readonly {
|
|
287
|
+
readonly name: string;
|
|
288
|
+
readonly description: string;
|
|
289
|
+
readonly builtIn: boolean;
|
|
290
|
+
readonly scopes?: readonly {
|
|
291
|
+
readonly permission: string;
|
|
292
|
+
readonly where: {
|
|
293
|
+
readonly [x: string]: Schema.Json;
|
|
294
|
+
};
|
|
295
|
+
}[] | undefined;
|
|
296
|
+
readonly permissions?: readonly string[] | undefined;
|
|
297
|
+
}[];
|
|
286
298
|
readonly hash: string;
|
|
287
299
|
readonly entities: readonly {
|
|
288
300
|
readonly id: string;
|
|
@@ -384,18 +396,6 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
384
396
|
readonly unlink?: string | undefined;
|
|
385
397
|
} | undefined;
|
|
386
398
|
}[];
|
|
387
|
-
readonly roles: readonly {
|
|
388
|
-
readonly name: string;
|
|
389
|
-
readonly description: string;
|
|
390
|
-
readonly builtIn: boolean;
|
|
391
|
-
readonly scopes?: readonly {
|
|
392
|
-
readonly permission: string;
|
|
393
|
-
readonly where: {
|
|
394
|
-
readonly [x: string]: Schema.Json;
|
|
395
|
-
};
|
|
396
|
-
}[] | undefined;
|
|
397
|
-
readonly permissions?: readonly string[] | undefined;
|
|
398
|
-
}[];
|
|
399
399
|
readonly chat?: {
|
|
400
400
|
readonly telegram?: {
|
|
401
401
|
readonly connection: string;
|
|
@@ -423,11 +423,11 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
423
423
|
readonly workflows?: readonly {
|
|
424
424
|
readonly name: string;
|
|
425
425
|
readonly description: string;
|
|
426
|
-
readonly role: string;
|
|
427
426
|
readonly input: {
|
|
428
427
|
readonly [x: string]: Schema.Json;
|
|
429
428
|
};
|
|
430
429
|
readonly connections: readonly string[];
|
|
430
|
+
readonly role: string;
|
|
431
431
|
readonly triggers: readonly ({
|
|
432
432
|
readonly kind: "cron";
|
|
433
433
|
readonly name: string;
|
|
@@ -445,6 +445,7 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
445
445
|
readonly name: string;
|
|
446
446
|
readonly description: string;
|
|
447
447
|
readonly connection?: string | undefined;
|
|
448
|
+
readonly headers?: readonly string[] | undefined;
|
|
448
449
|
readonly signature?: {
|
|
449
450
|
readonly scheme: string;
|
|
450
451
|
readonly secret: string;
|
|
@@ -453,10 +454,13 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
453
454
|
readonly scheme: string;
|
|
454
455
|
readonly verifyToken: string;
|
|
455
456
|
} | undefined;
|
|
456
|
-
readonly headers?: readonly string[] | undefined;
|
|
457
457
|
} | {
|
|
458
458
|
readonly [x: string]: Schema.Json;
|
|
459
459
|
})[];
|
|
460
|
+
readonly action?: {
|
|
461
|
+
readonly entity: string;
|
|
462
|
+
readonly action: string;
|
|
463
|
+
} | undefined;
|
|
460
464
|
}[] | undefined;
|
|
461
465
|
readonly metrics?: readonly {
|
|
462
466
|
readonly name: string;
|
|
@@ -596,6 +600,18 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
596
600
|
}[] | undefined;
|
|
597
601
|
} | {
|
|
598
602
|
readonly version: number;
|
|
603
|
+
readonly roles: readonly {
|
|
604
|
+
readonly name: string;
|
|
605
|
+
readonly description: string;
|
|
606
|
+
readonly builtIn: boolean;
|
|
607
|
+
readonly scopes?: readonly {
|
|
608
|
+
readonly permission: string;
|
|
609
|
+
readonly where: {
|
|
610
|
+
readonly [x: string]: Schema.Json;
|
|
611
|
+
};
|
|
612
|
+
}[] | undefined;
|
|
613
|
+
readonly permissions?: readonly string[] | undefined;
|
|
614
|
+
}[];
|
|
599
615
|
readonly hash: string;
|
|
600
616
|
readonly entities: readonly {
|
|
601
617
|
readonly id: string;
|
|
@@ -697,18 +713,6 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
697
713
|
readonly unlink?: string | undefined;
|
|
698
714
|
} | undefined;
|
|
699
715
|
}[];
|
|
700
|
-
readonly roles: readonly {
|
|
701
|
-
readonly name: string;
|
|
702
|
-
readonly description: string;
|
|
703
|
-
readonly builtIn: boolean;
|
|
704
|
-
readonly scopes?: readonly {
|
|
705
|
-
readonly permission: string;
|
|
706
|
-
readonly where: {
|
|
707
|
-
readonly [x: string]: Schema.Json;
|
|
708
|
-
};
|
|
709
|
-
}[] | undefined;
|
|
710
|
-
readonly permissions?: readonly string[] | undefined;
|
|
711
|
-
}[];
|
|
712
716
|
readonly chat?: {
|
|
713
717
|
readonly telegram?: {
|
|
714
718
|
readonly connection: string;
|
|
@@ -736,11 +740,11 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
736
740
|
readonly workflows?: readonly {
|
|
737
741
|
readonly name: string;
|
|
738
742
|
readonly description: string;
|
|
739
|
-
readonly role: string;
|
|
740
743
|
readonly input: {
|
|
741
744
|
readonly [x: string]: Schema.Json;
|
|
742
745
|
};
|
|
743
746
|
readonly connections: readonly string[];
|
|
747
|
+
readonly role: string;
|
|
744
748
|
readonly triggers: readonly ({
|
|
745
749
|
readonly kind: "cron";
|
|
746
750
|
readonly name: string;
|
|
@@ -758,6 +762,7 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
758
762
|
readonly name: string;
|
|
759
763
|
readonly description: string;
|
|
760
764
|
readonly connection?: string | undefined;
|
|
765
|
+
readonly headers?: readonly string[] | undefined;
|
|
761
766
|
readonly signature?: {
|
|
762
767
|
readonly scheme: string;
|
|
763
768
|
readonly secret: string;
|
|
@@ -766,10 +771,13 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
766
771
|
readonly scheme: string;
|
|
767
772
|
readonly verifyToken: string;
|
|
768
773
|
} | undefined;
|
|
769
|
-
readonly headers?: readonly string[] | undefined;
|
|
770
774
|
} | {
|
|
771
775
|
readonly [x: string]: Schema.Json;
|
|
772
776
|
})[];
|
|
777
|
+
readonly action?: {
|
|
778
|
+
readonly entity: string;
|
|
779
|
+
readonly action: string;
|
|
780
|
+
} | undefined;
|
|
773
781
|
}[] | undefined;
|
|
774
782
|
readonly metrics?: readonly {
|
|
775
783
|
readonly name: string;
|
|
@@ -909,6 +917,18 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
909
917
|
}[] | undefined;
|
|
910
918
|
}, {
|
|
911
919
|
readonly version: number;
|
|
920
|
+
readonly roles: readonly {
|
|
921
|
+
readonly name: string;
|
|
922
|
+
readonly description: string;
|
|
923
|
+
readonly built_in: boolean;
|
|
924
|
+
readonly scopes?: readonly {
|
|
925
|
+
readonly permission: string;
|
|
926
|
+
readonly where: {
|
|
927
|
+
readonly [x: string]: Schema.Json;
|
|
928
|
+
};
|
|
929
|
+
}[] | undefined;
|
|
930
|
+
readonly permissions?: readonly string[] | undefined;
|
|
931
|
+
}[];
|
|
912
932
|
readonly hash: string;
|
|
913
933
|
readonly entities: readonly {
|
|
914
934
|
readonly id: string;
|
|
@@ -1010,18 +1030,6 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
1010
1030
|
} | undefined;
|
|
1011
1031
|
readonly renamed_from?: string | undefined;
|
|
1012
1032
|
}[];
|
|
1013
|
-
readonly roles: readonly {
|
|
1014
|
-
readonly name: string;
|
|
1015
|
-
readonly description: string;
|
|
1016
|
-
readonly built_in: boolean;
|
|
1017
|
-
readonly scopes?: readonly {
|
|
1018
|
-
readonly permission: string;
|
|
1019
|
-
readonly where: {
|
|
1020
|
-
readonly [x: string]: Schema.Json;
|
|
1021
|
-
};
|
|
1022
|
-
}[] | undefined;
|
|
1023
|
-
readonly permissions?: readonly string[] | undefined;
|
|
1024
|
-
}[];
|
|
1025
1033
|
readonly chat?: {
|
|
1026
1034
|
readonly telegram?: {
|
|
1027
1035
|
readonly connection: string;
|
|
@@ -1049,11 +1057,11 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
1049
1057
|
readonly workflows?: readonly {
|
|
1050
1058
|
readonly name: string;
|
|
1051
1059
|
readonly description: string;
|
|
1052
|
-
readonly role: string;
|
|
1053
1060
|
readonly input: {
|
|
1054
1061
|
readonly [x: string]: Schema.Json;
|
|
1055
1062
|
};
|
|
1056
1063
|
readonly connections: readonly string[];
|
|
1064
|
+
readonly role: string;
|
|
1057
1065
|
readonly triggers: readonly ({
|
|
1058
1066
|
readonly [x: string]: Schema.Json;
|
|
1059
1067
|
} | {
|
|
@@ -1073,6 +1081,7 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
1073
1081
|
readonly name: string;
|
|
1074
1082
|
readonly description: string;
|
|
1075
1083
|
readonly connection?: string | undefined;
|
|
1084
|
+
readonly headers?: readonly string[] | undefined;
|
|
1076
1085
|
readonly signature?: {
|
|
1077
1086
|
readonly scheme: string;
|
|
1078
1087
|
readonly secret: string;
|
|
@@ -1081,8 +1090,11 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
1081
1090
|
readonly scheme: string;
|
|
1082
1091
|
readonly verifyToken: string;
|
|
1083
1092
|
} | undefined;
|
|
1084
|
-
readonly headers?: readonly string[] | undefined;
|
|
1085
1093
|
})[];
|
|
1094
|
+
readonly action?: {
|
|
1095
|
+
readonly entity: string;
|
|
1096
|
+
readonly action: string;
|
|
1097
|
+
} | undefined;
|
|
1086
1098
|
}[] | undefined;
|
|
1087
1099
|
readonly metrics?: readonly {
|
|
1088
1100
|
readonly name: string;
|
|
@@ -1222,6 +1234,18 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
1222
1234
|
} | undefined;
|
|
1223
1235
|
} | {
|
|
1224
1236
|
readonly version: number;
|
|
1237
|
+
readonly roles: readonly {
|
|
1238
|
+
readonly name: string;
|
|
1239
|
+
readonly description: string;
|
|
1240
|
+
readonly builtIn: boolean;
|
|
1241
|
+
readonly scopes?: readonly {
|
|
1242
|
+
readonly permission: string;
|
|
1243
|
+
readonly where: {
|
|
1244
|
+
readonly [x: string]: Schema.Json;
|
|
1245
|
+
};
|
|
1246
|
+
}[] | undefined;
|
|
1247
|
+
readonly permissions?: readonly string[] | undefined;
|
|
1248
|
+
}[];
|
|
1225
1249
|
readonly hash: string;
|
|
1226
1250
|
readonly entities: readonly {
|
|
1227
1251
|
readonly id: string;
|
|
@@ -1323,18 +1347,6 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
1323
1347
|
readonly unlink?: string | undefined;
|
|
1324
1348
|
} | undefined;
|
|
1325
1349
|
}[];
|
|
1326
|
-
readonly roles: readonly {
|
|
1327
|
-
readonly name: string;
|
|
1328
|
-
readonly description: string;
|
|
1329
|
-
readonly builtIn: boolean;
|
|
1330
|
-
readonly scopes?: readonly {
|
|
1331
|
-
readonly permission: string;
|
|
1332
|
-
readonly where: {
|
|
1333
|
-
readonly [x: string]: Schema.Json;
|
|
1334
|
-
};
|
|
1335
|
-
}[] | undefined;
|
|
1336
|
-
readonly permissions?: readonly string[] | undefined;
|
|
1337
|
-
}[];
|
|
1338
1350
|
readonly chat?: {
|
|
1339
1351
|
readonly telegram?: {
|
|
1340
1352
|
readonly connection: string;
|
|
@@ -1362,11 +1374,11 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
1362
1374
|
readonly workflows?: readonly {
|
|
1363
1375
|
readonly name: string;
|
|
1364
1376
|
readonly description: string;
|
|
1365
|
-
readonly role: string;
|
|
1366
1377
|
readonly input: {
|
|
1367
1378
|
readonly [x: string]: Schema.Json;
|
|
1368
1379
|
};
|
|
1369
1380
|
readonly connections: readonly string[];
|
|
1381
|
+
readonly role: string;
|
|
1370
1382
|
readonly triggers: readonly ({
|
|
1371
1383
|
readonly [x: string]: Schema.Json;
|
|
1372
1384
|
} | {
|
|
@@ -1386,6 +1398,7 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
1386
1398
|
readonly name: string;
|
|
1387
1399
|
readonly description: string;
|
|
1388
1400
|
readonly connection?: string | undefined;
|
|
1401
|
+
readonly headers?: readonly string[] | undefined;
|
|
1389
1402
|
readonly signature?: {
|
|
1390
1403
|
readonly scheme: string;
|
|
1391
1404
|
readonly secret: string;
|
|
@@ -1394,8 +1407,11 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
1394
1407
|
readonly scheme: string;
|
|
1395
1408
|
readonly verifyToken: string;
|
|
1396
1409
|
} | undefined;
|
|
1397
|
-
readonly headers?: readonly string[] | undefined;
|
|
1398
1410
|
})[];
|
|
1411
|
+
readonly action?: {
|
|
1412
|
+
readonly entity: string;
|
|
1413
|
+
readonly action: string;
|
|
1414
|
+
} | undefined;
|
|
1399
1415
|
}[] | undefined;
|
|
1400
1416
|
readonly metrics?: readonly {
|
|
1401
1417
|
readonly name: string;
|
|
@@ -1823,6 +1839,10 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
1823
1839
|
readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
1824
1840
|
readonly connection: Schema.optionalKey<Schema.String>;
|
|
1825
1841
|
}>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>;
|
|
1842
|
+
readonly action: Schema.optionalKey<Schema.Struct<{
|
|
1843
|
+
readonly entity: Schema.String;
|
|
1844
|
+
readonly action: Schema.String;
|
|
1845
|
+
}>>;
|
|
1826
1846
|
}>>>;
|
|
1827
1847
|
readonly toolsets: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
1828
1848
|
readonly name: Schema.String;
|
|
@@ -2132,6 +2152,10 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2132
2152
|
readonly headers: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
2133
2153
|
readonly connection: Schema.optionalKey<Schema.String>;
|
|
2134
2154
|
}>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>;
|
|
2155
|
+
readonly action: Schema.optionalKey<Schema.Struct<{
|
|
2156
|
+
readonly entity: Schema.String;
|
|
2157
|
+
readonly action: Schema.String;
|
|
2158
|
+
}>>;
|
|
2135
2159
|
}>>>;
|
|
2136
2160
|
readonly toolsets: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
2137
2161
|
readonly name: Schema.String;
|
|
@@ -2166,6 +2190,18 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2166
2190
|
}>>>;
|
|
2167
2191
|
}>]>], {
|
|
2168
2192
|
readonly version: number;
|
|
2193
|
+
readonly roles: readonly {
|
|
2194
|
+
readonly name: string;
|
|
2195
|
+
readonly description: string;
|
|
2196
|
+
readonly builtIn: boolean;
|
|
2197
|
+
readonly scopes?: readonly {
|
|
2198
|
+
readonly permission: string;
|
|
2199
|
+
readonly where: {
|
|
2200
|
+
readonly [x: string]: Schema.Json;
|
|
2201
|
+
};
|
|
2202
|
+
}[] | undefined;
|
|
2203
|
+
readonly permissions?: readonly string[] | undefined;
|
|
2204
|
+
}[];
|
|
2169
2205
|
readonly hash: string;
|
|
2170
2206
|
readonly entities: readonly {
|
|
2171
2207
|
readonly id: string;
|
|
@@ -2267,18 +2303,6 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2267
2303
|
readonly unlink?: string | undefined;
|
|
2268
2304
|
} | undefined;
|
|
2269
2305
|
}[];
|
|
2270
|
-
readonly roles: readonly {
|
|
2271
|
-
readonly name: string;
|
|
2272
|
-
readonly description: string;
|
|
2273
|
-
readonly builtIn: boolean;
|
|
2274
|
-
readonly scopes?: readonly {
|
|
2275
|
-
readonly permission: string;
|
|
2276
|
-
readonly where: {
|
|
2277
|
-
readonly [x: string]: Schema.Json;
|
|
2278
|
-
};
|
|
2279
|
-
}[] | undefined;
|
|
2280
|
-
readonly permissions?: readonly string[] | undefined;
|
|
2281
|
-
}[];
|
|
2282
2306
|
readonly chat?: {
|
|
2283
2307
|
readonly telegram?: {
|
|
2284
2308
|
readonly connection: string;
|
|
@@ -2306,11 +2330,11 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2306
2330
|
readonly workflows?: readonly {
|
|
2307
2331
|
readonly name: string;
|
|
2308
2332
|
readonly description: string;
|
|
2309
|
-
readonly role: string;
|
|
2310
2333
|
readonly input: {
|
|
2311
2334
|
readonly [x: string]: Schema.Json;
|
|
2312
2335
|
};
|
|
2313
2336
|
readonly connections: readonly string[];
|
|
2337
|
+
readonly role: string;
|
|
2314
2338
|
readonly triggers: readonly ({
|
|
2315
2339
|
readonly kind: "cron";
|
|
2316
2340
|
readonly name: string;
|
|
@@ -2328,6 +2352,7 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2328
2352
|
readonly name: string;
|
|
2329
2353
|
readonly description: string;
|
|
2330
2354
|
readonly connection?: string | undefined;
|
|
2355
|
+
readonly headers?: readonly string[] | undefined;
|
|
2331
2356
|
readonly signature?: {
|
|
2332
2357
|
readonly scheme: string;
|
|
2333
2358
|
readonly secret: string;
|
|
@@ -2336,10 +2361,13 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2336
2361
|
readonly scheme: string;
|
|
2337
2362
|
readonly verifyToken: string;
|
|
2338
2363
|
} | undefined;
|
|
2339
|
-
readonly headers?: readonly string[] | undefined;
|
|
2340
2364
|
} | {
|
|
2341
2365
|
readonly [x: string]: Schema.Json;
|
|
2342
2366
|
})[];
|
|
2367
|
+
readonly action?: {
|
|
2368
|
+
readonly entity: string;
|
|
2369
|
+
readonly action: string;
|
|
2370
|
+
} | undefined;
|
|
2343
2371
|
}[] | undefined;
|
|
2344
2372
|
readonly metrics?: readonly {
|
|
2345
2373
|
readonly name: string;
|
|
@@ -2479,6 +2507,18 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2479
2507
|
}[] | undefined;
|
|
2480
2508
|
} | {
|
|
2481
2509
|
readonly version: number;
|
|
2510
|
+
readonly roles: readonly {
|
|
2511
|
+
readonly name: string;
|
|
2512
|
+
readonly description: string;
|
|
2513
|
+
readonly builtIn: boolean;
|
|
2514
|
+
readonly scopes?: readonly {
|
|
2515
|
+
readonly permission: string;
|
|
2516
|
+
readonly where: {
|
|
2517
|
+
readonly [x: string]: Schema.Json;
|
|
2518
|
+
};
|
|
2519
|
+
}[] | undefined;
|
|
2520
|
+
readonly permissions?: readonly string[] | undefined;
|
|
2521
|
+
}[];
|
|
2482
2522
|
readonly hash: string;
|
|
2483
2523
|
readonly entities: readonly {
|
|
2484
2524
|
readonly id: string;
|
|
@@ -2580,18 +2620,6 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2580
2620
|
readonly unlink?: string | undefined;
|
|
2581
2621
|
} | undefined;
|
|
2582
2622
|
}[];
|
|
2583
|
-
readonly roles: readonly {
|
|
2584
|
-
readonly name: string;
|
|
2585
|
-
readonly description: string;
|
|
2586
|
-
readonly builtIn: boolean;
|
|
2587
|
-
readonly scopes?: readonly {
|
|
2588
|
-
readonly permission: string;
|
|
2589
|
-
readonly where: {
|
|
2590
|
-
readonly [x: string]: Schema.Json;
|
|
2591
|
-
};
|
|
2592
|
-
}[] | undefined;
|
|
2593
|
-
readonly permissions?: readonly string[] | undefined;
|
|
2594
|
-
}[];
|
|
2595
2623
|
readonly chat?: {
|
|
2596
2624
|
readonly telegram?: {
|
|
2597
2625
|
readonly connection: string;
|
|
@@ -2619,11 +2647,11 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2619
2647
|
readonly workflows?: readonly {
|
|
2620
2648
|
readonly name: string;
|
|
2621
2649
|
readonly description: string;
|
|
2622
|
-
readonly role: string;
|
|
2623
2650
|
readonly input: {
|
|
2624
2651
|
readonly [x: string]: Schema.Json;
|
|
2625
2652
|
};
|
|
2626
2653
|
readonly connections: readonly string[];
|
|
2654
|
+
readonly role: string;
|
|
2627
2655
|
readonly triggers: readonly ({
|
|
2628
2656
|
readonly kind: "cron";
|
|
2629
2657
|
readonly name: string;
|
|
@@ -2641,6 +2669,7 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2641
2669
|
readonly name: string;
|
|
2642
2670
|
readonly description: string;
|
|
2643
2671
|
readonly connection?: string | undefined;
|
|
2672
|
+
readonly headers?: readonly string[] | undefined;
|
|
2644
2673
|
readonly signature?: {
|
|
2645
2674
|
readonly scheme: string;
|
|
2646
2675
|
readonly secret: string;
|
|
@@ -2649,10 +2678,13 @@ export declare const MigrationPlan: Schema.Struct<{
|
|
|
2649
2678
|
readonly scheme: string;
|
|
2650
2679
|
readonly verifyToken: string;
|
|
2651
2680
|
} | undefined;
|
|
2652
|
-
readonly headers?: readonly string[] | undefined;
|
|
2653
2681
|
} | {
|
|
2654
2682
|
readonly [x: string]: Schema.Json;
|
|
2655
2683
|
})[];
|
|
2684
|
+
readonly action?: {
|
|
2685
|
+
readonly entity: string;
|
|
2686
|
+
readonly action: string;
|
|
2687
|
+
} | undefined;
|
|
2656
2688
|
}[] | undefined;
|
|
2657
2689
|
readonly metrics?: readonly {
|
|
2658
2690
|
readonly name: string;
|
|
@@ -23,6 +23,28 @@ export declare function platformWorkflowDir(rootDir: string): string;
|
|
|
23
23
|
/** The platform workflow file the builder writes, and the name of its workflow function. */
|
|
24
24
|
export declare const PLATFORM_WORKFLOW_FILE = "recover-starts.ts";
|
|
25
25
|
export declare const PLATFORM_RECOVERY_WORKFLOW = "recoverStarts";
|
|
26
|
+
/**
|
|
27
|
+
* The deployment's list of the workflows its triggers that run an action are published as, which
|
|
28
|
+
* the platform writes into the ontology's files from the evaluated manifest, as it writes the
|
|
29
|
+
* navigation catalog: `{ "version": 1, "workflows": ["resend_events"] }`. Absent, as in
|
|
30
|
+
* `nitro dev`, the build compiles none.
|
|
31
|
+
*/
|
|
32
|
+
export declare const TRIGGER_ACTIONS_FILE: string;
|
|
33
|
+
/** The run function each trigger action's generated workflow file exports. */
|
|
34
|
+
export declare const TRIGGER_ACTION_WORKFLOW = "triggerAction";
|
|
35
|
+
/** The workflow file the builder writes for a trigger action's workflow. */
|
|
36
|
+
export declare function triggerActionWorkflowFile(name: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* The workflows of the deployment's trigger actions, from the platform's list beside the
|
|
39
|
+
* ontology's sources; none without it. A malformed list fails the build.
|
|
40
|
+
*/
|
|
41
|
+
export declare function readTriggerActions(rootDir: string): Promise<ReadonlyArray<string>>;
|
|
42
|
+
/**
|
|
43
|
+
* A trigger action's workflow, as a workflow file of the workspace's build: one `"use workflow"`
|
|
44
|
+
* function per trigger, so that the Workflow SDK records each trigger's runs under its own
|
|
45
|
+
* workflow, whose body is the SDK's one step.
|
|
46
|
+
*/
|
|
47
|
+
export declare function triggerActionWorkflowSource(name: string, settings?: Pick<PlatformWorkflowsSettings, "imports">): string;
|
|
26
48
|
/** Where the generated platform workflow takes the SDK from; tests point it at the sources. */
|
|
27
49
|
export interface PlatformWorkflowImports {
|
|
28
50
|
/** The module that exports `recoverWorkflowStarts`: the `workflows` entry. */
|
|
@@ -44,6 +66,8 @@ export interface PlatformWorkflowsSettings {
|
|
|
44
66
|
readonly firstSweepMs: number;
|
|
45
67
|
readonly confirmMs: number;
|
|
46
68
|
};
|
|
69
|
+
/** The workflows of the deployment's trigger actions, each compiled from its own file. */
|
|
70
|
+
readonly triggerActions?: ReadonlyArray<string>;
|
|
47
71
|
}
|
|
48
72
|
/**
|
|
49
73
|
* The platform's start recovery workflow, as a workflow file of the workspace's build: its body is
|
|
@@ -59,6 +83,11 @@ export declare function platformPluginSource(input: {
|
|
|
59
83
|
readonly file: string;
|
|
60
84
|
/** The module that exports `registerPlatformWorkflows`: the `server` entry. */
|
|
61
85
|
readonly server?: string;
|
|
86
|
+
/** Each trigger action's workflow and the file its run function is compiled from. */
|
|
87
|
+
readonly triggerActions?: ReadonlyArray<{
|
|
88
|
+
readonly name: string;
|
|
89
|
+
readonly file: string;
|
|
90
|
+
}>;
|
|
62
91
|
}): string;
|
|
63
92
|
/**
|
|
64
93
|
* Bundles a folder's workflows and steps as the ontology service serves them, as the SDK's own
|
package/dist/nitro-workflows.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
1
|
+
import { mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
import { BaseBuilder, createBaseBuilderConfig } from "@workflow/builders";
|
|
@@ -19,6 +19,69 @@ export function platformWorkflowDir(rootDir) {
|
|
|
19
19
|
/** The platform workflow file the builder writes, and the name of its workflow function. */
|
|
20
20
|
export const PLATFORM_WORKFLOW_FILE = "recover-starts.ts";
|
|
21
21
|
export const PLATFORM_RECOVERY_WORKFLOW = "recoverStarts";
|
|
22
|
+
/**
|
|
23
|
+
* The deployment's list of the workflows its triggers that run an action are published as, which
|
|
24
|
+
* the platform writes into the ontology's files from the evaluated manifest, as it writes the
|
|
25
|
+
* navigation catalog: `{ "version": 1, "workflows": ["resend_events"] }`. Absent, as in
|
|
26
|
+
* `nitro dev`, the build compiles none.
|
|
27
|
+
*/
|
|
28
|
+
export const TRIGGER_ACTIONS_FILE = join(".segmentstream", "actions", "targets.json");
|
|
29
|
+
/** The run function each trigger action's generated workflow file exports. */
|
|
30
|
+
export const TRIGGER_ACTION_WORKFLOW = "triggerAction";
|
|
31
|
+
const WIRE_NAME = /^[a-z][a-z0-9_]{0,62}$/;
|
|
32
|
+
/** The workflow file the builder writes for a trigger action's workflow. */
|
|
33
|
+
export function triggerActionWorkflowFile(name) {
|
|
34
|
+
return `trigger-action-${name}.ts`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The workflows of the deployment's trigger actions, from the platform's list beside the
|
|
38
|
+
* ontology's sources; none without it. A malformed list fails the build.
|
|
39
|
+
*/
|
|
40
|
+
export async function readTriggerActions(rootDir) {
|
|
41
|
+
let text;
|
|
42
|
+
try {
|
|
43
|
+
text = await readFile(join(rootDir, TRIGGER_ACTIONS_FILE), "utf8");
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
const parsed = JSON.parse(text);
|
|
52
|
+
const list = typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)
|
|
53
|
+
? parsed
|
|
54
|
+
: undefined;
|
|
55
|
+
if (list?.version !== 1 ||
|
|
56
|
+
!Array.isArray(list.workflows) ||
|
|
57
|
+
!list.workflows.every((name) => typeof name === "string" && WIRE_NAME.test(name)) ||
|
|
58
|
+
new Set(list.workflows).size !== list.workflows.length) {
|
|
59
|
+
throw new Error("trigger_actions_artifact_invalid");
|
|
60
|
+
}
|
|
61
|
+
return list.workflows;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A trigger action's workflow, as a workflow file of the workspace's build: one `"use workflow"`
|
|
65
|
+
* function per trigger, so that the Workflow SDK records each trigger's runs under its own
|
|
66
|
+
* workflow, whose body is the SDK's one step.
|
|
67
|
+
*/
|
|
68
|
+
export function triggerActionWorkflowSource(name, settings = {}) {
|
|
69
|
+
const from = settings.imports?.workflows ?? "@segmentstream/ontology/workflows";
|
|
70
|
+
return [
|
|
71
|
+
"// Written by @segmentstream/ontology's ontologyWorkflows() before every build; not part",
|
|
72
|
+
`// of the workspace's code. The runs of the trigger ${name}, listed in`,
|
|
73
|
+
"// defineOntology({ triggers }): one step runs its action; see the SDK's trigger-run.ts.",
|
|
74
|
+
`import { runTriggerAction } from ${JSON.stringify(from)};`,
|
|
75
|
+
...(settings.imports?.steps ?? []).map((module) => `import ${JSON.stringify(module)};`),
|
|
76
|
+
"",
|
|
77
|
+
`export async function ${TRIGGER_ACTION_WORKFLOW}(input: unknown) {`,
|
|
78
|
+
' "use workflow";',
|
|
79
|
+
"",
|
|
80
|
+
" return runTriggerAction(input);",
|
|
81
|
+
"}",
|
|
82
|
+
"",
|
|
83
|
+
].join("\n");
|
|
84
|
+
}
|
|
22
85
|
/**
|
|
23
86
|
* The platform's start recovery workflow, as a workflow file of the workspace's build: its body is
|
|
24
87
|
* the SDK's, so an SDK upgrade changes what the run does without touching the workspace's code.
|
|
@@ -49,12 +112,19 @@ export function platformWorkflowSource(settings = {}) {
|
|
|
49
112
|
*/
|
|
50
113
|
export function platformPluginSource(input) {
|
|
51
114
|
const server = input.server ?? "@segmentstream/ontology/server";
|
|
115
|
+
const actions = input.triggerActions ?? [];
|
|
52
116
|
return [
|
|
53
117
|
`import { registerPlatformWorkflows } from ${JSON.stringify(server)};`,
|
|
54
118
|
`import { ${PLATFORM_RECOVERY_WORKFLOW} } from ${JSON.stringify(pathToFileURL(input.file).href)};`,
|
|
119
|
+
...actions.map((action, index) => `import { ${TRIGGER_ACTION_WORKFLOW} as triggerAction${index} } from ` +
|
|
120
|
+
`${JSON.stringify(pathToFileURL(action.file).href)};`),
|
|
55
121
|
"",
|
|
56
122
|
"export default function registerOntologyPlatformWorkflows() {",
|
|
57
|
-
|
|
123
|
+
actions.length === 0
|
|
124
|
+
? ` registerPlatformWorkflows({ recoverStarts: ${PLATFORM_RECOVERY_WORKFLOW} });`
|
|
125
|
+
: ` registerPlatformWorkflows({ recoverStarts: ${PLATFORM_RECOVERY_WORKFLOW}, triggerActions: { ${actions
|
|
126
|
+
.map((action, index) => `${JSON.stringify(action.name)}: triggerAction${index}`)
|
|
127
|
+
.join(", ")} } });`,
|
|
58
128
|
"}",
|
|
59
129
|
"",
|
|
60
130
|
].join("\n");
|
|
@@ -99,8 +169,20 @@ export class OntologyWorkflowBuilder extends BaseBuilder {
|
|
|
99
169
|
}
|
|
100
170
|
async build() {
|
|
101
171
|
if (this.#platform !== undefined) {
|
|
102
|
-
|
|
103
|
-
|
|
172
|
+
const platform = this.#platform;
|
|
173
|
+
const actions = platform.triggerActions ?? [];
|
|
174
|
+
const current = new Set(actions.map(triggerActionWorkflowFile));
|
|
175
|
+
await mkdir(platform.dir, { recursive: true });
|
|
176
|
+
await writeFile(join(platform.dir, PLATFORM_WORKFLOW_FILE), platformWorkflowSource(platform));
|
|
177
|
+
// A trigger action removed since the last build leaves no workflow behind.
|
|
178
|
+
for (const file of await readdir(platform.dir)) {
|
|
179
|
+
if (file.startsWith("trigger-action-") && !current.has(file)) {
|
|
180
|
+
await rm(join(platform.dir, file), { force: true });
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
for (const name of actions) {
|
|
184
|
+
await writeFile(join(platform.dir, triggerActionWorkflowFile(name)), triggerActionWorkflowSource(name, platform));
|
|
185
|
+
}
|
|
104
186
|
}
|
|
105
187
|
const inputFiles = await this.getInputFiles();
|
|
106
188
|
const flowFile = join(this.#outDir, "workflows.mjs");
|
|
@@ -250,6 +332,7 @@ export function callbackHandlerSource(input) {
|
|
|
250
332
|
export async function setupOntologyWorkflows(nitro, settings) {
|
|
251
333
|
const outDir = workflowBuildDir(nitro.options.buildDir);
|
|
252
334
|
const platformDir = platformWorkflowDir(nitro.options.rootDir);
|
|
335
|
+
const triggerActions = await readTriggerActions(nitro.options.rootDir);
|
|
253
336
|
const builder = new OntologyWorkflowBuilder({
|
|
254
337
|
workingDir: nitro.options.rootDir,
|
|
255
338
|
...(nitro.options.workspaceDir === undefined
|
|
@@ -260,7 +343,7 @@ export async function setupOntologyWorkflows(nitro, settings) {
|
|
|
260
343
|
namespace: settings.namespace,
|
|
261
344
|
outDir,
|
|
262
345
|
watch: nitro.options.dev,
|
|
263
|
-
platform: { dir: platformDir },
|
|
346
|
+
platform: { dir: platformDir, triggerActions },
|
|
264
347
|
});
|
|
265
348
|
const buildDirPrefix = `${nitro.options.buildDir.replace(/[\\/]+$/, "")}/`;
|
|
266
349
|
nitro.hooks.hook("rollup:before", ((_nitro, config) => {
|
|
@@ -317,6 +400,10 @@ export async function setupOntologyWorkflows(nitro, settings) {
|
|
|
317
400
|
(nitro.options.plugins ??= []).push(platformPlugin);
|
|
318
401
|
nitro.options.virtual[platformPlugin] = platformPluginSource({
|
|
319
402
|
file: join(platformDir, PLATFORM_WORKFLOW_FILE),
|
|
403
|
+
triggerActions: triggerActions.map((name) => ({
|
|
404
|
+
name,
|
|
405
|
+
file: join(platformDir, triggerActionWorkflowFile(name)),
|
|
406
|
+
})),
|
|
320
407
|
});
|
|
321
408
|
nitro.options.plugins.push(structuresPlugin);
|
|
322
409
|
nitro.options.virtual[structuresPlugin] = structuresPluginSource({
|
package/dist/ontology.d.ts
CHANGED
|
@@ -34,11 +34,6 @@ export interface Ontology<Entities extends ReadonlyArray<AnyEntity> = ReadonlyAr
|
|
|
34
34
|
* input of `defineOntology` or its result.
|
|
35
35
|
*/
|
|
36
36
|
export declare function check(input: OntologyConfig | Ontology, options?: AnalyzeOptions): ReadonlyArray<Diagnostic>;
|
|
37
|
-
/**
|
|
38
|
-
* `defineOntology` with analysis options. The SDK uses it to rebuild an ontology from a deployed
|
|
39
|
-
* manifest's roles, whose permissions name entities the rebuilt ontology does not have, and whose
|
|
40
|
-
* `user` table may predate properties this SDK added to the built-in `User`.
|
|
41
|
-
*/
|
|
42
37
|
export declare function buildOntology<const Entities extends ReadonlyArray<AnyEntity>, const Metrics extends ModelMetrics = ModelMetrics>(config: OntologyConfig<Entities, Metrics>, options: AnalyzeOptions): Ontology<Entities, Metrics>;
|
|
43
38
|
/**
|
|
44
39
|
* Resolves and checks the ontology and builds its manifest. Throws {@link InvalidOntology}, carrying
|