@turbofy-ai/app-runtime 0.0.7 → 0.0.9

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/src/dsl.d.ts CHANGED
@@ -557,6 +557,16 @@ export interface TableOpts {
557
557
  createdAt?: string;
558
558
  updatedAt?: string;
559
559
  };
560
+ /**
561
+ * Type overrides for the auto-generated default fields. Older schemas store
562
+ * e.g. `createdAt: DateTime` or `id: String`; decompiled sources carry the
563
+ * stored types here so the round trip is lossless.
564
+ */
565
+ defaultFieldTypes?: {
566
+ id?: FieldTypeEnum | `${FieldTypeEnum}`;
567
+ createdAt?: FieldTypeEnum | `${FieldTypeEnum}`;
568
+ updatedAt?: FieldTypeEnum | `${FieldTypeEnum}`;
569
+ };
560
570
  }
561
571
  /**
562
572
  * Internal table definition type preserving field definitions.
@@ -785,6 +795,898 @@ export interface IPageMetaDictionary {
785
795
  "twitter:url"?: string;
786
796
  [key: string]: LocalizationValue | undefined;
787
797
  }
798
+ export interface IBatchCreateTypeParams {
799
+ ofType: string;
800
+ namespace: string;
801
+ input: {
802
+ id: string;
803
+ fields?: {
804
+ [k: string]: unknown;
805
+ };
806
+ directives?: string[];
807
+ connections?: {
808
+ first?: {
809
+ with: string;
810
+ link: string;
811
+ };
812
+ second?: {
813
+ with: string;
814
+ link: string;
815
+ };
816
+ };
817
+ }[];
818
+ dynamicArgs?: {
819
+ [k: string]: unknown;
820
+ };
821
+ }
822
+ export interface IBatchCreateTypeResult {
823
+ [k: string]: {
824
+ id: string;
825
+ createdAt: string;
826
+ updatedAt: string;
827
+ ofType: string;
828
+ fields: {
829
+ [k: string]: unknown;
830
+ };
831
+ namespace: string;
832
+ directives: string[];
833
+ };
834
+ }
835
+ export interface IBatchGetTypeParams {
836
+ ids: string[];
837
+ ofType: string;
838
+ namespace?: string;
839
+ dynamicArgs?: {
840
+ [k: string]: unknown;
841
+ };
842
+ }
843
+ export interface IBatchGetTypeResult {
844
+ [k: string]: {
845
+ id: string;
846
+ createdAt: string;
847
+ updatedAt: string;
848
+ ofType: string;
849
+ fields: {
850
+ [k: string]: unknown;
851
+ };
852
+ namespace: string;
853
+ directives: string[];
854
+ };
855
+ }
856
+ export interface ICreateTypeParams {
857
+ id?: string;
858
+ ofType: string;
859
+ fields?: {
860
+ [k: string]: unknown;
861
+ };
862
+ namespace?: string;
863
+ directives?: string[];
864
+ connections?: {
865
+ [k: string]: unknown;
866
+ };
867
+ dynamicArgs?: {
868
+ [k: string]: unknown;
869
+ };
870
+ }
871
+ export interface ICreateTypeResult {
872
+ id: string;
873
+ createdAt: string;
874
+ updatedAt: string;
875
+ ofType: string;
876
+ fields: {
877
+ [k: string]: unknown;
878
+ };
879
+ namespace: string;
880
+ directives: string[];
881
+ connections?: {
882
+ [k: string]: unknown;
883
+ };
884
+ }
885
+ export interface IDeleteTypeParams {
886
+ id: string;
887
+ ofType: string;
888
+ namespace?: string;
889
+ dynamicArgs?: {
890
+ [k: string]: unknown;
891
+ };
892
+ }
893
+ export interface IDeleteTypeResult {
894
+ id: string;
895
+ createdAt: string;
896
+ updatedAt: string;
897
+ fields: {
898
+ [k: string]: unknown;
899
+ };
900
+ }
901
+ export interface IElevenLabsTTSParams {
902
+ text: string;
903
+ model?: string;
904
+ stream?: boolean;
905
+ outputFormat?: string;
906
+ voiceId?: string;
907
+ apiKey?: string;
908
+ similarityBoost?: number;
909
+ stability?: number;
910
+ style?: number;
911
+ }
912
+ export type IElevenLabsTTSResult = {
913
+ type: "error";
914
+ value?: string;
915
+ } | {
916
+ type: "success";
917
+ url: string;
918
+ key: string;
919
+ mimeType: string;
920
+ durationSeconds: number;
921
+ characterStartTimes: {
922
+ c: string;
923
+ s: number;
924
+ }[];
925
+ } | {
926
+ type: "stream";
927
+ data: string;
928
+ characterStartTimes: {
929
+ c: string;
930
+ s: number;
931
+ }[];
932
+ index: number;
933
+ };
934
+ export interface IGoogleSearchParams {
935
+ searchTerms: string;
936
+ searchEngineId?: string;
937
+ lang?: "lang_ar" | "lang_bg" | "lang_ca" | "lang_cs" | "lang_da" | "lang_de" | "lang_el" | "lang_en" | "lang_es" | "lang_et" | "lang_fi" | "lang_fr" | "lang_hr" | "lang_hu" | "lang_id" | "lang_is" | "lang_it" | "lang_iw" | "lang_ja" | "lang_ko" | "lang_lt" | "lang_lv" | "lang_nl" | "lang_no" | "lang_pl" | "lang_pt" | "lang_ro" | "lang_ru" | "lang_sk" | "lang_sl" | "lang_sr" | "lang_sv" | "lang_tr" | "lang_zh-CN" | "lang_zh-TW";
938
+ apiKey?: string;
939
+ numOfResults?: number;
940
+ searchType?: "image";
941
+ siteSearch?: string;
942
+ siteSearchFilter?: "exclude" | "include";
943
+ dateRestrict?: string;
944
+ }
945
+ export type IGoogleSearchResult = {
946
+ title: string;
947
+ link: string;
948
+ snippet: string;
949
+ metatags?: {
950
+ [k: string]: string;
951
+ }[];
952
+ }[] | {
953
+ title?: string;
954
+ link?: string;
955
+ snippet?: string;
956
+ mime?: string;
957
+ image?: {
958
+ contextLink: string;
959
+ height?: number;
960
+ width?: number;
961
+ byteSize?: number;
962
+ thumbnailLink?: string;
963
+ thumbnailHeight?: number;
964
+ thumbnailWidth?: number;
965
+ };
966
+ }[];
967
+ export interface IHtmlToPdfParams {
968
+ htmlString: string;
969
+ outputFilename?: string;
970
+ format?: "letter" | "legal" | "tabloid" | "ledger" | "a0" | "a1" | "a2" | "a3" | "a4" | "a5" | "a6";
971
+ margin?: {
972
+ top?: string;
973
+ right?: string;
974
+ bottom?: string;
975
+ left?: string;
976
+ };
977
+ }
978
+ export type IHtmlToPdfResult = {
979
+ type: "error";
980
+ value?: string;
981
+ } | {
982
+ type: "success";
983
+ url: string;
984
+ key: string;
985
+ mimeType: string;
986
+ };
987
+ export type IHttpRequestParams = {
988
+ httpMethod: "GET" | "DELETE";
989
+ url: string;
990
+ parameters?: {
991
+ [k: string]: string;
992
+ };
993
+ headers?: {
994
+ [k: string]: string;
995
+ };
996
+ contentMediaType?: "application/json" | "text/plain" | "application/xml" | "application/x-www-form-urlencoded" | "multipart/form-data";
997
+ } | {
998
+ httpMethod: "POST" | "PUT" | "PATCH";
999
+ url: string;
1000
+ parameters?: {
1001
+ [k: string]: string;
1002
+ };
1003
+ headers?: {
1004
+ [k: string]: string;
1005
+ };
1006
+ contentMediaType?: "application/json" | "text/plain" | "application/xml" | "application/x-www-form-urlencoded" | "multipart/form-data";
1007
+ body: string;
1008
+ };
1009
+ export type IHttpRequestResult = {
1010
+ type: "success";
1011
+ status?: number;
1012
+ headers?: {
1013
+ [k: string]: string;
1014
+ };
1015
+ body?: string | {
1016
+ [k: string]: unknown;
1017
+ } | unknown[];
1018
+ statusText?: string;
1019
+ } | {
1020
+ type: "error";
1021
+ content: string;
1022
+ };
1023
+ export interface ILogicParams {
1024
+ [k: string]: unknown;
1025
+ }
1026
+ export interface ILogicResult {
1027
+ [k: string]: unknown;
1028
+ }
1029
+ export interface ILinkScraperParams {
1030
+ websiteUrl: string;
1031
+ selectors?: string;
1032
+ resultType?: "text" | "html";
1033
+ numOfResults?: number;
1034
+ }
1035
+ export interface ILinkScraperResult {
1036
+ [k: string]: string[];
1037
+ }
1038
+ export interface IListTypeByParentParams {
1039
+ ofType: string;
1040
+ parentType: string;
1041
+ limit?: number;
1042
+ nextToken?: string | null;
1043
+ parentId: string;
1044
+ parentKey: "SECOND" | "FIRST";
1045
+ sortOrder?: "ASC" | "DESC";
1046
+ namespace?: string;
1047
+ dynamicArgs?: {
1048
+ [k: string]: unknown;
1049
+ };
1050
+ }
1051
+ export interface IListTypeByParentResult {
1052
+ nextToken: string | null;
1053
+ items: {
1054
+ id: string;
1055
+ createdAt: string;
1056
+ updatedAt: string;
1057
+ ofType: string;
1058
+ fields: {
1059
+ [k: string]: unknown;
1060
+ };
1061
+ namespace: string;
1062
+ directives: string[];
1063
+ }[];
1064
+ }
1065
+ export interface IListTypeParams {
1066
+ ofType: string;
1067
+ limit?: number;
1068
+ nextToken?: string;
1069
+ sortOrder?: "ASC" | "DESC";
1070
+ namespace?: string;
1071
+ dynamicArgs?: {
1072
+ [k: string]: unknown;
1073
+ };
1074
+ }
1075
+ export interface IListTypeResult {
1076
+ nextToken: string | null;
1077
+ items: {
1078
+ id: string;
1079
+ createdAt: string;
1080
+ updatedAt: string;
1081
+ ofType: string;
1082
+ fields: {
1083
+ [k: string]: unknown;
1084
+ };
1085
+ namespace: string;
1086
+ directives: string[];
1087
+ }[];
1088
+ }
1089
+ export interface INotifyWebSocketParams {
1090
+ record?: {
1091
+ id?: string;
1092
+ ofType?: string;
1093
+ namespace?: string;
1094
+ connections?: {
1095
+ first?: {
1096
+ with: string;
1097
+ link: string;
1098
+ };
1099
+ second?: {
1100
+ with: string;
1101
+ link: string;
1102
+ };
1103
+ };
1104
+ };
1105
+ operation?: "INSERT" | "UPDATE" | "DELETE";
1106
+ }
1107
+ export interface INotifyWebSocketResult {
1108
+ [k: string]: unknown;
1109
+ }
1110
+ export type IOpenAIImageGenerationParams = {
1111
+ model: "dall-e-3";
1112
+ prompt: string;
1113
+ quality?: "standard" | "hd";
1114
+ size?: "1024x1024" | "1792x1024" | "1024x1792";
1115
+ style?: "vivid" | "natural";
1116
+ outputFilename?: string;
1117
+ apiKey?: string;
1118
+ } | {
1119
+ model: "dall-e-2";
1120
+ prompt: string;
1121
+ size?: "256x256" | "512x512" | "1024x1024";
1122
+ n?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
1123
+ outputFilename?: string;
1124
+ apiKey?: string;
1125
+ };
1126
+ export type IOpenAIImageGenerationResult = {
1127
+ type: "result";
1128
+ url: string;
1129
+ key: string;
1130
+ mimeType: string;
1131
+ } | {
1132
+ type: "error";
1133
+ value: string;
1134
+ };
1135
+ export interface ITypeParams {
1136
+ id: string;
1137
+ ofType: string;
1138
+ namespace?: string;
1139
+ dynamicArgs?: {
1140
+ [k: string]: unknown;
1141
+ };
1142
+ }
1143
+ export interface ITypeResult {
1144
+ id: string;
1145
+ createdAt: string;
1146
+ updatedAt: string;
1147
+ ofType: string;
1148
+ fields: {
1149
+ [k: string]: unknown;
1150
+ };
1151
+ namespace: string;
1152
+ directives: string[];
1153
+ }
1154
+ export interface IUpdateTypeParams {
1155
+ id: string;
1156
+ ofType: string;
1157
+ fields?: {
1158
+ [k: string]: unknown;
1159
+ };
1160
+ connections?: {
1161
+ [k: string]: unknown;
1162
+ };
1163
+ namespace?: string;
1164
+ directives?: string[];
1165
+ dynamicArgs?: {
1166
+ [k: string]: unknown;
1167
+ };
1168
+ }
1169
+ export interface IUpdateTypeResult {
1170
+ id: string;
1171
+ createdAt: string;
1172
+ updatedAt: string;
1173
+ ofType: string;
1174
+ fields: {
1175
+ [k: string]: unknown;
1176
+ };
1177
+ namespace: string;
1178
+ }
1179
+ export interface IExtractImageMetadataParams {
1180
+ url?: string;
1181
+ }
1182
+ export interface IExtractImageMetadataResult {
1183
+ "Bits Per Sample"?: string;
1184
+ "Image Height": string;
1185
+ "Image Width": string;
1186
+ "Color Components": string;
1187
+ Subsampling?: string;
1188
+ "JFIF Version"?: string;
1189
+ "Resolution Unit"?: string;
1190
+ XResolution?: string;
1191
+ YResolution?: string;
1192
+ "JFIF Thumbnail Width"?: string;
1193
+ "JFIF Thumbnail Height"?: string;
1194
+ ImageDescription?: string;
1195
+ ResolutionUnit?: string;
1196
+ YCbCrPositioning?: string;
1197
+ "Exif IFD Pointer"?: number;
1198
+ XPTitle?: string;
1199
+ XPKeywords?: string;
1200
+ XPSubject?: string;
1201
+ ExifVersion?: string;
1202
+ ComponentsConfiguration?: string;
1203
+ UserComment?: string;
1204
+ FlashpixVersion?: string;
1205
+ ColorSpace?: string;
1206
+ "Model Version"?: string;
1207
+ "Coded Character Set"?: string;
1208
+ "Object Name"?: string;
1209
+ Keywords?: string[];
1210
+ "Country/Primary Location Name"?: string;
1211
+ Headline?: string;
1212
+ Credit?: string;
1213
+ Source?: string;
1214
+ "Caption/Abstract"?: string;
1215
+ "Record Version"?: string;
1216
+ about?: string;
1217
+ LastKeywordXMP?: string;
1218
+ description?: string;
1219
+ subject?: string;
1220
+ title?: string;
1221
+ creditLine?: string;
1222
+ BitsPerSample?: string;
1223
+ ImageLength?: string;
1224
+ ImageWidth?: string;
1225
+ YCbCrSubSampling?: string;
1226
+ FileType: string;
1227
+ }
1228
+ export interface ICloudFunctionParams {
1229
+ cloudFunctionUrl: string;
1230
+ [k: string]: unknown;
1231
+ }
1232
+ export type ICloudFunctionResult = {
1233
+ type: "success";
1234
+ status?: number;
1235
+ headers?: {
1236
+ [k: string]: string;
1237
+ };
1238
+ body?: string | {
1239
+ [k: string]: unknown;
1240
+ } | unknown[];
1241
+ statusText?: string;
1242
+ } | {
1243
+ type: "error";
1244
+ content: string;
1245
+ };
1246
+ export type IGenericAIParams = {
1247
+ operation: "generateObject";
1248
+ apiKey: string;
1249
+ temperature?: number;
1250
+ model: {
1251
+ provider: "openai";
1252
+ model: string;
1253
+ } | {
1254
+ provider: "anthropic";
1255
+ model: string;
1256
+ } | {
1257
+ provider: "mistral";
1258
+ model: string;
1259
+ } | {
1260
+ provider: "cohere";
1261
+ model: string;
1262
+ } | {
1263
+ provider: "google";
1264
+ model: string;
1265
+ };
1266
+ prompt: string;
1267
+ /**
1268
+ * jsOnly
1269
+ */
1270
+ schema: {
1271
+ [k: string]: unknown;
1272
+ };
1273
+ providerOptions?: {
1274
+ [k: string]: unknown;
1275
+ };
1276
+ } | {
1277
+ operation: "generateText";
1278
+ apiKey: string;
1279
+ temperature?: number;
1280
+ model: {
1281
+ provider: "openai";
1282
+ model: string;
1283
+ } | {
1284
+ provider: "anthropic";
1285
+ model: string;
1286
+ } | {
1287
+ provider: "mistral";
1288
+ model: string;
1289
+ } | {
1290
+ provider: "cohere";
1291
+ model: string;
1292
+ } | {
1293
+ provider: "google";
1294
+ model: string;
1295
+ };
1296
+ /**
1297
+ * jsOnly
1298
+ */
1299
+ messages?: ({
1300
+ role: "system";
1301
+ content: string;
1302
+ providerOptions?: {
1303
+ [k: string]: unknown;
1304
+ };
1305
+ } | {
1306
+ role: "user";
1307
+ content: string | ({
1308
+ type: "text";
1309
+ text: string;
1310
+ providerOptions?: {
1311
+ [k: string]: unknown;
1312
+ };
1313
+ } | {
1314
+ type: "image";
1315
+ imageUrl: string;
1316
+ mimeType?: string;
1317
+ providerOptions?: {
1318
+ [k: string]: unknown;
1319
+ };
1320
+ } | {
1321
+ type: "file";
1322
+ fileUrl: string;
1323
+ filename?: string;
1324
+ mimeType: string;
1325
+ providerOptions?: {
1326
+ [k: string]: unknown;
1327
+ };
1328
+ })[];
1329
+ providerOptions?: {
1330
+ [k: string]: unknown;
1331
+ };
1332
+ } | {
1333
+ role: "assistant";
1334
+ content: string | ({
1335
+ type: "text";
1336
+ text: string;
1337
+ providerOptions?: {
1338
+ [k: string]: unknown;
1339
+ };
1340
+ } | {
1341
+ type: "tool-call";
1342
+ toolCallId: string;
1343
+ toolName: string;
1344
+ args: unknown;
1345
+ providerOptions?: {
1346
+ [k: string]: unknown;
1347
+ };
1348
+ })[];
1349
+ providerOptions?: {
1350
+ [k: string]: unknown;
1351
+ };
1352
+ } | {
1353
+ role: "tool";
1354
+ content: {
1355
+ type: "tool-result";
1356
+ toolCallId: string;
1357
+ toolName: string;
1358
+ result: unknown;
1359
+ }[];
1360
+ })[];
1361
+ system?: string;
1362
+ prompt?: string;
1363
+ /**
1364
+ * jsOnly
1365
+ */
1366
+ tools: {
1367
+ [k: string]: {
1368
+ description?: string;
1369
+ parameters: unknown;
1370
+ type: "function";
1371
+ } | {
1372
+ type: "provider-defined";
1373
+ parameters: unknown;
1374
+ id: string;
1375
+ args: {
1376
+ [k: string]: unknown;
1377
+ };
1378
+ };
1379
+ };
1380
+ toolChoice?: "auto" | "required" | "none";
1381
+ providerOptions?: {
1382
+ [k: string]: unknown;
1383
+ };
1384
+ } | {
1385
+ operation: "streamText";
1386
+ apiKey: string;
1387
+ temperature?: number;
1388
+ model: {
1389
+ provider: "openai";
1390
+ model: string;
1391
+ } | {
1392
+ provider: "anthropic";
1393
+ model: string;
1394
+ } | {
1395
+ provider: "mistral";
1396
+ model: string;
1397
+ } | {
1398
+ provider: "cohere";
1399
+ model: string;
1400
+ } | {
1401
+ provider: "google";
1402
+ model: string;
1403
+ };
1404
+ /**
1405
+ * jsOnly
1406
+ */
1407
+ messages?: ({
1408
+ role: "system";
1409
+ content: string;
1410
+ providerOptions?: {
1411
+ [k: string]: unknown;
1412
+ };
1413
+ } | {
1414
+ role: "user";
1415
+ content: string | ({
1416
+ type: "text";
1417
+ text: string;
1418
+ providerOptions?: {
1419
+ [k: string]: unknown;
1420
+ };
1421
+ } | {
1422
+ type: "image";
1423
+ imageUrl: string;
1424
+ mimeType?: string;
1425
+ providerOptions?: {
1426
+ [k: string]: unknown;
1427
+ };
1428
+ } | {
1429
+ type: "file";
1430
+ fileUrl: string;
1431
+ filename?: string;
1432
+ mimeType: string;
1433
+ providerOptions?: {
1434
+ [k: string]: unknown;
1435
+ };
1436
+ })[];
1437
+ providerOptions?: {
1438
+ [k: string]: unknown;
1439
+ };
1440
+ } | {
1441
+ role: "assistant";
1442
+ content: string | ({
1443
+ type: "text";
1444
+ text: string;
1445
+ providerOptions?: {
1446
+ [k: string]: unknown;
1447
+ };
1448
+ } | {
1449
+ type: "tool-call";
1450
+ toolCallId: string;
1451
+ toolName: string;
1452
+ args: unknown;
1453
+ providerOptions?: {
1454
+ [k: string]: unknown;
1455
+ };
1456
+ })[];
1457
+ providerOptions?: {
1458
+ [k: string]: unknown;
1459
+ };
1460
+ } | {
1461
+ role: "tool";
1462
+ content: {
1463
+ type: "tool-result";
1464
+ toolCallId: string;
1465
+ toolName: string;
1466
+ result: unknown;
1467
+ }[];
1468
+ })[];
1469
+ system?: string;
1470
+ prompt?: string;
1471
+ /**
1472
+ * jsOnly
1473
+ */
1474
+ tools: {
1475
+ [k: string]: {
1476
+ description?: string;
1477
+ parameters: unknown;
1478
+ type: "function";
1479
+ } | {
1480
+ type: "provider-defined";
1481
+ parameters: unknown;
1482
+ id: string;
1483
+ args: {
1484
+ [k: string]: unknown;
1485
+ };
1486
+ };
1487
+ };
1488
+ toolChoice?: "auto" | "required" | "none";
1489
+ providerOptions?: {
1490
+ [k: string]: unknown;
1491
+ };
1492
+ } | {
1493
+ operation: "embed";
1494
+ apiKey: string;
1495
+ temperature?: number;
1496
+ model: {
1497
+ provider: "openai";
1498
+ model: string;
1499
+ } | {
1500
+ provider: "anthropic";
1501
+ model: string;
1502
+ } | {
1503
+ provider: "mistral";
1504
+ model: string;
1505
+ } | {
1506
+ provider: "cohere";
1507
+ model: string;
1508
+ } | {
1509
+ provider: "google";
1510
+ model: string;
1511
+ };
1512
+ value: string;
1513
+ };
1514
+ export type IGenericAIResult = {
1515
+ type: "result";
1516
+ value: {
1517
+ reasoning?: string;
1518
+ text: string;
1519
+ toolCalls: {
1520
+ type: "function" | "tool-call";
1521
+ toolName: string;
1522
+ toolCallId: string;
1523
+ id?: string;
1524
+ args?: unknown;
1525
+ }[];
1526
+ };
1527
+ } | {
1528
+ type: "objectResult";
1529
+ value: unknown;
1530
+ } | {
1531
+ type: "streamChunk";
1532
+ value: string;
1533
+ } | {
1534
+ type: "streamResult";
1535
+ value: {
1536
+ text: string;
1537
+ toolCalls: {
1538
+ type: "function" | "tool-call";
1539
+ toolName: string;
1540
+ toolCallId: string;
1541
+ id?: string;
1542
+ args: unknown;
1543
+ }[];
1544
+ };
1545
+ } | {
1546
+ type: "embeddingResult";
1547
+ value: number[];
1548
+ } | {
1549
+ type: "error";
1550
+ error: string;
1551
+ };
1552
+ export type IStepParamsMap = {
1553
+ batchCreateType: IBatchCreateTypeParams;
1554
+ batchGetType: IBatchGetTypeParams;
1555
+ createType: ICreateTypeParams;
1556
+ deleteType: IDeleteTypeParams;
1557
+ elevenLabsTTS: IElevenLabsTTSParams;
1558
+ googleSearch: IGoogleSearchParams;
1559
+ htmlToPdf: IHtmlToPdfParams;
1560
+ httpRequest: IHttpRequestParams;
1561
+ logic: ILogicParams;
1562
+ linkScraper: ILinkScraperParams;
1563
+ listTypeByParent: IListTypeByParentParams;
1564
+ listType: IListTypeParams;
1565
+ notifyWebSocket: INotifyWebSocketParams;
1566
+ openAIImageGeneration: IOpenAIImageGenerationParams;
1567
+ type: ITypeParams;
1568
+ updateType: IUpdateTypeParams;
1569
+ extractImageMetadata: IExtractImageMetadataParams;
1570
+ cloudFunction: ICloudFunctionParams;
1571
+ genericAI: IGenericAIParams;
1572
+ };
1573
+ export type IStepResultMap = {
1574
+ batchCreateType: IBatchCreateTypeResult;
1575
+ batchGetType: IBatchGetTypeResult;
1576
+ createType: ICreateTypeResult;
1577
+ deleteType: IDeleteTypeResult;
1578
+ elevenLabsTTS: IElevenLabsTTSResult;
1579
+ googleSearch: IGoogleSearchResult;
1580
+ htmlToPdf: IHtmlToPdfResult;
1581
+ httpRequest: IHttpRequestResult;
1582
+ logic: ILogicResult;
1583
+ linkScraper: ILinkScraperResult;
1584
+ listTypeByParent: IListTypeByParentResult;
1585
+ listType: IListTypeResult;
1586
+ notifyWebSocket: INotifyWebSocketResult;
1587
+ openAIImageGeneration: IOpenAIImageGenerationResult;
1588
+ type: ITypeResult;
1589
+ updateType: IUpdateTypeResult;
1590
+ extractImageMetadata: IExtractImageMetadataResult;
1591
+ cloudFunction: ICloudFunctionResult;
1592
+ genericAI: IGenericAIResult;
1593
+ };
1594
+ declare enum StepType {
1595
+ batchCreateType = "batchCreateType",
1596
+ batchGetType = "batchGetType",
1597
+ createType = "createType",
1598
+ deleteType = "deleteType",
1599
+ elevenLabsTTS = "elevenLabsTTS",
1600
+ googleSearch = "googleSearch",
1601
+ htmlToPdf = "htmlToPdf",
1602
+ httpRequest = "httpRequest",
1603
+ logic = "logic",
1604
+ linkScraper = "linkScraper",
1605
+ listTypeByParent = "listTypeByParent",
1606
+ listType = "listType",
1607
+ notifyWebSocket = "notifyWebSocket",
1608
+ openAIImageGeneration = "openAIImageGeneration",
1609
+ type = "type",
1610
+ updateType = "updateType",
1611
+ extractImageMetadata = "extractImageMetadata",
1612
+ cloudFunction = "cloudFunction",
1613
+ genericAI = "genericAI"
1614
+ }
1615
+ export type IStepLike = {
1616
+ _tsStepResult: unknown;
1617
+ };
1618
+ export type IJSONSerializable = string | number | boolean | undefined | null | IJSONSerializable[] | {
1619
+ [x: string]: IJSONSerializable;
1620
+ };
1621
+ declare enum TriggerVariantEnum {
1622
+ TABLE_DATA_CHANGE = "TABLE_DATA_CHANGE",
1623
+ SCHEDULE = "SCHEDULE",
1624
+ MANUAL = "MANUAL"
1625
+ }
1626
+ export interface ISharedTriggerDeclaration<TName extends string> {
1627
+ name: TName;
1628
+ condition?: string;
1629
+ }
1630
+ export type ILogicLanguage = "json-logic" | "js";
1631
+ export type IParameterLogicLanguage = ILogicLanguage | "static";
1632
+ export type ITableDataChangeTriggerOperation = "INSERT" | "MODIFY" | "REMOVE";
1633
+ export interface ITableDataChangeTrigger<TName extends string, TOperation extends ITableDataChangeTriggerOperation, ITriggerData> extends ISharedTriggerDeclaration<TName> {
1634
+ variant: TriggerVariantEnum.TABLE_DATA_CHANGE;
1635
+ tableId: string;
1636
+ operation: TOperation;
1637
+ _tsTriggerData: TOperation extends "MODIFY" ? {
1638
+ old: ITriggerData;
1639
+ new: ITriggerData;
1640
+ } : ITriggerData;
1641
+ }
1642
+ export interface IScheduledTrigger<TName extends string> extends ISharedTriggerDeclaration<TName> {
1643
+ variant: TriggerVariantEnum.SCHEDULE;
1644
+ _tsTriggerData: unknown;
1645
+ }
1646
+ export interface IManualTrigger<TName extends string> extends ISharedTriggerDeclaration<TName> {
1647
+ variant: TriggerVariantEnum.MANUAL;
1648
+ _tsTriggerData: unknown;
1649
+ }
1650
+ export type ITriggerDeclaration<TName extends string, TOperation extends ITableDataChangeTriggerOperation, TTriggerData> = ITableDataChangeTrigger<TName, TOperation, TTriggerData> | IScheduledTrigger<TName> | IManualTrigger<TName>;
1651
+ export type IParamConfig = {
1652
+ type: "object";
1653
+ subParams: Record<string, IParamConfig>;
1654
+ } | {
1655
+ type?: "logic";
1656
+ language: IParameterLogicLanguage;
1657
+ } | {
1658
+ type: "secret";
1659
+ };
1660
+ export type IStepFactory<ITypeName extends string, IParams, IResult, TStepName extends string = string> = {
1661
+ name: TStepName;
1662
+ type: ITypeName;
1663
+ description?: string;
1664
+ params: {
1665
+ [K in keyof IParams]: IJSONSerializable;
1666
+ };
1667
+ nextStep: string | null;
1668
+ passThroughCondition?: string;
1669
+ continueCondition?: string;
1670
+ skipCondition?: string;
1671
+ continueConditionLanguage?: ILogicLanguage;
1672
+ skipConditionLanguage?: ILogicLanguage;
1673
+ paramsConfig?: {
1674
+ [K in keyof IParams]: IParamConfig;
1675
+ };
1676
+ _tsStepResult: IResult;
1677
+ };
1678
+ export type ISteps = {
1679
+ [K in StepType]: IStepFactory<K, IStepParamsMap[K], IStepResultMap[K]>;
1680
+ };
1681
+ export type IStep = ISteps[keyof ISteps];
1682
+ export interface IFlowDeclaration<TName extends string, TSteps extends Record<string, IStepLike>> {
1683
+ triggers: Record<string, ITriggerDeclaration<TName, any, any>>;
1684
+ startStep: string | null;
1685
+ steps: TSteps;
1686
+ debug?: boolean;
1687
+ disabled?: boolean;
1688
+ }
1689
+ export type INonGenericIFlowDeclaration = IFlowDeclaration<string, Record<string, IStep>>;
788
1690
  export type II18nSettings = {
789
1691
  locales: string[];
790
1692
  default: string;
@@ -972,7 +1874,10 @@ export interface IPageOutput {
972
1874
  id?: string;
973
1875
  name: string;
974
1876
  slugConfig: IPageSlugConfig;
1877
+ /** @deprecated Prefer `localizations`. Kept for the local DSL / old MCP. */
975
1878
  defaultLocalization?: LocalizationDictionary;
1879
+ /** Per-locale page copies / SEO meta (`{locale}_page_{pageId}`). */
1880
+ localizations?: ILocalizationsByLocale;
976
1881
  localizedConfig?: string;
977
1882
  blocks: IBlockOutput[];
978
1883
  }
@@ -1010,9 +1915,181 @@ export interface IAppOutput {
1010
1915
  auth?: IAppAuthSettings;
1011
1916
  }
1012
1917
  declare function buildApp(opts: IAppOptions): IAppOutput;
1918
+ export interface IJsParam {
1919
+ readonly __flowParam: "js";
1920
+ readonly code: string;
1921
+ }
1922
+ export interface ISecretParam {
1923
+ readonly __flowParam: "secret";
1924
+ readonly secretId: string;
1925
+ }
1926
+ declare function js(code: string): IJsParam;
1927
+ declare function secret(secretId: string): ISecretParam;
1928
+ /**
1929
+ * Widens a step's param type so every level accepts either the plain value,
1930
+ * a `js()` marker, or (for leaves) a `secret()` marker. Arrays only allow a
1931
+ * marker for the whole array — the runtime cannot address paths inside arrays.
1932
+ */
1933
+ export type DeepParam<T> = [
1934
+ T
1935
+ ] extends [
1936
+ never
1937
+ ] ? never : T extends (infer U)[] ? U[] | IJsParam : T extends object ? {
1938
+ [K in keyof T]: DeepParam<T[K]>;
1939
+ } | IJsParam : T | IJsParam | ISecretParam;
1940
+ export interface ITableDataChangeTriggerOptions {
1941
+ tableId: string;
1942
+ operation: ITableDataChangeTriggerOperation;
1943
+ /** JS code evaluated against the trigger data; truthy result fires the flow. */
1944
+ condition?: string;
1945
+ }
1946
+ export interface ISharedTriggerOptions {
1947
+ condition?: string;
1948
+ }
1949
+ export type IFlowTriggerDefinition = {
1950
+ variant: TriggerVariantEnum.TABLE_DATA_CHANGE;
1951
+ tableId: string;
1952
+ operation: ITableDataChangeTriggerOperation;
1953
+ condition?: string;
1954
+ } | {
1955
+ variant: TriggerVariantEnum.SCHEDULE;
1956
+ condition?: string;
1957
+ } | {
1958
+ variant: TriggerVariantEnum.MANUAL;
1959
+ condition?: string;
1960
+ };
1961
+ declare const trigger: {
1962
+ tableDataChange(opts: ITableDataChangeTriggerOptions): IFlowTriggerDefinition;
1963
+ schedule(opts?: ISharedTriggerOptions): IFlowTriggerDefinition;
1964
+ manual(opts?: ISharedTriggerOptions): IFlowTriggerDefinition;
1965
+ };
1966
+ export type DeepParamObject<P> = P extends object ? {
1967
+ [K in keyof P]: DeepParam<P[K]>;
1968
+ } : never;
1969
+ export type IStepParamsInput<T extends StepType> = DeepParamObject<IStepParamsMap[T]>;
1970
+ export interface IFlowStepOptions<T extends StepType> {
1971
+ description?: string;
1972
+ /**
1973
+ * The step-type shape drives IntelliSense, but a raw record is accepted
1974
+ * too: declarations created in the webapp routinely carry extra keys or
1975
+ * omit ones that are resolved dynamically, and pulled flows must always
1976
+ * compile. Mismatches surface as schema warnings on push.
1977
+ */
1978
+ params: IStepParamsInput<T> | Record<string, unknown>;
1979
+ /**
1980
+ * Explicit next step name (or null to end the flow). Defaults to the
1981
+ * following entry of the `steps` array. Required for `detachedSteps`.
1982
+ */
1983
+ next?: string | null;
1984
+ /** JS condition — truthy result skips this step (the flow continues). */
1985
+ skipIf?: string;
1986
+ /** JS condition evaluated after the step — falsy result stops the flow. */
1987
+ continueIf?: string;
1988
+ passThroughCondition?: string;
1989
+ }
1990
+ export interface IFlowStepDefinition<T extends StepType = StepType> {
1991
+ name: string;
1992
+ type: T;
1993
+ description?: string;
1994
+ params: Record<string, unknown>;
1995
+ next?: string | null;
1996
+ skipIf?: string;
1997
+ continueIf?: string;
1998
+ passThroughCondition?: string;
1999
+ }
2000
+ declare const step: {
2001
+ batchCreateType: (name: string, opts: IFlowStepOptions<StepType.batchCreateType>) => IFlowStepDefinition<StepType.batchCreateType>;
2002
+ batchGetType: (name: string, opts: IFlowStepOptions<StepType.batchGetType>) => IFlowStepDefinition<StepType.batchGetType>;
2003
+ createType: (name: string, opts: IFlowStepOptions<StepType.createType>) => IFlowStepDefinition<StepType.createType>;
2004
+ deleteType: (name: string, opts: IFlowStepOptions<StepType.deleteType>) => IFlowStepDefinition<StepType.deleteType>;
2005
+ elevenLabsTTS: (name: string, opts: IFlowStepOptions<StepType.elevenLabsTTS>) => IFlowStepDefinition<StepType.elevenLabsTTS>;
2006
+ googleSearch: (name: string, opts: IFlowStepOptions<StepType.googleSearch>) => IFlowStepDefinition<StepType.googleSearch>;
2007
+ htmlToPdf: (name: string, opts: IFlowStepOptions<StepType.htmlToPdf>) => IFlowStepDefinition<StepType.htmlToPdf>;
2008
+ httpRequest: (name: string, opts: IFlowStepOptions<StepType.httpRequest>) => IFlowStepDefinition<StepType.httpRequest>;
2009
+ logic: (name: string, opts: IFlowStepOptions<StepType.logic>) => IFlowStepDefinition<StepType.logic>;
2010
+ linkScraper: (name: string, opts: IFlowStepOptions<StepType.linkScraper>) => IFlowStepDefinition<StepType.linkScraper>;
2011
+ listTypeByParent: (name: string, opts: IFlowStepOptions<StepType.listTypeByParent>) => IFlowStepDefinition<StepType.listTypeByParent>;
2012
+ listType: (name: string, opts: IFlowStepOptions<StepType.listType>) => IFlowStepDefinition<StepType.listType>;
2013
+ notifyWebSocket: (name: string, opts: IFlowStepOptions<StepType.notifyWebSocket>) => IFlowStepDefinition<StepType.notifyWebSocket>;
2014
+ openAIImageGeneration: (name: string, opts: IFlowStepOptions<StepType.openAIImageGeneration>) => IFlowStepDefinition<StepType.openAIImageGeneration>;
2015
+ type: (name: string, opts: IFlowStepOptions<StepType.type>) => IFlowStepDefinition<StepType.type>;
2016
+ updateType: (name: string, opts: IFlowStepOptions<StepType.updateType>) => IFlowStepDefinition<StepType.updateType>;
2017
+ extractImageMetadata: (name: string, opts: IFlowStepOptions<StepType.extractImageMetadata>) => IFlowStepDefinition<StepType.extractImageMetadata>;
2018
+ cloudFunction: (name: string, opts: IFlowStepOptions<StepType.cloudFunction>) => IFlowStepDefinition<StepType.cloudFunction>;
2019
+ genericAI: (name: string, opts: IFlowStepOptions<StepType.genericAI>) => IFlowStepDefinition<StepType.genericAI>;
2020
+ };
2021
+ export interface IFlowOptions {
2022
+ /** Flow record name — stored next to the declaration, not inside it. */
2023
+ name?: string;
2024
+ triggers: Record<string, IFlowTriggerDefinition>;
2025
+ /** Executed in order; each step's nextStep defaults to the next entry. */
2026
+ steps: IFlowStepDefinition[];
2027
+ /**
2028
+ * Steps not reachable from the main chain (each needs an explicit `next`).
2029
+ * Exists for round-trip fidelity of pulled declarations — avoid in new flows.
2030
+ */
2031
+ detachedSteps?: IFlowStepDefinition[];
2032
+ debug?: boolean;
2033
+ disabled?: boolean;
2034
+ }
2035
+ export interface IFlowOutput {
2036
+ name?: string;
2037
+ declaration: INonGenericIFlowDeclaration;
2038
+ }
2039
+ declare const TABLE_ID_PARAM_NAMES: readonly [
2040
+ "ofType",
2041
+ "parentType"
2042
+ ];
2043
+ declare function buildFlow(opts: IFlowOptions): IFlowOutput;
2044
+ export interface IFlowValidationIssue {
2045
+ flowId?: string;
2046
+ flowName?: string;
2047
+ path: string;
2048
+ message: string;
2049
+ }
2050
+ export interface IFlowValidationResult {
2051
+ errors: IFlowValidationIssue[];
2052
+ warnings: IFlowValidationIssue[];
2053
+ }
2054
+ export interface IValidatableFlow {
2055
+ id: string;
2056
+ name?: string;
2057
+ declaration: INonGenericIFlowDeclaration;
2058
+ }
2059
+ export interface IValidateFlowContext {
2060
+ flowId?: string;
2061
+ name?: string;
2062
+ }
2063
+ /**
2064
+ * All secret record IDs referenced by a declaration's secret params.
2065
+ */
2066
+ export declare function collectSecretIds(declaration: INonGenericIFlowDeclaration): string[];
2067
+ /**
2068
+ * Validates a single flow declaration: linked-list step integrity, param
2069
+ * shapes, secret hygiene, and self-retriggering write steps.
2070
+ */
2071
+ export declare function validateFlow(declaration: INonGenericIFlowDeclaration, ctx?: IValidateFlowContext): IFlowValidationResult;
2072
+ /**
2073
+ * Detects trigger cycles across flows: flow A writes a table that triggers
2074
+ * flow B, whose writes eventually trigger flow A again. Only statically
2075
+ * determinable writes create edges — dynamic writes are reported per flow by
2076
+ * {@link validateFlow}.
2077
+ */
2078
+ export declare function validateFlowGraph(flows: IValidatableFlow[]): IFlowValidationResult;
2079
+ export interface IValidateFlowsOptions {
2080
+ /**
2081
+ * Restrict per-flow validation to these flow IDs (cross-flow cycle
2082
+ * detection always runs across all flows). Defaults to all flows.
2083
+ */
2084
+ flowIdsToValidate?: string[];
2085
+ }
2086
+ /**
2087
+ * Validates each flow individually and detects cross-flow trigger cycles.
2088
+ */
2089
+ export declare function validateFlows(flows: IValidatableFlow[], opts?: IValidateFlowsOptions): IFlowValidationResult;
1013
2090
 
1014
- declare namespace appBuilder {
1015
- export { block, blockType, buildApp, buildBlockTypes, buildPages, flattenBlocks, page };
2091
+ declare namespace flowBuilder {
2092
+ export { IFlowOptions, IFlowOutput, IFlowStepDefinition, IFlowStepOptions, IFlowTriggerDefinition, ISharedTriggerOptions, IStepParamsInput, ITableDataChangeTriggerOptions, TABLE_ID_PARAM_NAMES, buildFlow, js, secret, step, trigger };
1016
2093
  }
1017
2094
  declare namespace dataBuilder {
1018
2095
  export { TableDef, TableOpts, TableSearchConfig, build, enumType, fields, table };
@@ -1020,10 +2097,14 @@ declare namespace dataBuilder {
1020
2097
  declare namespace macros {
1021
2098
  export { blockConfigCode, blockDynamicDataCode, blockNameCode, blockTypeCopiesCode, entityLocalizationCode, pageLocalizedConfigCode };
1022
2099
  }
2100
+ declare namespace appBuilder {
2101
+ export { block, blockType, buildApp, buildBlockTypes, buildPages, flattenBlocks, page };
2102
+ }
1023
2103
 
1024
2104
  export {
1025
2105
  appBuilder,
1026
2106
  dataBuilder,
2107
+ flowBuilder,
1027
2108
  macros,
1028
2109
  };
1029
2110