@nocobase/plugin-flow-engine 2.1.0-beta.43 → 2.1.0-beta.45

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 (90) 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/authoring-validation.js +160 -21
  10. package/dist/server/flow-surfaces/catalog.js +9 -5
  11. package/dist/server/flow-surfaces/chart-config.js +29 -6
  12. package/dist/server/flow-surfaces/contract-guard.js +39 -5
  13. package/dist/server/flow-surfaces/default-block-actions.js +2 -0
  14. package/dist/server/flow-surfaces/errors.d.ts +15 -0
  15. package/dist/server/flow-surfaces/errors.js +49 -3
  16. package/dist/server/flow-surfaces/filter-group.d.ts +7 -1
  17. package/dist/server/flow-surfaces/filter-group.js +175 -71
  18. package/dist/server/flow-surfaces/public-data-surface-default-filter.js +2 -1
  19. package/dist/server/flow-surfaces/runjs-authoring/ast/bindings.d.ts +66 -0
  20. package/dist/server/flow-surfaces/runjs-authoring/ast/bindings.js +661 -0
  21. package/dist/server/flow-surfaces/runjs-authoring/ast/execution.d.ts +20 -0
  22. package/dist/server/flow-surfaces/runjs-authoring/ast/execution.js +275 -0
  23. package/dist/server/flow-surfaces/runjs-authoring/ast/parser.d.ts +16 -0
  24. package/dist/server/flow-surfaces/runjs-authoring/ast/parser.js +130 -0
  25. package/dist/server/flow-surfaces/runjs-authoring/ast/react-values.d.ts +20 -0
  26. package/dist/server/flow-surfaces/runjs-authoring/ast/react-values.js +401 -0
  27. package/dist/server/flow-surfaces/runjs-authoring/ast/request-config.d.ts +21 -0
  28. package/dist/server/flow-surfaces/runjs-authoring/ast/request-config.js +199 -0
  29. package/dist/server/flow-surfaces/runjs-authoring/ast/source.d.ts +70 -0
  30. package/dist/server/flow-surfaces/runjs-authoring/ast/source.js +895 -0
  31. package/dist/server/flow-surfaces/runjs-authoring/ast/static-bindings.d.ts +23 -0
  32. package/dist/server/flow-surfaces/runjs-authoring/ast/static-bindings.js +618 -0
  33. package/dist/server/flow-surfaces/runjs-authoring/ast/static-values.d.ts +196 -0
  34. package/dist/server/flow-surfaces/runjs-authoring/ast/static-values.js +1777 -0
  35. package/dist/server/flow-surfaces/runjs-authoring/ast/walk.d.ts +10 -0
  36. package/dist/server/flow-surfaces/runjs-authoring/ast/walk.js +55 -0
  37. package/dist/server/flow-surfaces/runjs-authoring/collectors.d.ts +12 -0
  38. package/dist/server/flow-surfaces/runjs-authoring/collectors.js +589 -0
  39. package/dist/server/flow-surfaces/runjs-authoring/index.d.ts +2 -25
  40. package/dist/server/flow-surfaces/runjs-authoring/index.js +5 -11138
  41. package/dist/server/flow-surfaces/runjs-authoring/inspect.d.ts +13 -0
  42. package/dist/server/flow-surfaces/runjs-authoring/inspect.js +149 -0
  43. package/dist/server/flow-surfaces/runjs-authoring/internal-types.d.ts +333 -0
  44. package/dist/server/flow-surfaces/runjs-authoring/internal-types.js +36 -0
  45. package/dist/server/flow-surfaces/runjs-authoring/rules.js +2 -0
  46. package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.d.ts +67 -0
  47. package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.js +757 -0
  48. package/dist/server/flow-surfaces/runjs-authoring/runtime/errors.d.ts +22 -0
  49. package/dist/server/flow-surfaces/runjs-authoring/runtime/errors.js +91 -0
  50. package/dist/server/flow-surfaces/runjs-authoring/runtime/source-budget.d.ts +16 -0
  51. package/dist/server/flow-surfaces/runjs-authoring/runtime/source-budget.js +115 -0
  52. package/dist/server/flow-surfaces/runjs-authoring/runtime/surface.d.ts +19 -0
  53. package/dist/server/flow-surfaces/runjs-authoring/runtime/surface.js +140 -0
  54. package/dist/server/flow-surfaces/runjs-authoring/runtime/types.d.ts +91 -0
  55. package/dist/server/flow-surfaces/runjs-authoring/runtime/types.js +24 -0
  56. package/dist/server/flow-surfaces/runjs-authoring/scan/ctx-api.d.ts +138 -0
  57. package/dist/server/flow-surfaces/runjs-authoring/scan/ctx-api.js +1779 -0
  58. package/dist/server/flow-surfaces/runjs-authoring/scan/filter.d.ts +10 -0
  59. package/dist/server/flow-surfaces/runjs-authoring/scan/filter.js +1583 -0
  60. package/dist/server/flow-surfaces/runjs-authoring/scan/index.d.ts +195 -0
  61. package/dist/server/flow-surfaces/runjs-authoring/scan/index.js +463 -0
  62. package/dist/server/flow-surfaces/runjs-authoring/scan/react-render.d.ts +48 -0
  63. package/dist/server/flow-surfaces/runjs-authoring/scan/react-render.js +379 -0
  64. package/dist/server/flow-surfaces/runjs-authoring/scan/react.d.ts +26 -0
  65. package/dist/server/flow-surfaces/runjs-authoring/scan/react.js +1441 -0
  66. package/dist/server/flow-surfaces/runjs-authoring/scan/resource.d.ts +23 -0
  67. package/dist/server/flow-surfaces/runjs-authoring/scan/resource.js +1427 -0
  68. package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.d.ts +91 -0
  69. package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.js +889 -0
  70. package/dist/server/flow-surfaces/runjs-authoring/types.d.ts +1 -1
  71. package/dist/server/flow-surfaces/runjs-authoring/unknown-global-stop/index.d.ts +10 -0
  72. package/dist/server/flow-surfaces/runjs-authoring/unknown-global-stop/index.js +40 -0
  73. package/dist/server/flow-surfaces/runjs-authoring/validators/index.d.ts +12 -0
  74. package/dist/server/flow-surfaces/runjs-authoring/validators/index.js +887 -0
  75. package/dist/server/flow-surfaces/service-helpers.d.ts +29 -0
  76. package/dist/server/flow-surfaces/service-helpers.js +105 -0
  77. package/dist/server/flow-surfaces/service-utils.d.ts +15 -3
  78. package/dist/server/flow-surfaces/service-utils.js +5 -4
  79. package/dist/server/flow-surfaces/service.d.ts +4 -0
  80. package/dist/server/flow-surfaces/service.js +360 -30
  81. package/dist/server/flow-surfaces/types.d.ts +3 -0
  82. package/dist/server/repository.d.ts +15 -1
  83. package/dist/server/repository.js +262 -23
  84. package/dist/server/template/contexts.d.ts +2 -0
  85. package/dist/server/template/contexts.js +34 -0
  86. package/dist/server/template/resolver.js +233 -22
  87. package/dist/swagger/flow-surfaces.d.ts +175 -0
  88. package/dist/swagger/flow-surfaces.js +130 -51
  89. package/dist/swagger/index.d.ts +175 -0
  90. 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,
