@nocobase/plugin-flow-engine 2.1.0-beta.35 → 2.1.0-beta.37

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 (68) 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/LICENSE +21 -0
  4. package/dist/node_modules/acorn/bin/acorn +4 -0
  5. package/dist/node_modules/acorn/dist/acorn.d.mts +857 -0
  6. package/dist/node_modules/acorn/dist/acorn.d.ts +857 -0
  7. package/dist/node_modules/acorn/dist/acorn.js +1 -0
  8. package/dist/node_modules/acorn/dist/bin.js +90 -0
  9. package/dist/node_modules/acorn/package.json +1 -0
  10. package/dist/node_modules/acorn-jsx/LICENSE +19 -0
  11. package/dist/node_modules/acorn-jsx/index.d.ts +12 -0
  12. package/dist/node_modules/acorn-jsx/index.js +1 -0
  13. package/dist/node_modules/acorn-jsx/package.json +1 -0
  14. package/dist/node_modules/acorn-jsx/xhtml.js +255 -0
  15. package/dist/node_modules/acorn-walk/LICENSE +21 -0
  16. package/dist/node_modules/acorn-walk/dist/walk.d.mts +177 -0
  17. package/dist/node_modules/acorn-walk/dist/walk.d.ts +177 -0
  18. package/dist/node_modules/acorn-walk/dist/walk.js +1 -0
  19. package/dist/node_modules/acorn-walk/node_modules/acorn/bin/acorn +4 -0
  20. package/dist/node_modules/acorn-walk/node_modules/acorn/dist/acorn.d.mts +866 -0
  21. package/dist/node_modules/acorn-walk/node_modules/acorn/dist/acorn.d.ts +866 -0
  22. package/dist/node_modules/acorn-walk/node_modules/acorn/dist/acorn.js +6174 -0
  23. package/dist/node_modules/acorn-walk/node_modules/acorn/dist/bin.js +90 -0
  24. package/dist/node_modules/acorn-walk/node_modules/acorn/package.json +50 -0
  25. package/dist/node_modules/acorn-walk/package.json +1 -0
  26. package/dist/node_modules/ses/package.json +1 -1
  27. package/dist/node_modules/zod/package.json +1 -1
  28. package/dist/server/flow-surfaces/action-scope.d.ts +2 -0
  29. package/dist/server/flow-surfaces/action-scope.js +8 -0
  30. package/dist/server/flow-surfaces/authoring-validation.d.ts +3 -0
  31. package/dist/server/flow-surfaces/authoring-validation.js +317 -9
  32. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +143 -3
  33. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +1 -1
  34. package/dist/server/flow-surfaces/builder.js +54 -1
  35. package/dist/server/flow-surfaces/catalog.js +158 -2
  36. package/dist/server/flow-surfaces/chart-config.d.ts +58 -54
  37. package/dist/server/flow-surfaces/chart-config.js +18 -5
  38. package/dist/server/flow-surfaces/compose-compiler.d.ts +1 -1
  39. package/dist/server/flow-surfaces/compose-runtime.d.ts +1 -0
  40. package/dist/server/flow-surfaces/compose-runtime.js +24 -6
  41. package/dist/server/flow-surfaces/configure-options.js +40 -1
  42. package/dist/server/flow-surfaces/default-block-actions.js +11 -0
  43. package/dist/server/flow-surfaces/index.js +4 -2
  44. package/dist/server/flow-surfaces/node-use-sets.js +2 -0
  45. package/dist/server/flow-surfaces/runjs-authoring/ctx-libs-member-mismatch-stop/index.js +1 -1
  46. package/dist/server/flow-surfaces/runjs-authoring/index.d.ts +14 -2
  47. package/dist/server/flow-surfaces/runjs-authoring/index.js +4633 -252
  48. package/dist/server/flow-surfaces/runjs-authoring/nested-runjs-stop/index.d.ts +10 -0
  49. package/dist/server/flow-surfaces/runjs-authoring/nested-runjs-stop/index.js +40 -0
  50. package/dist/server/flow-surfaces/runjs-authoring/rules.js +6 -0
  51. package/dist/server/flow-surfaces/runjs-authoring/source-limit-stop/index.d.ts +10 -0
  52. package/dist/server/flow-surfaces/runjs-authoring/source-limit-stop/index.js +40 -0
  53. package/dist/server/flow-surfaces/runjs-authoring/syntax-stop/index.d.ts +10 -0
  54. package/dist/server/flow-surfaces/runjs-authoring/syntax-stop/index.js +40 -0
  55. package/dist/server/flow-surfaces/runjs-authoring/types.d.ts +1 -1
  56. package/dist/server/flow-surfaces/service-utils.d.ts +1 -1
  57. package/dist/server/flow-surfaces/service-utils.js +3 -0
  58. package/dist/server/flow-surfaces/service.d.ts +106 -17
  59. package/dist/server/flow-surfaces/service.js +1760 -131
  60. package/dist/server/flow-surfaces/support-matrix.d.ts +1 -1
  61. package/dist/server/flow-surfaces/support-matrix.js +13 -1
  62. package/dist/server/flow-surfaces/surface-context.js +4 -13
  63. package/dist/swagger/flow-surfaces.d.ts +148 -0
  64. package/dist/swagger/flow-surfaces.examples.d.ts +179 -1
  65. package/dist/swagger/flow-surfaces.examples.js +75 -3
  66. package/dist/swagger/flow-surfaces.js +181 -7
  67. package/dist/swagger/index.d.ts +148 -0
  68. package/package.json +5 -2
