@flowrunner/cli 0.1.17 → 0.1.18-dev.2

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.
Files changed (40) hide show
  1. package/ai-docs/instructions/service-code-format/02-zod-types.md +173 -41
  2. package/ai-docs/instructions/service-code-format/03-parameters.md +3 -1
  3. package/ai-docs/instructions/service-code-format/05-dictionaries.md +8 -2
  4. package/ai-docs/instructions/service-code-format/07-actions.md +1 -1
  5. package/ai-docs/instructions/service-code-format/11-output-model.md +3 -0
  6. package/ai-docs/instructions/service-code-format/14-reference-service.md +1 -1
  7. package/ai-docs/instructions/service-code-format/16-gotchas.md +89 -6
  8. package/ai-docs/instructions/service-code-format/18-test-recipes.md +2 -1
  9. package/ai-docs/instructions/service-code-format/README.md +1 -1
  10. package/dist/cli.js +646 -89
  11. package/dist/cli.js.map +4 -4
  12. package/dist/index.js +645 -88
  13. package/dist/index.js.map +4 -4
  14. package/dist/types/flow-extension-runner/src/v2/context/execution-context.d.ts +8 -0
  15. package/dist/types/flow-extension-runner/src/v2/dictionaries/payload-schema.d.ts +1 -1
  16. package/dist/types/flow-extension-runner/src/v2/params/index.d.ts +2 -0
  17. package/dist/types/flow-extension-runner/src/v2/params/json/types.d.ts +2 -0
  18. package/dist/types/flow-extension-runner/src/v2/params/schema/date-format.d.ts +80 -0
  19. package/dist/types/flow-extension-runner/src/v2/params/schema/defaults.d.ts +4 -10
  20. package/dist/types/flow-extension-runner/src/v2/params/schema/field-plan.d.ts +9 -2
  21. package/dist/types/flow-extension-runner/src/v2/params/schema/introspect.d.ts +8 -0
  22. package/dist/types/flow-extension-runner/src/v2/params/schema/notices.d.ts +15 -0
  23. package/dist/types/flow-extension-runner/src/v2/params/widget-types.d.ts +1 -1
  24. package/dist/types/flow-extension-runner/src/v2/params/zod.d.ts +30 -19
  25. package/dist/types/flow-extension-runner/src/v2/types.d.ts +1 -1
  26. package/package.json +1 -1
  27. package/runtime/index.js +652 -89
  28. package/runtime/index.js.map +4 -4
  29. package/runtime/types/flow-extension-runner/src/v2/context/execution-context.d.ts +8 -0
  30. package/runtime/types/flow-extension-runner/src/v2/dictionaries/payload-schema.d.ts +1 -1
  31. package/runtime/types/flow-extension-runner/src/v2/params/index.d.ts +2 -0
  32. package/runtime/types/flow-extension-runner/src/v2/params/json/types.d.ts +2 -0
  33. package/runtime/types/flow-extension-runner/src/v2/params/schema/date-format.d.ts +80 -0
  34. package/runtime/types/flow-extension-runner/src/v2/params/schema/defaults.d.ts +4 -10
  35. package/runtime/types/flow-extension-runner/src/v2/params/schema/field-plan.d.ts +9 -2
  36. package/runtime/types/flow-extension-runner/src/v2/params/schema/introspect.d.ts +8 -0
  37. package/runtime/types/flow-extension-runner/src/v2/params/schema/notices.d.ts +15 -0
  38. package/runtime/types/flow-extension-runner/src/v2/params/widget-types.d.ts +1 -1
  39. package/runtime/types/flow-extension-runner/src/v2/params/zod.d.ts +30 -19
  40. package/runtime/types/flow-extension-runner/src/v2/types.d.ts +1 -1
