@nocobase/plugin-flow-engine 2.1.0-alpha.39 → 2.1.0-alpha.40

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 (67) 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 +148 -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/index.d.ts +14 -2
  46. package/dist/server/flow-surfaces/runjs-authoring/index.js +4213 -242
  47. package/dist/server/flow-surfaces/runjs-authoring/nested-runjs-stop/index.d.ts +10 -0
  48. package/dist/server/flow-surfaces/runjs-authoring/nested-runjs-stop/index.js +40 -0
  49. package/dist/server/flow-surfaces/runjs-authoring/rules.js +6 -0
  50. package/dist/server/flow-surfaces/runjs-authoring/source-limit-stop/index.d.ts +10 -0
  51. package/dist/server/flow-surfaces/runjs-authoring/source-limit-stop/index.js +40 -0
  52. package/dist/server/flow-surfaces/runjs-authoring/syntax-stop/index.d.ts +10 -0
  53. package/dist/server/flow-surfaces/runjs-authoring/syntax-stop/index.js +40 -0
  54. package/dist/server/flow-surfaces/runjs-authoring/types.d.ts +1 -1
  55. package/dist/server/flow-surfaces/service-utils.d.ts +1 -1
  56. package/dist/server/flow-surfaces/service-utils.js +3 -0
  57. package/dist/server/flow-surfaces/service.d.ts +61 -3
  58. package/dist/server/flow-surfaces/service.js +1199 -101
  59. package/dist/server/flow-surfaces/support-matrix.d.ts +1 -1
  60. package/dist/server/flow-surfaces/support-matrix.js +13 -1
  61. package/dist/server/flow-surfaces/surface-context.js +4 -13
  62. package/dist/swagger/flow-surfaces.d.ts +147 -0
  63. package/dist/swagger/flow-surfaces.examples.d.ts +194 -1
  64. package/dist/swagger/flow-surfaces.examples.js +75 -3
  65. package/dist/swagger/flow-surfaces.js +180 -7
  66. package/dist/swagger/index.d.ts +147 -0
  67. 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,17 @@ 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"],
2445
+ props: ["aiEmployee", "context", "auto", "tasks", "style"]
2446
+ });
2447
+ AI_EMPLOYEE_ACTION_CONTRACT.domains.props = keyedDomain(["aiEmployee", "context", "auto", "tasks", "style"], "deep", {
2448
+ aiEmployee: OBJECT_SCHEMA,
2449
+ context: OBJECT_SCHEMA,
2450
+ auto: BOOLEAN_SCHEMA,
2451
+ tasks: ARRAY_SCHEMA,
2452
+ style: OBJECT_SCHEMA
2453
+ });
2408
2454
  const APPROVAL_FORM_BLOCK_CONTRACT = createContract({
2409
2455
  editableDomains: ["props", "decoratorProps", "stepParams", "flowRegistry"],
2410
2456
  props: ["labelWidth", "labelWrap"],
@@ -2528,6 +2574,11 @@ APPROVAL_ACTION_CONTRACT.domains.stepParams = groupedDomain({
2528
2574
  }
2529
2575
  }
2530
2576
  });
2577
+ const COMMENT_ITEM_CONTRACT = createContract({
2578
+ editableDomains: [],
2579
+ props: [],
2580
+ stepParams: []
2581
+ });
2531
2582
  const nodeContracts = /* @__PURE__ */ new Map();
