@nocobase/plugin-flow-engine 2.2.0-alpha.1 → 2.2.0-alpha.11

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 (86) hide show
  1. package/dist/ai/ai-employees/nathan/prompt.md +2 -0
  2. package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +1 -0
  3. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/getContextApis.js +2 -2
  4. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/getContextEnvs.js +2 -2
  5. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/getContextVars.js +2 -2
  6. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/lintAndTestJS.js +2 -2
  7. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.js +4 -4
  8. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.js +2 -2
  9. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.js +2 -2
  10. package/dist/ai/docs/runjs/context/ai.md +206 -0
  11. package/dist/client/index.js +1 -1
  12. package/dist/externalVersion.js +9 -9
  13. package/dist/locale/en-US.json +3 -0
  14. package/dist/locale/index.d.ts +6 -0
  15. package/dist/locale/zh-CN.json +3 -0
  16. package/dist/node_modules/@ant-design/icons-svg/package.json +1 -1
  17. package/dist/node_modules/acorn/package.json +1 -1
  18. package/dist/node_modules/acorn-jsx/package.json +1 -1
  19. package/dist/node_modules/acorn-walk/package.json +1 -1
  20. package/dist/node_modules/ses/package.json +1 -1
  21. package/dist/node_modules/zod/package.json +1 -1
  22. package/dist/server/flow-surfaces/{runjs-authoring/blocked-global-stop/index.d.ts → approval/authoring-validation.d.ts} +1 -2
  23. package/dist/server/flow-surfaces/approval/authoring-validation.js +1151 -0
  24. package/dist/server/flow-surfaces/approval/blueprint-service.js +2 -0
  25. package/dist/server/flow-surfaces/authoring-validation.d.ts +3 -1
  26. package/dist/server/flow-surfaces/authoring-validation.js +645 -59
  27. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +7 -3
  28. package/dist/server/flow-surfaces/blueprint/compile-plan.js +23 -15
  29. package/dist/server/flow-surfaces/blueprint/export-document.d.ts +50 -0
  30. package/dist/server/flow-surfaces/blueprint/export-document.js +2510 -0
  31. package/dist/server/flow-surfaces/blueprint/normalize-document.js +18 -1
  32. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +2 -0
  33. package/dist/server/flow-surfaces/builder.js +43 -5
  34. package/dist/server/flow-surfaces/catalog.js +13 -2
  35. package/dist/server/flow-surfaces/configure-options.js +5 -3
  36. package/dist/server/flow-surfaces/constants.d.ts +16 -2
  37. package/dist/server/flow-surfaces/constants.js +2 -0
  38. package/dist/server/flow-surfaces/contract-guard.js +37 -5
  39. package/dist/server/flow-surfaces/default-action-popup.d.ts +2 -0
  40. package/dist/server/flow-surfaces/default-action-popup.js +27 -13
  41. package/dist/server/flow-surfaces/errors.d.ts +2 -2
  42. package/dist/server/flow-surfaces/errors.js +4 -4
  43. package/dist/server/flow-surfaces/filter-group.d.ts +19 -2
  44. package/dist/server/flow-surfaces/filter-group.js +232 -3
  45. package/dist/server/flow-surfaces/navigation-targets.d.ts +73 -0
  46. package/dist/server/flow-surfaces/navigation-targets.js +439 -0
  47. package/dist/server/flow-surfaces/planning/compiler.d.ts +1 -0
  48. package/dist/server/flow-surfaces/planning/compiler.js +205 -82
  49. package/dist/server/flow-surfaces/planning/key-registry.d.ts +1 -1
  50. package/dist/server/flow-surfaces/planning/runtime.js +1 -0
  51. package/dist/server/flow-surfaces/planning/step-link.d.ts +1 -1
  52. package/dist/server/flow-surfaces/planning/step-link.js +22 -3
  53. package/dist/server/flow-surfaces/public-data-surface-default-filter.js +0 -9
  54. package/dist/server/flow-surfaces/reaction/field-value.d.ts +9 -0
  55. package/dist/server/flow-surfaces/reaction/field-value.js +51 -2
  56. package/dist/server/flow-surfaces/reaction/linkage.d.ts +6 -1
  57. package/dist/server/flow-surfaces/reaction/linkage.js +18 -3
  58. package/dist/server/flow-surfaces/reaction/meta.js +19 -1
  59. package/dist/server/flow-surfaces/reaction/types.d.ts +19 -0
  60. package/dist/server/flow-surfaces/relation-backing-foreign-key.d.ts +10 -0
  61. package/dist/server/flow-surfaces/relation-backing-foreign-key.js +79 -0
  62. package/dist/server/flow-surfaces/runjs-authoring/ast/source.d.ts +1 -0
  63. package/dist/server/flow-surfaces/runjs-authoring/ast/source.js +20 -0
  64. package/dist/server/flow-surfaces/runjs-authoring/rules.js +0 -2
  65. package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.d.ts +0 -1
  66. package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.js +12 -19
  67. package/dist/server/flow-surfaces/runjs-authoring/runtime/types.d.ts +0 -12
  68. package/dist/server/flow-surfaces/runjs-authoring/scan/filter.js +12 -2
  69. package/dist/server/flow-surfaces/runjs-authoring/scan/index.d.ts +0 -14
  70. package/dist/server/flow-surfaces/runjs-authoring/scan/index.js +10 -8
  71. package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.d.ts +0 -14
  72. package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.js +18 -73
  73. package/dist/server/flow-surfaces/runjs-authoring/types.d.ts +1 -1
  74. package/dist/server/flow-surfaces/runjs-authoring/validators/index.js +9 -53
  75. package/dist/server/flow-surfaces/service.d.ts +65 -0
  76. package/dist/server/flow-surfaces/service.js +1372 -148
  77. package/dist/server/flow-surfaces/types.d.ts +2 -1
  78. package/dist/server/variables/records.js +7 -2
  79. package/dist/server/variables/registry.js +3 -0
  80. package/dist/swagger/flow-surfaces.d.ts +289 -0
  81. package/dist/swagger/flow-surfaces.examples.d.ts +11 -0
  82. package/dist/swagger/flow-surfaces.examples.js +11 -0
  83. package/dist/swagger/flow-surfaces.js +261 -11
  84. package/dist/swagger/index.d.ts +289 -0
  85. package/package.json +2 -2
  86. package/dist/server/flow-surfaces/runjs-authoring/blocked-global-stop/index.js +0 -40
@@ -51,6 +51,7 @@ var import_association_title_field = require("./association-title-field");
51
51
  var import_chart_config = require("./chart-config");
52
52
  var import_public_data_surface_default_filter = require("./public-data-surface-default-filter");
53
53
  var import_default_action_popup = require("./default-action-popup");
54
+ var import_relation_backing_foreign_key = require("./relation-backing-foreign-key");
54
55
  var import_default_block_actions = require("./default-block-actions");
55
56
  var import_hidden_popup_contract = require("./hidden-popup-contract");
56
57
  var import_node_use_sets = require("./node-use-sets");
@@ -60,7 +61,23 @@ var import_association_interfaces = require("./association-interfaces");
60
61
  var import_defaults = require("./blueprint/defaults");
61
62
  var import_runjs_authoring = require("./runjs-authoring");
62
63
  var import_configure_options = require("./configure-options");
64
+ var import_context = require("./context");
63
65
  var import_filter_group = require("./filter-group");