package/dist/index.js CHANGED
@@ -9836,8 +9836,8 @@ var require_get_intrinsic = __commonJS({
9836
9836
  throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
9837
9837
  }
9838
9838
  var result = [];
9839
- $replace(string, rePropName, function(match, number, quote, subString) {
9840
- result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match;
9839
+ $replace(string, rePropName, function(match, number, quote2, subString) {
9840
+ result[result.length] = quote2 ? $replace(subString, reEscapeChar, "$1") : number || match;
9841
9841
  });
9842
9842
  return result;
9843
9843
  };
@@ -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",
@@ -15383,17 +15352,20 @@ function literalType(core) {
15383
15352
  const [kind] = [...kinds];
15384
15353
  return kinds.size === 1 && LITERAL_KINDS.has(kind) ? kind : void 0;
15385
15354
  }
15355
+ function hasBlankBranch(ins) {
15356
+ return !!ins.branches?.some((branch) => {
15357
+ const { core, coreType } = inspect(branch);
15358
+ return coreType === "literal" && (core._zod?.def?.values ?? []).includes("");
15359
+ });
15360
+ }
15386
15361
  function deriveWidget(ins) {
15387
15362
  const { coreType, core, meta } = ins;
15388
- if (meta.frJson) {
15389
- return { paramType: "STRING", uiComponent: { type: FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT } };
15390
- }
15391
15363
  switch (coreType) {
15392
15364
  case "string":
15393
15365
  if (meta.frWidget === FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT) {
15394
15366
  return { paramType: "STRING", uiComponent: { type: FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT } };
15395
15367
  }
15396
- return { paramType: "STRING" };
15368
+ return dateStringWidget(ins) ?? { paramType: "STRING" };
15397
15369
  case "number":
15398
15370
  case "bigint":
15399
15371
  return { paramType: "NUMBER", uiComponent: { type: FlowExtensionParamWidgetTypes.NUMERIC_STEPPER } };
@@ -15436,11 +15408,399 @@ function deriveWidget(ins) {
15436
15408
  return { paramType: "STRING" };
15437
15409
  }
15438
15410
  }
15411
+ var DATE_STRING_WIDGETS = {
15412
+ date: FlowExtensionParamWidgetTypes.DATE_PICKER,
15413
+ datetime: FlowExtensionParamWidgetTypes.DATE_TIME_PICKER,
15414
+ time: FlowExtensionParamWidgetTypes.TIME_PICKER
15415
+ };
15416
+ function dateStringWidget(ins) {
15417
+ const kind = dateStringKind(ins);
15418
+ return kind ? { paramType: "STRING", uiComponent: { type: DATE_STRING_WIDGETS[kind], valueKind: "string", format: patternOf(ins, kind) } } : void 0;
15419
+ }
15439
15420
  function shapeEntries(schema) {
15440
15421
  const shape = schema?.shape;
15441
15422
  return shape && typeof shape === "object" ? Object.entries(shape) : [];
15442
15423
  }
15443
15424
 
15425
+ // ../../flow-extension-runner/src/v2/params/schema/date-format.ts
15426
+ var ISO_PATTERNS = {
15427
+ date: "yyyy-MM-dd",
15428
+ datetime: "yyyy-MM-dd'T'HH:mm",
15429
+ time: "HH:mm"
15430
+ };
15431
+ var DATE_STRINGS_ACCEPT_TIMESTAMPS = true;
15432
+ function dateStringKind(ins) {
15433
+ if (ins.coreType !== "string") {
15434
+ return void 0;
15435
+ }
15436
+ const def = ins.core?._zod?.def;
15437
+ if (def?.format === "date" || def?.format === "time") {
15438
+ return def.format;
15439
+ }
15440
+ return def?.format === "datetime" && def.local ? "datetime" : void 0;
15441
+ }
15442
+ var patternOf = (ins, kind) => ins.meta.frDateFormat ?? ISO_PATTERNS[kind];
15443
+ var TOKENS = ["yyyy", "yy", "MM", "M", "dd", "d", "HH", "H", "hh", "h", "mm", "ss", "a"];
15444
+ var SPEC = {
15445
+ yyyy: { part: "year", width: 4 },
15446
+ yy: { part: "year", width: 2 },
15447
+ MM: { part: "month", width: 2 },
15448
+ M: { part: "month" },
15449
+ dd: { part: "day", width: 2 },
15450
+ d: { part: "day" },
15451
+ HH: { part: "hour", width: 2 },
15452
+ H: { part: "hour" },
15453
+ hh: { part: "hour", width: 2 },
15454
+ h: { part: "hour" },
15455
+ mm: { part: "minute", width: 2 },
15456
+ ss: { part: "second", width: 2 },
15457
+ a: { part: "meridiem" }
15458
+ };
15459
+ var DATE_PARTS = /* @__PURE__ */ new Set(["year", "month", "day"]);
15460
+ var TIME_PARTS = /* @__PURE__ */ new Set(["hour", "minute", "second", "meridiem"]);
15461
+ var DateFormatError = class extends Error {
15462
+ };
15463
+ var LOOK_ALIKES = {
15464
+ YYYY: "yyyy",
15465
+ YY: "yy",
15466
+ DD: "dd",
15467
+ D: "d",
15468
+ S: "ss",
15469
+ A: "a"
15470
+ };
15471
+ function tokenize(pattern, kind) {
15472
+ const tokens = [];
15473
+ let index = 0;
15474
+ while (index < pattern.length) {
15475
+ const char = pattern[index];
15476
+ if (char === "'") {
15477
+ const end = pattern.indexOf("'", index + 1);
15478
+ if (end < 0) {
15479
+ throw new DateFormatError("has an unclosed quote \u2014 literal text is written between two single quotes");
15480
+ }
15481
+ tokens.push({ literal: end === index + 1 ? "'" : pattern.slice(index + 1, end) });
15482
+ index = end + 1;
15483
+ continue;
15484
+ }
15485
+ if (!/[A-Za-z]/.test(char)) {
15486
+ tokens.push({ literal: char });
15487
+ index++;
15488
+ continue;
15489
+ }
15490
+ const run = /^([A-Za-z])\1*/.exec(pattern.slice(index))?.[0];
15491
+ const known = TOKENS.find((token) => run.startsWith(token) && token.length === run.length);
15492
+ if (!known) {
15493
+ const hint2 = LOOK_ALIKES[run] ? ` (did you mean \`${suggest(pattern, kind)}\`?)` : "";
15494
+ throw new DateFormatError(
15495
+ `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`
15496
+ );
15497
+ }
15498
+ tokens.push({ token: known });
15499
+ index += run.length;
15500
+ }
15501
+ return tokens;
15502
+ }
15503
+ function suggest(pattern, kind) {
15504
+ let fixed = pattern;
15505
+ for (const [wrong, right] of Object.entries(LOOK_ALIKES)) {
15506
+ fixed = fixed.replace(new RegExp(`(?<![A-Za-z])${wrong}(?![A-Za-z])`, "g"), right);
15507
+ }
15508
+ if (kind === "date") {
15509
+ fixed = fixed.replace(/mm/g, "MM");
15510
+ }
15511
+ return fixed;
15512
+ }
15513
+ var parsedPatterns = /* @__PURE__ */ new Map();
15514
+ function compilePattern(pattern, kind) {
15515
+ const key = `${kind}|${pattern}`;
15516
+ const cached2 = parsedPatterns.get(key);
15517
+ if (cached2) {
15518
+ return cached2;
15519
+ }
15520
+ if (typeof pattern !== "string" || !pattern.trim()) {
15521
+ throw new DateFormatError("needs a pattern, e.g. `dd/MM/yyyy`");
15522
+ }
15523
+ const tokens = tokenize(pattern, kind);
15524
+ const names = tokens.flatMap((token) => "token" in token ? [token.token] : []);
15525
+ const parts = names.map((name) => SPEC[name].part);
15526
+ const has = (part) => parts.includes(part);
15527
+ const repeated = parts.find((part, index) => parts.indexOf(part) !== index);
15528
+ if (repeated) {
15529
+ throw new DateFormatError(`names the ${repeated === "meridiem" ? "AM/PM" : repeated} twice`);
15530
+ }
15531
+ if (kind === "date" && names.includes("mm") && !has("hour")) {
15532
+ throw new DateFormatError(`uses \`mm\`, which is minutes \u2014 did you mean \`${suggest(pattern, kind)}\`?`);
15533
+ }
15534
+ if (kind === "date" && parts.some((part) => TIME_PARTS.has(part))) {
15535
+ throw new DateFormatError("has a time of day, which a date has not \u2014 declare `z.iso.datetime({ local: true })`");
15536
+ }
15537
+ if (kind === "time" && parts.some((part) => DATE_PARTS.has(part))) {
15538
+ throw new DateFormatError("has a date, which a time has not \u2014 declare `z.iso.datetime({ local: true })`");
15539
+ }
15540
+ const missing = [
15541
+ ...kind !== "time" ? [["year", "yyyy"], ["month", "MM"], ["day", "dd"]] : [],
15542
+ ...kind !== "date" ? [["hour", "HH"], ["minute", "mm"]] : []
15543
+ ].filter(([part]) => !has(part)).map(([, token]) => `\`${token}\``);
15544
+ if (missing.length) {
15545
+ throw new DateFormatError(`is missing ${missing.join(", ")} \u2014 every part of a ${describeKind(kind)} must be in it`);
15546
+ }
15547
+ if ((names.includes("HH") || names.includes("H")) && names.includes("a")) {
15548
+ throw new DateFormatError(
15549
+ "uses a 24-hour clock (`HH` / `H`) with `a` \u2014 13:45 would be written `13:45 PM`, which cannot be read back. Use `hh` / `h` with `a`, or `HH` without it"
15550
+ );
15551
+ }
15552
+ if ((names.includes("hh") || names.includes("h")) && !names.includes("a")) {
15553
+ throw new DateFormatError(
15554
+ "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"
15555
+ );
15556
+ }
15557
+ parsedPatterns.set(key, tokens);
15558
+ return tokens;
15559
+ }
15560
+ var describeKind = (kind) => kind === "date" ? "date" : kind === "time" ? "time" : "date and time";
15561
+ var pad = (value, width) => String(value).padStart(width, "0");
15562
+ function formatParts(parts, pattern, kind) {
15563
+ return compilePattern(pattern, kind).map((token) => {
15564
+ if ("literal" in token) {
15565
+ return token.literal;
15566
+ }
15567
+ const hour = parts.hour ?? 0;
15568
+ switch (token.token) {
15569
+ case "yyyy":
15570
+ return pad(parts.year ?? 0, 4);
15571
+ case "yy":
15572
+ return pad((parts.year ?? 0) % 100, 2);
15573
+ case "MM":
15574
+ return pad(parts.month ?? 0, 2);
15575
+ case "M":
15576
+ return String(parts.month ?? 0);
15577
+ case "dd":
15578
+ return pad(parts.day ?? 0, 2);
15579
+ case "d":
15580
+ return String(parts.day ?? 0);
15581
+ case "HH":
15582
+ return pad(hour, 2);
15583
+ case "H":
15584
+ return String(hour);
15585
+ case "hh":
15586
+ return pad(hour % 12 || 12, 2);
15587
+ case "h":
15588
+ return String(hour % 12 || 12);
15589
+ case "mm":
15590
+ return pad(parts.minute ?? 0, 2);
15591
+ case "ss":
15592
+ return pad(parts.second ?? 0, 2);
15593
+ case "a":
15594
+ return hour < 12 ? "AM" : "PM";
15595
+ }
15596
+ }).join("");
15597
+ }
15598
+ var escapeRegex = (text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
15599
+ function parseInPattern(text2, pattern, kind) {
15600
+ const tokens = compilePattern(pattern, kind);
15601
+ const order = [];
15602
+ const source = tokens.map((token) => {
15603
+ if ("literal" in token) {
15604
+ return escapeRegex(token.literal);
15605
+ }
15606
+ order.push(token.token);
15607
+ if (token.token === "a") {
15608
+ return "(AM|PM)";
15609
+ }
15610
+ const { width } = SPEC[token.token];
15611
+ return width ? `(\\d{${width}})` : "(\\d{1,2})";
15612
+ }).join("");
15613
+ const match = new RegExp(`^${source}$`).exec(text2);
15614
+ if (!match) {
15615
+ return void 0;
15616
+ }
15617
+ const parts = {};
15618
+ let meridiem;
15619
+ order.forEach((name, index) => {
15620
+ const raw = match[index + 1];
15621
+ if (name === "a") {
15622
+ meridiem = raw;
15623
+ return;
15624
+ }
15625
+ const value = Number(raw);
15626
+ switch (name) {
15627
+ // date-fns' two-digit year rule against its reference year 2000: 00–49 → 20xx, 50–99 → 19xx.
15628
+ case "yy":
15629
+ parts.year = value < 50 ? 2e3 + value : 1900 + value;
15630
+ break;
15631
+ case "hh":
15632
+ case "h":
15633
+ parts.hour = value;
15634
+ break;
15635
+ default:
15636
+ parts[SPEC[name].part] = value;
15637
+ }
15638
+ });
15639
+ if (meridiem) {
15640
+ if (parts.hour === void 0 || parts.hour < 1 || parts.hour > 12) {
15641
+ return void 0;
15642
+ }
15643
+ parts.hour = parts.hour % 12 + (meridiem === "PM" ? 12 : 0);
15644
+ }
15645
+ const complete = completeParts(parts, kind);
15646
+ return complete && formatParts(complete, pattern, kind) === text2 ? complete : void 0;
15647
+ }
15648
+ function completeParts(parts, kind) {
15649
+ const { year, month, day, hour, minute, second } = parts;
15650
+ if (kind !== "time" && !isRealDate(year, month, day)) {
15651
+ return void 0;
15652
+ }
15653
+ if (kind !== "date" && !isRealTime(hour, minute, second)) {
15654
+ return void 0;
15655
+ }
15656
+ return kind === "date" ? { year, month, day } : kind === "time" ? { hour, minute, ...second !== void 0 ? { second } : {} } : { year, month, day, hour, minute, ...second !== void 0 ? { second } : {} };
15657
+ }
15658
+ function isRealDate(year, month, day) {
15659
+ if (year === void 0 || month === void 0 || day === void 0 || month < 1 || month > 12 || day < 1) {
15660
+ return false;
15661
+ }
15662
+ const leap = year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
15663
+ const days = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month - 1];
15664
+ return day <= days;
15665
+ }
15666
+ 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);
15667
+ var ISO_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
15668
+ var ISO_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:Z|[+-]\d{2}(?::?\d{2})?)?$/i;
15669
+ var ISO_TIME = /^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:Z|[+-]\d{2}(?::?\d{2})?)?$/i;
15670
+ function parseIso(text2, kind) {
15671
+ const dateTime = ISO_DATE_TIME.exec(text2);
15672
+ if (dateTime) {
15673
+ const [, year, month, day, hour, minute, second] = dateTime.map(Number);
15674
+ return completeParts({ year, month, day, hour, minute, ...dateTime[6] ? { second } : {} }, kind);
15675
+ }
15676
+ const date = ISO_DATE.exec(text2);
15677
+ if (date) {
15678
+ return kind === "date" ? completeParts({ year: +date[1], month: +date[2], day: +date[3] }, kind) : void 0;
15679
+ }
15680
+ const time = ISO_TIME.exec(text2);
15681
+ if (time && kind === "time") {
15682
+ return completeParts({ hour: +time[1], minute: +time[2], ...time[3] ? { second: +time[3] } : {} }, kind);
15683
+ }
15684
+ return void 0;
15685
+ }
15686
+ function toCanonical(parts, kind) {
15687
+ const seconds = parts.second !== void 0 ? `:${pad(parts.second, 2)}` : "";
15688
+ const date = `${pad(parts.year ?? 0, 4)}-${pad(parts.month ?? 0, 2)}-${pad(parts.day ?? 0, 2)}`;
15689
+ const time = `${pad(parts.hour ?? 0, 2)}:${pad(parts.minute ?? 0, 2)}${seconds}`;
15690
+ return kind === "date" ? date : kind === "time" ? time : `${date}T${time}`;
15691
+ }
15692
+ function canonicalToPattern(canonical, ins, kind) {
15693
+ const pattern = ins.meta.frDateFormat;
15694
+ if (!pattern) {
15695
+ return canonical;
15696
+ }
15697
+ const parts = parseIso(canonical, kind);
15698
+ return parts ? formatParts(parts, pattern, kind) : canonical;
15699
+ }
15700
+ var MIN_TIMESTAMP_DIGITS = 13;
15701
+ function digitOnlyLength(pattern, kind) {
15702
+ const example = formatParts(EXAMPLE, pattern, kind);
15703
+ return /^\d+$/.test(example) ? example.length : void 0;
15704
+ }
15705
+ function isTimestamp(value, pattern, kind) {
15706
+ if (typeof value === "number") {
15707
+ return Number.isFinite(value);
15708
+ }
15709
+ if (typeof value !== "string") {
15710
+ return false;
15711
+ }
15712
+ const text2 = value.trim();
15713
+ return new RegExp(`^\\d{${MIN_TIMESTAMP_DIGITS},}$`).test(text2) && digitOnlyLength(pattern, kind) !== text2.length;
15714
+ }
15715
+ function timestampParts(value, kind) {
15716
+ const date = new Date(Number(value));
15717
+ if (Number.isNaN(date.getTime())) {
15718
+ return void 0;
15719
+ }
15720
+ const second = date.getSeconds();
15721
+ return completeParts({
15722
+ year: date.getFullYear(),
15723
+ month: date.getMonth() + 1,
15724
+ day: date.getDate(),
15725
+ hour: date.getHours(),
15726
+ minute: date.getMinutes(),
15727
+ ...second ? { second } : {}
15728
+ }, kind);
15729
+ }
15730
+ function toDateString(value, ins, kind) {
15731
+ const pattern = ins.meta.frDateFormat;
15732
+ const text2 = typeof value === "string" ? value.trim() : typeof value === "number" && Number.isInteger(value) && value >= 0 ? String(value) : void 0;
15733
+ if (text2 !== void 0) {
15734
+ const parts = (pattern ? parseInPattern(text2, pattern, kind) : void 0) ?? (typeof value === "string" ? parseIso(text2, kind) : void 0);
15735
+ if (parts) {
15736
+ return { canonical: toCanonical(parts, kind) };
15737
+ }
15738
+ }
15739
+ if (DATE_STRINGS_ACCEPT_TIMESTAMPS && isTimestamp(value, patternOf(ins, kind), kind)) {
15740
+ const parts = timestampParts(value, kind);
15741
+ return parts ? { canonical: toCanonical(parts, kind), fromTimestamp: true } : {};
15742
+ }
15743
+ return {};
15744
+ }
15745
+ var EXAMPLE = { year: 2024, month: 1, day: 31, hour: 13, minute: 45, second: 30 };
15746
+ function expectedDateString(ins, kind) {
15747
+ const pattern = patternOf(ins, kind);
15748
+ const shown = ins.meta.frDateFormat ? pattern : pattern.replace(/'T'/, "T");
15749
+ const example = formatParts(EXAMPLE, pattern, kind);
15750
+ return `${kind === "date" ? "a date" : kind === "time" ? "a time" : "a date and time"} in ${shown}, e.g. ${example}`;
15751
+ }
15752
+ function hasDateFormat(schema, seen = /* @__PURE__ */ new Set()) {
15753
+ if (!schema || seen.has(schema)) {
15754
+ return false;
15755
+ }
15756
+ seen.add(schema);
15757
+ const ins = inspect(schema);
15758
+ if (ins.meta.frDateFormat && dateStringKind(ins)) {
15759
+ return true;
15760
+ }
15761
+ const def = ins.core?._zod?.def ?? {};
15762
+ const children = [
15763
+ ...shapeEntries(ins.core).map(([, child]) => child),
15764
+ ...def.element ? [def.element] : [],
15765
+ ...def.valueType ? [def.valueType] : [],
15766
+ ...ins.branches ?? []
15767
+ ];
15768
+ return children.some((child) => hasDateFormat(child, seen));
15769
+ }
15770
+
15771
+ // ../../flow-extension-runner/src/v2/params/schema/dictionary-binding.ts
15772
+ var DictionaryScope = class _DictionaryScope {
15773
+ constructor(top, visible) {
15774
+ this.top = top;
15775
+ this.visible = visible;
15776
+ }
15777
+ static {
15778
+ this.ROOT = new _DictionaryScope(null, /* @__PURE__ */ new Set());
15779
+ }
15780
+ enter(names) {
15781
+ if (!this.top) {
15782
+ const top = new Set(names);
15783
+ return new _DictionaryScope(top, top);
15784
+ }
15785
+ return new _DictionaryScope(this.top, /* @__PURE__ */ new Set([...this.top, ...names]));
15786
+ }
15787
+ };
15788
+ function resolveDependsOn(binding, scope2) {
15789
+ const aliases = binding.criteriaAliases ?? {};
15790
+ let clash;
15791
+ const dependsOn = binding.dependsOn.map((key) => {
15792
+ const visible = [key, ...aliases[key] ?? []].filter((name) => scope2.visible.has(name));
15793
+ if (visible.length > 1 && !clash) {
15794
+ clash = { key, names: visible };
15795
+ }
15796
+ return visible[0] ?? key;
15797
+ });
15798
+ return clash ? { dependsOn, clash } : { dependsOn };
15799
+ }
15800
+ function publishedBinding(binding, scope2) {
15801
+ return { id: binding.id, dependsOn: resolveDependsOn(binding, scope2).dependsOn };
15802
+ }
15803
+
15444
15804
  // ../../flow-extension-runner/src/v2/params/schema/assert-supported-schema.ts