@@ -104,17 +104,29 @@ export declare function hasLegacyLocatorFields(input: any, options?: {
104
104
  }): boolean;
105
105
  export declare function rethrowInlineConfigurationError(error: any, prefix: string): never;
106
106
  export declare function toFlowSurfaceBatchItemError(error: any): {
107
- code: string;
108
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;
109
123
  status: number;
110
124
  type: import("./errors").FlowSurfaceErrorType;
111
- errors: import("./errors").FlowSurfaceErrorItem[];
112
125
  } | {
113
126
  code: string;
114
127
  message: string;
115
128
  status: number;
116
129
  type: import("./errors").FlowSurfaceErrorType;
117
- errors?: undefined;
118
130
  };
119
131
  export declare function splitComposeFieldChanges(changes: Record<string, any>, wrapperUse?: string): {
120
132
  wrapperChanges: _.Dictionary<any>;
@@ -620,8 +620,10 @@ function hasLegacyLocatorFields(input, options = {}) {
620
620
  return keys.some((key) => Object.prototype.hasOwnProperty.call(input, key));
621
621
  }
622
622
  function rethrowInlineConfigurationError(error, prefix) {
623
- const childMessages = (0, import_errors.isFlowSurfaceAggregateError)(error) ? error.errors.map((item) => item.message).filter(Boolean) : [];
624
- 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)}`;
625
627
  if ((0, import_errors.isFlowSurfaceError)(error)) {
626
628
  const normalized = (0, import_errors.normalizeFlowSurfaceError)(error);
627
629
  if (normalized.type === "bad_request") {
@@ -641,10 +643,9 @@ function toFlowSurfaceBatchItemError(error) {
641
643
  if ((0, import_errors.isFlowSurfaceAggregateError)(error)) {
642
644
  return {
643
645
  code: error.code,
644
- message: error.message,
645
646
  status: error.status,
646
647
  type: error.type,
647
- errors: error.errors
648
+ ...error.toResponseBody()
648
649
  };
649
650
  }
650
651
  const normalized = (0, import_errors.normalizeFlowSurfaceError)(error);
@@ -194,6 +194,10 @@ export declare class FlowSurfacesService {
194
194
  private resolveApplyBlueprintCreatePageIdentity;
195
195
  private prepareApplyBlueprintRequest;
196
196
  private prevalidateApplyBlueprintChartAssets;
197
+ private composeChartBlockHasInlineConfig;
198
+ private prepareComposeChartAssetNestedPopupBlocks;
199
+ private prepareComposeChartAssetBlockList;
200
+ private prepareComposeChartAssetSettings;
197
201
  private getApplyBlueprintKanbanBlockResourceObject;
198
202
  private normalizeApplyBlueprintKanbanResourceText;
199
203
  private getApplyBlueprintKanbanBlockBinding;