@@ -157,6 +157,11 @@ const CALENDAR_READONLY_ACTION_MODEL_USES = /* @__PURE__ */ new Set([
157
157
  "CalendarTitleActionModel",
158
158
  "CalendarViewSelectActionModel"
159
159
  ]);
160
+ const AI_EMPLOYEE_ACTION_USE = "AIEmployeeButtonModel";
161
+ const AI_EMPLOYEE_DEFAULT_STYLE = {
162
+ size: 40,
163
+ mask: false
164
+ };
160
165
  function resolveModelStepParamsOrLegacyObject(model, path, legacyValue) {
161
166
  if (import_lodash.default.has(model.stepParams, path)) {
162
167
  const value = import_lodash.default.get(model.stepParams, path);
@@ -528,6 +533,15 @@ function buildBlockTree(options) {
528
533
  popupSettings: eventPopupSettings
529
534
  })
530
535
  };
536
+ } else if (use === "CommentsBlockModel") {
537
+ model.subModels = {
538
+ items: [
539
+ {
540
+ uid: (0, import_utils.uid)(),
541
+ use: "CommentItemModel"
542
+ }
543
+ ]
544
+ };
531
545
  }
532
546
  return assignClientKeysToUids(model, {});
533
547
  }
@@ -775,6 +789,14 @@ function assignClientKeysToUids(spec, clientKeyToUid) {
775
789
  }
776
790
  function buildActionDefaults(options) {
777
791
  var _a, _b, _c;
792
+ if (options.use === AI_EMPLOYEE_ACTION_USE) {
793
+ return {
794
+ props: {
795
+ style: import_lodash.default.cloneDeep(AI_EMPLOYEE_DEFAULT_STYLE)
796
+ },
797
+ stepParams: {}
798
+ };
799
+ }
778
800
  const approvalDefaults = (0, import_approval.buildApprovalActionDefaults)(options.use);
779
801
  const readonlyCalendarAction = CALENDAR_READONLY_ACTION_MODEL_USES.has(options.use);
780
802
  const props = import_lodash.default.merge(
@@ -831,6 +853,15 @@ function buildActionDefaults(options) {
831
853
  }
832
854
  };
833
855
  }