66
+ const FLOW_SURFACE_DATA_SCOPE_DATE_EMPTY_OPERATORS = /* @__PURE__ */ new Set(["$empty", "$notEmpty"]);
67
+ const FLOW_SURFACE_DATA_SCOPE_DATE_ALLOWED_OPERATORS = /* @__PURE__ */ new Set([
68
+ ...import_filter_group.FLOW_SURFACE_DATE_FILTER_OPERATORS,
69
+ ...FLOW_SURFACE_DATA_SCOPE_DATE_EMPTY_OPERATORS
70
+ ]);
71
+ const FLOW_SURFACE_DATA_SCOPE_DATE_UI_INCOMPATIBLE_OPERATORS = /* @__PURE__ */ new Set([
72
+ "$eq",
73
+ "$ne",
74
+ "$lt",
75
+ "$lte",
76
+ "$gt",
77
+ "$gte",
78
+ "$in",
79
+ "$notIn"
80
+ ]);
64
81
  const MAIN_BLOCK_UNSUPPORTED_SECTIONS = {
65
82
  calendar: ["fields", "fieldGroups", "recordActions", "fieldsLayout"],
66
83
  kanban: ["fieldGroups", "recordActions", "fieldsLayout"],
@@ -171,10 +188,17 @@ const GRID_CARD_ALLOWED_SETTINGS_KEYS = /* @__PURE__ */ new Set([
171
188
  const TABLE_ALLOWED_SETTINGS_KEYS = /* @__PURE__ */ new Set([...(0, import_configure_options.getConfigureOptionKeysForUse)("TableBlockModel"), "sort"]);
172
189
  const TABLE_INTERNAL_AUTHORING_KEYS = ["tableSettings", "defaultSorting", "stepParams"];
173
190
  const TABLE_SETTINGS_REPAIR_HINT = "Use public table settings keys such as settings.pageSize, settings.sorting, settings.dataScope, settings.density, settings.showRowNumbers, settings.treeTable, settings.dragSort, and settings.dragSortBy. Do not nest persisted tableSettings/defaultSorting/stepParams payloads.";
174
- const JS_BLOCK_ALLOWED_SETTINGS_KEYS = /* @__PURE__ */ new Set(["title", "description", "className", "code", "version"]);
191
+ const JS_BLOCK_ALLOWED_SETTINGS_KEYS = /* @__PURE__ */ new Set([
192
+ "title",
193
+ "description",
194
+ "className",
195
+ "showBlockCard",
196
+ "code",
197
+ "version"
198
+ ]);
175
199
  const JS_BLOCK_TOP_LEVEL_JS_KEYS = ["code", "version"];
176
200
  const JS_BLOCK_INTERNAL_AUTHORING_KEYS = ["props", "decoratorProps", "flowRegistry", "stepParams"];
177
- const JS_BLOCK_REPAIR_HINT = "This is a jsBlock payload shape problem. Repair this jsBlock using inline settings.code/settings.version, or applyBlueprint assets.scripts.<key>.code plus block.script. Do not change this block type to table, chart, actionPanel, gridCard, or another block type.";
201
+ const JS_BLOCK_REPAIR_HINT = "This is a jsBlock payload shape problem. Repair this jsBlock using inline settings.code/settings.version/settings.showBlockCard, or applyBlueprint assets.scripts.<key>.code plus block.script with optional settings.showBlockCard. Do not change this block type to table, chart, actionPanel, gridCard, or another block type.";
178
202
  const CHART_REPAIR_HINT = "This is a chart payload shape problem. Keep using chart and repair this chart using assets.charts.<key>.query/visual plus block.chart, or localized settings.query/settings.visual. Do not change this block type to table, jsBlock, actionPanel, gridCard, or another block type, and do not drop or defer the chart. KPI / summary numbers should use jsBlock; charts are for trends, distributions, rankings, and visual analysis.";
179
203
  const REPAIR_ALL_ERRORS_AGENT_INSTRUCTION = "If this response contains errors[], fix every listed error in one payload revision before retrying the same write. Do not fix only this error and immediately retry.";
180
204
  const JS_BLOCK_AGENT_INSTRUCTION = `${REPAIR_ALL_ERRORS_AGENT_INSTRUCTION} Do not skip, drop, defer, or replace this required jsBlock. Repair it as jsBlock.`;
@@ -472,7 +496,10 @@ async function collectFlowSurfaceAuthoringErrors(actionName, values, context = {
472
496
  blocks.forEach(({ block }) => collectLocalKeys(block, localKeys));
473
497
  }
474
498
  blocks.forEach(({ block, path }) => collectBlockErrors(block, path, errors, localKeys, validationContext));
475
- collectReactionErrors(values == null ? void 0 : values.reaction, "$.reaction", localKeys, errors);
499
+ collectReactionErrors(values == null ? void 0 : values.reaction, "$.reaction", localKeys, errors, {
500
+ values,
501
+ context: validationContext
502
+ });
476
503
  if (!validationContext.skipGeneratedPopupDefaultFieldGroups) {
477
504
  collectGeneratedPopupDefaultFieldGroupErrors(actionName, values, validationContext, errors);
478
505
  }
@@ -513,10 +540,13 @@ function pushChartBadRequestAuthoringError(errors, error, fallbackPath) {
513
540
  });
514
541
  }
515
542
  async function collectNavigationGroupErrors(actionName, values, context, errors) {
516
- var _a;
543
+ var _a, _b, _c;
517
544
  if (actionName !== "applyBlueprint" || (values == null ? void 0 : values.mode) !== "create" || !_.isPlainObject((_a = values == null ? void 0 : values.navigation) == null ? void 0 : _a.group)) {
518
545
  return;
519
546
  }
547
+ if (await isApplyBlueprintMobileCreateNavigation(values, context)) {
548
+ return;
549
+ }
520
550
  if (!_.isUndefined(values.navigation.group.routeId) || !context.findMenuGroupRoutesByTitle) {
521
551
  return;
522
552
  }
@@ -524,7 +554,9 @@ async function collectNavigationGroupErrors(actionName, values, context, errors)
524
554
  if (!groupTitle) {
525
555
  return;
526
556
  }
527
- const matchedRoutes = await context.findMenuGroupRoutesByTitle(groupTitle, context.transaction);
557
+ const layoutUid = String(((_b = values == null ? void 0 : values.navigation) == null ? void 0 : _b.layoutUid) || "").trim() || void 0;
558
+ const portalUid = String(((_c = values == null ? void 0 : values.navigation) == null ? void 0 : _c.portalUid) || "").trim() || void 0;
559
+ const matchedRoutes = await context.findMenuGroupRoutesByTitle(groupTitle, context.transaction, layoutUid, portalUid);
528
560
  const rootMatchedRoutes = filterRootMenuGroupRoutes(matchedRoutes);
529
561
  if (rootMatchedRoutes.length <= 1) {
530
562
  return;
@@ -541,15 +573,18 @@ async function collectNavigationGroupErrors(actionName, values, context, errors)
541
573
  });
542
574
  }
543
575
  async function collectNavigationIconErrors(actionName, values, context, errors) {
544
- var _a, _b, _c;
576
+ var _a, _b, _c, _d, _e;
545
577
  if (actionName !== "applyBlueprint" || (values == null ? void 0 : values.mode) !== "create") {
546
578
  return;
547
579
  }
580
+ const isMobileCreateNavigation = await isApplyBlueprintMobileCreateNavigation(values, context);
548
581
  const group = _.isPlainObject((_a = values == null ? void 0 : values.navigation) == null ? void 0 : _a.group) ? values.navigation.group : null;
549
582
  const groupRouteId = String((group == null ? void 0 : group.routeId) || "").trim();
550
- if (group && !groupRouteId && group.hideInMenu !== true) {
583
+ const layoutUid = String(((_b = values == null ? void 0 : values.navigation) == null ? void 0 : _b.layoutUid) || "").trim() || void 0;
584
+ const portalUid = String(((_c = values == null ? void 0 : values.navigation) == null ? void 0 : _c.portalUid) || "").trim() || void 0;
585
+ if (!isMobileCreateNavigation && group && !groupRouteId && group.hideInMenu !== true) {
551
586
  const groupIcon = String(group.icon || "").trim();
552
- if (!groupIcon && await shouldRequireNewNavigationGroupIcon(group, context)) {
587
+ if (!groupIcon && await shouldRequireNewNavigationGroupIcon(group, context, layoutUid, portalUid)) {
553
588
  pushAuthoringError(errors, {
554
589
  path: "$.navigation.group.icon",
555
590
  ruleId: "navigation-icon-required",
@@ -568,7 +603,7 @@ async function collectNavigationIconErrors(actionName, values, context, errors)
568
603
  }
569
604
  });
570
605
  }
571
- } else if (group && String(group.icon || "").trim() && !isValidAntDesignIconName(group.icon)) {
606
+ } else if (!isMobileCreateNavigation && group && String(group.icon || "").trim() && !isValidAntDesignIconName(group.icon)) {
572
607
  pushAuthoringError(errors, {
573
608
  path: "$.navigation.group.icon",
574
609
  ruleId: "navigation-icon-unknown",
@@ -578,7 +613,7 @@ async function collectNavigationIconErrors(actionName, values, context, errors)
578
613
  }
579
614
  });
580
615
  }
581
- const item = _.isPlainObject((_b = values == null ? void 0 : values.navigation) == null ? void 0 : _b.item) ? values.navigation.item : null;
616
+ const item = _.isPlainObject((_d = values == null ? void 0 : values.navigation) == null ? void 0 : _d.item) ? values.navigation.item : null;
582
617
  const itemIcon = String((item == null ? void 0 : item.icon) || "").trim();
583
618
  if (itemIcon && !isValidAntDesignIconName(itemIcon)) {
584
619
  pushAuthoringError(errors, {
@@ -590,7 +625,7 @@ async function collectNavigationIconErrors(actionName, values, context, errors)
590
625
  }
591
626
  });
592
627
  }
593
- const pageIcon = String(((_c = values == null ? void 0 : values.page) == null ? void 0 : _c.icon) || "").trim();
628
+ const pageIcon = String(((_e = values == null ? void 0 : values.page) == null ? void 0 : _e.icon) || "").trim();
594
629
  if (pageIcon && !isValidAntDesignIconName(pageIcon)) {
595
630
  pushAuthoringError(errors, {
596
631
  path: "$.page.icon",
@@ -602,12 +637,24 @@ async function collectNavigationIconErrors(actionName, values, context, errors)
602
637
  });
603
638
  }
604
639
  }
605
- async function shouldRequireNewNavigationGroupIcon(group, context) {
640
+ async function isApplyBlueprintMobileCreateNavigation(values, context) {
641
+ var _a, _b;
642
+ const portalUid = String(((_a = values == null ? void 0 : values.navigation) == null ? void 0 : _a.portalUid) || "").trim();
643
+ if (portalUid && context.getPortalLayoutTypeByUid) {
644
+ return await context.getPortalLayoutTypeByUid(portalUid, context.transaction) === "mobile";
645
+ }
646
+ const layoutUid = String(((_b = values == null ? void 0 : values.navigation) == null ? void 0 : _b.layoutUid) || "").trim();
647
+ if (!layoutUid || !context.getUiLayoutTypeByUid) {
648
+ return false;
649
+ }
650
+ return await context.getUiLayoutTypeByUid(layoutUid, context.transaction) === "mobile";
651
+ }
652
+ async function shouldRequireNewNavigationGroupIcon(group, context, layoutUid, portalUid) {
606
653
  const groupTitle = String((group == null ? void 0 : group.title) || "").trim();
607
654
  if (!groupTitle || !context.findMenuGroupRoutesByTitle) {
608
655
  return true;
609
656
  }
610
- const matchedRoutes = await context.findMenuGroupRoutesByTitle(groupTitle, context.transaction);
657
+ const matchedRoutes = await context.findMenuGroupRoutesByTitle(groupTitle, context.transaction, layoutUid, portalUid);
611
658
  return filterRootMenuGroupRoutes(matchedRoutes).length === 0;
612
659
  }
613
660
  function filterRootMenuGroupRoutes(routes) {
@@ -732,6 +779,7 @@ function withJsBlockRepairHint(details = {}) {
732
779
  inlineBlock: {
733
780
  type: "jsBlock",
734
781
  settings: {
782
+ showBlockCard: true,
735
783
  code: 'ctx.render("Replace this with the required rendered UI");'
736
784
  }
737
785
  },
@@ -745,7 +793,10 @@ function withJsBlockRepairHint(details = {}) {
745
793
  },
746
794
  block: {
747
795
  type: "jsBlock",
748
- script: "scriptKey"
796
+ script: "scriptKey",
797
+ settings: {
798
+ showBlockCard: true
799
+ }
749
800
  }
750
801
  }
751
802
  },
@@ -1177,47 +1228,69 @@ function collectBuilderChartAssetQueryErrors(query, path, context, errors) {
1177
1228
  errors,
1178
1229
  withChartRepairHint()
1179
1230
  );
1180
- collectChartQueryFilterOperatorErrors(query, `${path}.query`, errors);
1231
+ collectChartQueryFilterOperatorErrors(query, `${path}.query`, errors, context);
1181
1232
  collectBuilderChartAssetFieldErrors(query, path, context, errors);
1182
1233
  }
