@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/cli.js CHANGED
@@ -9832,8 +9832,8 @@ var require_get_intrinsic = __commonJS({
9832
9832
  throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
9833
9833
  }
9834
9834
  var result = [];
9835
- $replace(string, rePropName, function(match, number, quote, subString) {
9836
- result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match;
9835
+ $replace(string, rePropName, function(match, number, quote2, subString) {
9836
+ result[result.length] = quote2 ? $replace(subString, reEscapeChar, "$1") : number || match;
9837
9837
  });
9838
9838
  return result;
9839
9839
  };
@@ -14508,7 +14508,7 @@ var require_package = __commonJS({
14508
14508
  "package.json"(exports2, module2) {
14509
14509
  module2.exports = {
14510
14510
  name: "@flowrunner/cli",
14511
- version: "0.1.17",
14511
+ version: "0.1.18-dev.2",
14512
14512
  publishConfig: {
14513
14513
  access: "public"
14514
14514
  },
@@ -15758,39 +15758,6 @@ function assertObjectSchema(scheme, source) {
15758
15758
  );
15759
15759
  }
15760
15760
 
15761
- // ../../flow-extension-runner/src/v2/params/schema/dictionary-binding.ts
15762
- var DictionaryScope = class _DictionaryScope {
15763
- constructor(top, visible) {
15764
- this.top = top;
15765
- this.visible = visible;
15766
- }
15767
- static {
15768
- this.ROOT = new _DictionaryScope(null, /* @__PURE__ */ new Set());
15769
- }
15770
- enter(names) {
15771
- if (!this.top) {
15772
- const top = new Set(names);
15773
- return new _DictionaryScope(top, top);
15774
- }
15775
- return new _DictionaryScope(this.top, /* @__PURE__ */ new Set([...this.top, ...names]));
15776
- }
15777
- };
15778
- function resolveDependsOn(binding, scope2) {
15779
- const aliases = binding.criteriaAliases ?? {};
15780
- let clash;
15781
- const dependsOn = binding.dependsOn.map((key) => {
15782
- const visible = [key, ...aliases[key] ?? []].filter((name) => scope2.visible.has(name));
15783
- if (visible.length > 1 && !clash) {
15784
- clash = { key, names: visible };
15785
- }
15786
- return visible[0] ?? key;
15787
- });
15788
- return clash ? { dependsOn, clash } : { dependsOn };
15789
- }
15790
- function publishedBinding(binding, scope2) {
15791
- return { id: binding.id, dependsOn: resolveDependsOn(binding, scope2).dependsOn };
15792
- }
15793
-
15794
15761
  // ../../flow-extension-runner/src/v2/params/widget-types.ts
15795
15762
  var FlowExtensionParamGroupTypes = {
15796
15763
  FILE_UPLOAD_OPTIONS: "FILE_UPLOAD_OPTIONS",
@@ -15809,7 +15776,9 @@ var FlowExtensionParamWidgetTypes = {
15809
15776
  ...FlowExtensionParamGroupTypes,
15810
15777
  // legacy — no zod declaration produces these. They reach the console only from a legacy JSDoc-format
15811
15778
  // service, which writes `uiComponent` by hand. Kept because the console still renders them for an
15812
- // already-installed extension.
15779
+ // already-installed extension. `DATE_TIME_PICKER` / `TIME_PICKER` are also published, with
15780
+ // `valueKind: 'string'` and `format`, by `z.iso.datetime({ local: true })` / `z.iso.time()` (FR-3920) —
15781
+ // without `valueKind` they are the legacy tokens, storing epoch millis.
15813
15782
  NUMERIC: "NUMERIC",
15814
15783
  CHECKBOX: "CHECKBOX",
15815
15784
  DATE_TIME_PICKER: "DATE_TIME_PICKER",
@@ -15902,17 +15871,20 @@ function literalType(core) {
15902
15871
  const [kind] = [...kinds];
15903
15872
  return kinds.size === 1 && LITERAL_KINDS.has(kind) ? kind : void 0;
15904
15873
  }
15874
+ function hasBlankBranch(ins) {
15875
+ return !!ins.branches?.some((branch) => {
15876
+ const { core, coreType } = inspect(branch);
15877
+ return coreType === "literal" && (core._zod?.def?.values ?? []).includes("");
15878
+ });
15879
+ }
15905
15880
  function deriveWidget(ins) {
15906
15881
  const { coreType, core, meta } = ins;
15907
- if (meta.frJson) {
15908
- return { paramType: "STRING", uiComponent: { type: FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT } };
15909
- }
15910
15882
  switch (coreType) {
15911
15883
  case "string":
15912
15884
  if (meta.frWidget === FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT) {
15913
15885
  return { paramType: "STRING", uiComponent: { type: FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT } };
15914
15886
  }
15915
- return { paramType: "STRING" };
15887
+ return dateStringWidget(ins) ?? { paramType: "STRING" };
15916
15888
  case "number":
15917
15889
  case "bigint":
15918
15890
  return { paramType: "NUMBER", uiComponent: { type: FlowExtensionParamWidgetTypes.NUMERIC_STEPPER } };
@@ -15955,11 +15927,399 @@ function deriveWidget(ins) {
15955
15927
  return { paramType: "STRING" };
15956
15928
  }
15957
15929
  }
15930
+ var DATE_STRING_WIDGETS = {
15931
+ date: FlowExtensionParamWidgetTypes.DATE_PICKER,
15932
+ datetime: FlowExtensionParamWidgetTypes.DATE_TIME_PICKER,
15933
+ time: FlowExtensionParamWidgetTypes.TIME_PICKER
15934
+ };
15935
+ function dateStringWidget(ins) {
15936
+ const kind = dateStringKind(ins);
15937
+ return kind ? { paramType: "STRING", uiComponent: { type: DATE_STRING_WIDGETS[kind], valueKind: "string", format: patternOf(ins, kind) } } : void 0;
15938
+ }
15958
15939
  function shapeEntries(schema) {
15959
15940
  const shape = schema?.shape;
15960
15941
  return shape && typeof shape === "object" ? Object.entries(shape) : [];
15961
15942
  }
15962
15943
 
15944
+ // ../../flow-extension-runner/src/v2/params/schema/date-format.ts
15945
+ var ISO_PATTERNS = {
15946
+ date: "yyyy-MM-dd",
15947
+ datetime: "yyyy-MM-dd'T'HH:mm",
15948
+ time: "HH:mm"
15949
+ };
15950
+ var DATE_STRINGS_ACCEPT_TIMESTAMPS = true;
15951
+ function dateStringKind(ins) {
15952
+ if (ins.coreType !== "string") {
15953
+ return void 0;
15954
+ }
15955
+ const def = ins.core?._zod?.def;
15956
+ if (def?.format === "date" || def?.format === "time") {
15957
+ return def.format;
15958
+ }
15959
+ return def?.format === "datetime" && def.local ? "datetime" : void 0;
15960
+ }
15961
+ var patternOf = (ins, kind) => ins.meta.frDateFormat ?? ISO_PATTERNS[kind];
15962
+ var TOKENS = ["yyyy", "yy", "MM", "M", "dd", "d", "HH", "H", "hh", "h", "mm", "ss", "a"];
15963
+ var SPEC = {
15964
+ yyyy: { part: "year", width: 4 },
15965
+ yy: { part: "year", width: 2 },
15966
+ MM: { part: "month", width: 2 },
15967
+ M: { part: "month" },
15968
+ dd: { part: "day", width: 2 },
15969
+ d: { part: "day" },
15970
+ HH: { part: "hour", width: 2 },
15971
+ H: { part: "hour" },
15972
+ hh: { part: "hour", width: 2 },
15973
+ h: { part: "hour" },
15974
+ mm: { part: "minute", width: 2 },
15975
+ ss: { part: "second", width: 2 },
15976
+ a: { part: "meridiem" }
15977
+ };
15978
+ var DATE_PARTS = /* @__PURE__ */ new Set(["year", "month", "day"]);
15979
+ var TIME_PARTS = /* @__PURE__ */ new Set(["hour", "minute", "second", "meridiem"]);
15980
+ var DateFormatError = class extends Error {
15981
+ };
15982
+ var LOOK_ALIKES = {
15983
+ YYYY: "yyyy",
15984
+ YY: "yy",
15985
+ DD: "dd",
15986
+ D: "d",
15987
+ S: "ss",
15988
+ A: "a"
15989
+ };
15990
+ function tokenize(pattern, kind) {
15991
+ const tokens = [];
15992
+ let index = 0;
15993
+ while (index < pattern.length) {
15994
+ const char = pattern[index];
15995
+ if (char === "'") {
15996
+ const end = pattern.indexOf("'", index + 1);
15997
+ if (end < 0) {
15998
+ throw new DateFormatError("has an unclosed quote \u2014 literal text is written between two single quotes");
15999
+ }
16000
+ tokens.push({ literal: end === index + 1 ? "'" : pattern.slice(index + 1, end) });
16001
+ index = end + 1;
16002
+ continue;
16003
+ }
16004
+ if (!/[A-Za-z]/.test(char)) {
16005
+ tokens.push({ literal: char });
16006
+ index++;
16007
+ continue;
16008
+ }
16009
+ const run = /^([A-Za-z])\1*/.exec(pattern.slice(index))?.[0];
16010
+ const known = TOKENS.find((token) => run.startsWith(token) && token.length === run.length);
16011
+ if (!known) {
16012
+ const hint3 = LOOK_ALIKES[run] ? ` (did you mean \`${suggest(pattern, kind)}\`?)` : "";
16013
+ throw new DateFormatError(
16014
+ `uses \`${run}\`, which is not a supported token${hint3}. Supported: yyyy yy MM M dd d HH H hh h mm ss a, and literal text in single quotes`
16015
+ );
16016
+ }
16017
+ tokens.push({ token: known });
16018
+ index += run.length;
16019
+ }
16020
+ return tokens;
16021
+ }
16022
+ function suggest(pattern, kind) {
16023
+ let fixed = pattern;
16024
+ for (const [wrong, right] of Object.entries(LOOK_ALIKES)) {
16025
+ fixed = fixed.replace(new RegExp(`(?<![A-Za-z])${wrong}(?![A-Za-z])`, "g"), right);
16026
+ }
16027
+ if (kind === "date") {
16028
+ fixed = fixed.replace(/mm/g, "MM");
16029
+ }
16030
+ return fixed;
16031
+ }
16032
+ var parsedPatterns = /* @__PURE__ */ new Map();
16033
+ function compilePattern(pattern, kind) {
16034
+ const key = `${kind}|${pattern}`;
16035
+ const cached2 = parsedPatterns.get(key);
16036
+ if (cached2) {
16037
+ return cached2;
16038
+ }
16039
+ if (typeof pattern !== "string" || !pattern.trim()) {
16040
+ throw new DateFormatError("needs a pattern, e.g. `dd/MM/yyyy`");
16041
+ }
16042
+ const tokens = tokenize(pattern, kind);
16043
+ const names = tokens.flatMap((token) => "token" in token ? [token.token] : []);
16044
+ const parts = names.map((name) => SPEC[name].part);
16045
+ const has = (part) => parts.includes(part);
16046
+ const repeated = parts.find((part, index) => parts.indexOf(part) !== index);
16047
+ if (repeated) {
16048
+ throw new DateFormatError(`names the ${repeated === "meridiem" ? "AM/PM" : repeated} twice`);
16049
+ }
16050
+ if (kind === "date" && names.includes("mm") && !has("hour")) {
16051
+ throw new DateFormatError(`uses \`mm\`, which is minutes \u2014 did you mean \`${suggest(pattern, kind)}\`?`);
16052
+ }
16053
+ if (kind === "date" && parts.some((part) => TIME_PARTS.has(part))) {
16054
+ throw new DateFormatError("has a time of day, which a date has not \u2014 declare `z.iso.datetime({ local: true })`");
16055
+ }
16056
+ if (kind === "time" && parts.some((part) => DATE_PARTS.has(part))) {
16057
+ throw new DateFormatError("has a date, which a time has not \u2014 declare `z.iso.datetime({ local: true })`");
16058
+ }
16059
+ const missing = [
16060
+ ...kind !== "time" ? [["year", "yyyy"], ["month", "MM"], ["day", "dd"]] : [],
16061
+ ...kind !== "date" ? [["hour", "HH"], ["minute", "mm"]] : []
16062
+ ].filter(([part]) => !has(part)).map(([, token]) => `\`${token}\``);
16063
+ if (missing.length) {
16064
+ throw new DateFormatError(`is missing ${missing.join(", ")} \u2014 every part of a ${describeKind(kind)} must be in it`);
16065
+ }
16066
+ if ((names.includes("HH") || names.includes("H")) && names.includes("a")) {
16067
+ throw new DateFormatError(
16068
+ "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"
16069
+ );
16070
+ }
16071
+ if ((names.includes("hh") || names.includes("h")) && !names.includes("a")) {
16072
+ throw new DateFormatError(
16073
+ "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"
16074
+ );
16075
+ }
16076
+ parsedPatterns.set(key, tokens);
16077
+ return tokens;
16078
+ }
16079
+ var describeKind = (kind) => kind === "date" ? "date" : kind === "time" ? "time" : "date and time";
16080
+ var pad = (value, width) => String(value).padStart(width, "0");
16081
+ function formatParts(parts, pattern, kind) {
16082
+ return compilePattern(pattern, kind).map((token) => {
16083
+ if ("literal" in token) {
16084
+ return token.literal;
16085
+ }
16086
+ const hour = parts.hour ?? 0;
16087
+ switch (token.token) {
16088
+ case "yyyy":
16089
+ return pad(parts.year ?? 0, 4);
16090
+ case "yy":
16091
+ return pad((parts.year ?? 0) % 100, 2);
16092
+ case "MM":
16093
+ return pad(parts.month ?? 0, 2);
16094
+ case "M":
16095
+ return String(parts.month ?? 0);
16096
+ case "dd":
16097
+ return pad(parts.day ?? 0, 2);
16098
+ case "d":
16099
+ return String(parts.day ?? 0);
16100
+ case "HH":
16101
+ return pad(hour, 2);
16102
+ case "H":
16103
+ return String(hour);
16104
+ case "hh":
16105
+ return pad(hour % 12 || 12, 2);
16106
+ case "h":
16107
+ return String(hour % 12 || 12);
16108
+ case "mm":
16109
+ return pad(parts.minute ?? 0, 2);
16110
+ case "ss":
16111
+ return pad(parts.second ?? 0, 2);
16112
+ case "a":
16113
+ return hour < 12 ? "AM" : "PM";
16114
+ }
16115
+ }).join("");
16116
+ }
16117
+ var escapeRegex = (text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
16118
+ function parseInPattern(text2, pattern, kind) {
16119
+ const tokens = compilePattern(pattern, kind);
16120
+ const order = [];
16121
+ const source = tokens.map((token) => {
16122
+ if ("literal" in token) {
16123
+ return escapeRegex(token.literal);
16124
+ }
16125
+ order.push(token.token);
16126
+ if (token.token === "a") {
16127
+ return "(AM|PM)";
16128
+ }
16129
+ const { width } = SPEC[token.token];
16130
+ return width ? `(\\d{${width}})` : "(\\d{1,2})";
16131
+ }).join("");
16132
+ const match = new RegExp(`^${source}$`).exec(text2);
16133
+ if (!match) {
16134
+ return void 0;
16135
+ }
16136
+ const parts = {};
16137
+ let meridiem;
16138
+ order.forEach((name, index) => {
16139
+ const raw = match[index + 1];
16140
+ if (name === "a") {
16141
+ meridiem = raw;
16142
+ return;
16143
+ }
16144
+ const value = Number(raw);
16145
+ switch (name) {
16146
+ // date-fns' two-digit year rule against its reference year 2000: 00–49 → 20xx, 50–99 → 19xx.
16147
+ case "yy":
16148
+ parts.year = value < 50 ? 2e3 + value : 1900 + value;
16149
+ break;
16150
+ case "hh":
16151
+ case "h":
16152
+ parts.hour = value;
16153
+ break;
16154
+ default:
16155
+ parts[SPEC[name].part] = value;
16156
+ }
16157
+ });
16158
+ if (meridiem) {
16159
+ if (parts.hour === void 0 || parts.hour < 1 || parts.hour > 12) {
16160
+ return void 0;
16161
+ }
16162
+ parts.hour = parts.hour % 12 + (meridiem === "PM" ? 12 : 0);
16163
+ }
16164
+ const complete = completeParts(parts, kind);
16165
+ return complete && formatParts(complete, pattern, kind) === text2 ? complete : void 0;
16166
+ }
16167
+ function completeParts(parts, kind) {
16168
+ const { year, month, day, hour, minute, second } = parts;
16169
+ if (kind !== "time" && !isRealDate(year, month, day)) {
16170
+ return void 0;
16171
+ }
16172
+ if (kind !== "date" && !isRealTime(hour, minute, second)) {
16173
+ return void 0;
16174
+ }
16175
+ return kind === "date" ? { year, month, day } : kind === "time" ? { hour, minute, ...second !== void 0 ? { second } : {} } : { year, month, day, hour, minute, ...second !== void 0 ? { second } : {} };
16176
+ }
16177
+ function isRealDate(year, month, day) {
16178
+ if (year === void 0 || month === void 0 || day === void 0 || month < 1 || month > 12 || day < 1) {
16179
+ return false;
16180
+ }
16181
+ const leap = year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
16182
+ const days = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month - 1];
16183
+ return day <= days;
16184
+ }
16185
+ 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);
16186
+ var ISO_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
16187
+ var ISO_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:Z|[+-]\d{2}(?::?\d{2})?)?$/i;
16188
+ var ISO_TIME = /^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:Z|[+-]\d{2}(?::?\d{2})?)?$/i;
16189
+ function parseIso(text2, kind) {
16190
+ const dateTime = ISO_DATE_TIME.exec(text2);
16191
+ if (dateTime) {
16192
+ const [, year, month, day, hour, minute, second] = dateTime.map(Number);
16193
+ return completeParts({ year, month, day, hour, minute, ...dateTime[6] ? { second } : {} }, kind);
16194
+ }
16195
+ const date = ISO_DATE.exec(text2);
16196
+ if (date) {
16197
+ return kind === "date" ? completeParts({ year: +date[1], month: +date[2], day: +date[3] }, kind) : void 0;
16198
+ }
16199
+ const time = ISO_TIME.exec(text2);
16200
+ if (time && kind === "time") {
16201
+ return completeParts({ hour: +time[1], minute: +time[2], ...time[3] ? { second: +time[3] } : {} }, kind);
16202
+ }
16203
+ return void 0;
16204
+ }
16205
+ function toCanonical(parts, kind) {
16206
+ const seconds = parts.second !== void 0 ? `:${pad(parts.second, 2)}` : "";
16207
+ const date = `${pad(parts.year ?? 0, 4)}-${pad(parts.month ?? 0, 2)}-${pad(parts.day ?? 0, 2)}`;
16208
+ const time = `${pad(parts.hour ?? 0, 2)}:${pad(parts.minute ?? 0, 2)}${seconds}`;
16209
+ return kind === "date" ? date : kind === "time" ? time : `${date}T${time}`;
16210
+ }
16211
+ function canonicalToPattern(canonical, ins, kind) {
16212
+ const pattern = ins.meta.frDateFormat;
16213
+ if (!pattern) {
16214
+ return canonical;
16215
+ }
16216
+ const parts = parseIso(canonical, kind);
16217
+ return parts ? formatParts(parts, pattern, kind) : canonical;
16218
+ }
16219
+ var MIN_TIMESTAMP_DIGITS = 13;
16220
+ function digitOnlyLength(pattern, kind) {
16221
+ const example = formatParts(EXAMPLE, pattern, kind);
16222
+ return /^\d+$/.test(example) ? example.length : void 0;
16223
+ }
16224
+ function isTimestamp(value, pattern, kind) {
16225
+ if (typeof value === "number") {
16226
+ return Number.isFinite(value);
16227
+ }
16228
+ if (typeof value !== "string") {
16229
+ return false;
16230
+ }
16231
+ const text2 = value.trim();
16232
+ return new RegExp(`^\\d{${MIN_TIMESTAMP_DIGITS},}$`).test(text2) && digitOnlyLength(pattern, kind) !== text2.length;
16233
+ }
16234
+ function timestampParts(value, kind) {
16235
+ const date = new Date(Number(value));
16236
+ if (Number.isNaN(date.getTime())) {
16237
+ return void 0;
16238
+ }
16239
+ const second = date.getSeconds();
16240
+ return completeParts({
16241
+ year: date.getFullYear(),
16242
+ month: date.getMonth() + 1,
16243
+ day: date.getDate(),
16244
+ hour: date.getHours(),
16245
+ minute: date.getMinutes(),
16246
+ ...second ? { second } : {}
16247
+ }, kind);
16248
+ }
16249
+ function toDateString(value, ins, kind) {
16250
+ const pattern = ins.meta.frDateFormat;
16251
+ const text2 = typeof value === "string" ? value.trim() : typeof value === "number" && Number.isInteger(value) && value >= 0 ? String(value) : void 0;
16252
+ if (text2 !== void 0) {
16253
+ const parts = (pattern ? parseInPattern(text2, pattern, kind) : void 0) ?? (typeof value === "string" ? parseIso(text2, kind) : void 0);
16254
+ if (parts) {
16255
+ return { canonical: toCanonical(parts, kind) };
16256
+ }
16257
+ }
16258
+ if (DATE_STRINGS_ACCEPT_TIMESTAMPS && isTimestamp(value, patternOf(ins, kind), kind)) {
16259
+ const parts = timestampParts(value, kind);
16260
+ return parts ? { canonical: toCanonical(parts, kind), fromTimestamp: true } : {};
16261
+ }
16262
+ return {};
16263
+ }
16264
+ var EXAMPLE = { year: 2024, month: 1, day: 31, hour: 13, minute: 45, second: 30 };
16265
+ function expectedDateString(ins, kind) {
16266
+ const pattern = patternOf(ins, kind);
16267
+ const shown = ins.meta.frDateFormat ? pattern : pattern.replace(/'T'/, "T");
16268
+ const example = formatParts(EXAMPLE, pattern, kind);
16269
+ return `${kind === "date" ? "a date" : kind === "time" ? "a time" : "a date and time"} in ${shown}, e.g. ${example}`;
16270
+ }
16271
+ function hasDateFormat(schema, seen = /* @__PURE__ */ new Set()) {
16272
+ if (!schema || seen.has(schema)) {
16273
+ return false;
16274
+ }
16275
+ seen.add(schema);
16276
+ const ins = inspect(schema);
16277
+ if (ins.meta.frDateFormat && dateStringKind(ins)) {
16278
+ return true;
16279
+ }
16280
+ const def = ins.core?._zod?.def ?? {};
16281
+ const children = [
16282
+ ...shapeEntries(ins.core).map(([, child]) => child),
16283
+ ...def.element ? [def.element] : [],
16284
+ ...def.valueType ? [def.valueType] : [],
16285
+ ...ins.branches ?? []
16286
+ ];
16287
+ return children.some((child) => hasDateFormat(child, seen));
16288
+ }
16289
+
16290
+ // ../../flow-extension-runner/src/v2/params/schema/dictionary-binding.ts
16291
+ var DictionaryScope = class _DictionaryScope {
16292
+ constructor(top, visible) {
16293
+ this.top = top;
16294
+ this.visible = visible;
16295
+ }
16296
+ static {
16297
+ this.ROOT = new _DictionaryScope(null, /* @__PURE__ */ new Set());
16298
+ }
16299
+ enter(names) {
16300
+ if (!this.top) {
16301
+ const top = new Set(names);
16302
+ return new _DictionaryScope(top, top);
16303
+ }
16304
+ return new _DictionaryScope(this.top, /* @__PURE__ */ new Set([...this.top, ...names]));
16305
+ }
16306
+ };
16307
+ function resolveDependsOn(binding, scope2) {
16308
+ const aliases = binding.criteriaAliases ?? {};
16309
+ let clash;
16310
+ const dependsOn = binding.dependsOn.map((key) => {
16311
+ const visible = [key, ...aliases[key] ?? []].filter((name) => scope2.visible.has(name));
16312
+ if (visible.length > 1 && !clash) {
16313
+ clash = { key, names: visible };
16314
+ }
16315
+ return visible[0] ?? key;
16316
+ });
16317
+ return clash ? { dependsOn, clash } : { dependsOn };
16318
+ }
16319
+ function publishedBinding(binding, scope2) {
16320
+ return { id: binding.id, dependsOn: resolveDependsOn(binding, scope2).dependsOn };
16321
+ }
16322
+
15963
16323
  // ../../flow-extension-runner/src/v2/params/schema/assert-supported-schema.ts
15964
16324
  var GUARDED_KINDS = /* @__PURE__ */ new Set(["action", "dictionary", "polling trigger", "realtime trigger", "extension"]);
15965
16325
  var SUPPORTED_TYPES = /* @__PURE__ */ new Set([
@@ -16089,6 +16449,48 @@ function assertDictionaryBinding(schema, source, path23, scope2) {
16089
16449
  );
16090
16450
  }
16091
16451
  }
16452
+ function assertDateString(schema, source, path23) {
16453
+ const ins = inspect(schema);
16454
+ const pattern = ins.meta.frDateFormat;
16455
+ const kind = dateStringKind(ins);
16456
+ if (pattern !== void 0 && !kind) {
16457
+ const format = ins.core?._zod?.def?.format;
16458
+ const zoned = ins.coreType === "string" && format === "datetime";
16459
+ refuse(
16460
+ `${subjectOf(source, path23)} 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.`,
16461
+ source,
16462
+ path23,
16463
+ zoned ? "datetime" : ins.resolvedType ?? "unknown"
16464
+ );
16465
+ }
16466
+ if (!kind) {
16467
+ return;
16468
+ }
16469
+ if (pattern !== void 0) {
16470
+ try {
16471
+ compilePattern(pattern, kind);
16472
+ } catch (error) {
16473
+ if (error instanceof DateFormatError) {
16474
+ refuse(`${subjectOf(source, path23)}: \`.dateFormat('${pattern}')\` ${error.message}.`, source, path23, pattern);
16475
+ }
16476
+ throw error;
16477
+ }
16478
+ }
16479
+ const fallback = ins.defaultValue;
16480
+ if (fallback === void 0 || fallback === null) {
16481
+ return;
16482
+ }
16483
+ const written = patternOf(ins, kind);
16484
+ const fits = typeof fallback === "string" && (pattern !== void 0 ? !!parseInPattern(fallback, pattern, kind) : ((parts) => !!parts && toCanonical(parts, kind) === fallback)(parseIso(fallback, kind)));
16485
+ if (!fits) {
16486
+ refuse(
16487
+ `${subjectOf(source, path23)} 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.`,
16488
+ source,
16489
+ path23,
16490
+ String(fallback)
16491
+ );
16492
+ }
16493
+ }
16092
16494
  function assertField(schema, source, path23, seen, scope2, topLevel = false) {
16093
16495
  if (!schema || seen.has(schema)) {
16094
16496
  return;
@@ -16107,6 +16509,7 @@ function assertField(schema, source, path23, seen, scope2, topLevel = false) {
16107
16509
  refuseCatch(source, path23);
16108
16510
  }
16109
16511
  assertDictionaryBinding(schema, source, path23, scope2);
16512
+ assertDateString(schema, source, path23);
16110
16513
  if (!ins.resolvedType || !SUPPORTED_TYPES.has(ins.resolvedType)) {
16111
16514
  refuseType(source, path23, ins.resolvedType);
16112
16515
  }
@@ -16296,7 +16699,6 @@ function declaredAbsence(schema) {
16296
16699
  function coerces(schema) {
16297
16700
  return inspect(schema).core?._zod?.def?.coerce === true;
16298
16701
  }
16299
- var parsesJson = (schema) => !!inspect(schema).meta.frJson;
16300
16702
  var OPEN_TYPES = /* @__PURE__ */ new Set(["unknown", "any"]);
16301
16703
  var isOpenType = (schema) => OPEN_TYPES.has(inspect(schema).coreType);
16302
16704
  function requiredOpenType(schema) {
@@ -16318,7 +16720,7 @@ function requiredOpenType(schema) {
16318
16720
  return false;
16319
16721
  }
16320
16722
  function probeAbsence(schema) {
16321
- if (coerces(schema) || parsesJson(schema)) {
16723
+ if (coerces(schema)) {
16322
16724
  return declaredAbsence(schema);
16323
16725
  }
16324
16726
  if (requiredOpenType(schema)) {
@@ -16345,7 +16747,7 @@ function absenceOf(schema) {
16345
16747
  if (cached2) {
16346
16748
  return cached2;
16347
16749
  }
16348
- const probed = { ...probeAbsence(schema), blankIsValue: isOpenType(schema) && !parsesJson(schema) };
16750
+ const probed = { ...probeAbsence(schema), blankIsValue: isOpenType(schema) };
16349
16751
  probeCache.set(schema, probed);
16350
16752
  return probed;
16351
16753
  }
@@ -16358,15 +16760,45 @@ function planField(name, schema) {
16358
16760
  label: labelOf(name, schema),
16359
16761
  coreType: ins.coreType,
16360
16762
  isUnion: !!ins.branches,
16763
+ blankBranch: hasBlankBranch(ins),
16361
16764
  absence,
16362
16765
  absorbsBlank,
16363
16766
  keepsEmpty,
16364
16767
  blankIsValue,
16365
16768
  passThroughDate: passesDateThrough(ins),
16366
- restoresDates: hasPassThroughDate(schema, inspect, shapeEntries)
16769
+ restoresDates: hasPassThroughDate(schema, inspect, shapeEntries),
16770
+ dateString: dateStringKind(ins),
16771
+ formatsDates: hasDateFormat(schema)
16367
16772
  };
16368
16773
  }
16369
16774
 
16775
+ // ../../flow-extension-runner/src/v2/params/schema/notices.ts
16776
+ var sink;
16777
+ var currentField;
16778
+ function collectNotices(fn) {
16779
+ const outer = sink;
16780
+ const notices = [];
16781
+ sink = notices;
16782
+ try {
16783
+ return { result: fn(), notices };
16784
+ } finally {
16785
+ sink = outer;
16786
+ outer?.push(...notices);
16787
+ }
16788
+ }
16789
+ function withinField(field, fn) {
16790
+ const outer = currentField;
16791
+ currentField = field;
16792
+ try {
16793
+ return fn();
16794
+ } finally {
16795
+ currentField = outer;
16796
+ }
16797
+ }
16798
+ function notice(entry) {
16799
+ sink?.push({ field: currentField, ...entry });
16800
+ }
16801
+
16370
16802
  // ../../flow-extension-runner/src/v2/params/schema/coerce.ts
16371
16803
  var ok = (value) => ({ ok: true, value });
16372
16804
  var fail2 = (expected) => ({ ok: false, expected });
@@ -16441,16 +16873,6 @@ function toBooleanValue(value) {
16441
16873
  const lowered = value.trim().toLowerCase();
16442
16874
  return TRUE.has(lowered) ? ok(true) : FALSE.has(lowered) ? ok(false) : fail2("boolean");
16443
16875
  }
16444
- function toJsonValue(value) {
16445
- if (typeof value !== "string") {
16446
- return ok(value);
16447
- }
16448
- try {
16449
- return ok(JSON.parse(value));
16450
- } catch {
16451
- return fail2("json");
16452
- }
16453
- }
16454
16876
  function coerceValue(value, coreType) {
16455
16877
  if (coreType === "string") {
16456
16878
  return toStringValue(value);
@@ -16548,8 +16970,20 @@ function coerceLeaf(value, ins) {
16548
16970
  if (ins.branches) {
16549
16971
  return ok(coerceUnion(value, ins.branches));
16550
16972
  }
16551
- if (ins.meta.frJson) {
16552
- return toJsonValue(value);
16973
+ const kind = dateStringKind(ins);
16974
+ if (kind) {
16975
+ const { canonical, fromTimestamp } = toDateString(value, ins, kind);
16976
+ if (canonical === void 0) {
16977
+ return fail2(expectedDateString(ins, kind));
16978
+ }
16979
+ if (fromTimestamp) {
16980
+ notice({
16981
+ message: "a timestamp was converted to a date string in the server time zone (FR-3920 lenient period)",
16982
+ value,
16983
+ converted: canonical
16984
+ });
16985
+ }
16986
+ return ok(canonical);
16553
16987
  }
16554
16988
  const format = formatOf(ins);
16555
16989
  if (ins.coreType === "string" && isConvertibleIso(format)) {
@@ -16579,12 +17013,12 @@ function isBlank(value, ins, schema) {
16579
17013
  return false;
16580
17014
  }
16581
17015
  if (ins.branches) {
16582
- return true;
17016
+ return !hasBlankBranch(ins) || absenceOf(schema).absorbsBlank;
16583
17017
  }
16584
17018
  if (absenceOf(schema).blankIsValue) {
16585
17019
  return absenceOf(schema).absorbsBlank;
16586
17020
  }
16587
- return ins.coreType !== "string" || absenceOf(schema).absorbsBlank;
17021
+ return ins.coreType !== "string" || !!dateStringKind(ins) || absenceOf(schema).absorbsBlank;
16588
17022
  }
16589
17023
  function absentAs(schema, value) {
16590
17024
  const { absence } = absenceOf(schema);
@@ -16645,11 +17079,76 @@ var EXPECTED = {
16645
17079
  object: "an object",
16646
17080
  array: "an array",
16647
17081
  // zod's own token for `z.record()`, which the author declared as a map — to a person it is an object.
16648
- record: "an object",
16649
- // `z.json()`. Not a zod token — ./coerce.ts raises it when the submitted text will not parse.
16650
- json: "valid JSON"
17082
+ record: "an object"
16651
17083
  };
16652
17084
  var requiredMessage = (plan2) => `\xAB${plan2.label}\xBB is required`;
17085
+ var quote = (value) => typeof value === "string" ? JSON.stringify(value) : String(value);
17086
+ var oneOf = (values) => values.length === 1 ? quote(values[0]) : `one of: ${values.map(quote).join(", ")}`;
17087
+ var formatPhrase = (format) => {
17088
+ const described = FORMAT_DESCRIPTIONS[format ?? ""];
17089
+ return described?.replace(/^Expects (.*?), e\.g\. (.*)$/, "$1 (e.g. $2)").replace(/^Expects /, "");
17090
+ };
17091
+ var distinct = (phrases) => [...new Set(phrases.filter((phrase) => !!phrase))];
17092
+ function unionPhrases(union, value) {
17093
+ return distinct((inspect(union).branches ?? []).map((branch) => {
17094
+ try {
17095
+ const result = branch.safeParse(value);
17096
+ return branchPhrase(branch, result.error?.issues[0]);
17097
+ } catch {
17098
+ return void 0;
17099
+ }
17100
+ }));
17101
+ }
17102
+ function remainingIssue(branch, value) {
17103
+ if (!branch) {
17104
+ return void 0;
17105
+ }
17106
+ try {
17107
+ const result = branch.safeParse(coerceDeep(value, branch));
17108
+ return result.success ? void 0 : result.error?.issues[0];
17109
+ } catch {
17110
+ return void 0;
17111
+ }
17112
+ }
17113
+ function branchPhrase(branch, issue) {
17114
+ if (!branch || !issue) {
17115
+ return void 0;
17116
+ }
17117
+ const ins = inspect(branch);
17118
+ const values = ins.core._zod?.def?.values ?? [];
17119
+ if (ins.coreType === "literal" && values.length === 1 && values[0] === "") {
17120
+ return void 0;
17121
+ }
17122
+ const dateKind = dateStringKind(ins);
17123
+ if (dateKind) {
17124
+ return expectedDateString(ins, dateKind);
17125
+ }
17126
+ switch (issue.code) {
17127
+ case "invalid_type":
17128
+ return EXPECTED[issue.expected ?? ""] ?? issue.expected;
17129
+ case "invalid_value":
17130
+ return oneOf(issue.values ?? values);
17131
+ case "invalid_format":
17132
+ return formatPhrase(issue.format);
17133
+ // A bound has no short phrase ("a number of at least 10"); the branch still names its type.
17134
+ case "too_small":
17135
+ case "too_big":
17136
+ return EXPECTED[ins.coreType === "literal" ? literalType(ins.core) ?? "" : ins.coreType];
17137
+ default:
17138
+ return void 0;
17139
+ }
17140
+ }
17141
+ function unionIssue(plan2, issue, union, unionValue, fieldValue) {
17142
+ const branches = union ? inspect(union).branches : void 0;
17143
+ const errors = issue.errors ?? [];
17144
+ const deepIndex = errors.findIndex((branchIssues) => branchIssues.some((branchIssue) => (branchIssue.path ?? []).length));
17145
+ if (deepIndex >= 0) {
17146
+ const deep = remainingIssue(branches?.[deepIndex], unionValue) ?? errors[deepIndex].find((branchIssue) => (branchIssue.path ?? []).length);
17147
+ return toFieldIssue(plan2, { ...deep, path: [...issue.path ?? [], ...deep.path ?? []] }, fieldValue);
17148
+ }
17149
+ const phrases = distinct(errors.map((branchIssues, index) => branchPhrase(branches?.[index], branchIssues[0])));
17150
+ return phrases.length ? { path: "", code: "invalid_union", message: `must be ${phrases.join(", or ")}` } : void 0;
17151
+ }
16653
17152
  var invalidTypeMessage = (plan2, expected) => `\xAB${plan2.label}\xBB must be ${EXPECTED[expected] ?? expected}`;
16654
17153
  var isIndex = (segment) => /^\d+$/.test(segment);
16655
17154
  function resolveTarget(plan2, segments, fieldValue) {
@@ -16674,7 +17173,7 @@ function resolveTarget(plan2, segments, fieldValue) {
16674
17173
  schema = nested[1];
16675
17174
  label = labelOf(segment, schema);
16676
17175
  }
16677
- return { label, value, found };
17176
+ return { label, value, found, schema: found ? schema : void 0 };
16678
17177
  }
16679
17178
  function bound(value, plan2) {
16680
17179
  if (plan2.coreType !== "date" || typeof value !== "number") {
@@ -16696,6 +17195,17 @@ function toFieldIssue(plan2, issue, fieldValue) {
16696
17195
  if (isAuthored(issue)) {
16697
17196
  return { path: path23, code, message: issue.message };
16698
17197
  }
17198
+ if (code !== "invalid_union" && target.schema && inspect(target.schema).branches) {
17199
+ const combined = unionPhrases(target.schema, target.value);
17200
+ if (combined.length > 1) {
17201
+ return { path: path23, code: "invalid_union", message: `\xAB${target.label}\xBB must be ${combined.join(", or ")}` };
17202
+ }
17203
+ }
17204
+ const dateKind = target.schema ? dateStringKind(inspect(target.schema)) : void 0;
17205
+ const dateMissing = target.value == null || target.value === "";
17206
+ if (dateKind && (code === "invalid_type" || code === "invalid_format")) {
17207
+ return dateMissing ? { path: path23, code, message: requiredMessage(named) } : { path: path23, code, message: invalidTypeMessage(named, expectedDateString(inspect(target.schema), dateKind)) };
17208
+ }
16699
17209
  if (code === "invalid_type") {
16700
17210
  const received = issue.received;
16701
17211
  const absent = segments.length ? target.found && target.value == null : received === "undefined" || received === "null" || issue.expected === void 0;
@@ -16708,13 +17218,18 @@ function toFieldIssue(plan2, issue, fieldValue) {
16708
17218
  return { path: path23, code, message: `\xAB${target.label}\xBB must be at most ${bound(issue.maximum, plan2)}` };
16709
17219
  }
16710
17220
  if (code === "invalid_value") {
16711
- const values = (issue.values ?? []).map(String);
16712
- return { path: path23, code, message: `\xAB${target.label}\xBB must be one of: ${values.join(", ")}` };
17221
+ return { path: path23, code, message: `\xAB${target.label}\xBB must be ${oneOf(issue.values ?? [])}` };
16713
17222
  }
16714
17223
  if (code === "invalid_format") {
16715
17224
  const described = FORMAT_DESCRIPTIONS[issue.format ?? ""];
16716
17225
  return described ? { path: path23, code, message: `\xAB${target.label}\xBB is invalid \u2014 ${described.replace(/^Expects /, "expects ")}` } : { path: path23, code, message: `\xAB${target.label}\xBB has an invalid format` };
16717
17226
  }
17227
+ if (code === "invalid_union") {
17228
+ const combined = unionIssue(plan2, issue, target.schema, target.value, fieldValue);
17229
+ if (combined) {
17230
+ return combined.path ? combined : { path: path23, code, message: `\xAB${target.label}\xBB ${combined.message}` };
17231
+ }
17232
+ }
16718
17233
  return { path: path23, code, message: `\xAB${target.label}\xBB is invalid` };
16719
17234
  }
16720
17235
 
@@ -16735,12 +17250,12 @@ function isAbsent(value, plan2) {
16735
17250
  return false;
16736
17251
  }
16737
17252
  if (plan2.isUnion) {
16738
- return true;
17253
+ return !plan2.blankBranch || plan2.absorbsBlank;
16739
17254
  }
16740
17255
  if (plan2.blankIsValue) {
16741
17256
  return plan2.absorbsBlank;
16742
17257
  }
16743
- return plan2.coreType !== "string" || plan2.absorbsBlank;
17258
+ return plan2.coreType !== "string" || !!plan2.dateString || plan2.absorbsBlank;
16744
17259
  }
16745
17260
  function normalizeAbsence(value, plan2) {
16746
17261
  if (plan2.absence === "required") {
@@ -16779,7 +17294,7 @@ function normalizeField(value, plan2) {
16779
17294
  return restore(validate(coerced.value, plan2), value, plan2);
16780
17295
  }
16781
17296
  function restore(result, original, plan2) {
16782
- if (!plan2.restoresDates || !result.present || result.issues.length) {
17297
+ if (!(plan2.restoresDates || plan2.formatsDates) || !result.present || result.issues.length) {
16783
17298
  return result;
16784
17299
  }
16785
17300
  if (plan2.passThroughDate) {
@@ -16799,6 +17314,10 @@ function restoreDeep(output, original, schema) {
16799
17314
  const branch = ins.branches.find((option) => accepts(option, output));
16800
17315
  return branch ? restoreDeep(output, original, branch) : output;
16801
17316
  }
17317
+ const kind = dateStringKind(ins);
17318
+ if (kind) {
17319
+ return typeof output === "string" && original !== "" ? canonicalToPattern(output, ins, kind) : output;
17320
+ }
16802
17321
  const element = ins.core?._zod?.def?.element;
16803
17322
  if (ins.coreType === "array" && element && Array.isArray(output) && Array.isArray(original)) {
16804
17323
  return output.map((item, index) => restoreDeep(item, original[index], element));
@@ -16888,7 +17407,7 @@ var Params = class {
16888
17407
  const values = {};
16889
17408
  const issues = [];
16890
17409
  for (const plan2 of this.plans()) {
16891
- const result = normalizeField(source[plan2.name], plan2);
17410
+ const result = withinField(plan2.name, () => normalizeField(source[plan2.name], plan2));
16892
17411
  if (result.issues.length) {
16893
17412
  issues.push(...result.issues);
16894
17413
  } else if (result.present) {
@@ -17043,6 +17562,9 @@ function extendPrototype() {
17043
17562
  }
17044
17563
  return this.meta({ frDictionary: binding });
17045
17564
  };
17565
+ proto.dateFormat = function dateFormat(pattern) {
17566
+ return this.meta({ frDateFormat: pattern });
17567
+ };
17046
17568
  proto.labels = function labels(byValue) {
17047
17569
  return this.meta({ frLabels: byValue });
17048
17570
  };
@@ -17065,10 +17587,9 @@ function text() {
17065
17587
  return import_zod3.z.string().meta({ frWidget: FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT });
17066
17588
  }
17067
17589
  function json() {
17068
- return import_zod3.z.unknown().nonoptional().meta({
17069
- frWidget: FlowExtensionParamWidgetTypes.MULTI_LINE_TEXT,
17070
- frJson: true
17071
- });
17590
+ throw new Error(
17591
+ "`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."
17592
+ );
17072
17593
  }
17073
17594
  var namespace = Object.create(import_zod3.z);
17074
17595
  Object.defineProperties(namespace, {
@@ -17082,7 +17603,7 @@ Object.defineProperties(namespace, {
17082
17603
  var z2 = namespace;
17083
17604
 
17084
17605
  // ../../flow-extension-runner/src/v2/params/json/values.ts
17085
- function toJsonValue2(value) {
17606
+ function toJsonValue(value) {
17086
17607
  if (typeof value === "bigint") {
17087
17608
  return { $bigint: value.toString() };
17088
17609
  }
@@ -17090,10 +17611,10 @@ function toJsonValue2(value) {
17090
17611
  return { $date: value.toISOString() };
17091
17612
  }
17092
17613
  if (Array.isArray(value)) {
17093
- return value.map(toJsonValue2);
17614
+ return value.map(toJsonValue);
17094
17615
  }
17095
17616
  if (value && typeof value === "object") {
17096
- return Object.fromEntries(Object.entries(value).map(([key, inner]) => [key, toJsonValue2(inner)]));
17617
+ return Object.fromEntries(Object.entries(value).map(([key, inner]) => [key, toJsonValue(inner)]));
17097
17618
  }
17098
17619
  return value;
17099
17620
  }
@@ -17128,18 +17649,18 @@ function encodeCheck(check) {
17128
17649
  switch (def.check) {
17129
17650
  // strings and arrays
17130
17651
  case "min_length":
17131
- return at("min", toJsonValue2(def.minimum));
17652
+ return at("min", toJsonValue(def.minimum));
17132
17653
  case "max_length":
17133
- return at("max", toJsonValue2(def.maximum));
17654
+ return at("max", toJsonValue(def.maximum));
17134
17655
  case "length_equals":
17135
- return at("length", toJsonValue2(def.length));
17656
+ return at("length", toJsonValue(def.length));
17136
17657
  // numbers and bigints
17137
17658
  case "greater_than":
17138
- return at("min", toJsonValue2(def.value), def.inclusive ? void 0 : true);
17659
+ return at("min", toJsonValue(def.value), def.inclusive ? void 0 : true);
17139
17660
  case "less_than":
17140
- return at("max", toJsonValue2(def.value), def.inclusive ? void 0 : true);
17661
+ return at("max", toJsonValue(def.value), def.inclusive ? void 0 : true);
17141
17662
  case "multiple_of":
17142
- return at("multipleOf", toJsonValue2(def.value));
17663
+ return at("multipleOf", toJsonValue(def.value));
17143
17664
  case "number_format":
17144
17665
  return def.format === "safeint" || def.format === "int32" ? at("int") : void 0;
17145
17666
  // the string sub-formats that are checks rather than types
@@ -17300,7 +17821,7 @@ function encodeMeta(meta, field, scope2, loaderId) {
17300
17821
  if (hasFunction(source)) {
17301
17822
  throw new Error(`Cannot encode "${field}": its metadata holds a function, which has no wire form.`);
17302
17823
  }
17303
- const encoded = toJsonValue2(source);
17824
+ const encoded = toJsonValue(source);
17304
17825
  return Object.keys(encoded).length ? encoded : void 0;
17305
17826
  }
17306
17827
  function isLoose(core) {
@@ -17310,11 +17831,11 @@ function isLoose(core) {
17310
17831
  function encodeValues(core, type) {
17311
17832
  if (type === "enum") {
17312
17833
  const entries = core?._zod?.def?.entries ?? {};
17313
- return Object.values(entries).map(toJsonValue2);
17834
+ return Object.values(entries).map(toJsonValue);
17314
17835
  }
17315
17836
  if (type === "literal") {
17316
17837
  const values = core?._zod?.def?.values ?? [];
17317
- return values.map(toJsonValue2);
17838
+ return values.map(toJsonValue);
17318
17839
  }
17319
17840
  return void 0;
17320
17841
  }
@@ -17342,9 +17863,10 @@ function encodeField(name, schema, seen = /* @__PURE__ */ new Set(), loaderId, s
17342
17863
  name,
17343
17864
  type,
17344
17865
  ...format ? { format } : {},
17866
+ ...format === "datetime" && core?._zod?.def?.local ? { local: true } : {},
17345
17867
  ...optional ? { optional: true } : {},
17346
17868
  ...nullable ? { nullable: true } : {},
17347
- ...hasDefault ? { default: toJsonValue2(defaultValue) } : {},
17869
+ ...hasDefault ? { default: toJsonValue(defaultValue) } : {},
17348
17870
  ...checks.length ? { checks } : {},
17349
17871
  ...values?.length ? { values } : {},
17350
17872
  ...meta ? { meta } : {},
@@ -17869,8 +18391,23 @@ var ExecutionContext = class _ExecutionContext {
17869
18391
  get logger() {
17870
18392
  return this.#options.logger ?? defaultLogger;
17871
18393
  }
18394
+ get invocation() {
18395
+ return this.#options.invocation ?? {};
18396
+ }
17872
18397
  get config() {
17873
- this.#config ??= this.#extension.config.resolve(this.#options.configs);
18398
+ if (!this.#config) {
18399
+ const { result, notices } = collectNotices(() => this.#extension.config.resolve(this.#options.configs));
18400
+ for (const { message, field, value, converted } of notices) {
18401
+ this.logger.warn(`[flow-extension:${this.#extension.id}] config item "${field ?? "?"}": ${message}`, {
18402
+ serviceId: this.#extension.id,
18403
+ configItem: field,
18404
+ value,
18405
+ converted,
18406
+ ...this.invocation
18407
+ });
18408
+ }
18409
+ this.#config = result;
18410
+ }
17874
18411
  return this.#config;
17875
18412
  }
17876
18413
  // The header access token plus its deserialized composite payload — or a throwing proxy when the
@@ -18021,6 +18558,10 @@ var DictionaryMethod = class extends ExtensionMethod {
18021
18558
  return this.criteria.keys();
18022
18559
  }
18023
18560
  // ── runtime ────────────────────────────────────────────────────────────────
18561
+ // `search` is always text, trimmed (FR-3910): `''` when the author typed nothing — the console then sends no
18562
+ // `search` at all — or only spaces. So a handler never guards it: `search ? { q: search } : undefined`, and
18563
+ // `search.toLowerCase()` as is. Surrounding spaces never mean anything to a lookup.
18564
+ //
18024
18565
  // Two-stage: the `{ search, cursor, criteria }` envelope the runtime owns, then the author-declared
18025
18566
  // criteria through the shared pipeline — reported as a criteria failure so the console can point at the
18026
18567
  // dependent fields rather than the whole call.
@@ -18029,7 +18570,7 @@ var DictionaryMethod = class extends ExtensionMethod {
18029
18570
  const payload = input.parseField("payload", DictionaryPayloadSchema);
18030
18571
  const criteria = this.criteria.normalize(this.#resolveAliases(payload.criteria), input.invalidCriteria());
18031
18572
  return {
18032
- search: payload.search,
18573
+ search: payload.search?.trim() ?? "",
18033
18574
  cursor: payload.cursor,
18034
18575
  criteria
18035
18576
  };
@@ -19380,7 +19921,23 @@ var Extension = class {
19380
19921
  // generated loader, SYSTEM seam — arrives here through the same three steps.
19381
19922
  async run(methodName, methodData, ctx) {
19382
19923
  const method = this.getMethod(methodName);
19383
- return method.execute(method.validate(methodData ?? {}), ctx);
19924
+ const { result: input, notices } = collectNotices(() => method.validate(methodData ?? {}));
19925
+ this.#reportNotices(notices, methodName, ctx);
19926
+ return method.execute(input, ctx);
19927
+ }
19928
+ // One warning per value the pipeline accepted only under a temporary rule — today a timestamp converted for
19929
+ // a date-string field (FR-3920 lenient period). Named well enough to find the flow still holding one.
19930
+ #reportNotices(notices, methodName, ctx) {
19931
+ for (const { message, field, value, converted } of notices) {
19932
+ ctx.logger.warn(`[flow-extension:${this.id}] ${methodName}: param "${field ?? "?"}": ${message}`, {
19933
+ serviceId: this.id,
19934
+ method: methodName,
19935
+ param: field,
19936
+ value,
19937
+ converted,
19938
+ ...ctx.invocation
19939
+ });
19940
+ }
19384
19941
  }
19385
19942
  // ── output model ────────────────────────────────────────────────────────────
19386
19943
  toConfigItems() {