@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
@@ -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: null,
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;
@@ -138,6 +138,17 @@ const FLOW_SURFACE_DEFAULT_BLOCK_ACTIONS = {
138
138
  [FLOW_SURFACE_INTERNAL_AUTO_SAVE_DEFAULT_POPUP_TEMPLATE_KEY]: true
139
139
  }
140
140
  }
141
+ ],
142
+ comments: [
143
+ { type: "edit", scope: "recordActions" },
144
+ { type: "delete", scope: "recordActions" },
145
+ { type: "quoteReply", scope: "recordActions" }
146
+ ],
147
+ recordHistory: [
148
+ { type: "filter", scope: "actions" },
149
+ { type: "refresh", scope: "actions" },
150
+ { type: "expandAll", scope: "actions" },
151
+ { type: "collapseAll", scope: "actions" }
141
152
  ]
142
153
  };
143
154
  function cloneDefaultActionDescriptor(descriptor) {
@@ -263,15 +263,17 @@ function registerFlowSurfacesResource(plugin) {
263
263
  actionName,
264
264
  async (ctx, next) => {
265
265
  await runFlowSurfaceAction(ctx, next, async () => {
266
+ var _a;
266
267
  const definition = import_constants.FLOW_SURFACE_ACTION_DEFINITIONS[actionName];
267
268
  const values = definition.valueSource === "read" ? getReadValues(ctx) : getValues(ctx);
268
269
  const t = getFlowSurfaceTranslate(ctx);
270
+ const currentRoles = (_a = ctx.state) == null ? void 0 : _a.currentRoles;
269
271
  if (definition.transaction) {
270
272
  return service.transaction(
271
- (transaction) => invokeFlowSurfaceServiceAction(service, actionName, values, { transaction, t })
273
+ (transaction) => invokeFlowSurfaceServiceAction(service, actionName, values, { transaction, currentRoles, t })
272
274
  );
273
275
  }
274
- return invokeFlowSurfaceServiceAction(service, actionName, values, { t });
276
+ return invokeFlowSurfaceServiceAction(service, actionName, values, { currentRoles, t });
275
277
  });
276
278
  }
277
279
  ])
@@ -50,6 +50,7 @@ const COLLECTION_BLOCK_USES = /* @__PURE__ */ new Set([
50
50
  "GridCardBlockModel",
51
51
  "MapBlockModel",
52
52
  "CommentsBlockModel",
53
+ "RecordHistoryBlockModel",
53
54
  ...import_approval.APPROVAL_FORM_BLOCK_USES,
54
55
  ...import_approval.APPROVAL_DETAILS_BLOCK_USES
55
56
  ]);
@@ -107,6 +108,7 @@ const ACTION_BUTTON_USES = /* @__PURE__ */ new Set([
107
108
  "JSItemActionModel",
108
109
  "FilterFormJSActionModel",
109
110
  "JSActionModel",
111
+ "AIEmployeeButtonModel",
110
112
  "CalendarTodayActionModel",
111
113
  "CalendarNavActionModel",
112
114
  "CalendarTitleActionModel",
@@ -32,7 +32,7 @@ module.exports = __toCommonJS(ctx_libs_member_mismatch_stop_exports);
32
32
  const ctxLibsMemberMismatchStopRule = {
33
33
  repairClass: "ctx-libs-member-mismatch-stop",
34
34
  defaultRuleId: "runjs-ctx-libs-member-case-invalid",
35
- suggestedAction: "Use exact case-sensitive ctx.libs keys, such as ctx.libs.React, ctx.libs.ReactDOM, and ctx.libs.antdIcons."
35
+ suggestedAction: "Use exact case-sensitive ctx.libs keys and supported library exports. For Ant Design color palettes, import '@ant-design/colors' with ctx.importAsync."
36
36
  };
37
37
  // Annotate the CommonJS export names for ESM import in node:
38
38
  0 && (module.exports = {
@@ -12,10 +12,22 @@ type FlowSurfaceAuthoringWriteAction = 'applyBlueprint' | 'compose' | 'addBlock'
12
12
  type RunJsAuthoringContext = {
13
13
  authoringActionName?: FlowSurfaceAuthoringWriteAction;
14
14
  applyBlueprintScriptAssets?: Record<string, any>;
15
+ currentCollectionName?: string;
16
+ currentDataSourceKey?: string;
15
17
  currentNode?: any;
18
+ getCollection?: (dataSourceKey: string, collectionName: string) => any;
16
19
  hostBlockType?: string;
20
+ hostCollectionName?: string;
21
+ hostDataSourceKey?: string;
22
+ runJsSourceBudget?: RunJsSourceBudget;
23
+ };
24
+ type RunJsSourceBudget = {
25
+ count: number;
26
+ countLimitReported?: boolean;
27
+ totalLength: number;
28
+ totalLimitReported?: boolean;
17
29
  };
18
30
  export declare function collectRunJsAuthoringErrors(actionName: FlowSurfaceAuthoringWriteAction, values: any, context?: RunJsAuthoringContext): FlowSurfaceErrorItemInput[];
19
- export declare function collectFlowRegistryRunJsAuthoringErrors(flowRegistry: any, path?: string): FlowSurfaceErrorItemInput[];
20
- export declare function inspectRunJsAuthoringCode(input: RunJsAuthoringInspectionInput): FlowSurfaceErrorItemInput[];
31
+ export declare function collectFlowRegistryRunJsAuthoringErrors(flowRegistry: any, path?: string, context?: RunJsAuthoringContext): FlowSurfaceErrorItemInput[];
32
+ export declare function inspectRunJsAuthoringCode(input: RunJsAuthoringInspectionInput, context?: RunJsAuthoringContext): FlowSurfaceErrorItemInput[];
21
33
  export {};