@nocobase/plugin-flow-engine 2.1.0-beta.41 → 2.1.0-beta.42
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.
- package/dist/externalVersion.js +9 -9
- package/dist/node_modules/@ant-design/icons-svg/package.json +1 -1
- package/dist/node_modules/acorn/package.json +1 -1
- package/dist/node_modules/acorn-jsx/package.json +1 -1
- package/dist/node_modules/acorn-walk/package.json +1 -1
- package/dist/node_modules/ses/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/flow-surfaces/apply/compiler.js +10 -11
- package/dist/server/flow-surfaces/authoring-validation.d.ts +1 -0
- package/dist/server/flow-surfaces/authoring-validation.js +614 -6
- package/dist/server/flow-surfaces/blueprint/normalize-document.js +5 -1
- package/dist/server/flow-surfaces/chart-config.js +192 -11
- package/dist/server/flow-surfaces/contract-guard.js +1 -1
- package/dist/server/flow-surfaces/event-flow-normalizer.d.ts +19 -0
- package/dist/server/flow-surfaces/event-flow-normalizer.js +128 -0
- package/dist/server/flow-surfaces/filter-group.d.ts +2 -0
- package/dist/server/flow-surfaces/filter-group.js +295 -0
- package/dist/server/flow-surfaces/route-sync.js +19 -2
- package/dist/server/flow-surfaces/service-utils.js +1 -1
- package/dist/server/flow-surfaces/service.d.ts +3 -1
- package/dist/server/flow-surfaces/service.js +128 -64
- package/package.json +2 -2
|
@@ -81,6 +81,7 @@ var import_placement = require("./placement");
|
|
|
81
81
|
var import_route_sync = require("./route-sync");
|
|
82
82
|
var import_surface_context = require("./surface-context");
|
|
83
83
|
var import_context = require("./context");
|
|
84
|
+
var import_event_flow_normalizer = require("./event-flow-normalizer");
|
|
84
85
|
var import_configure_options = require("./configure-options");
|
|
85
86
|
var import_public_compatibility = require("./public-compatibility");
|
|
86
87
|
var import_support_matrix = require("./support-matrix");
|
|
@@ -103,14 +104,38 @@ var import_template_service_utils = require("./template-service-utils");
|
|
|
103
104
|
var import_hidden_popup_contract = require("./hidden-popup-contract");
|
|
104
105
|
var import_hidden_popup_calendar = require("./hidden-popup-calendar");
|
|
105
106
|
var import_hidden_popup_kanban = require("./hidden-popup-kanban");
|
|
106
|
-
const FLOW_SURFACE_CHART_REPAIR_HINT = "This is a chart payload shape problem.
|
|
107
|
+
const FLOW_SURFACE_CHART_REPAIR_HINT = "This is a chart payload shape problem. Keep using chart and repair the current chart block payload using assets.charts.<key>.query/visual plus block.chart, or localized settings.query/settings.visual. Do not change this block type to table, jsBlock, actionPanel, gridCard, or another block type. Do not drop or defer the chart. KPI / summary numbers should use jsBlock; charts are for trends, distributions, rankings, and visual analysis.";
|
|
107
108
|
const FLOW_SURFACE_CHART_REPAIR_STEPS = [
|
|
108
109
|
"Keep the block type as chart.",
|
|
109
|
-
"Define assets.charts.<key>.query and assets.charts.<key>.visual, or
|
|
110
|
+
"Define assets.charts.<key>.query and assets.charts.<key>.visual, or fill localized settings.query and settings.visual on the existing chart block.",
|
|
110
111
|
"Reference the asset from the chart block with block.chart = <key> when using assets.charts.",
|
|
111
112
|
"Retry the chart payload instead of replacing the chart with another block type, omitting it, or deferring it."
|
|
112
113
|
];
|
|
113
114
|
const FLOW_SURFACE_CHART_EXPECTED_SHAPE = {
|
|
115
|
+
settings: {
|
|
116
|
+
query: {
|
|
117
|
+
mode: "builder",
|
|
118
|
+
resource: {
|
|
119
|
+
dataSourceKey: "main",
|
|
120
|
+
collectionName: "employees"
|
|
121
|
+
},
|
|
122
|
+
measures: [
|
|
123
|
+
{
|
|
124
|
+
field: "id",
|
|
125
|
+
aggregation: "count",
|
|
126
|
+
alias: "employeeCount"
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
visual: {
|
|
131
|
+
mode: "basic",
|
|
132
|
+
type: "bar",
|
|
133
|
+
mappings: {
|
|
134
|
+
x: "status",
|
|
135
|
+
y: "employeeCount"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
114
139
|
assets: {
|
|
115
140
|
charts: {
|
|
116
141
|
chartKey: {
|
|
@@ -126,29 +151,80 @@ const FLOW_SURFACE_CHART_EXPECTED_SHAPE = {
|
|
|
126
151
|
};
|
|
127
152
|
const FLOW_SURFACE_CHART_FORBIDDEN_FALLBACKS = [
|
|
128
153
|
"table",
|
|
154
|
+
"list",
|
|
129
155
|
"jsBlock",
|
|
130
156
|
"actionPanel",
|
|
131
157
|
"gridCard",
|
|
158
|
+
"markdown",
|
|
132
159
|
"drop chart",
|
|
133
160
|
"defer chart"
|
|
134
161
|
];
|
|
162
|
+
const FLOW_SURFACE_CHART_REPAIR_EXAMPLE = {
|
|
163
|
+
settings: {
|
|
164
|
+
query: {
|
|
165
|
+
mode: "builder",
|
|
166
|
+
resource: {
|
|
167
|
+
dataSourceKey: "main",
|
|
168
|
+
collectionName: "<collectionName>"
|
|
169
|
+
},
|
|
170
|
+
measures: [
|
|
171
|
+
{
|
|
172
|
+
field: "id",
|
|
173
|
+
aggregation: "count",
|
|
174
|
+
alias: "recordCount"
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
dimensions: [
|
|
178
|
+
{
|
|
179
|
+
field: "<dimensionField>"
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
visual: {
|
|
184
|
+
mode: "basic",
|
|
185
|
+
type: "bar",
|
|
186
|
+
mappings: {
|
|
187
|
+
x: "<dimensionField>",
|
|
188
|
+
y: "recordCount"
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
};
|
|
135
193
|
function withChartRepairMessage(message) {
|
|
136
194
|
return `${message}. ${FLOW_SURFACE_CHART_REPAIR_HINT}`;
|
|
137
195
|
}
|
|
138
196
|
function withFlowSurfaceChartRepairDetails(details = {}) {
|
|
139
197
|
return {
|
|
140
198
|
...details,
|
|
199
|
+
requiredBlockType: "chart",
|
|
200
|
+
fixStrategy: "repair_same_block_type",
|
|
141
201
|
repairHint: FLOW_SURFACE_CHART_REPAIR_HINT,
|
|
142
202
|
repairSteps: FLOW_SURFACE_CHART_REPAIR_STEPS,
|
|
143
203
|
expectedShape: FLOW_SURFACE_CHART_EXPECTED_SHAPE,
|
|
204
|
+
repairExample: FLOW_SURFACE_CHART_REPAIR_EXAMPLE,
|
|
144
205
|
forbiddenFallbacks: FLOW_SURFACE_CHART_FORBIDDEN_FALLBACKS
|
|
145
206
|
};
|
|
146
207
|
}
|
|
147
|
-
function throwChartRepairBadRequest(message,
|
|
208
|
+
function throwChartRepairBadRequest(message, options = {}) {
|
|
209
|
+
const details = import_lodash.default.isPlainObject(options.details) ? options.details : {};
|
|
148
210
|
(0, import_errors.throwBadRequest)(withChartRepairMessage(message), {
|
|
211
|
+
...options,
|
|
149
212
|
details: withFlowSurfaceChartRepairDetails(details)
|
|
150
213
|
});
|
|
151
214
|
}
|
|
215
|
+
function isChartConfigureBadRequestError(error) {
|
|
216
|
+
return error instanceof import_errors.FlowSurfaceBadRequestError && String(error.message || "").startsWith("chart ");
|
|
217
|
+
}
|
|
218
|
+
function buildChartConfigureFromSemanticChangesWithRepair(currentConfigure, changes) {
|
|
219
|
+
try {
|
|
220
|
+
return (0, import_chart_config.buildChartConfigureFromSemanticChanges)(currentConfigure, changes);
|
|
221
|
+
} catch (error) {
|
|
222
|
+
if (isChartConfigureBadRequestError(error)) {
|
|
223
|
+
throwChartRepairBadRequest(error.message, error.options);
|
|
224
|
+
}
|
|
225
|
+
throw error;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
152
228
|
function isFlowSurfaceChartRepairError(error) {
|
|
153
229
|
var _a, _b;
|
|
154
230
|
return error instanceof import_errors.FlowSurfaceBadRequestError && ((_b = (_a = error.options) == null ? void 0 : _a.details) == null ? void 0 : _b.repairHint) === FLOW_SURFACE_CHART_REPAIR_HINT;
|
|
@@ -1088,7 +1164,7 @@ class FlowSurfacesService {
|
|
|
1088
1164
|
parentId: null,
|
|
1089
1165
|
options: {
|
|
1090
1166
|
documentTitle: values.tabDocumentTitle,
|
|
1091
|
-
flowRegistry: values.tabFlowRegistry || {}
|
|
1167
|
+
flowRegistry: this.normalizeEventFlowRegistry("createMenu", values.tabFlowRegistry || {})
|
|
1092
1168
|
}
|
|
1093
1169
|
}
|
|
1094
1170
|
]
|
|
@@ -2819,7 +2895,7 @@ class FlowSurfacesService {
|
|
|
2819
2895
|
use: "RootPageTabModel",
|
|
2820
2896
|
props: import_lodash.default.omit(import_lodash.default.cloneDeep((currentNode == null ? void 0 : currentNode.props) || {}), ["route"]),
|
|
2821
2897
|
decoratorProps: import_lodash.default.cloneDeep((currentNode == null ? void 0 : currentNode.decoratorProps) || {}),
|
|
2822
|
-
flowRegistry:
|
|
2898
|
+
flowRegistry: this.getEventFlowRegistry(currentNode),
|
|
2823
2899
|
stepParams: import_lodash.default.cloneDeep((values == null ? void 0 : values.stepParams) || (currentNode == null ? void 0 : currentNode.stepParams) || {})
|
|
2824
2900
|
}),
|
|
2825
2901
|
{ transaction: options == null ? void 0 : options.transaction }
|
|
@@ -3040,7 +3116,7 @@ class FlowSurfacesService {
|
|
|
3040
3116
|
continue;
|
|
3041
3117
|
}
|
|
3042
3118
|
(0, import_service_utils.assertSupportedSimpleChanges)("chart", chartAsset, (0, import_configure_options.getConfigureOptionKeysForUse)("ChartBlockModel"));
|
|
3043
|
-
const nextConfigure = (
|
|
3119
|
+
const nextConfigure = buildChartConfigureFromSemanticChangesWithRepair(void 0, chartAsset);
|
|
3044
3120
|
await this.validateChartConfigureForRuntime(
|
|
3045
3121
|
`applyBlueprint assets.charts.${chartKey}`,
|
|
3046
3122
|
nextConfigure,
|
|
@@ -3450,16 +3526,6 @@ class FlowSurfacesService {
|
|
|
3450
3526
|
await this.assertApplyBlueprintAuthoringPayload(values, options);
|
|
3451
3527
|
const document = (0, import_blueprint.prepareFlowSurfaceApplyBlueprintDocument)(values);
|
|
3452
3528
|
await this.prevalidateApplyBlueprintChartAssets(document);
|
|
3453
|
-
if (document.mode === "create") {
|
|
3454
|
-
return await this.applyBlueprintWithTransaction(
|
|
3455
|
-
values,
|
|
3456
|
-
{ ...options, skipAuthoringValidation: true },
|
|
3457
|
-
createdKanbanSortFields,
|
|
3458
|
-
{
|
|
3459
|
-
readSurface: false
|
|
3460
|
-
}
|
|
3461
|
-
);
|
|
3462
|
-
}
|
|
3463
3529
|
return await this.transaction(
|
|
3464
3530
|
(transaction) => this.applyBlueprintWithTransaction(
|
|
3465
3531
|
values,
|
|
@@ -5553,7 +5619,7 @@ class FlowSurfacesService {
|
|
|
5553
5619
|
parentId: routeId,
|
|
5554
5620
|
options: {
|
|
5555
5621
|
documentTitle: values.tabDocumentTitle,
|
|
5556
|
-
flowRegistry: values.tabFlowRegistry || {}
|
|
5622
|
+
flowRegistry: this.normalizeEventFlowRegistry("createPage", values.tabFlowRegistry || {})
|
|
5557
5623
|
}
|
|
5558
5624
|
},
|
|
5559
5625
|
transaction
|
|
@@ -5572,7 +5638,10 @@ class FlowSurfacesService {
|
|
|
5572
5638
|
options: {
|
|
5573
5639
|
...this.readRouteOptions(tabRoute),
|
|
5574
5640
|
documentTitle: values.tabDocumentTitle ?? this.readRouteOptions(tabRoute).documentTitle,
|
|
5575
|
-
flowRegistry:
|
|
5641
|
+
flowRegistry: this.normalizeEventFlowRegistry(
|
|
5642
|
+
"createPage",
|
|
5643
|
+
values.tabFlowRegistry || this.readRouteOptions(tabRoute).flowRegistry || {}
|
|
5644
|
+
)
|
|
5576
5645
|
}
|
|
5577
5646
|
},
|
|
5578
5647
|
transaction
|
|
@@ -5714,7 +5783,7 @@ class FlowSurfacesService {
|
|
|
5714
5783
|
hidden: !pageRoute.get("enableTabs"),
|
|
5715
5784
|
options: {
|
|
5716
5785
|
documentTitle: values.documentTitle,
|
|
5717
|
-
flowRegistry: values.flowRegistry || {}
|
|
5786
|
+
flowRegistry: this.normalizeEventFlowRegistry("addTab", values.flowRegistry || {})
|
|
5718
5787
|
}
|
|
5719
5788
|
},
|
|
5720
5789
|
transaction: options.transaction
|
|
@@ -5762,7 +5831,7 @@ class FlowSurfacesService {
|
|
|
5762
5831
|
)
|
|
5763
5832
|
}
|
|
5764
5833
|
} : void 0,
|
|
5765
|
-
flowRegistry: !import_lodash.default.isUndefined(values.flowRegistry) ? values.flowRegistry : void 0
|
|
5834
|
+
flowRegistry: !import_lodash.default.isUndefined(values.flowRegistry) ? this.normalizeEventFlowRegistry("updateTab", values.flowRegistry) : void 0
|
|
5766
5835
|
});
|
|
5767
5836
|
await this.routeSync.persistTabSettings(target, current, nextPayload, options.transaction);
|
|
5768
5837
|
return {
|
|
@@ -5878,7 +5947,7 @@ class FlowSurfacesService {
|
|
|
5878
5947
|
title: values.title,
|
|
5879
5948
|
icon: values.icon,
|
|
5880
5949
|
documentTitle: values.documentTitle,
|
|
5881
|
-
flowRegistry: values.flowRegistry
|
|
5950
|
+
flowRegistry: this.normalizeEventFlowRegistry("addPopupTab", values.flowRegistry)
|
|
5882
5951
|
});
|
|
5883
5952
|
await this.repository.upsertModel(
|
|
5884
5953
|
{
|
|
@@ -5933,7 +6002,7 @@ class FlowSurfacesService {
|
|
|
5933
6002
|
}
|
|
5934
6003
|
}
|
|
5935
6004
|
} : void 0,
|
|
5936
|
-
flowRegistry: !import_lodash.default.isUndefined(values.flowRegistry) ? values.flowRegistry : void 0
|
|
6005
|
+
flowRegistry: !import_lodash.default.isUndefined(values.flowRegistry) ? this.normalizeEventFlowRegistry("updatePopupTab", values.flowRegistry) : void 0
|
|
5937
6006
|
});
|
|
5938
6007
|
if (Object.keys(nextPayload).length === 1) {
|
|
5939
6008
|
return { uid: popupTab.uid };
|
|
@@ -6134,7 +6203,7 @@ class FlowSurfacesService {
|
|
|
6134
6203
|
use: "ReferenceFormGridModel",
|
|
6135
6204
|
props: currentGrid.props,
|
|
6136
6205
|
decoratorProps: currentGrid.decoratorProps,
|
|
6137
|
-
flowRegistry: currentGrid
|
|
6206
|
+
flowRegistry: this.getEventFlowRegistry(currentGrid),
|
|
6138
6207
|
sortIndex: currentGrid.sortIndex,
|
|
6139
6208
|
parentId: blockUid,
|
|
6140
6209
|
subKey: "grid",
|
|
@@ -7390,7 +7459,7 @@ class FlowSurfacesService {
|
|
|
7390
7459
|
props: actionSettingsPayload.props,
|
|
7391
7460
|
decoratorProps: values.decoratorProps,
|
|
7392
7461
|
stepParams: actionSettingsPayload.stepParams,
|
|
7393
|
-
flowRegistry: values.flowRegistry
|
|
7462
|
+
flowRegistry: this.normalizeEventFlowRegistry("addAction", values.flowRegistry)
|
|
7394
7463
|
});
|
|
7395
7464
|
this.contractGuard.validateNodeTreeAgainstContract(action);
|
|
7396
7465
|
const created = await this.repository.upsertModel(
|
|
@@ -7517,7 +7586,7 @@ class FlowSurfacesService {
|
|
|
7517
7586
|
props: actionSettingsPayload.props,
|
|
7518
7587
|
decoratorProps: values.decoratorProps,
|
|
7519
7588
|
stepParams: actionSettingsPayload.stepParams,
|
|
7520
|
-
flowRegistry: values.flowRegistry
|
|
7589
|
+
flowRegistry: this.normalizeEventFlowRegistry("addRecordAction", values.flowRegistry)
|
|
7521
7590
|
});
|
|
7522
7591
|
this.contractGuard.validateNodeTreeAgainstContract(action);
|
|
7523
7592
|
const created = await this.repository.upsertModel(
|
|
@@ -7569,7 +7638,8 @@ class FlowSurfacesService {
|
|
|
7569
7638
|
},
|
|
7570
7639
|
{
|
|
7571
7640
|
...options,
|
|
7572
|
-
preserveSingleScopeDataBlockTitle
|
|
7641
|
+
preserveSingleScopeDataBlockTitle,
|
|
7642
|
+
skipAuthoringValidation: true
|
|
7573
7643
|
}
|
|
7574
7644
|
)
|
|
7575
7645
|
});
|
|
@@ -11157,6 +11227,7 @@ class FlowSurfacesService {
|
|
|
11157
11227
|
}
|
|
11158
11228
|
if (domain === "flowRegistry") {
|
|
11159
11229
|
this.assertNoTreeConnectFieldsFlowRegistry(current, normalizedValues[domain], "updateSettings");
|
|
11230
|
+
normalizedValues[domain] = this.normalizeEventFlowRegistry("updateSettings", normalizedValues[domain]);
|
|
11160
11231
|
}
|
|
11161
11232
|
if (!contract.editableDomains.includes(domain)) {
|
|
11162
11233
|
(0, import_errors.throwBadRequest)(`flowSurfaces updateSettings domain '${domain}' is not editable`);
|
|
@@ -11173,6 +11244,9 @@ class FlowSurfacesService {
|
|
|
11173
11244
|
current.use
|
|
11174
11245
|
);
|
|
11175
11246
|
});
|
|
11247
|
+
if (!import_lodash.default.isUndefined(nextPayload.flowRegistry)) {
|
|
11248
|
+
nextPayload.flowRegistry = this.normalizeEventFlowRegistry("updateSettings", nextPayload.flowRegistry);
|
|
11249
|
+
}
|
|
11176
11250
|
this.replaceExplicitPopupStepParamSubtreesForUpdateSettings(
|
|
11177
11251
|
current,
|
|
11178
11252
|
normalizedValues,
|
|
@@ -11239,7 +11313,7 @@ class FlowSurfacesService {
|
|
|
11239
11313
|
props: nextPayload.props ?? current.props,
|
|
11240
11314
|
decoratorProps: nextPayload.decoratorProps ?? current.decoratorProps,
|
|
11241
11315
|
stepParams: nextPayload.stepParams ?? current.stepParams,
|
|
11242
|
-
flowRegistry: nextPayload.flowRegistry ?? current
|
|
11316
|
+
flowRegistry: nextPayload.flowRegistry ?? this.getEventFlowRegistry(current)
|
|
11243
11317
|
};
|
|
11244
11318
|
const shouldValidateFlowRegistry = !import_lodash.default.isUndefined(nextPayload.flowRegistry) || !import_lodash.default.isUndefined(nextPayload.stepParams);
|
|
11245
11319
|
assertNoFlowSurfaceIdTitleFieldSettings(import_lodash.default.pick(effectiveNode, ["props", "stepParams"]), {
|
|
@@ -12448,6 +12522,8 @@ class FlowSurfacesService {
|
|
|
12448
12522
|
options
|
|
12449
12523
|
);
|
|
12450
12524
|
const flowRegistry = this.getEventFlowRegistry(current);
|
|
12525
|
+
const directEvents = import_lodash.default.cloneDeep(((_a = contract.eventCapabilities) == null ? void 0 : _a.direct) || []);
|
|
12526
|
+
const objectEvents = import_lodash.default.uniq([...import_lodash.default.cloneDeep(((_b = contract.eventCapabilities) == null ? void 0 : _b.object) || []), ...directEvents]);
|
|
12451
12527
|
return {
|
|
12452
12528
|
target: {
|
|
12453
12529
|
uid: target.uid,
|
|
@@ -12456,8 +12532,8 @@ class FlowSurfacesService {
|
|
|
12456
12532
|
},
|
|
12457
12533
|
flowRegistry,
|
|
12458
12534
|
events: {
|
|
12459
|
-
direct:
|
|
12460
|
-
object:
|
|
12535
|
+
direct: directEvents,
|
|
12536
|
+
object: objectEvents
|
|
12461
12537
|
},
|
|
12462
12538
|
phases: {
|
|
12463
12539
|
supported: ["beforeAllFlows", "afterAllFlows", "beforeFlow", "afterFlow", "beforeStep", "afterStep"],
|
|
@@ -12492,13 +12568,12 @@ class FlowSurfacesService {
|
|
|
12492
12568
|
if (phase !== "beforeAllFlows") {
|
|
12493
12569
|
(0, import_errors.throwBadRequest)(`flowSurfaces addEventFlow only supports phase 'beforeAllFlows'`);
|
|
12494
12570
|
}
|
|
12495
|
-
const
|
|
12496
|
-
const nextFlowRegistry = {
|
|
12571
|
+
const nextFlowRegistry = this.normalizeEventFlowRegistry("addEventFlow", {
|
|
12497
12572
|
...flowRegistry,
|
|
12498
|
-
[key]:
|
|
12499
|
-
};
|
|
12573
|
+
[key]: this.normalizeAddEventFlowInput(key, values, phase)
|
|
12574
|
+
});
|
|
12500
12575
|
await this.persistEventFlowRegistry("addEventFlow", target, current, nextFlowRegistry, options);
|
|
12501
|
-
return this.buildEventFlowWriteResult(target, key,
|
|
12576
|
+
return this.buildEventFlowWriteResult(target, key, nextFlowRegistry[key], nextFlowRegistry);
|
|
12502
12577
|
}
|
|
12503
12578
|
async setEventFlow(values, options = {}) {
|
|
12504
12579
|
var _a;
|
|
@@ -12512,13 +12587,12 @@ class FlowSurfacesService {
|
|
|
12512
12587
|
const key = this.normalizeEventFlowKey("setEventFlow", (values == null ? void 0 : values.key) ?? ((_a = values == null ? void 0 : values.flow) == null ? void 0 : _a.key));
|
|
12513
12588
|
this.assertEventFlowFingerprint("setEventFlow", values == null ? void 0 : values.expectedFingerprint, flowRegistry);
|
|
12514
12589
|
const flowInput = import_lodash.default.isPlainObject(values == null ? void 0 : values.flow) ? values.flow : values;
|
|
12515
|
-
const
|
|
12516
|
-
const nextFlowRegistry = {
|
|
12590
|
+
const nextFlowRegistry = this.normalizeEventFlowRegistry("setEventFlow", {
|
|
12517
12591
|
...flowRegistry,
|
|
12518
|
-
[key]:
|
|
12519
|
-
};
|
|
12592
|
+
[key]: this.normalizeEventFlowObject("setEventFlow", key, flowInput)
|
|
12593
|
+
});
|
|
12520
12594
|
await this.persistEventFlowRegistry("setEventFlow", target, current, nextFlowRegistry, options);
|
|
12521
|
-
return this.buildEventFlowWriteResult(target, key,
|
|
12595
|
+
return this.buildEventFlowWriteResult(target, key, nextFlowRegistry[key], nextFlowRegistry);
|
|
12522
12596
|
}
|
|
12523
12597
|
async removeEventFlow(values, options = {}) {
|
|
12524
12598
|
(0, import_payload_shape.validateFlowSurfacePayloadShape)("removeEventFlow", values, "values");
|
|
@@ -12533,14 +12607,14 @@ class FlowSurfacesService {
|
|
|
12533
12607
|
(0, import_errors.throwBadRequest)(`flowSurfaces removeEventFlow flow '${key}' does not exist`);
|
|
12534
12608
|
}
|
|
12535
12609
|
this.assertEventFlowFingerprint("removeEventFlow", values == null ? void 0 : values.expectedFingerprint, flowRegistry);
|
|
12536
|
-
const nextFlowRegistry = import_lodash.default.omit(flowRegistry, [key]);
|
|
12610
|
+
const nextFlowRegistry = this.normalizeEventFlowRegistry("removeEventFlow", import_lodash.default.omit(flowRegistry, [key]));
|
|
12537
12611
|
await this.persistEventFlowRegistry("removeEventFlow", target, current, nextFlowRegistry, options);
|
|
12538
12612
|
return this.buildEventFlowWriteResult(target, key, void 0, nextFlowRegistry);
|
|
12539
12613
|
}
|
|
12540
12614
|
async setEventFlows(values, options = {}) {
|
|
12541
12615
|
(0, import_payload_shape.validateFlowSurfacePayloadShape)("setEventFlows", values, "values");
|
|
12542
12616
|
const { target, current } = await this.resolveEventFlowTarget("setEventFlows", values == null ? void 0 : values.target, values, options);
|
|
12543
|
-
const flows = values.flowRegistry || values.flows || {};
|
|
12617
|
+
const flows = this.normalizeEventFlowRegistry("setEventFlows", values.flowRegistry || values.flows || {});
|
|
12544
12618
|
await this.persistEventFlowRegistry("setEventFlows", target, current, flows, options);
|
|
12545
12619
|
return {
|
|
12546
12620
|
uid: target.uid,
|
|
@@ -12566,7 +12640,10 @@ class FlowSurfacesService {
|
|
|
12566
12640
|
};
|
|
12567
12641
|
}
|
|
12568
12642
|
getEventFlowRegistry(node) {
|
|
12569
|
-
return import_lodash.default.isPlainObject(node == null ? void 0 : node.flowRegistry) ?
|
|
12643
|
+
return import_lodash.default.isPlainObject(node == null ? void 0 : node.flowRegistry) ? this.normalizeEventFlowRegistry("getEventFlowRegistry", node.flowRegistry) : {};
|
|
12644
|
+
}
|
|
12645
|
+
normalizeEventFlowRegistry(actionName, flowRegistry) {
|
|
12646
|
+
return (0, import_event_flow_normalizer.normalizeFlowSurfaceEventFlowRegistry)(actionName, flowRegistry);
|
|
12570
12647
|
}
|
|
12571
12648
|
buildEventFlowFingerprint(flowRegistry) {
|
|
12572
12649
|
return this.buildSurfaceFingerprint({
|
|
@@ -12604,7 +12681,9 @@ class FlowSurfacesService {
|
|
|
12604
12681
|
normalizeAddEventFlowInput(key, values, phase) {
|
|
12605
12682
|
var _a, _b, _c;
|
|
12606
12683
|
const flow = import_lodash.default.isPlainObject(values.flow) ? import_lodash.default.cloneDeep(values.flow) : {};
|
|
12607
|
-
const eventName = String(
|
|
12684
|
+
const eventName = String(
|
|
12685
|
+
values.eventName ?? (typeof flow.on === "string" ? flow.on : (_a = flow == null ? void 0 : flow.on) == null ? void 0 : _a.eventName) ?? ""
|
|
12686
|
+
).trim();
|
|
12608
12687
|
if (!eventName) {
|
|
12609
12688
|
(0, import_errors.throwBadRequest)(`flowSurfaces addEventFlow requires eventName`);
|
|
12610
12689
|
}
|
|
@@ -12627,25 +12706,7 @@ class FlowSurfacesService {
|
|
|
12627
12706
|
});
|
|
12628
12707
|
}
|
|
12629
12708
|
normalizeEventFlowObject(actionName, key, flowInput) {
|
|
12630
|
-
|
|
12631
|
-
(0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} flow '${key}' must be an object`);
|
|
12632
|
-
}
|
|
12633
|
-
const flow = import_lodash.default.cloneDeep(flowInput);
|
|
12634
|
-
flow.key = key;
|
|
12635
|
-
if (import_lodash.default.isPlainObject(flow.on)) {
|
|
12636
|
-
const eventName = String(flow.on.eventName || "").trim();
|
|
12637
|
-
if (eventName) {
|
|
12638
|
-
flow.on.eventName = eventName;
|
|
12639
|
-
}
|
|
12640
|
-
const phase = String(flow.on.phase || "").trim();
|
|
12641
|
-
if (phase) {
|
|
12642
|
-
flow.on.phase = phase;
|
|
12643
|
-
}
|
|
12644
|
-
}
|
|
12645
|
-
if (import_lodash.default.isUndefined(flow.steps)) {
|
|
12646
|
-
flow.steps = {};
|
|
12647
|
-
}
|
|
12648
|
-
return flow;
|
|
12709
|
+
return (0, import_event_flow_normalizer.normalizeFlowSurfaceEventFlow)(actionName, key, flowInput);
|
|
12649
12710
|
}
|
|
12650
12711
|
async persistEventFlowRegistry(actionName, target, current, flowRegistry, options = {}) {
|
|
12651
12712
|
this.assertNoTreeConnectFieldsFlowRegistry(current, flowRegistry, actionName);
|
|
@@ -16037,7 +16098,10 @@ class FlowSurfacesService {
|
|
|
16037
16098
|
const shouldLoadCurrent = shouldUpdateConfigure || shouldUpdateCardSettings;
|
|
16038
16099
|
const resolved = shouldLoadCurrent ? await this.locator.resolve(target, options) : null;
|
|
16039
16100
|
const current = resolved ? await this.loadResolvedNode(resolved, options.transaction) : null;
|
|
16040
|
-
let nextConfigure = shouldUpdateConfigure ? (
|
|
16101
|
+
let nextConfigure = shouldUpdateConfigure ? buildChartConfigureFromSemanticChangesWithRepair(
|
|
16102
|
+
import_lodash.default.get(current, ["stepParams", "chartSettings", "configure"]),
|
|
16103
|
+
changes
|
|
16104
|
+
) : void 0;
|
|
16041
16105
|
if (shouldUpdateConfigure) {
|
|
16042
16106
|
nextConfigure = await this.stripBasicSqlVisualWhenPreviewUnavailable(nextConfigure, changes, options.transaction);
|
|
16043
16107
|
}
|
|
@@ -21637,7 +21701,7 @@ ${AI_EMPLOYEE_CURRENT_RECORD_PROMPT_VARIABLE}` : AI_EMPLOYEE_CURRENT_RECORD_PROM
|
|
|
21637
21701
|
(value) => !import_lodash.default.isUndefined(value)
|
|
21638
21702
|
),
|
|
21639
21703
|
decoratorProps: import_lodash.default.cloneDeep(innerField.decoratorProps || {}),
|
|
21640
|
-
flowRegistry:
|
|
21704
|
+
flowRegistry: this.getEventFlowRegistry(innerField),
|
|
21641
21705
|
stepParams: import_lodash.default.merge({}, innerField.stepParams || {}, {
|
|
21642
21706
|
fieldBinding: {
|
|
21643
21707
|
use: normalizedTargetUse
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "前端流引擎",
|
|
5
5
|
"description": "",
|
|
6
6
|
"description.zh-CN": "",
|
|
7
|
-
"version": "2.1.0-beta.
|
|
7
|
+
"version": "2.1.0-beta.42",
|
|
8
8
|
"main": "./dist/server/index.js",
|
|
9
9
|
"license": "Apache-2.0",
|
|
10
10
|
"devDependencies": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"@nocobase/test": "2.x",
|
|
27
27
|
"@nocobase/utils": "2.x"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "619b4d06c934bf3266ba7f388438db018217c87d"
|
|
30
30
|
}
|