@nocobase/plugin-flow-engine 2.1.0-alpha.17 → 2.1.0-alpha.19
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 +11 -11
- package/dist/node_modules/ses/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/flow-surfaces/action-scope.js +3 -1
- package/dist/server/flow-surfaces/apply/compiler.js +84 -5
- package/dist/server/flow-surfaces/approval/blueprint-service.d.ts +84 -0
- package/dist/server/flow-surfaces/approval/blueprint-service.js +589 -0
- package/dist/server/flow-surfaces/approval/blueprint.d.ts +21 -0
- package/dist/server/flow-surfaces/approval/blueprint.js +190 -0
- package/dist/server/flow-surfaces/approval/builder.d.ts +225 -0
- package/dist/server/flow-surfaces/approval/builder.js +384 -0
- package/dist/server/flow-surfaces/approval/catalog-specs.d.ts +33 -0
- package/dist/server/flow-surfaces/approval/catalog-specs.js +156 -0
- package/dist/server/flow-surfaces/approval/index.d.ts +14 -0
- package/dist/server/flow-surfaces/approval/index.js +40 -0
- package/dist/server/flow-surfaces/approval/runtime-config.d.ts +44 -0
- package/dist/server/flow-surfaces/approval/runtime-config.js +299 -0
- package/dist/server/flow-surfaces/approval/semantic-use.d.ts +23 -0
- package/dist/server/flow-surfaces/approval/semantic-use.js +155 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.js +36 -2
- package/dist/server/flow-surfaces/blueprint/public-types.d.ts +7 -0
- package/dist/server/flow-surfaces/builder.d.ts +2 -0
- package/dist/server/flow-surfaces/builder.js +83 -10
- package/dist/server/flow-surfaces/catalog.d.ts +10 -0
- package/dist/server/flow-surfaces/catalog.js +368 -9
- package/dist/server/flow-surfaces/chart-config.d.ts +1 -1
- package/dist/server/flow-surfaces/compose-compiler.d.ts +1 -0
- package/dist/server/flow-surfaces/compose-compiler.js +2 -1
- package/dist/server/flow-surfaces/configure-options.js +61 -3
- package/dist/server/flow-surfaces/constants.d.ts +342 -5
- package/dist/server/flow-surfaces/constants.js +59 -125
- package/dist/server/flow-surfaces/default-action-popup.d.ts +1 -0
- package/dist/server/flow-surfaces/default-action-popup.js +6 -2
- package/dist/server/flow-surfaces/field-semantics.js +2 -1
- package/dist/server/flow-surfaces/index.js +21 -273
- package/dist/server/flow-surfaces/locator.js +8 -6
- package/dist/server/flow-surfaces/node-use-sets.js +15 -3
- package/dist/server/flow-surfaces/placement.js +11 -7
- package/dist/server/flow-surfaces/planning/action-specs.d.ts +1 -1
- package/dist/server/flow-surfaces/planning/compiler.d.ts +1 -1
- package/dist/server/flow-surfaces/planning/key-kind.js +7 -5
- package/dist/server/flow-surfaces/reaction/registry.d.ts +13 -0
- package/dist/server/flow-surfaces/reaction/registry.js +13 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +10 -14
- package/dist/server/flow-surfaces/service-utils.js +4 -2
- package/dist/server/flow-surfaces/service.d.ts +63 -1
- package/dist/server/flow-surfaces/service.js +1058 -109
- package/dist/server/flow-surfaces/surface-context.d.ts +1 -0
- package/dist/server/flow-surfaces/surface-context.js +99 -19
- package/dist/server/flow-surfaces/types.d.ts +4 -1
- package/dist/swagger/flow-surfaces.d.ts +406 -2
- package/dist/swagger/flow-surfaces.examples.d.ts +164 -0
- package/dist/swagger/flow-surfaces.examples.js +184 -0
- package/dist/swagger/flow-surfaces.js +390 -76
- package/dist/swagger/index.d.ts +406 -2
- package/package.json +2 -2
|
@@ -51,6 +51,8 @@ var import_utils = require("@nocobase/utils");
|
|
|
51
51
|
var import_lodash = __toESM(require("lodash"));
|
|
52
52
|
var import_catalog = require("./catalog");
|
|
53
53
|
var import_chart_config = require("./chart-config");
|
|
54
|
+
var import_approval = require("./approval");
|
|
55
|
+
var import_service_utils = require("./service-utils");
|
|
54
56
|
const JS_BLOCK_DEFAULT_CODE = [
|
|
55
57
|
"// Welcome to the JS block",
|
|
56
58
|
"ctx.render(`",
|
|
@@ -208,14 +210,21 @@ function buildBlockTree(options) {
|
|
|
208
210
|
const use = (0, import_catalog.resolveSupportedBlockCatalogItem)(
|
|
209
211
|
{
|
|
210
212
|
type: options.type,
|
|
211
|
-
use: options.use
|
|
213
|
+
use: options.use,
|
|
214
|
+
containerUse: options.containerUse
|
|
212
215
|
},
|
|
213
216
|
{
|
|
214
217
|
requireCreateSupported: true
|
|
215
218
|
}
|
|
216
219
|
).use;
|
|
217
220
|
const defaults = buildBlockDefaults(use);
|
|
218
|
-
const
|
|
221
|
+
const approvalBlockDefaults = (0, import_approval.buildApprovalBlockDefaults)(use);
|
|
222
|
+
const baseStepParams = import_lodash.default.merge(
|
|
223
|
+
{},
|
|
224
|
+
import_lodash.default.cloneDeep(defaults.stepParams || {}),
|
|
225
|
+
import_lodash.default.cloneDeep((approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.stepParams) || {}),
|
|
226
|
+
import_lodash.default.cloneDeep(options.stepParams || {})
|
|
227
|
+
);
|
|
219
228
|
const normalizedResourceInit = import_lodash.default.pickBy(import_lodash.default.cloneDeep(options.resourceInit || {}), (value) => !import_lodash.default.isUndefined(value));
|
|
220
229
|
if (use === "ChartBlockModel") {
|
|
221
230
|
import_lodash.default.unset(baseStepParams, "resourceSettings");
|
|
@@ -248,11 +257,49 @@ function buildBlockTree(options) {
|
|
|
248
257
|
}
|
|
249
258
|
const model = {
|
|
250
259
|
use,
|
|
251
|
-
|
|
252
|
-
|
|
260
|
+
...typeof (approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.async) === "boolean" ? { async: approvalBlockDefaults.async } : {},
|
|
261
|
+
props: import_lodash.default.merge(
|
|
262
|
+
{},
|
|
263
|
+
import_lodash.default.cloneDeep(defaults.props || {}),
|
|
264
|
+
import_lodash.default.cloneDeep((approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.props) || {}),
|
|
265
|
+
import_lodash.default.cloneDeep(options.props || {})
|
|
266
|
+
),
|
|
267
|
+
decoratorProps: import_lodash.default.merge(
|
|
268
|
+
{},
|
|
269
|
+
import_lodash.default.cloneDeep(defaults.decoratorProps || {}),
|
|
270
|
+
import_lodash.default.cloneDeep((approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.decoratorProps) || {}),
|
|
271
|
+
import_lodash.default.cloneDeep(options.decoratorProps || {})
|
|
272
|
+
),
|
|
253
273
|
stepParams: baseStepParams
|
|
254
274
|
};
|
|
255
|
-
|
|
275
|
+
const flowRegistry = import_lodash.default.merge(
|
|
276
|
+
{},
|
|
277
|
+
import_lodash.default.cloneDeep(defaults.flowRegistry || {}),
|
|
278
|
+
import_lodash.default.cloneDeep((approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.flowRegistry) || {}),
|
|
279
|
+
import_lodash.default.cloneDeep(options.flowRegistry || {})
|
|
280
|
+
);
|
|
281
|
+
if (Object.keys(flowRegistry).length) {
|
|
282
|
+
model.flowRegistry = flowRegistry;
|
|
283
|
+
}
|
|
284
|
+
if (approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.subModels) {
|
|
285
|
+
model.subModels = {};
|
|
286
|
+
const gridDefaults = (0, import_service_utils.getSingleNodeSubModel)(approvalBlockDefaults.subModels.grid);
|
|
287
|
+
if (gridDefaults == null ? void 0 : gridDefaults.use) {
|
|
288
|
+
model.subModels.grid = {
|
|
289
|
+
uid: (0, import_utils.uid)(),
|
|
290
|
+
use: gridDefaults.use
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
if (Array.isArray(approvalBlockDefaults.subModels.actions) && approvalBlockDefaults.subModels.actions.length) {
|
|
294
|
+
model.subModels.actions = approvalBlockDefaults.subModels.actions.map((action) => ({
|
|
295
|
+
uid: (0, import_utils.uid)(),
|
|
296
|
+
...buildActionTree({
|
|
297
|
+
use: action.use,
|
|
298
|
+
containerUse: use
|
|
299
|
+
})
|
|
300
|
+
}));
|
|
301
|
+
}
|
|
302
|
+
} else if (use === "TableBlockModel") {
|
|
256
303
|
model.subModels = {
|
|
257
304
|
columns: [buildCanonicalTableActionsColumnNode()]
|
|
258
305
|
};
|
|
@@ -359,6 +406,20 @@ function buildPopupPageTree(options) {
|
|
|
359
406
|
function buildFieldTree(params) {
|
|
360
407
|
const wrapperUid = params.uid || (0, import_utils.uid)();
|
|
361
408
|
const innerUid = params.innerUid || (0, import_utils.uid)();
|
|
409
|
+
const fieldDefaults = getStandaloneFieldDefaults(params.fieldUse);
|
|
410
|
+
const approvalTree = (0, import_approval.buildApprovalFieldTree)({
|
|
411
|
+
...params,
|
|
412
|
+
uid: wrapperUid,
|
|
413
|
+
innerUid,
|
|
414
|
+
fieldDefaults
|
|
415
|
+
});
|
|
416
|
+
if (approvalTree) {
|
|
417
|
+
return {
|
|
418
|
+
wrapperUid: approvalTree.wrapperUid,
|
|
419
|
+
innerUid: approvalTree.innerUid,
|
|
420
|
+
model: approvalTree.model
|
|
421
|
+
};
|
|
422
|
+
}
|
|
362
423
|
const initPayload = import_lodash.default.pickBy(
|
|
363
424
|
{
|
|
364
425
|
dataSourceKey: params.dataSourceKey,
|
|
@@ -393,7 +454,7 @@ function buildFieldTree(params) {
|
|
|
393
454
|
props: import_lodash.default.cloneDeep(params.fieldProps || {}),
|
|
394
455
|
stepParams: import_lodash.default.merge(
|
|
395
456
|
{},
|
|
396
|
-
|
|
457
|
+
fieldDefaults.stepParams || {},
|
|
397
458
|
import_lodash.default.cloneDeep({
|
|
398
459
|
fieldSettings: {
|
|
399
460
|
init: initPayload
|
|
@@ -492,14 +553,26 @@ function assignClientKeysToUids(spec, clientKeyToUid) {
|
|
|
492
553
|
}
|
|
493
554
|
function buildActionDefaults(options) {
|
|
494
555
|
var _a, _b, _c;
|
|
495
|
-
const
|
|
556
|
+
const approvalDefaults = (0, import_approval.buildApprovalActionDefaults)(options.use);
|
|
557
|
+
const props = import_lodash.default.merge(
|
|
558
|
+
{},
|
|
559
|
+
inferActionDefaultProps(options.use, options.catalogItem.scope),
|
|
560
|
+
(approvalDefaults == null ? void 0 : approvalDefaults.props) || {}
|
|
561
|
+
);
|
|
496
562
|
const normalizedProps = applyContainerActionStyle(props, options.containerUse);
|
|
497
|
-
const stepParams = {
|
|
563
|
+
const stepParams = import_lodash.default.merge({}, import_lodash.default.cloneDeep((approvalDefaults == null ? void 0 : approvalDefaults.stepParams) || {}), {
|
|
498
564
|
buttonSettings: {
|
|
499
565
|
general: pickButtonGeneralProps(normalizedProps)
|
|
500
566
|
}
|
|
501
|
-
};
|
|
502
|
-
const subModels = {};
|
|
567
|
+
});
|
|
568
|
+
const subModels = import_lodash.default.cloneDeep((approvalDefaults == null ? void 0 : approvalDefaults.subModels) || {});
|
|
569
|
+
if (approvalDefaults) {
|
|
570
|
+
return {
|
|
571
|
+
props: normalizedProps,
|
|
572
|
+
stepParams,
|
|
573
|
+
...Object.keys(subModels).length ? { subModels } : {}
|
|
574
|
+
};
|
|
575
|
+
}
|
|
503
576
|
if ([
|
|
504
577
|
"AddNewActionModel",
|
|
505
578
|
"ViewActionModel",
|
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { FlowSurfaceActionScope, FlowSurfaceCatalogItem, FlowSurfaceLayoutCapabilities, FlowSurfaceNodeContract, FlowSurfaceNodeDomain } from './types';
|
|
10
10
|
export declare const READONLY_NODE_CONTRACT: FlowSurfaceNodeContract;
|
|
11
|
+
export declare function getSupportedFieldComponentUseSet(input: {
|
|
12
|
+
containerUse: string;
|
|
13
|
+
field?: any;
|
|
14
|
+
enabledPackages?: ReadonlySet<string>;
|
|
15
|
+
dataSourceKey?: string;
|
|
16
|
+
getCollection?: (dataSourceKey: string, collectionName: string) => any;
|
|
17
|
+
}): Set<any>;
|
|
11
18
|
export declare function resolveSupportedFieldCapability(input: {
|
|
12
19
|
containerUse: string;
|
|
13
20
|
field?: any;
|
|
@@ -34,6 +41,7 @@ export declare function resolveSupportedFieldCapability(input: {
|
|
|
34
41
|
};
|
|
35
42
|
export declare function getAvailableActionCatalogItems(containerUse?: string, scope?: FlowSurfaceActionScope, enabledPackages?: ReadonlySet<string>): FlowSurfaceCatalogItem[];
|
|
36
43
|
export declare const blockCatalog: FlowSurfaceCatalogItem[];
|
|
44
|
+
export declare function getAvailableBlockCatalogItems(containerUse?: string, enabledPackages?: ReadonlySet<string>): FlowSurfaceCatalogItem[];
|
|
37
45
|
export declare const actionCatalog: FlowSurfaceCatalogItem[];
|
|
38
46
|
export declare const ACTION_PUBLIC_KEYS: string[];
|
|
39
47
|
export declare const SERVICE_SUPPORTED_FLOW_SURFACE_BLOCK_KEYS: string[];
|
|
@@ -48,10 +56,12 @@ export declare function filterAvailableCatalogItems<T extends Pick<FlowSurfaceCa
|
|
|
48
56
|
export declare function resolveSupportedBlockCatalogItem(input: {
|
|
49
57
|
type?: string;
|
|
50
58
|
use?: string;
|
|
59
|
+
containerUse?: string;
|
|
51
60
|
}, options?: {
|
|
52
61
|
context?: string;
|
|
53
62
|
enabledPackages?: ReadonlySet<string>;
|
|
54
63
|
requireCreateSupported?: boolean;
|
|
64
|
+
skipContainerValidation?: boolean;
|
|
55
65
|
}): FlowSurfaceCatalogItem;
|
|
56
66
|
export declare function resolveSupportedActionCatalogItem(input: {
|
|
57
67
|
type?: string;
|