@flowrunner/cli 0.1.16 → 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 +169 -29
- 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 +5 -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 +111 -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 +559 -88
- package/dist/cli.js.map +4 -4
- package/dist/index.js +558 -87
- 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 +565 -88
- 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 });
|
|
@@ -15860,8 +16266,29 @@ function toStringValue(value) {
|
|
|
15860
16266
|
if (typeof value === "boolean") {
|
|
15861
16267
|
return ok(String(value));
|
|
15862
16268
|
}
|
|
16269
|
+
if (value !== null && typeof value === "object") {
|
|
16270
|
+
return ok(value instanceof Date ? value.toISOString() : JSON.stringify(value));
|
|
16271
|
+
}
|
|
15863
16272
|
return typeof value === "number" && Number.isFinite(value) ? ok(String(value)) : fail("string");
|
|
15864
16273
|
}
|
|
16274
|
+
var OPENS = { array: "[", object: "{" };
|
|
16275
|
+
function parseContainerText(value, kind) {
|
|
16276
|
+
if (typeof value !== "string") {
|
|
16277
|
+
return value;
|
|
16278
|
+
}
|
|
16279
|
+
const text2 = value.trim();
|
|
16280
|
+
if (!text2.startsWith(OPENS[kind])) {
|
|
16281
|
+
return value;
|
|
16282
|
+
}
|
|
16283
|
+
try {
|
|
16284
|
+
const parsed = JSON.parse(text2);
|
|
16285
|
+
const isList = Array.isArray(parsed);
|
|
16286
|
+
const fits = kind === "array" ? isList : parsed !== null && typeof parsed === "object" && !isList;
|
|
16287
|
+
return fits ? parsed : value;
|
|
16288
|
+
} catch {
|
|
16289
|
+
return value;
|
|
16290
|
+
}
|
|
16291
|
+
}
|
|
15865
16292
|
function toNumberValue(value) {
|
|
15866
16293
|
if (typeof value === "number") {
|
|
15867
16294
|
return Number.isFinite(value) ? ok(value) : fail("number");
|
|
@@ -15901,16 +16328,6 @@ function toBooleanValue(value) {
|
|
|
15901
16328
|
const lowered = value.trim().toLowerCase();
|
|
15902
16329
|
return TRUE.has(lowered) ? ok(true) : FALSE.has(lowered) ? ok(false) : fail("boolean");
|
|
15903
16330
|
}
|
|
15904
|
-
function toJsonValue(value) {
|
|
15905
|
-
if (typeof value !== "string") {
|
|
15906
|
-
return ok(value);
|
|
15907
|
-
}
|
|
15908
|
-
try {
|
|
15909
|
-
return ok(JSON.parse(value));
|
|
15910
|
-
} catch {
|
|
15911
|
-
return fail("json");
|
|
15912
|
-
}
|
|
15913
|
-
}
|
|
15914
16331
|
function coerceValue(value, coreType) {
|
|
15915
16332
|
if (coreType === "string") {
|
|
15916
16333
|
return toStringValue(value);
|
|
@@ -15944,7 +16361,11 @@ function coerceUnion(value, branches) {
|
|
|
15944
16361
|
if (branches.some((branch) => accepts(branch, value))) {
|
|
15945
16362
|
return value;
|
|
15946
16363
|
}
|
|
16364
|
+
const isStructure = value !== null && typeof value === "object";
|
|
15947
16365
|
for (const branch of branches) {
|
|
16366
|
+
if (isStructure && inspect(branch).coreType === "string") {
|
|
16367
|
+
continue;
|
|
16368
|
+
}
|
|
15948
16369
|
const coerced = coerceDeep(value, branch);
|
|
15949
16370
|
if (accepts(branch, coerced)) {
|
|
15950
16371
|
return coerced;
|
|
@@ -15969,22 +16390,25 @@ function coerceDeep(value, schema) {
|
|
|
15969
16390
|
}
|
|
15970
16391
|
if (ins.coreType === "array") {
|
|
15971
16392
|
const element = ins.core?._zod?.def?.element;
|
|
15972
|
-
|
|
16393
|
+
const list = parseContainerText(value, "array");
|
|
16394
|
+
return Array.isArray(list) ? list.map((item) => coerceDeep(item, element)) : list;
|
|
15973
16395
|
}
|
|
15974
16396
|
if (ins.coreType === "record") {
|
|
15975
|
-
|
|
15976
|
-
|
|
16397
|
+
const map = parseContainerText(value, "object");
|
|
16398
|
+
if (typeof map !== "object" || Array.isArray(map)) {
|
|
16399
|
+
return map;
|
|
15977
16400
|
}
|
|
15978
16401
|
const valueType = ins.core?._zod?.def?.valueType;
|
|
15979
16402
|
return Object.fromEntries(
|
|
15980
|
-
Object.entries(
|
|
16403
|
+
Object.entries(map).map(([key, item]) => [key, coerceDeep(item, valueType)])
|
|
15981
16404
|
);
|
|
15982
16405
|
}
|
|
15983
16406
|
if (ins.coreType === "object") {
|
|
15984
|
-
|
|
15985
|
-
|
|
16407
|
+
const parsed = parseContainerText(value, "object");
|
|
16408
|
+
if (typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
16409
|
+
return parsed;
|
|
15986
16410
|
}
|
|
15987
|
-
const source =
|
|
16411
|
+
const source = parsed;
|
|
15988
16412
|
const coerced = { ...source };
|
|
15989
16413
|
for (const [name, property] of shapeEntries(ins.core)) {
|
|
15990
16414
|
if (name in source) {
|
|
@@ -16001,8 +16425,20 @@ function coerceLeaf(value, ins) {
|
|
|
16001
16425
|
if (ins.branches) {
|
|
16002
16426
|
return ok(coerceUnion(value, ins.branches));
|
|
16003
16427
|
}
|
|
16004
|
-
|
|
16005
|
-
|
|
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);
|
|
16006
16442
|
}
|
|
16007
16443
|
const format = formatOf(ins);
|
|
16008
16444
|
if (ins.coreType === "string" && isConvertibleIso(format)) {
|
|
@@ -16037,7 +16473,7 @@ function isBlank(value, ins, schema) {
|
|
|
16037
16473
|
if (absenceOf(schema).blankIsValue) {
|
|
16038
16474
|
return absenceOf(schema).absorbsBlank;
|
|
16039
16475
|
}
|
|
16040
|
-
return ins.coreType !== "string" || absenceOf(schema).absorbsBlank;
|
|
16476
|
+
return ins.coreType !== "string" || !!dateStringKind(ins) || absenceOf(schema).absorbsBlank;
|
|
16041
16477
|
}
|
|
16042
16478
|
function absentAs(schema, value) {
|
|
16043
16479
|
const { absence } = absenceOf(schema);
|
|
@@ -16097,8 +16533,8 @@ var EXPECTED = {
|
|
|
16097
16533
|
date: "a date",
|
|
16098
16534
|
object: "an object",
|
|
16099
16535
|
array: "an array",
|
|
16100
|
-
// `z.
|
|
16101
|
-
|
|
16536
|
+
// zod's own token for `z.record()`, which the author declared as a map — to a person it is an object.
|
|
16537
|
+
record: "an object"
|
|
16102
16538
|
};
|
|
16103
16539
|
var requiredMessage = (plan2) => `\xAB${plan2.label}\xBB is required`;
|
|
16104
16540
|
var invalidTypeMessage = (plan2, expected) => `\xAB${plan2.label}\xBB must be ${EXPECTED[expected] ?? expected}`;
|
|
@@ -16125,7 +16561,7 @@ function resolveTarget(plan2, segments, fieldValue) {
|
|
|
16125
16561
|
schema = nested[1];
|
|
16126
16562
|
label = labelOf(segment, schema);
|
|
16127
16563
|
}
|
|
16128
|
-
return { label, value, found };
|
|
16564
|
+
return { label, value, found, schema: found ? schema : void 0 };
|
|
16129
16565
|
}
|
|
16130
16566
|
function bound(value, plan2) {
|
|
16131
16567
|
if (plan2.coreType !== "date" || typeof value !== "number") {
|
|
@@ -16147,6 +16583,11 @@ function toFieldIssue(plan2, issue, fieldValue) {
|
|
|
16147
16583
|
if (isAuthored(issue)) {
|
|
16148
16584
|
return { path: path19, code, message: issue.message };
|
|
16149
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
|
+
}
|
|
16150
16591
|
if (code === "invalid_type") {
|
|
16151
16592
|
const received = issue.received;
|
|
16152
16593
|
const absent = segments.length ? target.found && target.value == null : received === "undefined" || received === "null" || issue.expected === void 0;
|
|
@@ -16191,7 +16632,7 @@ function isAbsent(value, plan2) {
|
|
|
16191
16632
|
if (plan2.blankIsValue) {
|
|
16192
16633
|
return plan2.absorbsBlank;
|
|
16193
16634
|
}
|
|
16194
|
-
return plan2.coreType !== "string" || plan2.absorbsBlank;
|
|
16635
|
+
return plan2.coreType !== "string" || !!plan2.dateString || plan2.absorbsBlank;
|
|
16195
16636
|
}
|
|
16196
16637
|
function normalizeAbsence(value, plan2) {
|
|
16197
16638
|
if (plan2.absence === "required") {
|
|
@@ -16230,7 +16671,7 @@ function normalizeField(value, plan2) {
|
|
|
16230
16671
|
return restore(validate(coerced.value, plan2), value, plan2);
|
|
16231
16672
|
}
|
|
16232
16673
|
function restore(result, original, plan2) {
|
|
16233
|
-
if (!plan2.restoresDates || !result.present || result.issues.length) {
|
|
16674
|
+
if (!(plan2.restoresDates || plan2.formatsDates) || !result.present || result.issues.length) {
|
|
16234
16675
|
return result;
|
|
16235
16676
|
}
|
|
16236
16677
|
if (plan2.passThroughDate) {
|
|
@@ -16250,6 +16691,10 @@ function restoreDeep(output, original, schema) {
|
|
|
16250
16691
|
const branch = ins.branches.find((option) => accepts(option, output));
|
|
16251
16692
|
return branch ? restoreDeep(output, original, branch) : output;
|
|
16252
16693
|
}
|
|
16694
|
+
const kind = dateStringKind(ins);
|
|
16695
|
+
if (kind) {
|
|
16696
|
+
return typeof output === "string" && original !== "" ? canonicalToPattern(output, ins, kind) : output;
|
|
16697
|
+
}
|
|
16253
16698
|
const element = ins.core?._zod?.def?.element;
|
|
16254
16699
|
if (ins.coreType === "array" && element && Array.isArray(output) && Array.isArray(original)) {
|
|
16255
16700
|
return output.map((item, index) => restoreDeep(item, original[index], element));
|
|
@@ -16339,7 +16784,7 @@ var Params = class {
|
|
|
16339
16784
|
const values = {};
|
|
16340
16785
|
const issues = [];
|
|
16341
16786
|
for (const plan2 of this.plans()) {
|
|
16342
|
-
const result = normalizeField(source[plan2.name], plan2);
|
|
16787
|
+
const result = withinField(plan2.name, () => normalizeField(source[plan2.name], plan2));
|
|
16343
16788
|
if (result.issues.length) {
|
|
16344
16789
|
issues.push(...result.issues);
|
|
16345
16790
|
} else if (result.present) {
|
|
@@ -16494,6 +16939,9 @@ function extendPrototype() {
|
|
|
16494
16939
|
}
|
|
16495
16940
|
return this.meta({ frDictionary: binding });
|
|
16496
16941
|
};
|
|
16942
|
+
proto.dateFormat = function dateFormat(pattern) {
|
|
16943
|
+
return this.meta({ frDateFormat: pattern });
|
|
16944
|
+
};
|
|
16497
16945
|
proto.labels = function labels(byValue) {
|
|
16498
16946
|
return this.meta({ frLabels: byValue });
|
|
16499
16947
|
};
|
|
@@ -16516,10 +16964,9 @@ function text() {
|
|
|
16516
16964
|
return import_zod2.z.string().meta({ frWidget: FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT });
|
|
16517
16965
|
}
|
|
16518
16966
|
function json() {
|
|
16519
|
-
|
|
16520
|
-
|
|
16521
|
-
|
|
16522
|
-
});
|
|
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
|
+
);
|
|
16523
16970
|
}
|
|
16524
16971
|
var namespace = Object.create(import_zod2.z);
|
|
16525
16972
|
Object.defineProperties(namespace, {
|
|
@@ -16533,7 +16980,7 @@ Object.defineProperties(namespace, {
|
|
|
16533
16980
|
var z = namespace;
|
|
16534
16981
|
|
|
16535
16982
|
// ../../flow-extension-runner/src/v2/params/json/values.ts
|
|
16536
|
-
function
|
|
16983
|
+
function toJsonValue(value) {
|
|
16537
16984
|
if (typeof value === "bigint") {
|
|
16538
16985
|
return { $bigint: value.toString() };
|
|
16539
16986
|
}
|
|
@@ -16541,10 +16988,10 @@ function toJsonValue2(value) {
|
|
|
16541
16988
|
return { $date: value.toISOString() };
|
|
16542
16989
|
}
|
|
16543
16990
|
if (Array.isArray(value)) {
|
|
16544
|
-
return value.map(
|
|
16991
|
+
return value.map(toJsonValue);
|
|
16545
16992
|
}
|
|
16546
16993
|
if (value && typeof value === "object") {
|
|
16547
|
-
return Object.fromEntries(Object.entries(value).map(([key, inner]) => [key,
|
|
16994
|
+
return Object.fromEntries(Object.entries(value).map(([key, inner]) => [key, toJsonValue(inner)]));
|
|
16548
16995
|
}
|
|
16549
16996
|
return value;
|
|
16550
16997
|
}
|
|
@@ -16579,18 +17026,18 @@ function encodeCheck(check) {
|
|
|
16579
17026
|
switch (def.check) {
|
|
16580
17027
|
// strings and arrays
|
|
16581
17028
|
case "min_length":
|
|
16582
|
-
return at("min",
|
|
17029
|
+
return at("min", toJsonValue(def.minimum));
|
|
16583
17030
|
case "max_length":
|
|
16584
|
-
return at("max",
|
|
17031
|
+
return at("max", toJsonValue(def.maximum));
|
|
16585
17032
|
case "length_equals":
|
|
16586
|
-
return at("length",
|
|
17033
|
+
return at("length", toJsonValue(def.length));
|
|
16587
17034
|
// numbers and bigints
|
|
16588
17035
|
case "greater_than":
|
|
16589
|
-
return at("min",
|
|
17036
|
+
return at("min", toJsonValue(def.value), def.inclusive ? void 0 : true);
|
|
16590
17037
|
case "less_than":
|
|
16591
|
-
return at("max",
|
|
17038
|
+
return at("max", toJsonValue(def.value), def.inclusive ? void 0 : true);
|
|
16592
17039
|
case "multiple_of":
|
|
16593
|
-
return at("multipleOf",
|
|
17040
|
+
return at("multipleOf", toJsonValue(def.value));
|
|
16594
17041
|
case "number_format":
|
|
16595
17042
|
return def.format === "safeint" || def.format === "int32" ? at("int") : void 0;
|
|
16596
17043
|
// the string sub-formats that are checks rather than types
|
|
@@ -16751,7 +17198,7 @@ function encodeMeta(meta, field, scope2, loaderId) {
|
|
|
16751
17198
|
if (hasFunction(source)) {
|
|
16752
17199
|
throw new Error(`Cannot encode "${field}": its metadata holds a function, which has no wire form.`);
|
|
16753
17200
|
}
|
|
16754
|
-
const encoded =
|
|
17201
|
+
const encoded = toJsonValue(source);
|
|
16755
17202
|
return Object.keys(encoded).length ? encoded : void 0;
|
|
16756
17203
|
}
|
|
16757
17204
|
function isLoose(core) {
|
|
@@ -16761,11 +17208,11 @@ function isLoose(core) {
|
|
|
16761
17208
|
function encodeValues(core, type) {
|
|
16762
17209
|
if (type === "enum") {
|
|
16763
17210
|
const entries = core?._zod?.def?.entries ?? {};
|
|
16764
|
-
return Object.values(entries).map(
|
|
17211
|
+
return Object.values(entries).map(toJsonValue);
|
|
16765
17212
|
}
|
|
16766
17213
|
if (type === "literal") {
|
|
16767
17214
|
const values = core?._zod?.def?.values ?? [];
|
|
16768
|
-
return values.map(
|
|
17215
|
+
return values.map(toJsonValue);
|
|
16769
17216
|
}
|
|
16770
17217
|
return void 0;
|
|
16771
17218
|
}
|
|
@@ -16793,9 +17240,10 @@ function encodeField(name, schema, seen = /* @__PURE__ */ new Set(), loaderId, s
|
|
|
16793
17240
|
name,
|
|
16794
17241
|
type,
|
|
16795
17242
|
...format ? { format } : {},
|
|
17243
|
+
...format === "datetime" && core?._zod?.def?.local ? { local: true } : {},
|
|
16796
17244
|
...optional ? { optional: true } : {},
|
|
16797
17245
|
...nullable ? { nullable: true } : {},
|
|
16798
|
-
...hasDefault ? { default:
|
|
17246
|
+
...hasDefault ? { default: toJsonValue(defaultValue) } : {},
|
|
16799
17247
|
...checks.length ? { checks } : {},
|
|
16800
17248
|
...values?.length ? { values } : {},
|
|
16801
17249
|
...meta ? { meta } : {},
|
|
@@ -17320,6 +17768,9 @@ var ExecutionContext = class _ExecutionContext {
|
|
|
17320
17768
|
get logger() {
|
|
17321
17769
|
return this.#options.logger ?? defaultLogger;
|
|
17322
17770
|
}
|
|
17771
|
+
get invocation() {
|
|
17772
|
+
return this.#options.invocation ?? {};
|
|
17773
|
+
}
|
|
17323
17774
|
get config() {
|
|
17324
17775
|
this.#config ??= this.#extension.config.resolve(this.#options.configs);
|
|
17325
17776
|
return this.#config;
|
|
@@ -17472,6 +17923,10 @@ var DictionaryMethod = class extends ExtensionMethod {
|
|
|
17472
17923
|
return this.criteria.keys();
|
|
17473
17924
|
}
|
|
17474
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
|
+
//
|
|
17475
17930
|
// Two-stage: the `{ search, cursor, criteria }` envelope the runtime owns, then the author-declared
|
|
17476
17931
|
// criteria through the shared pipeline — reported as a criteria failure so the console can point at the
|
|
17477
17932
|
// dependent fields rather than the whole call.
|
|
@@ -17480,7 +17935,7 @@ var DictionaryMethod = class extends ExtensionMethod {
|
|
|
17480
17935
|
const payload = input.parseField("payload", DictionaryPayloadSchema);
|
|
17481
17936
|
const criteria = this.criteria.normalize(this.#resolveAliases(payload.criteria), input.invalidCriteria());
|
|
17482
17937
|
return {
|
|
17483
|
-
search: payload.search,
|
|
17938
|
+
search: payload.search?.trim() ?? "",
|
|
17484
17939
|
cursor: payload.cursor,
|
|
17485
17940
|
criteria
|
|
17486
17941
|
};
|
|
@@ -18831,7 +19286,23 @@ var Extension = class {
|
|
|
18831
19286
|
// generated loader, SYSTEM seam — arrives here through the same three steps.
|
|
18832
19287
|
async run(methodName, methodData, ctx) {
|
|
18833
19288
|
const method = this.getMethod(methodName);
|
|
18834
|
-
|
|
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
|
+
}
|
|
18835
19306
|
}
|
|
18836
19307
|
// ── output model ────────────────────────────────────────────────────────────
|
|
18837
19308
|
toConfigItems() {
|