@nocobase/plugin-flow-engine 2.2.0-beta.1 → 2.2.0-beta.11
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/client/index.js +1 -1
- package/dist/externalVersion.js +9 -9
- package/dist/locale/en-US.json +1 -0
- package/dist/locale/index.d.ts +2 -0
- package/dist/locale/zh-CN.json +1 -0
- 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/{runjs-authoring/blocked-global-stop/index.d.ts → approval/authoring-validation.d.ts} +1 -2
- package/dist/server/flow-surfaces/approval/authoring-validation.js +1151 -0
- package/dist/server/flow-surfaces/approval/blueprint-service.js +2 -0
- package/dist/server/flow-surfaces/authoring-validation.d.ts +2 -1
- package/dist/server/flow-surfaces/authoring-validation.js +639 -59
- package/dist/server/flow-surfaces/blueprint/compile-blocks.js +7 -3
- package/dist/server/flow-surfaces/blueprint/compile-plan.js +19 -15
- package/dist/server/flow-surfaces/blueprint/export-document.d.ts +50 -0
- package/dist/server/flow-surfaces/blueprint/export-document.js +2510 -0
- package/dist/server/flow-surfaces/blueprint/normalize-document.js +2 -1
- package/dist/server/flow-surfaces/blueprint/public-types.d.ts +1 -0
- package/dist/server/flow-surfaces/builder.js +43 -5
- package/dist/server/flow-surfaces/catalog.js +13 -2
- package/dist/server/flow-surfaces/configure-options.js +5 -3
- package/dist/server/flow-surfaces/constants.d.ts +9 -2
- package/dist/server/flow-surfaces/constants.js +1 -0
- package/dist/server/flow-surfaces/contract-guard.js +37 -5
- package/dist/server/flow-surfaces/default-action-popup.d.ts +2 -0
- package/dist/server/flow-surfaces/default-action-popup.js +27 -13
- package/dist/server/flow-surfaces/filter-group.d.ts +19 -2
- package/dist/server/flow-surfaces/filter-group.js +232 -3
- package/dist/server/flow-surfaces/planning/compiler.d.ts +1 -0
- package/dist/server/flow-surfaces/planning/compiler.js +205 -82
- package/dist/server/flow-surfaces/planning/key-registry.d.ts +1 -1
- package/dist/server/flow-surfaces/planning/runtime.js +1 -0
- package/dist/server/flow-surfaces/planning/step-link.d.ts +1 -1
- package/dist/server/flow-surfaces/planning/step-link.js +22 -3
- package/dist/server/flow-surfaces/public-data-surface-default-filter.js +0 -9
- package/dist/server/flow-surfaces/reaction/field-value.d.ts +9 -0
- package/dist/server/flow-surfaces/reaction/field-value.js +51 -2
- package/dist/server/flow-surfaces/reaction/linkage.d.ts +6 -1
- package/dist/server/flow-surfaces/reaction/linkage.js +18 -3
- package/dist/server/flow-surfaces/reaction/meta.js +19 -1
- package/dist/server/flow-surfaces/reaction/types.d.ts +19 -0
- package/dist/server/flow-surfaces/relation-backing-foreign-key.d.ts +10 -0
- package/dist/server/flow-surfaces/relation-backing-foreign-key.js +79 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/source.d.ts +1 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/source.js +20 -0
- package/dist/server/flow-surfaces/runjs-authoring/rules.js +0 -2
- package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.d.ts +0 -1
- package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.js +11 -19
- package/dist/server/flow-surfaces/runjs-authoring/runtime/types.d.ts +0 -12
- package/dist/server/flow-surfaces/runjs-authoring/scan/filter.js +12 -2
- package/dist/server/flow-surfaces/runjs-authoring/scan/index.d.ts +0 -14
- package/dist/server/flow-surfaces/runjs-authoring/scan/index.js +10 -8
- package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.d.ts +0 -14
- package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.js +18 -73
- package/dist/server/flow-surfaces/runjs-authoring/types.d.ts +1 -1
- package/dist/server/flow-surfaces/runjs-authoring/validators/index.js +9 -53
- package/dist/server/flow-surfaces/service.d.ts +53 -0
- package/dist/server/flow-surfaces/service.js +997 -127
- package/dist/server/flow-surfaces/types.d.ts +2 -1
- package/dist/server/variables/records.js +7 -2
- package/dist/server/variables/registry.js +3 -0
- package/dist/swagger/flow-surfaces.d.ts +193 -0
- package/dist/swagger/flow-surfaces.examples.d.ts +11 -0
- package/dist/swagger/flow-surfaces.examples.js +11 -0
- package/dist/swagger/flow-surfaces.js +179 -10
- package/dist/swagger/index.d.ts +193 -0
- package/package.json +2 -2
- package/dist/server/flow-surfaces/runjs-authoring/blocked-global-stop/index.js +0 -40
|
@@ -51,6 +51,7 @@ var import_association_title_field = require("./association-title-field");
|
|
|
51
51
|
var import_chart_config = require("./chart-config");
|
|
52
52
|
var import_public_data_surface_default_filter = require("./public-data-surface-default-filter");
|
|
53
53
|
var import_default_action_popup = require("./default-action-popup");
|
|
54
|
+
var import_relation_backing_foreign_key = require("./relation-backing-foreign-key");
|
|
54
55
|
var import_default_block_actions = require("./default-block-actions");
|
|
55
56
|
var import_hidden_popup_contract = require("./hidden-popup-contract");
|
|
56
57
|
var import_node_use_sets = require("./node-use-sets");
|
|
@@ -60,7 +61,23 @@ var import_association_interfaces = require("./association-interfaces");
|
|
|
60
61
|
var import_defaults = require("./blueprint/defaults");
|
|
61
62
|
var import_runjs_authoring = require("./runjs-authoring");
|
|
62
63
|
var import_configure_options = require("./configure-options");
|
|
64
|
+
var import_context = require("./context");
|
|
63
65
|
var import_filter_group = require("./filter-group");
|
|
66
|
+
const FLOW_SURFACE_DATA_SCOPE_DATE_EMPTY_OPERATORS = /* @__PURE__ */ new Set(["$empty", "$notEmpty"]);
|
|
67
|
+
const FLOW_SURFACE_DATA_SCOPE_DATE_ALLOWED_OPERATORS = /* @__PURE__ */ new Set([
|
|
68
|
+
...import_filter_group.FLOW_SURFACE_DATE_FILTER_OPERATORS,
|
|
69
|
+
...FLOW_SURFACE_DATA_SCOPE_DATE_EMPTY_OPERATORS
|
|
70
|
+
]);
|
|
71
|
+
const FLOW_SURFACE_DATA_SCOPE_DATE_UI_INCOMPATIBLE_OPERATORS = /* @__PURE__ */ new Set([
|
|
72
|
+
"$eq",
|
|
73
|
+
"$ne",
|
|
74
|
+
"$lt",
|
|
75
|
+
"$lte",
|
|
76
|
+
"$gt",
|
|
77
|
+
"$gte",
|
|
78
|
+
"$in",
|
|
79
|
+
"$notIn"
|
|
80
|
+
]);
|
|
64
81
|
const MAIN_BLOCK_UNSUPPORTED_SECTIONS = {
|
|
65
82
|
calendar: ["fields", "fieldGroups", "recordActions", "fieldsLayout"],
|
|
66
83
|
kanban: ["fieldGroups", "recordActions", "fieldsLayout"],
|
|
@@ -171,10 +188,17 @@ const GRID_CARD_ALLOWED_SETTINGS_KEYS = /* @__PURE__ */ new Set([
|
|
|
171
188
|
const TABLE_ALLOWED_SETTINGS_KEYS = /* @__PURE__ */ new Set([...(0, import_configure_options.getConfigureOptionKeysForUse)("TableBlockModel"), "sort"]);
|
|
172
189
|
const TABLE_INTERNAL_AUTHORING_KEYS = ["tableSettings", "defaultSorting", "stepParams"];
|
|
173
190
|
const TABLE_SETTINGS_REPAIR_HINT = "Use public table settings keys such as settings.pageSize, settings.sorting, settings.dataScope, settings.density, settings.showRowNumbers, settings.treeTable, settings.dragSort, and settings.dragSortBy. Do not nest persisted tableSettings/defaultSorting/stepParams payloads.";
|
|
174
|
-
const JS_BLOCK_ALLOWED_SETTINGS_KEYS = /* @__PURE__ */ new Set([
|
|
191
|
+
const JS_BLOCK_ALLOWED_SETTINGS_KEYS = /* @__PURE__ */ new Set([
|
|
192
|
+
"title",
|
|
193
|
+
"description",
|
|
194
|
+
"className",
|
|
195
|
+
"showBlockCard",
|
|
196
|
+
"code",
|
|
197
|
+
"version"
|
|
198
|
+
]);
|
|
175
199
|
const JS_BLOCK_TOP_LEVEL_JS_KEYS = ["code", "version"];
|
|
176
200
|
const JS_BLOCK_INTERNAL_AUTHORING_KEYS = ["props", "decoratorProps", "flowRegistry", "stepParams"];
|
|
177
|
-
const JS_BLOCK_REPAIR_HINT = "This is a jsBlock payload shape problem. Repair this jsBlock using inline settings.code/settings.version, or applyBlueprint assets.scripts.<key>.code plus block.script. Do not change this block type to table, chart, actionPanel, gridCard, or another block type.";
|
|
201
|
+
const JS_BLOCK_REPAIR_HINT = "This is a jsBlock payload shape problem. Repair this jsBlock using inline settings.code/settings.version/settings.showBlockCard, or applyBlueprint assets.scripts.<key>.code plus block.script with optional settings.showBlockCard. Do not change this block type to table, chart, actionPanel, gridCard, or another block type.";
|
|
178
202
|
const CHART_REPAIR_HINT = "This is a chart payload shape problem. Keep using chart and repair this chart 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, and do not drop or defer the chart. KPI / summary numbers should use jsBlock; charts are for trends, distributions, rankings, and visual analysis.";
|
|
179
203
|
const REPAIR_ALL_ERRORS_AGENT_INSTRUCTION = "If this response contains errors[], fix every listed error in one payload revision before retrying the same write. Do not fix only this error and immediately retry.";
|
|
180
204
|
const JS_BLOCK_AGENT_INSTRUCTION = `${REPAIR_ALL_ERRORS_AGENT_INSTRUCTION} Do not skip, drop, defer, or replace this required jsBlock. Repair it as jsBlock.`;
|
|
@@ -472,7 +496,10 @@ async function collectFlowSurfaceAuthoringErrors(actionName, values, context = {
|
|
|
472
496
|
blocks.forEach(({ block }) => collectLocalKeys(block, localKeys));
|
|
473
497
|
}
|
|
474
498
|
blocks.forEach(({ block, path }) => collectBlockErrors(block, path, errors, localKeys, validationContext));
|
|
475
|
-
collectReactionErrors(values == null ? void 0 : values.reaction, "$.reaction", localKeys, errors
|
|
499
|
+
collectReactionErrors(values == null ? void 0 : values.reaction, "$.reaction", localKeys, errors, {
|
|
500
|
+
values,
|
|
501
|
+
context: validationContext
|
|
502
|
+
});
|
|
476
503
|
if (!validationContext.skipGeneratedPopupDefaultFieldGroups) {
|
|
477
504
|
collectGeneratedPopupDefaultFieldGroupErrors(actionName, values, validationContext, errors);
|
|
478
505
|
}
|
|
@@ -513,10 +540,13 @@ function pushChartBadRequestAuthoringError(errors, error, fallbackPath) {
|
|
|
513
540
|
});
|
|
514
541
|
}
|
|
515
542
|
async function collectNavigationGroupErrors(actionName, values, context, errors) {
|
|
516
|
-
var _a;
|
|
543
|
+
var _a, _b;
|
|
517
544
|
if (actionName !== "applyBlueprint" || (values == null ? void 0 : values.mode) !== "create" || !_.isPlainObject((_a = values == null ? void 0 : values.navigation) == null ? void 0 : _a.group)) {
|
|
518
545
|
return;
|
|
519
546
|
}
|
|
547
|
+
if (await isApplyBlueprintMobileCreateNavigation(values, context)) {
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
520
550
|
if (!_.isUndefined(values.navigation.group.routeId) || !context.findMenuGroupRoutesByTitle) {
|
|
521
551
|
return;
|
|
522
552
|
}
|
|
@@ -524,7 +554,8 @@ async function collectNavigationGroupErrors(actionName, values, context, errors)
|
|
|
524
554
|
if (!groupTitle) {
|
|
525
555
|
return;
|
|
526
556
|
}
|
|
527
|
-
const
|
|
557
|
+
const layoutUid = String(((_b = values == null ? void 0 : values.navigation) == null ? void 0 : _b.layoutUid) || "").trim() || void 0;
|
|
558
|
+
const matchedRoutes = await context.findMenuGroupRoutesByTitle(groupTitle, context.transaction, layoutUid);
|
|
528
559
|
const rootMatchedRoutes = filterRootMenuGroupRoutes(matchedRoutes);
|
|
529
560
|
if (rootMatchedRoutes.length <= 1) {
|
|
530
561
|
return;
|
|
@@ -541,15 +572,17 @@ async function collectNavigationGroupErrors(actionName, values, context, errors)
|
|
|
541
572
|
});
|
|
542
573
|
}
|
|
543
574
|
async function collectNavigationIconErrors(actionName, values, context, errors) {
|
|
544
|
-
var _a, _b, _c;
|
|
575
|
+
var _a, _b, _c, _d;
|
|
545
576
|
if (actionName !== "applyBlueprint" || (values == null ? void 0 : values.mode) !== "create") {
|
|
546
577
|
return;
|
|
547
578
|
}
|
|
579
|
+
const isMobileCreateNavigation = await isApplyBlueprintMobileCreateNavigation(values, context);
|
|
548
580
|
const group = _.isPlainObject((_a = values == null ? void 0 : values.navigation) == null ? void 0 : _a.group) ? values.navigation.group : null;
|
|
549
581
|
const groupRouteId = String((group == null ? void 0 : group.routeId) || "").trim();
|
|
550
|
-
|
|
582
|
+
const layoutUid = String(((_b = values == null ? void 0 : values.navigation) == null ? void 0 : _b.layoutUid) || "").trim() || void 0;
|
|
583
|
+
if (!isMobileCreateNavigation && group && !groupRouteId && group.hideInMenu !== true) {
|
|
551
584
|
const groupIcon = String(group.icon || "").trim();
|
|
552
|
-
if (!groupIcon && await shouldRequireNewNavigationGroupIcon(group, context)) {
|
|
585
|
+
if (!groupIcon && await shouldRequireNewNavigationGroupIcon(group, context, layoutUid)) {
|
|
553
586
|
pushAuthoringError(errors, {
|
|
554
587
|
path: "$.navigation.group.icon",
|
|
555
588
|
ruleId: "navigation-icon-required",
|
|
@@ -568,7 +601,7 @@ async function collectNavigationIconErrors(actionName, values, context, errors)
|
|
|
568
601
|
}
|
|
569
602
|
});
|
|
570
603
|
}
|
|
571
|
-
} else if (group && String(group.icon || "").trim() && !isValidAntDesignIconName(group.icon)) {
|
|
604
|
+
} else if (!isMobileCreateNavigation && group && String(group.icon || "").trim() && !isValidAntDesignIconName(group.icon)) {
|
|
572
605
|
pushAuthoringError(errors, {
|
|
573
606
|
path: "$.navigation.group.icon",
|
|
574
607
|
ruleId: "navigation-icon-unknown",
|
|
@@ -578,7 +611,7 @@ async function collectNavigationIconErrors(actionName, values, context, errors)
|
|
|
578
611
|
}
|
|
579
612
|
});
|
|
580
613
|
}
|
|
581
|
-
const item = _.isPlainObject((
|
|
614
|
+
const item = _.isPlainObject((_c = values == null ? void 0 : values.navigation) == null ? void 0 : _c.item) ? values.navigation.item : null;
|
|
582
615
|
const itemIcon = String((item == null ? void 0 : item.icon) || "").trim();
|
|
583
616
|
if (itemIcon && !isValidAntDesignIconName(itemIcon)) {
|
|
584
617
|
pushAuthoringError(errors, {
|
|
@@ -590,7 +623,7 @@ async function collectNavigationIconErrors(actionName, values, context, errors)
|
|
|
590
623
|
}
|
|
591
624
|
});
|
|
592
625
|
}
|
|
593
|
-
const pageIcon = String(((
|
|
626
|
+
const pageIcon = String(((_d = values == null ? void 0 : values.page) == null ? void 0 : _d.icon) || "").trim();
|
|
594
627
|
if (pageIcon && !isValidAntDesignIconName(pageIcon)) {
|
|
595
628
|
pushAuthoringError(errors, {
|
|
596
629
|
path: "$.page.icon",
|
|
@@ -602,12 +635,20 @@ async function collectNavigationIconErrors(actionName, values, context, errors)
|
|
|
602
635
|
});
|
|
603
636
|
}
|
|
604
637
|
}
|
|
605
|
-
async function
|
|
638
|
+
async function isApplyBlueprintMobileCreateNavigation(values, context) {
|
|
639
|
+
var _a;
|
|
640
|
+
const layoutUid = String(((_a = values == null ? void 0 : values.navigation) == null ? void 0 : _a.layoutUid) || "").trim();
|
|
641
|
+
if (!layoutUid || !context.getUiLayoutTypeByUid) {
|
|
642
|
+
return false;
|
|
643
|
+
}
|
|
644
|
+
return await context.getUiLayoutTypeByUid(layoutUid, context.transaction) === "mobile";
|
|
645
|
+
}
|
|
646
|
+
async function shouldRequireNewNavigationGroupIcon(group, context, layoutUid) {
|
|
606
647
|
const groupTitle = String((group == null ? void 0 : group.title) || "").trim();
|
|
607
648
|
if (!groupTitle || !context.findMenuGroupRoutesByTitle) {
|
|
608
649
|
return true;
|
|
609
650
|
}
|
|
610
|
-
const matchedRoutes = await context.findMenuGroupRoutesByTitle(groupTitle, context.transaction);
|
|
651
|
+
const matchedRoutes = await context.findMenuGroupRoutesByTitle(groupTitle, context.transaction, layoutUid);
|
|
611
652
|
return filterRootMenuGroupRoutes(matchedRoutes).length === 0;
|
|
612
653
|
}
|
|
613
654
|
function filterRootMenuGroupRoutes(routes) {
|
|
@@ -732,6 +773,7 @@ function withJsBlockRepairHint(details = {}) {
|
|
|
732
773
|
inlineBlock: {
|
|
733
774
|
type: "jsBlock",
|
|
734
775
|
settings: {
|
|
776
|
+
showBlockCard: true,
|
|
735
777
|
code: 'ctx.render("Replace this with the required rendered UI");'
|
|
736
778
|
}
|
|
737
779
|
},
|
|
@@ -745,7 +787,10 @@ function withJsBlockRepairHint(details = {}) {
|
|
|
745
787
|
},
|
|
746
788
|
block: {
|
|
747
789
|
type: "jsBlock",
|
|
748
|
-
script: "scriptKey"
|
|
790
|
+
script: "scriptKey",
|
|
791
|
+
settings: {
|
|
792
|
+
showBlockCard: true
|
|
793
|
+
}
|
|
749
794
|
}
|
|
750
795
|
}
|
|
751
796
|
},
|
|
@@ -1177,47 +1222,69 @@ function collectBuilderChartAssetQueryErrors(query, path, context, errors) {
|
|
|
1177
1222
|
errors,
|
|
1178
1223
|
withChartRepairHint()
|
|
1179
1224
|
);
|
|
1180
|
-
collectChartQueryFilterOperatorErrors(query, `${path}.query`, errors);
|
|
1225
|
+
collectChartQueryFilterOperatorErrors(query, `${path}.query`, errors, context);
|
|
1181
1226
|
collectBuilderChartAssetFieldErrors(query, path, context, errors);
|
|
1182
1227
|
}
|
|
1183
|
-
|
|
1228
|
+
const AUTHORABLE_REACTION_SCALAR_CONTEXT_PATHS = /* @__PURE__ */ new Set(["role", "locale", "token", "deviceType"]);
|
|
1229
|
+
const AUTHORABLE_REACTION_CONTEXT_ROOTS = /* @__PURE__ */ new Set([
|
|
1230
|
+
"user",
|
|
1231
|
+
"collection",
|
|
1232
|
+
"formValues",
|
|
1233
|
+
"record",
|
|
1234
|
+
"item",
|
|
1235
|
+
"popup",
|
|
1236
|
+
"urlSearchParams"
|
|
1237
|
+
]);
|
|
1238
|
+
function collectChartQueryFilterOperatorErrors(query, path, errors, context) {
|
|
1184
1239
|
if (!_.isPlainObject(query) || !hasOwn(query, "filter")) {
|
|
1185
1240
|
return;
|
|
1186
1241
|
}
|
|
1187
|
-
collectChartFilterOperatorErrors(
|
|
1242
|
+
collectChartFilterOperatorErrors(
|
|
1243
|
+
query.filter,
|
|
1244
|
+
`${path}.filter`,
|
|
1245
|
+
errors,
|
|
1246
|
+
createChartQueryDateConditionFieldResolver(query, context)
|
|
1247
|
+
);
|
|
1188
1248
|
}
|
|
1189
|
-
function collectChartFilterOperatorErrors(filter, path, errors) {
|
|
1249
|
+
function collectChartFilterOperatorErrors(filter, path, errors, resolveField) {
|
|
1190
1250
|
if (_.isUndefined(filter) || _.isNull(filter) || !_.isPlainObject(filter)) {
|
|
1191
1251
|
return;
|
|
1192
1252
|
}
|
|
1193
1253
|
if (Array.isArray(filter.items)) {
|
|
1194
|
-
collectChartFilterGroupOperatorErrors(filter.items, `${path}.items`, errors);
|
|
1254
|
+
collectChartFilterGroupOperatorErrors(filter.items, `${path}.items`, errors, resolveField);
|
|
1195
1255
|
return;
|
|
1196
1256
|
}
|
|
1197
|
-
collectBackendQueryFilterOperatorErrors(filter, path, errors);
|
|
1257
|
+
collectBackendQueryFilterOperatorErrors(filter, path, errors, resolveField);
|
|
1198
1258
|
}
|
|
1199
|
-
function collectChartFilterGroupOperatorErrors(items, path, errors) {
|
|
1259
|
+
function collectChartFilterGroupOperatorErrors(items, path, errors, resolveField) {
|
|
1200
1260
|
items.forEach((item, index) => {
|
|
1201
1261
|
const itemPath = `${path}[${index}]`;
|
|
1202
1262
|
if (!_.isPlainObject(item)) {
|
|
1203
1263
|
return;
|
|
1204
1264
|
}
|
|
1205
1265
|
if (Array.isArray(item.items)) {
|
|
1206
|
-
collectChartFilterGroupOperatorErrors(item.items, `${itemPath}.items`, errors);
|
|
1266
|
+
collectChartFilterGroupOperatorErrors(item.items, `${itemPath}.items`, errors, resolveField);
|
|
1207
1267
|
return;
|
|
1208
1268
|
}
|
|
1209
1269
|
if (hasOwn(item, "operator")) {
|
|
1210
1270
|
collectChartFilterOperatorError(item.operator, `${itemPath}.operator`, errors);
|
|
1211
|
-
|
|
1271
|
+
const fieldPath = String(item.path || item.field || "").trim();
|
|
1272
|
+
collectChartFilterDateValueError(
|
|
1273
|
+
item.operator,
|
|
1274
|
+
item.value,
|
|
1275
|
+
`${itemPath}.value`,
|
|
1276
|
+
errors,
|
|
1277
|
+
fieldPath ? (resolveField == null ? void 0 : resolveField(fieldPath)) || { fieldPath } : void 0
|
|
1278
|
+
);
|
|
1212
1279
|
}
|
|
1213
1280
|
});
|
|
1214
1281
|
}
|
|
1215
|
-
function collectBackendQueryFilterOperatorErrors(filter, path, errors) {
|
|
1282
|
+
function collectBackendQueryFilterOperatorErrors(filter, path, errors, resolveField) {
|
|
1216
1283
|
Object.entries(filter).forEach(([field, condition]) => {
|
|
1217
1284
|
const fieldPath = `${path}.${field}`;
|
|
1218
1285
|
if ((field === "$and" || field === "$or") && Array.isArray(condition)) {
|
|
1219
1286
|
condition.forEach(
|
|
1220
|
-
(operand, index) => collectChartFilterOperatorErrors(operand, `${fieldPath}[${index}]`, errors)
|
|
1287
|
+
(operand, index) => collectChartFilterOperatorErrors(operand, `${fieldPath}[${index}]`, errors, resolveField)
|
|
1221
1288
|
);
|
|
1222
1289
|
return;
|
|
1223
1290
|
}
|
|
@@ -1226,11 +1293,17 @@ function collectBackendQueryFilterOperatorErrors(filter, path, errors) {
|
|
|
1226
1293
|
}
|
|
1227
1294
|
Object.keys(condition).forEach((operator) => {
|
|
1228
1295
|
if (operator === "$and" || operator === "$or") {
|
|
1229
|
-
collectChartFilterOperatorErrors({ [operator]: condition[operator] }, fieldPath, errors);
|
|
1296
|
+
collectChartFilterOperatorErrors({ [operator]: condition[operator] }, fieldPath, errors, resolveField);
|
|
1230
1297
|
return;
|
|
1231
1298
|
}
|
|
1232
1299
|
collectChartFilterOperatorError(operator, `${fieldPath}.${operator}`, errors);
|
|
1233
|
-
collectChartFilterDateValueError(
|
|
1300
|
+
collectChartFilterDateValueError(
|
|
1301
|
+
operator,
|
|
1302
|
+
condition[operator],
|
|
1303
|
+
`${fieldPath}.${operator}`,
|
|
1304
|
+
errors,
|
|
1305
|
+
(resolveField == null ? void 0 : resolveField(field)) || { fieldPath: field }
|
|
1306
|
+
);
|
|
1234
1307
|
});
|
|
1235
1308
|
});
|
|
1236
1309
|
}
|
|
@@ -1245,9 +1318,18 @@ function collectChartFilterOperatorError(operator, path, errors) {
|
|
|
1245
1318
|
throw error;
|
|
1246
1319
|
}
|
|
1247
1320
|
}
|
|
1248
|
-
function collectChartFilterDateValueError(operator, value, path, errors) {
|
|
1321
|
+
function collectChartFilterDateValueError(operator, value, path, errors, fieldContext) {
|
|
1322
|
+
const fieldMeta = getDateConditionFieldContextMeta(fieldContext);
|
|
1323
|
+
const normalizedOperator = typeof operator === "string" ? operator.trim() : "";
|
|
1324
|
+
if (!import_filter_group.FLOW_SURFACE_DATE_FILTER_OPERATORS.has(normalizedOperator) && !(0, import_filter_group.isFlowSurfaceDateLikeFieldMeta)(fieldMeta)) {
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1249
1327
|
try {
|
|
1250
|
-
(0, import_filter_group.
|
|
1328
|
+
(0, import_filter_group.normalizeFlowSurfaceDateConditionValue)(operator, value, path, {
|
|
1329
|
+
fieldPath: fieldContext == null ? void 0 : fieldContext.fieldPath,
|
|
1330
|
+
fieldType: fieldMeta.type,
|
|
1331
|
+
fieldInterface: fieldMeta.interface
|
|
1332
|
+
});
|
|
1251
1333
|
} catch (error) {
|
|
1252
1334
|
if (error instanceof import_errors.FlowSurfaceBadRequestError) {
|
|
1253
1335
|
pushChartBadRequestAuthoringError(errors, error, path);
|
|
@@ -1256,6 +1338,38 @@ function collectChartFilterDateValueError(operator, value, path, errors) {
|
|
|
1256
1338
|
throw error;
|
|
1257
1339
|
}
|
|
1258
1340
|
}
|
|
1341
|
+
function createChartQueryDateConditionFieldResolver(query, context) {
|
|
1342
|
+
const resource = _.isPlainObject(query == null ? void 0 : query.resource) ? query.resource : null;
|
|
1343
|
+
const collectionName = String((resource == null ? void 0 : resource.collectionName) || "").trim();
|
|
1344
|
+
if (!collectionName || typeof (context == null ? void 0 : context.getCollection) !== "function") {
|
|
1345
|
+
return null;
|
|
1346
|
+
}
|
|
1347
|
+
const dataSourceKey = String((resource == null ? void 0 : resource.dataSourceKey) || "main").trim() || "main";
|
|
1348
|
+
const collection = context.getCollection(dataSourceKey, collectionName);
|
|
1349
|
+
if (!collection) {
|
|
1350
|
+
return null;
|
|
1351
|
+
}
|
|
1352
|
+
return (fieldPath) => {
|
|
1353
|
+
const normalizedFieldPath = (0, import_service_helpers.normalizeFieldPath)(fieldPath);
|
|
1354
|
+
const resolved = resolveDefaultFilterFieldPath(collection, normalizedFieldPath, dataSourceKey, context);
|
|
1355
|
+
return {
|
|
1356
|
+
fieldPath,
|
|
1357
|
+
field: resolved.field
|
|
1358
|
+
};
|
|
1359
|
+
};
|
|
1360
|
+
}
|
|
1361
|
+
function getDateConditionFieldMeta(field) {
|
|
1362
|
+
return {
|
|
1363
|
+
type: (0, import_service_helpers.getFieldType)(field),
|
|
1364
|
+
interface: (0, import_service_helpers.getFieldInterface)(field)
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1367
|
+
function getDateConditionFieldContextMeta(fieldContext) {
|
|
1368
|
+
return {
|
|
1369
|
+
...getDateConditionFieldMeta(fieldContext == null ? void 0 : fieldContext.field),
|
|
1370
|
+
...(fieldContext == null ? void 0 : fieldContext.fieldMeta) || {}
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1259
1373
|
function normalizeChartAssetFieldPath(input) {
|
|
1260
1374
|
if (Array.isArray(input)) {
|
|
1261
1375
|
return input.map((item) => String(item || "").trim()).filter(Boolean).join(".");
|
|
@@ -3616,6 +3730,9 @@ function getGeneratedPopupBusinessFieldCandidates(collection) {
|
|
|
3616
3730
|
if (!fieldName || !(0, import_default_action_popup.isFlowSurfaceDefaultActionPopupBusinessField)(field)) {
|
|
3617
3731
|
return [];
|
|
3618
3732
|
}
|
|
3733
|
+
if ((0, import_relation_backing_foreign_key.isRelationBackingForeignKeyField)(collection, field)) {
|
|
3734
|
+
return [];
|
|
3735
|
+
}
|
|
3619
3736
|
return [
|
|
3620
3737
|
{
|
|
3621
3738
|
field,
|
|
@@ -3730,11 +3847,15 @@ function getGeneratedPopupDefaultFormFieldPaths(candidates, fieldGroups) {
|
|
|
3730
3847
|
}
|
|
3731
3848
|
function getGeneratedPopupRuntimeFieldCandidates(input) {
|
|
3732
3849
|
const candidateContext = DEFAULT_ACTION_POPUP_FIELD_CONTEXT_BY_TYPE[input.actionType];
|
|
3850
|
+
const explicitDefaultFieldPaths = (0, import_default_action_popup.collectFlowSurfaceDefaultActionPopupFieldGroupFieldPaths)(input.fieldGroups);
|
|
3733
3851
|
return (0, import_service_helpers.getCollectionFields)(input.collection).flatMap((field) => {
|
|
3734
3852
|
const fieldName = (0, import_service_helpers.getFieldName)(field);
|
|
3735
3853
|
if (!fieldName || !(0, import_default_action_popup.isFlowSurfaceDefaultActionPopupBusinessField)(field)) {
|
|
3736
3854
|
return [];
|
|
3737
3855
|
}
|
|
3856
|
+
if ((0, import_relation_backing_foreign_key.isRelationBackingForeignKeyField)(input.collection, field) && !explicitDefaultFieldPaths.has(fieldName)) {
|
|
3857
|
+
return [];
|
|
3858
|
+
}
|
|
3738
3859
|
const fieldInterface = (0, import_service_helpers.getFieldInterface)(field);
|
|
3739
3860
|
const registeredBinding = (0, import_field_binding_registry.resolveRegisteredFieldBinding)({
|
|
3740
3861
|
containerUse: candidateContext.ownerUse,
|
|
@@ -3958,9 +4079,16 @@ function collectBlockErrors(block, path, errors, localKeys, context) {
|
|
|
3958
4079
|
collectChartDisplayTitleErrors(block, blockType, path, errors);
|
|
3959
4080
|
collectTreeTableExplicitFieldsErrors(block, blockType, path, errors, context);
|
|
3960
4081
|
collectTreeConnectFieldsErrors((_a = block.settings) == null ? void 0 : _a.connectFields, `${path}.settings.connectFields`, errors);
|
|
3961
|
-
collectTableSettingsErrors(
|
|
3962
|
-
|
|
3963
|
-
|
|
4082
|
+
collectTableSettingsErrors(
|
|
4083
|
+
block,
|
|
4084
|
+
blockType,
|
|
4085
|
+
path,
|
|
4086
|
+
errors,
|
|
4087
|
+
{
|
|
4088
|
+
deferPublicDataScopeErrors: context.authoringActionName === "addBlocks"
|
|
4089
|
+
},
|
|
4090
|
+
context
|
|
4091
|
+
);
|
|
3964
4092
|
collectGridCardSettingsErrors(block, blockType, path, errors);
|
|
3965
4093
|
const descendantContext = getBlockDescendantValidationContext(block, context);
|
|
3966
4094
|
collectActionListErrors(block.actions, `${path}.actions`, errors, block, descendantContext, "actions");
|
|
@@ -3999,7 +4127,7 @@ function collectJsBlockPublicContractErrors(block, path, errors, context) {
|
|
|
3999
4127
|
pushAuthoringError(errors, {
|
|
4000
4128
|
path: `${path}.${key}`,
|
|
4001
4129
|
ruleId: `jsBlock-top-level-${key}-unsupported`,
|
|
4002
|
-
message: `flowSurfaces authoring ${path}.${key} is not accepted on public jsBlock blocks; use ${path}.settings.code and ${path}.settings.
|
|
4130
|
+
message: `flowSurfaces authoring ${path}.${key} is not accepted on public jsBlock blocks; use ${path}.settings.code, ${path}.settings.version, and ${path}.settings.showBlockCard for public JS block settings`,
|
|
4003
4131
|
details: withJsBlockRepairHint({ key })
|
|
4004
4132
|
});
|
|
4005
4133
|
});
|
|
@@ -4010,7 +4138,7 @@ function collectJsBlockPublicContractErrors(block, path, errors, context) {
|
|
|
4010
4138
|
pushAuthoringError(errors, {
|
|
4011
4139
|
path: `${path}.${key}`,
|
|
4012
4140
|
ruleId: key === "stepParams" ? "jsBlock-stepParams-unsupported" : "jsBlock-internal-field-unsupported",
|
|
4013
|
-
message: `flowSurfaces authoring ${path}.${key} is not accepted on public jsBlock blocks; use ${path}.settings.code and ${path}.settings.
|
|
4141
|
+
message: `flowSurfaces authoring ${path}.${key} is not accepted on public jsBlock blocks; use ${path}.settings.code, ${path}.settings.version, and ${path}.settings.showBlockCard instead of internal persisted fields`,
|
|
4014
4142
|
details: withJsBlockRepairHint({
|
|
4015
4143
|
key
|
|
4016
4144
|
})
|
|
@@ -4033,7 +4161,7 @@ function collectJsBlockPublicContractErrors(block, path, errors, context) {
|
|
|
4033
4161
|
pushAuthoringError(errors, {
|
|
4034
4162
|
path: `${path}.settings.${key}`,
|
|
4035
4163
|
ruleId: "jsBlock-settings-unsupported-key",
|
|
4036
|
-
message: `flowSurfaces authoring ${path}.settings.${key} is not part of the public jsBlock contract; use ${path}.settings.code and ${path}.settings.
|
|
4164
|
+
message: `flowSurfaces authoring ${path}.settings.${key} is not part of the public jsBlock contract; use ${path}.settings.code, ${path}.settings.version, and ${path}.settings.showBlockCard for public JS block settings`,
|
|
4037
4165
|
details: withJsBlockRepairHint({
|
|
4038
4166
|
key,
|
|
4039
4167
|
allowedKeys: Array.from(JS_BLOCK_ALLOWED_SETTINGS_KEYS)
|
|
@@ -4075,7 +4203,7 @@ function collectJsBlockConfigurePublicContractErrors(changes, path, errors) {
|
|
|
4075
4203
|
pushAuthoringError(errors, {
|
|
4076
4204
|
path: `${path}.${key}`,
|
|
4077
4205
|
ruleId: key === "stepParams" ? "jsBlock-stepParams-unsupported" : "jsBlock-internal-field-unsupported",
|
|
4078
|
-
message: `flowSurfaces authoring ${path}.${key} is not accepted on public jsBlock configure changes; use ${path}.code and ${path}.
|
|
4206
|
+
message: `flowSurfaces authoring ${path}.${key} is not accepted on public jsBlock configure changes; use ${path}.code, ${path}.version, and ${path}.showBlockCard instead of internal persisted fields`,
|
|
4079
4207
|
details: withJsBlockRepairHint({
|
|
4080
4208
|
key
|
|
4081
4209
|
})
|
|
@@ -4108,7 +4236,7 @@ function collectJsBlockConfigurePublicContractErrors(changes, path, errors) {
|
|
|
4108
4236
|
pushAuthoringError(errors, {
|
|
4109
4237
|
path: `${path}.settings`,
|
|
4110
4238
|
ruleId: "jsBlock-settings-unsupported-key",
|
|
4111
|
-
message: `flowSurfaces authoring ${path}.settings is not part of the public jsBlock configure contract; use ${path}.code and ${path}.
|
|
4239
|
+
message: `flowSurfaces authoring ${path}.settings is not part of the public jsBlock configure contract; use ${path}.code, ${path}.version, and ${path}.showBlockCard`,
|
|
4112
4240
|
details: withJsBlockRepairHint()
|
|
4113
4241
|
});
|
|
4114
4242
|
return;
|
|
@@ -4268,11 +4396,12 @@ async function collectConfigureErrors(values, errors, context) {
|
|
|
4268
4396
|
collectCommentsBlockErrors(changesBlock, hostBlockType, "$.changes", errors, context);
|
|
4269
4397
|
collectRecordHistoryBlockErrors(changesBlock, hostBlockType, "$.changes", errors, context);
|
|
4270
4398
|
collectChartDisplayTitleErrors(changes, hostBlockType, "$.changes", errors);
|
|
4271
|
-
collectChartConfigureFilterOperatorErrors(changes, hostBlockType, "$.changes", errors);
|
|
4272
|
-
collectTableSettingsErrors(changes, hostBlockType, "$.changes", errors, { directSettings: true });
|
|
4399
|
+
collectChartConfigureFilterOperatorErrors(changes, hostBlockType, "$.changes", errors, context);
|
|
4400
|
+
collectTableSettingsErrors(changes, hostBlockType, "$.changes", errors, { directSettings: true }, context);
|
|
4273
4401
|
collectGridCardSettingsErrors(changes, hostBlockType, "$.changes", errors, { directSettings: true });
|
|
4274
4402
|
collectAssignValuesErrors(changes.assignValues, "$.changes.assignValues", errors, changesBlock, context);
|
|
4275
4403
|
collectTriggerWorkflowsErrors(changes.triggerWorkflows, "$.changes.triggerWorkflows", errors);
|
|
4404
|
+
collectLinkageRulesErrors(changes.linkageRules, "$.changes.linkageRules", errors);
|
|
4276
4405
|
collectFieldListInternalKeyErrors(changes.fields, "$.changes.fields", errors);
|
|
4277
4406
|
const connectFieldsTargets = collectTreeConnectFieldsErrors(changes.connectFields, "$.changes.connectFields", errors);
|
|
4278
4407
|
await collectTreeConnectFieldsLiveErrors(connectFieldsTargets, changes, "$.changes.connectFields", errors, context);
|
|
@@ -4357,10 +4486,20 @@ function collectUnsupportedDefaultFilterOperatorError(operator, path, errors) {
|
|
|
4357
4486
|
}
|
|
4358
4487
|
});
|
|
4359
4488
|
}
|
|
4360
|
-
function collectDefaultFilterDateValueError(operator, value, path, errors) {
|
|
4489
|
+
function collectDefaultFilterDateValueError(operator, value, path, errors, fieldContext, options = {}) {
|
|
4361
4490
|
var _a, _b, _c;
|
|
4491
|
+
const fieldMeta = getDateConditionFieldContextMeta(fieldContext);
|
|
4492
|
+
const normalizedOperator = typeof operator === "string" ? operator.trim() : "";
|
|
4493
|
+
if (!import_filter_group.FLOW_SURFACE_DATE_FILTER_OPERATORS.has(normalizedOperator) && !(0, import_filter_group.isFlowSurfaceDateLikeFieldMeta)(fieldMeta)) {
|
|
4494
|
+
return;
|
|
4495
|
+
}
|
|
4362
4496
|
try {
|
|
4363
|
-
(0, import_filter_group.
|
|
4497
|
+
(0, import_filter_group.normalizeFlowSurfaceDateConditionValue)(operator, value, path, {
|
|
4498
|
+
fieldPath: fieldContext == null ? void 0 : fieldContext.fieldPath,
|
|
4499
|
+
fieldType: fieldMeta.type,
|
|
4500
|
+
fieldInterface: fieldMeta.interface,
|
|
4501
|
+
allowContextPathValue: options.allowContextPathValue
|
|
4502
|
+
});
|
|
4364
4503
|
} catch (error) {
|
|
4365
4504
|
if (!(error instanceof import_errors.FlowSurfaceBadRequestError)) {
|
|
4366
4505
|
throw error;
|
|
@@ -4374,6 +4513,82 @@ function collectDefaultFilterDateValueError(operator, value, path, errors) {
|
|
|
4374
4513
|
});
|
|
4375
4514
|
}
|
|
4376
4515
|
}
|
|
4516
|
+
function collectPublicDataScopeDateOperatorError(operator, value, path, errors, fieldContext) {
|
|
4517
|
+
const fieldMeta = getDateConditionFieldContextMeta(fieldContext);
|
|
4518
|
+
if (!(0, import_filter_group.isFlowSurfaceDateLikeFieldMeta)(fieldMeta)) {
|
|
4519
|
+
return;
|
|
4520
|
+
}
|
|
4521
|
+
const normalizedOperator = typeof operator === "string" ? operator.trim() : "";
|
|
4522
|
+
if (FLOW_SURFACE_DATA_SCOPE_DATE_ALLOWED_OPERATORS.has(normalizedOperator)) {
|
|
4523
|
+
return;
|
|
4524
|
+
}
|
|
4525
|
+
const isComparisonOperator = FLOW_SURFACE_DATA_SCOPE_DATE_UI_INCOMPATIBLE_OPERATORS.has(normalizedOperator);
|
|
4526
|
+
const suggestedOperator = isComparisonOperator ? getSuggestedPublicDataScopeDateOperator(normalizedOperator) : void 0;
|
|
4527
|
+
const suggestedValue = getSuggestedPublicDataScopeDateValue(value);
|
|
4528
|
+
pushAuthoringError(errors, {
|
|
4529
|
+
path,
|
|
4530
|
+
ruleId: "dataScope-date-operator-ui-incompatible",
|
|
4531
|
+
message: `flowSurfaces authoring ${path} cannot use operator '${normalizedOperator}' for a date/datetime DataScope condition`,
|
|
4532
|
+
details: {
|
|
4533
|
+
fieldPath: fieldContext == null ? void 0 : fieldContext.fieldPath,
|
|
4534
|
+
fieldType: fieldMeta.type,
|
|
4535
|
+
fieldInterface: fieldMeta.interface,
|
|
4536
|
+
invalidOperator: normalizedOperator,
|
|
4537
|
+
invalidValue: value,
|
|
4538
|
+
allowedOperators: Array.from(FLOW_SURFACE_DATA_SCOPE_DATE_ALLOWED_OPERATORS),
|
|
4539
|
+
...suggestedOperator ? { suggestedOperator } : {},
|
|
4540
|
+
...typeof suggestedValue !== "undefined" ? { suggestedValue } : {},
|
|
4541
|
+
repairHint: 'For public settings.dataScope date/datetime fields, use UI date operators such as $dateOn with UI date values like "2026-07-05"; do not move fixed data-range conditions to defaultFilter.',
|
|
4542
|
+
repairExample: {
|
|
4543
|
+
logic: "$and",
|
|
4544
|
+
items: [
|
|
4545
|
+
{
|
|
4546
|
+
path: (fieldContext == null ? void 0 : fieldContext.fieldPath) || "createdAt",
|
|
4547
|
+
operator: suggestedOperator || "$dateOn",
|
|
4548
|
+
value: typeof suggestedValue !== "undefined" ? suggestedValue : "2026-07-05"
|
|
4549
|
+
}
|
|
4550
|
+
]
|
|
4551
|
+
},
|
|
4552
|
+
agentInstruction: "Replace date/datetime DataScope comparison operators with $dateOn/$dateNotOn/$dateBefore/$dateAfter/$dateNotBefore/$dateNotAfter/$dateBetween and UI date values. Keep the condition in dataScope when it is a fixed data range."
|
|
4553
|
+
}
|
|
4554
|
+
});
|
|
4555
|
+
}
|
|
4556
|
+
function getSuggestedPublicDataScopeDateOperator(operator) {
|
|
4557
|
+
switch (operator) {
|
|
4558
|
+
case "$eq":
|
|
4559
|
+
return "$dateOn";
|
|
4560
|
+
case "$ne":
|
|
4561
|
+
return "$dateNotOn";
|
|
4562
|
+
case "$lt":
|
|
4563
|
+
return "$dateBefore";
|
|
4564
|
+
case "$lte":
|
|
4565
|
+
return "$dateNotAfter";
|
|
4566
|
+
case "$gt":
|
|
4567
|
+
return "$dateAfter";
|
|
4568
|
+
case "$gte":
|
|
4569
|
+
return "$dateNotBefore";
|
|
4570
|
+
default:
|
|
4571
|
+
return void 0;
|
|
4572
|
+
}
|
|
4573
|
+
}
|
|
4574
|
+
function getSuggestedPublicDataScopeDateValue(value) {
|
|
4575
|
+
if (typeof value === "string") {
|
|
4576
|
+
const match = /^(\d{4}-\d{2}-\d{2})/.exec(value.trim());
|
|
4577
|
+
if (match) {
|
|
4578
|
+
return match[1];
|
|
4579
|
+
}
|
|
4580
|
+
}
|
|
4581
|
+
if (Array.isArray(value)) {
|
|
4582
|
+
const suggested = value.map((item) => {
|
|
4583
|
+
var _a;
|
|
4584
|
+
return typeof item === "string" ? (_a = /^(\d{4}-\d{2}-\d{2})/.exec(item.trim())) == null ? void 0 : _a[1] : void 0;
|
|
4585
|
+
}).filter(Boolean);
|
|
4586
|
+
if (suggested.length === value.length && suggested.length > 0) {
|
|
4587
|
+
return suggested;
|
|
4588
|
+
}
|
|
4589
|
+
}
|
|
4590
|
+
return void 0;
|
|
4591
|
+
}
|
|
4377
4592
|
function collectTopLevelLayoutErrors(actionName, values, errors) {
|
|
4378
4593
|
if (actionName !== "applyBlueprint") {
|
|
4379
4594
|
return;
|
|
@@ -5423,13 +5638,13 @@ function collectChartDisplayTitleErrors(block, blockType, blockPath, errors) {
|
|
|
5423
5638
|
message: "Chart block settings do not support displayTitle in the current flowSurfaces runtime; keep settings.title and omit displayTitle."
|
|
5424
5639
|
});
|
|
5425
5640
|
}
|
|
5426
|
-
function collectChartConfigureFilterOperatorErrors(changes, hostBlockType, path, errors) {
|
|
5641
|
+
function collectChartConfigureFilterOperatorErrors(changes, hostBlockType, path, errors, context) {
|
|
5427
5642
|
if (hostBlockType !== "chart" || !_.isPlainObject(changes)) {
|
|
5428
5643
|
return;
|
|
5429
5644
|
}
|
|
5430
|
-
collectChartQueryFilterOperatorErrors(changes.query, `${path}.query`, errors);
|
|
5645
|
+
collectChartQueryFilterOperatorErrors(changes.query, `${path}.query`, errors, context);
|
|
5431
5646
|
if (_.isPlainObject(changes.configure)) {
|
|
5432
|
-
collectChartQueryFilterOperatorErrors(changes.configure.query, `${path}.configure.query`, errors);
|
|
5647
|
+
collectChartQueryFilterOperatorErrors(changes.configure.query, `${path}.configure.query`, errors, context);
|
|
5433
5648
|
}
|
|
5434
5649
|
}
|
|
5435
5650
|
function visitFilterItems(value, path, errors, block, context = {}) {
|
|
@@ -5446,7 +5661,13 @@ function visitFilterItems(value, path, errors, block, context = {}) {
|
|
|
5446
5661
|
}
|
|
5447
5662
|
if (typeof value.operator === "string") {
|
|
5448
5663
|
collectUnsupportedDefaultFilterOperatorError(value.operator, `${path}.operator`, errors);
|
|
5449
|
-
collectDefaultFilterDateValueError(
|
|
5664
|
+
collectDefaultFilterDateValueError(
|
|
5665
|
+
value.operator,
|
|
5666
|
+
value.value,
|
|
5667
|
+
`${path}.value`,
|
|
5668
|
+
errors,
|
|
5669
|
+
fieldRef ? resolveDefaultFilterDateConditionField(fieldRef.value, block, context) : void 0
|
|
5670
|
+
);
|
|
5450
5671
|
}
|
|
5451
5672
|
const filterItems = value.items;
|
|
5452
5673
|
if (Array.isArray(filterItems)) {
|
|
@@ -5472,11 +5693,33 @@ function visitFilterItems(value, path, errors, block, context = {}) {
|
|
|
5472
5693
|
if (_.isPlainObject(child)) {
|
|
5473
5694
|
Object.entries(child).forEach(([operator, operatorValue]) => {
|
|
5474
5695
|
collectUnsupportedDefaultFilterOperatorError(operator, `${path}.${key}.${operator}`, errors);
|
|
5475
|
-
collectDefaultFilterDateValueError(
|
|
5696
|
+
collectDefaultFilterDateValueError(
|
|
5697
|
+
operator,
|
|
5698
|
+
operatorValue,
|
|
5699
|
+
`${path}.${key}.${operator}`,
|
|
5700
|
+
errors,
|
|
5701
|
+
resolveDefaultFilterDateConditionField(key, block, context)
|
|
5702
|
+
);
|
|
5476
5703
|
});
|
|
5477
5704
|
}
|
|
5478
5705
|
});
|
|
5479
5706
|
}
|
|
5707
|
+
function resolveDefaultFilterDateConditionField(rawFieldPath, block, context) {
|
|
5708
|
+
const fieldPath = String(rawFieldPath || "").trim();
|
|
5709
|
+
if (!fieldPath || fieldPath.startsWith("$") || fieldPath.startsWith("{{")) {
|
|
5710
|
+
return null;
|
|
5711
|
+
}
|
|
5712
|
+
const collection = getBlockCollection(block, context);
|
|
5713
|
+
if (!collection) {
|
|
5714
|
+
return null;
|
|
5715
|
+
}
|
|
5716
|
+
const dataSourceKey = getBlockDataSourceKey(block, context);
|
|
5717
|
+
const resolved = resolveDefaultFilterFieldPath(collection, (0, import_service_helpers.normalizeFieldPath)(fieldPath), dataSourceKey, context);
|
|
5718
|
+
return {
|
|
5719
|
+
fieldPath,
|
|
5720
|
+
field: resolved.field
|
|
5721
|
+
};
|
|
5722
|
+
}
|
|
5480
5723
|
function collectTreeConnectFieldsErrors(value, path, errors) {
|
|
5481
5724
|
if (_.isUndefined(value)) {
|
|
5482
5725
|
return [];
|
|
@@ -5825,7 +6068,7 @@ function getCollectionFilterTargetKey(collection) {
|
|
|
5825
6068
|
function normalizeDataSourceKey(value) {
|
|
5826
6069
|
return String(value || "main").trim() || "main";
|
|
5827
6070
|
}
|
|
5828
|
-
function collectTableSettingsErrors(block, blockType, blockPath, errors, options = {}) {
|
|
6071
|
+
function collectTableSettingsErrors(block, blockType, blockPath, errors, options = {}, context = {}) {
|
|
5829
6072
|
if (blockType !== "table" || !_.isPlainObject(block)) {
|
|
5830
6073
|
return;
|
|
5831
6074
|
}
|
|
@@ -5836,6 +6079,9 @@ function collectTableSettingsErrors(block, blockType, blockPath, errors, options
|
|
|
5836
6079
|
});
|
|
5837
6080
|
const hasSettings = _.isPlainObject(block == null ? void 0 : block.settings);
|
|
5838
6081
|
if (!hasSettings) {
|
|
6082
|
+
if (options.directSettings === true && !shouldDeferPublicDataScopeErrorsToBatchItem(blockPath, errors, options)) {
|
|
6083
|
+
collectPublicDataScopeErrors(block.dataScope, `${blockPath}.dataScope`, errors, block, context);
|
|
6084
|
+
}
|
|
5839
6085
|
return;
|
|
5840
6086
|
}
|
|
5841
6087
|
const settings = block.settings;
|
|
@@ -5850,7 +6096,7 @@ function collectTableSettingsErrors(block, blockType, blockPath, errors, options
|
|
|
5850
6096
|
pushTableSettingsUnsupportedError(errors, `${settingsPath}.${key}`, key);
|
|
5851
6097
|
});
|
|
5852
6098
|
if (!shouldDeferPublicDataScopeErrorsToBatchItem(blockPath, errors, options)) {
|
|
5853
|
-
collectPublicDataScopeErrors(settings.dataScope, `${settingsPath}.dataScope`, errors);
|
|
6099
|
+
collectPublicDataScopeErrors(settings.dataScope, `${settingsPath}.dataScope`, errors, block, context);
|
|
5854
6100
|
}
|
|
5855
6101
|
}
|
|
5856
6102
|
function pushTableSettingsUnsupportedError(errors, path, key) {
|
|
@@ -5865,7 +6111,7 @@ function pushTableSettingsUnsupportedError(errors, path, key) {
|
|
|
5865
6111
|
}
|
|
5866
6112
|
});
|
|
5867
6113
|
}
|
|
5868
|
-
function collectPublicDataScopeErrors(value, path, errors) {
|
|
6114
|
+
function collectPublicDataScopeErrors(value, path, errors, block, context) {
|
|
5869
6115
|
if (_.isUndefined(value)) {
|
|
5870
6116
|
return;
|
|
5871
6117
|
}
|
|
@@ -5885,6 +6131,62 @@ function collectPublicDataScopeErrors(value, path, errors) {
|
|
|
5885
6131
|
repairHint: 'Use settings.dataScope with logic/items, for example {"logic":"$and","items":[{"path":"status","operator":"$eq","value":"Active"}]}; do not use a field-name map.'
|
|
5886
6132
|
}
|
|
5887
6133
|
});
|
|
6134
|
+
return;
|
|
6135
|
+
}
|
|
6136
|
+
collectPublicDataScopeFieldPathErrors(validationValue, path, errors, block, context);
|
|
6137
|
+
collectFilterGroupDateConditionErrors(validationValue, path, errors, block, context);
|
|
6138
|
+
}
|
|
6139
|
+
function collectPublicDataScopeFieldPathErrors(value, path, errors, block, context) {
|
|
6140
|
+
if (!_.isPlainObject(value)) {
|
|
6141
|
+
return;
|
|
6142
|
+
}
|
|
6143
|
+
if (hasOwn(value, "operator")) {
|
|
6144
|
+
collectPublicDataScopeFieldPathError(value.path, `${path}.path`, block, context, errors);
|
|
6145
|
+
}
|
|
6146
|
+
if (Array.isArray(value.items)) {
|
|
6147
|
+
value.items.forEach(
|
|
6148
|
+
(item, index) => collectPublicDataScopeFieldPathErrors(item, `${path}.items[${index}]`, errors, block, context)
|
|
6149
|
+
);
|
|
6150
|
+
}
|
|
6151
|
+
}
|
|
6152
|
+
function collectPublicDataScopeFieldPathError(rawFieldPath, path, block, context, errors) {
|
|
6153
|
+
const fieldPath = String(rawFieldPath || "").trim();
|
|
6154
|
+
if (!fieldPath || fieldPath.startsWith("$") || fieldPath.startsWith("{{")) {
|
|
6155
|
+
return;
|
|
6156
|
+
}
|
|
6157
|
+
const collection = getBlockCollection(block, context);
|
|
6158
|
+
if (!collection) {
|
|
6159
|
+
return;
|
|
6160
|
+
}
|
|
6161
|
+
const resolved = resolveDefaultFilterFieldPath(
|
|
6162
|
+
collection,
|
|
6163
|
+
(0, import_service_helpers.normalizeFieldPath)(fieldPath),
|
|
6164
|
+
getBlockDataSourceKey(block, context),
|
|
6165
|
+
context
|
|
6166
|
+
);
|
|
6167
|
+
if (!resolved.field) {
|
|
6168
|
+
pushAuthoringError(errors, {
|
|
6169
|
+
path,
|
|
6170
|
+
ruleId: "field-path-unknown",
|
|
6171
|
+
message: `flowSurfaces authoring ${path} references unknown field '${fieldPath}'`,
|
|
6172
|
+
details: {
|
|
6173
|
+
fieldPath,
|
|
6174
|
+
collection: (0, import_service_helpers.getCollectionName)(resolved.collection || collection),
|
|
6175
|
+
availableFields: (0, import_service_helpers.getCollectionFields)(resolved.collection || collection).map((field) => String((0, import_service_helpers.getFieldName)(field) || "").trim()).filter(Boolean)
|
|
6176
|
+
}
|
|
6177
|
+
});
|
|
6178
|
+
return;
|
|
6179
|
+
}
|
|
6180
|
+
if ((0, import_service_helpers.isAssociationField)(resolved.field)) {
|
|
6181
|
+
pushAuthoringError(errors, {
|
|
6182
|
+
path,
|
|
6183
|
+
ruleId: "defaultFilter-relation-field-unsupported",
|
|
6184
|
+
message: `flowSurfaces authoring ${path} cannot use relation field '${fieldPath}' itself; use a scalar subfield instead`,
|
|
6185
|
+
details: {
|
|
6186
|
+
fieldPath,
|
|
6187
|
+
fieldName: (0, import_service_helpers.getFieldName)(resolved.field)
|
|
6188
|
+
}
|
|
6189
|
+
});
|
|
5888
6190
|
}
|
|
5889
6191
|
}
|
|
5890
6192
|
function shouldDeferPublicDataScopeErrorsToBatchItem(blockPath, errors, options) {
|
|
@@ -5906,6 +6208,24 @@ function normalizePublicDataScopeValueForValidation(value) {
|
|
|
5906
6208
|
}
|
|
5907
6209
|
return value;
|
|
5908
6210
|
}
|
|
6211
|
+
function collectFilterGroupDateConditionErrors(value, path, errors, block, context) {
|
|
6212
|
+
if (!_.isPlainObject(value)) {
|
|
6213
|
+
return;
|
|
6214
|
+
}
|
|
6215
|
+
if (Array.isArray(value.items)) {
|
|
6216
|
+
value.items.forEach(
|
|
6217
|
+
(item, index) => collectFilterGroupDateConditionErrors(item, `${path}.items[${index}]`, errors, block, context)
|
|
6218
|
+
);
|
|
6219
|
+
return;
|
|
6220
|
+
}
|
|
6221
|
+
if (!hasOwn(value, "operator")) {
|
|
6222
|
+
return;
|
|
6223
|
+
}
|
|
6224
|
+
const fieldPath = String(value.path || value.field || "").trim();
|
|
6225
|
+
const fieldContext = fieldPath ? resolveDefaultFilterDateConditionField(fieldPath, block, context) : void 0;
|
|
6226
|
+
collectPublicDataScopeDateOperatorError(value.operator, value.value, `${path}.operator`, errors, fieldContext);
|
|
6227
|
+
collectDefaultFilterDateValueError(value.operator, value.value, `${path}.value`, errors, fieldContext);
|
|
6228
|
+
}
|
|
5909
6229
|
function collectGridCardSettingsErrors(block, blockType, blockPath, errors, options = {}) {
|
|
5910
6230
|
const hasSettings = _.isPlainObject(block == null ? void 0 : block.settings);
|
|
5911
6231
|
if (!hasSettings && options.directSettings !== true) {
|
|
@@ -6033,11 +6353,12 @@ function buildAuthoringAIEmployeeActionIdentity(settings) {
|
|
|
6033
6353
|
return stableSerializeAuthoringValue(normalizeAuthoringAIEmployeePublicSettingsForIdentity(settings));
|
|
6034
6354
|
}
|
|
6035
6355
|
function normalizeAuthoringAIEmployeePublicSettingsForIdentity(settings) {
|
|
6356
|
+
const workContext = Object.prototype.hasOwnProperty.call(settings, "workContext") ? normalizeAuthoringAIEmployeeWorkContextForIdentity(settings.workContext) : [{ type: "flow-model", target: "self" }];
|
|
6036
6357
|
return {
|
|
6037
6358
|
username: String(settings.username || "").trim(),
|
|
6038
6359
|
auto: typeof settings.auto === "boolean" ? settings.auto : false,
|
|
6039
|
-
workContext
|
|
6040
|
-
tasks: normalizeAuthoringAIEmployeeTasksForIdentity(settings.tasks),
|
|
6360
|
+
workContext,
|
|
6361
|
+
tasks: normalizeAuthoringAIEmployeeTasksForIdentity(settings.tasks, workContext),
|
|
6041
6362
|
style: {
|
|
6042
6363
|
...AUTHORING_AI_EMPLOYEE_DEFAULT_STYLE,
|
|
6043
6364
|
..._.isPlainObject(settings.style) ? _.pick(settings.style, AUTHORING_AI_EMPLOYEE_STYLE_PUBLIC_KEYS) : {}
|
|
@@ -6056,7 +6377,14 @@ function normalizeAuthoringAIEmployeeWorkContextForIdentity(value) {
|
|
|
6056
6377
|
return output;
|
|
6057
6378
|
});
|
|
6058
6379
|
}
|
|
6059
|
-
function
|
|
6380
|
+
function normalizeAuthoringAIEmployeeTaskWorkContextForIdentity(value, defaultWorkContext) {
|
|
6381
|
+
const normalized = normalizeAuthoringAIEmployeeWorkContextForIdentity(value);
|
|
6382
|
+
if (Array.isArray(defaultWorkContext) && !normalized.length) {
|
|
6383
|
+
return _.cloneDeep(defaultWorkContext);
|
|
6384
|
+
}
|
|
6385
|
+
return normalized;
|
|
6386
|
+
}
|
|
6387
|
+
function normalizeAuthoringAIEmployeeTasksForIdentity(value, defaultWorkContext) {
|
|
6060
6388
|
return _.castArray(value || []).map((task) => {
|
|
6061
6389
|
if (!_.isPlainObject(task)) {
|
|
6062
6390
|
return task;
|
|
@@ -6064,10 +6392,11 @@ function normalizeAuthoringAIEmployeeTasksForIdentity(value) {
|
|
|
6064
6392
|
const output = _.pick(task, AUTHORING_AI_EMPLOYEE_TASK_PUBLIC_SETTING_KEYS);
|
|
6065
6393
|
if (_.isPlainObject(output.message)) {
|
|
6066
6394
|
output.message = _.pick(output.message, AUTHORING_AI_EMPLOYEE_TASK_MESSAGE_PUBLIC_KEYS);
|
|
6067
|
-
if (
|
|
6068
|
-
output.message.workContext =
|
|
6069
|
-
|
|
6070
|
-
|
|
6395
|
+
if (Object.prototype.hasOwnProperty.call(output.message, "workContext")) {
|
|
6396
|
+
output.message.workContext = normalizeAuthoringAIEmployeeTaskWorkContextForIdentity(
|
|
6397
|
+
output.message.workContext,
|
|
6398
|
+
defaultWorkContext
|
|
6399
|
+
);
|
|
6071
6400
|
}
|
|
6072
6401
|
}
|
|
6073
6402
|
if (Object.prototype.hasOwnProperty.call(task, "prompt") && !Object.prototype.hasOwnProperty.call(output.message || {}, "user")) {
|
|
@@ -6076,6 +6405,13 @@ function normalizeAuthoringAIEmployeeTasksForIdentity(value) {
|
|
|
6076
6405
|
user: task.prompt
|
|
6077
6406
|
};
|
|
6078
6407
|
}
|
|
6408
|
+
if (!_.isPlainObject(output.message) && Array.isArray(defaultWorkContext)) {
|
|
6409
|
+
output.message = {
|
|
6410
|
+
workContext: _.cloneDeep(defaultWorkContext)
|
|
6411
|
+
};
|
|
6412
|
+
} else if (_.isPlainObject(output.message) && !Object.prototype.hasOwnProperty.call(output.message, "workContext")) {
|
|
6413
|
+
output.message.workContext = _.cloneDeep(defaultWorkContext || []);
|
|
6414
|
+
}
|
|
6079
6415
|
if (_.isPlainObject(output.model)) {
|
|
6080
6416
|
output.model = _.pick(output.model, AUTHORING_AI_EMPLOYEE_TASK_MODEL_PUBLIC_KEYS);
|
|
6081
6417
|
}
|
|
@@ -6154,7 +6490,7 @@ function collectActionSlotErrors(actionType, path, errors, block, slot = "action
|
|
|
6154
6490
|
}
|
|
6155
6491
|
}
|
|
6156
6492
|
function collectActionErrors(action, path, errors, block, context = {}, slot = "actions") {
|
|
6157
|
-
var _a, _b, _c, _d;
|
|
6493
|
+
var _a, _b, _c, _d, _e;
|
|
6158
6494
|
const actionType = resolveAuthoringActionType(action, block);
|
|
6159
6495
|
collectActionSlotErrors(actionType, path, errors, block, slot);
|
|
6160
6496
|
if (!_.isPlainObject(action)) {
|
|
@@ -6163,6 +6499,7 @@ function collectActionErrors(action, path, errors, block, context = {}, slot = "
|
|
|
6163
6499
|
collectApplyBlueprintScriptAssetReferenceErrors(action, path, errors, context);
|
|
6164
6500
|
collectAssignValuesErrors((_a = action.settings) == null ? void 0 : _a.assignValues, `${path}.settings.assignValues`, errors, block, context);
|
|
6165
6501
|
collectTriggerWorkflowsErrors((_b = action.settings) == null ? void 0 : _b.triggerWorkflows, `${path}.settings.triggerWorkflows`, errors);
|
|
6502
|
+
collectLinkageRulesErrors((_c = action.settings) == null ? void 0 : _c.linkageRules, `${path}.settings.linkageRules`, errors);
|
|
6166
6503
|
if (hasOwn(action, "assignValues")) {
|
|
6167
6504
|
pushAuthoringError(errors, {
|
|
6168
6505
|
path: `${path}.assignValues`,
|
|
@@ -6198,7 +6535,7 @@ function collectActionErrors(action, path, errors, block, context = {}, slot = "
|
|
|
6198
6535
|
}
|
|
6199
6536
|
});
|
|
6200
6537
|
}
|
|
6201
|
-
const hasRunnableSource = typeof action.source === "string" && action.source.trim() || typeof action.code === "string" && action.code.trim() || hasApplyBlueprintRunnableScriptAssetReference(action.script, context) || typeof ((
|
|
6538
|
+
const hasRunnableSource = typeof action.source === "string" && action.source.trim() || typeof action.code === "string" && action.code.trim() || hasApplyBlueprintRunnableScriptAssetReference(action.script, context) || typeof ((_d = action.settings) == null ? void 0 : _d.source) === "string" && action.settings.source.trim() || typeof ((_e = action.settings) == null ? void 0 : _e.code) === "string" && action.settings.code.trim();
|
|
6202
6539
|
if (!hasRunnableSource) {
|
|
6203
6540
|
pushAuthoringError(errors, {
|
|
6204
6541
|
path,
|
|
@@ -6463,6 +6800,59 @@ function collectTriggerWorkflowsErrors(value, path, errors) {
|
|
|
6463
6800
|
}
|
|
6464
6801
|
});
|
|
6465
6802
|
}
|
|
6803
|
+
function collectLinkageRulesErrors(value, path, errors) {
|
|
6804
|
+
if (_.isUndefined(value)) {
|
|
6805
|
+
return;
|
|
6806
|
+
}
|
|
6807
|
+
if (!Array.isArray(value)) {
|
|
6808
|
+
pushAuthoringError(errors, {
|
|
6809
|
+
path,
|
|
6810
|
+
ruleId: "linkageRules-invalid-shape",
|
|
6811
|
+
message: `flowSurfaces authoring ${path} must be an array`
|
|
6812
|
+
});
|
|
6813
|
+
return;
|
|
6814
|
+
}
|
|
6815
|
+
value.forEach((rule, index) => {
|
|
6816
|
+
const rulePath = `${path}[${index}]`;
|
|
6817
|
+
if (!_.isPlainObject(rule)) {
|
|
6818
|
+
pushAuthoringError(errors, {
|
|
6819
|
+
path: rulePath,
|
|
6820
|
+
ruleId: "linkageRules-rule-invalid-shape",
|
|
6821
|
+
message: `flowSurfaces authoring ${rulePath} must be an object`
|
|
6822
|
+
});
|
|
6823
|
+
return;
|
|
6824
|
+
}
|
|
6825
|
+
const conditionPath = hasOwn(rule, "condition") ? `${rulePath}.condition` : hasOwn(rule, "when") ? `${rulePath}.when` : `${rulePath}.condition`;
|
|
6826
|
+
const conditionValue = hasOwn(rule, "condition") ? rule.condition : hasOwn(rule, "when") ? rule.when : import_filter_group.FLOW_SURFACE_EMPTY_FILTER_GROUP;
|
|
6827
|
+
try {
|
|
6828
|
+
(0, import_filter_group.normalizeFlowSurfaceCompatibleFilterGroupValue)(
|
|
6829
|
+
conditionValue,
|
|
6830
|
+
`flowSurfaces authoring ${conditionPath} expects FilterGroup or backend query filter like ${import_filter_group.FLOW_SURFACE_FILTER_GROUP_EXAMPLE}`,
|
|
6831
|
+
{ strictDateValues: true }
|
|
6832
|
+
);
|
|
6833
|
+
} catch (error) {
|
|
6834
|
+
pushAuthoringError(errors, {
|
|
6835
|
+
path: conditionPath,
|
|
6836
|
+
ruleId: "linkageRules-condition-invalid-shape",
|
|
6837
|
+
message: error instanceof Error ? error.message : String(error)
|
|
6838
|
+
});
|
|
6839
|
+
}
|
|
6840
|
+
if (hasOwn(rule, "actions") && !Array.isArray(rule.actions)) {
|
|
6841
|
+
pushAuthoringError(errors, {
|
|
6842
|
+
path: `${rulePath}.actions`,
|
|
6843
|
+
ruleId: "linkageRules-actions-invalid-shape",
|
|
6844
|
+
message: `flowSurfaces authoring ${rulePath}.actions must be an array`
|
|
6845
|
+
});
|
|
6846
|
+
}
|
|
6847
|
+
if (hasOwn(rule, "then") && !Array.isArray(rule.then)) {
|
|
6848
|
+
pushAuthoringError(errors, {
|
|
6849
|
+
path: `${rulePath}.then`,
|
|
6850
|
+
ruleId: "linkageRules-actions-invalid-shape",
|
|
6851
|
+
message: `flowSurfaces authoring ${rulePath}.then must be an array`
|
|
6852
|
+
});
|
|
6853
|
+
}
|
|
6854
|
+
});
|
|
6855
|
+
}
|
|
6466
6856
|
function collectPopupErrors(popup, path, errors, localKeys, context = {}) {
|
|
6467
6857
|
if (!_.isPlainObject(popup)) {
|
|
6468
6858
|
return;
|
|
@@ -6516,7 +6906,7 @@ function collectNestedBlockErrors(blocks, path, errors, localKeys, context) {
|
|
|
6516
6906
|
}
|
|
6517
6907
|
blocks.forEach((block, index) => collectBlockErrors(block, `${path}[${index}]`, errors, localKeys, context));
|
|
6518
6908
|
}
|
|
6519
|
-
function collectReactionErrors(reaction, path, localKeys, errors) {
|
|
6909
|
+
function collectReactionErrors(reaction, path, localKeys, errors, options = {}) {
|
|
6520
6910
|
const items = Array.isArray(reaction == null ? void 0 : reaction.items) ? reaction.items : [];
|
|
6521
6911
|
items.forEach((item, index) => {
|
|
6522
6912
|
const rawTarget = (item == null ? void 0 : item.target) ?? (item == null ? void 0 : item.targetKey) ?? (item == null ? void 0 : item.targetBlock);
|
|
@@ -6534,8 +6924,198 @@ function collectReactionErrors(reaction, path, localKeys, errors) {
|
|
|
6534
6924
|
message: `flowSurfaces authoring ${path}.items[${index}].target references unknown local target '${target}'`
|
|
6535
6925
|
});
|
|
6536
6926
|
}
|
|
6927
|
+
collectReactionItemDateConditionErrors(item, `${path}.items[${index}]`, target, errors, options);
|
|
6537
6928
|
});
|
|
6538
6929
|
}
|
|
6930
|
+
function collectReactionItemDateConditionErrors(item, path, target, errors, options) {
|
|
6931
|
+
if (!_.isPlainObject(item) || !_.isPlainObject(options.values) || !options.context) {
|
|
6932
|
+
return;
|
|
6933
|
+
}
|
|
6934
|
+
const targetMatch = findApplyBlueprintReactionTargetBlock(options.values, target, options.context);
|
|
6935
|
+
if (!targetMatch) {
|
|
6936
|
+
return;
|
|
6937
|
+
}
|
|
6938
|
+
const type = String(item.type || "").trim();
|
|
6939
|
+
const conditionFieldMetaByPath = buildApplyBlueprintReactionConditionFieldMetaByPath(
|
|
6940
|
+
targetMatch.block,
|
|
6941
|
+
targetMatch.context
|
|
6942
|
+
);
|
|
6943
|
+
_.castArray(item.rules || []).forEach((rule, ruleIndex) => {
|
|
6944
|
+
collectReactionFilterDateConditionErrors(
|
|
6945
|
+
(rule == null ? void 0 : rule.when) ?? (rule == null ? void 0 : rule.condition),
|
|
6946
|
+
`${path}.rules[${ruleIndex}].when`,
|
|
6947
|
+
errors,
|
|
6948
|
+
targetMatch.block,
|
|
6949
|
+
targetMatch.context,
|
|
6950
|
+
conditionFieldMetaByPath
|
|
6951
|
+
);
|
|
6952
|
+
if (type !== "setFieldLinkageRules") {
|
|
6953
|
+
return;
|
|
6954
|
+
}
|
|
6955
|
+
_.castArray((rule == null ? void 0 : rule.then) || (rule == null ? void 0 : rule.actions) || []).forEach((action, actionIndex) => {
|
|
6956
|
+
_.castArray((action == null ? void 0 : action.items) || []).forEach((assignItem, itemIndex) => {
|
|
6957
|
+
collectReactionFilterDateConditionErrors(
|
|
6958
|
+
(assignItem == null ? void 0 : assignItem.when) ?? (assignItem == null ? void 0 : assignItem.condition),
|
|
6959
|
+
`${path}.rules[${ruleIndex}].then[${actionIndex}].items[${itemIndex}].when`,
|
|
6960
|
+
errors,
|
|
6961
|
+
targetMatch.block,
|
|
6962
|
+
targetMatch.context,
|
|
6963
|
+
conditionFieldMetaByPath
|
|
6964
|
+
);
|
|
6965
|
+
});
|
|
6966
|
+
});
|
|
6967
|
+
});
|
|
6968
|
+
}
|
|
6969
|
+
function collectReactionFilterDateConditionErrors(filter, path, errors, block, context, fieldMetaByPath = {}) {
|
|
6970
|
+
if (!_.isPlainObject(filter)) {
|
|
6971
|
+
return;
|
|
6972
|
+
}
|
|
6973
|
+
if (Array.isArray(filter.items)) {
|
|
6974
|
+
filter.items.forEach(
|
|
6975
|
+
(item, index) => collectReactionFilterDateConditionErrors(
|
|
6976
|
+
item,
|
|
6977
|
+
`${path}.items[${index}]`,
|
|
6978
|
+
errors,
|
|
6979
|
+
block,
|
|
6980
|
+
context,
|
|
6981
|
+
fieldMetaByPath
|
|
6982
|
+
)
|
|
6983
|
+
);
|
|
6984
|
+
return;
|
|
6985
|
+
}
|
|
6986
|
+
if (!hasOwn(filter, "operator")) {
|
|
6987
|
+
return;
|
|
6988
|
+
}
|
|
6989
|
+
const conditionPath = normalizeReactionConditionPath(filter.path);
|
|
6990
|
+
const fieldContext = resolveReactionConditionFieldContext(conditionPath, block, context, fieldMetaByPath);
|
|
6991
|
+
collectDefaultFilterDateValueError(filter.operator, filter.value, `${path}.value`, errors, fieldContext, {
|
|
6992
|
+
allowContextPathValue: true
|
|
6993
|
+
});
|
|
6994
|
+
}
|
|
6995
|
+
function normalizeReactionConditionPath(rawPath) {
|
|
6996
|
+
const value = String(rawPath || "").trim();
|
|
6997
|
+
const templateMatch = /^\{\{\s*ctx(?:\.([^}]+?))?\s*\}\}$/.exec(value);
|
|
6998
|
+
const path = templateMatch ? String(templateMatch[1] || "").trim() : value.replace(/^ctx\./, "");
|
|
6999
|
+
return path.split(".").map((segment) => segment.trim()).filter(Boolean).join(".");
|
|
7000
|
+
}
|
|
7001
|
+
function buildApplyBlueprintReactionConditionFieldMetaByPath(block, context) {
|
|
7002
|
+
var _a, _b;
|
|
7003
|
+
const collection = getBlockCollection(block, context);
|
|
7004
|
+
const dataSourceKey = getBlockDataSourceKey(block, context);
|
|
7005
|
+
const userCollection = ((_a = context.getCollection) == null ? void 0 : _a.call(context, "main", "users")) || ((_b = context.getCollection) == null ? void 0 : _b.call(context, dataSourceKey, "users")) || null;
|
|
7006
|
+
const response = (0, import_context.buildFlowSurfaceContextResponse)({
|
|
7007
|
+
semantic: {
|
|
7008
|
+
collection,
|
|
7009
|
+
userCollection,
|
|
7010
|
+
recordCollection: collection,
|
|
7011
|
+
formValuesCollection: collection,
|
|
7012
|
+
itemCollections: collection ? [collection] : [],
|
|
7013
|
+
itemRootCollection: collection || void 0,
|
|
7014
|
+
popupLevels: context.isPopupSurface || context.popupHasCurrentRecord ? [
|
|
7015
|
+
{
|
|
7016
|
+
recordCollection: collection,
|
|
7017
|
+
sourceRecordCollection: collection
|
|
7018
|
+
}
|
|
7019
|
+
] : []
|
|
7020
|
+
},
|
|
7021
|
+
maxDepth: 4
|
|
7022
|
+
});
|
|
7023
|
+
const fieldMetaByPath = collectAuthorableReactionContextFieldMetaByPath(response);
|
|
7024
|
+
addCollectionFieldMetaAliases(fieldMetaByPath, collection, ["collection", "record", "formValues"]);
|
|
7025
|
+
addCollectionFieldMetaAliases(fieldMetaByPath, collection, ["item"], {
|
|
7026
|
+
preserveExisting: true,
|
|
7027
|
+
reservedKeys: /* @__PURE__ */ new Set(["index", "length", "value", "parentItem"])
|
|
7028
|
+
});
|
|
7029
|
+
if (userCollection) {
|
|
7030
|
+
addCollectionFieldMetaAliases(fieldMetaByPath, userCollection, ["user"]);
|
|
7031
|
+
}
|
|
7032
|
+
return fieldMetaByPath;
|
|
7033
|
+
}
|
|
7034
|
+
function collectAuthorableReactionContextFieldMetaByPath(context) {
|
|
7035
|
+
const fieldMetaByPath = {};
|
|
7036
|
+
const visit = (prefix, info) => {
|
|
7037
|
+
if (!prefix || !info) {
|
|
7038
|
+
return;
|
|
7039
|
+
}
|
|
7040
|
+
if (isAuthorableReactionContextPath(prefix)) {
|
|
7041
|
+
fieldMetaByPath[prefix] = {
|
|
7042
|
+
...info.type ? { type: info.type } : {},
|
|
7043
|
+
...info.interface ? { interface: info.interface } : {}
|
|
7044
|
+
};
|
|
7045
|
+
}
|
|
7046
|
+
if (info.dynamicProperties) {
|
|
7047
|
+
visit(`${prefix}.*`, info.dynamicProperties);
|
|
7048
|
+
}
|
|
7049
|
+
Object.entries(info.properties || {}).forEach(([key, child]) => visit(`${prefix}.${key}`, child));
|
|
7050
|
+
};
|
|
7051
|
+
Object.entries((context == null ? void 0 : context.vars) || {}).forEach(([key, info]) => visit(key, info));
|
|
7052
|
+
return fieldMetaByPath;
|
|
7053
|
+
}
|
|
7054
|
+
function isAuthorableReactionContextPath(path) {
|
|
7055
|
+
const segments = String(path || "").split(".").filter(Boolean);
|
|
7056
|
+
const root = segments[0];
|
|
7057
|
+
if (!root) {
|
|
7058
|
+
return false;
|
|
7059
|
+
}
|
|
7060
|
+
if (AUTHORABLE_REACTION_SCALAR_CONTEXT_PATHS.has(root)) {
|
|
7061
|
+
return segments.length === 1;
|
|
7062
|
+
}
|
|
7063
|
+
return AUTHORABLE_REACTION_CONTEXT_ROOTS.has(root);
|
|
7064
|
+
}
|
|
7065
|
+
function addCollectionFieldMetaAliases(fieldMetaByPath, collection, roots, options = {}) {
|
|
7066
|
+
var _a;
|
|
7067
|
+
for (const field of (0, import_service_helpers.getCollectionFields)(collection)) {
|
|
7068
|
+
const fieldName = (0, import_service_helpers.getFieldName)(field);
|
|
7069
|
+
if (!fieldName) {
|
|
7070
|
+
continue;
|
|
7071
|
+
}
|
|
7072
|
+
const fieldMeta = {
|
|
7073
|
+
...(0, import_service_helpers.getFieldType)(field) ? { type: (0, import_service_helpers.getFieldType)(field) } : {},
|
|
7074
|
+
...(0, import_service_helpers.getFieldInterface)(field) ? { interface: (0, import_service_helpers.getFieldInterface)(field) } : {}
|
|
7075
|
+
};
|
|
7076
|
+
for (const root of roots) {
|
|
7077
|
+
if ((_a = options.reservedKeys) == null ? void 0 : _a.has(fieldName)) {
|
|
7078
|
+
continue;
|
|
7079
|
+
}
|
|
7080
|
+
const aliasPath = `${root}.${fieldName}`;
|
|
7081
|
+
if (options.preserveExisting && fieldMetaByPath[aliasPath]) {
|
|
7082
|
+
continue;
|
|
7083
|
+
}
|
|
7084
|
+
fieldMetaByPath[aliasPath] = {
|
|
7085
|
+
...fieldMetaByPath[aliasPath],
|
|
7086
|
+
...fieldMeta
|
|
7087
|
+
};
|
|
7088
|
+
}
|
|
7089
|
+
}
|
|
7090
|
+
}
|
|
7091
|
+
function resolveReactionConditionFieldContext(path, block, context, fieldMetaByPath) {
|
|
7092
|
+
const normalized = String(path || "").trim();
|
|
7093
|
+
const contextMeta = resolveReactionConditionFieldMeta(normalized, fieldMetaByPath);
|
|
7094
|
+
if (contextMeta) {
|
|
7095
|
+
return {
|
|
7096
|
+
fieldPath: normalized,
|
|
7097
|
+
fieldMeta: contextMeta
|
|
7098
|
+
};
|
|
7099
|
+
}
|
|
7100
|
+
const fieldPath = resolveReactionConditionFieldPath(normalized);
|
|
7101
|
+
return fieldPath ? resolveDefaultFilterDateConditionField(fieldPath, block, context) || void 0 : void 0;
|
|
7102
|
+
}
|
|
7103
|
+
function resolveReactionConditionFieldMeta(path, fieldMetaByPath) {
|
|
7104
|
+
if (fieldMetaByPath[path]) {
|
|
7105
|
+
return fieldMetaByPath[path];
|
|
7106
|
+
}
|
|
7107
|
+
const wildcardPath = Object.keys(fieldMetaByPath).filter((candidate) => candidate.endsWith(".*")).sort((a, b) => b.length - a.length).find((candidate) => {
|
|
7108
|
+
const prefix = candidate.slice(0, -2);
|
|
7109
|
+
return path.startsWith(`${prefix}.`) && path.length > prefix.length + 1;
|
|
7110
|
+
});
|
|
7111
|
+
return wildcardPath ? fieldMetaByPath[wildcardPath] : void 0;
|
|
7112
|
+
}
|
|
7113
|
+
function resolveReactionConditionFieldPath(path) {
|
|
7114
|
+
const normalized = String(path || "").trim();
|
|
7115
|
+
const prefixes = ["formValues.", "record.", "item.value.", "item.", "popup.record.", "collection.", "user."];
|
|
7116
|
+
const prefix = prefixes.find((candidate) => normalized.startsWith(candidate));
|
|
7117
|
+
return prefix ? normalized.slice(prefix.length) : "";
|
|
7118
|
+
}
|
|
6539
7119
|
function collectFieldListErrors(fields, path, errors, localKeys, context, block) {
|
|
6540
7120
|
if (!Array.isArray(fields)) {
|
|
6541
7121
|
return;
|