@nocobase/plugin-flow-engine 2.2.0-beta.2 → 2.2.0-beta.5

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 (50) hide show
  1. package/dist/externalVersion.js +9 -9
  2. package/dist/node_modules/@ant-design/icons-svg/package.json +1 -1
  3. package/dist/node_modules/acorn/package.json +1 -1
  4. package/dist/node_modules/acorn-jsx/package.json +1 -1
  5. package/dist/node_modules/acorn-walk/package.json +1 -1
  6. package/dist/node_modules/ses/package.json +1 -1
  7. package/dist/node_modules/zod/package.json +1 -1
  8. package/dist/server/flow-surfaces/approval/authoring-validation.d.ts +9 -0
  9. package/dist/server/flow-surfaces/approval/authoring-validation.js +1151 -0
  10. package/dist/server/flow-surfaces/approval/blueprint-service.js +2 -0
  11. package/dist/server/flow-surfaces/authoring-validation.js +429 -32
  12. package/dist/server/flow-surfaces/blueprint/export-document.d.ts +50 -0
  13. package/dist/server/flow-surfaces/blueprint/export-document.js +2505 -0
  14. package/dist/server/flow-surfaces/builder.js +16 -1
  15. package/dist/server/flow-surfaces/catalog.js +3 -1
  16. package/dist/server/flow-surfaces/configure-options.js +4 -3
  17. package/dist/server/flow-surfaces/constants.d.ts +9 -2
  18. package/dist/server/flow-surfaces/constants.js +1 -0
  19. package/dist/server/flow-surfaces/contract-guard.js +24 -2
  20. package/dist/server/flow-surfaces/default-action-popup.d.ts +2 -0
  21. package/dist/server/flow-surfaces/default-action-popup.js +27 -13
  22. package/dist/server/flow-surfaces/filter-group.d.ts +19 -2
  23. package/dist/server/flow-surfaces/filter-group.js +232 -3
  24. package/dist/server/flow-surfaces/planning/compiler.d.ts +1 -0
  25. package/dist/server/flow-surfaces/planning/compiler.js +205 -82
  26. package/dist/server/flow-surfaces/planning/runtime.js +1 -0
  27. package/dist/server/flow-surfaces/planning/step-link.d.ts +1 -1
  28. package/dist/server/flow-surfaces/planning/step-link.js +22 -3
  29. package/dist/server/flow-surfaces/public-data-surface-default-filter.js +0 -9
  30. package/dist/server/flow-surfaces/reaction/field-value.d.ts +9 -0
  31. package/dist/server/flow-surfaces/reaction/field-value.js +51 -2
  32. package/dist/server/flow-surfaces/reaction/linkage.d.ts +6 -1
  33. package/dist/server/flow-surfaces/reaction/linkage.js +18 -3
  34. package/dist/server/flow-surfaces/reaction/meta.js +19 -1
  35. package/dist/server/flow-surfaces/reaction/types.d.ts +19 -0
  36. package/dist/server/flow-surfaces/relation-backing-foreign-key.d.ts +10 -0
  37. package/dist/server/flow-surfaces/relation-backing-foreign-key.js +79 -0
  38. package/dist/server/flow-surfaces/runjs-authoring/ast/source.d.ts +1 -0
  39. package/dist/server/flow-surfaces/runjs-authoring/ast/source.js +20 -0
  40. package/dist/server/flow-surfaces/runjs-authoring/scan/filter.js +12 -2
  41. package/dist/server/flow-surfaces/runjs-authoring/scan/index.js +9 -1
  42. package/dist/server/flow-surfaces/service.d.ts +24 -0
  43. package/dist/server/flow-surfaces/service.js +308 -27
  44. package/dist/server/variables/registry.js +3 -0
  45. package/dist/swagger/flow-surfaces.d.ts +180 -0
  46. package/dist/swagger/flow-surfaces.examples.d.ts +8 -0
  47. package/dist/swagger/flow-surfaces.examples.js +8 -0
  48. package/dist/swagger/flow-surfaces.js +160 -4
  49. package/dist/swagger/index.d.ts +180 -0
  50. package/package.json +2 -2
@@ -731,10 +731,19 @@ function buildActionTree(options) {
731
731
  containerUse: options.containerUse,
732
732
  resourceInit: options.resourceInit
733
733
  });