1183
- function collectChartQueryFilterOperatorErrors(query, path, errors) {
1234
+ const AUTHORABLE_REACTION_SCALAR_CONTEXT_PATHS = /* @__PURE__ */ new Set(["role", "locale", "token", "deviceType"]);
1235
+ const AUTHORABLE_REACTION_CONTEXT_ROOTS = /* @__PURE__ */ new Set([
1236
+ "user",
1237
+ "collection",
1238
+ "formValues",
1239
+ "record",
1240
+ "item",
1241
+ "popup",
1242
+ "urlSearchParams"
1243
+ ]);
1244
+ function collectChartQueryFilterOperatorErrors(query, path, errors, context) {
1184
1245
  if (!_.isPlainObject(query) || !hasOwn(query, "filter")) {
1185
1246
  return;
1186
1247
  }
1187
- collectChartFilterOperatorErrors(query.filter, `${path}.filter`, errors);
1248
+ collectChartFilterOperatorErrors(
1249
+ query.filter,
1250
+ `${path}.filter`,
1251
+ errors,
1252
+ createChartQueryDateConditionFieldResolver(query, context)
1253
+ );
1188
1254
  }
1189
- function collectChartFilterOperatorErrors(filter, path, errors) {
1255
+ function collectChartFilterOperatorErrors(filter, path, errors, resolveField) {
1190
1256
  if (_.isUndefined(filter) || _.isNull(filter) || !_.isPlainObject(filter)) {
1191
1257
  return;
1192
1258
  }
1193
1259
  if (Array.isArray(filter.items)) {
1194
- collectChartFilterGroupOperatorErrors(filter.items, `${path}.items`, errors);
1260
+ collectChartFilterGroupOperatorErrors(filter.items, `${path}.items`, errors, resolveField);
1195
1261
  return;
1196
1262
  }
1197
- collectBackendQueryFilterOperatorErrors(filter, path, errors);
1263
+ collectBackendQueryFilterOperatorErrors(filter, path, errors, resolveField);
1198
1264
  }
1199
- function collectChartFilterGroupOperatorErrors(items, path, errors) {
1265
+ function collectChartFilterGroupOperatorErrors(items, path, errors, resolveField) {
1200
1266
  items.forEach((item, index) => {
1201
1267
  const itemPath = `${path}[${index}]`;
1202
1268
  if (!_.isPlainObject(item)) {
1203
1269
  return;
1204
1270
  }
1205
1271
  if (Array.isArray(item.items)) {
1206
- collectChartFilterGroupOperatorErrors(item.items, `${itemPath}.items`, errors);
1272
+ collectChartFilterGroupOperatorErrors(item.items, `${itemPath}.items`, errors, resolveField);
1207
1273
  return;
1208
1274
  }
1209
1275
  if (hasOwn(item, "operator")) {
1210
1276
  collectChartFilterOperatorError(item.operator, `${itemPath}.operator`, errors);
1211
- collectChartFilterDateValueError(item.operator, item.value, `${itemPath}.value`, errors);
1277
+ const fieldPath = String(item.path || item.field || "").trim();
1278
+ collectChartFilterDateValueError(
1279
+ item.operator,
1280
+ item.value,
1281
+ `${itemPath}.value`,
1282
+ errors,
1283
+ fieldPath ? (resolveField == null ? void 0 : resolveField(fieldPath)) || { fieldPath } : void 0
1284
+ );
1212
1285
  }
1213
1286
  });
1214
1287
  }
1215
- function collectBackendQueryFilterOperatorErrors(filter, path, errors) {
1288
+ function collectBackendQueryFilterOperatorErrors(filter, path, errors, resolveField) {
1216
1289
  Object.entries(filter).forEach(([field, condition]) => {
1217
1290
  const fieldPath = `${path}.${field}`;
1218
1291
  if ((field === "$and" || field === "$or") && Array.isArray(condition)) {
1219
1292
  condition.forEach(
1220
- (operand, index) => collectChartFilterOperatorErrors(operand, `${fieldPath}[${index}]`, errors)
1293
+ (operand, index) => collectChartFilterOperatorErrors(operand, `${fieldPath}[${index}]`, errors, resolveField)
1221
1294
  );
1222
1295
  return;
1223
1296
  }
@@ -1226,11 +1299,17 @@ function collectBackendQueryFilterOperatorErrors(filter, path, errors) {
1226
1299
  }
1227
1300
  Object.keys(condition).forEach((operator) => {
1228
1301
  if (operator === "$and" || operator === "$or") {
1229
- collectChartFilterOperatorErrors({ [operator]: condition[operator] }, fieldPath, errors);
1302
+ collectChartFilterOperatorErrors({ [operator]: condition[operator] }, fieldPath, errors, resolveField);
1230
1303
  return;
1231
1304
  }
1232
1305
  collectChartFilterOperatorError(operator, `${fieldPath}.${operator}`, errors);
1233
- collectChartFilterDateValueError(operator, condition[operator], `${fieldPath}.${operator}`, errors);
1306
+ collectChartFilterDateValueError(
1307
+ operator,
1308
+ condition[operator],
1309
+ `${fieldPath}.${operator}`,
1310
+ errors,
1311
+ (resolveField == null ? void 0 : resolveField(field)) || { fieldPath: field }
1312
+ );
1234
1313
  });
1235
1314
  });
1236
1315
  }
@@ -1245,9 +1324,18 @@ function collectChartFilterOperatorError(operator, path, errors) {
1245
1324
  throw error;
1246
1325
  }
1247
1326
  }
1248
- function collectChartFilterDateValueError(operator, value, path, errors) {
1327
+ function collectChartFilterDateValueError(operator, value, path, errors, fieldContext) {
1328
+ const fieldMeta = getDateConditionFieldContextMeta(fieldContext);
1329
+ const normalizedOperator = typeof operator === "string" ? operator.trim() : "";
1330
+ if (!import_filter_group.FLOW_SURFACE_DATE_FILTER_OPERATORS.has(normalizedOperator) && !(0, import_filter_group.isFlowSurfaceDateLikeFieldMeta)(fieldMeta)) {
1331
+ return;
1332
+ }
1249
1333
  try {
1250
- (0, import_filter_group.normalizeFlowSurfaceStrictFilterDateValue)(operator, value, path);
1334
+ (0, import_filter_group.normalizeFlowSurfaceDateConditionValue)(operator, value, path, {
1335
+ fieldPath: fieldContext == null ? void 0 : fieldContext.fieldPath,
1336
+ fieldType: fieldMeta.type,
1337
+ fieldInterface: fieldMeta.interface
1338
+ });
1251
1339
  } catch (error) {
1252
1340
  if (error instanceof import_errors.FlowSurfaceBadRequestError) {
1253
1341
  pushChartBadRequestAuthoringError(errors, error, path);
@@ -1256,6 +1344,38 @@ function collectChartFilterDateValueError(operator, value, path, errors) {
1256
1344
  throw error;
1257
1345
  }
1258
1346
  }
1347
+ function createChartQueryDateConditionFieldResolver(query, context) {
1348
+ const resource = _.isPlainObject(query == null ? void 0 : query.resource) ? query.resource : null;
1349
+ const collectionName = String((resource == null ? void 0 : resource.collectionName) || "").trim();
1350
+ if (!collectionName || typeof (context == null ? void 0 : context.getCollection) !== "function") {
1351
+ return null;
1352
+ }
1353
+ const dataSourceKey = String((resource == null ? void 0 : resource.dataSourceKey) || "main").trim() || "main";
1354
+ const collection = context.getCollection(dataSourceKey, collectionName);
1355
+ if (!collection) {
1356
+ return null;
1357
+ }
1358
+ return (fieldPath) => {
1359
+ const normalizedFieldPath = (0, import_service_helpers.normalizeFieldPath)(fieldPath);
1360
+ const resolved = resolveDefaultFilterFieldPath(collection, normalizedFieldPath, dataSourceKey, context);
1361
+ return {
1362
+ fieldPath,
1363
+ field: resolved.field
1364
+ };
1365
+ };
1366
+ }
1367
+ function getDateConditionFieldMeta(field) {
1368
+ return {
1369
+ type: (0, import_service_helpers.getFieldType)(field),
1370
+ interface: (0, import_service_helpers.getFieldInterface)(field)
1371
+ };
1372
+ }
1373
+ function getDateConditionFieldContextMeta(fieldContext) {
1374
+ return {
1375
+ ...getDateConditionFieldMeta(fieldContext == null ? void 0 : fieldContext.field),
1376
+ ...(fieldContext == null ? void 0 : fieldContext.fieldMeta) || {}
1377
+ };
1378
+ }
1259
1379
  function normalizeChartAssetFieldPath(input) {
1260
1380
  if (Array.isArray(input)) {
1261
1381
  return input.map((item) => String(item || "").trim()).filter(Boolean).join(".");
@@ -3616,6 +3736,9 @@ function getGeneratedPopupBusinessFieldCandidates(collection) {
3616
3736
  if (!fieldName || !(0, import_default_action_popup.isFlowSurfaceDefaultActionPopupBusinessField)(field)) {
3617
3737
  return [];
3618
3738
  }
3739
+ if ((0, import_relation_backing_foreign_key.isRelationBackingForeignKeyField)(collection, field)) {
3740
+ return [];
3741
+ }
3619
3742
  return [
3620
3743
  {
3621
3744
  field,
@@ -3730,11 +3853,15 @@ function getGeneratedPopupDefaultFormFieldPaths(candidates, fieldGroups) {
3730
3853
  }
3731
3854
  function getGeneratedPopupRuntimeFieldCandidates(input) {
3732
3855
  const candidateContext = DEFAULT_ACTION_POPUP_FIELD_CONTEXT_BY_TYPE[input.actionType];
3856
+ const explicitDefaultFieldPaths = (0, import_default_action_popup.collectFlowSurfaceDefaultActionPopupFieldGroupFieldPaths)(input.fieldGroups);
3733
3857
  return (0, import_service_helpers.getCollectionFields)(input.collection).flatMap((field) => {
3734
3858
  const fieldName = (0, import_service_helpers.getFieldName)(field);
3735
3859
  if (!fieldName || !(0, import_default_action_popup.isFlowSurfaceDefaultActionPopupBusinessField)(field)) {
3736
3860
  return [];
3737
3861
  }
3862
+ if ((0, import_relation_backing_foreign_key.isRelationBackingForeignKeyField)(input.collection, field) && !explicitDefaultFieldPaths.has(fieldName)) {
3863
+ return [];
3864
+ }
3738
3865
  const fieldInterface = (0, import_service_helpers.getFieldInterface)(field);
3739
3866
  const registeredBinding = (0, import_field_binding_registry.resolveRegisteredFieldBinding)({
3740
3867
  containerUse: candidateContext.ownerUse,
@@ -3958,9 +4085,16 @@ function collectBlockErrors(block, path, errors, localKeys, context) {
3958
4085
  collectChartDisplayTitleErrors(block, blockType, path, errors);
3959
4086
  collectTreeTableExplicitFieldsErrors(block, blockType, path, errors, context);
3960
4087
  collectTreeConnectFieldsErrors((_a = block.settings) == null ? void 0 : _a.connectFields, `${path}.settings.connectFields`, errors);
3961
- collectTableSettingsErrors(block, blockType, path, errors, {
3962
- deferPublicDataScopeErrors: context.authoringActionName === "addBlocks"
3963
- });
4088
+ collectTableSettingsErrors(
4089
+ block,
4090
+ blockType,
4091
+ path,
4092
+ errors,
4093
+ {
4094
+ deferPublicDataScopeErrors: context.authoringActionName === "addBlocks"
4095
+ },
4096
+ context
4097
+ );
3964
4098
  collectGridCardSettingsErrors(block, blockType, path, errors);
3965
4099
  const descendantContext = getBlockDescendantValidationContext(block, context);
3966
4100
  collectActionListErrors(block.actions, `${path}.actions`, errors, block, descendantContext, "actions");
@@ -3999,7 +4133,7 @@ function collectJsBlockPublicContractErrors(block, path, errors, context) {
3999
4133
  pushAuthoringError(errors, {
4000
4134
  path: `${path}.${key}`,
4001
4135
  ruleId: `jsBlock-top-level-${key}-unsupported`,
4002
- message: `flowSurfaces authoring ${path}.${key} is not accepted on public jsBlock blocks; use ${path}.settings.code and ${path}.settings.version for inline JS code`,
4136
+ message: `flowSurfaces authoring ${path}.${key} is not accepted on public jsBlock blocks; use ${path}.settings.code, ${path}.settings.version, and ${path}.settings.showBlockCard for public JS block settings`,
4003
4137
  details: withJsBlockRepairHint({ key })
4004
4138
  });
4005
4139
  });
@@ -4010,7 +4144,7 @@ function collectJsBlockPublicContractErrors(block, path, errors, context) {
4010
4144
  pushAuthoringError(errors, {
4011
4145
  path: `${path}.${key}`,
4012
4146
  ruleId: key === "stepParams" ? "jsBlock-stepParams-unsupported" : "jsBlock-internal-field-unsupported",
4013
- message: `flowSurfaces authoring ${path}.${key} is not accepted on public jsBlock blocks; use ${path}.settings.code and ${path}.settings.version instead of internal persisted fields`,
4147
+ message: `flowSurfaces authoring ${path}.${key} is not accepted on public jsBlock blocks; use ${path}.settings.code, ${path}.settings.version, and ${path}.settings.showBlockCard instead of internal persisted fields`,
4014
4148
  details: withJsBlockRepairHint({
4015
4149
  key
4016
4150
  })
@@ -4033,7 +4167,7 @@ function collectJsBlockPublicContractErrors(block, path, errors, context) {
4033
4167
  pushAuthoringError(errors, {
4034
4168
  path: `${path}.settings.${key}`,
4035
4169
  ruleId: "jsBlock-settings-unsupported-key",
4036
- message: `flowSurfaces authoring ${path}.settings.${key} is not part of the public jsBlock contract; use ${path}.settings.code and ${path}.settings.version for inline JS code`,
4170
+ message: `flowSurfaces authoring ${path}.settings.${key} is not part of the public jsBlock contract; use ${path}.settings.code, ${path}.settings.version, and ${path}.settings.showBlockCard for public JS block settings`,
4037
4171
  details: withJsBlockRepairHint({
4038
4172
  key,
4039
4173
  allowedKeys: Array.from(JS_BLOCK_ALLOWED_SETTINGS_KEYS)
@@ -4075,7 +4209,7 @@ function collectJsBlockConfigurePublicContractErrors(changes, path, errors) {
4075
4209
  pushAuthoringError(errors, {
4076
4210
  path: `${path}.${key}`,
4077
4211
  ruleId: key === "stepParams" ? "jsBlock-stepParams-unsupported" : "jsBlock-internal-field-unsupported",
4078
- message: `flowSurfaces authoring ${path}.${key} is not accepted on public jsBlock configure changes; use ${path}.code and ${path}.version instead of internal persisted fields`,
4212
+ message: `flowSurfaces authoring ${path}.${key} is not accepted on public jsBlock configure changes; use ${path}.code, ${path}.version, and ${path}.showBlockCard instead of internal persisted fields`,
4079
4213
  details: withJsBlockRepairHint({
4080
4214
  key
4081
4215
  })
@@ -4108,7 +4242,7 @@ function collectJsBlockConfigurePublicContractErrors(changes, path, errors) {
4108
4242
  pushAuthoringError(errors, {
4109
4243
  path: `${path}.settings`,
4110
4244
  ruleId: "jsBlock-settings-unsupported-key",
4111
- message: `flowSurfaces authoring ${path}.settings is not part of the public jsBlock configure contract; use ${path}.code and ${path}.version`,
4245
+ message: `flowSurfaces authoring ${path}.settings is not part of the public jsBlock configure contract; use ${path}.code, ${path}.version, and ${path}.showBlockCard`,
4112
4246
  details: withJsBlockRepairHint()
4113
4247
  });
4114
4248
  return;
@@ -4268,11 +4402,12 @@ async function collectConfigureErrors(values, errors, context) {
4268
4402
  collectCommentsBlockErrors(changesBlock, hostBlockType, "$.changes", errors, context);
4269
4403
  collectRecordHistoryBlockErrors(changesBlock, hostBlockType, "$.changes", errors, context);
4270
4404
  collectChartDisplayTitleErrors(changes, hostBlockType, "$.changes", errors);
4271
- collectChartConfigureFilterOperatorErrors(changes, hostBlockType, "$.changes", errors);
4272
- collectTableSettingsErrors(changes, hostBlockType, "$.changes", errors, { directSettings: true });
4405
+ collectChartConfigureFilterOperatorErrors(changes, hostBlockType, "$.changes", errors, context);
4406
+ collectTableSettingsErrors(changes, hostBlockType, "$.changes", errors, { directSettings: true }, context);
4273
4407
  collectGridCardSettingsErrors(changes, hostBlockType, "$.changes", errors, { directSettings: true });
4274
4408
  collectAssignValuesErrors(changes.assignValues, "$.changes.assignValues", errors, changesBlock, context);
4275
4409
  collectTriggerWorkflowsErrors(changes.triggerWorkflows, "$.changes.triggerWorkflows", errors);
4410
+ collectLinkageRulesErrors(changes.linkageRules, "$.changes.linkageRules", errors);
4276
4411
  collectFieldListInternalKeyErrors(changes.fields, "$.changes.fields", errors);
4277
4412
  const connectFieldsTargets = collectTreeConnectFieldsErrors(changes.connectFields, "$.changes.connectFields", errors);
4278
4413
  await collectTreeConnectFieldsLiveErrors(connectFieldsTargets, changes, "$.changes.connectFields", errors, context);
@@ -4357,10 +4492,20 @@ function collectUnsupportedDefaultFilterOperatorError(operator, path, errors) {
4357
4492
  }
4358
4493
  });
4359
4494
  }
4360
- function collectDefaultFilterDateValueError(operator, value, path, errors) {
4495
+ function collectDefaultFilterDateValueError(operator, value, path, errors, fieldContext, options = {}) {
4361
4496
  var _a, _b, _c;
4497
+ const fieldMeta = getDateConditionFieldContextMeta(fieldContext);
4498
+ const normalizedOperator = typeof operator === "string" ? operator.trim() : "";
4499
+ if (!import_filter_group.FLOW_SURFACE_DATE_FILTER_OPERATORS.has(normalizedOperator) && !(0, import_filter_group.isFlowSurfaceDateLikeFieldMeta)(fieldMeta)) {
4500
+ return;
4501
+ }
4362
4502
  try {
4363
- (0, import_filter_group.normalizeFlowSurfaceStrictFilterDateValue)(operator, value, path);
4503
+ (0, import_filter_group.normalizeFlowSurfaceDateConditionValue)(operator, value, path, {
4504
+ fieldPath: fieldContext == null ? void 0 : fieldContext.fieldPath,
4505
+ fieldType: fieldMeta.type,
4506
+ fieldInterface: fieldMeta.interface,
4507
+ allowContextPathValue: options.allowContextPathValue
4508
+ });
4364
4509
  } catch (error) {
4365
4510
  if (!(error instanceof import_errors.FlowSurfaceBadRequestError)) {
4366
4511
  throw error;
@@ -4374,6 +4519,82 @@ function collectDefaultFilterDateValueError(operator, value, path, errors) {
4374
4519
  });
4375
4520
  }
4376
4521
  }
4522
+ function collectPublicDataScopeDateOperatorError(operator, value, path, errors, fieldContext) {
4523
+ const fieldMeta = getDateConditionFieldContextMeta(fieldContext);
4524
+ if (!(0, import_filter_group.isFlowSurfaceDateLikeFieldMeta)(fieldMeta)) {
4525
+ return;
4526
+ }
4527
+ const normalizedOperator = typeof operator === "string" ? operator.trim() : "";
4528
+ if (FLOW_SURFACE_DATA_SCOPE_DATE_ALLOWED_OPERATORS.has(normalizedOperator)) {
4529
+ return;
4530
+ }
4531
+ const isComparisonOperator = FLOW_SURFACE_DATA_SCOPE_DATE_UI_INCOMPATIBLE_OPERATORS.has(normalizedOperator);
4532
+ const suggestedOperator = isComparisonOperator ? getSuggestedPublicDataScopeDateOperator(normalizedOperator) : void 0;
4533
+ const suggestedValue = getSuggestedPublicDataScopeDateValue(value);
4534
+ pushAuthoringError(errors, {
4535
+ path,
4536
+ ruleId: "dataScope-date-operator-ui-incompatible",
4537
+ message: `flowSurfaces authoring ${path} cannot use operator '${normalizedOperator}' for a date/datetime DataScope condition`,
4538
+ details: {
4539
+ fieldPath: fieldContext == null ? void 0 : fieldContext.fieldPath,
4540
+ fieldType: fieldMeta.type,
4541
+ fieldInterface: fieldMeta.interface,
4542
+ invalidOperator: normalizedOperator,
4543
+ invalidValue: value,
4544
+ allowedOperators: Array.from(FLOW_SURFACE_DATA_SCOPE_DATE_ALLOWED_OPERATORS),
4545
+ ...suggestedOperator ? { suggestedOperator } : {},
4546
+ ...typeof suggestedValue !== "undefined" ? { suggestedValue } : {},
4547
+ repairHint: 'For public settings.dataScope date/datetime fields, use UI date operators such as $dateOn with UI date values like "2026-07-05"; do not move fixed data-range conditions to defaultFilter.',
4548
+ repairExample: {
4549
+ logic: "$and",
4550
+ items: [
4551
+ {
4552
+ path: (fieldContext == null ? void 0 : fieldContext.fieldPath) || "createdAt",
4553
+ operator: suggestedOperator || "$dateOn",
4554
+ value: typeof suggestedValue !== "undefined" ? suggestedValue : "2026-07-05"
4555
+ }
4556
+ ]
4557
+ },
4558
+ agentInstruction: "Replace date/datetime DataScope comparison operators with $dateOn/$dateNotOn/$dateBefore/$dateAfter/$dateNotBefore/$dateNotAfter/$dateBetween and UI date values. Keep the condition in dataScope when it is a fixed data range."
4559
+ }
4560
+ });
4561
+ }
4562
+ function getSuggestedPublicDataScopeDateOperator(operator) {
4563
+ switch (operator) {
4564
+ case "$eq":
4565
+ return "$dateOn";
4566
+ case "$ne":
4567
+ return "$dateNotOn";
4568
+ case "$lt":
4569
+ return "$dateBefore";
4570
+ case "$lte":
4571
+ return "$dateNotAfter";
4572
+ case "$gt":
4573
+ return "$dateAfter";
4574
+ case "$gte":
4575
+ return "$dateNotBefore";
4576
+ default:
4577
+ return void 0;
4578
+ }
4579
+ }
4580
+ function getSuggestedPublicDataScopeDateValue(value) {
4581
+ if (typeof value === "string") {
4582
+ const match = /^(\d{4}-\d{2}-\d{2})/.exec(value.trim());
4583
+ if (match) {
4584
+ return match[1];
4585
+ }
4586
+ }
4587
+ if (Array.isArray(value)) {
4588
+ const suggested = value.map((item) => {
4589
+ var _a;
4590
+ return typeof item === "string" ? (_a = /^(\d{4}-\d{2}-\d{2})/.exec(item.trim())) == null ? void 0 : _a[1] : void 0;
4591
+ }).filter(Boolean);
4592
+ if (suggested.length === value.length && suggested.length > 0) {
4593
+ return suggested;
4594
+ }
4595
+ }
4596
+ return void 0;
4597
+ }
4377
4598
  function collectTopLevelLayoutErrors(actionName, values, errors) {
4378
4599
  if (actionName !== "applyBlueprint") {
4379
4600
  return;
@@ -5423,13 +5644,13 @@ function collectChartDisplayTitleErrors(block, blockType, blockPath, errors) {
5423
5644
  message: "Chart block settings do not support displayTitle in the current flowSurfaces runtime; keep settings.title and omit displayTitle."
5424
5645
  });
5425
5646
  }
5426
- function collectChartConfigureFilterOperatorErrors(changes, hostBlockType, path, errors) {
5647
+ function collectChartConfigureFilterOperatorErrors(changes, hostBlockType, path, errors, context) {
5427
5648
  if (hostBlockType !== "chart" || !_.isPlainObject(changes)) {
5428
5649
  return;
5429
5650
  }
5430
- collectChartQueryFilterOperatorErrors(changes.query, `${path}.query`, errors);
5651
+ collectChartQueryFilterOperatorErrors(changes.query, `${path}.query`, errors, context);
5431
5652
  if (_.isPlainObject(changes.configure)) {
5432
- collectChartQueryFilterOperatorErrors(changes.configure.query, `${path}.configure.query`, errors);
5653
+ collectChartQueryFilterOperatorErrors(changes.configure.query, `${path}.configure.query`, errors, context);
5433
5654
  }
5434
5655
  }
5435
5656
  function visitFilterItems(value, path, errors, block, context = {}) {
@@ -5446,7 +5667,13 @@ function visitFilterItems(value, path, errors, block, context = {}) {
5446
5667
  }
5447
5668
  if (typeof value.operator === "string") {
5448
5669
  collectUnsupportedDefaultFilterOperatorError(value.operator, `${path}.operator`, errors);
5449
- collectDefaultFilterDateValueError(value.operator, value.value, `${path}.value`, errors);
5670
+ collectDefaultFilterDateValueError(
5671
+ value.operator,
5672
+ value.value,
5673
+ `${path}.value`,
5674
+ errors,
5675
+ fieldRef ? resolveDefaultFilterDateConditionField(fieldRef.value, block, context) : void 0
5676
+ );
5450
5677
  }
5451
5678
  const filterItems = value.items;
5452
5679
  if (Array.isArray(filterItems)) {
@@ -5472,11 +5699,33 @@ function visitFilterItems(value, path, errors, block, context = {}) {
5472
5699
  if (_.isPlainObject(child)) {
5473
5700
  Object.entries(child).forEach(([operator, operatorValue]) => {
5474
5701
  collectUnsupportedDefaultFilterOperatorError(operator, `${path}.${key}.${operator}`, errors);
5475
- collectDefaultFilterDateValueError(operator, operatorValue, `${path}.${key}.${operator}`, errors);
5702
+ collectDefaultFilterDateValueError(
5703
+ operator,
5704
+ operatorValue,
5705
+ `${path}.${key}.${operator}`,
5706
+ errors,
5707
+ resolveDefaultFilterDateConditionField(key, block, context)
5708
+ );
5476
5709
  });
5477
5710
  }
5478
5711
  });
5479
5712
  }
5713
+ function resolveDefaultFilterDateConditionField(rawFieldPath, block, context) {
5714
+ const fieldPath = String(rawFieldPath || "").trim();
5715
+ if (!fieldPath || fieldPath.startsWith("$") || fieldPath.startsWith("{{")) {
5716
+ return null;
5717
+ }
5718
+ const collection = getBlockCollection(block, context);
5719
+ if (!collection) {
5720
+ return null;
5721
+ }
5722
+ const dataSourceKey = getBlockDataSourceKey(block, context);
5723
+ const resolved = resolveDefaultFilterFieldPath(collection, (0, import_service_helpers.normalizeFieldPath)(fieldPath), dataSourceKey, context);
5724
+ return {
5725
+ fieldPath,
5726
+ field: resolved.field
5727
+ };
5728
+ }
5480
5729
  function collectTreeConnectFieldsErrors(value, path, errors) {
5481
5730
  if (_.isUndefined(value)) {
5482
5731
  return [];
@@ -5825,7 +6074,7 @@ function getCollectionFilterTargetKey(collection) {
5825
6074
  function normalizeDataSourceKey(value) {
5826
6075
  return String(value || "main").trim() || "main";
5827
6076
  }
5828
- function collectTableSettingsErrors(block, blockType, blockPath, errors, options = {}) {
6077
+ function collectTableSettingsErrors(block, blockType, blockPath, errors, options = {}, context = {}) {
5829
6078
  if (blockType !== "table" || !_.isPlainObject(block)) {
5830
6079
  return;
5831
6080
  }
@@ -5836,6 +6085,9 @@ function collectTableSettingsErrors(block, blockType, blockPath, errors, options
5836
6085
  });
5837
6086
  const hasSettings = _.isPlainObject(block == null ? void 0 : block.settings);
5838
6087
  if (!hasSettings) {
6088
+ if (options.directSettings === true && !shouldDeferPublicDataScopeErrorsToBatchItem(blockPath, errors, options)) {
6089
+ collectPublicDataScopeErrors(block.dataScope, `${blockPath}.dataScope`, errors, block, context);
6090
+ }
5839
6091
  return;
5840
6092
  }
5841
6093
  const settings = block.settings;
@@ -5850,7 +6102,7 @@ function collectTableSettingsErrors(block, blockType, blockPath, errors, options
5850
6102
  pushTableSettingsUnsupportedError(errors, `${settingsPath}.${key}`, key);
5851
6103
  });
5852
6104
  if (!shouldDeferPublicDataScopeErrorsToBatchItem(blockPath, errors, options)) {
5853
- collectPublicDataScopeErrors(settings.dataScope, `${settingsPath}.dataScope`, errors);
6105
+ collectPublicDataScopeErrors(settings.dataScope, `${settingsPath}.dataScope`, errors, block, context);
5854
6106
  }
5855
6107
  }
5856
6108
  function pushTableSettingsUnsupportedError(errors, path, key) {
@@ -5865,7 +6117,7 @@ function pushTableSettingsUnsupportedError(errors, path, key) {
5865
6117
  }
5866
6118
  });
5867
6119
  }
5868
- function collectPublicDataScopeErrors(value, path, errors) {
6120
+ function collectPublicDataScopeErrors(value, path, errors, block, context) {
5869
6121
  if (_.isUndefined(value)) {
5870
6122
  return;
5871
6123
  }
@@ -5885,6 +6137,62 @@ function collectPublicDataScopeErrors(value, path, errors) {
5885
6137
  repairHint: 'Use settings.dataScope with logic/items, for example {"logic":"$and","items":[{"path":"status","operator":"$eq","value":"Active"}]}; do not use a field-name map.'
5886
6138
  }
5887
6139
  });
6140
+ return;
6141
+ }
6142
+ collectPublicDataScopeFieldPathErrors(validationValue, path, errors, block, context);
6143
+ collectFilterGroupDateConditionErrors(validationValue, path, errors, block, context);
6144
+ }
6145
+ function collectPublicDataScopeFieldPathErrors(value, path, errors, block, context) {
6146
+ if (!_.isPlainObject(value)) {
6147
+ return;
6148
+ }
6149
+ if (hasOwn(value, "operator")) {
6150
+ collectPublicDataScopeFieldPathError(value.path, `${path}.path`, block, context, errors);
6151
+ }
6152
+ if (Array.isArray(value.items)) {
6153
+ value.items.forEach(
6154
+ (item, index) => collectPublicDataScopeFieldPathErrors(item, `${path}.items[${index}]`, errors, block, context)
6155
+ );
6156
+ }
6157
+ }
6158
+ function collectPublicDataScopeFieldPathError(rawFieldPath, path, block, context, errors) {
6159
+ const fieldPath = String(rawFieldPath || "").trim();
6160
+ if (!fieldPath || fieldPath.startsWith("$") || fieldPath.startsWith("{{")) {
6161
+ return;
6162
+ }
6163
+ const collection = getBlockCollection(block, context);
6164
+ if (!collection) {
6165
+ return;
6166
+ }
6167
+ const resolved = resolveDefaultFilterFieldPath(
6168
+ collection,
6169
+ (0, import_service_helpers.normalizeFieldPath)(fieldPath),
6170
+ getBlockDataSourceKey(block, context),
6171
+ context
6172
+ );
6173
+ if (!resolved.field) {
6174
+ pushAuthoringError(errors, {
6175
+ path,
6176
+ ruleId: "field-path-unknown",
6177
+ message: `flowSurfaces authoring ${path} references unknown field '${fieldPath}'`,
6178
+ details: {
6179
+ fieldPath,
6180
+ collection: (0, import_service_helpers.getCollectionName)(resolved.collection || collection),
6181
+ availableFields: (0, import_service_helpers.getCollectionFields)(resolved.collection || collection).map((field) => String((0, import_service_helpers.getFieldName)(field) || "").trim()).filter(Boolean)
6182
+ }
6183
+ });
6184
+ return;
6185
+ }
6186
+ if ((0, import_service_helpers.isAssociationField)(resolved.field)) {
6187
+ pushAuthoringError(errors, {
6188
+ path,
6189
+ ruleId: "defaultFilter-relation-field-unsupported",
6190
+ message: `flowSurfaces authoring ${path} cannot use relation field '${fieldPath}' itself; use a scalar subfield instead`,
6191
+ details: {
6192
+ fieldPath,
6193
+ fieldName: (0, import_service_helpers.getFieldName)(resolved.field)
6194
+ }
6195
+ });
5888
6196
  }
5889
6197
  }
5890
6198
  function shouldDeferPublicDataScopeErrorsToBatchItem(blockPath, errors, options) {
@@ -5906,6 +6214,24 @@ function normalizePublicDataScopeValueForValidation(value) {
5906
6214
  }
5907
6215
  return value;
5908
6216
  }
6217
+ function collectFilterGroupDateConditionErrors(value, path, errors, block, context) {
6218
+ if (!_.isPlainObject(value)) {
6219
+ return;
6220
+ }
6221
+ if (Array.isArray(value.items)) {
6222
+ value.items.forEach(
6223
+ (item, index) => collectFilterGroupDateConditionErrors(item, `${path}.items[${index}]`, errors, block, context)
6224
+ );
6225
+ return;
6226
+ }
6227
+ if (!hasOwn(value, "operator")) {
6228
+ return;
6229
+ }
6230
+ const fieldPath = String(value.path || value.field || "").trim();
6231
+ const fieldContext = fieldPath ? resolveDefaultFilterDateConditionField(fieldPath, block, context) : void 0;
6232
+ collectPublicDataScopeDateOperatorError(value.operator, value.value, `${path}.operator`, errors, fieldContext);
6233
+ collectDefaultFilterDateValueError(value.operator, value.value, `${path}.value`, errors, fieldContext);
6234
+ }
5909
6235
  function collectGridCardSettingsErrors(block, blockType, blockPath, errors, options = {}) {
5910
6236
  const hasSettings = _.isPlainObject(block == null ? void 0 : block.settings);
5911
6237
  if (!hasSettings && options.directSettings !== true) {
@@ -6033,11 +6359,12 @@ function buildAuthoringAIEmployeeActionIdentity(settings) {
6033
6359
  return stableSerializeAuthoringValue(normalizeAuthoringAIEmployeePublicSettingsForIdentity(settings));
6034
6360
  }
6035
6361
  function normalizeAuthoringAIEmployeePublicSettingsForIdentity(settings) {
6362
+ const workContext = Object.prototype.hasOwnProperty.call(settings, "workContext") ? normalizeAuthoringAIEmployeeWorkContextForIdentity(settings.workContext) : [{ type: "flow-model", target: "self" }];
6036
6363
  return {
6037
6364
  username: String(settings.username || "").trim(),
6038
6365
  auto: typeof settings.auto === "boolean" ? settings.auto : false,
6039
- workContext: Object.prototype.hasOwnProperty.call(settings, "workContext") ? normalizeAuthoringAIEmployeeWorkContextForIdentity(settings.workContext) : [{ type: "flow-model", target: "self" }],
6040
- tasks: normalizeAuthoringAIEmployeeTasksForIdentity(settings.tasks),
6366
+ workContext,
6367
+ tasks: normalizeAuthoringAIEmployeeTasksForIdentity(settings.tasks, workContext),
6041
6368
  style: {
6042
6369
  ...AUTHORING_AI_EMPLOYEE_DEFAULT_STYLE,
6043
6370
  ..._.isPlainObject(settings.style) ? _.pick(settings.style, AUTHORING_AI_EMPLOYEE_STYLE_PUBLIC_KEYS) : {}
@@ -6056,7 +6383,14 @@ function normalizeAuthoringAIEmployeeWorkContextForIdentity(value) {
6056
6383
  return output;
6057
6384
  });
6058
6385
  }
6059
- function normalizeAuthoringAIEmployeeTasksForIdentity(value) {
6386
+ function normalizeAuthoringAIEmployeeTaskWorkContextForIdentity(value, defaultWorkContext) {
6387
+ const normalized = normalizeAuthoringAIEmployeeWorkContextForIdentity(value);
6388
+ if (Array.isArray(defaultWorkContext) && !normalized.length) {
6389
+ return _.cloneDeep(defaultWorkContext);
6390
+ }
6391
+ return normalized;
6392
+ }
6393
+ function normalizeAuthoringAIEmployeeTasksForIdentity(value, defaultWorkContext) {
6060
6394
  return _.castArray(value || []).map((task) => {
6061
6395
  if (!_.isPlainObject(task)) {
6062
6396
  return task;
@@ -6064,10 +6398,11 @@ function normalizeAuthoringAIEmployeeTasksForIdentity(value) {
6064
6398
  const output = _.pick(task, AUTHORING_AI_EMPLOYEE_TASK_PUBLIC_SETTING_KEYS);
6065
6399
  if (_.isPlainObject(output.message)) {
6066
6400
  output.message = _.pick(output.message, AUTHORING_AI_EMPLOYEE_TASK_MESSAGE_PUBLIC_KEYS);
6067
- if (_.isPlainObject(output.message.workContext)) {
6068
- output.message.workContext = normalizeAuthoringAIEmployeeWorkContextForIdentity(output.message.workContext);
6069
- } else if (Array.isArray(output.message.workContext)) {
6070
- output.message.workContext = normalizeAuthoringAIEmployeeWorkContextForIdentity(output.message.workContext);
6401
+ if (Object.prototype.hasOwnProperty.call(output.message, "workContext")) {
6402
+ output.message.workContext = normalizeAuthoringAIEmployeeTaskWorkContextForIdentity(
6403
+ output.message.workContext,
6404
+ defaultWorkContext
6405
+ );
6071
6406
  }
6072
6407
  }
6073
6408
  if (Object.prototype.hasOwnProperty.call(task, "prompt") && !Object.prototype.hasOwnProperty.call(output.message || {}, "user")) {
@@ -6076,6 +6411,13 @@ function normalizeAuthoringAIEmployeeTasksForIdentity(value) {
6076
6411
  user: task.prompt
6077
6412
  };
6078
6413
  }
6414
+ if (!_.isPlainObject(output.message) && Array.isArray(defaultWorkContext)) {
6415
+ output.message = {
6416
+ workContext: _.cloneDeep(defaultWorkContext)
6417
+ };
6418
+ } else if (_.isPlainObject(output.message) && !Object.prototype.hasOwnProperty.call(output.message, "workContext")) {
6419
+ output.message.workContext = _.cloneDeep(defaultWorkContext || []);
6420
+ }
6079
6421
  if (_.isPlainObject(output.model)) {
6080
6422
  output.model = _.pick(output.model, AUTHORING_AI_EMPLOYEE_TASK_MODEL_PUBLIC_KEYS);
6081
6423
  }
@@ -6154,7 +6496,7 @@ function collectActionSlotErrors(actionType, path, errors, block, slot = "action
6154
6496
  }
6155
6497
  }
6156
6498
  function collectActionErrors(action, path, errors, block, context = {}, slot = "actions") {
6157
- var _a, _b, _c, _d;
6499
+ var _a, _b, _c, _d, _e;
6158
6500
  const actionType = resolveAuthoringActionType(action, block);
6159
6501
  collectActionSlotErrors(actionType, path, errors, block, slot);
6160
6502
  if (!_.isPlainObject(action)) {
@@ -6163,6 +6505,7 @@ function collectActionErrors(action, path, errors, block, context = {}, slot = "
6163
6505
  collectApplyBlueprintScriptAssetReferenceErrors(action, path, errors, context);
6164
6506
  collectAssignValuesErrors((_a = action.settings) == null ? void 0 : _a.assignValues, `${path}.settings.assignValues`, errors, block, context);
6165
6507
  collectTriggerWorkflowsErrors((_b = action.settings) == null ? void 0 : _b.triggerWorkflows, `${path}.settings.triggerWorkflows`, errors);
6508
+ collectLinkageRulesErrors((_c = action.settings) == null ? void 0 : _c.linkageRules, `${path}.settings.linkageRules`, errors);
6166
6509
  if (hasOwn(action, "assignValues")) {
6167
6510
  pushAuthoringError(errors, {
6168
6511
  path: `${path}.assignValues`,
@@ -6198,7 +6541,7 @@ function collectActionErrors(action, path, errors, block, context = {}, slot = "
6198
6541
  }
6199
6542
  });
6200
6543
  }
6201
- const hasRunnableSource = typeof action.source === "string" && action.source.trim() || typeof action.code === "string" && action.code.trim() || hasApplyBlueprintRunnableScriptAssetReference(action.script, context) || typeof ((_c = action.settings) == null ? void 0 : _c.source) === "string" && action.settings.source.trim() || typeof ((_d = action.settings) == null ? void 0 : _d.code) === "string" && action.settings.code.trim();
6544
+ const hasRunnableSource = typeof action.source === "string" && action.source.trim() || typeof action.code === "string" && action.code.trim() || hasApplyBlueprintRunnableScriptAssetReference(action.script, context) || typeof ((_d = action.settings) == null ? void 0 : _d.source) === "string" && action.settings.source.trim() || typeof ((_e = action.settings) == null ? void 0 : _e.code) === "string" && action.settings.code.trim();
6202
6545
  if (!hasRunnableSource) {
6203
6546
  pushAuthoringError(errors, {
6204
6547
  path,
@@ -6463,6 +6806,59 @@ function collectTriggerWorkflowsErrors(value, path, errors) {
6463
6806
  }
6464
6807
  });
6465
6808
  }
6809
+ function collectLinkageRulesErrors(value, path, errors) {
6810
+ if (_.isUndefined(value)) {
6811
+ return;
6812
+ }
6813
+ if (!Array.isArray(value)) {
6814
+ pushAuthoringError(errors, {
6815
+ path,
6816
+ ruleId: "linkageRules-invalid-shape",
6817
+ message: `flowSurfaces authoring ${path} must be an array`
6818
+ });
6819
+ return;
6820
+ }
6821
+ value.forEach((rule, index) => {
6822
+ const rulePath = `${path}[${index}]`;
6823
+ if (!_.isPlainObject(rule)) {
6824
+ pushAuthoringError(errors, {
6825
+ path: rulePath,
6826
+ ruleId: "linkageRules-rule-invalid-shape",
6827
+ message: `flowSurfaces authoring ${rulePath} must be an object`
6828
+ });
6829
+ return;
6830
+ }
6831
+ const conditionPath = hasOwn(rule, "condition") ? `${rulePath}.condition` : hasOwn(rule, "when") ? `${rulePath}.when` : `${rulePath}.condition`;
6832
+ const conditionValue = hasOwn(rule, "condition") ? rule.condition : hasOwn(rule, "when") ? rule.when : import_filter_group.FLOW_SURFACE_EMPTY_FILTER_GROUP;
6833
+ try {
6834
+ (0, import_filter_group.normalizeFlowSurfaceCompatibleFilterGroupValue)(
6835
+ conditionValue,
6836
+ `flowSurfaces authoring ${conditionPath} expects FilterGroup or backend query filter like ${import_filter_group.FLOW_SURFACE_FILTER_GROUP_EXAMPLE}`,
6837
+ { strictDateValues: true }
6838
+ );
6839
+ } catch (error) {
6840
+ pushAuthoringError(errors, {
6841
+ path: conditionPath,
6842
+ ruleId: "linkageRules-condition-invalid-shape",
6843
+ message: error instanceof Error ? error.message : String(error)
6844
+ });
6845
+ }
6846
+ if (hasOwn(rule, "actions") && !Array.isArray(rule.actions)) {
6847
+ pushAuthoringError(errors, {
6848
+ path: `${rulePath}.actions`,
6849
+ ruleId: "linkageRules-actions-invalid-shape",
6850
+ message: `flowSurfaces authoring ${rulePath}.actions must be an array`
6851
+ });
6852
+ }
6853
+ if (hasOwn(rule, "then") && !Array.isArray(rule.then)) {
6854
+ pushAuthoringError(errors, {
6855
+ path: `${rulePath}.then`,
6856
+ ruleId: "linkageRules-actions-invalid-shape",
6857
+ message: `flowSurfaces authoring ${rulePath}.then must be an array`
6858
+ });
6859
+ }
6860
+ });
6861
+ }
6466
6862
  function collectPopupErrors(popup, path, errors, localKeys, context = {}) {
6467
6863
  if (!_.isPlainObject(popup)) {
6468
6864
  return;
@@ -6516,7 +6912,7 @@ function collectNestedBlockErrors(blocks, path, errors, localKeys, context) {
6516
6912
  }
6517
6913
  blocks.forEach((block, index) => collectBlockErrors(block, `${path}[${index}]`, errors, localKeys, context));
6518
6914
  }
6519
- function collectReactionErrors(reaction, path, localKeys, errors) {
6915
+ function collectReactionErrors(reaction, path, localKeys, errors, options = {}) {
6520
6916
  const items = Array.isArray(reaction == null ? void 0 : reaction.items) ? reaction.items : [];
6521
6917
  items.forEach((item, index) => {
6522
6918
  const rawTarget = (item == null ? void 0 : item.target) ?? (item == null ? void 0 : item.targetKey) ?? (item == null ? void 0 : item.targetBlock);
@@ -6534,8 +6930,198 @@ function collectReactionErrors(reaction, path, localKeys, errors) {
6534
6930
  message: `flowSurfaces authoring ${path}.items[${index}].target references unknown local target '${target}'`
6535
6931
  });
6536
6932
  }
6933
+ collectReactionItemDateConditionErrors(item, `${path}.items[${index}]`, target, errors, options);
6537
6934
  });
6538
6935
  }
6936
+ function collectReactionItemDateConditionErrors(item, path, target, errors, options) {
6937
+ if (!_.isPlainObject(item) || !_.isPlainObject(options.values) || !options.context) {
6938
+ return;
6939
+ }
6940
+ const targetMatch = findApplyBlueprintReactionTargetBlock(options.values, target, options.context);
6941
+ if (!targetMatch) {
6942
+ return;
6943
+ }
6944
+ const type = String(item.type || "").trim();
6945
+ const conditionFieldMetaByPath = buildApplyBlueprintReactionConditionFieldMetaByPath(
6946
+ targetMatch.block,
6947
+ targetMatch.context
6948
+ );
6949
+ _.castArray(item.rules || []).forEach((rule, ruleIndex) => {
6950
+ collectReactionFilterDateConditionErrors(
6951
+ (rule == null ? void 0 : rule.when) ?? (rule == null ? void 0 : rule.condition),
6952
+ `${path}.rules[${ruleIndex}].when`,
6953
+ errors,
6954
+ targetMatch.block,
6955
+ targetMatch.context,
6956
+ conditionFieldMetaByPath
6957
+ );
6958
+ if (type !== "setFieldLinkageRules") {
6959
+ return;
6960
+ }
6961
+ _.castArray((rule == null ? void 0 : rule.then) || (rule == null ? void 0 : rule.actions) || []).forEach((action, actionIndex) => {
6962
+ _.castArray((action == null ? void 0 : action.items) || []).forEach((assignItem, itemIndex) => {
6963
+ collectReactionFilterDateConditionErrors(
6964
+ (assignItem == null ? void 0 : assignItem.when) ?? (assignItem == null ? void 0 : assignItem.condition),
6965
+ `${path}.rules[${ruleIndex}].then[${actionIndex}].items[${itemIndex}].when`,
6966
+ errors,
6967
+ targetMatch.block,
6968
+ targetMatch.context,
6969
+ conditionFieldMetaByPath
6970
+ );
6971
+ });
6972
+ });
6973
+ });
6974
+ }
6975
+ function collectReactionFilterDateConditionErrors(filter, path, errors, block, context, fieldMetaByPath = {}) {
6976
+ if (!_.isPlainObject(filter)) {
6977
+ return;
6978
+ }
6979
+ if (Array.isArray(filter.items)) {
6980
+ filter.items.forEach(
6981
+ (item, index) => collectReactionFilterDateConditionErrors(
6982
+ item,
6983
+ `${path}.items[${index}]`,
6984
+ errors,
6985
+ block,
6986
+ context,
6987
+ fieldMetaByPath
6988
+ )
6989
+ );
6990
+ return;
6991
+ }
6992
+ if (!hasOwn(filter, "operator")) {
6993
+ return;
6994
+ }
6995
+ const conditionPath = normalizeReactionConditionPath(filter.path);
6996
+ const fieldContext = resolveReactionConditionFieldContext(conditionPath, block, context, fieldMetaByPath);
6997
+ collectDefaultFilterDateValueError(filter.operator, filter.value, `${path}.value`, errors, fieldContext, {
6998
+ allowContextPathValue: true
6999
+ });
7000
+ }
7001
+ function normalizeReactionConditionPath(rawPath) {
7002
+ const value = String(rawPath || "").trim();
7003
+ const templateMatch = /^\{\{\s*ctx(?:\.([^}]+?))?\s*\}\}$/.exec(value);
7004
+ const path = templateMatch ? String(templateMatch[1] || "").trim() : value.replace(/^ctx\./, "");
7005
+ return path.split(".").map((segment) => segment.trim()).filter(Boolean).join(".");
7006
+ }
7007
+ function buildApplyBlueprintReactionConditionFieldMetaByPath(block, context) {
7008
+ var _a, _b;
7009
+ const collection = getBlockCollection(block, context);
7010
+ const dataSourceKey = getBlockDataSourceKey(block, context);
7011
+ const userCollection = ((_a = context.getCollection) == null ? void 0 : _a.call(context, "main", "users")) || ((_b = context.getCollection) == null ? void 0 : _b.call(context, dataSourceKey, "users")) || null;
7012
+ const response = (0, import_context.buildFlowSurfaceContextResponse)({
7013
+ semantic: {
7014
+ collection,
7015
+ userCollection,
7016
+ recordCollection: collection,
7017
+ formValuesCollection: collection,
7018
+ itemCollections: collection ? [collection] : [],
7019
+ itemRootCollection: collection || void 0,
7020
+ popupLevels: context.isPopupSurface || context.popupHasCurrentRecord ? [
7021
+ {
7022
+ recordCollection: collection,
7023
+ sourceRecordCollection: collection
7024
+ }
7025
+ ] : []
7026
+ },
7027
+ maxDepth: 4
7028
+ });
7029
+ const fieldMetaByPath = collectAuthorableReactionContextFieldMetaByPath(response);
7030
+ addCollectionFieldMetaAliases(fieldMetaByPath, collection, ["collection", "record", "formValues"]);
7031
+ addCollectionFieldMetaAliases(fieldMetaByPath, collection, ["item"], {
7032
+ preserveExisting: true,
7033
+ reservedKeys: /* @__PURE__ */ new Set(["index", "length", "value", "parentItem"])
7034
+ });
7035
+ if (userCollection) {
7036
+ addCollectionFieldMetaAliases(fieldMetaByPath, userCollection, ["user"]);
7037
+ }
7038
+ return fieldMetaByPath;
7039
+ }
7040
+ function collectAuthorableReactionContextFieldMetaByPath(context) {
7041
+ const fieldMetaByPath = {};
7042
+ const visit = (prefix, info) => {
7043
+ if (!prefix || !info) {
7044
+ return;
7045
+ }
7046
+ if (isAuthorableReactionContextPath(prefix)) {
7047
+ fieldMetaByPath[prefix] = {
7048
+ ...info.type ? { type: info.type } : {},
7049
+ ...info.interface ? { interface: info.interface } : {}
7050
+ };
7051
+ }
7052
+ if (info.dynamicProperties) {
7053
+ visit(`${prefix}.*`, info.dynamicProperties);
7054
+ }
7055
+ Object.entries(info.properties || {}).forEach(([key, child]) => visit(`${prefix}.${key}`, child));
7056
+ };
7057
+ Object.entries((context == null ? void 0 : context.vars) || {}).forEach(([key, info]) => visit(key, info));
7058
+ return fieldMetaByPath;
7059
+ }
7060
+ function isAuthorableReactionContextPath(path) {
7061
+ const segments = String(path || "").split(".").filter(Boolean);
7062
+ const root = segments[0];
7063
+ if (!root) {
7064
+ return false;
7065
+ }
7066
+ if (AUTHORABLE_REACTION_SCALAR_CONTEXT_PATHS.has(root)) {
7067
+ return segments.length === 1;
7068
+ }
7069
+ return AUTHORABLE_REACTION_CONTEXT_ROOTS.has(root);
7070
+ }
7071
+ function addCollectionFieldMetaAliases(fieldMetaByPath, collection, roots, options = {}) {
7072
+ var _a;
7073
+ for (const field of (0, import_service_helpers.getCollectionFields)(collection)) {
7074
+ const fieldName = (0, import_service_helpers.getFieldName)(field);
7075
+ if (!fieldName) {
7076
+ continue;
7077
+ }
7078
+ const fieldMeta = {
7079
+ ...(0, import_service_helpers.getFieldType)(field) ? { type: (0, import_service_helpers.getFieldType)(field) } : {},
7080
+ ...(0, import_service_helpers.getFieldInterface)(field) ? { interface: (0, import_service_helpers.getFieldInterface)(field) } : {}
7081
+ };
7082
+ for (const root of roots) {
7083
+ if ((_a = options.reservedKeys) == null ? void 0 : _a.has(fieldName)) {
7084
+ continue;
7085
+ }
7086
+ const aliasPath = `${root}.${fieldName}`;
7087
+ if (options.preserveExisting && fieldMetaByPath[aliasPath]) {
7088
+ continue;
7089
+ }
7090
+ fieldMetaByPath[aliasPath] = {
7091
+ ...fieldMetaByPath[aliasPath],
7092
+ ...fieldMeta
7093
+ };
7094
+ }
7095
+ }
7096
+ }
7097
+ function resolveReactionConditionFieldContext(path, block, context, fieldMetaByPath) {
7098
+ const normalized = String(path || "").trim();
7099
+ const contextMeta = resolveReactionConditionFieldMeta(normalized, fieldMetaByPath);
7100
+ if (contextMeta) {
7101
+ return {
7102
+ fieldPath: normalized,
7103
+ fieldMeta: contextMeta
7104
+ };
7105
+ }
7106
+ const fieldPath = resolveReactionConditionFieldPath(normalized);
7107
+ return fieldPath ? resolveDefaultFilterDateConditionField(fieldPath, block, context) || void 0 : void 0;
7108
+ }
7109
+ function resolveReactionConditionFieldMeta(path, fieldMetaByPath) {
7110
+ if (fieldMetaByPath[path]) {
7111
+ return fieldMetaByPath[path];
7112
+ }
7113
+ const wildcardPath = Object.keys(fieldMetaByPath).filter((candidate) => candidate.endsWith(".*")).sort((a, b) => b.length - a.length).find((candidate) => {
7114
+ const prefix = candidate.slice(0, -2);
7115
+ return path.startsWith(`${prefix}.`) && path.length > prefix.length + 1;
7116
+ });
7117
+ return wildcardPath ? fieldMetaByPath[wildcardPath] : void 0;
7118
+ }
7119
+ function resolveReactionConditionFieldPath(path) {
7120
+ const normalized = String(path || "").trim();
7121
+ const prefixes = ["formValues.", "record.", "item.value.", "item.", "popup.record.", "collection.", "user."];
7122
+ const prefix = prefixes.find((candidate) => normalized.startsWith(candidate));
7123
+ return prefix ? normalized.slice(prefix.length) : "";
7124
+ }
6539
7125
  function collectFieldListErrors(fields, path, errors, localKeys, context, block) {
6540
7126
  if (!Array.isArray(fields)) {
6541
7127
  return;