856
+ if (options.use === "DeleteCommentActionModel") {
857
+ stepParams.deleteSettings = {
858
+ confirm: {
859
+ enable: true,
860
+ title: '{{t("Delete record")}}',
861
+ content: '{{t("Are you sure you want to delete it?")}}'
862
+ }
863
+ };
864
+ }
834
865
  if (options.use === "FormSubmitActionModel") {
835
866
  stepParams.submitSettings = {
836
867
  confirm: {
@@ -922,6 +953,18 @@ function inferActionDefaultProps(use, scope) {
922
953
  title: '{{t("Delete")}}',
923
954
  icon: "DeleteOutlined"
924
955
  },
956
+ EditCommentActionModel: {
957
+ type: "link",
958
+ title: '{{t("Edit")}}'
959
+ },
960
+ DeleteCommentActionModel: {
961
+ type: "link",
962
+ title: '{{t("Delete")}}'
963
+ },
964
+ QuoteReplyActionModel: {
965
+ type: "link",
966
+ title: '{{t("Quote reply", { ns: "comments" })}}'
967
+ },
925
968
  UpdateRecordActionModel: {
926
969
  type: "link",
927
970
  title: '{{t("Update record")}}',
@@ -939,6 +982,14 @@ function inferActionDefaultProps(use, scope) {
939
982
  title: '{{t("Refresh")}}',
940
983
  icon: "ReloadOutlined"
941
984
  },
985
+ RecordHistoryExpandActionModel: {
986
+ title: '{{t("Expand all")}}',
987
+ icon: "NodeExpandOutlined"
988
+ },
989
+ RecordHistoryCollapseActionModel: {
990
+ title: '{{t("Collapse all")}}',
991
+ icon: "NodeCollapseOutlined"
992
+ },
942
993
  ExpandCollapseActionModel: {
943
994
  icon: "DownOutlined"
944
995
  },
@@ -1070,7 +1121,9 @@ function inferActionDefaultProps(use, scope) {
1070
1121
  );
1071
1122
  }
1072
1123
  function applyContainerActionStyle(props, containerUse) {
1073
- if (["TableActionsColumnModel", "ListItemModel", "GridCardItemModel"].includes(String(containerUse || "").trim())) {
1124
+ if (["TableActionsColumnModel", "ListItemModel", "GridCardItemModel", "CommentItemModel"].includes(
1125
+ String(containerUse || "").trim()
1126
+ )) {
1074
1127
  return {
1075
1128
  ...props,
1076
1129
  type: "link",
@@ -123,6 +123,8 @@ const DEFAULT_DIRECT_EVENTS = ["beforeRender"];
123
123
  const ACTION_DIRECT_EVENTS = ["click", "beforeRender"];
124
124
  const ACTION_OBJECT_EVENTS = ["click"];
125
125
  const GRID_LAYOUT_CAPABILITIES = { supported: true };
126
+ const AI_EMPLOYEE_ACTION_USE = "AIEmployeeButtonModel";
127
+ const AI_EMPLOYEE_FLOW_SURFACE_OWNER_PLUGIN = "@nocobase/plugin-ai";
126
128
  const RUN_JS_ALLOWED_PATHS = ["runJs.code", "runJs.version"];
127
129
  const OPEN_VIEW_ALLOWED_PATHS = [
128
130
  "openView.mode",
@@ -1451,6 +1453,39 @@ COMMENTS_BLOCK_CONTRACT.domains.stepParams = groupedDomain({
1451
1453
  }
1452
1454
  }
1453
1455
  });
1456
+ const RECORD_HISTORY_BLOCK_CONTRACT = createContract({
1457
+ editableDomains: ["props", "stepParams", "flowRegistry"],
1458
+ props: [],
1459
+ stepParams: ["resourceSettings", "recordHistorySettings", "cardSettings"],
1460
+ flowRegistry: true,
1461
+ eventCapabilities: {
1462
+ direct: DEFAULT_DIRECT_EVENTS,
1463
+ object: ["click"]
1464
+ }
1465
+ });
1466
+ RECORD_HISTORY_BLOCK_CONTRACT.domains.stepParams = groupedDomain({
1467
+ resourceSettings: {
1468
+ allowedPaths: ["init.dataSourceKey", "init.collectionName"],
1469
+ eventBindingSteps: [],
1470
+ pathSchemas: {
1471
+ "init.dataSourceKey": STRING_SCHEMA,
1472
+ "init.collectionName": STRING_SCHEMA
1473
+ }
1474
+ },
1475
+ cardSettings: BLOCK_CARD_SETTINGS_GROUP,
1476
+ recordHistorySettings: {
1477
+ allowedPaths: ["sortOrder.order", "dataScope.filter", "expand.expand", "template.apply", "recordId.recordId"],
1478
+ clearable: true,
1479
+ eventBindingSteps: [],
1480
+ pathSchemas: {
1481
+ "sortOrder.order": STRING_SCHEMA,
1482
+ "dataScope.filter": FILTER_GROUP_SCHEMA,
1483
+ "expand.expand": BOOLEAN_SCHEMA,
1484
+ "template.apply": STRING_SCHEMA,
1485
+ "recordId.recordId": STRING_SCHEMA
1486
+ }
1487
+ }
1488
+ });
1454
1489
  const ACTION_COLUMN_CONTRACT = createContract({
1455
1490
  editableDomains: ["props", "stepParams", "flowRegistry"],
1456
1491
  props: ["title", "tooltip", "width", "fixed"],
@@ -2405,6 +2440,27 @@ JS_ITEM_ACTION_CONTRACT.domains.stepParams = groupedDomain({
2405
2440
  buttonSettings: ACTION_BUTTON_SETTINGS_GROUP,
2406
2441
  jsSettings: RUN_JS_SETTINGS_GROUP
2407
2442
  });
2443
+ const AI_EMPLOYEE_ACTION_CONTRACT = createContract({
2444
+ editableDomains: ["props", "stepParams"],
2445
+ props: ["aiEmployee", "context", "auto", "style"],
2446
+ stepParams: ["shortcutSettings"]
2447
+ });
2448
+ AI_EMPLOYEE_ACTION_CONTRACT.domains.props = keyedDomain(["aiEmployee", "context", "auto", "style"], "deep", {
2449
+ aiEmployee: OBJECT_SCHEMA,
2450
+ context: OBJECT_SCHEMA,
2451
+ auto: BOOLEAN_SCHEMA,
2452
+ style: OBJECT_SCHEMA
2453
+ });
2454
+ AI_EMPLOYEE_ACTION_CONTRACT.domains.stepParams = groupedDomain({
2455
+ shortcutSettings: {
2456
+ allowedPaths: ["editTasks.tasks"],
2457
+ mergeStrategy: "deep",
2458
+ eventBindingSteps: ["editTasks"],
2459
+ pathSchemas: {
2460
+ "editTasks.tasks": ARRAY_SCHEMA
2461
+ }
2462
+ }
2463
+ });
2408
2464
  const APPROVAL_FORM_BLOCK_CONTRACT = createContract({
2409
2465
  editableDomains: ["props", "decoratorProps", "stepParams", "flowRegistry"],
2410
2466
  props: ["labelWidth", "labelWrap"],
@@ -2528,6 +2584,11 @@ APPROVAL_ACTION_CONTRACT.domains.stepParams = groupedDomain({
2528
2584
  }
2529
2585
  }
2530
2586
  });
2587
+ const COMMENT_ITEM_CONTRACT = createContract({
2588
+ editableDomains: [],
2589
+ props: [],
2590
+ stepParams: []
2591
+ });
2531
2592
  const nodeContracts = /* @__PURE__ */ new Map();
2532
2593
  function registerNodeContract(use, contract) {
2533
2594
  nodeContracts.set(use, contract);
@@ -2571,6 +2632,8 @@ const NODE_CONTRACT_ENTRIES = [
2571
2632
  ["ActionPanelBlockModel", ACTION_PANEL_BLOCK_CONTRACT],
2572
2633
  ["MapBlockModel", MAP_BLOCK_CONTRACT],
2573
2634
  ["CommentsBlockModel", COMMENTS_BLOCK_CONTRACT],
2635
+ ["CommentItemModel", COMMENT_ITEM_CONTRACT],
2636
+ ["RecordHistoryBlockModel", RECORD_HISTORY_BLOCK_CONTRACT],
2574
2637
  ["TableActionsColumnModel", ACTION_COLUMN_CONTRACT],
2575
2638
  ["FormItemModel", FORM_ITEM_CONTRACT],
2576
2639
  ["FormAssociationItemModel", DETAILS_ITEM_CONTRACT],
@@ -2599,6 +2662,11 @@ const NODE_CONTRACT_ENTRIES = [
2599
2662
  ["KanbanCardViewActionModel", KANBAN_POPUP_ACTION_CONTRACT],
2600
2663
  ["AddChildActionModel", POPUP_ACTION_CONTRACT],
2601
2664
  ["DeleteActionModel", DELETE_ACTION_CONTRACT],
2665
+ ["EditCommentActionModel", SIMPLE_ACTION_CONTRACT],
2666
+ ["DeleteCommentActionModel", DELETE_ACTION_CONTRACT],
2667
+ ["QuoteReplyActionModel", SIMPLE_ACTION_CONTRACT],
2668
+ ["RecordHistoryExpandActionModel", SIMPLE_ACTION_CONTRACT],
2669
+ ["RecordHistoryCollapseActionModel", SIMPLE_ACTION_CONTRACT],
2602
2670
  ["BulkDeleteActionModel", DELETE_ACTION_CONTRACT],
2603
2671
  ["UpdateRecordActionModel", UPDATE_RECORD_ACTION_CONTRACT],
2604
2672
  ["BulkEditActionModel", BULK_EDIT_ACTION_CONTRACT],
@@ -2633,6 +2701,7 @@ const NODE_CONTRACT_ENTRIES = [
2633
2701
  ["FilterFormJSActionModel", JS_ACTION_CONTRACT],
2634
2702
  ["JSItemActionModel", JS_ITEM_ACTION_CONTRACT],
2635
2703
  ["JSActionModel", JS_ACTION_CONTRACT],
2704
+ [AI_EMPLOYEE_ACTION_USE, AI_EMPLOYEE_ACTION_CONTRACT],
2636
2705
  ["ApplyFormSubmitModel", APPROVAL_ACTION_CONTRACT],
2637
2706
  ["ApplyFormSaveDraftModel", APPROVAL_ACTION_CONTRACT],
2638
2707
  ["ApplyFormWithdrawModel", APPROVAL_ACTION_CONTRACT],
@@ -3046,6 +3115,7 @@ const COLLECTION_RESOURCE_REQUIRED = /* @__PURE__ */ new Set([
3046
3115
  "GridCardBlockModel",
3047
3116
  "MapBlockModel",
3048
3117
  "CommentsBlockModel",
3118
+ "RecordHistoryBlockModel",
3049
3119
  ...import_approval.APPROVAL_FORM_BLOCK_USES,
3050
3120
  ...import_approval.APPROVAL_DETAILS_BLOCK_USES
3051
3121
  ]);
@@ -3118,7 +3188,10 @@ const actionRegistry = [
3118
3188
  scene: "collection",
3119
3189
  use: "FilterActionModel",
3120
3190
  ownerPlugin: CORE_FLOW_SURFACE_OWNER_PLUGIN,
3121
- allowedContainerUses: COLLECTION_BLOCK_AND_KANBAN_ACTION_CONTAINER_USES,
3191
+ allowedContainerUses: [
3192
+ ...COLLECTION_BLOCK_AND_KANBAN_ACTION_CONTAINER_USES,
3193
+ ...import_action_scope.RECORD_HISTORY_BLOCK_ACTION_CONTAINER_USES
3194
+ ],
3122
3195
  createSupported: true
3123
3196
  },
3124
3197
  {
@@ -3148,7 +3221,30 @@ const actionRegistry = [
3148
3221
  scene: "collection",
3149
3222
  use: "RefreshActionModel",
3150
3223
  ownerPlugin: CORE_FLOW_SURFACE_OWNER_PLUGIN,
3151
- allowedContainerUses: COLLECTION_BLOCK_AND_KANBAN_ACTION_CONTAINER_USES,
3224
+ allowedContainerUses: [
3225
+ ...COLLECTION_BLOCK_AND_KANBAN_ACTION_CONTAINER_USES,
3226
+ ...import_action_scope.RECORD_HISTORY_BLOCK_ACTION_CONTAINER_USES
3227
+ ],
3228
+ createSupported: true
3229
+ },
3230
+ {
3231
+ publicKey: "expandAll",
3232
+ label: "Expand all",
3233
+ scope: "block",
3234
+ scene: "collection",
3235
+ use: "RecordHistoryExpandActionModel",
3236
+ ownerPlugin: "@nocobase/plugin-record-history",
3237
+ allowedContainerUses: import_action_scope.RECORD_HISTORY_BLOCK_ACTION_CONTAINER_USES,
3238
+ createSupported: true
3239
+ },
3240
+ {
3241
+ publicKey: "collapseAll",
3242
+ label: "Collapse all",
3243
+ scope: "block",
3244
+ scene: "collection",
3245
+ use: "RecordHistoryCollapseActionModel",
3246
+ ownerPlugin: "@nocobase/plugin-record-history",
3247
+ allowedContainerUses: import_action_scope.RECORD_HISTORY_BLOCK_ACTION_CONTAINER_USES,
3152
3248
  createSupported: true
3153
3249
  },
3154
3250
  {
@@ -3331,6 +3427,16 @@ const actionRegistry = [
3331
3427
  allowedContainerUses: import_action_scope.COLLECTION_BLOCK_ACTION_CONTAINER_USES,
3332
3428
  createSupported: true
3333
3429
  },
3430
+ {
3431
+ publicKey: "aiEmployee",
3432
+ label: "AI employee",
3433
+ scope: "block",
3434
+ scene: "collection",
3435
+ use: AI_EMPLOYEE_ACTION_USE,
3436
+ ownerPlugin: AI_EMPLOYEE_FLOW_SURFACE_OWNER_PLUGIN,
3437
+ allowedContainerUses: COLLECTION_BLOCK_AND_KANBAN_ACTION_CONTAINER_USES,
3438
+ createSupported: true
3439
+ },
3334
3440
  {
3335
3441
  publicKey: "duplicate",
3336
3442
  label: "Duplicate",
@@ -3401,6 +3507,36 @@ const actionRegistry = [
3401
3507
  allowedContainerUses: import_action_scope.RECORD_ACTION_CONTAINER_USES,
3402
3508
  createSupported: true
3403
3509
  },
3510
+ {
3511
+ publicKey: "edit",
3512
+ label: "Edit",
3513
+ scope: "record",
3514
+ scene: "record",
3515
+ use: "EditCommentActionModel",
3516
+ ownerPlugin: "@nocobase/plugin-comments",
3517
+ allowedContainerUses: import_action_scope.COMMENT_RECORD_ACTION_CONTAINER_USES,
3518
+ createSupported: true
3519
+ },
3520
+ {
3521
+ publicKey: "delete",
3522
+ label: "Delete",
3523
+ scope: "record",
3524
+ scene: "record",
3525
+ use: "DeleteCommentActionModel",
3526
+ ownerPlugin: "@nocobase/plugin-comments",
3527
+ allowedContainerUses: import_action_scope.COMMENT_RECORD_ACTION_CONTAINER_USES,
3528
+ createSupported: true
3529
+ },
3530
+ {
3531
+ publicKey: "quoteReply",
3532
+ label: "Quote reply",
3533
+ scope: "record",
3534
+ scene: "record",
3535
+ use: "QuoteReplyActionModel",
3536
+ ownerPlugin: "@nocobase/plugin-comments",
3537
+ allowedContainerUses: import_action_scope.COMMENT_RECORD_ACTION_CONTAINER_USES,
3538
+ createSupported: true
3539
+ },
3404
3540
  {
3405
3541
  publicKey: "updateRecord",
3406
3542
  label: "Update record",
@@ -3451,6 +3587,16 @@ const actionRegistry = [
3451
3587
  allowedContainerUses: import_action_scope.RECORD_ACTION_CONTAINER_USES,
3452
3588
  createSupported: true
3453
3589
  },
3590
+ {
3591
+ publicKey: "aiEmployee",
3592
+ label: "AI employee",
3593
+ scope: "record",
3594
+ scene: "record",
3595
+ use: AI_EMPLOYEE_ACTION_USE,
3596
+ ownerPlugin: AI_EMPLOYEE_FLOW_SURFACE_OWNER_PLUGIN,
3597
+ allowedContainerUses: import_action_scope.RECORD_ACTION_CONTAINER_USES,
3598
+ createSupported: true
3599
+ },
3454
3600
  {
3455
3601
  publicKey: "submit",
3456
3602
  label: "Submit",
@@ -3491,6 +3637,16 @@ const actionRegistry = [
3491
3637
  allowedContainerUses: import_action_scope.FORM_ACTION_CONTAINER_USES,
3492
3638
  createSupported: true
3493
3639
  },
3640
+ {
3641
+ publicKey: "aiEmployee",
3642
+ label: "AI employee",
3643
+ scope: "form",
3644
+ scene: "form",
3645
+ use: AI_EMPLOYEE_ACTION_USE,
3646
+ ownerPlugin: AI_EMPLOYEE_FLOW_SURFACE_OWNER_PLUGIN,
3647
+ allowedContainerUses: import_action_scope.FORM_ACTION_CONTAINER_USES,
3648
+ createSupported: true
3649
+ },
3494
3650
  {
3495
3651
  publicKey: "submit",
3496
3652
  label: "Submit",
@@ -36,63 +36,66 @@ export type ChartStyleValueSupport = {
36
36
  max?: number;
37
37
  description?: string;
38
38
  };
39
- export declare function deriveChartSemanticState(configure: any): Partial<{
40
- query: Partial<{
41
- mode: string;
42
- sql: any;
43
- sqlDatasource: any;
44
- }> | Partial<{
45
- mode: any;
46
- resource: {
47
- dataSourceKey: string;
48
- collectionName: string;
49
- };
50
- measures: any;
51
- dimensions: any;
52
- filter: any;
53
- sorting: Partial<{
54
- field: any;
55
- direction: string;
56
- nulls: any;
57
- }>[];
58
- limit: any;
59
- offset: any;
60
- }>;
61
- visual: Partial<{
62
- mode: string;
63
- raw: any;
64
- }> | Partial<{
65
- style?: Partial<{
66
- legend: any;
67
- tooltip: any;
68
- label: any;
69
- boundaryGap: any;
70
- xAxisLabelRotate: any;
71
- yAxisSplitLine: any;
72
- smooth: any;
73
- stack: any;
74
- radiusInner: any;
75
- radiusOuter: any;
76
- labelType: any;
77
- sort: any;
78
- minSize: any;
79
- maxSize: any;
80
- }>;
81
- mappings?: Partial<{
82
- x: any;
83
- y: any;
84
- category: any;
85
- value: any;
86
- series: any;
87
- size: any;
88
- }>;
89
- mode: string;
90
- type: string;
39
+ type DerivedChartResource = {
40
+ dataSourceKey: string;
41
+ collectionName: string;
42
+ };
43
+ type DerivedSqlChartQuery = {
44
+ mode: 'sql';
45
+ sql?: any;
46
+ sqlDatasource?: any;
47
+ };
48
+ type DerivedBuilderChartQuery = {
49
+ mode: 'builder';
50
+ resource?: DerivedChartResource | null;
51
+ measures?: any;
52
+ dimensions?: any;
53
+ filter?: any;
54
+ sorting?: any[];
55
+ limit?: any;
56
+ offset?: any;
57
+ };
58
+ type DerivedChartQuery = DerivedSqlChartQuery | DerivedBuilderChartQuery;
59
+ type DerivedChartSemanticState = {
60
+ query?: DerivedChartQuery;
61
+ visual?: ReturnType<typeof deriveChartVisual>;
62
+ events?: ReturnType<typeof deriveChartEvents>;
63
+ };
64
+ declare function deriveChartVisual(configure: any): Partial<{
65
+ mode: string;
66
+ raw: any;
67
+ }> | Partial<{
68
+ style?: Partial<{
69
+ legend: any;
70
+ tooltip: any;
71
+ label: any;
72
+ boundaryGap: any;
73
+ xAxisLabelRotate: any;
74
+ yAxisSplitLine: any;
75
+ smooth: any;
76
+ stack: any;
77
+ radiusInner: any;
78
+ radiusOuter: any;
79
+ labelType: any;
80
+ sort: any;
81
+ minSize: any;
82
+ maxSize: any;
91
83
  }>;
92
- events: Partial<{
93
- raw: any;
84
+ mappings?: Partial<{
85
+ x: any;
86
+ y: any;
87
+ category: any;
88
+ value: any;
89
+ series: any;
90
+ size: any;
94
91
  }>;
92
+ mode: string;
93
+ type: string;
94
+ }>;
95
+ declare function deriveChartEvents(configure: any): Partial<{
96
+ raw: any;
95
97
  }>;
98
+ export declare function deriveChartSemanticState(configure: any): DerivedChartSemanticState;
96
99
  export declare function getChartBuilderResourceInit(configure: any): {
97
100
  dataSourceKey: string;
98
101
  collectionName: string;
@@ -119,3 +122,4 @@ export declare function canonicalizeChartConfigure(configure: any): Record<strin
119
122
  export declare function buildChartConfigureFromSemanticChanges(currentConfigure: any, changes: Record<string, any>): any;
120
123
  export declare function isChartBuilderQuery(configure: any): boolean;
121
124
  export declare function getChartVisualCommonStyleKeys(): string[];
125
+ export {};
@@ -499,6 +499,19 @@ function normalizeChartDimension(input, index) {
499
499
  alias: normalizeOptionalTrimmedString(normalized.alias, `${label}.alias`)
500
500
  });
501
501
  }
502
+ function normalizeBuilderCountMeasureFieldForRuntime(measure, dimensions) {
503
+ if (measure.aggregation !== "count" || measure.distinct || aliasOfFieldValue(measure.field) !== "id") {
504
+ return measure;
505
+ }
506
+ const fallbackDimension = import_lodash.default.castArray(dimensions || []).find((dimension) => aliasOfFieldValue(dimension == null ? void 0 : dimension.field));
507
+ if (!fallbackDimension) {
508
+ return measure;
509
+ }
510
+ return {
511
+ ...measure,
512
+ field: import_lodash.default.cloneDeep(fallbackDimension.field)
513
+ };
514
+ }
502
515
  function normalizeChartSortingItem(input, index) {
503
516
  const label = `chart query.sorting[${index}]`;
504
517
  const normalized = ensurePlainObject(input, label);
@@ -846,15 +859,15 @@ function assertBuilderRuntimeCompatibleSorting(query, sorting) {
846
859
  }
847
860
  function normalizeBuilderQuery(query) {
848
861
  const resource = normalizeMergedChartResource(query, { required: true });
849
- const measures = Array.isArray(query.measures) ? query.measures.map((item, index) => normalizeChartMeasure(item, index)) : (() => {
862
+ const dimensions = import_lodash.default.isUndefined(query.dimensions) ? void 0 : Array.isArray(query.dimensions) ? query.dimensions.map((item, index) => normalizeChartDimension(item, index)) : (() => {
863
+ throw new import_errors.FlowSurfaceBadRequestError("chart query.dimensions must be an array");
864
+ })();
865
+ const measures = Array.isArray(query.measures) ? query.measures.map((item, index) => normalizeChartMeasure(item, index)).map((measure) => normalizeBuilderCountMeasureFieldForRuntime(measure, dimensions)) : (() => {
850
866
  throw new import_errors.FlowSurfaceBadRequestError("chart query.measures must be an array");
851
867
  })();
852
868
  if (!measures.length) {
853
869
  throw new import_errors.FlowSurfaceBadRequestError("chart query.measures cannot be empty");
854
870
  }
855
- const dimensions = import_lodash.default.isUndefined(query.dimensions) ? void 0 : Array.isArray(query.dimensions) ? query.dimensions.map((item, index) => normalizeChartDimension(item, index)) : (() => {
856
- throw new import_errors.FlowSurfaceBadRequestError("chart query.dimensions must be an array");
857
- })();
858
871
  const rawSorting = hasOwn(query, "sorting") ? query.sorting : query.orders;
859
872
  const sorting = import_lodash.default.isUndefined(rawSorting) ? void 0 : Array.isArray(rawSorting) ? rawSorting.map((item, index) => normalizeChartSortingItem(item, index)) : (() => {
860
873
  throw new import_errors.FlowSurfaceBadRequestError("chart query.sorting must be an array");
@@ -1128,7 +1141,7 @@ function deriveChartQuery(configure) {
1128
1141
  });
1129
1142
  }
1130
1143
  return buildDefinedObject({
1131
- mode: query.mode || "builder",
1144
+ mode: "builder",
1132
1145
  resource: getChartBuilderResourceInit(configure),
1133
1146
  measures: import_lodash.default.cloneDeep(query.measures),
1134
1147
  dimensions: import_lodash.default.cloneDeep(query.dimensions),
@@ -113,4 +113,4 @@ export declare function compileComposeExecutionPlan(input: {
113
113
  layout?: FlowSurfaceComposeObject;
114
114
  }): FlowSurfaceCompiledComposePlan;
115
115
  export declare function resolveComposeFieldContainerSource(blockSpec: Pick<FlowSurfaceComposeNormalizedBlockSpec, 'type'>): 'block' | 'item';
116
- export declare function resolveComposeTargetKey(targetKey: string, keyMap: Record<string, FlowSurfaceComposeTargetKey | undefined>, kind: 'field' | 'layout' | 'tree connectFields'): string;
116
+ export declare function resolveComposeTargetKey(targetKey: string, keyMap: Record<string, FlowSurfaceComposeTargetKey | undefined>, kind: string): string;
@@ -67,6 +67,7 @@ export type FlowSurfaceComposeRuntimeDeps = {
67
67
  createBlock: (payload: Record<string, unknown>, spec: FlowSurfaceComposeNormalizedBlockSpec) => Promise<FlowSurfaceComposeBlockResult>;
68
68
  applyNodeSettings?: (actionName: string, targetUid: string | undefined, settings?: FlowSurfaceComposeObject) => Promise<void>;
69
69
  resolveBlockSettings?: (settings: FlowSurfaceComposeObject, state: FlowSurfaceComposeRuntimeState, block: FlowSurfaceComposeRuntimeBlockState) => FlowSurfaceComposeObject | Promise<FlowSurfaceComposeObject>;
70
+ resolveActionSettings?: (settings: FlowSurfaceComposeObject, state: FlowSurfaceComposeRuntimeState, block: FlowSurfaceComposeRuntimeBlockState, action: FlowSurfaceComposeNormalizedActionSpec, actionName: string) => FlowSurfaceComposeObject | Promise<FlowSurfaceComposeObject>;
70
71
  createField: (payload: Record<string, unknown>, spec: FlowSurfaceComposeNormalizedFieldSpec, blockResult: FlowSurfaceComposeBlockResult) => Promise<FlowSurfaceComposeFieldResult | null>;
71
72
  applyFieldSettings?: (actionName: string, result: FlowSurfaceComposeFieldResult, settings?: FlowSurfaceComposeObject) => Promise<void>;
72
73
  onFieldError?: (input: {
@@ -225,18 +225,21 @@ async function applyBlockFieldLayouts(deps, state) {
225
225
  async function createActions(plan, deps, state) {
226
226
  for (const actionTask of plan.actions) {
227
227
  const block = requireBlockState(actionTask.blockKey, state);
228
+ const settings = await resolveComposeActionSettings(deps, state, block, actionTask.spec, "compose action");
229
+ const shouldPassSettingsDuringCreate = actionTask.spec.type === "aiEmployee" && hasInlineSettings(settings);
228
230
  const createdAction = await deps.createAction(
229
231
  {
230
232
  target: {
231
233
  uid: block.result.uid
232
234
  },
233
- ...actionTask.payload
235
+ ...actionTask.payload,
236
+ ...shouldPassSettingsDuringCreate ? { settings } : {}
234
237
  },
235
238
  actionTask.spec,
236
239
  block.result
237
240
  );
238
- if (deps.applyNodeSettings && hasInlineSettings(actionTask.spec.settings)) {
239
- await deps.applyNodeSettings("compose action", createdAction.uid, actionTask.spec.settings);
241
+ if (deps.applyNodeSettings && hasInlineSettings(settings) && !shouldPassSettingsDuringCreate) {
242
+ await deps.applyNodeSettings("compose action", createdAction.uid, settings);
240
243
  }
241
244
  if (deps.applyActionPopup && shouldApplyActionPopupAfterEffect(actionTask.spec)) {
242
245
  await deps.applyActionPopup("compose action", createdAction.uid, actionTask.spec.popup);
@@ -248,12 +251,21 @@ async function createActions(plan, deps, state) {
248
251
  async function createRecordActions(plan, deps, state) {
249
252
  for (const recordActionTask of plan.recordActions) {
250
253
  const block = requireBlockState(recordActionTask.blockKey, state);
254
+ const settings = await resolveComposeActionSettings(
255
+ deps,
256
+ state,
257
+ block,
258
+ recordActionTask.spec,
259
+ "compose recordAction"
260
+ );
261
+ const shouldPassSettingsDuringCreate = recordActionTask.spec.type === "aiEmployee" && hasInlineSettings(settings);
251
262
  const createdAction = await deps.createRecordAction(
252
263
  {
253
264
  target: {
254
265
  uid: block.result.uid
255
266
  },
256
- ...recordActionTask.payload
267
+ ...recordActionTask.payload,
268
+ ...shouldPassSettingsDuringCreate ? { settings } : {}
257
269
  },
258
270
  recordActionTask.spec,
259
271
  block.result
@@ -265,8 +277,8 @@ async function createRecordActions(plan, deps, state) {
265
277
  actionsColumnUid: createdAction.parentUid
266
278
  };
267
279
  }
268
- if (deps.applyNodeSettings && hasInlineSettings(recordActionTask.spec.settings)) {
269
- await deps.applyNodeSettings("compose recordAction", createdAction.uid, recordActionTask.spec.settings);
280
+ if (deps.applyNodeSettings && hasInlineSettings(settings) && !shouldPassSettingsDuringCreate) {
281
+ await deps.applyNodeSettings("compose recordAction", createdAction.uid, settings);
270
282
  }
271
283
  if (deps.applyActionPopup && shouldApplyActionPopupAfterEffect(recordActionTask.spec)) {
272
284
  await deps.applyActionPopup("compose recordAction", createdAction.uid, recordActionTask.spec.popup);
@@ -311,6 +323,12 @@ async function applyComposeLayout(plan, deps, state) {
311
323
  ...layoutPayload
312
324
  });
313
325
  }
326
+ async function resolveComposeActionSettings(deps, state, block, action, actionName) {
327
+ if (!hasInlineSettings(action.settings)) {
328
+ return action.settings;
329
+ }
330
+ return deps.resolveActionSettings ? await deps.resolveActionSettings(action.settings || {}, state, block, action, actionName) : action.settings;
331
+ }
314
332
  function requireBlockState(blockKey, state) {
315
333
  const matched = state.blocks.find((block) => block.spec.key === blockKey);
316
334
  if (!matched) {