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

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 (105) hide show
  1. package/dist/client/index.js +1 -1
  2. package/dist/externalVersion.js +9 -9
  3. package/dist/node_modules/@ant-design/icons-svg/package.json +1 -1
  4. package/dist/node_modules/acorn/package.json +1 -1
  5. package/dist/node_modules/acorn-jsx/package.json +1 -1
  6. package/dist/node_modules/acorn-walk/package.json +1 -1
  7. package/dist/node_modules/ses/package.json +1 -1
  8. package/dist/node_modules/zod/package.json +1 -1
  9. package/dist/server/flow-surfaces/apply/compiler.js +28 -14
  10. package/dist/server/flow-surfaces/apply/matching.js +2 -0
  11. package/dist/server/flow-surfaces/authoring-validation.d.ts +1 -0
  12. package/dist/server/flow-surfaces/authoring-validation.js +1453 -151
  13. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +21 -3
  14. package/dist/server/flow-surfaces/blueprint/compile-plan.js +9 -9
  15. package/dist/server/flow-surfaces/blueprint/normalize-document.js +5 -1
  16. package/dist/server/flow-surfaces/catalog.js +26 -9
  17. package/dist/server/flow-surfaces/chart-config.js +231 -14
  18. package/dist/server/flow-surfaces/compose-compiler.d.ts +2 -0
  19. package/dist/server/flow-surfaces/compose-compiler.js +2 -0
  20. package/dist/server/flow-surfaces/compose-runtime.js +4 -7
  21. package/dist/server/flow-surfaces/configure-options.js +19 -8
  22. package/dist/server/flow-surfaces/contract-guard.js +40 -6
  23. package/dist/server/flow-surfaces/default-block-actions.js +2 -0
  24. package/dist/server/flow-surfaces/errors.d.ts +15 -0
  25. package/dist/server/flow-surfaces/errors.js +49 -3
  26. package/dist/server/flow-surfaces/event-flow-normalizer.d.ts +19 -0
  27. package/dist/server/flow-surfaces/event-flow-normalizer.js +128 -0
  28. package/dist/server/flow-surfaces/filter-group.d.ts +9 -1
  29. package/dist/server/flow-surfaces/filter-group.js +402 -3
  30. package/dist/server/flow-surfaces/locator.js +16 -2
  31. package/dist/server/flow-surfaces/public-data-surface-default-filter.js +2 -1
  32. package/dist/server/flow-surfaces/route-sync.js +19 -2
  33. package/dist/server/flow-surfaces/runjs-authoring/ast/bindings.d.ts +66 -0
  34. package/dist/server/flow-surfaces/runjs-authoring/ast/bindings.js +661 -0
  35. package/dist/server/flow-surfaces/runjs-authoring/ast/execution.d.ts +20 -0
  36. package/dist/server/flow-surfaces/runjs-authoring/ast/execution.js +275 -0
  37. package/dist/server/flow-surfaces/runjs-authoring/ast/parser.d.ts +16 -0
  38. package/dist/server/flow-surfaces/runjs-authoring/ast/parser.js +130 -0
  39. package/dist/server/flow-surfaces/runjs-authoring/ast/react-values.d.ts +20 -0
  40. package/dist/server/flow-surfaces/runjs-authoring/ast/react-values.js +401 -0
  41. package/dist/server/flow-surfaces/runjs-authoring/ast/request-config.d.ts +21 -0
  42. package/dist/server/flow-surfaces/runjs-authoring/ast/request-config.js +199 -0
  43. package/dist/server/flow-surfaces/runjs-authoring/ast/source.d.ts +70 -0
  44. package/dist/server/flow-surfaces/runjs-authoring/ast/source.js +895 -0
  45. package/dist/server/flow-surfaces/runjs-authoring/ast/static-bindings.d.ts +23 -0
  46. package/dist/server/flow-surfaces/runjs-authoring/ast/static-bindings.js +618 -0
  47. package/dist/server/flow-surfaces/runjs-authoring/ast/static-values.d.ts +196 -0
  48. package/dist/server/flow-surfaces/runjs-authoring/ast/static-values.js +1777 -0
  49. package/dist/server/flow-surfaces/runjs-authoring/ast/walk.d.ts +10 -0
  50. package/dist/server/flow-surfaces/runjs-authoring/ast/walk.js +55 -0
  51. package/dist/server/flow-surfaces/runjs-authoring/collectors.d.ts +12 -0
  52. package/dist/server/flow-surfaces/runjs-authoring/collectors.js +589 -0
  53. package/dist/server/flow-surfaces/runjs-authoring/ctx-libs-member-mismatch-stop/index.js +1 -1
  54. package/dist/server/flow-surfaces/runjs-authoring/index.d.ts +2 -25
  55. package/dist/server/flow-surfaces/runjs-authoring/index.js +5 -7033
  56. package/dist/server/flow-surfaces/runjs-authoring/inspect.d.ts +13 -0
  57. package/dist/server/flow-surfaces/runjs-authoring/inspect.js +149 -0
  58. package/dist/server/flow-surfaces/runjs-authoring/internal-types.d.ts +333 -0
  59. package/dist/server/flow-surfaces/runjs-authoring/internal-types.js +36 -0
  60. package/dist/server/flow-surfaces/runjs-authoring/rules.js +2 -0
  61. package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.d.ts +67 -0
  62. package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.js +757 -0
  63. package/dist/server/flow-surfaces/runjs-authoring/runtime/errors.d.ts +22 -0
  64. package/dist/server/flow-surfaces/runjs-authoring/runtime/errors.js +91 -0
  65. package/dist/server/flow-surfaces/runjs-authoring/runtime/source-budget.d.ts +16 -0
  66. package/dist/server/flow-surfaces/runjs-authoring/runtime/source-budget.js +115 -0
  67. package/dist/server/flow-surfaces/runjs-authoring/runtime/surface.d.ts +19 -0
  68. package/dist/server/flow-surfaces/runjs-authoring/runtime/surface.js +140 -0
  69. package/dist/server/flow-surfaces/runjs-authoring/runtime/types.d.ts +91 -0
  70. package/dist/server/flow-surfaces/runjs-authoring/runtime/types.js +24 -0
  71. package/dist/server/flow-surfaces/runjs-authoring/scan/ctx-api.d.ts +138 -0
  72. package/dist/server/flow-surfaces/runjs-authoring/scan/ctx-api.js +1779 -0
  73. package/dist/server/flow-surfaces/runjs-authoring/scan/filter.d.ts +10 -0
  74. package/dist/server/flow-surfaces/runjs-authoring/scan/filter.js +1583 -0
  75. package/dist/server/flow-surfaces/runjs-authoring/scan/index.d.ts +195 -0
  76. package/dist/server/flow-surfaces/runjs-authoring/scan/index.js +463 -0
  77. package/dist/server/flow-surfaces/runjs-authoring/scan/react-render.d.ts +48 -0
  78. package/dist/server/flow-surfaces/runjs-authoring/scan/react-render.js +379 -0
  79. package/dist/server/flow-surfaces/runjs-authoring/scan/react.d.ts +26 -0
  80. package/dist/server/flow-surfaces/runjs-authoring/scan/react.js +1441 -0
  81. package/dist/server/flow-surfaces/runjs-authoring/scan/resource.d.ts +23 -0
  82. package/dist/server/flow-surfaces/runjs-authoring/scan/resource.js +1427 -0
  83. package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.d.ts +91 -0
  84. package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.js +889 -0
  85. package/dist/server/flow-surfaces/runjs-authoring/types.d.ts +1 -1
  86. package/dist/server/flow-surfaces/runjs-authoring/unknown-global-stop/index.d.ts +10 -0
  87. package/dist/server/flow-surfaces/runjs-authoring/unknown-global-stop/index.js +40 -0
  88. package/dist/server/flow-surfaces/runjs-authoring/validators/index.d.ts +12 -0
  89. package/dist/server/flow-surfaces/runjs-authoring/validators/index.js +887 -0
  90. package/dist/server/flow-surfaces/service-helpers.d.ts +29 -0
  91. package/dist/server/flow-surfaces/service-helpers.js +105 -0
  92. package/dist/server/flow-surfaces/service-utils.d.ts +17 -3
  93. package/dist/server/flow-surfaces/service-utils.js +14 -5
  94. package/dist/server/flow-surfaces/service.d.ts +74 -15
  95. package/dist/server/flow-surfaces/service.js +1781 -193
  96. package/dist/server/flow-surfaces/template-service-utils.d.ts +1 -0
  97. package/dist/server/flow-surfaces/types.d.ts +3 -0
  98. package/dist/server/repository.d.ts +12 -1
  99. package/dist/server/repository.js +195 -23
  100. package/dist/swagger/flow-surfaces.d.ts +180 -2
  101. package/dist/swagger/flow-surfaces.examples.d.ts +11 -37
  102. package/dist/swagger/flow-surfaces.examples.js +6 -6
  103. package/dist/swagger/flow-surfaces.js +136 -54
  104. package/dist/swagger/index.d.ts +180 -2
  105. package/package.json +2 -2