15445
15805
  var GUARDED_KINDS = /* @__PURE__ */ new Set(["action", "dictionary", "polling trigger", "realtime trigger", "extension"]);
15446
15806
  var SUPPORTED_TYPES = /* @__PURE__ */ new Set([
@@ -15570,6 +15930,48 @@ function assertDictionaryBinding(schema, source, path19, scope2) {
15570
15930
  );
15571
15931
  }
15572
15932
  }
15933
+ function assertDateString(schema, source, path19) {
15934
+ const ins = inspect(schema);
15935
+ const pattern = ins.meta.frDateFormat;
15936
+ const kind = dateStringKind(ins);
15937
+ if (pattern !== void 0 && !kind) {
15938
+ const format = ins.core?._zod?.def?.format;
15939
+ const zoned = ins.coreType === "string" && format === "datetime";
15940
+ refuse(
15941
+ `${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.`,
15942
+ source,
15943
+ path19,
15944
+ zoned ? "datetime" : ins.resolvedType ?? "unknown"
15945
+ );
15946
+ }
15947
+ if (!kind) {
15948
+ return;
15949
+ }
15950
+ if (pattern !== void 0) {
15951
+ try {
15952
+ compilePattern(pattern, kind);
15953
+ } catch (error) {
15954
+ if (error instanceof DateFormatError) {
15955
+ refuse(`${subjectOf(source, path19)}: \`.dateFormat('${pattern}')\` ${error.message}.`, source, path19, pattern);
15956
+ }
15957
+ throw error;
15958
+ }
15959
+ }
15960
+ const fallback = ins.defaultValue;
15961
+ if (fallback === void 0 || fallback === null) {
15962
+ return;
15963
+ }
15964
+ const written = patternOf(ins, kind);
15965
+ const fits = typeof fallback === "string" && (pattern !== void 0 ? !!parseInPattern(fallback, pattern, kind) : ((parts) => !!parts && toCanonical(parts, kind) === fallback)(parseIso(fallback, kind)));
15966
+ if (!fits) {
15967
+ refuse(
15968
+ `${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.`,
15969
+ source,
15970
+ path19,
15971
+ String(fallback)
15972
+ );
15973
+ }
15974
+ }
15573
15975
  function assertField(schema, source, path19, seen, scope2, topLevel = false) {
15574
15976
  if (!schema || seen.has(schema)) {
15575
15977
  return;
@@ -15588,6 +15990,7 @@ function assertField(schema, source, path19, seen, scope2, topLevel = false) {
15588
15990
  refuseCatch(source, path19);
15589
15991
  }
15590
15992
  assertDictionaryBinding(schema, source, path19, scope2);
15993
+ assertDateString(schema, source, path19);
15591
15994
  if (!ins.resolvedType || !SUPPORTED_TYPES.has(ins.resolvedType)) {
15592
15995
  refuseType(source, path19, ins.resolvedType);
15593
15996
  }
@@ -15777,7 +16180,6 @@ function declaredAbsence(schema) {
15777
16180
  function coerces(schema) {
15778
16181
  return inspect(schema).core?._zod?.def?.coerce === true;
15779
16182
  }
15780
- var parsesJson = (schema) => !!inspect(schema).meta.frJson;
15781
16183
  var OPEN_TYPES = /* @__PURE__ */ new Set(["unknown", "any"]);
15782
16184
  var isOpenType = (schema) => OPEN_TYPES.has(inspect(schema).coreType);
15783
16185
  function requiredOpenType(schema) {
@@ -15799,7 +16201,7 @@ function requiredOpenType(schema) {
15799
16201
  return false;
15800
16202
  }
15801
16203
  function probeAbsence(schema) {
15802
- if (coerces(schema) || parsesJson(schema)) {
16204
+ if (coerces(schema)) {
15803
16205
  return declaredAbsence(schema);
15804
16206
  }
15805
16207
  if (requiredOpenType(schema)) {
@@ -15826,7 +16228,7 @@ function absenceOf(schema) {
15826
16228
  if (cached2) {
15827
16229
  return cached2;
15828
16230
  }
15829
- const probed = { ...probeAbsence(schema), blankIsValue: isOpenType(schema) && !parsesJson(schema) };
16231
+ const probed = { ...probeAbsence(schema), blankIsValue: isOpenType(schema) };
15830
16232
  probeCache.set(schema, probed);
15831
16233
  return probed;
15832
16234
  }
@@ -15839,15 +16241,45 @@ function planField(name, schema) {
15839
16241
  label: labelOf(name, schema),
15840
16242
  coreType: ins.coreType,
15841
16243
  isUnion: !!ins.branches,
16244
+ blankBranch: hasBlankBranch(ins),
15842
16245
  absence,
15843
16246
  absorbsBlank,
15844
16247
  keepsEmpty,
15845
16248
  blankIsValue,
15846
16249
  passThroughDate: passesDateThrough(ins),
15847
- restoresDates: hasPassThroughDate(schema, inspect, shapeEntries)
16250
+ restoresDates: hasPassThroughDate(schema, inspect, shapeEntries),
16251
+ dateString: dateStringKind(ins),
16252
+ formatsDates: hasDateFormat(schema)
15848
16253
  };
15849
16254
  }
15850
16255
 
16256
+ // ../../flow-extension-runner/src/v2/params/schema/notices.ts
16257
+ var sink;
16258
+ var currentField;
16259
+ function collectNotices(fn) {
16260
+ const outer = sink;
16261
+ const notices = [];
16262
+ sink = notices;
16263
+ try {
16264
+ return { result: fn(), notices };
16265
+ } finally {
16266
+ sink = outer;
16267
+ outer?.push(...notices);
16268
+ }
16269
+ }
16270
+ function withinField(field, fn) {
16271
+ const outer = currentField;
16272
+ currentField = field;
16273
+ try {
16274
+ return fn();
16275
+ } finally {
16276
+ currentField = outer;
16277
+ }
16278
+ }
16279
+ function notice(entry) {
16280
+ sink?.push({ field: currentField, ...entry });
16281
+ }
16282
+
15851
16283
  // ../../flow-extension-runner/src/v2/params/schema/coerce.ts
15852
16284
  var ok = (value) => ({ ok: true, value });
15853
16285
  var fail = (expected) => ({ ok: false, expected });
@@ -15922,16 +16354,6 @@ function toBooleanValue(value) {
15922
16354
  const lowered = value.trim().toLowerCase();
15923
16355
  return TRUE.has(lowered) ? ok(true) : FALSE.has(lowered) ? ok(false) : fail("boolean");
15924
16356
  }
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
16357
  function coerceValue(value, coreType) {
15936
16358
  if (coreType === "string") {
15937
16359
  return toStringValue(value);
@@ -16029,8 +16451,20 @@ function coerceLeaf(value, ins) {
16029
16451
  if (ins.branches) {
16030
16452
  return ok(coerceUnion(value, ins.branches));
16031
16453
  }
16032
- if (ins.meta.frJson) {
16033
- return toJsonValue(value);
16454
+ const kind = dateStringKind(ins);
16455
+ if (kind) {
16456
+ const { canonical, fromTimestamp } = toDateString(value, ins, kind);
16457
+ if (canonical === void 0) {
16458
+ return fail(expectedDateString(ins, kind));
16459
+ }
16460
+ if (fromTimestamp) {
16461
+ notice({
16462
+ message: "a timestamp was converted to a date string in the server time zone (FR-3920 lenient period)",
16463
+ value,
16464
+ converted: canonical
16465
+ });
16466
+ }
16467
+ return ok(canonical);
16034
16468
  }
16035
16469
  const format = formatOf(ins);
16036
16470
  if (ins.coreType === "string" && isConvertibleIso(format)) {
@@ -16060,12 +16494,12 @@ function isBlank(value, ins, schema) {
16060
16494
  return false;
16061
16495
  }
16062
16496
  if (ins.branches) {
16063
- return true;
16497
+ return !hasBlankBranch(ins) || absenceOf(schema).absorbsBlank;
16064
16498
  }
16065
16499
  if (absenceOf(schema).blankIsValue) {
16066
16500
  return absenceOf(schema).absorbsBlank;
16067
16501
  }
16068
- return ins.coreType !== "string" || absenceOf(schema).absorbsBlank;
16502
+ return ins.coreType !== "string" || !!dateStringKind(ins) || absenceOf(schema).absorbsBlank;
16069
16503
  }
16070
16504
  function absentAs(schema, value) {
16071
16505
  const { absence } = absenceOf(schema);
@@ -16126,11 +16560,76 @@ var EXPECTED = {
16126
16560
  object: "an object",
16127
16561
  array: "an array",
16128
16562
  // 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"
16563
+ record: "an object"
16132
16564
  };
16133
16565
  var requiredMessage = (plan2) => `\xAB${plan2.label}\xBB is required`;
16566
+ var quote = (value) => typeof value === "string" ? JSON.stringify(value) : String(value);
16567
+ var oneOf = (values) => values.length === 1 ? quote(values[0]) : `one of: ${values.map(quote).join(", ")}`;
16568
+ var formatPhrase = (format) => {
16569
+ const described = FORMAT_DESCRIPTIONS[format ?? ""];
16570
+ return described?.replace(/^Expects (.*?), e\.g\. (.*)$/, "$1 (e.g. $2)").replace(/^Expects /, "");
16571
+ };
16572
+ var distinct = (phrases) => [...new Set(phrases.filter((phrase) => !!phrase))];
16573
+ function unionPhrases(union, value) {
16574
+ return distinct((inspect(union).branches ?? []).map((branch) => {
16575
+ try {
16576
+ const result = branch.safeParse(value);
16577
+ return branchPhrase(branch, result.error?.issues[0]);
16578
+ } catch {
16579
+ return void 0;
16580
+ }
16581
+ }));
16582
+ }
16583
+ function remainingIssue(branch, value) {
16584
+ if (!branch) {
16585
+ return void 0;
16586
+ }
16587
+ try {
16588
+ const result = branch.safeParse(coerceDeep(value, branch));
16589
+ return result.success ? void 0 : result.error?.issues[0];
16590
+ } catch {
16591
+ return void 0;
16592
+ }
16593
+ }
16594
+ function branchPhrase(branch, issue) {
16595
+ if (!branch || !issue) {
16596
+ return void 0;
16597
+ }
16598
+ const ins = inspect(branch);
16599
+ const values = ins.core._zod?.def?.values ?? [];
16600
+ if (ins.coreType === "literal" && values.length === 1 && values[0] === "") {
16601
+ return void 0;
16602
+ }
16603
+ const dateKind = dateStringKind(ins);
16604
+ if (dateKind) {
16605
+ return expectedDateString(ins, dateKind);
16606
+ }
16607
+ switch (issue.code) {
16608
+ case "invalid_type":
16609
+ return EXPECTED[issue.expected ?? ""] ?? issue.expected;
16610
+ case "invalid_value":
16611
+ return oneOf(issue.values ?? values);
16612
+ case "invalid_format":
16613
+ return formatPhrase(issue.format);
16614
+ // A bound has no short phrase ("a number of at least 10"); the branch still names its type.
16615
+ case "too_small":
16616
+ case "too_big":
16617
+ return EXPECTED[ins.coreType === "literal" ? literalType(ins.core) ?? "" : ins.coreType];
16618
+ default:
16619
+ return void 0;
16620
+ }
16621
+ }
16622
+ function unionIssue(plan2, issue, union, unionValue, fieldValue) {
16623
+ const branches = union ? inspect(union).branches : void 0;
16624
+ const errors = issue.errors ?? [];
16625
+ const deepIndex = errors.findIndex((branchIssues) => branchIssues.some((branchIssue) => (branchIssue.path ?? []).length));
16626
+ if (deepIndex >= 0) {
16627
+ const deep = remainingIssue(branches?.[deepIndex], unionValue) ?? errors[deepIndex].find((branchIssue) => (branchIssue.path ?? []).length);
16628
+ return toFieldIssue(plan2, { ...deep, path: [...issue.path ?? [], ...deep.path ?? []] }, fieldValue);
16629
+ }
16630
+ const phrases = distinct(errors.map((branchIssues, index) => branchPhrase(branches?.[index], branchIssues[0])));
16631
+ return phrases.length ? { path: "", code: "invalid_union", message: `must be ${phrases.join(", or ")}` } : void 0;
16632
+ }
16134
16633
  var invalidTypeMessage = (plan2, expected) => `\xAB${plan2.label}\xBB must be ${EXPECTED[expected] ?? expected}`;
16135
16634
  var isIndex = (segment) => /^\d+$/.test(segment);
16136
16635
  function resolveTarget(plan2, segments, fieldValue) {
@@ -16155,7 +16654,7 @@ function resolveTarget(plan2, segments, fieldValue) {
16155
16654
  schema = nested[1];
16156
16655
  label = labelOf(segment, schema);
16157
16656
  }
16158
- return { label, value, found };
16657
+ return { label, value, found, schema: found ? schema : void 0 };
16159
16658
  }
16160
16659
  function bound(value, plan2) {
16161
16660
  if (plan2.coreType !== "date" || typeof value !== "number") {
@@ -16177,6 +16676,17 @@ function toFieldIssue(plan2, issue, fieldValue) {
16177
16676
  if (isAuthored(issue)) {
16178
16677
  return { path: path19, code, message: issue.message };
16179
16678
  }
16679
+ if (code !== "invalid_union" && target.schema && inspect(target.schema).branches) {
16680
+ const combined = unionPhrases(target.schema, target.value);
16681
+ if (combined.length > 1) {
16682
+ return { path: path19, code: "invalid_union", message: `\xAB${target.label}\xBB must be ${combined.join(", or ")}` };
16683
+ }
16684
+ }
16685
+ const dateKind = target.schema ? dateStringKind(inspect(target.schema)) : void 0;
16686
+ const dateMissing = target.value == null || target.value === "";
16687
+ if (dateKind && (code === "invalid_type" || code === "invalid_format")) {
16688
+ return dateMissing ? { path: path19, code, message: requiredMessage(named) } : { path: path19, code, message: invalidTypeMessage(named, expectedDateString(inspect(target.schema), dateKind)) };
16689
+ }
16180
16690
  if (code === "invalid_type") {
16181
16691
  const received = issue.received;
16182
16692
  const absent = segments.length ? target.found && target.value == null : received === "undefined" || received === "null" || issue.expected === void 0;
@@ -16189,13 +16699,18 @@ function toFieldIssue(plan2, issue, fieldValue) {
16189
16699
  return { path: path19, code, message: `\xAB${target.label}\xBB must be at most ${bound(issue.maximum, plan2)}` };
16190
16700
  }
16191
16701
  if (code === "invalid_value") {
16192
- const values = (issue.values ?? []).map(String);
16193
- return { path: path19, code, message: `\xAB${target.label}\xBB must be one of: ${values.join(", ")}` };
16702
+ return { path: path19, code, message: `\xAB${target.label}\xBB must be ${oneOf(issue.values ?? [])}` };
16194
16703
  }
16195
16704
  if (code === "invalid_format") {
16196
16705
  const described = FORMAT_DESCRIPTIONS[issue.format ?? ""];
16197
16706
  return described ? { path: path19, code, message: `\xAB${target.label}\xBB is invalid \u2014 ${described.replace(/^Expects /, "expects ")}` } : { path: path19, code, message: `\xAB${target.label}\xBB has an invalid format` };
16198
16707
  }
16708
+ if (code === "invalid_union") {
16709
+ const combined = unionIssue(plan2, issue, target.schema, target.value, fieldValue);
16710
+ if (combined) {
16711
+ return combined.path ? combined : { path: path19, code, message: `\xAB${target.label}\xBB ${combined.message}` };
16712
+ }
16713
+ }
16199
16714
  return { path: path19, code, message: `\xAB${target.label}\xBB is invalid` };
16200
16715
  }
16201
16716
 
@@ -16216,12 +16731,12 @@ function isAbsent(value, plan2) {
16216
16731
  return false;
16217
16732
  }
16218
16733
  if (plan2.isUnion) {
16219
- return true;
16734
+ return !plan2.blankBranch || plan2.absorbsBlank;
16220
16735
  }
16221
16736
  if (plan2.blankIsValue) {
16222
16737
  return plan2.absorbsBlank;
16223
16738
  }
16224
- return plan2.coreType !== "string" || plan2.absorbsBlank;
16739
+ return plan2.coreType !== "string" || !!plan2.dateString || plan2.absorbsBlank;
16225
16740
  }
16226
16741
  function normalizeAbsence(value, plan2) {
16227
16742
  if (plan2.absence === "required") {
@@ -16260,7 +16775,7 @@ function normalizeField(value, plan2) {
16260
16775
  return restore(validate(coerced.value, plan2), value, plan2);
16261
16776
  }
16262
16777
  function restore(result, original, plan2) {
16263
- if (!plan2.restoresDates || !result.present || result.issues.length) {
16778
+ if (!(plan2.restoresDates || plan2.formatsDates) || !result.present || result.issues.length) {
16264
16779
  return result;
16265
16780
  }
16266
16781
  if (plan2.passThroughDate) {
@@ -16280,6 +16795,10 @@ function restoreDeep(output, original, schema) {
16280
16795
  const branch = ins.branches.find((option) => accepts(option, output));
16281
16796
  return branch ? restoreDeep(output, original, branch) : output;
16282
16797
  }
16798
+ const kind = dateStringKind(ins);
16799
+ if (kind) {
16800
+ return typeof output === "string" && original !== "" ? canonicalToPattern(output, ins, kind) : output;
16801
+ }
16283
16802
  const element = ins.core?._zod?.def?.element;
16284
16803
  if (ins.coreType === "array" && element && Array.isArray(output) && Array.isArray(original)) {
16285
16804
  return output.map((item, index) => restoreDeep(item, original[index], element));
@@ -16369,7 +16888,7 @@ var Params = class {
16369
16888
  const values = {};
16370
16889
  const issues = [];
16371
16890
  for (const plan2 of this.plans()) {
16372
- const result = normalizeField(source[plan2.name], plan2);
16891
+ const result = withinField(plan2.name, () => normalizeField(source[plan2.name], plan2));
16373
16892
  if (result.issues.length) {
16374
16893
  issues.push(...result.issues);
16375
16894
  } else if (result.present) {
@@ -16524,6 +17043,9 @@ function extendPrototype() {
16524
17043
  }
16525
17044
  return this.meta({ frDictionary: binding });
16526
17045
  };
17046
+ proto.dateFormat = function dateFormat(pattern) {
17047
+ return this.meta({ frDateFormat: pattern });
17048
+ };
16527
17049
  proto.labels = function labels(byValue) {
16528
17050
  return this.meta({ frLabels: byValue });
16529
17051
  };
@@ -16546,10 +17068,9 @@ function text() {
16546
17068
  return import_zod2.z.string().meta({ frWidget: FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT });
16547
17069
  }
16548
17070
  function json() {
16549
- return import_zod2.z.unknown().nonoptional().meta({
16550
- frWidget: FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT,
16551
- frJson: true
16552
- });
17071
+ throw new Error(
17072
+ "`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."
17073
+ );
16553
17074
  }
16554
17075
  var namespace = Object.create(import_zod2.z);
16555
17076
  Object.defineProperties(namespace, {
@@ -16563,7 +17084,7 @@ Object.defineProperties(namespace, {
16563
17084
  var z = namespace;
16564
17085
 
16565
17086
  // ../../flow-extension-runner/src/v2/params/json/values.ts
16566
- function toJsonValue2(value) {
17087
+ function toJsonValue(value) {
16567
17088
  if (typeof value === "bigint") {
16568
17089
  return { $bigint: value.toString() };
16569
17090
  }
@@ -16571,10 +17092,10 @@ function toJsonValue2(value) {
16571
17092
  return { $date: value.toISOString() };
16572
17093
  }
16573
17094
  if (Array.isArray(value)) {
16574
- return value.map(toJsonValue2);
17095
+ return value.map(toJsonValue);
16575
17096
  }
16576
17097
  if (value && typeof value === "object") {
16577
- return Object.fromEntries(Object.entries(value).map(([key, inner]) => [key, toJsonValue2(inner)]));
17098
+ return Object.fromEntries(Object.entries(value).map(([key, inner]) => [key, toJsonValue(inner)]));
16578
17099
  }
16579
17100
  return value;
16580
17101
  }
@@ -16609,18 +17130,18 @@ function encodeCheck(check) {
16609
17130
  switch (def.check) {
16610
17131
  // strings and arrays
16611
17132
  case "min_length":
16612
- return at("min", toJsonValue2(def.minimum));
17133
+ return at("min", toJsonValue(def.minimum));
16613
17134
  case "max_length":
16614
- return at("max", toJsonValue2(def.maximum));
17135
+ return at("max", toJsonValue(def.maximum));
16615
17136
  case "length_equals":
16616
- return at("length", toJsonValue2(def.length));
17137
+ return at("length", toJsonValue(def.length));
16617
17138
  // numbers and bigints
16618
17139
  case "greater_than":
16619
- return at("min", toJsonValue2(def.value), def.inclusive ? void 0 : true);
17140
+ return at("min", toJsonValue(def.value), def.inclusive ? void 0 : true);
16620
17141
  case "less_than":
16621
- return at("max", toJsonValue2(def.value), def.inclusive ? void 0 : true);
17142
+ return at("max", toJsonValue(def.value), def.inclusive ? void 0 : true);
16622
17143
  case "multiple_of":
16623
- return at("multipleOf", toJsonValue2(def.value));
17144
+ return at("multipleOf", toJsonValue(def.value));
16624
17145
  case "number_format":
16625
17146
  return def.format === "safeint" || def.format === "int32" ? at("int") : void 0;
16626
17147
  // the string sub-formats that are checks rather than types
@@ -16781,7 +17302,7 @@ function encodeMeta(meta, field, scope2, loaderId) {
16781
17302
  if (hasFunction(source)) {
16782
17303
  throw new Error(`Cannot encode "${field}": its metadata holds a function, which has no wire form.`);
16783
17304
  }
16784
- const encoded = toJsonValue2(source);
17305
+ const encoded = toJsonValue(source);
16785
17306
  return Object.keys(encoded).length ? encoded : void 0;
16786
17307
  }
16787
17308
  function isLoose(core) {
@@ -16791,11 +17312,11 @@ function isLoose(core) {
16791
17312
  function encodeValues(core, type) {
16792
17313
  if (type === "enum") {
16793
17314
  const entries = core?._zod?.def?.entries ?? {};
16794
- return Object.values(entries).map(toJsonValue2);
17315
+ return Object.values(entries).map(toJsonValue);
16795
17316
  }
16796
17317
  if (type === "literal") {
16797
17318
  const values = core?._zod?.def?.values ?? [];
16798
- return values.map(toJsonValue2);
17319
+ return values.map(toJsonValue);
16799
17320
  }
16800
17321
  return void 0;
16801
17322
  }
@@ -16823,9 +17344,10 @@ function encodeField(name, schema, seen = /* @__PURE__ */ new Set(), loaderId, s
16823
17344
  name,
16824
17345
  type,
16825
17346
  ...format ? { format } : {},
17347
+ ...format === "datetime" && core?._zod?.def?.local ? { local: true } : {},
16826
17348
  ...optional ? { optional: true } : {},
16827
17349
  ...nullable ? { nullable: true } : {},
16828
- ...hasDefault ? { default: toJsonValue2(defaultValue) } : {},
17350
+ ...hasDefault ? { default: toJsonValue(defaultValue) } : {},
16829
17351
  ...checks.length ? { checks } : {},
16830
17352
  ...values?.length ? { values } : {},
16831
17353
  ...meta ? { meta } : {},
@@ -17350,8 +17872,23 @@ var ExecutionContext = class _ExecutionContext {
17350
17872
  get logger() {
17351
17873
  return this.#options.logger ?? defaultLogger;
17352
17874
  }
17875
+ get invocation() {
17876
+ return this.#options.invocation ?? {};
17877
+ }
17353
17878
  get config() {
17354
- this.#config ??= this.#extension.config.resolve(this.#options.configs);
17879
+ if (!this.#config) {
17880
+ const { result, notices } = collectNotices(() => this.#extension.config.resolve(this.#options.configs));
17881
+ for (const { message, field, value, converted } of notices) {
17882
+ this.logger.warn(`[flow-extension:${this.#extension.id}] config item "${field ?? "?"}": ${message}`, {
17883
+ serviceId: this.#extension.id,
17884
+ configItem: field,
17885
+ value,
17886
+ converted,
17887
+ ...this.invocation
17888
+ });
17889
+ }
17890
+ this.#config = result;
17891
+ }
17355
17892
  return this.#config;
17356
17893
  }
17357
17894
  // The header access token plus its deserialized composite payload — or a throwing proxy when the
@@ -17502,6 +18039,10 @@ var DictionaryMethod = class extends ExtensionMethod {
17502
18039
  return this.criteria.keys();
17503
18040
  }
17504
18041
  // ── runtime ────────────────────────────────────────────────────────────────
18042
+ // `search` is always text, trimmed (FR-3910): `''` when the author typed nothing — the console then sends no
18043
+ // `search` at all — or only spaces. So a handler never guards it: `search ? { q: search } : undefined`, and
18044
+ // `search.toLowerCase()` as is. Surrounding spaces never mean anything to a lookup.
18045
+ //
17505
18046
  // Two-stage: the `{ search, cursor, criteria }` envelope the runtime owns, then the author-declared
17506
18047
  // criteria through the shared pipeline — reported as a criteria failure so the console can point at the
17507
18048
  // dependent fields rather than the whole call.
@@ -17510,7 +18051,7 @@ var DictionaryMethod = class extends ExtensionMethod {
17510
18051
  const payload = input.parseField("payload", DictionaryPayloadSchema);
17511
18052
  const criteria = this.criteria.normalize(this.#resolveAliases(payload.criteria), input.invalidCriteria());
17512
18053
  return {
17513
- search: payload.search,
18054
+ search: payload.search?.trim() ?? "",
17514
18055
  cursor: payload.cursor,
17515
18056
  criteria
17516
18057
  };
@@ -18861,7 +19402,23 @@ var Extension = class {
18861
19402
  // generated loader, SYSTEM seam — arrives here through the same three steps.
18862
19403
  async run(methodName, methodData, ctx) {
18863
19404
  const method = this.getMethod(methodName);
18864
- return method.execute(method.validate(methodData ?? {}), ctx);
19405
+ const { result: input, notices } = collectNotices(() => method.validate(methodData ?? {}));
19406
+ this.#reportNotices(notices, methodName, ctx);
19407
+ return method.execute(input, ctx);
19408
+ }
19409
+ // One warning per value the pipeline accepted only under a temporary rule — today a timestamp converted for
19410
+ // a date-string field (FR-3920 lenient period). Named well enough to find the flow still holding one.
19411
+ #reportNotices(notices, methodName, ctx) {
19412
+ for (const { message, field, value, converted } of notices) {
19413
+ ctx.logger.warn(`[flow-extension:${this.id}] ${methodName}: param "${field ?? "?"}": ${message}`, {
19414
+ serviceId: this.id,
19415
+ method: methodName,
19416
+ param: field,
19417
+ value,
19418
+ converted,
19419
+ ...ctx.invocation
19420
+ });
19421
+ }
18865
19422
  }
18866
19423
  // ── output model ────────────────────────────────────────────────────────────
18867
19424
  toConfigItems() {