2532
2583
  function registerNodeContract(use, contract) {
2533
2584
  nodeContracts.set(use, contract);
@@ -2571,6 +2622,8 @@ const NODE_CONTRACT_ENTRIES = [
2571
2622
  ["ActionPanelBlockModel", ACTION_PANEL_BLOCK_CONTRACT],
2572
2623
  ["MapBlockModel", MAP_BLOCK_CONTRACT],
2573
2624
  ["CommentsBlockModel", COMMENTS_BLOCK_CONTRACT],
2625
+ ["CommentItemModel", COMMENT_ITEM_CONTRACT],
2626
+ ["RecordHistoryBlockModel", RECORD_HISTORY_BLOCK_CONTRACT],
2574
2627
  ["TableActionsColumnModel", ACTION_COLUMN_CONTRACT],
2575
2628
  ["FormItemModel", FORM_ITEM_CONTRACT],
2576
2629
  ["FormAssociationItemModel", DETAILS_ITEM_CONTRACT],
@@ -2599,6 +2652,11 @@ const NODE_CONTRACT_ENTRIES = [
2599
2652
  ["KanbanCardViewActionModel", KANBAN_POPUP_ACTION_CONTRACT],
2600
2653
  ["AddChildActionModel", POPUP_ACTION_CONTRACT],
2601
2654
  ["DeleteActionModel", DELETE_ACTION_CONTRACT],
2655
+ ["EditCommentActionModel", SIMPLE_ACTION_CONTRACT],
2656
+ ["DeleteCommentActionModel", DELETE_ACTION_CONTRACT],
2657
+ ["QuoteReplyActionModel", SIMPLE_ACTION_CONTRACT],
2658
+ ["RecordHistoryExpandActionModel", SIMPLE_ACTION_CONTRACT],
2659
+ ["RecordHistoryCollapseActionModel", SIMPLE_ACTION_CONTRACT],
2602
2660
  ["BulkDeleteActionModel", DELETE_ACTION_CONTRACT],
2603
2661
  ["UpdateRecordActionModel", UPDATE_RECORD_ACTION_CONTRACT],
2604
2662
  ["BulkEditActionModel", BULK_EDIT_ACTION_CONTRACT],
@@ -2633,6 +2691,7 @@ const NODE_CONTRACT_ENTRIES = [
2633
2691
  ["FilterFormJSActionModel", JS_ACTION_CONTRACT],
2634
2692
  ["JSItemActionModel", JS_ITEM_ACTION_CONTRACT],
2635
2693
  ["JSActionModel", JS_ACTION_CONTRACT],
2694
+ [AI_EMPLOYEE_ACTION_USE, AI_EMPLOYEE_ACTION_CONTRACT],
2636
2695
  ["ApplyFormSubmitModel", APPROVAL_ACTION_CONTRACT],
2637
2696
  ["ApplyFormSaveDraftModel", APPROVAL_ACTION_CONTRACT],
2638
2697
  ["ApplyFormWithdrawModel", APPROVAL_ACTION_CONTRACT],
@@ -3046,6 +3105,7 @@ const COLLECTION_RESOURCE_REQUIRED = /* @__PURE__ */ new Set([
3046
3105
  "GridCardBlockModel",
3047
3106
  "MapBlockModel",
3048
3107
  "CommentsBlockModel",
3108
+ "RecordHistoryBlockModel",
3049
3109
  ...import_approval.APPROVAL_FORM_BLOCK_USES,
3050
3110
  ...import_approval.APPROVAL_DETAILS_BLOCK_USES
3051
3111
  ]);
@@ -3118,7 +3178,10 @@ const actionRegistry = [
3118
3178
  scene: "collection",
3119
3179
  use: "FilterActionModel",
3120
3180
  ownerPlugin: CORE_FLOW_SURFACE_OWNER_PLUGIN,
3121
- allowedContainerUses: COLLECTION_BLOCK_AND_KANBAN_ACTION_CONTAINER_USES,
3181
+ allowedContainerUses: [
3182
+ ...COLLECTION_BLOCK_AND_KANBAN_ACTION_CONTAINER_USES,
3183
+ ...import_action_scope.RECORD_HISTORY_BLOCK_ACTION_CONTAINER_USES
3184
+ ],
3122
3185
  createSupported: true
3123
3186
  },
3124
3187
  {
@@ -3148,7 +3211,30 @@ const actionRegistry = [
3148
3211
  scene: "collection",
3149
3212
  use: "RefreshActionModel",
3150
3213
  ownerPlugin: CORE_FLOW_SURFACE_OWNER_PLUGIN,
3151
- allowedContainerUses: COLLECTION_BLOCK_AND_KANBAN_ACTION_CONTAINER_USES,
3214
+ allowedContainerUses: [
3215
+ ...COLLECTION_BLOCK_AND_KANBAN_ACTION_CONTAINER_USES,
3216
+ ...import_action_scope.RECORD_HISTORY_BLOCK_ACTION_CONTAINER_USES
3217
+ ],
3218
+ createSupported: true
3219
+ },
3220
+ {
3221
+ publicKey: "expandAll",
3222
+ label: "Expand all",
3223
+ scope: "block",
3224
+ scene: "collection",
3225
+ use: "RecordHistoryExpandActionModel",
3226
+ ownerPlugin: "@nocobase/plugin-record-history",
3227
+ allowedContainerUses: import_action_scope.RECORD_HISTORY_BLOCK_ACTION_CONTAINER_USES,
3228
+ createSupported: true
3229
+ },
3230
+ {
3231
+ publicKey: "collapseAll",
3232
+ label: "Collapse all",
3233
+ scope: "block",
3234
+ scene: "collection",
3235
+ use: "RecordHistoryCollapseActionModel",
3236
+ ownerPlugin: "@nocobase/plugin-record-history",
3237
+ allowedContainerUses: import_action_scope.RECORD_HISTORY_BLOCK_ACTION_CONTAINER_USES,
3152
3238
  createSupported: true
3153
3239
  },
3154
3240
  {
@@ -3331,6 +3417,16 @@ const actionRegistry = [
3331
3417
  allowedContainerUses: import_action_scope.COLLECTION_BLOCK_ACTION_CONTAINER_USES,
3332
3418
  createSupported: true
3333
3419
  },
3420
+ {
3421
+ publicKey: "aiEmployee",
3422
+ label: "AI employee",
3423
+ scope: "block",
3424
+ scene: "collection",
3425
+ use: AI_EMPLOYEE_ACTION_USE,
3426
+ ownerPlugin: AI_EMPLOYEE_FLOW_SURFACE_OWNER_PLUGIN,
3427
+ allowedContainerUses: COLLECTION_BLOCK_AND_KANBAN_ACTION_CONTAINER_USES,
3428
+ createSupported: true
3429
+ },
3334
3430
  {
3335
3431
  publicKey: "duplicate",
3336
3432
  label: "Duplicate",
@@ -3401,6 +3497,36 @@ const actionRegistry = [
3401
3497
  allowedContainerUses: import_action_scope.RECORD_ACTION_CONTAINER_USES,
3402
3498
  createSupported: true
3403
3499
  },
3500
+ {
3501
+ publicKey: "edit",
3502
+ label: "Edit",
3503
+ scope: "record",
3504
+ scene: "record",
3505
+ use: "EditCommentActionModel",
3506
+ ownerPlugin: "@nocobase/plugin-comments",
3507
+ allowedContainerUses: import_action_scope.COMMENT_RECORD_ACTION_CONTAINER_USES,
3508
+ createSupported: true
3509
+ },
3510
+ {
3511
+ publicKey: "delete",
3512
+ label: "Delete",
3513
+ scope: "record",
3514
+ scene: "record",
3515
+ use: "DeleteCommentActionModel",
3516
+ ownerPlugin: "@nocobase/plugin-comments",
3517
+ allowedContainerUses: import_action_scope.COMMENT_RECORD_ACTION_CONTAINER_USES,
3518
+ createSupported: true
3519
+ },
3520
+ {
3521
+ publicKey: "quoteReply",
3522
+ label: "Quote reply",
3523
+ scope: "record",
3524
+ scene: "record",
3525
+ use: "QuoteReplyActionModel",
3526
+ ownerPlugin: "@nocobase/plugin-comments",
3527
+ allowedContainerUses: import_action_scope.COMMENT_RECORD_ACTION_CONTAINER_USES,
3528
+ createSupported: true
3529
+ },
3404
3530
  {
3405
3531
  publicKey: "updateRecord",
3406
3532
  label: "Update record",
@@ -3451,6 +3577,16 @@ const actionRegistry = [
3451
3577
  allowedContainerUses: import_action_scope.RECORD_ACTION_CONTAINER_USES,
3452
3578
  createSupported: true
3453
3579
  },
3580
+ {
3581
+ publicKey: "aiEmployee",
3582
+ label: "AI employee",
3583
+ scope: "record",
3584
+ scene: "record",
3585
+ use: AI_EMPLOYEE_ACTION_USE,
3586
+ ownerPlugin: AI_EMPLOYEE_FLOW_SURFACE_OWNER_PLUGIN,
3587
+ allowedContainerUses: import_action_scope.RECORD_ACTION_CONTAINER_USES,
3588
+ createSupported: true
3589
+ },
3454
3590
  {
3455
3591
  publicKey: "submit",
3456
3592
  label: "Submit",
@@ -3491,6 +3627,16 @@ const actionRegistry = [
3491
3627
  allowedContainerUses: import_action_scope.FORM_ACTION_CONTAINER_USES,
3492
3628
  createSupported: true
3493
3629
  },
3630
+ {
3631
+ publicKey: "aiEmployee",
3632
+ label: "AI employee",
3633
+ scope: "form",
3634
+ scene: "form",
3635
+ use: AI_EMPLOYEE_ACTION_USE,
3636
+ ownerPlugin: AI_EMPLOYEE_FLOW_SURFACE_OWNER_PLUGIN,
3637
+ allowedContainerUses: import_action_scope.FORM_ACTION_CONTAINER_USES,
3638
+ createSupported: true
3639
+ },
3494
3640
  {
3495
3641
  publicKey: "submit",
3496
3642
  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) {
@@ -395,9 +395,19 @@ const MAP_OPTIONS = {
395
395
  const COMMENTS_OPTIONS = {
396
396
  ...COMMON_BLOCK_HEADER_OPTIONS,
397
397
  resource: COMMON_RESOURCE,
398
- pageSize: numberOption("Page size", { example: 20 }),
398
+ pageSize: numberOption("Page size", { enum: [5, 10, 20, 50, 100, 200], example: 20 }),
399
399
  dataScope: FILTER_GROUP
400
400
  };
401
+ const RECORD_HISTORY_OPTIONS = {
402
+ ...COMMON_BLOCK_HEADER_OPTIONS,
403
+ resource: COMMON_RESOURCE,
404
+ sortOrder: objectOption("History sort order", { example: { order: "desc" } }),
405
+ dataScope: FILTER_GROUP,
406
+ expand: objectOption("Expansion state", { example: { expand: true } }),
407
+ template: objectOption('Record-history template binding. Only { apply: "current" } is public.', {
408
+ example: { apply: "current" }
409
+ })
410
+ };
401
411
  const JS_BLOCK_OPTIONS = {
402
412
  title: stringOption("Title", { example: "Runtime Banner" }),
403
413
  description: stringOption("Description", { example: "Custom JS block" }),
@@ -619,6 +629,30 @@ const ACTION_EMAIL_OPTIONS = {
619
629
  emailFieldNames: arrayOption("Email field name list", { example: ["email"] }),
620
630
  defaultSelectAllRecords: booleanOption("Whether all records are selected by default", { example: false })
621
631
  };
632
+ const ACTION_AI_EMPLOYEE_OPTIONS = {
633
+ username: stringOption("AI employee username", { example: "dex" }),
634
+ auto: booleanOption("Whether the single configured task is prepared automatically", { example: false }),
635
+ workContext: arrayOption("Top-level AI work context. Use target=self or a same-blueprint block key before write.", {
636
+ example: [{ type: "flow-model", target: "self" }]
637
+ }),
638
+ tasks: arrayOption("AI employee task definitions", {
639
+ example: [
640
+ {
641
+ title: "Analyze current record",
642
+ message: {
643
+ system: "Use the current UI context.",
644
+ user: "Analyze the current record and suggest next steps.",
645
+ workContext: [{ type: "flow-model", target: "self" }]
646
+ },
647
+ autoSend: false,
648
+ skillSettings: { skills: [], tools: [] },
649
+ model: null,
650
+ webSearch: false
651
+ }
652
+ ]
653
+ }),
654
+ style: objectOption("Avatar style", { example: { size: 40, mask: false } })
655
+ };
622
656
  const CALENDAR_ACTION_POSITION_OPTIONS = {
623
657
  position: stringOption("Position", { enum: ["left", "right"], example: "left" })
624
658
  };
@@ -674,6 +708,8 @@ function getActionConfigureOptionsByUse(use) {
674
708
  const base = [ACTION_COMMON_OPTIONS];
675
709
  const merged = (...extra) => mergeOptions(...base, ...extra);
676
710
  switch (normalized) {
711
+ case "AIEmployeeButtonModel":
712
+ return mergeOptions(ACTION_AI_EMPLOYEE_OPTIONS);
677
713
  case "CalendarTodayActionModel":
678
714
  return merged(CALENDAR_ACTION_POSITION_OPTIONS, ACTION_LINKAGE_OPTIONS);
679
715
  case "CalendarNavActionModel":
@@ -840,6 +876,9 @@ function getConfigureOptionsForUse(use) {
840
876
  case "CommentsBlockModel":
841
877
  options = cloneOptions(COMMENTS_OPTIONS);
842
878
  break;
879
+ case "RecordHistoryBlockModel":
880
+ options = cloneOptions(RECORD_HISTORY_OPTIONS);
881
+ break;
843
882
  case "JSBlockModel":
844
883
  options = cloneOptions(JS_BLOCK_OPTIONS);
845
884
  break;