@flowrunner/cli 0.1.17 → 0.1.18-dev.1
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/ai-docs/instructions/service-code-format/02-zod-types.md +139 -33
- package/ai-docs/instructions/service-code-format/03-parameters.md +3 -1
- package/ai-docs/instructions/service-code-format/05-dictionaries.md +8 -2
- package/ai-docs/instructions/service-code-format/07-actions.md +1 -1
- package/ai-docs/instructions/service-code-format/11-output-model.md +3 -0
- package/ai-docs/instructions/service-code-format/14-reference-service.md +1 -1
- package/ai-docs/instructions/service-code-format/16-gotchas.md +80 -0
- package/ai-docs/instructions/service-code-format/18-test-recipes.md +2 -1
- package/ai-docs/instructions/service-code-format/README.md +1 -1
- package/dist/cli.js +523 -82
- package/dist/cli.js.map +4 -4
- package/dist/index.js +522 -81
- package/dist/index.js.map +4 -4
- package/dist/types/flow-extension-runner/src/v2/context/execution-context.d.ts +8 -0
- package/dist/types/flow-extension-runner/src/v2/dictionaries/payload-schema.d.ts +1 -1
- package/dist/types/flow-extension-runner/src/v2/params/index.d.ts +2 -0
- package/dist/types/flow-extension-runner/src/v2/params/json/types.d.ts +2 -0
- package/dist/types/flow-extension-runner/src/v2/params/schema/date-format.d.ts +80 -0
- package/dist/types/flow-extension-runner/src/v2/params/schema/defaults.d.ts +4 -10
- package/dist/types/flow-extension-runner/src/v2/params/schema/field-plan.d.ts +7 -0
- package/dist/types/flow-extension-runner/src/v2/params/schema/notices.d.ts +15 -0
- package/dist/types/flow-extension-runner/src/v2/params/widget-types.d.ts +1 -1
- package/dist/types/flow-extension-runner/src/v2/params/zod.d.ts +30 -19
- package/dist/types/flow-extension-runner/src/v2/types.d.ts +1 -1
- package/package.json +1 -1
- package/runtime/index.js +529 -82
- package/runtime/index.js.map +4 -4
- package/runtime/types/flow-extension-runner/src/v2/context/execution-context.d.ts +8 -0
- package/runtime/types/flow-extension-runner/src/v2/dictionaries/payload-schema.d.ts +1 -1
- package/runtime/types/flow-extension-runner/src/v2/params/index.d.ts +2 -0
- package/runtime/types/flow-extension-runner/src/v2/params/json/types.d.ts +2 -0
- package/runtime/types/flow-extension-runner/src/v2/params/schema/date-format.d.ts +80 -0
- package/runtime/types/flow-extension-runner/src/v2/params/schema/defaults.d.ts +4 -10
- package/runtime/types/flow-extension-runner/src/v2/params/schema/field-plan.d.ts +7 -0
- package/runtime/types/flow-extension-runner/src/v2/params/schema/notices.d.ts +15 -0
- package/runtime/types/flow-extension-runner/src/v2/params/widget-types.d.ts +1 -1
- package/runtime/types/flow-extension-runner/src/v2/params/zod.d.ts +30 -19
- package/runtime/types/flow-extension-runner/src/v2/types.d.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -15239,39 +15239,6 @@ function assertObjectSchema(scheme, source) {
|
|
|
15239
15239
|
);
|
|
15240
15240
|
}
|
|
15241
15241
|
|
|
15242
|
-
// ../../flow-extension-runner/src/v2/params/schema/dictionary-binding.ts
|
|
15243
|
-
var DictionaryScope = class _DictionaryScope {
|
|
15244
|
-
constructor(top, visible) {
|
|
15245
|
-
this.top = top;
|
|
15246
|
-
this.visible = visible;
|
|
15247
|
-
}
|
|
15248
|
-
static {
|
|
15249
|
-
this.ROOT = new _DictionaryScope(null, /* @__PURE__ */ new Set());
|
|
15250
|
-
}
|
|
15251
|
-
enter(names) {
|
|
15252
|
-
if (!this.top) {
|
|
15253
|
-
const top = new Set(names);
|
|
15254
|
-
return new _DictionaryScope(top, top);
|
|
15255
|
-
}
|
|
15256
|
-
return new _DictionaryScope(this.top, /* @__PURE__ */ new Set([...this.top, ...names]));
|
|
15257
|
-
}
|
|
15258
|
-
};
|
|
15259
|
-
function resolveDependsOn(binding, scope2) {
|
|
15260
|
-
const aliases = binding.criteriaAliases ?? {};
|
|
15261
|
-
let clash;
|
|
15262
|
-
const dependsOn = binding.dependsOn.map((key) => {
|
|
15263
|
-
const visible = [key, ...aliases[key] ?? []].filter((name) => scope2.visible.has(name));
|
|
15264
|
-
if (visible.length > 1 && !clash) {
|
|
15265
|
-
clash = { key, names: visible };
|
|
15266
|
-
}
|
|
15267
|
-
return visible[0] ?? key;
|
|
15268
|
-
});
|
|
15269
|
-
return clash ? { dependsOn, clash } : { dependsOn };
|
|
15270
|
-
}
|
|
15271
|
-
function publishedBinding(binding, scope2) {
|
|
15272
|
-
return { id: binding.id, dependsOn: resolveDependsOn(binding, scope2).dependsOn };
|
|
15273
|
-
}
|
|
15274
|
-
|
|
15275
15242
|
// ../../flow-extension-runner/src/v2/params/widget-types.ts
|
|
15276
15243
|
var FlowExtensionParamGroupTypes = {
|
|
15277
15244
|
FILE_UPLOAD_OPTIONS: "FILE_UPLOAD_OPTIONS",
|
|
@@ -15290,7 +15257,9 @@ var FlowExtensionParamWidgetTypes = {
|
|
|
15290
15257
|
...FlowExtensionParamGroupTypes,
|
|
15291
15258
|
// legacy — no zod declaration produces these. They reach the console only from a legacy JSDoc-format
|
|
15292
15259
|
// service, which writes `uiComponent` by hand. Kept because the console still renders them for an
|
|
15293
|
-
// already-installed extension.
|
|
15260
|
+
// already-installed extension. `DATE_TIME_PICKER` / `TIME_PICKER` are also published, with
|
|
15261
|
+
// `valueKind: 'string'` and `format`, by `z.iso.datetime({ local: true })` / `z.iso.time()` (FR-3920) —
|
|
15262
|
+
// without `valueKind` they are the legacy tokens, storing epoch millis.
|
|
15294
15263
|
NUMERIC: "NUMERIC",
|
|
15295
15264
|
CHECKBOX: "CHECKBOX",
|
|
15296
15265
|
DATE_TIME_PICKER: "DATE_TIME_PICKER",
|
|
@@ -15385,15 +15354,12 @@ function literalType(core) {
|
|
|
15385
15354
|
}
|
|
15386
15355
|
function deriveWidget(ins) {
|
|
15387
15356
|
const { coreType, core, meta } = ins;
|
|
15388
|
-
if (meta.frJson) {
|
|
15389
|
-
return { paramType: "STRING", uiComponent: { type: FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT } };
|
|
15390
|
-
}
|
|
15391
15357
|
switch (coreType) {
|
|
15392
15358
|
case "string":
|
|
15393
15359
|
if (meta.frWidget === FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT) {
|
|
15394
15360
|
return { paramType: "STRING", uiComponent: { type: FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT } };
|
|
15395
15361
|
}
|
|
15396
|
-
return { paramType: "STRING" };
|
|
15362
|
+
return dateStringWidget(ins) ?? { paramType: "STRING" };
|
|
15397
15363
|
case "number":
|
|
15398
15364
|
case "bigint":
|
|
15399
15365
|
return { paramType: "NUMBER", uiComponent: { type: FlowExtensionParamWidgetTypes.NUMERIC_STEPPER } };
|
|
@@ -15436,11 +15402,380 @@ function deriveWidget(ins) {
|
|
|
15436
15402
|
return { paramType: "STRING" };
|
|
15437
15403
|
}
|
|
15438
15404
|
}
|
|
15405
|
+
var DATE_STRING_WIDGETS = {
|
|
15406
|
+
date: FlowExtensionParamWidgetTypes.DATE_PICKER,
|
|
15407
|
+
datetime: FlowExtensionParamWidgetTypes.DATE_TIME_PICKER,
|
|
15408
|
+
time: FlowExtensionParamWidgetTypes.TIME_PICKER
|
|
15409
|
+
};
|
|
15410
|
+
function dateStringWidget(ins) {
|
|
15411
|
+
const kind = dateStringKind(ins);
|
|
15412
|
+
return kind ? { paramType: "STRING", uiComponent: { type: DATE_STRING_WIDGETS[kind], valueKind: "string", format: patternOf(ins, kind) } } : void 0;
|
|
15413
|
+
}
|
|
15439
15414
|
function shapeEntries(schema) {
|
|
15440
15415
|
const shape = schema?.shape;
|
|
15441
15416
|
return shape && typeof shape === "object" ? Object.entries(shape) : [];
|
|
15442
15417
|
}
|
|
15443
15418
|
|
|
15419
|
+
// ../../flow-extension-runner/src/v2/params/schema/date-format.ts
|
|
15420
|
+
var ISO_PATTERNS = {
|
|
15421
|
+
date: "yyyy-MM-dd",
|
|
15422
|
+
datetime: "yyyy-MM-dd'T'HH:mm",
|
|
15423
|
+
time: "HH:mm"
|
|
15424
|
+
};
|
|
15425
|
+
var DATE_STRINGS_ACCEPT_TIMESTAMPS = true;
|
|
15426
|
+
function dateStringKind(ins) {
|
|
15427
|
+
if (ins.coreType !== "string") {
|
|
15428
|
+
return void 0;
|
|
15429
|
+
}
|
|
15430
|
+
const def = ins.core?._zod?.def;
|
|
15431
|
+
if (def?.format === "date" || def?.format === "time") {
|
|
15432
|
+
return def.format;
|
|
15433
|
+
}
|
|
15434
|
+
return def?.format === "datetime" && def.local ? "datetime" : void 0;
|
|
15435
|
+
}
|
|
15436
|
+
var patternOf = (ins, kind) => ins.meta.frDateFormat ?? ISO_PATTERNS[kind];
|
|
15437
|
+
var TOKENS = ["yyyy", "yy", "MM", "M", "dd", "d", "HH", "H", "hh", "h", "mm", "ss", "a"];
|
|
15438
|
+
var SPEC = {
|
|
15439
|
+
yyyy: { part: "year", width: 4 },
|
|
15440
|
+
yy: { part: "year", width: 2 },
|
|
15441
|
+
MM: { part: "month", width: 2 },
|
|
15442
|
+
M: { part: "month" },
|
|
15443
|
+
dd: { part: "day", width: 2 },
|
|
15444
|
+
d: { part: "day" },
|
|
15445
|
+
HH: { part: "hour", width: 2 },
|
|
15446
|
+
H: { part: "hour" },
|
|
15447
|
+
hh: { part: "hour", width: 2 },
|
|
15448
|
+
h: { part: "hour" },
|
|
15449
|
+
mm: { part: "minute", width: 2 },
|
|
15450
|
+
ss: { part: "second", width: 2 },
|
|
15451
|
+
a: { part: "meridiem" }
|
|
15452
|
+
};
|
|
15453
|
+
var DATE_PARTS = /* @__PURE__ */ new Set(["year", "month", "day"]);
|
|
15454
|
+
var TIME_PARTS = /* @__PURE__ */ new Set(["hour", "minute", "second", "meridiem"]);
|
|
15455
|
+
var DateFormatError = class extends Error {
|
|
15456
|
+
};
|
|
15457
|
+
var LOOK_ALIKES = {
|
|
15458
|
+
YYYY: "yyyy",
|
|
15459
|
+
YY: "yy",
|
|
15460
|
+
DD: "dd",
|
|
15461
|
+
D: "d",
|
|
15462
|
+
S: "ss",
|
|
15463
|
+
A: "a"
|
|
15464
|
+
};
|
|
15465
|
+
function tokenize(pattern, kind) {
|
|
15466
|
+
const tokens = [];
|
|
15467
|
+
let index = 0;
|
|
15468
|
+
while (index < pattern.length) {
|
|
15469
|
+
const char = pattern[index];
|
|
15470
|
+
if (char === "'") {
|
|
15471
|
+
const end = pattern.indexOf("'", index + 1);
|
|
15472
|
+
if (end < 0) {
|
|
15473
|
+
throw new DateFormatError("has an unclosed quote \u2014 literal text is written between two single quotes");
|
|
15474
|
+
}
|
|
15475
|
+
tokens.push({ literal: end === index + 1 ? "'" : pattern.slice(index + 1, end) });
|
|
15476
|
+
index = end + 1;
|
|
15477
|
+
continue;
|
|
15478
|
+
}
|
|
15479
|
+
if (!/[A-Za-z]/.test(char)) {
|
|
15480
|
+
tokens.push({ literal: char });
|
|
15481
|
+
index++;
|
|
15482
|
+
continue;
|
|
15483
|
+
}
|
|
15484
|
+
const run = /^([A-Za-z])\1*/.exec(pattern.slice(index))?.[0];
|
|
15485
|
+
const known = TOKENS.find((token) => run.startsWith(token) && token.length === run.length);
|
|
15486
|
+
if (!known) {
|
|
15487
|
+
const hint2 = LOOK_ALIKES[run] ? ` (did you mean \`${suggest(pattern, kind)}\`?)` : "";
|
|
15488
|
+
throw new DateFormatError(
|
|
15489
|
+
`uses \`${run}\`, which is not a supported token${hint2}. Supported: yyyy yy MM M dd d HH H hh h mm ss a, and literal text in single quotes`
|
|
15490
|
+
);
|
|
15491
|
+
}
|
|
15492
|
+
tokens.push({ token: known });
|
|
15493
|
+
index += run.length;
|
|
15494
|
+
}
|
|
15495
|
+
return tokens;
|
|
15496
|
+
}
|
|
15497
|
+
function suggest(pattern, kind) {
|
|
15498
|
+
let fixed = pattern;
|
|
15499
|
+
for (const [wrong, right] of Object.entries(LOOK_ALIKES)) {
|
|
15500
|
+
fixed = fixed.replace(new RegExp(`(?<![A-Za-z])${wrong}(?![A-Za-z])`, "g"), right);
|
|
15501
|
+
}
|
|
15502
|
+
if (kind === "date") {
|
|
15503
|
+
fixed = fixed.replace(/mm/g, "MM");
|
|
15504
|
+
}
|
|
15505
|
+
return fixed;
|
|
15506
|
+
}
|
|
15507
|
+
var parsedPatterns = /* @__PURE__ */ new Map();
|
|
15508
|
+
function compilePattern(pattern, kind) {
|
|
15509
|
+
const key = `${kind}|${pattern}`;
|
|
15510
|
+
const cached2 = parsedPatterns.get(key);
|
|
15511
|
+
if (cached2) {
|
|
15512
|
+
return cached2;
|
|
15513
|
+
}
|
|
15514
|
+
if (typeof pattern !== "string" || !pattern.trim()) {
|
|
15515
|
+
throw new DateFormatError("needs a pattern, e.g. `dd/MM/yyyy`");
|
|
15516
|
+
}
|
|
15517
|
+
const tokens = tokenize(pattern, kind);
|
|
15518
|
+
const names = tokens.flatMap((token) => "token" in token ? [token.token] : []);
|
|
15519
|
+
const parts = names.map((name) => SPEC[name].part);
|
|
15520
|
+
const has = (part) => parts.includes(part);
|
|
15521
|
+
const repeated = parts.find((part, index) => parts.indexOf(part) !== index);
|
|
15522
|
+
if (repeated) {
|
|
15523
|
+
throw new DateFormatError(`names the ${repeated === "meridiem" ? "AM/PM" : repeated} twice`);
|
|
15524
|
+
}
|
|
15525
|
+
if (kind === "date" && names.includes("mm") && !has("hour")) {
|
|
15526
|
+
throw new DateFormatError(`uses \`mm\`, which is minutes \u2014 did you mean \`${suggest(pattern, kind)}\`?`);
|
|
15527
|
+
}
|
|
15528
|
+
if (kind === "date" && parts.some((part) => TIME_PARTS.has(part))) {
|
|
15529
|
+
throw new DateFormatError("has a time of day, which a date has not \u2014 declare `z.iso.datetime({ local: true })`");
|
|
15530
|
+
}
|
|
15531
|
+
if (kind === "time" && parts.some((part) => DATE_PARTS.has(part))) {
|
|
15532
|
+
throw new DateFormatError("has a date, which a time has not \u2014 declare `z.iso.datetime({ local: true })`");
|
|
15533
|
+
}
|
|
15534
|
+
const missing = [
|
|
15535
|
+
...kind !== "time" ? [["year", "yyyy"], ["month", "MM"], ["day", "dd"]] : [],
|
|
15536
|
+
...kind !== "date" ? [["hour", "HH"], ["minute", "mm"]] : []
|
|
15537
|
+
].filter(([part]) => !has(part)).map(([, token]) => `\`${token}\``);
|
|
15538
|
+
if (missing.length) {
|
|
15539
|
+
throw new DateFormatError(`is missing ${missing.join(", ")} \u2014 every part of a ${describeKind(kind)} must be in it`);
|
|
15540
|
+
}
|
|
15541
|
+
if ((names.includes("hh") || names.includes("h")) && !names.includes("a")) {
|
|
15542
|
+
throw new DateFormatError(
|
|
15543
|
+
"uses a 12-hour clock (`hh` / `h`) without `a` \u2014 without AM/PM the value cannot be read back. Add `a`, or use `HH` for a 24-hour clock"
|
|
15544
|
+
);
|
|
15545
|
+
}
|
|
15546
|
+
parsedPatterns.set(key, tokens);
|
|
15547
|
+
return tokens;
|
|
15548
|
+
}
|
|
15549
|
+
var describeKind = (kind) => kind === "date" ? "date" : kind === "time" ? "time" : "date and time";
|
|
15550
|
+
var pad = (value, width) => String(value).padStart(width, "0");
|
|
15551
|
+
function formatParts(parts, pattern, kind) {
|
|
15552
|
+
return compilePattern(pattern, kind).map((token) => {
|
|
15553
|
+
if ("literal" in token) {
|
|
15554
|
+
return token.literal;
|
|
15555
|
+
}
|
|
15556
|
+
const hour = parts.hour ?? 0;
|
|
15557
|
+
switch (token.token) {
|
|
15558
|
+
case "yyyy":
|
|
15559
|
+
return pad(parts.year ?? 0, 4);
|
|
15560
|
+
case "yy":
|
|
15561
|
+
return pad((parts.year ?? 0) % 100, 2);
|
|
15562
|
+
case "MM":
|
|
15563
|
+
return pad(parts.month ?? 0, 2);
|
|
15564
|
+
case "M":
|
|
15565
|
+
return String(parts.month ?? 0);
|
|
15566
|
+
case "dd":
|
|
15567
|
+
return pad(parts.day ?? 0, 2);
|
|
15568
|
+
case "d":
|
|
15569
|
+
return String(parts.day ?? 0);
|
|
15570
|
+
case "HH":
|
|
15571
|
+
return pad(hour, 2);
|
|
15572
|
+
case "H":
|
|
15573
|
+
return String(hour);
|
|
15574
|
+
case "hh":
|
|
15575
|
+
return pad(hour % 12 || 12, 2);
|
|
15576
|
+
case "h":
|
|
15577
|
+
return String(hour % 12 || 12);
|
|
15578
|
+
case "mm":
|
|
15579
|
+
return pad(parts.minute ?? 0, 2);
|
|
15580
|
+
case "ss":
|
|
15581
|
+
return pad(parts.second ?? 0, 2);
|
|
15582
|
+
case "a":
|
|
15583
|
+
return hour < 12 ? "AM" : "PM";
|
|
15584
|
+
}
|
|
15585
|
+
}).join("");
|
|
15586
|
+
}
|
|
15587
|
+
var escapeRegex = (text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
15588
|
+
function parseInPattern(text2, pattern, kind) {
|
|
15589
|
+
const tokens = compilePattern(pattern, kind);
|
|
15590
|
+
const order = [];
|
|
15591
|
+
const source = tokens.map((token) => {
|
|
15592
|
+
if ("literal" in token) {
|
|
15593
|
+
return escapeRegex(token.literal);
|
|
15594
|
+
}
|
|
15595
|
+
order.push(token.token);
|
|
15596
|
+
if (token.token === "a") {
|
|
15597
|
+
return "(AM|PM)";
|
|
15598
|
+
}
|
|
15599
|
+
const { width } = SPEC[token.token];
|
|
15600
|
+
return width ? `(\\d{${width}})` : "(\\d{1,2})";
|
|
15601
|
+
}).join("");
|
|
15602
|
+
const match = new RegExp(`^${source}$`).exec(text2);
|
|
15603
|
+
if (!match) {
|
|
15604
|
+
return void 0;
|
|
15605
|
+
}
|
|
15606
|
+
const parts = {};
|
|
15607
|
+
let meridiem;
|
|
15608
|
+
order.forEach((name, index) => {
|
|
15609
|
+
const raw = match[index + 1];
|
|
15610
|
+
if (name === "a") {
|
|
15611
|
+
meridiem = raw;
|
|
15612
|
+
return;
|
|
15613
|
+
}
|
|
15614
|
+
const value = Number(raw);
|
|
15615
|
+
switch (name) {
|
|
15616
|
+
// date-fns' two-digit year rule against its reference year 2000: 00–49 → 20xx, 50–99 → 19xx.
|
|
15617
|
+
case "yy":
|
|
15618
|
+
parts.year = value < 50 ? 2e3 + value : 1900 + value;
|
|
15619
|
+
break;
|
|
15620
|
+
case "hh":
|
|
15621
|
+
case "h":
|
|
15622
|
+
parts.hour = value;
|
|
15623
|
+
break;
|
|
15624
|
+
default:
|
|
15625
|
+
parts[SPEC[name].part] = value;
|
|
15626
|
+
}
|
|
15627
|
+
});
|
|
15628
|
+
if (meridiem) {
|
|
15629
|
+
if (parts.hour === void 0 || parts.hour < 1 || parts.hour > 12) {
|
|
15630
|
+
return void 0;
|
|
15631
|
+
}
|
|
15632
|
+
parts.hour = parts.hour % 12 + (meridiem === "PM" ? 12 : 0);
|
|
15633
|
+
}
|
|
15634
|
+
const complete = completeParts(parts, kind);
|
|
15635
|
+
return complete && formatParts(complete, pattern, kind) === text2 ? complete : void 0;
|
|
15636
|
+
}
|
|
15637
|
+
function completeParts(parts, kind) {
|
|
15638
|
+
const { year, month, day, hour, minute, second } = parts;
|
|
15639
|
+
if (kind !== "time" && !isRealDate(year, month, day)) {
|
|
15640
|
+
return void 0;
|
|
15641
|
+
}
|
|
15642
|
+
if (kind !== "date" && !isRealTime(hour, minute, second)) {
|
|
15643
|
+
return void 0;
|
|
15644
|
+
}
|
|
15645
|
+
return kind === "date" ? { year, month, day } : kind === "time" ? { hour, minute, ...second !== void 0 ? { second } : {} } : { year, month, day, hour, minute, ...second !== void 0 ? { second } : {} };
|
|
15646
|
+
}
|
|
15647
|
+
function isRealDate(year, month, day) {
|
|
15648
|
+
if (year === void 0 || month === void 0 || day === void 0 || month < 1 || month > 12 || day < 1) {
|
|
15649
|
+
return false;
|
|
15650
|
+
}
|
|
15651
|
+
const leap = year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
15652
|
+
const days = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month - 1];
|
|
15653
|
+
return day <= days;
|
|
15654
|
+
}
|
|
15655
|
+
var isRealTime = (hour, minute, second) => hour !== void 0 && minute !== void 0 && hour >= 0 && hour <= 23 && minute >= 0 && minute <= 59 && (second === void 0 || second >= 0 && second <= 59);
|
|
15656
|
+
var ISO_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
15657
|
+
var ISO_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:Z|[+-]\d{2}(?::?\d{2})?)?$/i;
|
|
15658
|
+
var ISO_TIME = /^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:Z|[+-]\d{2}(?::?\d{2})?)?$/i;
|
|
15659
|
+
function parseIso(text2, kind) {
|
|
15660
|
+
const dateTime = ISO_DATE_TIME.exec(text2);
|
|
15661
|
+
if (dateTime) {
|
|
15662
|
+
const [, year, month, day, hour, minute, second] = dateTime.map(Number);
|
|
15663
|
+
return completeParts({ year, month, day, hour, minute, ...dateTime[6] ? { second } : {} }, kind);
|
|
15664
|
+
}
|
|
15665
|
+
const date = ISO_DATE.exec(text2);
|
|
15666
|
+
if (date) {
|
|
15667
|
+
return kind === "date" ? completeParts({ year: +date[1], month: +date[2], day: +date[3] }, kind) : void 0;
|
|
15668
|
+
}
|
|
15669
|
+
const time = ISO_TIME.exec(text2);
|
|
15670
|
+
if (time && kind === "time") {
|
|
15671
|
+
return completeParts({ hour: +time[1], minute: +time[2], ...time[3] ? { second: +time[3] } : {} }, kind);
|
|
15672
|
+
}
|
|
15673
|
+
return void 0;
|
|
15674
|
+
}
|
|
15675
|
+
function toCanonical(parts, kind) {
|
|
15676
|
+
const seconds = parts.second !== void 0 ? `:${pad(parts.second, 2)}` : "";
|
|
15677
|
+
const date = `${pad(parts.year ?? 0, 4)}-${pad(parts.month ?? 0, 2)}-${pad(parts.day ?? 0, 2)}`;
|
|
15678
|
+
const time = `${pad(parts.hour ?? 0, 2)}:${pad(parts.minute ?? 0, 2)}${seconds}`;
|
|
15679
|
+
return kind === "date" ? date : kind === "time" ? time : `${date}T${time}`;
|
|
15680
|
+
}
|
|
15681
|
+
function canonicalToPattern(canonical, ins, kind) {
|
|
15682
|
+
const pattern = ins.meta.frDateFormat;
|
|
15683
|
+
if (!pattern) {
|
|
15684
|
+
return canonical;
|
|
15685
|
+
}
|
|
15686
|
+
const parts = parseIso(canonical, kind);
|
|
15687
|
+
return parts ? formatParts(parts, pattern, kind) : canonical;
|
|
15688
|
+
}
|
|
15689
|
+
var isTimestamp = (value) => typeof value === "number" && Number.isFinite(value) || typeof value === "string" && /^-?\d+(\.\d+)?$/.test(value.trim());
|
|
15690
|
+
function timestampParts(value, kind) {
|
|
15691
|
+
const date = new Date(Number(value));
|
|
15692
|
+
if (Number.isNaN(date.getTime())) {
|
|
15693
|
+
return void 0;
|
|
15694
|
+
}
|
|
15695
|
+
const second = date.getSeconds();
|
|
15696
|
+
return completeParts({
|
|
15697
|
+
year: date.getFullYear(),
|
|
15698
|
+
month: date.getMonth() + 1,
|
|
15699
|
+
day: date.getDate(),
|
|
15700
|
+
hour: date.getHours(),
|
|
15701
|
+
minute: date.getMinutes(),
|
|
15702
|
+
...second ? { second } : {}
|
|
15703
|
+
}, kind);
|
|
15704
|
+
}
|
|
15705
|
+
function toDateString(value, ins, kind) {
|
|
15706
|
+
if (typeof value === "string") {
|
|
15707
|
+
const text2 = value.trim();
|
|
15708
|
+
const pattern = ins.meta.frDateFormat;
|
|
15709
|
+
const parts = (pattern ? parseInPattern(text2, pattern, kind) : void 0) ?? parseIso(text2, kind);
|
|
15710
|
+
if (parts) {
|
|
15711
|
+
return { canonical: toCanonical(parts, kind) };
|
|
15712
|
+
}
|
|
15713
|
+
}
|
|
15714
|
+
if (DATE_STRINGS_ACCEPT_TIMESTAMPS && isTimestamp(value)) {
|
|
15715
|
+
const parts = timestampParts(value, kind);
|
|
15716
|
+
return parts ? { canonical: toCanonical(parts, kind), fromTimestamp: true } : {};
|
|
15717
|
+
}
|
|
15718
|
+
return {};
|
|
15719
|
+
}
|
|
15720
|
+
var EXAMPLE = { year: 2024, month: 1, day: 31, hour: 13, minute: 45, second: 30 };
|
|
15721
|
+
function expectedDateString(ins, kind) {
|
|
15722
|
+
const pattern = patternOf(ins, kind);
|
|
15723
|
+
const shown = ins.meta.frDateFormat ? pattern : pattern.replace(/'T'/, "T");
|
|
15724
|
+
const example = formatParts(EXAMPLE, pattern, kind);
|
|
15725
|
+
return `${kind === "date" ? "a date" : kind === "time" ? "a time" : "a date and time"} in ${shown}, e.g. ${example}`;
|
|
15726
|
+
}
|
|
15727
|
+
function hasDateFormat(schema, seen = /* @__PURE__ */ new Set()) {
|
|
15728
|
+
if (!schema || seen.has(schema)) {
|
|
15729
|
+
return false;
|
|
15730
|
+
}
|
|
15731
|
+
seen.add(schema);
|
|
15732
|
+
const ins = inspect(schema);
|
|
15733
|
+
if (ins.meta.frDateFormat && dateStringKind(ins)) {
|
|
15734
|
+
return true;
|
|
15735
|
+
}
|
|
15736
|
+
const def = ins.core?._zod?.def ?? {};
|
|
15737
|
+
const children = [
|
|
15738
|
+
...shapeEntries(ins.core).map(([, child]) => child),
|
|
15739
|
+
...def.element ? [def.element] : [],
|
|
15740
|
+
...def.valueType ? [def.valueType] : [],
|
|
15741
|
+
...ins.branches ?? []
|
|
15742
|
+
];
|
|
15743
|
+
return children.some((child) => hasDateFormat(child, seen));
|
|
15744
|
+
}
|
|
15745
|
+
|
|
15746
|
+
// ../../flow-extension-runner/src/v2/params/schema/dictionary-binding.ts
|
|
15747
|
+
var DictionaryScope = class _DictionaryScope {
|
|
15748
|
+
constructor(top, visible) {
|
|
15749
|
+
this.top = top;
|
|
15750
|
+
this.visible = visible;
|
|
15751
|
+
}
|
|
15752
|
+
static {
|
|
15753
|
+
this.ROOT = new _DictionaryScope(null, /* @__PURE__ */ new Set());
|
|
15754
|
+
}
|
|
15755
|
+
enter(names) {
|
|
15756
|
+
if (!this.top) {
|
|
15757
|
+
const top = new Set(names);
|
|
15758
|
+
return new _DictionaryScope(top, top);
|
|
15759
|
+
}
|
|
15760
|
+
return new _DictionaryScope(this.top, /* @__PURE__ */ new Set([...this.top, ...names]));
|
|
15761
|
+
}
|
|
15762
|
+
};
|
|
15763
|
+
function resolveDependsOn(binding, scope2) {
|
|
15764
|
+
const aliases = binding.criteriaAliases ?? {};
|
|
15765
|
+
let clash;
|
|
15766
|
+
const dependsOn = binding.dependsOn.map((key) => {
|
|
15767
|
+
const visible = [key, ...aliases[key] ?? []].filter((name) => scope2.visible.has(name));
|
|
15768
|
+
if (visible.length > 1 && !clash) {
|
|
15769
|
+
clash = { key, names: visible };
|
|
15770
|
+
}
|
|
15771
|
+
return visible[0] ?? key;
|
|
15772
|
+
});
|
|
15773
|
+
return clash ? { dependsOn, clash } : { dependsOn };
|
|
15774
|
+
}
|
|
15775
|
+
function publishedBinding(binding, scope2) {
|
|
15776
|
+
return { id: binding.id, dependsOn: resolveDependsOn(binding, scope2).dependsOn };
|
|
15777
|
+
}
|
|
15778
|
+
|
|
15444
15779
|
// ../../flow-extension-runner/src/v2/params/schema/assert-supported-schema.ts
|
|
15445
15780
|
var GUARDED_KINDS = /* @__PURE__ */ new Set(["action", "dictionary", "polling trigger", "realtime trigger", "extension"]);
|
|
15446
15781
|
var SUPPORTED_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -15570,6 +15905,48 @@ function assertDictionaryBinding(schema, source, path19, scope2) {
|
|
|
15570
15905
|
);
|
|
15571
15906
|
}
|
|
15572
15907
|
}
|
|
15908
|
+
function assertDateString(schema, source, path19) {
|
|
15909
|
+
const ins = inspect(schema);
|
|
15910
|
+
const pattern = ins.meta.frDateFormat;
|
|
15911
|
+
const kind = dateStringKind(ins);
|
|
15912
|
+
if (pattern !== void 0 && !kind) {
|
|
15913
|
+
const format = ins.core?._zod?.def?.format;
|
|
15914
|
+
const zoned = ins.coreType === "string" && format === "datetime";
|
|
15915
|
+
refuse(
|
|
15916
|
+
`${subjectOf(source, path19)} uses \`.dateFormat()\` on ${zoned ? "z.iso.datetime() with a zone \u2014 an instant, not a wall clock" : "a type that is not a date string"}. Only z.iso.date(), z.iso.datetime({ local: true }) and z.iso.time() take a format.`,
|
|
15917
|
+
source,
|
|
15918
|
+
path19,
|
|
15919
|
+
zoned ? "datetime" : ins.resolvedType ?? "unknown"
|
|
15920
|
+
);
|
|
15921
|
+
}
|
|
15922
|
+
if (!kind) {
|
|
15923
|
+
return;
|
|
15924
|
+
}
|
|
15925
|
+
if (pattern !== void 0) {
|
|
15926
|
+
try {
|
|
15927
|
+
compilePattern(pattern, kind);
|
|
15928
|
+
} catch (error) {
|
|
15929
|
+
if (error instanceof DateFormatError) {
|
|
15930
|
+
refuse(`${subjectOf(source, path19)}: \`.dateFormat('${pattern}')\` ${error.message}.`, source, path19, pattern);
|
|
15931
|
+
}
|
|
15932
|
+
throw error;
|
|
15933
|
+
}
|
|
15934
|
+
}
|
|
15935
|
+
const fallback = ins.defaultValue;
|
|
15936
|
+
if (fallback === void 0 || fallback === null) {
|
|
15937
|
+
return;
|
|
15938
|
+
}
|
|
15939
|
+
const written = patternOf(ins, kind);
|
|
15940
|
+
const fits = typeof fallback === "string" && (pattern !== void 0 ? !!parseInPattern(fallback, pattern, kind) : ((parts) => !!parts && toCanonical(parts, kind) === fallback)(parseIso(fallback, kind)));
|
|
15941
|
+
if (!fits) {
|
|
15942
|
+
refuse(
|
|
15943
|
+
`${subjectOf(source, path19)} has the default ${JSON.stringify(fallback)}, which is not written in ${written.replace(/'T'/, "T")} \u2014 a default is handed to \`execute\` as written, so write it in the field's own format.`,
|
|
15944
|
+
source,
|
|
15945
|
+
path19,
|
|
15946
|
+
String(fallback)
|
|
15947
|
+
);
|
|
15948
|
+
}
|
|
15949
|
+
}
|
|
15573
15950
|
function assertField(schema, source, path19, seen, scope2, topLevel = false) {
|
|
15574
15951
|
if (!schema || seen.has(schema)) {
|
|
15575
15952
|
return;
|
|
@@ -15588,6 +15965,7 @@ function assertField(schema, source, path19, seen, scope2, topLevel = false) {
|
|
|
15588
15965
|
refuseCatch(source, path19);
|
|
15589
15966
|
}
|
|
15590
15967
|
assertDictionaryBinding(schema, source, path19, scope2);
|
|
15968
|
+
assertDateString(schema, source, path19);
|
|
15591
15969
|
if (!ins.resolvedType || !SUPPORTED_TYPES.has(ins.resolvedType)) {
|
|
15592
15970
|
refuseType(source, path19, ins.resolvedType);
|
|
15593
15971
|
}
|
|
@@ -15777,7 +16155,6 @@ function declaredAbsence(schema) {
|
|
|
15777
16155
|
function coerces(schema) {
|
|
15778
16156
|
return inspect(schema).core?._zod?.def?.coerce === true;
|
|
15779
16157
|
}
|
|
15780
|
-
var parsesJson = (schema) => !!inspect(schema).meta.frJson;
|
|
15781
16158
|
var OPEN_TYPES = /* @__PURE__ */ new Set(["unknown", "any"]);
|
|
15782
16159
|
var isOpenType = (schema) => OPEN_TYPES.has(inspect(schema).coreType);
|
|
15783
16160
|
function requiredOpenType(schema) {
|
|
@@ -15799,7 +16176,7 @@ function requiredOpenType(schema) {
|
|
|
15799
16176
|
return false;
|
|
15800
16177
|
}
|
|
15801
16178
|
function probeAbsence(schema) {
|
|
15802
|
-
if (coerces(schema)
|
|
16179
|
+
if (coerces(schema)) {
|
|
15803
16180
|
return declaredAbsence(schema);
|
|
15804
16181
|
}
|
|
15805
16182
|
if (requiredOpenType(schema)) {
|
|
@@ -15826,7 +16203,7 @@ function absenceOf(schema) {
|
|
|
15826
16203
|
if (cached2) {
|
|
15827
16204
|
return cached2;
|
|
15828
16205
|
}
|
|
15829
|
-
const probed = { ...probeAbsence(schema), blankIsValue: isOpenType(schema)
|
|
16206
|
+
const probed = { ...probeAbsence(schema), blankIsValue: isOpenType(schema) };
|
|
15830
16207
|
probeCache.set(schema, probed);
|
|
15831
16208
|
return probed;
|
|
15832
16209
|
}
|
|
@@ -15844,10 +16221,39 @@ function planField(name, schema) {
|
|
|
15844
16221
|
keepsEmpty,
|
|
15845
16222
|
blankIsValue,
|
|
15846
16223
|
passThroughDate: passesDateThrough(ins),
|
|
15847
|
-
restoresDates: hasPassThroughDate(schema, inspect, shapeEntries)
|
|
16224
|
+
restoresDates: hasPassThroughDate(schema, inspect, shapeEntries),
|
|
16225
|
+
dateString: dateStringKind(ins),
|
|
16226
|
+
formatsDates: hasDateFormat(schema)
|
|
15848
16227
|
};
|
|
15849
16228
|
}
|
|
15850
16229
|
|
|
16230
|
+
// ../../flow-extension-runner/src/v2/params/schema/notices.ts
|
|
16231
|
+
var sink;
|
|
16232
|
+
var currentField;
|
|
16233
|
+
function collectNotices(fn) {
|
|
16234
|
+
const outer = sink;
|
|
16235
|
+
const notices = [];
|
|
16236
|
+
sink = notices;
|
|
16237
|
+
try {
|
|
16238
|
+
return { result: fn(), notices };
|
|
16239
|
+
} finally {
|
|
16240
|
+
sink = outer;
|
|
16241
|
+
outer?.push(...notices);
|
|
16242
|
+
}
|
|
16243
|
+
}
|
|
16244
|
+
function withinField(field, fn) {
|
|
16245
|
+
const outer = currentField;
|
|
16246
|
+
currentField = field;
|
|
16247
|
+
try {
|
|
16248
|
+
return fn();
|
|
16249
|
+
} finally {
|
|
16250
|
+
currentField = outer;
|
|
16251
|
+
}
|
|
16252
|
+
}
|
|
16253
|
+
function notice(entry) {
|
|
16254
|
+
sink?.push({ field: currentField, ...entry });
|
|
16255
|
+
}
|
|
16256
|
+
|
|
15851
16257
|
// ../../flow-extension-runner/src/v2/params/schema/coerce.ts
|
|
15852
16258
|
var ok = (value) => ({ ok: true, value });
|
|
15853
16259
|
var fail = (expected) => ({ ok: false, expected });
|
|
@@ -15922,16 +16328,6 @@ function toBooleanValue(value) {
|
|
|
15922
16328
|
const lowered = value.trim().toLowerCase();
|
|
15923
16329
|
return TRUE.has(lowered) ? ok(true) : FALSE.has(lowered) ? ok(false) : fail("boolean");
|
|
15924
16330
|
}
|
|
15925
|
-
function toJsonValue(value) {
|
|
15926
|
-
if (typeof value !== "string") {
|
|
15927
|
-
return ok(value);
|
|
15928
|
-
}
|
|
15929
|
-
try {
|
|
15930
|
-
return ok(JSON.parse(value));
|
|
15931
|
-
} catch {
|
|
15932
|
-
return fail("json");
|
|
15933
|
-
}
|
|
15934
|
-
}
|
|
15935
16331
|
function coerceValue(value, coreType) {
|
|
15936
16332
|
if (coreType === "string") {
|
|
15937
16333
|
return toStringValue(value);
|
|
@@ -16029,8 +16425,20 @@ function coerceLeaf(value, ins) {
|
|
|
16029
16425
|
if (ins.branches) {
|
|
16030
16426
|
return ok(coerceUnion(value, ins.branches));
|
|
16031
16427
|
}
|
|
16032
|
-
|
|
16033
|
-
|
|
16428
|
+
const kind = dateStringKind(ins);
|
|
16429
|
+
if (kind) {
|
|
16430
|
+
const { canonical, fromTimestamp } = toDateString(value, ins, kind);
|
|
16431
|
+
if (canonical === void 0) {
|
|
16432
|
+
return fail(expectedDateString(ins, kind));
|
|
16433
|
+
}
|
|
16434
|
+
if (fromTimestamp) {
|
|
16435
|
+
notice({
|
|
16436
|
+
message: "a timestamp was converted to a date string in the server time zone (FR-3920 lenient period)",
|
|
16437
|
+
value,
|
|
16438
|
+
converted: canonical
|
|
16439
|
+
});
|
|
16440
|
+
}
|
|
16441
|
+
return ok(canonical);
|
|
16034
16442
|
}
|
|
16035
16443
|
const format = formatOf(ins);
|
|
16036
16444
|
if (ins.coreType === "string" && isConvertibleIso(format)) {
|
|
@@ -16065,7 +16473,7 @@ function isBlank(value, ins, schema) {
|
|
|
16065
16473
|
if (absenceOf(schema).blankIsValue) {
|
|
16066
16474
|
return absenceOf(schema).absorbsBlank;
|
|
16067
16475
|
}
|
|
16068
|
-
return ins.coreType !== "string" || absenceOf(schema).absorbsBlank;
|
|
16476
|
+
return ins.coreType !== "string" || !!dateStringKind(ins) || absenceOf(schema).absorbsBlank;
|
|
16069
16477
|
}
|
|
16070
16478
|
function absentAs(schema, value) {
|
|
16071
16479
|
const { absence } = absenceOf(schema);
|
|
@@ -16126,9 +16534,7 @@ var EXPECTED = {
|
|
|
16126
16534
|
object: "an object",
|
|
16127
16535
|
array: "an array",
|
|
16128
16536
|
// zod's own token for `z.record()`, which the author declared as a map — to a person it is an object.
|
|
16129
|
-
record: "an object"
|
|
16130
|
-
// `z.json()`. Not a zod token — ./coerce.ts raises it when the submitted text will not parse.
|
|
16131
|
-
json: "valid JSON"
|
|
16537
|
+
record: "an object"
|
|
16132
16538
|
};
|
|
16133
16539
|
var requiredMessage = (plan2) => `\xAB${plan2.label}\xBB is required`;
|
|
16134
16540
|
var invalidTypeMessage = (plan2, expected) => `\xAB${plan2.label}\xBB must be ${EXPECTED[expected] ?? expected}`;
|
|
@@ -16155,7 +16561,7 @@ function resolveTarget(plan2, segments, fieldValue) {
|
|
|
16155
16561
|
schema = nested[1];
|
|
16156
16562
|
label = labelOf(segment, schema);
|
|
16157
16563
|
}
|
|
16158
|
-
return { label, value, found };
|
|
16564
|
+
return { label, value, found, schema: found ? schema : void 0 };
|
|
16159
16565
|
}
|
|
16160
16566
|
function bound(value, plan2) {
|
|
16161
16567
|
if (plan2.coreType !== "date" || typeof value !== "number") {
|
|
@@ -16177,6 +16583,11 @@ function toFieldIssue(plan2, issue, fieldValue) {
|
|
|
16177
16583
|
if (isAuthored(issue)) {
|
|
16178
16584
|
return { path: path19, code, message: issue.message };
|
|
16179
16585
|
}
|
|
16586
|
+
const dateKind = target.schema ? dateStringKind(inspect(target.schema)) : void 0;
|
|
16587
|
+
const dateMissing = target.value == null || target.value === "";
|
|
16588
|
+
if (dateKind && (code === "invalid_type" || code === "invalid_format")) {
|
|
16589
|
+
return dateMissing ? { path: path19, code, message: requiredMessage(named) } : { path: path19, code, message: invalidTypeMessage(named, expectedDateString(inspect(target.schema), dateKind)) };
|
|
16590
|
+
}
|
|
16180
16591
|
if (code === "invalid_type") {
|
|
16181
16592
|
const received = issue.received;
|
|
16182
16593
|
const absent = segments.length ? target.found && target.value == null : received === "undefined" || received === "null" || issue.expected === void 0;
|
|
@@ -16221,7 +16632,7 @@ function isAbsent(value, plan2) {
|
|
|
16221
16632
|
if (plan2.blankIsValue) {
|
|
16222
16633
|
return plan2.absorbsBlank;
|
|
16223
16634
|
}
|
|
16224
|
-
return plan2.coreType !== "string" || plan2.absorbsBlank;
|
|
16635
|
+
return plan2.coreType !== "string" || !!plan2.dateString || plan2.absorbsBlank;
|
|
16225
16636
|
}
|
|
16226
16637
|
function normalizeAbsence(value, plan2) {
|
|
16227
16638
|
if (plan2.absence === "required") {
|
|
@@ -16260,7 +16671,7 @@ function normalizeField(value, plan2) {
|
|
|
16260
16671
|
return restore(validate(coerced.value, plan2), value, plan2);
|
|
16261
16672
|
}
|
|
16262
16673
|
function restore(result, original, plan2) {
|
|
16263
|
-
if (!plan2.restoresDates || !result.present || result.issues.length) {
|
|
16674
|
+
if (!(plan2.restoresDates || plan2.formatsDates) || !result.present || result.issues.length) {
|
|
16264
16675
|
return result;
|
|
16265
16676
|
}
|
|
16266
16677
|
if (plan2.passThroughDate) {
|
|
@@ -16280,6 +16691,10 @@ function restoreDeep(output, original, schema) {
|
|
|
16280
16691
|
const branch = ins.branches.find((option) => accepts(option, output));
|
|
16281
16692
|
return branch ? restoreDeep(output, original, branch) : output;
|
|
16282
16693
|
}
|
|
16694
|
+
const kind = dateStringKind(ins);
|
|
16695
|
+
if (kind) {
|
|
16696
|
+
return typeof output === "string" && original !== "" ? canonicalToPattern(output, ins, kind) : output;
|
|
16697
|
+
}
|
|
16283
16698
|
const element = ins.core?._zod?.def?.element;
|
|
16284
16699
|
if (ins.coreType === "array" && element && Array.isArray(output) && Array.isArray(original)) {
|
|
16285
16700
|
return output.map((item, index) => restoreDeep(item, original[index], element));
|
|
@@ -16369,7 +16784,7 @@ var Params = class {
|
|
|
16369
16784
|
const values = {};
|
|
16370
16785
|
const issues = [];
|
|
16371
16786
|
for (const plan2 of this.plans()) {
|
|
16372
|
-
const result = normalizeField(source[plan2.name], plan2);
|
|
16787
|
+
const result = withinField(plan2.name, () => normalizeField(source[plan2.name], plan2));
|
|
16373
16788
|
if (result.issues.length) {
|
|
16374
16789
|
issues.push(...result.issues);
|
|
16375
16790
|
} else if (result.present) {
|
|
@@ -16524,6 +16939,9 @@ function extendPrototype() {
|
|
|
16524
16939
|
}
|
|
16525
16940
|
return this.meta({ frDictionary: binding });
|
|
16526
16941
|
};
|
|
16942
|
+
proto.dateFormat = function dateFormat(pattern) {
|
|
16943
|
+
return this.meta({ frDateFormat: pattern });
|
|
16944
|
+
};
|
|
16527
16945
|
proto.labels = function labels(byValue) {
|
|
16528
16946
|
return this.meta({ frLabels: byValue });
|
|
16529
16947
|
};
|
|
@@ -16546,10 +16964,9 @@ function text() {
|
|
|
16546
16964
|
return import_zod2.z.string().meta({ frWidget: FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT });
|
|
16547
16965
|
}
|
|
16548
16966
|
function json() {
|
|
16549
|
-
|
|
16550
|
-
|
|
16551
|
-
|
|
16552
|
-
});
|
|
16967
|
+
throw new Error(
|
|
16968
|
+
"`z.json()` is not supported \u2014 declare `z.unknown()` for any value passed as given (`.required()` to make it required), or declare the shape: `z.object({ \u2026 })` / `z.array(\u2026)` also accept JSON text and parse it."
|
|
16969
|
+
);
|
|
16553
16970
|
}
|
|
16554
16971
|
var namespace = Object.create(import_zod2.z);
|
|
16555
16972
|
Object.defineProperties(namespace, {
|
|
@@ -16563,7 +16980,7 @@ Object.defineProperties(namespace, {
|
|
|
16563
16980
|
var z = namespace;
|
|
16564
16981
|
|
|
16565
16982
|
// ../../flow-extension-runner/src/v2/params/json/values.ts
|
|
16566
|
-
function
|
|
16983
|
+
function toJsonValue(value) {
|
|
16567
16984
|
if (typeof value === "bigint") {
|
|
16568
16985
|
return { $bigint: value.toString() };
|
|
16569
16986
|
}
|
|
@@ -16571,10 +16988,10 @@ function toJsonValue2(value) {
|
|
|
16571
16988
|
return { $date: value.toISOString() };
|
|
16572
16989
|
}
|
|
16573
16990
|
if (Array.isArray(value)) {
|
|
16574
|
-
return value.map(
|
|
16991
|
+
return value.map(toJsonValue);
|
|
16575
16992
|
}
|
|
16576
16993
|
if (value && typeof value === "object") {
|
|
16577
|
-
return Object.fromEntries(Object.entries(value).map(([key, inner]) => [key,
|
|
16994
|
+
return Object.fromEntries(Object.entries(value).map(([key, inner]) => [key, toJsonValue(inner)]));
|
|
16578
16995
|
}
|
|
16579
16996
|
return value;
|
|
16580
16997
|
}
|
|
@@ -16609,18 +17026,18 @@ function encodeCheck(check) {
|
|
|
16609
17026
|
switch (def.check) {
|
|
16610
17027
|
// strings and arrays
|
|
16611
17028
|
case "min_length":
|
|
16612
|
-
return at("min",
|
|
17029
|
+
return at("min", toJsonValue(def.minimum));
|
|
16613
17030
|
case "max_length":
|
|
16614
|
-
return at("max",
|
|
17031
|
+
return at("max", toJsonValue(def.maximum));
|
|
16615
17032
|
case "length_equals":
|
|
16616
|
-
return at("length",
|
|
17033
|
+
return at("length", toJsonValue(def.length));
|
|
16617
17034
|
// numbers and bigints
|
|
16618
17035
|
case "greater_than":
|
|
16619
|
-
return at("min",
|
|
17036
|
+
return at("min", toJsonValue(def.value), def.inclusive ? void 0 : true);
|
|
16620
17037
|
case "less_than":
|
|
16621
|
-
return at("max",
|
|
17038
|
+
return at("max", toJsonValue(def.value), def.inclusive ? void 0 : true);
|
|
16622
17039
|
case "multiple_of":
|
|
16623
|
-
return at("multipleOf",
|
|
17040
|
+
return at("multipleOf", toJsonValue(def.value));
|
|
16624
17041
|
case "number_format":
|
|
16625
17042
|
return def.format === "safeint" || def.format === "int32" ? at("int") : void 0;
|
|
16626
17043
|
// the string sub-formats that are checks rather than types
|
|
@@ -16781,7 +17198,7 @@ function encodeMeta(meta, field, scope2, loaderId) {
|
|
|
16781
17198
|
if (hasFunction(source)) {
|
|
16782
17199
|
throw new Error(`Cannot encode "${field}": its metadata holds a function, which has no wire form.`);
|
|
16783
17200
|
}
|
|
16784
|
-
const encoded =
|
|
17201
|
+
const encoded = toJsonValue(source);
|
|
16785
17202
|
return Object.keys(encoded).length ? encoded : void 0;
|
|
16786
17203
|
}
|
|
16787
17204
|
function isLoose(core) {
|
|
@@ -16791,11 +17208,11 @@ function isLoose(core) {
|
|
|
16791
17208
|
function encodeValues(core, type) {
|
|
16792
17209
|
if (type === "enum") {
|
|
16793
17210
|
const entries = core?._zod?.def?.entries ?? {};
|
|
16794
|
-
return Object.values(entries).map(
|
|
17211
|
+
return Object.values(entries).map(toJsonValue);
|
|
16795
17212
|
}
|
|
16796
17213
|
if (type === "literal") {
|
|
16797
17214
|
const values = core?._zod?.def?.values ?? [];
|
|
16798
|
-
return values.map(
|
|
17215
|
+
return values.map(toJsonValue);
|
|
16799
17216
|
}
|
|
16800
17217
|
return void 0;
|
|
16801
17218
|
}
|
|
@@ -16823,9 +17240,10 @@ function encodeField(name, schema, seen = /* @__PURE__ */ new Set(), loaderId, s
|
|
|
16823
17240
|
name,
|
|
16824
17241
|
type,
|
|
16825
17242
|
...format ? { format } : {},
|
|
17243
|
+
...format === "datetime" && core?._zod?.def?.local ? { local: true } : {},
|
|
16826
17244
|
...optional ? { optional: true } : {},
|
|
16827
17245
|
...nullable ? { nullable: true } : {},
|
|
16828
|
-
...hasDefault ? { default:
|
|
17246
|
+
...hasDefault ? { default: toJsonValue(defaultValue) } : {},
|
|
16829
17247
|
...checks.length ? { checks } : {},
|
|
16830
17248
|
...values?.length ? { values } : {},
|
|
16831
17249
|
...meta ? { meta } : {},
|
|
@@ -17350,6 +17768,9 @@ var ExecutionContext = class _ExecutionContext {
|
|
|
17350
17768
|
get logger() {
|
|
17351
17769
|
return this.#options.logger ?? defaultLogger;
|
|
17352
17770
|
}
|
|
17771
|
+
get invocation() {
|
|
17772
|
+
return this.#options.invocation ?? {};
|
|
17773
|
+
}
|
|
17353
17774
|
get config() {
|
|
17354
17775
|
this.#config ??= this.#extension.config.resolve(this.#options.configs);
|
|
17355
17776
|
return this.#config;
|
|
@@ -17502,6 +17923,10 @@ var DictionaryMethod = class extends ExtensionMethod {
|
|
|
17502
17923
|
return this.criteria.keys();
|
|
17503
17924
|
}
|
|
17504
17925
|
// ── runtime ────────────────────────────────────────────────────────────────
|
|
17926
|
+
// `search` is always text, trimmed (FR-3910): `''` when the author typed nothing — the console then sends no
|
|
17927
|
+
// `search` at all — or only spaces. So a handler never guards it: `search ? { q: search } : undefined`, and
|
|
17928
|
+
// `search.toLowerCase()` as is. Surrounding spaces never mean anything to a lookup.
|
|
17929
|
+
//
|
|
17505
17930
|
// Two-stage: the `{ search, cursor, criteria }` envelope the runtime owns, then the author-declared
|
|
17506
17931
|
// criteria through the shared pipeline — reported as a criteria failure so the console can point at the
|
|
17507
17932
|
// dependent fields rather than the whole call.
|
|
@@ -17510,7 +17935,7 @@ var DictionaryMethod = class extends ExtensionMethod {
|
|
|
17510
17935
|
const payload = input.parseField("payload", DictionaryPayloadSchema);
|
|
17511
17936
|
const criteria = this.criteria.normalize(this.#resolveAliases(payload.criteria), input.invalidCriteria());
|
|
17512
17937
|
return {
|
|
17513
|
-
search: payload.search,
|
|
17938
|
+
search: payload.search?.trim() ?? "",
|
|
17514
17939
|
cursor: payload.cursor,
|
|
17515
17940
|
criteria
|
|
17516
17941
|
};
|
|
@@ -18861,7 +19286,23 @@ var Extension = class {
|
|
|
18861
19286
|
// generated loader, SYSTEM seam — arrives here through the same three steps.
|
|
18862
19287
|
async run(methodName, methodData, ctx) {
|
|
18863
19288
|
const method = this.getMethod(methodName);
|
|
18864
|
-
|
|
19289
|
+
const { result: input, notices } = collectNotices(() => method.validate(methodData ?? {}));
|
|
19290
|
+
this.#reportNotices(notices, methodName, ctx);
|
|
19291
|
+
return method.execute(input, ctx);
|
|
19292
|
+
}
|
|
19293
|
+
// One warning per value the pipeline accepted only under a temporary rule — today a timestamp converted for
|
|
19294
|
+
// a date-string field (FR-3920 lenient period). Named well enough to find the flow still holding one.
|
|
19295
|
+
#reportNotices(notices, methodName, ctx) {
|
|
19296
|
+
for (const { message, field, value, converted } of notices) {
|
|
19297
|
+
ctx.logger.warn(`[flow-extension:${this.id}] ${methodName}: param "${field ?? "?"}": ${message}`, {
|
|
19298
|
+
serviceId: this.id,
|
|
19299
|
+
method: methodName,
|
|
19300
|
+
param: field,
|
|
19301
|
+
value,
|
|
19302
|
+
converted,
|
|
19303
|
+
...ctx.invocation
|
|
19304
|
+
});
|
|
19305
|
+
}
|
|
18865
19306
|
}
|
|
18866
19307
|
// ── output model ────────────────────────────────────────────────────────────
|
|
18867
19308
|
toConfigItems() {
|