@@ -26,6 +26,35 @@ export declare function getCollectionName(collection: any): any;
26
26
  export declare function getCollectionTitleFieldName(collection: any): any;
27
27
  export declare function getFieldName(field: any): any;
28
28
  export declare function getFieldTitle(field: any): any;
29
+ export declare function getCollectionModelAttributes(collection: any): any;
30
+ export type FlowSurfaceChartBuilderSupportedSubfield = {
31
+ field: string;
32
+ title?: string;
33
+ interface?: string;
34
+ };
35
+ export declare function getChartBuilderSupportedRelationSubfields(associationPathName: string, targetCollection: any): FlowSurfaceChartBuilderSupportedSubfield[];
36
+ export declare function formatChartBuilderSupportedRelationSubfields(associationPath: string, supportedFields?: FlowSurfaceChartBuilderSupportedSubfield[]): string;
37
+ export declare function getInvalidChartBuilderRelationDirectSubfieldDetails(input: {
38
+ associationPathName: string;
39
+ selectedSubfieldPath: string;
40
+ targetCollection: any;
41
+ }): {
42
+ associationPath: string;
43
+ leafFieldName: string;
44
+ selectedSubfieldPath: string;
45
+ supportedFields: FlowSurfaceChartBuilderSupportedSubfield[];
46
+ };
47
+ export declare function getUnsupportedChartBuilderRelationSubfieldDetails(input: {
48
+ associationPathName: string;
49
+ leafFieldName: string;
50
+ leafField?: any;
51
+ targetCollection: any;
52
+ }): {
53
+ associationPath: string;
54
+ leafFieldName: string;
55
+ columnName: string;
56
+ supportedFields: FlowSurfaceChartBuilderSupportedSubfield[];
57
+ };
29
58
  export declare function resolveAssociationNameFromField(field: any, fallbackCollection?: any): any;
