@nocobase/plugin-flow-engine 2.1.0-beta.43 → 2.1.0-beta.44
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/authoring-validation.js +160 -21
- package/dist/server/flow-surfaces/catalog.js +9 -5
- package/dist/server/flow-surfaces/chart-config.js +29 -6
- package/dist/server/flow-surfaces/contract-guard.js +39 -5
- package/dist/server/flow-surfaces/default-block-actions.js +2 -0
- package/dist/server/flow-surfaces/errors.d.ts +15 -0
- package/dist/server/flow-surfaces/errors.js +49 -3
- package/dist/server/flow-surfaces/filter-group.d.ts +7 -1
- package/dist/server/flow-surfaces/filter-group.js +175 -71
- package/dist/server/flow-surfaces/public-data-surface-default-filter.js +2 -1
- package/dist/server/flow-surfaces/runjs-authoring/ast/bindings.d.ts +66 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/bindings.js +661 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/execution.d.ts +20 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/execution.js +275 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/parser.d.ts +16 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/parser.js +130 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/react-values.d.ts +20 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/react-values.js +401 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/request-config.d.ts +21 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/request-config.js +199 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/source.d.ts +70 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/source.js +895 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/static-bindings.d.ts +23 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/static-bindings.js +618 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/static-values.d.ts +196 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/static-values.js +1777 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/walk.d.ts +10 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/walk.js +55 -0
- package/dist/server/flow-surfaces/runjs-authoring/collectors.d.ts +12 -0
- package/dist/server/flow-surfaces/runjs-authoring/collectors.js +589 -0
- package/dist/server/flow-surfaces/runjs-authoring/index.d.ts +2 -25
- package/dist/server/flow-surfaces/runjs-authoring/index.js +5 -11138
- package/dist/server/flow-surfaces/runjs-authoring/inspect.d.ts +13 -0
- package/dist/server/flow-surfaces/runjs-authoring/inspect.js +149 -0
- package/dist/server/flow-surfaces/runjs-authoring/internal-types.d.ts +333 -0
- package/dist/server/flow-surfaces/runjs-authoring/internal-types.js +36 -0
- package/dist/server/flow-surfaces/runjs-authoring/rules.js +2 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.d.ts +67 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.js +757 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/errors.d.ts +22 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/errors.js +91 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/source-budget.d.ts +16 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/source-budget.js +115 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/surface.d.ts +19 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/surface.js +140 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/types.d.ts +91 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/types.js +24 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/ctx-api.d.ts +138 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/ctx-api.js +1779 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/filter.d.ts +10 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/filter.js +1583 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/index.d.ts +195 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/index.js +463 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/react-render.d.ts +48 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/react-render.js +379 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/react.d.ts +26 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/react.js +1441 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/resource.d.ts +23 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/resource.js +1427 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.d.ts +91 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.js +889 -0
- package/dist/server/flow-surfaces/runjs-authoring/types.d.ts +1 -1
- package/dist/server/flow-surfaces/runjs-authoring/unknown-global-stop/index.d.ts +10 -0
- package/dist/server/flow-surfaces/runjs-authoring/unknown-global-stop/index.js +40 -0
- package/dist/server/flow-surfaces/runjs-authoring/validators/index.d.ts +12 -0
- package/dist/server/flow-surfaces/runjs-authoring/validators/index.js +887 -0
- package/dist/server/flow-surfaces/service-helpers.d.ts +29 -0
- package/dist/server/flow-surfaces/service-helpers.js +105 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +15 -3
- package/dist/server/flow-surfaces/service-utils.js +5 -4
- package/dist/server/flow-surfaces/service.d.ts +4 -0
- package/dist/server/flow-surfaces/service.js +360 -30
- package/dist/server/flow-surfaces/types.d.ts +3 -0
- package/dist/server/repository.d.ts +12 -1
- package/dist/server/repository.js +195 -23
- package/dist/swagger/flow-surfaces.d.ts +175 -0
- package/dist/swagger/flow-surfaces.js +130 -51
- package/dist/swagger/index.d.ts +175 -0
- package/package.json +2 -2
|
@@ -3124,6 +3124,209 @@ class FlowSurfacesService {
|
|
|
3124
3124
|
);
|
|
3125
3125
|
}
|
|
3126
3126
|
}
|
|
3127
|
+
composeChartBlockHasInlineConfig(block) {
|
|
3128
|
+
const settings = import_lodash.default.isPlainObject(block.settings) ? block.settings : {};
|
|
3129
|
+
return ["configure", "query", "visual", "events"].some(
|
|
3130
|
+
(key) => Object.prototype.hasOwnProperty.call(settings, key)
|
|
3131
|
+
);
|
|
3132
|
+
}
|
|
3133
|
+
prepareComposeChartAssetNestedPopupBlocks(input, path, chartAssets) {
|
|
3134
|
+
if (!import_lodash.default.isPlainObject(input)) {
|
|
3135
|
+
return { value: input, didResolveChartAsset: false };
|
|
3136
|
+
}
|
|
3137
|
+
let didResolveChartAsset = false;
|
|
3138
|
+
let nextInput = input;
|
|
3139
|
+
const ensureNextInput = () => {
|
|
3140
|
+
if (nextInput === input) {
|
|
3141
|
+
nextInput = { ...input };
|
|
3142
|
+
}
|
|
3143
|
+
return nextInput;
|
|
3144
|
+
};
|
|
3145
|
+
const preparePopupBlocks = (key) => {
|
|
3146
|
+
const popup = input[key];
|
|
3147
|
+
if (!import_lodash.default.isPlainObject(popup) || !Array.isArray(popup.blocks)) {
|
|
3148
|
+
return;
|
|
3149
|
+
}
|
|
3150
|
+
const prepared = this.prepareComposeChartAssetBlockList(popup.blocks, `${path}.${key}.blocks`, chartAssets);
|
|
3151
|
+
if (!prepared.didResolveChartAsset) {
|
|
3152
|
+
return;
|
|
3153
|
+
}
|
|
3154
|
+
ensureNextInput()[key] = {
|
|
3155
|
+
...popup,
|
|
3156
|
+
blocks: prepared.blocks
|
|
3157
|
+
};
|
|
3158
|
+
didResolveChartAsset = true;
|
|
3159
|
+
};
|
|
3160
|
+
preparePopupBlocks("popup");
|
|
3161
|
+
preparePopupBlocks("openView");
|
|
3162
|
+
return {
|
|
3163
|
+
value: nextInput,
|
|
3164
|
+
didResolveChartAsset
|
|
3165
|
+
};
|
|
3166
|
+
}
|
|
3167
|
+
prepareComposeChartAssetBlockList(blocks, path, chartAssets) {
|
|
3168
|
+
const rawBlocks = import_lodash.default.castArray(blocks || []);
|
|
3169
|
+
if (!rawBlocks.length) {
|
|
3170
|
+
return { blocks: rawBlocks, didResolveChartAsset: false };
|
|
3171
|
+
}
|
|
3172
|
+
let didResolveChartAsset = false;
|
|
3173
|
+
const hiddenPopupKeys = [
|
|
3174
|
+
"quickCreatePopup",
|
|
3175
|
+
"eventPopup",
|
|
3176
|
+
"cardPopup",
|
|
3177
|
+
"quickCreatePopupSettings",
|
|
3178
|
+
"eventPopupSettings",
|
|
3179
|
+
"cardPopupSettings"
|
|
3180
|
+
];
|
|
3181
|
+
const nextBlocks = rawBlocks.map((block, index) => {
|
|
3182
|
+
if (!import_lodash.default.isPlainObject(block)) {
|
|
3183
|
+
return block;
|
|
3184
|
+
}
|
|
3185
|
+
const blockPath = `${path}[${index}]`;
|
|
3186
|
+
let nextBlock = block;
|
|
3187
|
+
const ensureNextBlock = () => {
|
|
3188
|
+
if (nextBlock === block) {
|
|
3189
|
+
nextBlock = { ...block };
|
|
3190
|
+
}
|
|
3191
|
+
return nextBlock;
|
|
3192
|
+
};
|
|
3193
|
+
if (Array.isArray(block.blocks)) {
|
|
3194
|
+
const prepared = this.prepareComposeChartAssetBlockList(block.blocks, `${blockPath}.blocks`, chartAssets);
|
|
3195
|
+
if (prepared.didResolveChartAsset) {
|
|
3196
|
+
ensureNextBlock().blocks = prepared.blocks;
|
|
3197
|
+
didResolveChartAsset = true;
|
|
3198
|
+
}
|
|
3199
|
+
}
|
|
3200
|
+
for (const slot of ["actions", "recordActions", "fields"]) {
|
|
3201
|
+
if (!Array.isArray(block[slot])) {
|
|
3202
|
+
continue;
|
|
3203
|
+
}
|
|
3204
|
+
let didPrepareSlot = false;
|
|
3205
|
+
const nextItems = block[slot].map((item, itemIndex) => {
|
|
3206
|
+
const prepared = this.prepareComposeChartAssetNestedPopupBlocks(
|
|
3207
|
+
item,
|
|
3208
|
+
`${blockPath}.${slot}[${itemIndex}]`,
|
|
3209
|
+
chartAssets
|
|
3210
|
+
);
|
|
3211
|
+
didPrepareSlot = didPrepareSlot || prepared.didResolveChartAsset;
|
|
3212
|
+
return prepared.value;
|
|
3213
|
+
});
|
|
3214
|
+
if (didPrepareSlot) {
|
|
3215
|
+
ensureNextBlock()[slot] = nextItems;
|
|
3216
|
+
didResolveChartAsset = true;
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
if (Array.isArray(block.fieldGroups)) {
|
|
3220
|
+
let didPrepareFieldGroups = false;
|
|
3221
|
+
const nextFieldGroups = block.fieldGroups.map((group, groupIndex) => {
|
|
3222
|
+
if (!import_lodash.default.isPlainObject(group) || !Array.isArray(group.fields)) {
|
|
3223
|
+
return group;
|
|
3224
|
+
}
|
|
3225
|
+
let didPrepareGroupFields = false;
|
|
3226
|
+
const nextFields = group.fields.map((field, fieldIndex) => {
|
|
3227
|
+
const prepared = this.prepareComposeChartAssetNestedPopupBlocks(
|
|
3228
|
+
field,
|
|
3229
|
+
`${blockPath}.fieldGroups[${groupIndex}].fields[${fieldIndex}]`,
|
|
3230
|
+
chartAssets
|
|
3231
|
+
);
|
|
3232
|
+
didPrepareGroupFields = didPrepareGroupFields || prepared.didResolveChartAsset;
|
|
3233
|
+
return prepared.value;
|
|
3234
|
+
});
|
|
3235
|
+
if (!didPrepareGroupFields) {
|
|
3236
|
+
return group;
|
|
3237
|
+
}
|
|
3238
|
+
didPrepareFieldGroups = true;
|
|
3239
|
+
return {
|
|
3240
|
+
...group,
|
|
3241
|
+
fields: nextFields
|
|
3242
|
+
};
|
|
3243
|
+
});
|
|
3244
|
+
if (didPrepareFieldGroups) {
|
|
3245
|
+
ensureNextBlock().fieldGroups = nextFieldGroups;
|
|
3246
|
+
didResolveChartAsset = true;
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
if (import_lodash.default.isPlainObject(block.popup) && Array.isArray(block.popup.blocks)) {
|
|
3250
|
+
const prepared = this.prepareComposeChartAssetBlockList(
|
|
3251
|
+
block.popup.blocks,
|
|
3252
|
+
`${blockPath}.popup.blocks`,
|
|
3253
|
+
chartAssets
|
|
3254
|
+
);
|
|
3255
|
+
if (prepared.didResolveChartAsset) {
|
|
3256
|
+
ensureNextBlock().popup = {
|
|
3257
|
+
...block.popup,
|
|
3258
|
+
blocks: prepared.blocks
|
|
3259
|
+
};
|
|
3260
|
+
didResolveChartAsset = true;
|
|
3261
|
+
}
|
|
3262
|
+
}
|
|
3263
|
+
if (import_lodash.default.isPlainObject(block.settings)) {
|
|
3264
|
+
for (const key of hiddenPopupKeys) {
|
|
3265
|
+
const popup = block.settings[key];
|
|
3266
|
+
if (!import_lodash.default.isPlainObject(popup) || !Array.isArray(popup.blocks)) {
|
|
3267
|
+
continue;
|
|
3268
|
+
}
|
|
3269
|
+
const prepared = this.prepareComposeChartAssetBlockList(
|
|
3270
|
+
popup.blocks,
|
|
3271
|
+
`${blockPath}.settings.${key}.blocks`,
|
|
3272
|
+
chartAssets
|
|
3273
|
+
);
|
|
3274
|
+
if (!prepared.didResolveChartAsset) {
|
|
3275
|
+
continue;
|
|
3276
|
+
}
|
|
3277
|
+
ensureNextBlock().settings = {
|
|
3278
|
+
...nextBlock.settings || {},
|
|
3279
|
+
[key]: {
|
|
3280
|
+
...popup,
|
|
3281
|
+
blocks: prepared.blocks
|
|
3282
|
+
}
|
|
3283
|
+
};
|
|
3284
|
+
didResolveChartAsset = true;
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
if (String(nextBlock.type || "").trim() !== "chart" || !Object.prototype.hasOwnProperty.call(nextBlock, "chart") || this.composeChartBlockHasInlineConfig(nextBlock)) {
|
|
3288
|
+
return nextBlock;
|
|
3289
|
+
}
|
|
3290
|
+
const chartKey = String(nextBlock.chart || "").trim();
|
|
3291
|
+
if (!chartKey) {
|
|
3292
|
+
throwChartRepairBadRequest(`${blockPath}.chart must reference one key from assets.charts`, {
|
|
3293
|
+
path: `${blockPath}.chart`,
|
|
3294
|
+
ruleId: "chart-block-asset-reference-required"
|
|
3295
|
+
});
|
|
3296
|
+
}
|
|
3297
|
+
const chartAsset = chartAssets[chartKey];
|
|
3298
|
+
if (!import_lodash.default.isPlainObject(chartAsset)) {
|
|
3299
|
+
throwChartRepairBadRequest(`${blockPath}.chart references missing chart asset '${chartKey}'`, {
|
|
3300
|
+
path: `${blockPath}.chart`,
|
|
3301
|
+
ruleId: "chart-block-asset-reference-missing",
|
|
3302
|
+
details: {
|
|
3303
|
+
chartKey
|
|
3304
|
+
}
|
|
3305
|
+
});
|
|
3306
|
+
}
|
|
3307
|
+
if (!import_lodash.default.isUndefined(nextBlock.settings) && !import_lodash.default.isPlainObject(nextBlock.settings)) {
|
|
3308
|
+
return nextBlock;
|
|
3309
|
+
}
|
|
3310
|
+
didResolveChartAsset = true;
|
|
3311
|
+
return {
|
|
3312
|
+
...nextBlock,
|
|
3313
|
+
settings: import_lodash.default.merge({}, import_lodash.default.cloneDeep(nextBlock.settings || {}), import_lodash.default.cloneDeep(chartAsset))
|
|
3314
|
+
};
|
|
3315
|
+
});
|
|
3316
|
+
return {
|
|
3317
|
+
blocks: nextBlocks,
|
|
3318
|
+
didResolveChartAsset
|
|
3319
|
+
};
|
|
3320
|
+
}
|
|
3321
|
+
prepareComposeChartAssetSettings(values) {
|
|
3322
|
+
var _a;
|
|
3323
|
+
const chartAssets = import_lodash.default.isPlainObject((_a = values == null ? void 0 : values.assets) == null ? void 0 : _a.charts) ? values.assets.charts : {};
|
|
3324
|
+
const prepared = this.prepareComposeChartAssetBlockList(values == null ? void 0 : values.blocks, "$.blocks", chartAssets);
|
|
3325
|
+
return prepared.didResolveChartAsset ? {
|
|
3326
|
+
...values,
|
|
3327
|
+
blocks: prepared.blocks
|
|
3328
|
+
} : values;
|
|
3329
|
+
}
|
|
3127
3330
|
getApplyBlueprintKanbanBlockResourceObject(block) {
|
|
3128
3331
|
return import_lodash.default.isPlainObject(block == null ? void 0 : block.resource) ? block.resource : {};
|
|
3129
3332
|
}
|
|
@@ -5198,12 +5401,13 @@ class FlowSurfacesService {
|
|
|
5198
5401
|
async compose(values, options = {}) {
|
|
5199
5402
|
var _a, _b, _c;
|
|
5200
5403
|
const enabledPackages = await this.resolveEnabledPluginPackages(options);
|
|
5201
|
-
const
|
|
5404
|
+
const composeValues = this.prepareComposeChartAssetSettings(values);
|
|
5405
|
+
const target = await this.prepareWriteTarget("compose", composeValues == null ? void 0 : composeValues.target, composeValues, options);
|
|
5202
5406
|
const authoringContext = await this.buildTargetAuthoringContext({
|
|
5203
5407
|
target,
|
|
5204
5408
|
transaction: options.transaction
|
|
5205
5409
|
});
|
|
5206
|
-
await (0, import_authoring_validation.assertFlowSurfaceAuthoringPayload)("compose",
|
|
5410
|
+
await (0, import_authoring_validation.assertFlowSurfaceAuthoringPayload)("compose", composeValues, {
|
|
5207
5411
|
transaction: options.transaction,
|
|
5208
5412
|
enabledPackages,
|
|
5209
5413
|
skipGeneratedLayoutSingleColumnErrors: options.skipGeneratedLayoutSingleColumnErrors === true,
|
|
@@ -5216,12 +5420,17 @@ class FlowSurfacesService {
|
|
|
5216
5420
|
...options,
|
|
5217
5421
|
popupTemplateTreeCache
|
|
5218
5422
|
};
|
|
5219
|
-
const mode = this.assertComposeMode(
|
|
5220
|
-
const popupDefaultsMetadata = this.buildPopupDefaultsMetadata(
|
|
5221
|
-
const normalizedBlocks = this.normalizeComposeBlocks(
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5423
|
+
const mode = this.assertComposeMode(composeValues == null ? void 0 : composeValues.mode);
|
|
5424
|
+
const popupDefaultsMetadata = this.buildPopupDefaultsMetadata(composeValues == null ? void 0 : composeValues.defaults);
|
|
5425
|
+
const normalizedBlocks = this.normalizeComposeBlocks(
|
|
5426
|
+
composeValues == null ? void 0 : composeValues.blocks,
|
|
5427
|
+
enabledPackages,
|
|
5428
|
+
popupDefaultsMetadata,
|
|
5429
|
+
{
|
|
5430
|
+
dataSourceKey: authoringContext.currentDataSourceKey,
|
|
5431
|
+
collectionName: authoringContext.currentCollectionName
|
|
5432
|
+
}
|
|
5433
|
+
);
|
|
5225
5434
|
this.validateComposePopupTemplateAliases(normalizedBlocks, popupTemplateAliasSession);
|
|
5226
5435
|
const blockParent = await this.surfaceContext.resolveBlockParent(target, options.transaction);
|
|
5227
5436
|
const gridUid = blockParent.parentUid;
|
|
@@ -5247,7 +5456,7 @@ class FlowSurfacesService {
|
|
|
5247
5456
|
mode,
|
|
5248
5457
|
normalizedBlocks,
|
|
5249
5458
|
existingItemUids: existingItems.map((item) => item.uid),
|
|
5250
|
-
layout:
|
|
5459
|
+
layout: composeValues.layout
|
|
5251
5460
|
});
|
|
5252
5461
|
const generatedDefaultFilterByComposeBlockUid = /* @__PURE__ */ new Map();
|
|
5253
5462
|
const result = await (0, import_compose_runtime.executeComposeRuntime)(plan, {
|
|
@@ -5282,7 +5491,7 @@ class FlowSurfacesService {
|
|
|
5282
5491
|
{
|
|
5283
5492
|
...payload,
|
|
5284
5493
|
...Object.keys(hiddenPopupSettings).length ? { settings: hiddenPopupSettings } : {},
|
|
5285
|
-
...
|
|
5494
|
+
...composeValues.defaults ? { defaults: composeValues.defaults } : {}
|
|
5286
5495
|
},
|
|
5287
5496
|
{
|
|
5288
5497
|
...runtimeOptions,
|
|
@@ -6449,7 +6658,8 @@ class FlowSurfacesService {
|
|
|
6449
6658
|
if ((0, import_service_utils.hasOwnDefined)(normalizedSettings, "defaultFilter")) {
|
|
6450
6659
|
normalizedSettings.defaultFilter = (0, import_filter_group.normalizeFlowSurfaceFilterGroupValue)(
|
|
6451
6660
|
normalizedSettings.defaultFilter,
|
|
6452
|
-
`flowSurfaces ${actionName} defaultActionSettings.filter.defaultFilter expects FilterGroup like ${import_filter_group.FLOW_SURFACE_FILTER_GROUP_EXAMPLE}
|
|
6661
|
+
`flowSurfaces ${actionName} defaultActionSettings.filter.defaultFilter expects FilterGroup like ${import_filter_group.FLOW_SURFACE_FILTER_GROUP_EXAMPLE}`,
|
|
6662
|
+
{ strictDateValues: true }
|
|
6453
6663
|
);
|
|
6454
6664
|
normalizedSettings.defaultFilter = this.normalizeEffectivePublicDataSurfaceDefaultFilter(
|
|
6455
6665
|
normalizedSettings.defaultFilter,
|
|
@@ -11738,12 +11948,12 @@ class FlowSurfacesService {
|
|
|
11738
11948
|
"flowSurfaces updateSettings filter action values 'props.defaultFilterValue/filterValue' and 'stepParams.filterSettings.defaultFilter.defaultFilter' must match"
|
|
11739
11949
|
);
|
|
11740
11950
|
}
|
|
11741
|
-
const
|
|
11742
|
-
hasStepDefaultFilter ? nextStepFilter : nextPropFilter
|
|
11743
|
-
{
|
|
11744
|
-
requiredFieldCount: options.requiredFieldCount
|
|
11745
|
-
}
|
|
11951
|
+
const normalizedFilterValue = this.normalizeFilterActionDefaultFilterValue(
|
|
11952
|
+
hasStepDefaultFilter ? nextStepFilter : nextPropFilter
|
|
11746
11953
|
);
|
|
11954
|
+
const filterValue = this.normalizeEffectivePublicDataSurfaceDefaultFilter(normalizedFilterValue, {
|
|
11955
|
+
requiredFieldCount: options.requiredFieldCount
|
|
11956
|
+
});
|
|
11747
11957
|
if (!hasPropsFilterableFieldNames && !hasStepFilterableFieldNames) {
|
|
11748
11958
|
const filterableFieldNames = (0, import_public_data_surface_default_filter.resolveFlowSurfaceDefaultFilterFieldNames)(filterValue);
|
|
11749
11959
|
if (filterableFieldNames.length) {
|
|
@@ -12187,7 +12397,7 @@ class FlowSurfacesService {
|
|
|
12187
12397
|
return String(input || "").trim();
|
|
12188
12398
|
}
|
|
12189
12399
|
validateBuilderChartFieldsForRuntime(actionName, configure) {
|
|
12190
|
-
var _a, _b;
|
|
12400
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
12191
12401
|
const resourceInit = (0, import_chart_config.getChartBuilderResourceInit)(configure);
|
|
12192
12402
|
if (!(resourceInit == null ? void 0 : resourceInit.collectionName)) {
|
|
12193
12403
|
return;
|
|
@@ -12205,10 +12415,12 @@ class FlowSurfacesService {
|
|
|
12205
12415
|
const selections = [
|
|
12206
12416
|
...import_lodash.default.castArray(state.query.measures || []).map((selection, index) => ({
|
|
12207
12417
|
selection,
|
|
12418
|
+
kind: "measure",
|
|
12208
12419
|
path: `chart query.measures[${index}].field`
|
|
12209
12420
|
})),
|
|
12210
12421
|
...import_lodash.default.castArray(state.query.dimensions || []).map((selection, index) => ({
|
|
12211
12422
|
selection,
|
|
12423
|
+
kind: "dimension",
|
|
12212
12424
|
path: `chart query.dimensions[${index}].field`
|
|
12213
12425
|
}))
|
|
12214
12426
|
];
|
|
@@ -12217,37 +12429,151 @@ class FlowSurfacesService {
|
|
|
12217
12429
|
if (!fieldPath) {
|
|
12218
12430
|
continue;
|
|
12219
12431
|
}
|
|
12432
|
+
const fieldPathParts = fieldPath.split(".").filter(Boolean);
|
|
12433
|
+
const isCountMeasureSelection = item.kind === "measure" && String(((_c = item.selection) == null ? void 0 : _c.aggregation) || "").trim() === "count" && !((_d = item.selection) == null ? void 0 : _d.distinct);
|
|
12434
|
+
if (fieldPathParts.length > 1 && !isCountMeasureSelection) {
|
|
12435
|
+
const directAssociationPath = fieldPathParts[0];
|
|
12436
|
+
const directAssociationField = (0, import_service_helpers.resolveFieldFromCollection)(collection, directAssociationPath);
|
|
12437
|
+
const directAssociationTargetCollection = directAssociationField && (0, import_service_helpers.isAssociationField)(directAssociationField) ? (0, import_service_helpers.resolveFieldTargetCollection)(
|
|
12438
|
+
directAssociationField,
|
|
12439
|
+
dataSourceKey,
|
|
12440
|
+
(resolvedDataSourceKey, targetCollection) => this.getCollection(resolvedDataSourceKey, targetCollection)
|
|
12441
|
+
) : null;
|
|
12442
|
+
const invalidDirectSubfield = directAssociationTargetCollection ? (0, import_service_helpers.getInvalidChartBuilderRelationDirectSubfieldDetails)({
|
|
12443
|
+
associationPathName: directAssociationPath,
|
|
12444
|
+
selectedSubfieldPath: fieldPathParts.slice(1).join("."),
|
|
12445
|
+
targetCollection: directAssociationTargetCollection
|
|
12446
|
+
}) : null;
|
|
12447
|
+
if (invalidDirectSubfield) {
|
|
12448
|
+
(0, import_errors.throwBadRequest)(
|
|
12449
|
+
withChartRepairMessage(
|
|
12450
|
+
`flowSurfaces ${actionName} ${item.path} '${fieldPath}' must reference a direct scalar child field under relation '${invalidDirectSubfield.associationPath}'. ${(0, import_service_helpers.formatChartBuilderSupportedRelationSubfields)(
|
|
12451
|
+
invalidDirectSubfield.associationPath,
|
|
12452
|
+
invalidDirectSubfield.supportedFields
|
|
12453
|
+
)}`
|
|
12454
|
+
),
|
|
12455
|
+
{
|
|
12456
|
+
path: item.path,
|
|
12457
|
+
ruleId: "chart-builder-query-relation-direct-subfield-required",
|
|
12458
|
+
details: withFlowSurfaceChartRepairDetails({
|
|
12459
|
+
fieldPath,
|
|
12460
|
+
dataSourceKey,
|
|
12461
|
+
collectionName,
|
|
12462
|
+
...invalidDirectSubfield
|
|
12463
|
+
})
|
|
12464
|
+
}
|
|
12465
|
+
);
|
|
12466
|
+
}
|
|
12467
|
+
}
|
|
12220
12468
|
const parsed = this.parseFieldPath(collection, fieldPath, void 0, dataSourceKey, collectionName);
|
|
12469
|
+
if (parsed.associationPathName) {
|
|
12470
|
+
const associationField = parsed.associationField;
|
|
12471
|
+
const associationTargetCollection = associationField && (0, import_service_helpers.isAssociationField)(associationField) ? (0, import_service_helpers.resolveFieldTargetCollection)(
|
|
12472
|
+
associationField,
|
|
12473
|
+
dataSourceKey,
|
|
12474
|
+
(resolvedDataSourceKey, targetCollection) => this.getCollection(resolvedDataSourceKey, targetCollection)
|
|
12475
|
+
) : null;
|
|
12476
|
+
if (!associationField || !(0, import_service_helpers.isAssociationField)(associationField) || !associationTargetCollection) {
|
|
12477
|
+
(0, import_errors.throwBadRequest)(
|
|
12478
|
+
withChartRepairMessage(
|
|
12479
|
+
`flowSurfaces ${actionName} ${item.path} '${fieldPath}' uses invalid association path '${parsed.associationPathName}' for builder charts`
|
|
12480
|
+
),
|
|
12481
|
+
{
|
|
12482
|
+
path: item.path,
|
|
12483
|
+
ruleId: "chart-builder-query-association-path-invalid",
|
|
12484
|
+
details: withFlowSurfaceChartRepairDetails({
|
|
12485
|
+
fieldPath,
|
|
12486
|
+
associationPath: parsed.associationPathName,
|
|
12487
|
+
dataSourceKey,
|
|
12488
|
+
collectionName
|
|
12489
|
+
})
|
|
12490
|
+
}
|
|
12491
|
+
);
|
|
12492
|
+
}
|
|
12493
|
+
}
|
|
12221
12494
|
const field = (0, import_service_helpers.resolveFieldFromCollection)(parsed.leafCollection, parsed.leafFieldPath);
|
|
12495
|
+
const leafModelAttributes = (0, import_service_helpers.getCollectionModelAttributes)(parsed.leafCollection);
|
|
12496
|
+
const hasLeafModelAttribute = Object.prototype.hasOwnProperty.call(leafModelAttributes, parsed.leafFieldPath);
|
|
12497
|
+
const isCountMeasureRelationSubfield = item.kind === "measure" && String(((_e = item.selection) == null ? void 0 : _e.aggregation) || "").trim() === "count" && !((_f = item.selection) == null ? void 0 : _f.distinct) && parsed.associationField && (0, import_service_helpers.isAssociationField)(parsed.associationField);
|
|
12498
|
+
const unsupportedRelationSubfield = parsed.associationField && (0, import_service_helpers.isAssociationField)(parsed.associationField) ? (0, import_service_helpers.getUnsupportedChartBuilderRelationSubfieldDetails)({
|
|
12499
|
+
associationPathName: parsed.associationPathName,
|
|
12500
|
+
leafFieldName: parsed.leafFieldPath,
|
|
12501
|
+
leafField: field,
|
|
12502
|
+
targetCollection: parsed.leafCollection
|
|
12503
|
+
}) : null;
|
|
12222
12504
|
if (!field) {
|
|
12223
|
-
|
|
12224
|
-
|
|
12505
|
+
const hasConcreteField = hasLeafModelAttribute || this.collectionHasConcreteField(parsed.leafCollection, parsed.leafFieldPath);
|
|
12506
|
+
if (!hasConcreteField) {
|
|
12507
|
+
(0, import_errors.throwBadRequest)(
|
|
12508
|
+
withChartRepairMessage(
|
|
12509
|
+
`flowSurfaces ${actionName} ${item.path} '${fieldPath}' does not exist on collection '${dataSourceKey}.${collectionName}'`
|
|
12510
|
+
),
|
|
12511
|
+
{
|
|
12512
|
+
details: withFlowSurfaceChartRepairDetails({
|
|
12513
|
+
fieldPath,
|
|
12514
|
+
dataSourceKey,
|
|
12515
|
+
collectionName
|
|
12516
|
+
})
|
|
12517
|
+
}
|
|
12518
|
+
);
|
|
12225
12519
|
}
|
|
12520
|
+
}
|
|
12521
|
+
if (!fieldPath.includes(".") && field && (0, import_service_helpers.isAssociationField)(field)) {
|
|
12522
|
+
const suggestion = this.resolveBuilderChartAssociationSubfieldSuggestion(fieldPath, field, dataSourceKey);
|
|
12226
12523
|
(0, import_errors.throwBadRequest)(
|
|
12227
12524
|
withChartRepairMessage(
|
|
12228
|
-
`flowSurfaces ${actionName} ${item.path} '${fieldPath}'
|
|
12525
|
+
`flowSurfaces ${actionName} ${item.path} '${fieldPath}' references an association field directly; use scalar subfield '${suggestion.suggestedFieldPath}' for builder charts`
|
|
12229
12526
|
),
|
|
12230
12527
|
{
|
|
12231
12528
|
details: withFlowSurfaceChartRepairDetails({
|
|
12232
12529
|
fieldPath,
|
|
12233
12530
|
dataSourceKey,
|
|
12234
|
-
collectionName
|
|
12531
|
+
collectionName,
|
|
12532
|
+
...suggestion
|
|
12235
12533
|
})
|
|
12236
12534
|
}
|
|
12237
12535
|
);
|
|
12238
12536
|
}
|
|
12239
|
-
if (
|
|
12240
|
-
const suggestion = this.resolveBuilderChartAssociationSubfieldSuggestion(fieldPath, field, dataSourceKey);
|
|
12537
|
+
if (isCountMeasureRelationSubfield) {
|
|
12241
12538
|
(0, import_errors.throwBadRequest)(
|
|
12242
12539
|
withChartRepairMessage(
|
|
12243
|
-
`flowSurfaces ${actionName} ${item.path} '${fieldPath}'
|
|
12540
|
+
`flowSurfaces ${actionName} ${item.path} '${fieldPath}' counts a relation subfield; count a scalar base field such as 'id' and keep '${fieldPath}' as a dimension`
|
|
12244
12541
|
),
|
|
12245
12542
|
{
|
|
12543
|
+
path: item.path,
|
|
12544
|
+
ruleId: "chart-builder-query-count-measure-relation-subfield",
|
|
12246
12545
|
details: withFlowSurfaceChartRepairDetails({
|
|
12247
12546
|
fieldPath,
|
|
12248
12547
|
dataSourceKey,
|
|
12249
12548
|
collectionName,
|
|
12250
|
-
|
|
12549
|
+
suggestedMeasure: {
|
|
12550
|
+
field: "id",
|
|
12551
|
+
aggregation: "count",
|
|
12552
|
+
alias: String(((_g = item.selection) == null ? void 0 : _g.alias) || "").trim() || "recordCount"
|
|
12553
|
+
},
|
|
12554
|
+
suggestedDimension: {
|
|
12555
|
+
field: fieldPath
|
|
12556
|
+
}
|
|
12557
|
+
})
|
|
12558
|
+
}
|
|
12559
|
+
);
|
|
12560
|
+
}
|
|
12561
|
+
if (unsupportedRelationSubfield) {
|
|
12562
|
+
(0, import_errors.throwBadRequest)(
|
|
12563
|
+
withChartRepairMessage(
|
|
12564
|
+
`flowSurfaces ${actionName} ${item.path} '${fieldPath}' references relation subfield '${fieldPath}', but current chart builder SQL generation cannot query relation subfield '${unsupportedRelationSubfield.leafFieldName}' because its database column is '${unsupportedRelationSubfield.columnName}'. ${(0, import_service_helpers.formatChartBuilderSupportedRelationSubfields)(
|
|
12565
|
+
unsupportedRelationSubfield.associationPath,
|
|
12566
|
+
unsupportedRelationSubfield.supportedFields
|
|
12567
|
+
)}`
|
|
12568
|
+
),
|
|
12569
|
+
{
|
|
12570
|
+
path: item.path,
|
|
12571
|
+
ruleId: "chart-builder-query-relation-subfield-column-unsupported",
|
|
12572
|
+
details: withFlowSurfaceChartRepairDetails({
|
|
12573
|
+
fieldPath,
|
|
12574
|
+
dataSourceKey,
|
|
12575
|
+
collectionName,
|
|
12576
|
+
...unsupportedRelationSubfield
|
|
12251
12577
|
})
|
|
12252
12578
|
}
|
|
12253
12579
|
);
|
|
@@ -16229,18 +16555,18 @@ class FlowSurfacesService {
|
|
|
16229
16555
|
return String(raw || "").trim();
|
|
16230
16556
|
}
|
|
16231
16557
|
collectionHasConcreteField(collection, fieldName) {
|
|
16232
|
-
var _a, _b, _c
|
|
16558
|
+
var _a, _b, _c;
|
|
16233
16559
|
const normalized = String(fieldName || "").trim();
|
|
16234
16560
|
if (!normalized) {
|
|
16235
16561
|
return false;
|
|
16236
16562
|
}
|
|
16237
|
-
const modelAttributes = (
|
|
16563
|
+
const modelAttributes = (0, import_service_helpers.getCollectionModelAttributes)(collection);
|
|
16238
16564
|
const primaryKeyAttributes = import_lodash.default.castArray(
|
|
16239
|
-
((
|
|
16565
|
+
((_a = collection == null ? void 0 : collection.model) == null ? void 0 : _a.primaryKeyAttributes) || ((_b = collection == null ? void 0 : collection.model) == null ? void 0 : _b.primaryKeyAttribute) || []
|
|
16240
16566
|
);
|
|
16241
16567
|
const modelAttribute = modelAttributes == null ? void 0 : modelAttributes[normalized];
|
|
16242
16568
|
const isModelPrimaryKey = primaryKeyAttributes.includes(normalized) || !!(modelAttribute == null ? void 0 : modelAttribute.primaryKey);
|
|
16243
|
-
return !!((0, import_service_helpers.resolveFieldFromCollection)(collection, normalized) || ((
|
|
16569
|
+
return !!((0, import_service_helpers.resolveFieldFromCollection)(collection, normalized) || ((_c = collection == null ? void 0 : collection.getField) == null ? void 0 : _c.call(collection, normalized)) || (0, import_service_helpers.getCollectionFields)(collection).some((field) => (0, import_service_helpers.getFieldName)(field) === normalized) || isModelPrimaryKey);
|
|
16244
16570
|
}
|
|
16245
16571
|
assertInitialBlockResourceCompatible(actionName, blockUse, resourceInit, popupProfile) {
|
|
16246
16572
|
if (blockUse === "CommentsBlockModel") {
|
|
@@ -17051,7 +17377,11 @@ class FlowSurfacesService {
|
|
|
17051
17377
|
items: []
|
|
17052
17378
|
};
|
|
17053
17379
|
}
|
|
17054
|
-
return
|
|
17380
|
+
return (0, import_filter_group.normalizeFlowSurfaceFilterGroupValue)(
|
|
17381
|
+
value,
|
|
17382
|
+
`flowSurfaces configure action defaultFilter expects FilterGroup like ${import_filter_group.FLOW_SURFACE_FILTER_GROUP_EXAMPLE}`,
|
|
17383
|
+
{ strictDateValues: true }
|
|
17384
|
+
);
|
|
17055
17385
|
}
|
|
17056
17386
|
normalizeActionAssignValues(actionName, value) {
|
|
17057
17387
|
if (!import_lodash.default.isPlainObject(value)) {
|
|
@@ -229,6 +229,9 @@ export type FlowSurfaceComposeValues = {
|
|
|
229
229
|
target: FlowSurfaceWriteTarget;
|
|
230
230
|
mode?: FlowSurfaceComposeMode;
|
|
231
231
|
blocks?: Array<Record<string, any>>;
|
|
232
|
+
assets?: {
|
|
233
|
+
charts?: Record<string, any>;
|
|
234
|
+
};
|
|
232
235
|
layout?: Record<string, any>;
|
|
233
236
|
defaults?: FlowSurfaceApplyBlueprintDefaults;
|
|
234
237
|
};
|
|
@@ -25,6 +25,12 @@ export interface FlowModelAttachOptions {
|
|
|
25
25
|
subType: 'array' | 'object';
|
|
26
26
|
position?: FlowModelAttachPosition;
|
|
27
27
|
}
|
|
28
|
+
type FlowModelMovePosition = 'before' | 'after';
|
|
29
|
+
interface FlowModelMoveOptions {
|
|
30
|
+
sourceId: string;
|
|
31
|
+
targetId: string;
|
|
32
|
+
position?: FlowModelMovePosition;
|
|
33
|
+
}
|
|
28
34
|
type BreakRemoveOnType = {
|
|
29
35
|
[key: string]: any;
|
|
30
36
|
};
|
|
@@ -59,6 +65,8 @@ export declare class FlowModelRepository extends Repository {
|
|
|
59
65
|
getParentProperty(uid: string, options?: GetPropertiesOptions): Promise<any>;
|
|
60
66
|
getJsonSchema(uid: string, options?: GetJsonSchemaOptions): Promise<any>;
|
|
61
67
|
static optionsToJson(options: any): any;
|
|
68
|
+
private static getSortNumber;
|
|
69
|
+
private static compareBySortAndUid;
|
|
62
70
|
nodesToSchema(nodes: any, rootUid: any): {
|
|
63
71
|
uid: any;
|
|
64
72
|
"x-async": boolean;
|
|
@@ -90,6 +98,9 @@ export declare class FlowModelRepository extends Repository {
|
|
|
90
98
|
protected childrenCount(uid: any, transaction: any): Promise<number>;
|
|
91
99
|
protected isLeafNode(uid: any, transaction: any): Promise<boolean>;
|
|
92
100
|
protected findParentUid(uid: any, transaction?: any): Promise<string>;
|
|
101
|
+
private findSiblingInfo;
|
|
102
|
+
private findSiblingSortRows;
|
|
103
|
+
private writeSiblingSorts;
|
|
93
104
|
protected findNodeSchemaWithParent(uid: any, transaction: any): Promise<{
|
|
94
105
|
parentUid: string;
|
|
95
106
|
schema: any;
|
|
@@ -122,6 +133,6 @@ export declare class FlowModelRepository extends Repository {
|
|
|
122
133
|
subKey?: string;
|
|
123
134
|
}): Promise<any>;
|
|
124
135
|
attach(uid: string, attachOptions: FlowModelAttachOptions, options?: Transactionable): Promise<any>;
|
|
125
|
-
move(options:
|
|
136
|
+
move(options: FlowModelMoveOptions, transactionOptions?: Transactionable): Promise<any>;
|
|
126
137
|
}
|
|
127
138
|
export default FlowModelRepository;
|