@turbofy-ai/app-runtime 0.0.4 → 0.0.6
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 +1149 -4
- package/dist/src/dsl.js +1641 -22
- package/dist/src/generated/auth-config.d.ts +5 -0
- package/dist/src/lib/auth.d.ts +21 -0
- package/package.json +1 -1
package/dist/src/dsl.js
CHANGED
|
@@ -398,12 +398,21 @@ function entityLocalizationCode(ofType, fieldName, defaultLocale = "en") {
|
|
|
398
398
|
const defaultLocaleLower = defaultLocale.toLowerCase();
|
|
399
399
|
return `(() => {
|
|
400
400
|
const lang = ($$args.lang || '${defaultLocaleLower}').toLowerCase();
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
401
|
+
const record = $$std.getRecord(
|
|
402
|
+
'localization',
|
|
403
|
+
'${ofTypeLower}#' + $$self.id + '#' + lang,
|
|
404
|
+
{ dynamicArgs: { fields: ['dictionary'] } },
|
|
405
|
+
);
|
|
406
|
+
let dict = record && typeof record === 'object' ? record.dictionary : null;
|
|
407
|
+
if (!dict) {
|
|
408
|
+
// Fallback to legacy approach for records that predate the id-equals-key invariant.
|
|
409
|
+
const results = $$std.listRecords('localization', {
|
|
410
|
+
sortRange: { beginsWith: '${ofTypeLower}#' + $$self.id + '#' + lang },
|
|
411
|
+
limit: 1,
|
|
412
|
+
});
|
|
413
|
+
if (!Array.isArray(results) || results.length === 0) return '';
|
|
414
|
+
dict = results[0].dictionary;
|
|
415
|
+
}
|
|
407
416
|
if (!dict || typeof dict !== 'object') return '';
|
|
408
417
|
return dict['${fieldName}'] || '';
|
|
409
418
|
})()`;
|
|
@@ -429,6 +438,7 @@ function pageLocalizedConfigCode() {
|
|
|
429
438
|
const paramsCollectionMap = slugConfig?.paramsCollectionMap ?? {};
|
|
430
439
|
let notFound = false;
|
|
431
440
|
const params = {};
|
|
441
|
+
const resolvedParamEntities = [];
|
|
432
442
|
|
|
433
443
|
const resolveIdFromSlug = (ofType, slug) => {
|
|
434
444
|
const t = ofType.toLowerCase();
|
|
@@ -477,6 +487,7 @@ function pageLocalizedConfigCode() {
|
|
|
477
487
|
const activeSlugForEntity = resolveSlugFromId(ofType, entityId);
|
|
478
488
|
canonicalPathArray[paramIndex + 1] = activeSlugForEntity ?? paramValue;
|
|
479
489
|
params[param] = entityId;
|
|
490
|
+
resolvedParamEntities.push({ index: paramIndex, id: entityId, param, record });
|
|
480
491
|
} else {
|
|
481
492
|
const id = paramValue.split('_')[0];
|
|
482
493
|
const record = $$std.getRecord(ofType, id, { dynamicArgs: $$args });
|
|
@@ -494,13 +505,81 @@ function pageLocalizedConfigCode() {
|
|
|
494
505
|
canonicalPathArray[paramIndex + 1] = paramValue;
|
|
495
506
|
}
|
|
496
507
|
params[param] = id;
|
|
508
|
+
resolvedParamEntities.push({ index: paramIndex, id, param, record });
|
|
497
509
|
}
|
|
498
510
|
}
|
|
499
511
|
|
|
512
|
+
const fetchLocalizationDictionary = (locale, suffix) => {
|
|
513
|
+
const record = $$std.getRecord('cmslocalization', locale + '_page_' + $$self.id + suffix);
|
|
514
|
+
if (!record || typeof record !== 'object') return null;
|
|
515
|
+
const dictionary = $$std.get(record, 'dictionary');
|
|
516
|
+
return dictionary && typeof dictionary === 'object' ? dictionary : null;
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
const buildMeta = () => {
|
|
520
|
+
const entitySuffixes = resolvedParamEntities
|
|
521
|
+
.sort((a, b) => a.index - b.index)
|
|
522
|
+
.map((entity) => '#' + entity.id);
|
|
523
|
+
const suffixes = [''].concat(entitySuffixes);
|
|
524
|
+
|
|
525
|
+
const layers = [];
|
|
526
|
+
for (const suffix of suffixes) {
|
|
527
|
+
if (lang !== 'en') {
|
|
528
|
+
const fallbackLayer = fetchLocalizationDictionary('en', suffix);
|
|
529
|
+
if (fallbackLayer) layers.push(fallbackLayer);
|
|
530
|
+
}
|
|
531
|
+
const activeLayer = fetchLocalizationDictionary(lang, suffix);
|
|
532
|
+
if (activeLayer) layers.push(activeLayer);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
const dictionary = {};
|
|
536
|
+
const rawMeta = {};
|
|
537
|
+
let hasMeta = false;
|
|
538
|
+
for (const layer of layers) {
|
|
539
|
+
Object.assign(dictionary, layer);
|
|
540
|
+
if (layer.meta && typeof layer.meta === 'object') {
|
|
541
|
+
Object.assign(rawMeta, layer.meta);
|
|
542
|
+
hasMeta = true;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (!hasMeta) return null;
|
|
546
|
+
|
|
547
|
+
const paramRecords = {};
|
|
548
|
+
for (const entity of resolvedParamEntities) {
|
|
549
|
+
if (entity.record) paramRecords[entity.param] = entity.record;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
const resolvePlaceholders = (value, visited) => {
|
|
553
|
+
if (typeof value !== 'string') return value;
|
|
554
|
+
return value.replace(/\\{\\{\\s*([^{}]+?)\\s*\\}\\}/g, (match, key) => {
|
|
555
|
+
if (visited[key]) return '';
|
|
556
|
+
let raw = dictionary[key] !== undefined && key !== 'meta' ? dictionary[key] : rawMeta[key];
|
|
557
|
+
if (raw === undefined) {
|
|
558
|
+
const dotIndex = key.indexOf('.');
|
|
559
|
+
const paramRecord = dotIndex > 0 ? paramRecords[key.slice(0, dotIndex)] : undefined;
|
|
560
|
+
if (paramRecord) raw = $$std.get(paramRecord, key.slice(dotIndex + 1));
|
|
561
|
+
}
|
|
562
|
+
const resolved = resolvePlaceholders(raw, { ...visited, [key]: true });
|
|
563
|
+
return resolved == null || typeof resolved === 'object' ? '' : String(resolved);
|
|
564
|
+
});
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
const meta = {};
|
|
568
|
+
for (const key in rawMeta) {
|
|
569
|
+
const value = resolvePlaceholders(rawMeta[key], {});
|
|
570
|
+
if (value == null || value === '') continue;
|
|
571
|
+
meta[key] = value;
|
|
572
|
+
}
|
|
573
|
+
return Object.keys(meta).length > 0 ? meta : null;
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
const meta = buildMeta();
|
|
577
|
+
|
|
500
578
|
return {
|
|
501
579
|
canonicalPath: '/' + canonicalPathArray.join('/'),
|
|
502
580
|
params,
|
|
503
581
|
notFound,
|
|
582
|
+
...(meta ? { meta } : {}),
|
|
504
583
|
};
|
|
505
584
|
})()`.trim();
|
|
506
585
|
}
|
|
@@ -1252,8 +1331,8 @@ function cleanRegex(source) {
|
|
|
1252
1331
|
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
1253
1332
|
return source.slice(start, end);
|
|
1254
1333
|
}
|
|
1255
|
-
function floatSafeRemainder(val,
|
|
1256
|
-
const ratio = val /
|
|
1334
|
+
function floatSafeRemainder(val, step2) {
|
|
1335
|
+
const ratio = val / step2;
|
|
1257
1336
|
const roundedRatio = Math.round(ratio);
|
|
1258
1337
|
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
1259
1338
|
if (Math.abs(ratio - roundedRatio) < tolerance)
|
|
@@ -12825,7 +12904,7 @@ function toJSONSchema(input, params) {
|
|
|
12825
12904
|
const [_, schema] = entry;
|
|
12826
12905
|
process(schema, ctx2);
|
|
12827
12906
|
}
|
|
12828
|
-
const
|
|
12907
|
+
const schemas2 = {};
|
|
12829
12908
|
const external = {
|
|
12830
12909
|
registry: registry2,
|
|
12831
12910
|
uri: params?.uri,
|
|
@@ -12835,15 +12914,15 @@ function toJSONSchema(input, params) {
|
|
|
12835
12914
|
for (const entry of registry2._idmap.entries()) {
|
|
12836
12915
|
const [key, schema] = entry;
|
|
12837
12916
|
extractDefs(ctx2, schema);
|
|
12838
|
-
|
|
12917
|
+
schemas2[key] = finalize(ctx2, schema);
|
|
12839
12918
|
}
|
|
12840
12919
|
if (Object.keys(defs).length > 0) {
|
|
12841
12920
|
const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
12842
|
-
|
|
12921
|
+
schemas2.__shared = {
|
|
12843
12922
|
[defsSegment]: defs
|
|
12844
12923
|
};
|
|
12845
12924
|
}
|
|
12846
|
-
return { schemas };
|
|
12925
|
+
return { schemas: schemas2 };
|
|
12847
12926
|
}
|
|
12848
12927
|
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
12849
12928
|
process(input, ctx);
|
|
@@ -14718,8 +14797,8 @@ function convertBaseSchema(schema, ctx) {
|
|
|
14718
14797
|
const type = schema.type;
|
|
14719
14798
|
if (Array.isArray(type)) {
|
|
14720
14799
|
const typeSchemas = type.map((t) => {
|
|
14721
|
-
const
|
|
14722
|
-
return convertBaseSchema(
|
|
14800
|
+
const typeSchema2 = { ...schema, type: t };
|
|
14801
|
+
return convertBaseSchema(typeSchema2, ctx);
|
|
14723
14802
|
});
|
|
14724
14803
|
if (typeSchemas.length === 0) {
|
|
14725
14804
|
return z.never();
|
|
@@ -15053,6 +15132,9 @@ function date4(params) {
|
|
|
15053
15132
|
// ../../node_modules/zod/v4/classic/external.js
|
|
15054
15133
|
config(en_default());
|
|
15055
15134
|
|
|
15135
|
+
// ../../node_modules/zod/index.js
|
|
15136
|
+
var zod_default = external_exports;
|
|
15137
|
+
|
|
15056
15138
|
// ../declarations/src/api/field-type.schema.ts
|
|
15057
15139
|
var FieldTypeEnum = /* @__PURE__ */ ((FieldTypeEnum2) => {
|
|
15058
15140
|
FieldTypeEnum2["Boolean"] = "Boolean";
|
|
@@ -15160,11 +15242,15 @@ var PipelineStepEnum = /* @__PURE__ */ ((PipelineStepEnum2) => {
|
|
|
15160
15242
|
})(PipelineStepEnum || {});
|
|
15161
15243
|
var RuntimeEnum = /* @__PURE__ */ ((RuntimeEnum2) => {
|
|
15162
15244
|
RuntimeEnum2["NODEJS_22_X"] = "NODEJS_22_X";
|
|
15245
|
+
RuntimeEnum2["NODEJS_24_X"] = "NODEJS_24_X";
|
|
15163
15246
|
RuntimeEnum2["NODEJS_18_X"] = "NODEJS_18_X";
|
|
15247
|
+
RuntimeEnum2["PYTHON_3_12"] = "PYTHON_3_12";
|
|
15248
|
+
RuntimeEnum2["PYTHON_3_11"] = "PYTHON_3_11";
|
|
15164
15249
|
RuntimeEnum2["PYTHON_3_10"] = "PYTHON_3_10";
|
|
15165
15250
|
RuntimeEnum2["GO_1_X"] = "GO_1_X";
|
|
15166
|
-
RuntimeEnum2["
|
|
15251
|
+
RuntimeEnum2["RUBY_3_3"] = "RUBY_3_3";
|
|
15167
15252
|
RuntimeEnum2["RUBY_3_2"] = "RUBY_3_2";
|
|
15253
|
+
RuntimeEnum2["RUBY_2_7"] = "RUBY_2_7";
|
|
15168
15254
|
RuntimeEnum2["DOCKER"] = "DOCKER";
|
|
15169
15255
|
return RuntimeEnum2;
|
|
15170
15256
|
})(RuntimeEnum || {});
|
|
@@ -15197,10 +15283,14 @@ var SubscribedProductEnum = /* @__PURE__ */ ((SubscribedProductEnum2) => {
|
|
|
15197
15283
|
SubscribedProductEnum2["FILES"] = "FILES";
|
|
15198
15284
|
SubscribedProductEnum2["SUBSCRIPTIONS"] = "SUBSCRIPTIONS";
|
|
15199
15285
|
SubscribedProductEnum2["DEDICATED_IP"] = "DEDICATED_IP";
|
|
15286
|
+
SubscribedProductEnum2["GRAPHQL_API"] = "GRAPHQL_API";
|
|
15287
|
+
SubscribedProductEnum2["AUTH"] = "AUTH";
|
|
15200
15288
|
return SubscribedProductEnum2;
|
|
15201
15289
|
})(SubscribedProductEnum || {});
|
|
15202
15290
|
var ProductNameEnum = /* @__PURE__ */ ((ProductNameEnum2) => {
|
|
15203
15291
|
ProductNameEnum2["dedicated_ip_address"] = "dedicated_ip_address";
|
|
15292
|
+
ProductNameEnum2["graphql_api"] = "graphql_api";
|
|
15293
|
+
ProductNameEnum2["cognito_auth"] = "cognito_auth";
|
|
15204
15294
|
ProductNameEnum2["mvp_bundle"] = "mvp_bundle";
|
|
15205
15295
|
ProductNameEnum2["mvp_cognito"] = "mvp_cognito_auth";
|
|
15206
15296
|
ProductNameEnum2["mvp_data_storage"] = "mvp_data_storage";
|
|
@@ -15543,7 +15633,8 @@ function table(name, fieldsDef, opts = {}) {
|
|
|
15543
15633
|
directives,
|
|
15544
15634
|
publishingTypes,
|
|
15545
15635
|
searchConfig,
|
|
15546
|
-
defaultFieldIds
|
|
15636
|
+
defaultFieldIds,
|
|
15637
|
+
defaultFieldTypes
|
|
15547
15638
|
} = opts;
|
|
15548
15639
|
if (firstParent && secondParent && firstParent.name === secondParent.name) {
|
|
15549
15640
|
throw new Error(
|
|
@@ -15572,19 +15663,19 @@ function table(name, fieldsDef, opts = {}) {
|
|
|
15572
15663
|
{
|
|
15573
15664
|
id: defaultFieldIds?.id ?? randomUuid(),
|
|
15574
15665
|
name: "id",
|
|
15575
|
-
type: "ID" /* ID */,
|
|
15666
|
+
type: defaultFieldTypes?.id ?? "ID" /* ID */,
|
|
15576
15667
|
directives: ["@connector" /* CONNECTOR */]
|
|
15577
15668
|
},
|
|
15578
15669
|
{
|
|
15579
15670
|
id: defaultFieldIds?.createdAt ?? randomUuid(),
|
|
15580
15671
|
name: "createdAt",
|
|
15581
|
-
type: "String" /* String */,
|
|
15672
|
+
type: defaultFieldTypes?.createdAt ?? "String" /* String */,
|
|
15582
15673
|
directives: []
|
|
15583
15674
|
},
|
|
15584
15675
|
{
|
|
15585
15676
|
id: defaultFieldIds?.updatedAt ?? randomUuid(),
|
|
15586
15677
|
name: "updatedAt",
|
|
15587
|
-
type: "String" /* String */,
|
|
15678
|
+
type: defaultFieldTypes?.updatedAt ?? "String" /* String */,
|
|
15588
15679
|
directives: []
|
|
15589
15680
|
}
|
|
15590
15681
|
];
|
|
@@ -15652,6 +15743,885 @@ function build(schema) {
|
|
|
15652
15743
|
return finalSchema;
|
|
15653
15744
|
}
|
|
15654
15745
|
|
|
15746
|
+
// ../declarations/src/flows/schemas/batch-create-type.schema.ts
|
|
15747
|
+
var paramsSchema = external_exports.object({
|
|
15748
|
+
ofType: external_exports.string(),
|
|
15749
|
+
namespace: external_exports.string(),
|
|
15750
|
+
input: external_exports.array(
|
|
15751
|
+
external_exports.object({
|
|
15752
|
+
id: external_exports.string(),
|
|
15753
|
+
fields: external_exports.looseObject({}).optional(),
|
|
15754
|
+
directives: external_exports.array(external_exports.string()).optional(),
|
|
15755
|
+
connections: external_exports.object({
|
|
15756
|
+
first: external_exports.object({
|
|
15757
|
+
with: external_exports.string(),
|
|
15758
|
+
link: external_exports.string()
|
|
15759
|
+
}).optional(),
|
|
15760
|
+
second: external_exports.object({
|
|
15761
|
+
with: external_exports.string(),
|
|
15762
|
+
link: external_exports.string()
|
|
15763
|
+
}).optional()
|
|
15764
|
+
}).optional()
|
|
15765
|
+
})
|
|
15766
|
+
),
|
|
15767
|
+
dynamicArgs: external_exports.looseObject({}).optional()
|
|
15768
|
+
});
|
|
15769
|
+
var resultSchema = external_exports.record(
|
|
15770
|
+
external_exports.string(),
|
|
15771
|
+
external_exports.object({
|
|
15772
|
+
id: external_exports.string(),
|
|
15773
|
+
createdAt: external_exports.string(),
|
|
15774
|
+
updatedAt: external_exports.string(),
|
|
15775
|
+
ofType: external_exports.string(),
|
|
15776
|
+
fields: external_exports.looseObject({}),
|
|
15777
|
+
namespace: external_exports.string(),
|
|
15778
|
+
directives: external_exports.array(external_exports.string())
|
|
15779
|
+
})
|
|
15780
|
+
);
|
|
15781
|
+
var batchCreateTypeSchema = {
|
|
15782
|
+
params: paramsSchema,
|
|
15783
|
+
result: resultSchema
|
|
15784
|
+
};
|
|
15785
|
+
|
|
15786
|
+
// ../declarations/src/flows/schemas/batch-get-type.schema.ts
|
|
15787
|
+
var paramsSchema2 = external_exports.object({
|
|
15788
|
+
ids: external_exports.array(external_exports.string()),
|
|
15789
|
+
ofType: external_exports.string(),
|
|
15790
|
+
namespace: external_exports.string().optional(),
|
|
15791
|
+
dynamicArgs: external_exports.looseObject({}).optional()
|
|
15792
|
+
});
|
|
15793
|
+
var resultSchema2 = external_exports.record(
|
|
15794
|
+
external_exports.string(),
|
|
15795
|
+
external_exports.object({
|
|
15796
|
+
id: external_exports.string(),
|
|
15797
|
+
createdAt: external_exports.string(),
|
|
15798
|
+
updatedAt: external_exports.string(),
|
|
15799
|
+
ofType: external_exports.string(),
|
|
15800
|
+
fields: external_exports.looseObject({}),
|
|
15801
|
+
namespace: external_exports.string(),
|
|
15802
|
+
directives: external_exports.array(external_exports.string())
|
|
15803
|
+
})
|
|
15804
|
+
);
|
|
15805
|
+
var batchGetTypeSchema = {
|
|
15806
|
+
params: paramsSchema2,
|
|
15807
|
+
result: resultSchema2
|
|
15808
|
+
};
|
|
15809
|
+
|
|
15810
|
+
// ../declarations/src/flows/schemas/cloud-function-type.schema.ts
|
|
15811
|
+
var paramsSchema3 = external_exports.looseObject({
|
|
15812
|
+
cloudFunctionUrl: external_exports.string()
|
|
15813
|
+
});
|
|
15814
|
+
var resultSchema3 = external_exports.discriminatedUnion("type", [
|
|
15815
|
+
external_exports.object({
|
|
15816
|
+
type: external_exports.literal("success"),
|
|
15817
|
+
status: external_exports.number().optional(),
|
|
15818
|
+
headers: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
15819
|
+
body: external_exports.union([external_exports.string(), external_exports.looseObject({}), external_exports.array(external_exports.any())]).optional(),
|
|
15820
|
+
statusText: external_exports.string().optional()
|
|
15821
|
+
}),
|
|
15822
|
+
external_exports.object({
|
|
15823
|
+
type: external_exports.literal("error"),
|
|
15824
|
+
content: external_exports.string()
|
|
15825
|
+
})
|
|
15826
|
+
]);
|
|
15827
|
+
var cloudFunctionTypeSchema = {
|
|
15828
|
+
params: paramsSchema3,
|
|
15829
|
+
result: resultSchema3
|
|
15830
|
+
};
|
|
15831
|
+
|
|
15832
|
+
// ../declarations/src/flows/schemas/create-type.schema.ts
|
|
15833
|
+
var paramsSchema4 = external_exports.object({
|
|
15834
|
+
id: external_exports.string().optional(),
|
|
15835
|
+
ofType: external_exports.string(),
|
|
15836
|
+
fields: external_exports.looseObject({}).optional(),
|
|
15837
|
+
namespace: external_exports.string().optional(),
|
|
15838
|
+
directives: external_exports.array(external_exports.string()).optional(),
|
|
15839
|
+
connections: external_exports.looseObject({}).optional(),
|
|
15840
|
+
dynamicArgs: external_exports.looseObject({}).optional()
|
|
15841
|
+
});
|
|
15842
|
+
var resultSchema4 = external_exports.object({
|
|
15843
|
+
id: external_exports.string(),
|
|
15844
|
+
createdAt: external_exports.string(),
|
|
15845
|
+
updatedAt: external_exports.string(),
|
|
15846
|
+
ofType: external_exports.string(),
|
|
15847
|
+
fields: external_exports.looseObject({}),
|
|
15848
|
+
namespace: external_exports.string(),
|
|
15849
|
+
directives: external_exports.array(external_exports.string()),
|
|
15850
|
+
connections: external_exports.looseObject({}).optional()
|
|
15851
|
+
});
|
|
15852
|
+
var createTypeSchema = {
|
|
15853
|
+
params: paramsSchema4,
|
|
15854
|
+
result: resultSchema4
|
|
15855
|
+
};
|
|
15856
|
+
|
|
15857
|
+
// ../declarations/src/flows/schemas/delete-type.schema.ts
|
|
15858
|
+
var paramsSchema5 = external_exports.object({
|
|
15859
|
+
id: external_exports.string(),
|
|
15860
|
+
ofType: external_exports.string(),
|
|
15861
|
+
namespace: external_exports.string().optional(),
|
|
15862
|
+
dynamicArgs: external_exports.looseObject({}).optional()
|
|
15863
|
+
});
|
|
15864
|
+
var resultSchema5 = external_exports.object({
|
|
15865
|
+
id: external_exports.string(),
|
|
15866
|
+
createdAt: external_exports.string(),
|
|
15867
|
+
updatedAt: external_exports.string(),
|
|
15868
|
+
fields: external_exports.looseObject({})
|
|
15869
|
+
});
|
|
15870
|
+
var deleteTypeSchema = {
|
|
15871
|
+
params: paramsSchema5,
|
|
15872
|
+
result: resultSchema5
|
|
15873
|
+
};
|
|
15874
|
+
|
|
15875
|
+
// ../declarations/src/flows/schemas/elevenlabs-tts.schema.ts
|
|
15876
|
+
var paramsSchema6 = external_exports.object({
|
|
15877
|
+
text: external_exports.string(),
|
|
15878
|
+
model: external_exports.string().meta({
|
|
15879
|
+
type: "string",
|
|
15880
|
+
format: "looseEnum",
|
|
15881
|
+
values: [
|
|
15882
|
+
"eleven_monolingual_v1",
|
|
15883
|
+
"eleven_multilingual_v1",
|
|
15884
|
+
"eleven_multilingual_v2",
|
|
15885
|
+
"eleven_turbo_v2",
|
|
15886
|
+
"eleven_turbo_v2_5",
|
|
15887
|
+
"eleven_flash_v2",
|
|
15888
|
+
"eleven_flash_v2_5"
|
|
15889
|
+
]
|
|
15890
|
+
}).optional(),
|
|
15891
|
+
stream: external_exports.boolean().optional(),
|
|
15892
|
+
outputFormat: external_exports.string().optional(),
|
|
15893
|
+
voiceId: external_exports.string().optional(),
|
|
15894
|
+
apiKey: external_exports.string().optional(),
|
|
15895
|
+
similarityBoost: external_exports.number().optional(),
|
|
15896
|
+
stability: external_exports.number().optional(),
|
|
15897
|
+
style: external_exports.number().optional()
|
|
15898
|
+
});
|
|
15899
|
+
var errorResultSchema = external_exports.object({
|
|
15900
|
+
type: external_exports.literal("error"),
|
|
15901
|
+
value: external_exports.string().optional()
|
|
15902
|
+
});
|
|
15903
|
+
var characterStartTimeSchema = external_exports.object({
|
|
15904
|
+
c: external_exports.string(),
|
|
15905
|
+
s: external_exports.number()
|
|
15906
|
+
});
|
|
15907
|
+
var successResultSchema = external_exports.object({
|
|
15908
|
+
type: external_exports.literal("success"),
|
|
15909
|
+
url: external_exports.string(),
|
|
15910
|
+
key: external_exports.string(),
|
|
15911
|
+
mimeType: external_exports.string(),
|
|
15912
|
+
durationSeconds: external_exports.number(),
|
|
15913
|
+
characterStartTimes: external_exports.array(characterStartTimeSchema)
|
|
15914
|
+
});
|
|
15915
|
+
var streamResultSchema = external_exports.object({
|
|
15916
|
+
type: external_exports.literal("stream"),
|
|
15917
|
+
data: external_exports.string(),
|
|
15918
|
+
characterStartTimes: external_exports.array(characterStartTimeSchema),
|
|
15919
|
+
index: external_exports.number()
|
|
15920
|
+
});
|
|
15921
|
+
var resultSchema6 = external_exports.union([
|
|
15922
|
+
errorResultSchema,
|
|
15923
|
+
successResultSchema,
|
|
15924
|
+
streamResultSchema
|
|
15925
|
+
]);
|
|
15926
|
+
var elevenlabsTTSSchema = {
|
|
15927
|
+
params: paramsSchema6,
|
|
15928
|
+
result: resultSchema6
|
|
15929
|
+
};
|
|
15930
|
+
|
|
15931
|
+
// ../declarations/src/flows/schemas/extract-image-metadata.schema.ts
|
|
15932
|
+
var paramsSchema7 = external_exports.object({
|
|
15933
|
+
url: external_exports.string().optional()
|
|
15934
|
+
});
|
|
15935
|
+
var resultSchema7 = external_exports.object({
|
|
15936
|
+
"Bits Per Sample": external_exports.string().optional(),
|
|
15937
|
+
"Image Height": external_exports.string().regex(/^[0-9]+px$/),
|
|
15938
|
+
"Image Width": external_exports.string().regex(/^[0-9]+px$/),
|
|
15939
|
+
"Color Components": external_exports.string(),
|
|
15940
|
+
Subsampling: external_exports.string().optional(),
|
|
15941
|
+
"JFIF Version": external_exports.string().optional(),
|
|
15942
|
+
"Resolution Unit": external_exports.string().optional(),
|
|
15943
|
+
XResolution: external_exports.string().optional(),
|
|
15944
|
+
YResolution: external_exports.string().optional(),
|
|
15945
|
+
"JFIF Thumbnail Width": external_exports.string().regex(/^[0-9]+px$/).optional(),
|
|
15946
|
+
"JFIF Thumbnail Height": external_exports.string().regex(/^[0-9]+px$/).optional(),
|
|
15947
|
+
ImageDescription: external_exports.string().optional(),
|
|
15948
|
+
ResolutionUnit: external_exports.string().optional(),
|
|
15949
|
+
YCbCrPositioning: external_exports.string().optional(),
|
|
15950
|
+
"Exif IFD Pointer": external_exports.number().optional(),
|
|
15951
|
+
XPTitle: external_exports.string().optional(),
|
|
15952
|
+
XPKeywords: external_exports.string().optional(),
|
|
15953
|
+
XPSubject: external_exports.string().optional(),
|
|
15954
|
+
ExifVersion: external_exports.string().optional(),
|
|
15955
|
+
ComponentsConfiguration: external_exports.string().optional(),
|
|
15956
|
+
UserComment: external_exports.string().optional(),
|
|
15957
|
+
FlashpixVersion: external_exports.string().optional(),
|
|
15958
|
+
ColorSpace: external_exports.string().optional(),
|
|
15959
|
+
"Model Version": external_exports.string().optional(),
|
|
15960
|
+
"Coded Character Set": external_exports.string().optional(),
|
|
15961
|
+
"Object Name": external_exports.string().optional(),
|
|
15962
|
+
Keywords: external_exports.array(external_exports.string()).optional(),
|
|
15963
|
+
"Country/Primary Location Name": external_exports.string().optional(),
|
|
15964
|
+
Headline: external_exports.string().optional(),
|
|
15965
|
+
Credit: external_exports.string().optional(),
|
|
15966
|
+
Source: external_exports.string().optional(),
|
|
15967
|
+
"Caption/Abstract": external_exports.string().optional(),
|
|
15968
|
+
"Record Version": external_exports.string().optional(),
|
|
15969
|
+
about: external_exports.string().optional(),
|
|
15970
|
+
LastKeywordXMP: external_exports.string().optional(),
|
|
15971
|
+
description: external_exports.string().optional(),
|
|
15972
|
+
subject: external_exports.string().optional(),
|
|
15973
|
+
title: external_exports.string().optional(),
|
|
15974
|
+
creditLine: external_exports.string().optional(),
|
|
15975
|
+
BitsPerSample: external_exports.string().optional(),
|
|
15976
|
+
ImageLength: external_exports.string().optional(),
|
|
15977
|
+
ImageWidth: external_exports.string().optional(),
|
|
15978
|
+
YCbCrSubSampling: external_exports.string().optional(),
|
|
15979
|
+
FileType: external_exports.string()
|
|
15980
|
+
});
|
|
15981
|
+
var extractImageMetadataSchema = {
|
|
15982
|
+
params: paramsSchema7,
|
|
15983
|
+
result: resultSchema7
|
|
15984
|
+
};
|
|
15985
|
+
|
|
15986
|
+
// ../declarations/src/flows/schemas/generic-ai-step.schema.ts
|
|
15987
|
+
var systemMessageSchema = zod_default.object({
|
|
15988
|
+
role: zod_default.literal("system"),
|
|
15989
|
+
content: zod_default.string(),
|
|
15990
|
+
providerOptions: zod_default.record(zod_default.string(), zod_default.any()).optional()
|
|
15991
|
+
});
|
|
15992
|
+
var userMessageContentTextPartSchema = zod_default.object({
|
|
15993
|
+
type: zod_default.literal("text"),
|
|
15994
|
+
text: zod_default.string(),
|
|
15995
|
+
providerOptions: zod_default.record(zod_default.string(), zod_default.any()).optional()
|
|
15996
|
+
});
|
|
15997
|
+
var userMessageContentImagePartSchema = zod_default.object({
|
|
15998
|
+
type: zod_default.literal("image"),
|
|
15999
|
+
imageUrl: zod_default.string(),
|
|
16000
|
+
mimeType: zod_default.string().optional(),
|
|
16001
|
+
providerOptions: zod_default.record(zod_default.string(), zod_default.any()).optional()
|
|
16002
|
+
});
|
|
16003
|
+
var userMessageContentFilePartSchema = zod_default.object({
|
|
16004
|
+
type: zod_default.literal("file"),
|
|
16005
|
+
fileUrl: zod_default.string(),
|
|
16006
|
+
filename: zod_default.string().optional(),
|
|
16007
|
+
mimeType: zod_default.string(),
|
|
16008
|
+
providerOptions: zod_default.record(zod_default.string(), zod_default.any()).optional()
|
|
16009
|
+
});
|
|
16010
|
+
var userMessageContentSchema = zod_default.union([
|
|
16011
|
+
userMessageContentTextPartSchema,
|
|
16012
|
+
userMessageContentImagePartSchema,
|
|
16013
|
+
userMessageContentFilePartSchema
|
|
16014
|
+
]);
|
|
16015
|
+
var userMessageSchema = zod_default.object({
|
|
16016
|
+
role: zod_default.literal("user"),
|
|
16017
|
+
content: zod_default.union([zod_default.string(), zod_default.array(userMessageContentSchema)]),
|
|
16018
|
+
providerOptions: zod_default.record(zod_default.string(), zod_default.any()).optional()
|
|
16019
|
+
});
|
|
16020
|
+
var assistantMessageContentTextPartSchema = zod_default.object({
|
|
16021
|
+
type: zod_default.literal("text"),
|
|
16022
|
+
text: zod_default.string(),
|
|
16023
|
+
providerOptions: zod_default.record(zod_default.string(), zod_default.any()).optional()
|
|
16024
|
+
});
|
|
16025
|
+
var assistantMessageToolCallPartSchema = zod_default.object({
|
|
16026
|
+
type: zod_default.literal("tool-call"),
|
|
16027
|
+
toolCallId: zod_default.string(),
|
|
16028
|
+
toolName: zod_default.string(),
|
|
16029
|
+
args: zod_default.any(),
|
|
16030
|
+
providerOptions: zod_default.record(zod_default.string(), zod_default.any()).optional()
|
|
16031
|
+
});
|
|
16032
|
+
var assistantMessageContentSchema = zod_default.union([
|
|
16033
|
+
assistantMessageContentTextPartSchema,
|
|
16034
|
+
assistantMessageToolCallPartSchema
|
|
16035
|
+
]);
|
|
16036
|
+
var assistantMessageSchema = zod_default.object({
|
|
16037
|
+
role: zod_default.literal("assistant"),
|
|
16038
|
+
content: zod_default.union([zod_default.string(), zod_default.array(assistantMessageContentSchema)]),
|
|
16039
|
+
providerOptions: zod_default.record(zod_default.string(), zod_default.any()).optional()
|
|
16040
|
+
});
|
|
16041
|
+
var toolMessageSchema = zod_default.object({
|
|
16042
|
+
role: zod_default.literal("tool"),
|
|
16043
|
+
content: zod_default.array(
|
|
16044
|
+
zod_default.object({
|
|
16045
|
+
type: zod_default.literal("tool-result"),
|
|
16046
|
+
toolCallId: zod_default.string(),
|
|
16047
|
+
toolName: zod_default.string(),
|
|
16048
|
+
result: zod_default.any()
|
|
16049
|
+
})
|
|
16050
|
+
)
|
|
16051
|
+
});
|
|
16052
|
+
var messageSchema = zod_default.union([
|
|
16053
|
+
systemMessageSchema,
|
|
16054
|
+
userMessageSchema,
|
|
16055
|
+
assistantMessageSchema,
|
|
16056
|
+
toolMessageSchema
|
|
16057
|
+
]);
|
|
16058
|
+
var toolSchema = zod_default.discriminatedUnion("type", [
|
|
16059
|
+
zod_default.object({
|
|
16060
|
+
description: zod_default.string().optional(),
|
|
16061
|
+
parameters: zod_default.any(),
|
|
16062
|
+
type: zod_default.literal("function")
|
|
16063
|
+
}),
|
|
16064
|
+
zod_default.object({
|
|
16065
|
+
type: zod_default.literal("provider-defined"),
|
|
16066
|
+
parameters: zod_default.any(),
|
|
16067
|
+
id: zod_default.string().regex(/^[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+$/),
|
|
16068
|
+
args: zod_default.record(zod_default.string(), zod_default.unknown())
|
|
16069
|
+
})
|
|
16070
|
+
]);
|
|
16071
|
+
var openAITextModelsSchema = zod_default.object({
|
|
16072
|
+
model: zod_default.string()
|
|
16073
|
+
});
|
|
16074
|
+
var anthropicTextModelsSchema = zod_default.object({
|
|
16075
|
+
model: zod_default.string()
|
|
16076
|
+
});
|
|
16077
|
+
var mistralTextModelsSchema = zod_default.object({
|
|
16078
|
+
model: zod_default.string()
|
|
16079
|
+
});
|
|
16080
|
+
var cohereTextModelsSchema = zod_default.object({
|
|
16081
|
+
model: zod_default.string()
|
|
16082
|
+
});
|
|
16083
|
+
var googleTextModelsSchema = zod_default.object({
|
|
16084
|
+
model: zod_default.string()
|
|
16085
|
+
});
|
|
16086
|
+
var openAIEmbedModelsSchema = zod_default.object({
|
|
16087
|
+
model: zod_default.string()
|
|
16088
|
+
});
|
|
16089
|
+
var anthropicEmbedModelsSchema = zod_default.object({
|
|
16090
|
+
model: zod_default.string()
|
|
16091
|
+
});
|
|
16092
|
+
var mistralEmbedModelsSchema = zod_default.object({
|
|
16093
|
+
model: zod_default.string()
|
|
16094
|
+
});
|
|
16095
|
+
var cohereEmbedModelsSchema = zod_default.object({
|
|
16096
|
+
model: zod_default.string()
|
|
16097
|
+
});
|
|
16098
|
+
var googleEmbedModelsSchema = zod_default.object({
|
|
16099
|
+
model: zod_default.string()
|
|
16100
|
+
});
|
|
16101
|
+
var openaiProviderSchema = zod_default.object({
|
|
16102
|
+
provider: zod_default.literal("openai")
|
|
16103
|
+
});
|
|
16104
|
+
var anthropicProviderSchema = zod_default.object({
|
|
16105
|
+
provider: zod_default.literal("anthropic")
|
|
16106
|
+
});
|
|
16107
|
+
var mistralProviderSchema = zod_default.object({
|
|
16108
|
+
provider: zod_default.literal("mistral")
|
|
16109
|
+
});
|
|
16110
|
+
var cohereProviderSchema = zod_default.object({
|
|
16111
|
+
provider: zod_default.literal("cohere")
|
|
16112
|
+
});
|
|
16113
|
+
var googleProviderSchema = zod_default.object({
|
|
16114
|
+
provider: zod_default.literal("google")
|
|
16115
|
+
});
|
|
16116
|
+
var sharedParamsSchema = zod_default.object({
|
|
16117
|
+
apiKey: zod_default.string(),
|
|
16118
|
+
temperature: zod_default.number().optional()
|
|
16119
|
+
});
|
|
16120
|
+
var generateTextParamsSchema = zod_default.object({
|
|
16121
|
+
operation: zod_default.literal("generateText")
|
|
16122
|
+
});
|
|
16123
|
+
var generateObjectParamsSchema = zod_default.object({
|
|
16124
|
+
operation: zod_default.literal("generateObject")
|
|
16125
|
+
});
|
|
16126
|
+
var streamTextParamsSchema = zod_default.object({
|
|
16127
|
+
operation: zod_default.literal("streamText")
|
|
16128
|
+
});
|
|
16129
|
+
var embedParamsSchema = zod_default.object({
|
|
16130
|
+
operation: zod_default.literal("embed")
|
|
16131
|
+
});
|
|
16132
|
+
var textModelsSchema = zod_default.object({
|
|
16133
|
+
model: zod_default.discriminatedUnion("provider", [
|
|
16134
|
+
openaiProviderSchema.merge(openAITextModelsSchema),
|
|
16135
|
+
anthropicProviderSchema.merge(anthropicTextModelsSchema),
|
|
16136
|
+
mistralProviderSchema.merge(mistralTextModelsSchema),
|
|
16137
|
+
cohereProviderSchema.merge(cohereTextModelsSchema),
|
|
16138
|
+
googleProviderSchema.merge(googleTextModelsSchema)
|
|
16139
|
+
])
|
|
16140
|
+
});
|
|
16141
|
+
var embedModelsSchema = zod_default.object({
|
|
16142
|
+
model: zod_default.discriminatedUnion("provider", [
|
|
16143
|
+
openaiProviderSchema.merge(openAIEmbedModelsSchema),
|
|
16144
|
+
anthropicProviderSchema.merge(anthropicEmbedModelsSchema),
|
|
16145
|
+
mistralProviderSchema.merge(mistralEmbedModelsSchema),
|
|
16146
|
+
cohereProviderSchema.merge(cohereEmbedModelsSchema),
|
|
16147
|
+
googleProviderSchema.merge(googleEmbedModelsSchema)
|
|
16148
|
+
])
|
|
16149
|
+
});
|
|
16150
|
+
var fullStreamTextParamsSchema = streamTextParamsSchema.extend({
|
|
16151
|
+
...sharedParamsSchema.shape,
|
|
16152
|
+
...textModelsSchema.shape,
|
|
16153
|
+
messages: zod_default.array(messageSchema).optional().describe("jsOnly"),
|
|
16154
|
+
system: zod_default.string().optional(),
|
|
16155
|
+
prompt: zod_default.string().optional(),
|
|
16156
|
+
tools: zod_default.record(zod_default.string(), toolSchema).describe("jsOnly"),
|
|
16157
|
+
toolChoice: zod_default.enum(["auto", "required", "none"]).optional(),
|
|
16158
|
+
providerOptions: zod_default.record(zod_default.string(), zod_default.any()).optional()
|
|
16159
|
+
});
|
|
16160
|
+
var paramsSchema8 = zod_default.discriminatedUnion("operation", [
|
|
16161
|
+
generateObjectParamsSchema.merge(sharedParamsSchema).merge(textModelsSchema).extend({
|
|
16162
|
+
prompt: zod_default.string(),
|
|
16163
|
+
schema: zod_default.any().describe("jsOnly"),
|
|
16164
|
+
providerOptions: zod_default.record(zod_default.string(), zod_default.any()).optional()
|
|
16165
|
+
}),
|
|
16166
|
+
generateTextParamsSchema.merge(sharedParamsSchema).merge(textModelsSchema).extend({
|
|
16167
|
+
messages: zod_default.array(messageSchema).optional().describe("jsOnly"),
|
|
16168
|
+
system: zod_default.string().optional(),
|
|
16169
|
+
prompt: zod_default.string().optional(),
|
|
16170
|
+
tools: zod_default.record(zod_default.string(), toolSchema).describe("jsOnly"),
|
|
16171
|
+
toolChoice: zod_default.enum(["auto", "required", "none"]).optional(),
|
|
16172
|
+
providerOptions: zod_default.record(zod_default.string(), zod_default.any()).optional()
|
|
16173
|
+
}),
|
|
16174
|
+
fullStreamTextParamsSchema,
|
|
16175
|
+
embedParamsSchema.merge(sharedParamsSchema).merge(embedModelsSchema).extend({
|
|
16176
|
+
value: zod_default.string()
|
|
16177
|
+
})
|
|
16178
|
+
]);
|
|
16179
|
+
var paramsNestedSchemas = {
|
|
16180
|
+
messages: messageSchema,
|
|
16181
|
+
userMessageContent: userMessageContentSchema,
|
|
16182
|
+
userMessage: userMessageSchema,
|
|
16183
|
+
message: messageSchema,
|
|
16184
|
+
tool: toolSchema,
|
|
16185
|
+
userMessageContentTextPart: userMessageContentTextPartSchema,
|
|
16186
|
+
userMessageContentImagePart: userMessageContentImagePartSchema,
|
|
16187
|
+
userMessageContentFilePart: userMessageContentFilePartSchema,
|
|
16188
|
+
assistantMessageContent: assistantMessageContentSchema,
|
|
16189
|
+
assistantMessage: assistantMessageSchema,
|
|
16190
|
+
assistantMessageContentTextPart: assistantMessageContentTextPartSchema,
|
|
16191
|
+
assistantMessageToolCallPart: assistantMessageToolCallPartSchema,
|
|
16192
|
+
toolMessage: toolMessageSchema
|
|
16193
|
+
};
|
|
16194
|
+
var resultSchema8 = zod_default.discriminatedUnion("type", [
|
|
16195
|
+
zod_default.object({
|
|
16196
|
+
type: zod_default.literal("result"),
|
|
16197
|
+
value: zod_default.object({
|
|
16198
|
+
reasoning: zod_default.string().optional(),
|
|
16199
|
+
text: zod_default.string(),
|
|
16200
|
+
toolCalls: zod_default.array(
|
|
16201
|
+
zod_default.object({
|
|
16202
|
+
type: zod_default.enum(["function", "tool-call"]),
|
|
16203
|
+
toolName: zod_default.string(),
|
|
16204
|
+
toolCallId: zod_default.string(),
|
|
16205
|
+
id: zod_default.string().optional(),
|
|
16206
|
+
args: zod_default.any().optional()
|
|
16207
|
+
})
|
|
16208
|
+
)
|
|
16209
|
+
})
|
|
16210
|
+
}),
|
|
16211
|
+
zod_default.object({
|
|
16212
|
+
type: zod_default.literal("objectResult"),
|
|
16213
|
+
value: zod_default.any()
|
|
16214
|
+
}),
|
|
16215
|
+
zod_default.object({
|
|
16216
|
+
type: zod_default.literal("streamChunk"),
|
|
16217
|
+
value: zod_default.string()
|
|
16218
|
+
}),
|
|
16219
|
+
zod_default.object({
|
|
16220
|
+
type: zod_default.literal("streamResult"),
|
|
16221
|
+
value: zod_default.object({
|
|
16222
|
+
text: zod_default.string(),
|
|
16223
|
+
toolCalls: zod_default.array(
|
|
16224
|
+
zod_default.object({
|
|
16225
|
+
type: zod_default.enum(["function", "tool-call"]),
|
|
16226
|
+
toolName: zod_default.string(),
|
|
16227
|
+
toolCallId: zod_default.string(),
|
|
16228
|
+
id: zod_default.string().optional(),
|
|
16229
|
+
args: zod_default.any()
|
|
16230
|
+
})
|
|
16231
|
+
)
|
|
16232
|
+
})
|
|
16233
|
+
}),
|
|
16234
|
+
zod_default.object({
|
|
16235
|
+
type: zod_default.literal("embeddingResult"),
|
|
16236
|
+
value: zod_default.array(zod_default.number())
|
|
16237
|
+
}),
|
|
16238
|
+
zod_default.object({
|
|
16239
|
+
type: zod_default.literal("error"),
|
|
16240
|
+
error: zod_default.string()
|
|
16241
|
+
})
|
|
16242
|
+
]);
|
|
16243
|
+
var genericAIStepSchema = {
|
|
16244
|
+
params: paramsSchema8,
|
|
16245
|
+
result: resultSchema8,
|
|
16246
|
+
paramsNestedSchemas,
|
|
16247
|
+
fullStreamTextParamsSchema
|
|
16248
|
+
};
|
|
16249
|
+
|
|
16250
|
+
// ../declarations/src/flows/schemas/google-search.schema.ts
|
|
16251
|
+
var paramsSchema9 = external_exports.object({
|
|
16252
|
+
searchTerms: external_exports.string(),
|
|
16253
|
+
searchEngineId: external_exports.string().optional(),
|
|
16254
|
+
lang: external_exports.enum([
|
|
16255
|
+
"lang_ar",
|
|
16256
|
+
"lang_bg",
|
|
16257
|
+
"lang_ca",
|
|
16258
|
+
"lang_cs",
|
|
16259
|
+
"lang_da",
|
|
16260
|
+
"lang_de",
|
|
16261
|
+
"lang_el",
|
|
16262
|
+
"lang_en",
|
|
16263
|
+
"lang_es",
|
|
16264
|
+
"lang_et",
|
|
16265
|
+
"lang_fi",
|
|
16266
|
+
"lang_fr",
|
|
16267
|
+
"lang_hr",
|
|
16268
|
+
"lang_hu",
|
|
16269
|
+
"lang_id",
|
|
16270
|
+
"lang_is",
|
|
16271
|
+
"lang_it",
|
|
16272
|
+
"lang_iw",
|
|
16273
|
+
"lang_ja",
|
|
16274
|
+
"lang_ko",
|
|
16275
|
+
"lang_lt",
|
|
16276
|
+
"lang_lv",
|
|
16277
|
+
"lang_nl",
|
|
16278
|
+
"lang_no",
|
|
16279
|
+
"lang_pl",
|
|
16280
|
+
"lang_pt",
|
|
16281
|
+
"lang_ro",
|
|
16282
|
+
"lang_ru",
|
|
16283
|
+
"lang_sk",
|
|
16284
|
+
"lang_sl",
|
|
16285
|
+
"lang_sr",
|
|
16286
|
+
"lang_sv",
|
|
16287
|
+
"lang_tr",
|
|
16288
|
+
"lang_zh-CN",
|
|
16289
|
+
"lang_zh-TW"
|
|
16290
|
+
]).optional(),
|
|
16291
|
+
apiKey: external_exports.string().optional(),
|
|
16292
|
+
numOfResults: external_exports.number().int().optional(),
|
|
16293
|
+
searchType: external_exports.enum(["image"]).optional(),
|
|
16294
|
+
siteSearch: external_exports.string().optional(),
|
|
16295
|
+
siteSearchFilter: external_exports.enum(["exclude", "include"]).optional(),
|
|
16296
|
+
dateRestrict: external_exports.string().optional()
|
|
16297
|
+
});
|
|
16298
|
+
var metatagSchema = external_exports.record(external_exports.string(), external_exports.string());
|
|
16299
|
+
var websiteResponseSchema = external_exports.object({
|
|
16300
|
+
title: external_exports.string(),
|
|
16301
|
+
link: external_exports.string(),
|
|
16302
|
+
snippet: external_exports.string(),
|
|
16303
|
+
metatags: external_exports.array(metatagSchema).optional()
|
|
16304
|
+
});
|
|
16305
|
+
var imageResponseSchema = external_exports.object({
|
|
16306
|
+
title: external_exports.string().optional(),
|
|
16307
|
+
link: external_exports.string().optional(),
|
|
16308
|
+
snippet: external_exports.string().optional(),
|
|
16309
|
+
mime: external_exports.string().optional(),
|
|
16310
|
+
image: external_exports.object({
|
|
16311
|
+
contextLink: external_exports.string(),
|
|
16312
|
+
height: external_exports.number().int().optional(),
|
|
16313
|
+
width: external_exports.number().int().optional(),
|
|
16314
|
+
byteSize: external_exports.number().int().optional(),
|
|
16315
|
+
thumbnailLink: external_exports.string().optional(),
|
|
16316
|
+
thumbnailHeight: external_exports.number().int().optional(),
|
|
16317
|
+
thumbnailWidth: external_exports.number().int().optional()
|
|
16318
|
+
}).optional()
|
|
16319
|
+
});
|
|
16320
|
+
var resultSchema9 = external_exports.union([
|
|
16321
|
+
external_exports.array(websiteResponseSchema),
|
|
16322
|
+
external_exports.array(imageResponseSchema)
|
|
16323
|
+
]);
|
|
16324
|
+
var googleSearchSchema = {
|
|
16325
|
+
params: paramsSchema9,
|
|
16326
|
+
result: resultSchema9
|
|
16327
|
+
};
|
|
16328
|
+
|
|
16329
|
+
// ../declarations/src/flows/schemas/html-to-pdf.schema.ts
|
|
16330
|
+
var paramsSchema10 = external_exports.object({
|
|
16331
|
+
htmlString: external_exports.string(),
|
|
16332
|
+
outputFilename: external_exports.string().optional(),
|
|
16333
|
+
format: external_exports.enum([
|
|
16334
|
+
"letter",
|
|
16335
|
+
"legal",
|
|
16336
|
+
"tabloid",
|
|
16337
|
+
"ledger",
|
|
16338
|
+
"a0",
|
|
16339
|
+
"a1",
|
|
16340
|
+
"a2",
|
|
16341
|
+
"a3",
|
|
16342
|
+
"a4",
|
|
16343
|
+
"a5",
|
|
16344
|
+
"a6"
|
|
16345
|
+
]).optional(),
|
|
16346
|
+
margin: external_exports.object({
|
|
16347
|
+
top: external_exports.string().optional(),
|
|
16348
|
+
right: external_exports.string().optional(),
|
|
16349
|
+
bottom: external_exports.string().optional(),
|
|
16350
|
+
left: external_exports.string().optional()
|
|
16351
|
+
}).optional()
|
|
16352
|
+
});
|
|
16353
|
+
var errorResultSchema2 = external_exports.object({
|
|
16354
|
+
type: external_exports.literal("error"),
|
|
16355
|
+
value: external_exports.string().optional()
|
|
16356
|
+
});
|
|
16357
|
+
var successResultSchema2 = external_exports.object({
|
|
16358
|
+
type: external_exports.literal("success"),
|
|
16359
|
+
url: external_exports.string(),
|
|
16360
|
+
key: external_exports.string(),
|
|
16361
|
+
mimeType: external_exports.string()
|
|
16362
|
+
});
|
|
16363
|
+
var resultSchema10 = external_exports.union([errorResultSchema2, successResultSchema2]);
|
|
16364
|
+
var htmlToPdfSchema = {
|
|
16365
|
+
params: paramsSchema10,
|
|
16366
|
+
result: resultSchema10
|
|
16367
|
+
};
|
|
16368
|
+
|
|
16369
|
+
// ../declarations/src/flows/schemas/http-request.schema.ts
|
|
16370
|
+
var urlSchema = external_exports.url();
|
|
16371
|
+
var parametersSchema = external_exports.record(external_exports.string(), external_exports.string());
|
|
16372
|
+
var headersSchema = external_exports.record(external_exports.string(), external_exports.string());
|
|
16373
|
+
var contentMediaTypeSchema = external_exports.enum([
|
|
16374
|
+
"application/json",
|
|
16375
|
+
"text/plain",
|
|
16376
|
+
"application/xml",
|
|
16377
|
+
"application/x-www-form-urlencoded",
|
|
16378
|
+
"multipart/form-data"
|
|
16379
|
+
]);
|
|
16380
|
+
var getDeleteParamsSchema = external_exports.object({
|
|
16381
|
+
httpMethod: external_exports.enum(["GET", "DELETE"]),
|
|
16382
|
+
url: urlSchema,
|
|
16383
|
+
parameters: parametersSchema.optional(),
|
|
16384
|
+
headers: headersSchema.optional(),
|
|
16385
|
+
contentMediaType: contentMediaTypeSchema.optional()
|
|
16386
|
+
});
|
|
16387
|
+
var postPutPatchParamsSchema = external_exports.object({
|
|
16388
|
+
httpMethod: external_exports.enum(["POST", "PUT", "PATCH"]),
|
|
16389
|
+
url: urlSchema,
|
|
16390
|
+
parameters: parametersSchema.optional(),
|
|
16391
|
+
headers: headersSchema.optional(),
|
|
16392
|
+
contentMediaType: contentMediaTypeSchema.optional(),
|
|
16393
|
+
body: external_exports.string()
|
|
16394
|
+
});
|
|
16395
|
+
var paramsSchema11 = external_exports.discriminatedUnion("httpMethod", [
|
|
16396
|
+
getDeleteParamsSchema,
|
|
16397
|
+
postPutPatchParamsSchema
|
|
16398
|
+
]);
|
|
16399
|
+
var resultSchema11 = external_exports.discriminatedUnion("type", [
|
|
16400
|
+
external_exports.object({
|
|
16401
|
+
type: external_exports.literal("success"),
|
|
16402
|
+
status: external_exports.number().optional(),
|
|
16403
|
+
headers: headersSchema.optional(),
|
|
16404
|
+
body: external_exports.union([external_exports.string(), external_exports.looseObject({}), external_exports.array(external_exports.any())]).optional(),
|
|
16405
|
+
statusText: external_exports.string().optional()
|
|
16406
|
+
}),
|
|
16407
|
+
external_exports.object({
|
|
16408
|
+
type: external_exports.literal("error"),
|
|
16409
|
+
content: external_exports.string()
|
|
16410
|
+
})
|
|
16411
|
+
]);
|
|
16412
|
+
var httpRequestSchema = {
|
|
16413
|
+
params: paramsSchema11,
|
|
16414
|
+
result: resultSchema11
|
|
16415
|
+
};
|
|
16416
|
+
|
|
16417
|
+
// ../declarations/src/flows/schemas/link-scraper.schema.ts
|
|
16418
|
+
var paramsSchema12 = external_exports.object({
|
|
16419
|
+
websiteUrl: external_exports.string(),
|
|
16420
|
+
selectors: external_exports.string().optional(),
|
|
16421
|
+
resultType: external_exports.enum(["text", "html"]).optional(),
|
|
16422
|
+
numOfResults: external_exports.number().int().optional()
|
|
16423
|
+
});
|
|
16424
|
+
var resultSchema12 = external_exports.record(external_exports.string(), external_exports.array(external_exports.string()));
|
|
16425
|
+
var linkScraperSchema = {
|
|
16426
|
+
params: paramsSchema12,
|
|
16427
|
+
result: resultSchema12
|
|
16428
|
+
};
|
|
16429
|
+
|
|
16430
|
+
// ../declarations/src/flows/schemas/list-type-by-parent.schema.ts
|
|
16431
|
+
var paramsSchema13 = external_exports.object({
|
|
16432
|
+
ofType: external_exports.string(),
|
|
16433
|
+
parentType: external_exports.string(),
|
|
16434
|
+
limit: external_exports.number().optional(),
|
|
16435
|
+
nextToken: external_exports.string().nullable().optional(),
|
|
16436
|
+
parentId: external_exports.string(),
|
|
16437
|
+
parentKey: external_exports.enum(["SECOND", "FIRST"]),
|
|
16438
|
+
sortOrder: external_exports.enum(["ASC", "DESC"]).optional(),
|
|
16439
|
+
namespace: external_exports.string().optional(),
|
|
16440
|
+
dynamicArgs: external_exports.looseObject({}).optional()
|
|
16441
|
+
});
|
|
16442
|
+
var resultItemSchema = external_exports.object({
|
|
16443
|
+
id: external_exports.string(),
|
|
16444
|
+
createdAt: external_exports.string(),
|
|
16445
|
+
updatedAt: external_exports.string(),
|
|
16446
|
+
ofType: external_exports.string(),
|
|
16447
|
+
fields: external_exports.looseObject({}),
|
|
16448
|
+
namespace: external_exports.string(),
|
|
16449
|
+
directives: external_exports.array(external_exports.string())
|
|
16450
|
+
});
|
|
16451
|
+
var resultSchema13 = external_exports.object({
|
|
16452
|
+
nextToken: external_exports.string().nullable(),
|
|
16453
|
+
items: external_exports.array(resultItemSchema)
|
|
16454
|
+
});
|
|
16455
|
+
var listTypeByParentSchema = {
|
|
16456
|
+
params: paramsSchema13,
|
|
16457
|
+
result: resultSchema13
|
|
16458
|
+
};
|
|
16459
|
+
|
|
16460
|
+
// ../declarations/src/flows/schemas/list-type.schema.ts
|
|
16461
|
+
var paramsSchema14 = external_exports.object({
|
|
16462
|
+
ofType: external_exports.string(),
|
|
16463
|
+
limit: external_exports.number().optional(),
|
|
16464
|
+
nextToken: external_exports.string().optional(),
|
|
16465
|
+
sortOrder: external_exports.enum(["ASC", "DESC"]).optional(),
|
|
16466
|
+
namespace: external_exports.string().optional(),
|
|
16467
|
+
dynamicArgs: external_exports.looseObject({}).optional()
|
|
16468
|
+
});
|
|
16469
|
+
var resultItemSchema2 = external_exports.object({
|
|
16470
|
+
id: external_exports.string(),
|
|
16471
|
+
createdAt: external_exports.string(),
|
|
16472
|
+
updatedAt: external_exports.string(),
|
|
16473
|
+
ofType: external_exports.string(),
|
|
16474
|
+
fields: external_exports.looseObject({}),
|
|
16475
|
+
namespace: external_exports.string(),
|
|
16476
|
+
directives: external_exports.array(external_exports.string())
|
|
16477
|
+
});
|
|
16478
|
+
var resultSchema14 = external_exports.object({
|
|
16479
|
+
nextToken: external_exports.string().nullable(),
|
|
16480
|
+
items: external_exports.array(resultItemSchema2)
|
|
16481
|
+
});
|
|
16482
|
+
var listTypeSchema = {
|
|
16483
|
+
params: paramsSchema14,
|
|
16484
|
+
result: resultSchema14
|
|
16485
|
+
};
|
|
16486
|
+
|
|
16487
|
+
// ../declarations/src/flows/schemas/logic.schema.ts
|
|
16488
|
+
var paramsSchema15 = external_exports.looseObject({});
|
|
16489
|
+
var resultSchema15 = external_exports.looseObject({});
|
|
16490
|
+
var logicSchema = {
|
|
16491
|
+
params: paramsSchema15,
|
|
16492
|
+
result: resultSchema15
|
|
16493
|
+
};
|
|
16494
|
+
|
|
16495
|
+
// ../declarations/src/flows/schemas/notify-websocket.schema.ts
|
|
16496
|
+
var paramsSchema16 = external_exports.object({
|
|
16497
|
+
record: external_exports.object({
|
|
16498
|
+
id: external_exports.string().optional(),
|
|
16499
|
+
ofType: external_exports.string().optional(),
|
|
16500
|
+
namespace: external_exports.string().optional(),
|
|
16501
|
+
connections: external_exports.object({
|
|
16502
|
+
first: external_exports.object({
|
|
16503
|
+
with: external_exports.string(),
|
|
16504
|
+
link: external_exports.string()
|
|
16505
|
+
}).optional(),
|
|
16506
|
+
second: external_exports.object({
|
|
16507
|
+
with: external_exports.string(),
|
|
16508
|
+
link: external_exports.string()
|
|
16509
|
+
}).optional()
|
|
16510
|
+
}).optional()
|
|
16511
|
+
}).optional(),
|
|
16512
|
+
operation: external_exports.enum(["INSERT", "UPDATE", "DELETE"]).optional()
|
|
16513
|
+
});
|
|
16514
|
+
var resultSchema16 = external_exports.looseObject({});
|
|
16515
|
+
var notifyWebSocketSchema = {
|
|
16516
|
+
params: paramsSchema16,
|
|
16517
|
+
result: resultSchema16
|
|
16518
|
+
};
|
|
16519
|
+
|
|
16520
|
+
// ../declarations/src/flows/schemas/openai-image-generation.schema.ts
|
|
16521
|
+
var dallE3ParamsSchema = external_exports.object({
|
|
16522
|
+
model: external_exports.literal("dall-e-3"),
|
|
16523
|
+
prompt: external_exports.string(),
|
|
16524
|
+
quality: external_exports.enum(["standard", "hd"]).optional(),
|
|
16525
|
+
size: external_exports.enum(["1024x1024", "1792x1024", "1024x1792"]).optional(),
|
|
16526
|
+
style: external_exports.enum(["vivid", "natural"]).optional(),
|
|
16527
|
+
outputFilename: external_exports.string().optional(),
|
|
16528
|
+
apiKey: external_exports.string().optional()
|
|
16529
|
+
});
|
|
16530
|
+
var dallE2ParamsSchema = external_exports.object({
|
|
16531
|
+
model: external_exports.literal("dall-e-2"),
|
|
16532
|
+
prompt: external_exports.string(),
|
|
16533
|
+
size: external_exports.enum(["256x256", "512x512", "1024x1024"]).optional(),
|
|
16534
|
+
n: external_exports.literal([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).optional(),
|
|
16535
|
+
outputFilename: external_exports.string().optional(),
|
|
16536
|
+
apiKey: external_exports.string().optional()
|
|
16537
|
+
});
|
|
16538
|
+
var paramsSchema17 = external_exports.discriminatedUnion("model", [
|
|
16539
|
+
dallE3ParamsSchema,
|
|
16540
|
+
dallE2ParamsSchema
|
|
16541
|
+
]);
|
|
16542
|
+
var resultSuccessSchema = external_exports.object({
|
|
16543
|
+
type: external_exports.literal("result"),
|
|
16544
|
+
url: external_exports.string(),
|
|
16545
|
+
key: external_exports.string(),
|
|
16546
|
+
mimeType: external_exports.string()
|
|
16547
|
+
});
|
|
16548
|
+
var resultErrorSchema = external_exports.object({
|
|
16549
|
+
type: external_exports.literal("error"),
|
|
16550
|
+
value: external_exports.string()
|
|
16551
|
+
});
|
|
16552
|
+
var resultSchema17 = external_exports.union([resultSuccessSchema, resultErrorSchema]);
|
|
16553
|
+
var openAIImageGenerationSchema = {
|
|
16554
|
+
params: paramsSchema17,
|
|
16555
|
+
result: resultSchema17
|
|
16556
|
+
};
|
|
16557
|
+
|
|
16558
|
+
// ../declarations/src/flows/schemas/type.schema.ts
|
|
16559
|
+
var paramsSchema18 = external_exports.object({
|
|
16560
|
+
id: external_exports.string(),
|
|
16561
|
+
ofType: external_exports.string(),
|
|
16562
|
+
namespace: external_exports.string().optional(),
|
|
16563
|
+
dynamicArgs: external_exports.looseObject({}).optional()
|
|
16564
|
+
});
|
|
16565
|
+
var resultSchema18 = external_exports.object({
|
|
16566
|
+
id: external_exports.string(),
|
|
16567
|
+
createdAt: external_exports.string(),
|
|
16568
|
+
updatedAt: external_exports.string(),
|
|
16569
|
+
ofType: external_exports.string(),
|
|
16570
|
+
fields: external_exports.looseObject({}),
|
|
16571
|
+
namespace: external_exports.string(),
|
|
16572
|
+
directives: external_exports.array(external_exports.string())
|
|
16573
|
+
});
|
|
16574
|
+
var typeSchema = {
|
|
16575
|
+
params: paramsSchema18,
|
|
16576
|
+
result: resultSchema18
|
|
16577
|
+
};
|
|
16578
|
+
|
|
16579
|
+
// ../declarations/src/flows/schemas/update-type.schema.ts
|
|
16580
|
+
var paramsSchema19 = external_exports.object({
|
|
16581
|
+
id: external_exports.string(),
|
|
16582
|
+
ofType: external_exports.string(),
|
|
16583
|
+
fields: external_exports.looseObject({}).optional(),
|
|
16584
|
+
connections: external_exports.looseObject({}).optional(),
|
|
16585
|
+
namespace: external_exports.string().optional(),
|
|
16586
|
+
directives: external_exports.array(external_exports.string()).optional(),
|
|
16587
|
+
dynamicArgs: external_exports.looseObject({}).optional()
|
|
16588
|
+
});
|
|
16589
|
+
var resultSchema19 = external_exports.object({
|
|
16590
|
+
id: external_exports.string(),
|
|
16591
|
+
createdAt: external_exports.string(),
|
|
16592
|
+
updatedAt: external_exports.string(),
|
|
16593
|
+
ofType: external_exports.string(),
|
|
16594
|
+
fields: external_exports.looseObject({}),
|
|
16595
|
+
namespace: external_exports.string()
|
|
16596
|
+
});
|
|
16597
|
+
var updateTypeSchema = {
|
|
16598
|
+
params: paramsSchema19,
|
|
16599
|
+
result: resultSchema19
|
|
16600
|
+
};
|
|
16601
|
+
|
|
16602
|
+
// ../declarations/src/flows/schemas/index.ts
|
|
16603
|
+
var schemas = {
|
|
16604
|
+
batchCreateType: batchCreateTypeSchema,
|
|
16605
|
+
batchGetType: batchGetTypeSchema,
|
|
16606
|
+
createType: createTypeSchema,
|
|
16607
|
+
deleteType: deleteTypeSchema,
|
|
16608
|
+
elevenLabsTTS: elevenlabsTTSSchema,
|
|
16609
|
+
googleSearch: googleSearchSchema,
|
|
16610
|
+
htmlToPdf: htmlToPdfSchema,
|
|
16611
|
+
httpRequest: httpRequestSchema,
|
|
16612
|
+
logic: logicSchema,
|
|
16613
|
+
linkScraper: linkScraperSchema,
|
|
16614
|
+
listTypeByParent: listTypeByParentSchema,
|
|
16615
|
+
listType: listTypeSchema,
|
|
16616
|
+
notifyWebSocket: notifyWebSocketSchema,
|
|
16617
|
+
openAIImageGeneration: openAIImageGenerationSchema,
|
|
16618
|
+
type: typeSchema,
|
|
16619
|
+
updateType: updateTypeSchema,
|
|
16620
|
+
extractImageMetadata: extractImageMetadataSchema,
|
|
16621
|
+
cloudFunction: cloudFunctionTypeSchema,
|
|
16622
|
+
genericAI: genericAIStepSchema
|
|
16623
|
+
};
|
|
16624
|
+
|
|
15655
16625
|
// ../dsl-builders/src/apps/app-builder.ts
|
|
15656
16626
|
var app_builder_exports = {};
|
|
15657
16627
|
__export(app_builder_exports, {
|
|
@@ -21520,6 +22490,11 @@ function flattenBlocks(blocks, opts) {
|
|
|
21520
22490
|
}
|
|
21521
22491
|
|
|
21522
22492
|
// ../dsl-builders/src/apps/pages.ts
|
|
22493
|
+
function setPageVisibility(slugConfig, visibility) {
|
|
22494
|
+
if (visibility && visibility !== "public") {
|
|
22495
|
+
slugConfig.visibility = visibility;
|
|
22496
|
+
}
|
|
22497
|
+
}
|
|
21523
22498
|
var STATIC_SEGMENT_RE = /^[a-z0-9-]+$/;
|
|
21524
22499
|
var PARAM_SEGMENT_RE = /^\[([a-zA-Z][a-zA-Z0-9_]*)\]$/;
|
|
21525
22500
|
function isParamSegment(slug) {
|
|
@@ -21548,11 +22523,27 @@ function page(opts) {
|
|
|
21548
22523
|
slug: opts.slug,
|
|
21549
22524
|
parent: opts.parent,
|
|
21550
22525
|
params,
|
|
21551
|
-
defaultLocalization:
|
|
22526
|
+
defaultLocalization: mergeMetaIntoLocalization(
|
|
22527
|
+
opts.defaultLocalization,
|
|
22528
|
+
opts.meta
|
|
22529
|
+
),
|
|
21552
22530
|
localizedConfig: opts.localizedConfig,
|
|
22531
|
+
...opts.visibility ? { visibility: opts.visibility } : {},
|
|
21553
22532
|
blocks: opts.blocks ?? []
|
|
21554
22533
|
};
|
|
21555
22534
|
}
|
|
22535
|
+
function mergeMetaIntoLocalization(defaultLocalization, meta3) {
|
|
22536
|
+
if (!meta3) return defaultLocalization;
|
|
22537
|
+
const mergedMeta = {};
|
|
22538
|
+
const existingMeta = defaultLocalization?.meta;
|
|
22539
|
+
if (existingMeta && typeof existingMeta === "object" && !Array.isArray(existingMeta)) {
|
|
22540
|
+
Object.assign(mergedMeta, existingMeta);
|
|
22541
|
+
}
|
|
22542
|
+
for (const [key, value] of Object.entries(meta3)) {
|
|
22543
|
+
if (value !== void 0) mergedMeta[key] = value;
|
|
22544
|
+
}
|
|
22545
|
+
return { ...defaultLocalization, meta: mergedMeta };
|
|
22546
|
+
}
|
|
21556
22547
|
var SLUG_FIELD_VALID_TYPES = /* @__PURE__ */ new Set([
|
|
21557
22548
|
"String" /* String */,
|
|
21558
22549
|
"Email" /* Email */,
|
|
@@ -21713,6 +22704,7 @@ function buildPages(pages, opts) {
|
|
|
21713
22704
|
}
|
|
21714
22705
|
}
|
|
21715
22706
|
const slugConfig = { paramsCollectionMap };
|
|
22707
|
+
setPageVisibility(slugConfig, p.visibility);
|
|
21716
22708
|
for (const loc of locales) {
|
|
21717
22709
|
slugConfig[loc] = { slug: computeFullPath(p, loc) };
|
|
21718
22710
|
}
|
|
@@ -21769,7 +22761,8 @@ function buildApp(opts) {
|
|
|
21769
22761
|
pages,
|
|
21770
22762
|
blockTypes,
|
|
21771
22763
|
slugConfig: opts.slugConfig,
|
|
21772
|
-
...i18n ? { i18n } : {}
|
|
22764
|
+
...i18n ? { i18n } : {},
|
|
22765
|
+
...opts.auth ? { auth: opts.auth } : {}
|
|
21773
22766
|
};
|
|
21774
22767
|
}
|
|
21775
22768
|
function resolveI18n(opts) {
|
|
@@ -21823,10 +22816,636 @@ function validateBlockLocalizations(pages, supportedLocales) {
|
|
|
21823
22816
|
visit(p.blocks, p.name);
|
|
21824
22817
|
}
|
|
21825
22818
|
}
|
|
22819
|
+
|
|
22820
|
+
// ../dsl-builders/src/flows/flow-builder.ts
|
|
22821
|
+
var flow_builder_exports = {};
|
|
22822
|
+
__export(flow_builder_exports, {
|
|
22823
|
+
TABLE_ID_PARAM_NAMES: () => TABLE_ID_PARAM_NAMES,
|
|
22824
|
+
buildFlow: () => buildFlow,
|
|
22825
|
+
js: () => js,
|
|
22826
|
+
secret: () => secret,
|
|
22827
|
+
step: () => step,
|
|
22828
|
+
trigger: () => trigger
|
|
22829
|
+
});
|
|
22830
|
+
|
|
22831
|
+
// ../dsl-builders/src/flows/params.ts
|
|
22832
|
+
var SECRET_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
22833
|
+
function js(code) {
|
|
22834
|
+
if (typeof code !== "string" || code.trim().length === 0) {
|
|
22835
|
+
throw new Error("js() requires a non-empty code string");
|
|
22836
|
+
}
|
|
22837
|
+
return { __flowParam: "js", code };
|
|
22838
|
+
}
|
|
22839
|
+
function secret(secretId) {
|
|
22840
|
+
if (typeof secretId !== "string" || !SECRET_ID_PATTERN.test(secretId)) {
|
|
22841
|
+
throw new Error(
|
|
22842
|
+
`secret() expects a secret record ID (a UUID \u2014 discover secrets via data_list with ofType "secret"), got ${JSON.stringify(
|
|
22843
|
+
secretId
|
|
22844
|
+
)}. Never pass secret values directly.`
|
|
22845
|
+
);
|
|
22846
|
+
}
|
|
22847
|
+
return { __flowParam: "secret", secretId };
|
|
22848
|
+
}
|
|
22849
|
+
function isJsParam(value) {
|
|
22850
|
+
return typeof value === "object" && value !== null && value.__flowParam === "js";
|
|
22851
|
+
}
|
|
22852
|
+
function isSecretParam(value) {
|
|
22853
|
+
return typeof value === "object" && value !== null && value.__flowParam === "secret";
|
|
22854
|
+
}
|
|
22855
|
+
function isFlowParamMarker(value) {
|
|
22856
|
+
return isJsParam(value) || isSecretParam(value);
|
|
22857
|
+
}
|
|
22858
|
+
function isPlainObject2(value) {
|
|
22859
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && !isFlowParamMarker(value);
|
|
22860
|
+
}
|
|
22861
|
+
function containsMarker(value) {
|
|
22862
|
+
if (isFlowParamMarker(value)) return true;
|
|
22863
|
+
if (Array.isArray(value)) return value.some(containsMarker);
|
|
22864
|
+
if (typeof value === "object" && value !== null) {
|
|
22865
|
+
return Object.values(value).some(containsMarker);
|
|
22866
|
+
}
|
|
22867
|
+
return false;
|
|
22868
|
+
}
|
|
22869
|
+
function lowerParamValue(value, path) {
|
|
22870
|
+
if (isSecretParam(value)) {
|
|
22871
|
+
return { value: value.secretId, config: { type: "secret" } };
|
|
22872
|
+
}
|
|
22873
|
+
if (isJsParam(value)) {
|
|
22874
|
+
return { value: value.code, config: { type: "logic", language: "js" } };
|
|
22875
|
+
}
|
|
22876
|
+
if (Array.isArray(value)) {
|
|
22877
|
+
if (value.some(containsMarker)) {
|
|
22878
|
+
throw new Error(
|
|
22879
|
+
`Param "${path}": js()/secret() markers inside arrays are not supported \u2014 wrap the whole array in js(...)`
|
|
22880
|
+
);
|
|
22881
|
+
}
|
|
22882
|
+
return { value, config: { type: "logic", language: "static" } };
|
|
22883
|
+
}
|
|
22884
|
+
if (isPlainObject2(value)) {
|
|
22885
|
+
if (!containsMarker(value)) {
|
|
22886
|
+
return { value, config: { type: "logic", language: "static" } };
|
|
22887
|
+
}
|
|
22888
|
+
const loweredValue = {};
|
|
22889
|
+
const subParams = {};
|
|
22890
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
22891
|
+
const lowered = lowerParamValue(entry, `${path}.${key}`);
|
|
22892
|
+
loweredValue[key] = lowered.value;
|
|
22893
|
+
if (lowered.config) {
|
|
22894
|
+
subParams[key] = lowered.config;
|
|
22895
|
+
}
|
|
22896
|
+
}
|
|
22897
|
+
return { value: loweredValue, config: { type: "object", subParams } };
|
|
22898
|
+
}
|
|
22899
|
+
return { value };
|
|
22900
|
+
}
|
|
22901
|
+
function lowerParams(params) {
|
|
22902
|
+
const loweredParams = {};
|
|
22903
|
+
const paramsConfig = {};
|
|
22904
|
+
for (const [key, value] of Object.entries(params)) {
|
|
22905
|
+
if (value === void 0) continue;
|
|
22906
|
+
const lowered = lowerParamValue(value, key);
|
|
22907
|
+
loweredParams[key] = lowered.value;
|
|
22908
|
+
if (lowered.config) {
|
|
22909
|
+
paramsConfig[key] = lowered.config;
|
|
22910
|
+
}
|
|
22911
|
+
}
|
|
22912
|
+
return Object.keys(paramsConfig).length > 0 ? { params: loweredParams, paramsConfig } : { params: loweredParams };
|
|
22913
|
+
}
|
|
22914
|
+
|
|
22915
|
+
// ../dsl-builders/src/flows/validate.ts
|
|
22916
|
+
var KNOWN_SECRET_PARAMS = {
|
|
22917
|
+
["elevenLabsTTS" /* elevenLabsTTS */]: ["apiKey"],
|
|
22918
|
+
["googleSearch" /* googleSearch */]: ["apiKey"],
|
|
22919
|
+
["openAIImageGeneration" /* openAIImageGeneration */]: ["apiKey"],
|
|
22920
|
+
["genericAI" /* genericAI */]: ["apiKey"]
|
|
22921
|
+
};
|
|
22922
|
+
var WRITE_STEP_OPERATIONS = {
|
|
22923
|
+
["createType" /* createType */]: "INSERT",
|
|
22924
|
+
["batchCreateType" /* batchCreateType */]: "INSERT",
|
|
22925
|
+
["updateType" /* updateType */]: "MODIFY",
|
|
22926
|
+
["deleteType" /* deleteType */]: "REMOVE"
|
|
22927
|
+
};
|
|
22928
|
+
function isStaticParamConfig(config2) {
|
|
22929
|
+
return !config2 || config2.type !== "secret" && config2.type !== "object" && config2.language === "static";
|
|
22930
|
+
}
|
|
22931
|
+
function collectWriteSteps(declaration) {
|
|
22932
|
+
const staticWrites = [];
|
|
22933
|
+
const dynamicWrites = [];
|
|
22934
|
+
for (const step2 of Object.values(declaration.steps)) {
|
|
22935
|
+
if (step2.type === "cloudFunction" /* cloudFunction */) {
|
|
22936
|
+
dynamicWrites.push({
|
|
22937
|
+
stepName: step2.name,
|
|
22938
|
+
reason: "cloudFunction steps can perform arbitrary writes"
|
|
22939
|
+
});
|
|
22940
|
+
continue;
|
|
22941
|
+
}
|
|
22942
|
+
const operation = WRITE_STEP_OPERATIONS[step2.type];
|
|
22943
|
+
if (!operation) continue;
|
|
22944
|
+
const params = step2.params;
|
|
22945
|
+
const ofTypeConfig = step2.paramsConfig?.ofType;
|
|
22946
|
+
if (isStaticParamConfig(ofTypeConfig) && typeof params.ofType === "string") {
|
|
22947
|
+
staticWrites.push({ stepName: step2.name, ofType: params.ofType, operation });
|
|
22948
|
+
} else {
|
|
22949
|
+
dynamicWrites.push({
|
|
22950
|
+
stepName: step2.name,
|
|
22951
|
+
reason: `"ofType" is dynamic, so the written table cannot be determined statically`
|
|
22952
|
+
});
|
|
22953
|
+
}
|
|
22954
|
+
}
|
|
22955
|
+
return { staticWrites, dynamicWrites };
|
|
22956
|
+
}
|
|
22957
|
+
function hasNonEmptyCondition(condition) {
|
|
22958
|
+
if (condition === void 0 || condition === null) return false;
|
|
22959
|
+
if (typeof condition === "string") return condition.trim().length > 0;
|
|
22960
|
+
if (typeof condition === "object") return Object.keys(condition).length > 0;
|
|
22961
|
+
return true;
|
|
22962
|
+
}
|
|
22963
|
+
function collectTableDataChangeTriggers(declaration) {
|
|
22964
|
+
const triggers = [];
|
|
22965
|
+
for (const [triggerName, trigger2] of Object.entries(declaration.triggers)) {
|
|
22966
|
+
if (trigger2.variant !== "TABLE_DATA_CHANGE" /* TABLE_DATA_CHANGE */) continue;
|
|
22967
|
+
triggers.push({
|
|
22968
|
+
triggerName,
|
|
22969
|
+
tableId: trigger2.tableId,
|
|
22970
|
+
operation: trigger2.operation,
|
|
22971
|
+
hasCondition: hasNonEmptyCondition(trigger2.condition)
|
|
22972
|
+
});
|
|
22973
|
+
}
|
|
22974
|
+
return triggers;
|
|
22975
|
+
}
|
|
22976
|
+
function collectNonStaticPaths(paramsConfig, prefix = "") {
|
|
22977
|
+
if (!paramsConfig) return [];
|
|
22978
|
+
const paths = [];
|
|
22979
|
+
for (const [key, config2] of Object.entries(paramsConfig)) {
|
|
22980
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
22981
|
+
if (config2.type === "object") {
|
|
22982
|
+
paths.push(...collectNonStaticPaths(config2.subParams, path));
|
|
22983
|
+
} else if (config2.type === "secret" || config2.language === "js") {
|
|
22984
|
+
paths.push(path);
|
|
22985
|
+
}
|
|
22986
|
+
}
|
|
22987
|
+
return paths;
|
|
22988
|
+
}
|
|
22989
|
+
function walkSecretLeaves(params, paramsConfig, visit, prefix = "") {
|
|
22990
|
+
if (!paramsConfig) return;
|
|
22991
|
+
for (const [key, config2] of Object.entries(paramsConfig)) {
|
|
22992
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
22993
|
+
const value = params?.[key];
|
|
22994
|
+
if (config2.type === "object") {
|
|
22995
|
+
walkSecretLeaves(
|
|
22996
|
+
value ?? {},
|
|
22997
|
+
config2.subParams,
|
|
22998
|
+
visit,
|
|
22999
|
+
path
|
|
23000
|
+
);
|
|
23001
|
+
} else if (config2.type === "secret") {
|
|
23002
|
+
visit(path, value);
|
|
23003
|
+
}
|
|
23004
|
+
}
|
|
23005
|
+
}
|
|
23006
|
+
function collectSecretIds(declaration) {
|
|
23007
|
+
const ids = /* @__PURE__ */ new Set();
|
|
23008
|
+
for (const step2 of Object.values(declaration.steps ?? {})) {
|
|
23009
|
+
walkSecretLeaves(
|
|
23010
|
+
step2.params,
|
|
23011
|
+
step2.paramsConfig,
|
|
23012
|
+
(_path, value) => {
|
|
23013
|
+
if (typeof value === "string") {
|
|
23014
|
+
ids.add(value);
|
|
23015
|
+
}
|
|
23016
|
+
}
|
|
23017
|
+
);
|
|
23018
|
+
}
|
|
23019
|
+
return [...ids];
|
|
23020
|
+
}
|
|
23021
|
+
function validateStepParams(step2, issue2, errors, warnings) {
|
|
23022
|
+
const params = step2.params;
|
|
23023
|
+
const paramsConfig = step2.paramsConfig;
|
|
23024
|
+
walkSecretLeaves(params, paramsConfig, (path, value) => {
|
|
23025
|
+
if (typeof value !== "string" || !SECRET_ID_PATTERN.test(value)) {
|
|
23026
|
+
errors.push(
|
|
23027
|
+
issue2(
|
|
23028
|
+
`steps.${step2.name}.params.${path}`,
|
|
23029
|
+
`Step "${step2.name}": secret param "${path}" does not look like a secret record ID \u2014 secret values must never be embedded in the declaration`
|
|
23030
|
+
)
|
|
23031
|
+
);
|
|
23032
|
+
}
|
|
23033
|
+
});
|
|
23034
|
+
for (const paramName of KNOWN_SECRET_PARAMS[step2.type] ?? []) {
|
|
23035
|
+
if (params?.[paramName] === void 0) continue;
|
|
23036
|
+
const config2 = paramsConfig?.[paramName];
|
|
23037
|
+
const isProtected = config2 && (config2.type === "secret" || config2.type !== "object" && config2.language === "js");
|
|
23038
|
+
if (!isProtected) {
|
|
23039
|
+
errors.push(
|
|
23040
|
+
issue2(
|
|
23041
|
+
`steps.${step2.name}.params.${paramName}`,
|
|
23042
|
+
`Step "${step2.name}": param "${paramName}" holds a credential and must be a secret reference, not a plain value`
|
|
23043
|
+
)
|
|
23044
|
+
);
|
|
23045
|
+
}
|
|
23046
|
+
}
|
|
23047
|
+
const schema = schemas[step2.type];
|
|
23048
|
+
if (!schema) return;
|
|
23049
|
+
const parsed = schema.params.safeParse(params);
|
|
23050
|
+
if (parsed.success) return;
|
|
23051
|
+
const nonStaticPaths = collectNonStaticPaths(paramsConfig);
|
|
23052
|
+
for (const zodIssue of parsed.error.issues) {
|
|
23053
|
+
const issuePath = zodIssue.path.map(String).join(".");
|
|
23054
|
+
const coveredByDynamicValue = nonStaticPaths.some(
|
|
23055
|
+
(path) => path === issuePath || path.startsWith(`${issuePath}.`) || issuePath.startsWith(`${path}.`)
|
|
23056
|
+
);
|
|
23057
|
+
if (coveredByDynamicValue) continue;
|
|
23058
|
+
warnings.push(
|
|
23059
|
+
issue2(
|
|
23060
|
+
`steps.${step2.name}.params${issuePath ? `.${issuePath}` : ""}`,
|
|
23061
|
+
`Step "${step2.name}": params do not match the "${step2.type}" schema${issuePath ? ` at "${issuePath}"` : ""}: ${zodIssue.message}`
|
|
23062
|
+
)
|
|
23063
|
+
);
|
|
23064
|
+
}
|
|
23065
|
+
}
|
|
23066
|
+
function tableIdsMatch(a, b) {
|
|
23067
|
+
return a.toLowerCase() === b.toLowerCase();
|
|
23068
|
+
}
|
|
23069
|
+
function validateFlow(declaration, ctx) {
|
|
23070
|
+
const errors = [];
|
|
23071
|
+
const warnings = [];
|
|
23072
|
+
const issue2 = (path, message) => ({
|
|
23073
|
+
...ctx?.flowId !== void 0 ? { flowId: ctx.flowId } : {},
|
|
23074
|
+
...ctx?.name !== void 0 ? { flowName: ctx.name } : {},
|
|
23075
|
+
path,
|
|
23076
|
+
message
|
|
23077
|
+
});
|
|
23078
|
+
const steps = declaration.steps ?? {};
|
|
23079
|
+
const stepNames = Object.keys(steps);
|
|
23080
|
+
for (const [key, step2] of Object.entries(steps)) {
|
|
23081
|
+
if (step2.name !== key) {
|
|
23082
|
+
errors.push(
|
|
23083
|
+
issue2(
|
|
23084
|
+
`steps.${key}`,
|
|
23085
|
+
`Step key "${key}" does not match its name "${step2.name}"`
|
|
23086
|
+
)
|
|
23087
|
+
);
|
|
23088
|
+
}
|
|
23089
|
+
}
|
|
23090
|
+
if (declaration.startStep === null) {
|
|
23091
|
+
if (stepNames.length === 0) {
|
|
23092
|
+
warnings.push(issue2("startStep", "Flow has no steps and does nothing"));
|
|
23093
|
+
} else {
|
|
23094
|
+
warnings.push(
|
|
23095
|
+
issue2(
|
|
23096
|
+
"startStep",
|
|
23097
|
+
"startStep is null \u2014 the declared steps are never executed"
|
|
23098
|
+
)
|
|
23099
|
+
);
|
|
23100
|
+
}
|
|
23101
|
+
} else if (!(declaration.startStep in steps)) {
|
|
23102
|
+
errors.push(
|
|
23103
|
+
issue2(
|
|
23104
|
+
"startStep",
|
|
23105
|
+
`startStep "${declaration.startStep}" does not exist in steps`
|
|
23106
|
+
)
|
|
23107
|
+
);
|
|
23108
|
+
}
|
|
23109
|
+
for (const step2 of Object.values(steps)) {
|
|
23110
|
+
if (step2.nextStep !== null && !(step2.nextStep in steps)) {
|
|
23111
|
+
errors.push(
|
|
23112
|
+
issue2(
|
|
23113
|
+
`steps.${step2.name}.nextStep`,
|
|
23114
|
+
`Step "${step2.name}" points to unknown step "${step2.nextStep}"`
|
|
23115
|
+
)
|
|
23116
|
+
);
|
|
23117
|
+
}
|
|
23118
|
+
}
|
|
23119
|
+
const visited = /* @__PURE__ */ new Set();
|
|
23120
|
+
let current2 = declaration.startStep;
|
|
23121
|
+
while (current2 !== null && current2 in steps) {
|
|
23122
|
+
if (visited.has(current2)) {
|
|
23123
|
+
errors.push(
|
|
23124
|
+
issue2(
|
|
23125
|
+
`steps.${current2}.nextStep`,
|
|
23126
|
+
`Step "${current2}" is executed twice \u2014 steps must form a linked list; nextStep must not point to itself or a previous step`
|
|
23127
|
+
)
|
|
23128
|
+
);
|
|
23129
|
+
break;
|
|
23130
|
+
}
|
|
23131
|
+
visited.add(current2);
|
|
23132
|
+
current2 = steps[current2].nextStep;
|
|
23133
|
+
}
|
|
23134
|
+
for (const name of stepNames) {
|
|
23135
|
+
if (!visited.has(name)) {
|
|
23136
|
+
warnings.push(
|
|
23137
|
+
issue2(
|
|
23138
|
+
`steps.${name}`,
|
|
23139
|
+
`Step "${name}" is not reachable from startStep`
|
|
23140
|
+
)
|
|
23141
|
+
);
|
|
23142
|
+
}
|
|
23143
|
+
}
|
|
23144
|
+
for (const step2 of Object.values(steps)) {
|
|
23145
|
+
validateStepParams(step2, issue2, errors, warnings);
|
|
23146
|
+
}
|
|
23147
|
+
const { staticWrites, dynamicWrites } = collectWriteSteps(declaration);
|
|
23148
|
+
const tableTriggers = collectTableDataChangeTriggers(declaration);
|
|
23149
|
+
for (const write of staticWrites) {
|
|
23150
|
+
for (const trigger2 of tableTriggers) {
|
|
23151
|
+
if (trigger2.operation !== write.operation || !tableIdsMatch(trigger2.tableId, write.ofType)) {
|
|
23152
|
+
continue;
|
|
23153
|
+
}
|
|
23154
|
+
const message = `Step "${write.stepName}" writes table "${write.ofType}" (${write.operation}) which retriggers this flow via trigger "${trigger2.triggerName}"`;
|
|
23155
|
+
if (trigger2.hasCondition) {
|
|
23156
|
+
warnings.push(
|
|
23157
|
+
issue2(
|
|
23158
|
+
`steps.${write.stepName}`,
|
|
23159
|
+
`${message} \u2014 the trigger condition may not terminate the recursion`
|
|
23160
|
+
)
|
|
23161
|
+
);
|
|
23162
|
+
} else {
|
|
23163
|
+
errors.push(issue2(`steps.${write.stepName}`, message));
|
|
23164
|
+
}
|
|
23165
|
+
}
|
|
23166
|
+
}
|
|
23167
|
+
for (const write of dynamicWrites) {
|
|
23168
|
+
warnings.push(
|
|
23169
|
+
issue2(
|
|
23170
|
+
`steps.${write.stepName}`,
|
|
23171
|
+
`Step "${write.stepName}": ${write.reason} \u2014 recursion cannot be statically verified`
|
|
23172
|
+
)
|
|
23173
|
+
);
|
|
23174
|
+
}
|
|
23175
|
+
return { errors, warnings };
|
|
23176
|
+
}
|
|
23177
|
+
function describeCycle(cycle, edges, flowsById) {
|
|
23178
|
+
const parts = [];
|
|
23179
|
+
for (let i = 0; i < cycle.length; i++) {
|
|
23180
|
+
const fromId = cycle[i];
|
|
23181
|
+
const toId = cycle[(i + 1) % cycle.length];
|
|
23182
|
+
const edge = (edges.get(fromId) ?? []).find((e) => e.toId === toId);
|
|
23183
|
+
const fromLabel = flowsById.get(fromId)?.name ?? fromId;
|
|
23184
|
+
const toLabel = flowsById.get(toId)?.name ?? toId;
|
|
23185
|
+
if (!edge) {
|
|
23186
|
+
parts.push(`"${fromLabel}" \u2192 "${toLabel}"`);
|
|
23187
|
+
continue;
|
|
23188
|
+
}
|
|
23189
|
+
parts.push(
|
|
23190
|
+
`"${fromLabel}" step "${edge.stepName}" writes "${edge.tableId}" (${edge.operation}) \u2192 "${toLabel}" trigger "${edge.triggerName}"${edge.hasCondition ? " [conditioned]" : ""}`
|
|
23191
|
+
);
|
|
23192
|
+
}
|
|
23193
|
+
return parts.join("; ");
|
|
23194
|
+
}
|
|
23195
|
+
function validateFlowGraph(flows) {
|
|
23196
|
+
const errors = [];
|
|
23197
|
+
const flowsById = new Map(flows.map((flow) => [flow.id, flow]));
|
|
23198
|
+
const edges = /* @__PURE__ */ new Map();
|
|
23199
|
+
for (const from of flows) {
|
|
23200
|
+
if (from.declaration.disabled === true) continue;
|
|
23201
|
+
const { staticWrites } = collectWriteSteps(from.declaration);
|
|
23202
|
+
const outgoing = [];
|
|
23203
|
+
for (const write of staticWrites) {
|
|
23204
|
+
for (const to of flows) {
|
|
23205
|
+
if (to.id === from.id || to.declaration.disabled === true) continue;
|
|
23206
|
+
for (const trigger2 of collectTableDataChangeTriggers(to.declaration)) {
|
|
23207
|
+
if (trigger2.operation !== write.operation || !tableIdsMatch(trigger2.tableId, write.ofType)) {
|
|
23208
|
+
continue;
|
|
23209
|
+
}
|
|
23210
|
+
outgoing.push({
|
|
23211
|
+
fromId: from.id,
|
|
23212
|
+
toId: to.id,
|
|
23213
|
+
stepName: write.stepName,
|
|
23214
|
+
triggerName: trigger2.triggerName,
|
|
23215
|
+
tableId: write.ofType,
|
|
23216
|
+
operation: write.operation,
|
|
23217
|
+
hasCondition: trigger2.hasCondition
|
|
23218
|
+
});
|
|
23219
|
+
}
|
|
23220
|
+
}
|
|
23221
|
+
}
|
|
23222
|
+
edges.set(from.id, outgoing);
|
|
23223
|
+
}
|
|
23224
|
+
const reportedCycles = /* @__PURE__ */ new Set();
|
|
23225
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
23226
|
+
const done = /* @__PURE__ */ new Set();
|
|
23227
|
+
const stack = [];
|
|
23228
|
+
const visit = (id) => {
|
|
23229
|
+
if (done.has(id)) return;
|
|
23230
|
+
visiting.add(id);
|
|
23231
|
+
stack.push(id);
|
|
23232
|
+
for (const edge of edges.get(id) ?? []) {
|
|
23233
|
+
if (visiting.has(edge.toId)) {
|
|
23234
|
+
const cycle = stack.slice(stack.indexOf(edge.toId));
|
|
23235
|
+
const canonicalStart = cycle.indexOf([...cycle].sort()[0]);
|
|
23236
|
+
const canonical = [
|
|
23237
|
+
...cycle.slice(canonicalStart),
|
|
23238
|
+
...cycle.slice(0, canonicalStart)
|
|
23239
|
+
];
|
|
23240
|
+
const key = canonical.join("\u2192");
|
|
23241
|
+
if (!reportedCycles.has(key)) {
|
|
23242
|
+
reportedCycles.add(key);
|
|
23243
|
+
const flow = flowsById.get(canonical[0]);
|
|
23244
|
+
errors.push({
|
|
23245
|
+
flowId: canonical[0],
|
|
23246
|
+
...flow?.name !== void 0 ? { flowName: flow.name } : {},
|
|
23247
|
+
path: "triggers",
|
|
23248
|
+
message: `Circular flow chain detected: ${describeCycle(canonical, edges, flowsById)}`
|
|
23249
|
+
});
|
|
23250
|
+
}
|
|
23251
|
+
continue;
|
|
23252
|
+
}
|
|
23253
|
+
if (!done.has(edge.toId)) {
|
|
23254
|
+
visit(edge.toId);
|
|
23255
|
+
}
|
|
23256
|
+
}
|
|
23257
|
+
stack.pop();
|
|
23258
|
+
visiting.delete(id);
|
|
23259
|
+
done.add(id);
|
|
23260
|
+
};
|
|
23261
|
+
for (const flow of flows) {
|
|
23262
|
+
visit(flow.id);
|
|
23263
|
+
}
|
|
23264
|
+
return { errors, warnings: [] };
|
|
23265
|
+
}
|
|
23266
|
+
function validateFlows(flows, opts) {
|
|
23267
|
+
const errors = [];
|
|
23268
|
+
const warnings = [];
|
|
23269
|
+
const idsToValidate = opts?.flowIdsToValidate ? new Set(opts.flowIdsToValidate) : null;
|
|
23270
|
+
for (const flow of flows) {
|
|
23271
|
+
if (idsToValidate && !idsToValidate.has(flow.id)) continue;
|
|
23272
|
+
const result = validateFlow(flow.declaration, {
|
|
23273
|
+
flowId: flow.id,
|
|
23274
|
+
name: flow.name
|
|
23275
|
+
});
|
|
23276
|
+
errors.push(...result.errors);
|
|
23277
|
+
warnings.push(...result.warnings);
|
|
23278
|
+
}
|
|
23279
|
+
const graphResult = validateFlowGraph(flows);
|
|
23280
|
+
errors.push(...graphResult.errors);
|
|
23281
|
+
warnings.push(...graphResult.warnings);
|
|
23282
|
+
return { errors, warnings };
|
|
23283
|
+
}
|
|
23284
|
+
|
|
23285
|
+
// ../dsl-builders/src/flows/flow-builder.ts
|
|
23286
|
+
var trigger = {
|
|
23287
|
+
tableDataChange(opts) {
|
|
23288
|
+
return {
|
|
23289
|
+
variant: "TABLE_DATA_CHANGE" /* TABLE_DATA_CHANGE */,
|
|
23290
|
+
// The webapp stores lowercase table ids (its pickers match on them);
|
|
23291
|
+
// the runtime matches case-insensitively either way.
|
|
23292
|
+
tableId: opts.tableId.toLowerCase(),
|
|
23293
|
+
operation: opts.operation,
|
|
23294
|
+
...opts.condition !== void 0 ? { condition: opts.condition } : {}
|
|
23295
|
+
};
|
|
23296
|
+
},
|
|
23297
|
+
schedule(opts) {
|
|
23298
|
+
return {
|
|
23299
|
+
variant: "SCHEDULE" /* SCHEDULE */,
|
|
23300
|
+
...opts?.condition !== void 0 ? { condition: opts.condition } : {}
|
|
23301
|
+
};
|
|
23302
|
+
},
|
|
23303
|
+
manual(opts) {
|
|
23304
|
+
return {
|
|
23305
|
+
variant: "MANUAL" /* MANUAL */,
|
|
23306
|
+
...opts?.condition !== void 0 ? { condition: opts.condition } : {}
|
|
23307
|
+
};
|
|
23308
|
+
}
|
|
23309
|
+
};
|
|
23310
|
+
function createStepFactory(type) {
|
|
23311
|
+
return (name, opts) => ({
|
|
23312
|
+
name,
|
|
23313
|
+
type,
|
|
23314
|
+
...opts.description !== void 0 ? { description: opts.description } : {},
|
|
23315
|
+
params: opts.params,
|
|
23316
|
+
...opts.next !== void 0 ? { next: opts.next } : {},
|
|
23317
|
+
...opts.skipIf !== void 0 ? { skipIf: opts.skipIf } : {},
|
|
23318
|
+
...opts.continueIf !== void 0 ? { continueIf: opts.continueIf } : {},
|
|
23319
|
+
...opts.passThroughCondition !== void 0 ? { passThroughCondition: opts.passThroughCondition } : {}
|
|
23320
|
+
});
|
|
23321
|
+
}
|
|
23322
|
+
var step = {
|
|
23323
|
+
batchCreateType: createStepFactory("batchCreateType" /* batchCreateType */),
|
|
23324
|
+
batchGetType: createStepFactory("batchGetType" /* batchGetType */),
|
|
23325
|
+
createType: createStepFactory("createType" /* createType */),
|
|
23326
|
+
deleteType: createStepFactory("deleteType" /* deleteType */),
|
|
23327
|
+
elevenLabsTTS: createStepFactory("elevenLabsTTS" /* elevenLabsTTS */),
|
|
23328
|
+
googleSearch: createStepFactory("googleSearch" /* googleSearch */),
|
|
23329
|
+
htmlToPdf: createStepFactory("htmlToPdf" /* htmlToPdf */),
|
|
23330
|
+
httpRequest: createStepFactory("httpRequest" /* httpRequest */),
|
|
23331
|
+
logic: createStepFactory("logic" /* logic */),
|
|
23332
|
+
linkScraper: createStepFactory("linkScraper" /* linkScraper */),
|
|
23333
|
+
listTypeByParent: createStepFactory("listTypeByParent" /* listTypeByParent */),
|
|
23334
|
+
listType: createStepFactory("listType" /* listType */),
|
|
23335
|
+
notifyWebSocket: createStepFactory("notifyWebSocket" /* notifyWebSocket */),
|
|
23336
|
+
openAIImageGeneration: createStepFactory("openAIImageGeneration" /* openAIImageGeneration */),
|
|
23337
|
+
type: createStepFactory("type" /* type */),
|
|
23338
|
+
updateType: createStepFactory("updateType" /* updateType */),
|
|
23339
|
+
extractImageMetadata: createStepFactory("extractImageMetadata" /* extractImageMetadata */),
|
|
23340
|
+
cloudFunction: createStepFactory("cloudFunction" /* cloudFunction */),
|
|
23341
|
+
genericAI: createStepFactory("genericAI" /* genericAI */)
|
|
23342
|
+
};
|
|
23343
|
+
function buildDeclarationStep(definition, nextStep, errors) {
|
|
23344
|
+
for (const paramName of KNOWN_SECRET_PARAMS[definition.type] ?? []) {
|
|
23345
|
+
const value = definition.params[paramName];
|
|
23346
|
+
if (value !== void 0 && !isFlowParamMarker(value)) {
|
|
23347
|
+
errors.push(
|
|
23348
|
+
`Step "${definition.name}": param "${paramName}" holds a credential and must use secret("<secretRecordId>") instead of a plain value`
|
|
23349
|
+
);
|
|
23350
|
+
}
|
|
23351
|
+
}
|
|
23352
|
+
const { params, paramsConfig } = lowerParams(definition.params);
|
|
23353
|
+
lowercaseStaticTableIdParams(params, paramsConfig);
|
|
23354
|
+
return {
|
|
23355
|
+
// The webapp stores id === key on every step; keep that convention.
|
|
23356
|
+
id: definition.name,
|
|
23357
|
+
name: definition.name,
|
|
23358
|
+
type: definition.type,
|
|
23359
|
+
...definition.description !== void 0 ? { description: definition.description } : {},
|
|
23360
|
+
params,
|
|
23361
|
+
nextStep,
|
|
23362
|
+
...paramsConfig ? { paramsConfig } : {},
|
|
23363
|
+
// Conditions are always explicit — the webapp step form expects them and
|
|
23364
|
+
// treats an absent skipCondition as "always skip".
|
|
23365
|
+
skipCondition: definition.skipIf ?? "false;",
|
|
23366
|
+
skipConditionLanguage: "js",
|
|
23367
|
+
continueCondition: definition.continueIf ?? "true;",
|
|
23368
|
+
continueConditionLanguage: "js",
|
|
23369
|
+
...definition.passThroughCondition !== void 0 ? { passThroughCondition: definition.passThroughCondition } : {}
|
|
23370
|
+
};
|
|
23371
|
+
}
|
|
23372
|
+
var TABLE_ID_PARAM_NAMES = ["ofType", "parentType"];
|
|
23373
|
+
function isStaticConfig(config2) {
|
|
23374
|
+
if (!config2) return true;
|
|
23375
|
+
return config2.type !== "secret" && config2.type !== "object" && config2.language === "static";
|
|
23376
|
+
}
|
|
23377
|
+
function lowercaseStaticTableIdParams(params, paramsConfig) {
|
|
23378
|
+
for (const paramName of TABLE_ID_PARAM_NAMES) {
|
|
23379
|
+
const value = params[paramName];
|
|
23380
|
+
if (typeof value === "string" && isStaticConfig(paramsConfig?.[paramName])) {
|
|
23381
|
+
params[paramName] = value.toLowerCase();
|
|
23382
|
+
}
|
|
23383
|
+
}
|
|
23384
|
+
}
|
|
23385
|
+
function buildFlow(opts) {
|
|
23386
|
+
const errors = [];
|
|
23387
|
+
const chainSteps = opts.steps;
|
|
23388
|
+
const detachedSteps = opts.detachedSteps ?? [];
|
|
23389
|
+
const allSteps = [...chainSteps, ...detachedSteps];
|
|
23390
|
+
const seenNames = /* @__PURE__ */ new Set();
|
|
23391
|
+
for (const definition of allSteps) {
|
|
23392
|
+
if (seenNames.has(definition.name)) {
|
|
23393
|
+
errors.push(`Duplicate step name "${definition.name}"`);
|
|
23394
|
+
}
|
|
23395
|
+
seenNames.add(definition.name);
|
|
23396
|
+
}
|
|
23397
|
+
const steps = {};
|
|
23398
|
+
for (let i = 0; i < chainSteps.length; i++) {
|
|
23399
|
+
const definition = chainSteps[i];
|
|
23400
|
+
const nextStep = definition.next !== void 0 ? definition.next : chainSteps[i + 1]?.name ?? null;
|
|
23401
|
+
steps[definition.name] = buildDeclarationStep(definition, nextStep, errors);
|
|
23402
|
+
}
|
|
23403
|
+
for (const definition of detachedSteps) {
|
|
23404
|
+
if (definition.next === void 0) {
|
|
23405
|
+
errors.push(
|
|
23406
|
+
`Detached step "${definition.name}" requires an explicit "next" (step name or null)`
|
|
23407
|
+
);
|
|
23408
|
+
}
|
|
23409
|
+
steps[definition.name] = buildDeclarationStep(
|
|
23410
|
+
definition,
|
|
23411
|
+
definition.next ?? null,
|
|
23412
|
+
errors
|
|
23413
|
+
);
|
|
23414
|
+
}
|
|
23415
|
+
const triggers = {};
|
|
23416
|
+
for (const [name, definition] of Object.entries(opts.triggers)) {
|
|
23417
|
+
triggers[name] = { name, ...definition };
|
|
23418
|
+
}
|
|
23419
|
+
const declaration = {
|
|
23420
|
+
triggers,
|
|
23421
|
+
startStep: chainSteps.length > 0 ? chainSteps[0].name : null,
|
|
23422
|
+
steps,
|
|
23423
|
+
...opts.debug !== void 0 ? { debug: opts.debug } : {},
|
|
23424
|
+
...opts.disabled !== void 0 ? { disabled: opts.disabled } : {}
|
|
23425
|
+
};
|
|
23426
|
+
const validation = validateFlow(declaration, { name: opts.name });
|
|
23427
|
+
errors.push(...validation.errors.map((issue2) => issue2.message));
|
|
23428
|
+
if (errors.length > 0) {
|
|
23429
|
+
const label = opts.name ? `Flow "${opts.name}"` : "Flow";
|
|
23430
|
+
throw new Error(
|
|
23431
|
+
`${label} is invalid:
|
|
23432
|
+
${errors.map((message) => `- ${message}`).join("\n")}`
|
|
23433
|
+
);
|
|
23434
|
+
}
|
|
23435
|
+
return {
|
|
23436
|
+
...opts.name !== void 0 ? { name: opts.name } : {},
|
|
23437
|
+
declaration
|
|
23438
|
+
};
|
|
23439
|
+
}
|
|
21826
23440
|
export {
|
|
21827
23441
|
PublishingTypeEnum,
|
|
21828
23442
|
app_builder_exports as appBuilder,
|
|
23443
|
+
collectSecretIds,
|
|
21829
23444
|
builder_exports as dataBuilder,
|
|
21830
23445
|
dataSchemaDeclarationSchema,
|
|
21831
|
-
|
|
23446
|
+
flow_builder_exports as flowBuilder,
|
|
23447
|
+
macros_exports as macros,
|
|
23448
|
+
validateFlow,
|
|
23449
|
+
validateFlowGraph,
|
|
23450
|
+
validateFlows
|
|
21832
23451
|
};
|