30
59
  export declare function getFieldInterface(field: any): any;
31
60
  export declare function getFieldType(field: any): any;
@@ -40,8 +40,11 @@ __export(service_helpers_exports, {
40
40
  buildFilterFieldMeta: () => buildFilterFieldMeta,
41
41
  buildFlowTemplateSearchFilter: () => buildFlowTemplateSearchFilter,
42
42
  dedupeVisibleFieldCandidates: () => dedupeVisibleFieldCandidates,
43
+ formatChartBuilderSupportedRelationSubfields: () => formatChartBuilderSupportedRelationSubfields,
43
44
  getAssociationFilterTargetKey: () => getAssociationFilterTargetKey,
45
+ getChartBuilderSupportedRelationSubfields: () => getChartBuilderSupportedRelationSubfields,
44
46
  getCollectionFields: () => getCollectionFields,
47
+ getCollectionModelAttributes: () => getCollectionModelAttributes,
45
48
  getCollectionName: () => getCollectionName,
46
49
  getCollectionTitle: () => getCollectionTitle,
47
50
  getCollectionTitleFieldName: () => getCollectionTitleFieldName,
@@ -51,6 +54,8 @@ __export(service_helpers_exports, {
51
54
  getFieldTarget: () => getFieldTarget,
52
55
  getFieldTitle: () => getFieldTitle,
53
56
  getFieldType: () => getFieldType,
57
+ getInvalidChartBuilderRelationDirectSubfieldDetails: () => getInvalidChartBuilderRelationDirectSubfieldDetails,
58
+ getUnsupportedChartBuilderRelationSubfieldDetails: () => getUnsupportedChartBuilderRelationSubfieldDetails,
54
59
  hasConfiguredFlowContextValue: () => hasConfiguredFlowContextValue,
55
60
  inferAssociationLeafDisplayFieldUse: () => inferAssociationLeafDisplayFieldUse,
56
61
  inferFieldMenuEditableFieldUse: () => inferFieldMenuEditableFieldUse,
@@ -178,6 +183,101 @@ function getFieldTitle(field) {
178
183
  var _a, _b, _c, _d;
179
184
  return ((_a = field == null ? void 0 : field.uiSchema) == null ? void 0 : _a.title) || ((_c = (_b = field == null ? void 0 : field.options) == null ? void 0 : _b.uiSchema) == null ? void 0 : _c.title) || (field == null ? void 0 : field.title) || ((_d = field == null ? void 0 : field.options) == null ? void 0 : _d.title) || getFieldName(field);
180
185
  }
186
+ function getCollectionModelAttributes(collection) {
187
+ var _a, _b, _c;
188
+ return (typeof ((_a = collection == null ? void 0 : collection.model) == null ? void 0 : _a.getAttributes) === "function" ? collection.model.getAttributes() : null) || ((_b = collection == null ? void 0 : collection.model) == null ? void 0 : _b.rawAttributes) || ((_c = collection == null ? void 0 : collection.model) == null ? void 0 : _c.attributes) || {};
189
+ }
190
+ function getCollectionFieldColumnName(collection, fieldName) {
191
+ var _a;
192
+ const normalized = String(fieldName || "").trim();
193
+ if (!normalized) {
194
+ return "";
195
+ }
196
+ const attribute = (_a = getCollectionModelAttributes(collection)) == null ? void 0 : _a[normalized];
197
+ return String((attribute == null ? void 0 : attribute.field) || normalized).trim();
198
+ }
199
+ function getChartBuilderSupportedRelationSubfields(associationPathName, targetCollection) {
200
+ const normalizedAssociationPath = String(associationPathName || "").trim();
201
+ if (!normalizedAssociationPath || !targetCollection) {
202
+ return [];
203
+ }
204
+ return getCollectionFields(targetCollection).reduce((result, field) => {
205
+ const fieldName = getFieldName(field);
206
+ if (!fieldName || isAssociationField(field)) {
207
+ return result;
208
+ }
209
+ if (getCollectionFieldColumnName(targetCollection, fieldName) !== fieldName) {
210
+ return result;
211
+ }
212
+ result.push(
213
+ import_lodash.default.pickBy(
214
+ {
215
+ field: `${normalizedAssociationPath}.${fieldName}`,
216
+ title: getFieldTitle(field),
217
+ interface: getFieldInterface(field)
218
+ },
219
+ (value) => !import_lodash.default.isUndefined(value)
220
+ )
221
+ );
222
+ return result;
223
+ }, []);
224
+ }
225
+ function formatChartBuilderSupportedRelationSubfields(associationPath, supportedFields = []) {
226
+ const fields = supportedFields.map((item) => String((item == null ? void 0 : item.field) || "").trim()).filter(Boolean);
227
+ if (!fields.length) {
228
+ return `No chart-builder-compatible fields are available under '${associationPath}'.`;
229
+ }
230
+ return `Supported fields under '${associationPath}': ${fields.join(", ")}.`;
231
+ }
232
+ function getInvalidChartBuilderRelationDirectSubfieldDetails(input) {
233
+ const associationPath = String(input.associationPathName || "").trim();
234
+ const selectedSubfieldPath = String(input.selectedSubfieldPath || "").trim();
235
+ const selectedParts = selectedSubfieldPath.split(".").filter(Boolean);
236
+ if (!associationPath || !input.targetCollection || !selectedParts.length) {
237
+ return null;
238
+ }
239
+ const leafFieldName = selectedParts[0];
240
+ const leafField = resolveFieldFromCollection(input.targetCollection, leafFieldName);
241
+ const modelAttributes = getCollectionModelAttributes(input.targetCollection);
242
+ const modelAttribute = modelAttributes == null ? void 0 : modelAttributes[leafFieldName];
243
+ const hasModelAttribute = Object.prototype.hasOwnProperty.call(modelAttributes, leafFieldName);
244
+ const hasNestedSubfieldPath = selectedParts.length > 1;
245
+ if (leafField && !hasNestedSubfieldPath && !isAssociationField(leafField)) {
246
+ return null;
247
+ }
248
+ if (!leafField && hasModelAttribute && !hasNestedSubfieldPath) {
249
+ const columnName = String((modelAttribute == null ? void 0 : modelAttribute.field) || leafFieldName).trim();
250
+ if (columnName && columnName !== leafFieldName) {
251
+ return null;
252
+ }
253
+ }
254
+ return {
255
+ associationPath,
256
+ leafFieldName,
257
+ selectedSubfieldPath: selectedParts.join("."),
258
+ supportedFields: getChartBuilderSupportedRelationSubfields(associationPath, input.targetCollection)
259
+ };
260
+ }
261
+ function getUnsupportedChartBuilderRelationSubfieldDetails(input) {
262
+ const leafFieldName = String(input.leafFieldName || "").trim();
263
+ if (!input.targetCollection || !leafFieldName || input.leafField && isAssociationField(input.leafField)) {
264
+ return null;
265
+ }
266
+ const modelAttributes = getCollectionModelAttributes(input.targetCollection);
267
+ if (!input.leafField && !Object.prototype.hasOwnProperty.call(modelAttributes, leafFieldName)) {
268
+ return null;
269
+ }
270
+ const columnName = getCollectionFieldColumnName(input.targetCollection, leafFieldName);
271
+ if (!columnName || columnName === leafFieldName) {
272
+ return null;
273
+ }
274
+ return {
275
+ associationPath: String(input.associationPathName || "").trim(),
276
+ leafFieldName,
277
+ columnName,
278
+ supportedFields: getChartBuilderSupportedRelationSubfields(input.associationPathName, input.targetCollection)
279
+ };
280
+ }
181
281
  function resolveAssociationNameFromField(field, fallbackCollection) {
182
282
  const resourceName = typeof (field == null ? void 0 : field.resourceName) === "string" ? field.resourceName.trim() : "";
183
283
  if (resourceName) {
@@ -309,8 +409,11 @@ function getAssociationFilterTargetKey(field, targetCollection) {
309
409
  buildFilterFieldMeta,
310
410
  buildFlowTemplateSearchFilter,
311
411
  dedupeVisibleFieldCandidates,
412
+ formatChartBuilderSupportedRelationSubfields,
312
413
  getAssociationFilterTargetKey,
414
+ getChartBuilderSupportedRelationSubfields,
313
415
  getCollectionFields,
416
+ getCollectionModelAttributes,
314
417
  getCollectionName,
315
418
  getCollectionTitle,
316
419
  getCollectionTitleFieldName,
@@ -320,6 +423,8 @@ function getAssociationFilterTargetKey(field, targetCollection) {
320
423
  getFieldTarget,
321
424
  getFieldTitle,
322
425
  getFieldType,
426
+ getInvalidChartBuilderRelationDirectSubfieldDetails,
427
+ getUnsupportedChartBuilderRelationSubfieldDetails,
323
428
  hasConfiguredFlowContextValue,
324
429
  inferAssociationLeafDisplayFieldUse,
325
430
  inferFieldMenuEditableFieldUse,
@@ -75,6 +75,8 @@ export type NormalizedComposeFieldSpec = {
75
75
  pageSize?: number;
76
76
  showIndex?: boolean;
77
77
  target?: string;
78
+ defaultTargetUid?: string;
79
+ targetBlockUid?: string;
78
80
  settings: Record<string, any>;
79
81
  popup?: Record<string, any>;
80
82
  __autoPopupForRelationField?: boolean;
@@ -102,17 +104,29 @@ export declare function hasLegacyLocatorFields(input: any, options?: {
102
104
  }): boolean;
103
105
  export declare function rethrowInlineConfigurationError(error: any, prefix: string): never;
104
106
  export declare function toFlowSurfaceBatchItemError(error: any): {
105
- code: string;
106
107
  message: string;
108
+ errorCount: number;
109
+ details: {
110
+ requiredBlockPolicy?: {
111
+ requiredBlockTypes: string[];
112
+ fixStrategy: string;
113
+ doNotReplaceOrDrop: boolean;
114
+ };
115
+ errorCount: number;
116
+ mustFixAllErrorsBeforeRetry: boolean;
117
+ retryPolicy: string;
118
+ sameWriteRetryRequired: boolean;
119
+ agentInstruction: string;
120
+ };
121
+ errors: import("./errors").FlowSurfaceErrorItem[];
122
+ code: string;
107
123
  status: number;
108
124
  type: import("./errors").FlowSurfaceErrorType;
109
- errors: import("./errors").FlowSurfaceErrorItem[];
110
125
  } | {
111
126
  code: string;
112
127
  message: string;
113
128
  status: number;
114
129
  type: import("./errors").FlowSurfaceErrorType;
115
- errors?: undefined;
116
130
  };
117
131
  export declare function splitComposeFieldChanges(changes: Record<string, any>, wrapperUse?: string): {
118
132
  wrapperChanges: _.Dictionary<any>;
@@ -410,6 +410,12 @@ function normalizeComposeFieldSpec(input, index) {
410
410
  if (!import_lodash.default.isUndefined(input.target) && typeof input.target !== "string") {
411
411
  (0, import_errors.throwBadRequest)(`flowSurfaces compose field #${index + 1} target must be a string block key`);
412
412
  }
413
+ if (!import_lodash.default.isUndefined(input.defaultTargetUid) && typeof input.defaultTargetUid !== "string") {
414
+ (0, import_errors.throwBadRequest)(`flowSurfaces compose field #${index + 1} defaultTargetUid must be a string`);
415
+ }
416
+ if (!import_lodash.default.isUndefined(input.targetBlockUid) && typeof input.targetBlockUid !== "string") {
417
+ (0, import_errors.throwBadRequest)(`flowSurfaces compose field #${index + 1} targetBlockUid must be a string`);
418
+ }
413
419
  const rawKey = String(input.key || semanticType || (renderer === "js" ? `js:${fieldPath}` : fieldPath)).trim();
414
420
  const key = normalizeFlowSurfaceComposeKey(rawKey, `flowSurfaces compose field #${index + 1}`);
415
421
  const popupDefaultsMetadata = import_lodash.default.isPlainObject(input[import_defaults.FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY]) ? input[import_defaults.FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY] : void 0;
@@ -428,6 +434,8 @@ function normalizeComposeFieldSpec(input, index) {
428
434
  ...!import_lodash.default.isUndefined(pageSize) && Number.isFinite(pageSize) ? { pageSize } : {},
429
435
  ...!import_lodash.default.isUndefined(showIndex) ? { showIndex } : {},
430
436
  target: typeof input.target === "string" ? String(input.target || "").trim() || void 0 : void 0,
437
+ defaultTargetUid: typeof input.defaultTargetUid === "string" ? String(input.defaultTargetUid || "").trim() || void 0 : void 0,
438
+ targetBlockUid: typeof input.targetBlockUid === "string" ? String(input.targetBlockUid || "").trim() || void 0 : void 0,
431
439
  settings: import_lodash.default.isPlainObject(input.settings) ? input.settings : {},
432
440
  popup: import_lodash.default.isPlainObject(input.popup) ? input.popup : void 0,
433
441
  __autoPopupForRelationField: input.__autoPopupForRelationField === true,
@@ -612,12 +620,14 @@ function hasLegacyLocatorFields(input, options = {}) {
612
620
  return keys.some((key) => Object.prototype.hasOwnProperty.call(input, key));
613
621
  }
614
622
  function rethrowInlineConfigurationError(error, prefix) {
615
- const childMessages = (0, import_errors.isFlowSurfaceAggregateError)(error) ? error.errors.map((item) => item.message).filter(Boolean) : [];
616
- const message = `${prefix}: ${[(error == null ? void 0 : error.message) || String(error), ...childMessages].join("; ")}`;
623
+ if ((0, import_errors.isFlowSurfaceAggregateError)(error)) {
624
+ throw new import_errors.FlowSurfaceAggregateError(error.errors, `${prefix}: ${error.message}`);
625
+ }
626
+ const message = `${prefix}: ${(error == null ? void 0 : error.message) || String(error)}`;
617
627
  if ((0, import_errors.isFlowSurfaceError)(error)) {
618
628
  const normalized = (0, import_errors.normalizeFlowSurfaceError)(error);
619
629
  if (normalized.type === "bad_request") {
620
- (0, import_errors.throwBadRequest)(message, normalized.code);
630
+ (0, import_errors.throwBadRequest)(message, normalized.code, normalized.options);
621
631
  }
622
632
  if (normalized.type === "conflict") {
623
633
  (0, import_errors.throwConflict)(message, normalized.code);
@@ -633,10 +643,9 @@ function toFlowSurfaceBatchItemError(error) {
633
643
  if ((0, import_errors.isFlowSurfaceAggregateError)(error)) {
634
644
  return {
635
645
  code: error.code,
636
- message: error.message,
637
646
  status: error.status,
638
647
  type: error.type,
639
- errors: error.errors
648
+ ...error.toResponseBody()
640
649
  };
641
650
  }
642
651
  const normalized = (0, import_errors.normalizeFlowSurfaceError)(error);
@@ -9,13 +9,20 @@
9
9
  import type { Plugin } from '@nocobase/server';
10
10
  import _ from 'lodash';
11
11
  import FlowModelRepository from '../repository';
12
+ import type { FlowSurfaceApplyBlueprintDocument } from './blueprint';
12
13
  import { SurfaceLocator } from './locator';
14
+ import { type FlowSurfaceEventFlowRegistry } from './event-flow-normalizer';
13
15
  import type { TemplateTranslate } from './template-display';
14
16
  import type { FlowSurfaceActionLinkageRule, FlowSurfaceBlockLinkageRule, FlowSurfaceFieldLinkageRule, FlowSurfaceFieldValueRule, FlowSurfaceGetReactionMetaResult, FlowSurfaceGetReactionMetaValues, FlowSurfaceReactionWriteResult, FlowSurfaceReactionWriteValues } from './reaction/types';
15
17
  import type { FlowSurfaceTemplateListPopupActionContext, FlowSurfaceTemplateListValues, FlowSurfaceTemplateRow } from './template-service-utils';
16
- import type { FlowSurfaceApplyValues, FlowSurfaceCatalogResponse, FlowSurfaceCatalogValues, FlowSurfaceComposeValues, FlowSurfaceConfigureValues, FlowSurfaceContextValues, FlowSurfaceDescribeValues, FlowSurfaceMutateValues } from './types';
18
+ import type { FlowSurfaceApplyValues, FlowSurfaceActionScope, FlowSurfaceCatalogResponse, FlowSurfaceCatalogValues, FlowSurfaceComposeValues, FlowSurfaceConfigureValues, FlowSurfaceContextValues, FlowSurfaceDescribeValues, FlowSurfaceMutateValues } from './types';
19
+ import type { FlowSurfaceContextResponse, FlowSurfaceContextVarInfo } from './types';
17
20
  type FlowSurfacePopupTemplateAliasSession = Map<string, string>;
18
21
  type FlowSurfaceRequestRoles = readonly string[] | string;
22
+ type FlowSurfaceReadOptions = {
23
+ transaction?: any;
24
+ currentRoles?: FlowSurfaceRequestRoles;
25
+ };
19
26
  type FlowSurfaceAddFieldResult = {
20
27
  uid?: string;
21
28
  parentUid?: string;
@@ -34,6 +41,12 @@ type FlowSurfaceAddFieldResult = {
34
41
  popupGridUid?: string;
35
42
  };
36
43
  type FlowSurfacePopupTemplateTreeCache = Map<string, Promise<any | null> | any | null>;
44
+ type FlowSurfaceApplyBlueprintResponse = {
45
+ version: '1';
46
+ mode: FlowSurfaceApplyBlueprintDocument['mode'];
47
+ target: Record<string, any>;
48
+ surface: any;
49
+ };
37
50
  export declare class FlowSurfacesService {
38
51
  private readonly plugin;
39
52
  constructor(plugin: Plugin);
@@ -61,12 +74,17 @@ export declare class FlowSurfacesService {
61
74
  private readRouteOptions;
62
75
  private findMenuRouteById;
63
76
  private findMenuGroupRoutesByTitle;
77
+ private routeParentIdMatches;
78
+ private findMenuGroupRoutesByParentIdAndTitle;
64
79
  private findFlowPageRoutesByParentIdAndTitle;
65
80
  private assertMenuParentIsGroup;
66
81
  private assertMenuRouteBindable;
67
82
  private assertMenuRouteUpdatable;
68
83
  private assertMenuParentNotSelfOrDescendant;
69
84
  private buildMenuResult;
85
+ private isValidMenuIconName;
86
+ private assertVisibleNavigationIcon;
87
+ private assertVisibleNavigationRouteIconUpdate;
70
88
  private createFlowMenuGroup;
71
89
  private createFlowMenuItem;
72
90
  private sanitizePublicCreateMenuValues;
@@ -129,7 +147,7 @@ export declare class FlowSurfacesService {
129
147
  private buildAssociatedRecordsResourceInit;
130
148
  context(values: FlowSurfaceContextValues, options?: {
131
149
  transaction?: any;
132
- }): Promise<import("./types").FlowSurfaceContextResponse>;
150
+ }): Promise<FlowSurfaceContextResponse>;
133
151
  private extractReactionCanonicalRules;
134
152
  private buildReactionFieldPathMaps;
135
153
  private extractReactionFieldPaths;
@@ -162,9 +180,7 @@ export declare class FlowSurfacesService {
162
180
  private stripInternalSurfaceMetaFromNodeTree;
163
181
  private buildSurfaceReadPayload;
164
182
  private buildSurfaceContextFingerprint;
165
- get(input: Record<string, any>, options?: {
166
- transaction?: any;
167
- }): Promise<Record<string, any>>;
183
+ get(input: Record<string, any>, options?: FlowSurfaceReadOptions): Promise<Record<string, any>>;
168
184
  private getDeclaredKeyPersistenceDeps;
169
185
  private patchDeclaredKeyModel;
170
186
  private persistCreatedKeysForAction;
@@ -177,6 +193,11 @@ export declare class FlowSurfacesService {
177
193
  private resolveApplyBlueprintCreateNavigationGroup;
178
194
  private resolveApplyBlueprintCreatePageIdentity;
179
195
  private prepareApplyBlueprintRequest;
196
+ private prevalidateApplyBlueprintChartAssets;
197
+ private composeChartBlockHasInlineConfig;
198
+ private prepareComposeChartAssetNestedPopupBlocks;
199
+ private prepareComposeChartAssetBlockList;
200
+ private prepareComposeChartAssetSettings;
180
201
  private getApplyBlueprintKanbanBlockResourceObject;
181
202
  private normalizeApplyBlueprintKanbanResourceText;
182
203
  private getApplyBlueprintKanbanBlockBinding;
@@ -201,13 +222,11 @@ export declare class FlowSurfacesService {
201
222
  applyBlueprint(values: Record<string, any>, options?: {
202
223
  transaction?: any;
203
224
  currentRoles?: FlowSurfaceRequestRoles;
204
- }): Promise<{
205
- version: string;
206
- mode: import("./blueprint").FlowSurfaceApplyBlueprintMode;
207
- target: _.Dictionary<any>;
208
- surface: Record<string, any>;
209
- }>;
225
+ }): Promise<FlowSurfaceApplyBlueprintResponse>;
226
+ private applyBlueprintMutationWithoutExternalTransaction;
227
+ private assertApplyBlueprintAuthoringPayload;
210
228
  private applyBlueprintWithTransaction;
229
+ private buildApplyBlueprintResponse;
211
230
  private findApprovalSurfaceRootForNode;
212
231
  private syncApprovalRuntimeConfigForSurfaceRoot;
213
232
  private syncApprovalRuntimeConfigForNode;
@@ -456,7 +475,7 @@ export declare class FlowSurfacesService {
456
475
  uid: any;
457
476
  parentUid: any;
458
477
  subKey: string;
459
- scope: import("./types").FlowSurfaceActionScope;
478
+ scope: FlowSurfaceActionScope;
460
479
  }>;
461
480
  addRecordAction(values: Record<string, any>, options?: {
462
481
  transaction?: any;
@@ -469,7 +488,7 @@ export declare class FlowSurfacesService {
469
488
  uid: any;
470
489
  parentUid: any;
471
490
  subKey: string;
472
- scope: import("./types").FlowSurfaceActionScope;
491
+ scope: FlowSurfaceActionScope;
473
492
  }>;
474
493
  addBlocks(values: Record<string, any>): Promise<{
475
494
  [x: string]: number | Record<string, any>[];
@@ -559,6 +578,7 @@ export declare class FlowSurfacesService {
559
578
  private resolveDefaultActionPopupTemplateOpenViewTitle;
560
579
  private buildInlinePopupTemplateOpenView;
561
580
  private peekInlineFieldSettingsOpenView;
581
+ private isInlineFieldClickToOpenEnabled;
562
582
  private assertOpenViewUidTarget;
563
583
  private normalizeFlowTemplateMode;
564
584
  private normalizeFlowTemplateUsage;
@@ -593,6 +613,11 @@ export declare class FlowSurfacesService {
593
613
  private tryResolvePopupTemplateForHost;
594
614
  private tryResolveExistingDefaultActionPopupTemplate;
595
615
  private getFlowTemplateOrThrow;
616
+ private shouldUseRuntimeRecordFilterByTkForOpenView;
617
+ private resolveOpenViewFilterTargetKey;
618
+ private resolvePopupHostCurrentRecordFilterTargetKey;
619
+ private resolveOpenViewRuntimeRecordFilterTargetKey;
620
+ private shouldOmitRuntimeRecordFilterByTk;
596
621
  private buildPopupTemplateOpenView;
597
622
  private isReferencedPopupTemplateOpenView;
598
623
  private isPopupTemplateReferenceOpenViewState;
@@ -622,6 +647,7 @@ export declare class FlowSurfacesService {
622
647
  private getActionButtonTitle;
623
648
  private isSemanticallyEmptyInlinePopup;
624
649
  private isEmptyInlinePopupPayload;
650
+ private isInlineFieldPopupDefaultShell;
625
651
  private shouldAutoCompleteDefaultFieldPopup;
626
652
  private isInlineFieldPopupBlockMissingResource;
627
653
  private buildRelationFieldPopupCurrentRecordResource;
@@ -727,6 +753,7 @@ export declare class FlowSurfacesService {
727
753
  private normalizeChartSelectionFieldPath;
728
754
  private validateBuilderChartFieldsForRuntime;
729
755
  private resolveBuilderChartAssociationSubfieldSuggestion;
756
+ private validateChartConfigureForRuntime;
730
757
  private stripChartSqlForInspection;
731
758
  private normalizeReadOnlyChartSql;
732
759
  private buildChartSqlPreviewQuery;
@@ -746,7 +773,7 @@ export declare class FlowSurfacesService {
746
773
  kind: import("./types").FlowSurfaceContainerKind;
747
774
  use: any;
748
775
  };
749
- flowRegistry: any;
776
+ flowRegistry: FlowSurfaceEventFlowRegistry;
750
777
  events: {
751
778
  direct: string[];
752
779
  object: string[];
@@ -773,7 +800,7 @@ export declare class FlowSurfacesService {
773
800
  additionalProperties: boolean;
774
801
  };
775
802
  }[];
776
- vars: Record<string, import("./types").FlowSurfaceContextVarInfo>;
803
+ vars: Record<string, FlowSurfaceContextVarInfo>;
777
804
  fingerprint: string;
778
805
  writeCapabilities: {
779
806
  defaultAddPhase: string;
@@ -817,6 +844,7 @@ export declare class FlowSurfacesService {
817
844
  }>;
818
845
  private resolveEventFlowTarget;
819
846
  private getEventFlowRegistry;
847
+ private normalizeEventFlowRegistry;
820
848
  private buildEventFlowFingerprint;
821
849
  private assertEventFlowFingerprint;
822
850
  private normalizeEventFlowKey;
@@ -942,6 +970,10 @@ export declare class FlowSurfacesService {
942
970
  private buildAutoComposeFieldsLayout;
943
971
  private normalizeComposeFieldGroups;
944
972
  private applyDefaultActionsForCreatedBlock;
973
+ private hasActionWithPublicType;
974
+ private ensureTableDefaultActionIntegrity;
975
+ private collectNodeTreeDescendants;
976
+ private ensureSurfaceTableDefaultActionIntegrity;
945
977
  private resolveReusableSingletonAction;
946
978
  private normalizeComposeBlock;
947
979
  private normalizeComposeBlocks;
@@ -1002,10 +1034,20 @@ export declare class FlowSurfacesService {
1002
1034
  private normalizeActionAssignValues;
1003
1035
  private normalizeActionTriggerWorkflows;
1004
1036
  private isAIEmployeeActionUse;
1037
+ private stableSerializeAIEmployeeValue;
1038
+ private buildAIEmployeeActionDedupIdentity;
1039
+ private normalizeAIEmployeeWorkContextForDedupIdentity;
1040
+ private normalizeAIEmployeeTasksForDedupIdentity;
1041
+ private assertNoDuplicateAIEmployeeAction;
1005
1042
  private hasAIEmployeePublicSettings;
1006
1043
  private assertOnlyAIEmployeePublicSettings;
1044
+ private aiEmployeeNestedRepairHint;
1007
1045
  private assertOnlyAIEmployeeNestedPublicSettings;
1008
1046
  private assertNoAIEmployeeInternalPropSettings;
1047
+ private readAIEmployeePersistedTasks;
1048
+ private buildAIEmployeeTaskStepParams;
1049
+ private mergeAIEmployeeActionSettingsPayload;
1050
+ private syncAIEmployeeTaskStepParamsForUpdateSettings;
1009
1051
  private assertAIEmployeePluginEnabled;
1010
1052
  private readRecordPlainObject;
1011
1053
  private readRecordField;
@@ -1017,6 +1059,23 @@ export declare class FlowSurfacesService {
1017
1059
  private normalizeAIEmployeeWorkContext;
1018
1060
  private normalizeAIEmployeeTaskModel;
1019
1061
  private normalizeAIEmployeeSkillSettings;
1062
+ private collectAIEmployeePromptVariables;
1063
+ private hasAIEmployeePromptVariables;
1064
+ private collectAIEmployeeContextPathEntries;
1065
+ private isAIEmployeeContextInfoPathAllowed;
1066
+ private canResolveAIEmployeeContextPath;
1067
+ private isAIEmployeeContextPathAllowed;
1068
+ private extractAIEmployeePromptContextPath;
1069
+ private buildAIEmployeePromptVariableHint;
1070
+ private throwAIEmployeePromptVariableInvalid;
1071
+ private assertAIEmployeePromptVariablesAllowed;
1072
+ private assertAIEmployeeTaskPromptVariablesAllowed;
1073
+ private appendAIEmployeeCurrentRecordPromptVariable;
1074
+ private resolveAIEmployeePromptActionTargetUid;
1075
+ private buildAIEmployeePromptValidationContext;
1076
+ private appendAIEmployeeCurrentRecordPromptVariableToTasks;
1077
+ private assertAIEmployeeStepParamTaskPromptVariablesAllowedForUpdateSettings;
1078
+ private normalizeAIEmployeeStepParamTasksForUpdateSettings;
1020
1079
  private normalizeAIEmployeeTaskMessage;
1021
1080
  private normalizeAIEmployeeTaskPatch;
1022
1081
  private normalizeAIEmployeeTasks;