734
+ const requestedProps = options.props;
735
+ const requestedButtonGeneral = import_lodash.default.get(options.stepParams, ["buttonSettings", "general"]);
736
+ const stripImplicitTitle = shouldStripImplicitIconOnlyActionTitle(requestedProps, requestedButtonGeneral);
734
737
  const props = import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.props || {}), import_lodash.default.cloneDeep(options.props || {}));
738
+ if (stripImplicitTitle) {
739
+ delete props.title;
740
+ }
735
741
  const stepParams = import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.stepParams || {}), import_lodash.default.cloneDeep(options.stepParams || {}));
736
742
  if (import_lodash.default.isPlainObject((_a = stepParams == null ? void 0 : stepParams.buttonSettings) == null ? void 0 : _a.general)) {
737
743
  stepParams.buttonSettings.general = import_lodash.default.merge({}, stepParams.buttonSettings.general, pickButtonGeneralProps(props));
744
+ if (stripImplicitTitle) {
745
+ delete stepParams.buttonSettings.general.title;
746
+ }
738
747
  }
739
748
  return {
740
749
  use,
@@ -767,10 +776,15 @@ function buildCanonicalTableActionsColumnNode(options = {}) {
767
776
  }
768
777
  function pickButtonGeneralProps(props) {
769
778
  return import_lodash.default.pickBy(
770
- import_lodash.default.pick(props || {}, ["title", "tooltip", "icon", "type", "danger", "color"]),
779
+ import_lodash.default.pick(props || {}, ["title", "tooltip", "icon", "iconOnly", "type", "danger", "color"]),
771
780
  (value) => !import_lodash.default.isUndefined(value)
772
781
  );
773
782
  }
783
+ function shouldStripImplicitIconOnlyActionTitle(props, buttonGeneral) {
784
+ const hasRequestedOnlyIcon = import_lodash.default.isPlainObject(props) && Object.prototype.hasOwnProperty.call(props, "iconOnly") && props.iconOnly === true || import_lodash.default.isPlainObject(buttonGeneral) && Object.prototype.hasOwnProperty.call(buttonGeneral, "iconOnly") && buttonGeneral.iconOnly === true;
785
+ const hasRequestedTitle = import_lodash.default.isPlainObject(props) && Object.prototype.hasOwnProperty.call(props, "title") || import_lodash.default.isPlainObject(buttonGeneral) && Object.prototype.hasOwnProperty.call(buttonGeneral, "title");
786
+ return hasRequestedOnlyIcon && !hasRequestedTitle;
787
+ }
774
788
  function assignClientKeysToUids(spec, clientKeyToUid) {
775
789
  const next = import_lodash.default.cloneDeep(spec);
776
790
  const walk = (node) => {
@@ -997,6 +1011,7 @@ function inferActionDefaultProps(use, scope) {
997
1011
  title: "",
998
1012
  tooltip: '{{t("Delete")}}',
999
1013
  icon: "DeleteOutlined",
1014
+ iconOnly: true,
1000
1015
  position: "right"
1001
1016
  },
1002
1017
  BulkEditActionModel: {
@@ -182,7 +182,7 @@ const FILTER_FORM_ITEM_ALLOWED_PATHS = [
182
182
  "init.filterField.type",
183
183
  "initialValue.defaultValue"
184
184
  ];
185
- const ACTION_PROP_KEYS = ["title", "tooltip", "icon", "type", "htmlType", "position", "danger", "color"];
185
+ const ACTION_PROP_KEYS = ["title", "tooltip", "icon", "iconOnly", "type", "htmlType", "position", "danger", "color"];
186
186
  const FILTER_ACTION_PROP_KEYS = [...ACTION_PROP_KEYS, "filterableFieldNames", "defaultFilterValue", "filterValue"];
187
187
  const FILTER_ACTION_PROP_PATH_SCHEMAS = {
188
188
  filterableFieldNames: {
@@ -197,6 +197,7 @@ const ACTION_BUTTON_SETTINGS_GROUP = {
197
197
  "general.title",
198
198
  "general.tooltip",
199
199
  "general.icon",
200
+ "general.iconOnly",
200
201
  "general.type",
201
202
  "general.danger",
202
203
  "general.color",
@@ -208,6 +209,7 @@ const ACTION_BUTTON_SETTINGS_GROUP = {
208
209
  "general.title": STRING_SCHEMA,
209
210
  "general.tooltip": STRING_SCHEMA,
210
211
  "general.icon": NULLABLE_STRING_SCHEMA,
212
+ "general.iconOnly": BOOLEAN_SCHEMA,
211
213
  "general.type": STRING_SCHEMA,
212
214
  "general.danger": BOOLEAN_SCHEMA,
213
215
  "general.color": STRING_SCHEMA,
@@ -201,7 +201,7 @@ const DETAILS_OPTIONS = {
201
201
  sorting: SORTING,
202
202
  dataScope: FILTER_GROUP,
203
203
  linkageRules: arrayOption(
204
- "Raw linkage-rules payload. For AI/CLI authoring, prefer `getReactionMeta` + `setFieldLinkageRules` instead of guessing this configure key directly.",
204
+ "Raw canonical linkage-rules payload. The API normalizes condition-only rules to include `actions: []`; for AI/CLI authoring, prefer `getReactionMeta` + `setFieldLinkageRules` instead of guessing this configure key directly.",
205
205
  { example: [] }
206
206
  )
207
207
  };
@@ -237,7 +237,7 @@ const CALENDAR_OPTIONS = {
237
237
  weekStart: numberOption("Week start day. Use 1 for Monday or 0 for Sunday.", { example: 1 }),
238
238
  dataScope: FILTER_GROUP,
239
239
  linkageRules: arrayOption(
240
- "Raw linkage-rules payload. For AI/CLI authoring, prefer `getReactionMeta` + `setBlockLinkageRules` instead of guessing this configure key directly.",
240
+ "Raw canonical linkage-rules payload. The API normalizes condition-only rules to include `actions: []`; for AI/CLI authoring, prefer `getReactionMeta` + `setBlockLinkageRules` instead of guessing this configure key directly.",
241
241
  { example: [] }
242
242
  ),
243
243
  quickCreatePopup: OPEN_VIEW,
@@ -560,6 +560,7 @@ const ACTION_COMMON_OPTIONS = {
560
560
  title: stringOption("Button title", { example: "Run" }),
561
561
  tooltip: stringOption("Tooltip"),
562
562
  icon: stringOption("Icon", { example: "PlusOutlined" }),
563
+ iconOnly: booleanOption("Whether to render only the icon without visible button text", { example: true }),
563
564
  type: stringOption("Button type", { example: "primary" }),
564
565
  color: stringOption("Color"),
565
566
  htmlType: stringOption("HTML button type", { example: "submit" }),
@@ -588,7 +589,7 @@ const APPROVAL_ASSIGN_ACTION_OPTIONS = {
588
589
  };
589
590
  const ACTION_LINKAGE_OPTIONS = {
590
591
  linkageRules: arrayOption(
591
- "Raw linkage-rules payload. For AI/CLI authoring, prefer `getReactionMeta` + `setActionLinkageRules` instead of guessing this configure key directly.",
592
+ "Raw canonical linkage-rules payload. The API normalizes condition-only rules to include `actions: []`; for AI/CLI authoring, prefer `getReactionMeta` + `setActionLinkageRules` instead of guessing this configure key directly.",
592
593
  { example: [] }
593
594
  )
594
595
  };
@@ -45,6 +45,13 @@ export declare const FLOW_SURFACE_ACTION_DEFINITIONS: {
45
45
  readonly mutate: false;
46
46
  readonly valueSource: "default";
47
47
  };
48
+ readonly exportBlueprint: {
49
+ readonly method: "post";
50
+ readonly read: true;
51
+ readonly transaction: false;
52
+ readonly mutate: false;
53
+ readonly valueSource: "default";
54
+ };
48
55
  readonly getReactionMeta: {
49
56
  readonly method: "post";
50
57
  readonly read: true;
@@ -373,7 +380,7 @@ type SelectFlowSurfaceActionNames<TFlag extends keyof FlowSurfaceActionDefinitio
373
380
  [K in FlowSurfacesActionName]: (typeof FLOW_SURFACE_ACTION_DEFINITIONS)[K][TFlag] extends true ? K : never;
374
381
  }[FlowSurfacesActionName];
375
382
  type FlowSurfaceMutateActionName = SelectFlowSurfaceActionNames<'mutate'>;
376
- export declare const FLOW_SURFACES_ACTION_NAMES: ("setFieldValueRules" | "setBlockLinkageRules" | "setFieldLinkageRules" | "setActionLinkageRules" | "context" | "get" | "configure" | "createPage" | "addTab" | "addPopupTab" | "addBlock" | "addField" | "addAction" | "addRecordAction" | "compose" | "createMenu" | "catalog" | "describeSurface" | "getReactionMeta" | "applyBlueprint" | "applyApprovalBlueprint" | "listTemplates" | "getTemplate" | "saveTemplate" | "updateTemplate" | "destroyTemplate" | "convertTemplateToCopy" | "updateMenu" | "destroyPage" | "updateTab" | "moveTab" | "removeTab" | "updatePopupTab" | "movePopupTab" | "removePopupTab" | "addBlocks" | "addFields" | "addActions" | "addRecordActions" | "updateSettings" | "getEventFlowMeta" | "addEventFlow" | "setEventFlow" | "removeEventFlow" | "setEventFlows" | "setLayout" | "moveNode" | "removeNode" | "mutate" | "apply")[];
383
+ export declare const FLOW_SURFACES_ACTION_NAMES: ("setFieldValueRules" | "setBlockLinkageRules" | "setFieldLinkageRules" | "setActionLinkageRules" | "context" | "get" | "configure" | "createPage" | "addTab" | "addPopupTab" | "addBlock" | "addField" | "addAction" | "addRecordAction" | "compose" | "createMenu" | "catalog" | "describeSurface" | "exportBlueprint" | "getReactionMeta" | "applyBlueprint" | "applyApprovalBlueprint" | "listTemplates" | "getTemplate" | "saveTemplate" | "updateTemplate" | "destroyTemplate" | "convertTemplateToCopy" | "updateMenu" | "destroyPage" | "updateTab" | "moveTab" | "removeTab" | "updatePopupTab" | "movePopupTab" | "removePopupTab" | "addBlocks" | "addFields" | "addActions" | "addRecordActions" | "updateSettings" | "getEventFlowMeta" | "addEventFlow" | "setEventFlow" | "removeEventFlow" | "setEventFlows" | "setLayout" | "moveNode" | "removeNode" | "mutate" | "apply")[];
377
384
  export declare const FLOW_SURFACES_READ_ACTION_NAMES: SelectFlowSurfaceActionNames<"read">[];
378
385
  export declare const FLOW_SURFACE_MUTATE_OP_TYPES: FlowSurfaceMutateActionName[];
379
- export declare const FLOW_SURFACES_ACTION_METHODS: Record<"setFieldValueRules" | "setBlockLinkageRules" | "setFieldLinkageRules" | "setActionLinkageRules" | "context" | "get" | "configure" | "createPage" | "addTab" | "addPopupTab" | "addBlock" | "addField" | "addAction" | "addRecordAction" | "compose" | "createMenu" | "catalog" | "describeSurface" | "getReactionMeta" | "applyBlueprint" | "applyApprovalBlueprint" | "listTemplates" | "getTemplate" | "saveTemplate" | "updateTemplate" | "destroyTemplate" | "convertTemplateToCopy" | "updateMenu" | "destroyPage" | "updateTab" | "moveTab" | "removeTab" | "updatePopupTab" | "movePopupTab" | "removePopupTab" | "addBlocks" | "addFields" | "addActions" | "addRecordActions" | "updateSettings" | "getEventFlowMeta" | "addEventFlow" | "setEventFlow" | "removeEventFlow" | "setEventFlows" | "setLayout" | "moveNode" | "removeNode" | "mutate" | "apply", FlowSurfaceActionMethod>;
386
+ export declare const FLOW_SURFACES_ACTION_METHODS: Record<"setFieldValueRules" | "setBlockLinkageRules" | "setFieldLinkageRules" | "setActionLinkageRules" | "context" | "get" | "configure" | "createPage" | "addTab" | "addPopupTab" | "addBlock" | "addField" | "addAction" | "addRecordAction" | "compose" | "createMenu" | "catalog" | "describeSurface" | "exportBlueprint" | "getReactionMeta" | "applyBlueprint" | "applyApprovalBlueprint" | "listTemplates" | "getTemplate" | "saveTemplate" | "updateTemplate" | "destroyTemplate" | "convertTemplateToCopy" | "updateMenu" | "destroyPage" | "updateTab" | "moveTab" | "removeTab" | "updatePopupTab" | "movePopupTab" | "removePopupTab" | "addBlocks" | "addFields" | "addActions" | "addRecordActions" | "updateSettings" | "getEventFlowMeta" | "addEventFlow" | "setEventFlow" | "removeEventFlow" | "setEventFlows" | "setLayout" | "moveNode" | "removeNode" | "mutate" | "apply", FlowSurfaceActionMethod>;
@@ -40,6 +40,7 @@ const FLOW_SURFACE_ACTION_DEFINITIONS = {
40
40
  context: { method: "post", read: true, transaction: false, mutate: false, valueSource: "default" },
41
41
  get: { method: "get", read: true, transaction: false, mutate: false, valueSource: "read" },
42
42
  describeSurface: { method: "post", read: true, transaction: false, mutate: false, valueSource: "default" },
43
+ exportBlueprint: { method: "post", read: true, transaction: false, mutate: false, valueSource: "default" },
43
44
  getReactionMeta: { method: "post", read: true, transaction: false, mutate: false, valueSource: "default" },
44
45
  setFieldValueRules: { method: "post", read: false, transaction: true, mutate: false, valueSource: "default" },
45
46
  setBlockLinkageRules: { method: "post", read: false, transaction: true, mutate: false, valueSource: "default" },
@@ -397,19 +397,41 @@ function normalizeLinkageRulesValue(value, context, path) {
397
397
  return rule;
398
398
  }
399
399
  const normalizedRule = import_lodash.default.cloneDeep(rule);
400
- const domainPath = context.groupKey ? `${context.domain}.${context.groupKey}.${path}[${index}].condition` : `${context.domain}.${path}[${index}].condition`;
400
+ const conditionPath = getLinkageRuleDomainPath(context, path, index, "condition");
401
401
  import_lodash.default.set(
402
402
  normalizedRule,
403
403
  "condition",
404
404
  (0, import_filter_group.normalizeFlowSurfaceCompatibleFilterGroupValue)(
405
405
  import_lodash.default.get(normalizedRule, "condition"),
406
- `flowSurfaces updateSettings domain '${domainPath}' on '${context.use}' expects FilterGroup or backend query filter like ${import_filter_group.FLOW_SURFACE_FILTER_GROUP_EXAMPLE}`,
406
+ `flowSurfaces updateSettings domain '${conditionPath}' on '${context.use}' expects FilterGroup or backend query filter like ${import_filter_group.FLOW_SURFACE_FILTER_GROUP_EXAMPLE}`,
407
407
  { strictDateValues: true }
408
408
  )
409
409
  );
410
+ if (!import_lodash.default.has(normalizedRule, "actions")) {
411
+ import_lodash.default.set(normalizedRule, "actions", []);
412
+ } else if (!Array.isArray(import_lodash.default.get(normalizedRule, "actions"))) {
413
+ (0, import_errors.throwBadRequest)(
414
+ `flowSurfaces updateSettings domain '${getLinkageRuleDomainPath(context, path, index, "actions")}' on '${context.use}' expects actions to be an array`
415
+ );
416
+ }
417
+ if (!import_lodash.default.has(normalizedRule, "key")) {
418
+ import_lodash.default.set(normalizedRule, "key", `linkage-rule-${index + 1}`);
419
+ }
420
+ if (!import_lodash.default.has(normalizedRule, "title")) {
421
+ import_lodash.default.set(normalizedRule, "title", `Linkage rule ${index + 1}`);
422
+ }
423
+ if (!import_lodash.default.has(normalizedRule, "enable")) {
424
+ const enabled = import_lodash.default.get(normalizedRule, "enabled");
425
+ import_lodash.default.set(normalizedRule, "enable", typeof enabled === "boolean" ? enabled : true);
426
+ }
427
+ import_lodash.default.unset(normalizedRule, "enabled");
410
428
  return normalizedRule;
411
429
  });
412
430
  }
431
+ function getLinkageRuleDomainPath(context, path, index, leaf) {
432
+ const basePath = context.groupKey ? `${context.domain}.${context.groupKey}.${path}[${index}]` : `${context.domain}.${path}[${index}]`;
433
+ return `${basePath}.${leaf}`;
434
+ }
413
435
  function isContractDefinedFlowGroup(groupContract) {
414
436
  if (!groupContract) {
415
437
  return false;
@@ -47,6 +47,7 @@ export type FlowSurfaceDefaultActionPopupFieldGroupCandidate = {
47
47
  type FlowSurfaceDefaultActionPopupFieldFilterOptions = {
48
48
  excludeAuditTimestampFields?: boolean;
49
49
  excludeAssociationFields?: boolean;
50
+ excludeRelationBackingForeignKeyFields?: boolean;
50
51
  };
51
52
  type FlowSurfaceDefaultActionPopupFieldsInput = any[] | {
52
53
  fieldPaths?: any[];
@@ -60,6 +61,7 @@ export declare function getFlowSurfaceDefaultActionPopupConfigByUse(use?: string
60
61
  export declare function resolveFlowSurfaceDefaultActionPopupTabTitle(use?: string, currentTitle?: string | null): string;
61
62
  export declare function isFlowSurfaceDefaultActionPopupBusinessField(field: any): boolean;
62
63
  export declare function pickFlowSurfaceDefaultActionPopupFieldPaths(candidates: FlowSurfaceDefaultActionPopupFieldCandidate[], options?: FlowSurfaceDefaultActionPopupFieldFilterOptions): string[];
64
+ export declare function collectFlowSurfaceDefaultActionPopupFieldGroupFieldPaths(fieldGroups: FlowSurfaceDefaultActionPopupFieldGroupCandidate[] | undefined): Set<string>;
63
65
  export declare function pickFlowSurfaceDefaultActionPopupFieldGroups(candidates: FlowSurfaceDefaultActionPopupFieldCandidate[], fieldGroups: FlowSurfaceDefaultActionPopupFieldGroupCandidate[] | undefined, options?: FlowSurfaceDefaultActionPopupFieldFilterOptions): FlowSurfaceDefaultActionPopupFieldGroupCandidate[];
64
66
  export declare function buildFlowSurfaceDefaultActionPopupBlocks(use: string | undefined, fieldsInput: FlowSurfaceDefaultActionPopupFieldsInput): _.Dictionary<string | any[] | Record<string, any> | FlowSurfaceDefaultActionPopupFieldGroupCandidate[] | FlowSurfaceDefaultActionPopupSubmitAction[] | {
65
67
  binding: "currentCollection" | "currentRecord";
@@ -39,6 +39,7 @@ __export(default_action_popup_exports, {
39
39
  FLOW_SURFACE_DEFAULT_ACTION_POPUP_TYPES: () => FLOW_SURFACE_DEFAULT_ACTION_POPUP_TYPES,
40
40
  FLOW_SURFACE_DEFAULT_ACTION_POPUP_USES: () => FLOW_SURFACE_DEFAULT_ACTION_POPUP_USES,
41
41
  buildFlowSurfaceDefaultActionPopupBlocks: () => buildFlowSurfaceDefaultActionPopupBlocks,
42
+ collectFlowSurfaceDefaultActionPopupFieldGroupFieldPaths: () => collectFlowSurfaceDefaultActionPopupFieldGroupFieldPaths,
42
43
  getFlowSurfaceDefaultActionPopupConfigByUse: () => getFlowSurfaceDefaultActionPopupConfigByUse,
43
44
  hasFlowSurfaceInlinePopupBlocks: () => hasFlowSurfaceInlinePopupBlocks,
44
45
  hasFlowSurfaceInlinePopupTemplate: () => hasFlowSurfaceInlinePopupTemplate,
@@ -52,6 +53,7 @@ __export(default_action_popup_exports, {
52
53
  module.exports = __toCommonJS(default_action_popup_exports);
53
54
  var import_lodash = __toESM(require("lodash"));
54
55
  var import_association_interfaces = require("./association-interfaces");
56
+ var import_relation_backing_foreign_key = require("./relation-backing-foreign-key");
55
57
  var import_service_helpers = require("./service-helpers");
56
58
  const DEFAULT_ACTION_POPUP_SYSTEM_FIELD_NAMES = /* @__PURE__ */ new Set(["id", "createdBy", "createdById", "updatedBy", "updatedById"]);
57
59
  const DEFAULT_ACTION_POPUP_SYSTEM_FIELD_INTERFACES = /* @__PURE__ */ new Set([
@@ -214,13 +216,10 @@ function isFlowSurfaceDefaultActionPopupAssociationField(field) {
214
216
  const fieldType = String((0, import_service_helpers.getFieldType)(field) || "").trim();
215
217
  return fieldType === "belongsTo" || fieldType === "hasOne" || fieldType === "hasMany" || fieldType === "belongsToMany";
216
218
  }
217
- function collectFlowSurfaceDefaultActionPopupAssociationForeignKeys(candidates) {
218
- return new Set(
219
- candidates.map((candidate) => candidate == null ? void 0 : candidate.field).filter((field) => (0, import_service_helpers.getFieldType)(field) === "belongsTo").map((field) => {
220
- var _a;
221
- return String((field == null ? void 0 : field.foreignKey) || ((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.foreignKey) || "").trim();
222
- }).filter(Boolean)
223
- );
219
+ function collectFlowSurfaceDefaultActionPopupRelationBackingForeignKeys(candidates) {
220
+ return (0, import_relation_backing_foreign_key.collectRelationBackingForeignKeyNames)({
221
+ getFields: () => candidates.map((candidate) => candidate == null ? void 0 : candidate.field).filter(Boolean)
222
+ });
224
223
  }
225
224
  function isFlowSurfaceDefaultActionPopupAssociationForeignKeyField(field, associationForeignKeys) {
226
225
  const fieldName = String((0, import_service_helpers.getFieldName)(field) || "").trim();
@@ -229,13 +228,26 @@ function isFlowSurfaceDefaultActionPopupAssociationForeignKeyField(field, associ
229
228
  function pickFlowSurfaceDefaultActionPopupFieldPaths(candidates, options = {}) {
230
229
  return filterFlowSurfaceDefaultActionPopupFieldCandidates(candidates, options).map((candidate) => String((candidate == null ? void 0 : candidate.fieldPath) || "").trim()).filter(Boolean);
231
230
  }
231
+ function collectFlowSurfaceDefaultActionPopupFieldGroupFieldPaths(fieldGroups) {
232
+ const fieldPaths = /* @__PURE__ */ new Set();
233
+ import_lodash.default.castArray(fieldGroups || []).forEach((group) => {
234
+ import_lodash.default.castArray((group == null ? void 0 : group.fields) || []).forEach((field) => {
235
+ const fieldPath = getFlowSurfaceDefaultActionPopupFieldGroupFieldPath(field);
236
+ if (fieldPath) {
237
+ fieldPaths.add(fieldPath);
238
+ }
239
+ });
240
+ });
241
+ return fieldPaths;
242
+ }
232
243
  function filterFlowSurfaceDefaultActionPopupFieldCandidates(candidates, options = {}) {
233
- const associationForeignKeys = collectFlowSurfaceDefaultActionPopupAssociationForeignKeys(candidates);
244
+ const associationForeignKeys = collectFlowSurfaceDefaultActionPopupRelationBackingForeignKeys(candidates);
245
+ const excludeRelationBackingForeignKeyFields = options.excludeRelationBackingForeignKeyFields !== false;
234
246
  const preferredCandidates = candidates.filter(
235
- (candidate) => !isFlowSurfaceDefaultActionPopupSystemField(candidate.field) && (!options.excludeAuditTimestampFields || !isFlowSurfaceDefaultActionPopupAuditTimestampField(candidate.field)) && (!options.excludeAssociationFields || !isFlowSurfaceDefaultActionPopupAssociationField(candidate.field)) && !isFlowSurfaceDefaultActionPopupMultiValueAssociationField(candidate.field) && !isFlowSurfaceDefaultActionPopupAssociationForeignKeyField(candidate.field, associationForeignKeys)
247
+ (candidate) => !isFlowSurfaceDefaultActionPopupSystemField(candidate.field) && (!options.excludeAuditTimestampFields || !isFlowSurfaceDefaultActionPopupAuditTimestampField(candidate.field)) && (!options.excludeAssociationFields || !isFlowSurfaceDefaultActionPopupAssociationField(candidate.field)) && !isFlowSurfaceDefaultActionPopupMultiValueAssociationField(candidate.field) && (!excludeRelationBackingForeignKeyFields || !isFlowSurfaceDefaultActionPopupAssociationForeignKeyField(candidate.field, associationForeignKeys))
236
248
  );
237
249
  const fallbackCandidates = candidates.filter(
238
- (candidate) => !isFlowSurfaceDefaultActionPopupTechnicalIdField(candidate.field) && (!options.excludeAuditTimestampFields || !isFlowSurfaceDefaultActionPopupAuditTimestampField(candidate.field)) && (!options.excludeAssociationFields || !isFlowSurfaceDefaultActionPopupAssociationField(candidate.field)) && !isFlowSurfaceDefaultActionPopupMultiValueAssociationField(candidate.field) && !isFlowSurfaceDefaultActionPopupAssociationForeignKeyField(candidate.field, associationForeignKeys)
250
+ (candidate) => !isFlowSurfaceDefaultActionPopupTechnicalIdField(candidate.field) && (!options.excludeAuditTimestampFields || !isFlowSurfaceDefaultActionPopupAuditTimestampField(candidate.field)) && (!options.excludeAssociationFields || !isFlowSurfaceDefaultActionPopupAssociationField(candidate.field)) && !isFlowSurfaceDefaultActionPopupMultiValueAssociationField(candidate.field) && (!excludeRelationBackingForeignKeyFields || !isFlowSurfaceDefaultActionPopupAssociationForeignKeyField(candidate.field, associationForeignKeys))
239
251
  );
240
252
  const baseCandidates = preferredCandidates.length ? preferredCandidates : fallbackCandidates;
241
253
  return baseCandidates.filter((candidate) => String((candidate == null ? void 0 : candidate.fieldPath) || "").trim());
@@ -266,9 +278,10 @@ function normalizeFlowSurfaceDefaultActionPopupFieldGroupField(field, fieldPath)
266
278
  }
267
279
  function pickFlowSurfaceDefaultActionPopupFieldGroups(candidates, fieldGroups, options = {}) {
268
280
  const allowedFieldPaths = new Set(
269
- filterFlowSurfaceDefaultActionPopupFieldCandidates(candidates, options).map(
270
- (candidate) => String((candidate == null ? void 0 : candidate.fieldPath) || "").trim()
271
- )
281
+ filterFlowSurfaceDefaultActionPopupFieldCandidates(candidates, {
282
+ ...options,
283
+ excludeRelationBackingForeignKeyFields: false
284
+ }).map((candidate) => String((candidate == null ? void 0 : candidate.fieldPath) || "").trim())
272
285
  );
273
286
  const usedFieldPaths = /* @__PURE__ */ new Set();
274
287
  return import_lodash.default.castArray(fieldGroups || []).flatMap((group) => {
@@ -351,6 +364,7 @@ function hasFlowSurfaceInlinePopupBlocks(popup) {
351
364
  FLOW_SURFACE_DEFAULT_ACTION_POPUP_TYPES,
352
365
  FLOW_SURFACE_DEFAULT_ACTION_POPUP_USES,
353
366
  buildFlowSurfaceDefaultActionPopupBlocks,
367
+ collectFlowSurfaceDefaultActionPopupFieldGroupFieldPaths,
354
368
  getFlowSurfaceDefaultActionPopupConfigByUse,
355
369
  hasFlowSurfaceInlinePopupBlocks,
356
370
  hasFlowSurfaceInlinePopupTemplate,
@@ -11,13 +11,30 @@ export declare const FLOW_SURFACE_EMPTY_FILTER_GROUP: {
11
11
  items: any[];
12
12
  };
13
13
  export declare const FLOW_SURFACE_FILTER_GROUP_EXAMPLE: string;
14
+ export declare const FLOW_SURFACE_DATE_FILTER_OPERATORS: Set<string>;
14
15
  export declare function assertFlowSurfaceFilterOperator(operator: unknown, path: string): void;
15
- export declare function normalizeFlowSurfaceFilterDateValue(operator: unknown, value: unknown, path: string): unknown;
16
- export declare function normalizeFlowSurfaceStrictFilterDateValue(operator: unknown, value: unknown, path: string): unknown;
16
+ export declare function normalizeFlowSurfaceFilterDateValue(operator: unknown, value: unknown, path: string, options?: {
17
+ allowContextPathValue?: boolean;
18
+ }): unknown;
19
+ export declare function normalizeFlowSurfaceStrictFilterDateValue(operator: unknown, value: unknown, path: string, options?: {
20
+ allowContextPathValue?: boolean;
21
+ }): unknown;
22
+ export declare function isFlowSurfaceDateLikeFieldMeta(value: {
23
+ type?: unknown;
24
+ interface?: unknown;
25
+ } | undefined | null): boolean;
26
+ export declare function normalizeFlowSurfaceDateConditionValue(operator: unknown, value: unknown, path: string, options?: {
27
+ fieldPath?: string;
28
+ fieldType?: unknown;
29
+ fieldInterface?: unknown;
30
+ allowContextPathValue?: boolean;
31
+ }): unknown;
17
32
  export declare function normalizeFlowSurfaceFilterGroupValue(value: any, errorPrefix: string, options?: {
18
33
  strictDateValues?: boolean;
34
+ allowContextPathValue?: boolean;
19
35
  }): any;
20
36
  export declare function normalizeFlowSurfaceCompatibleFilterGroupValue(value: unknown, errorPrefix: string, options?: {
21
37
  strictDateValues?: boolean;
38
+ allowContextPathValue?: boolean;
22
39
  }): any;
23
40
  export declare function assertFlowSurfaceFilterGroupShape(filter: any): void;