@nocobase/plugin-flow-engine 2.1.0-alpha.15 → 2.1.0-alpha.17
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 +10 -10
- package/dist/node_modules/ses/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/flow-surfaces/{compiler.d.ts → apply/compiler.d.ts} +1 -10
- package/dist/server/flow-surfaces/{compiler.js → apply/compiler.js} +41 -280
- package/dist/server/flow-surfaces/apply/layout.d.ts +34 -0
- package/dist/server/flow-surfaces/apply/layout.js +175 -0
- package/dist/server/flow-surfaces/apply/matching.d.ts +16 -0
- package/dist/server/flow-surfaces/apply/matching.js +181 -0
- package/dist/server/flow-surfaces/association-title-field.d.ts +20 -0
- package/dist/server/flow-surfaces/association-title-field.js +158 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +14 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.js +717 -0
- package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +13 -0
- package/dist/server/flow-surfaces/blueprint/compile-plan.js +308 -0
- package/dist/server/flow-surfaces/blueprint/compile-reaction.d.ts +11 -0
- package/dist/server/flow-surfaces/blueprint/compile-reaction.js +72 -0
- package/dist/server/flow-surfaces/blueprint/index.d.ts +12 -0
- package/dist/server/flow-surfaces/blueprint/index.js +44 -0
- package/dist/server/flow-surfaces/blueprint/normalize-document.d.ts +10 -0
- package/dist/server/flow-surfaces/blueprint/normalize-document.js +296 -0
- package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +26 -0
- package/dist/server/flow-surfaces/blueprint/private-utils.js +182 -0
- package/dist/server/flow-surfaces/blueprint/public-types.d.ts +153 -0
- package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
- package/dist/server/flow-surfaces/catalog-smart.d.ts +18 -0
- package/dist/server/flow-surfaces/catalog-smart.js +239 -0
- package/dist/server/flow-surfaces/catalog-smart.projector.d.ts +15 -0
- package/dist/server/flow-surfaces/catalog-smart.projector.js +157 -0
- package/dist/server/flow-surfaces/catalog-smart.types.d.ts +99 -0
- package/dist/server/flow-surfaces/catalog-smart.types.js +24 -0
- package/dist/server/flow-surfaces/catalog.d.ts +3 -0
- package/dist/server/flow-surfaces/catalog.js +163 -34
- package/dist/server/flow-surfaces/compose-compiler.d.ts +104 -0
- package/dist/server/flow-surfaces/compose-compiler.js +162 -0
- package/dist/server/flow-surfaces/compose-runtime.d.ts +89 -0
- package/dist/server/flow-surfaces/compose-runtime.js +338 -0
- package/dist/server/flow-surfaces/configure-options.js +12 -3
- package/dist/server/flow-surfaces/constants.d.ts +3 -2
- package/dist/server/flow-surfaces/constants.js +36 -3
- package/dist/server/flow-surfaces/default-action-popup.d.ts +52 -0
- package/dist/server/flow-surfaces/default-action-popup.js +258 -0
- package/dist/server/flow-surfaces/executor.d.ts +10 -0
- package/dist/server/flow-surfaces/executor.js +59 -24
- package/dist/server/flow-surfaces/field-binding-registry.d.ts +23 -0
- package/dist/server/flow-surfaces/field-binding-registry.js +391 -0
- package/dist/server/flow-surfaces/field-semantics.d.ts +1 -1
- package/dist/server/flow-surfaces/index.js +75 -0
- package/dist/server/flow-surfaces/node-use-sets.d.ts +15 -0
- package/dist/server/flow-surfaces/node-use-sets.js +114 -0
- package/dist/server/flow-surfaces/payload-shape.d.ts +9 -0
- package/dist/server/flow-surfaces/payload-shape.js +61 -0
- package/dist/server/flow-surfaces/placement.js +2 -6
- package/dist/server/flow-surfaces/planning/action-specs.d.ts +179 -0
- package/dist/server/flow-surfaces/planning/action-specs.js +190 -0
- package/dist/server/flow-surfaces/planning/compiler.d.ts +37 -0
- package/dist/server/flow-surfaces/planning/compiler.js +376 -0
- package/dist/server/flow-surfaces/planning/context.d.ts +30 -0
- package/dist/server/flow-surfaces/planning/context.js +139 -0
- package/dist/server/flow-surfaces/planning/created-keys.d.ts +34 -0
- package/dist/server/flow-surfaces/planning/created-keys.js +375 -0
- package/dist/server/flow-surfaces/planning/key-kind.d.ts +11 -0
- package/dist/server/flow-surfaces/planning/key-kind.js +86 -0
- package/dist/server/flow-surfaces/planning/key-persistence.d.ts +34 -0
- package/dist/server/flow-surfaces/planning/key-persistence.js +148 -0
- package/dist/server/flow-surfaces/planning/key-registry.d.ts +40 -0
- package/dist/server/flow-surfaces/planning/key-registry.js +206 -0
- package/dist/server/flow-surfaces/planning/runtime.d.ts +37 -0
- package/dist/server/flow-surfaces/planning/runtime.js +259 -0
- package/dist/server/flow-surfaces/planning/step-link.d.ts +14 -0
- package/dist/server/flow-surfaces/planning/step-link.js +104 -0
- package/dist/server/flow-surfaces/planning/types.d.ts +55 -0
- package/dist/server/flow-surfaces/planning/types.js +24 -0
- package/dist/server/flow-surfaces/reaction/errors.d.ts +20 -0
- package/dist/server/flow-surfaces/reaction/errors.js +69 -0
- package/dist/server/flow-surfaces/reaction/field-value.d.ts +34 -0
- package/dist/server/flow-surfaces/reaction/field-value.js +181 -0
- package/dist/server/flow-surfaces/reaction/fingerprint.d.ts +16 -0
- package/dist/server/flow-surfaces/reaction/fingerprint.js +71 -0
- package/dist/server/flow-surfaces/reaction/linkage.d.ts +136 -0
- package/dist/server/flow-surfaces/reaction/linkage.js +882 -0
- package/dist/server/flow-surfaces/reaction/meta.d.ts +11 -0
- package/dist/server/flow-surfaces/reaction/meta.js +451 -0
- package/dist/server/flow-surfaces/reaction/registry.d.ts +136 -0
- package/dist/server/flow-surfaces/reaction/registry.js +186 -0
- package/dist/server/flow-surfaces/reaction/resolver.d.ts +22 -0
- package/dist/server/flow-surfaces/reaction/resolver.js +202 -0
- package/dist/server/flow-surfaces/reaction/types.d.ts +241 -0
- package/dist/server/flow-surfaces/reaction/types.js +24 -0
- package/dist/server/flow-surfaces/reaction/utils.d.ts +17 -0
- package/dist/server/flow-surfaces/reaction/utils.js +67 -0
- package/dist/server/flow-surfaces/reaction/value-expr.d.ts +15 -0
- package/dist/server/flow-surfaces/reaction/value-expr.js +209 -0
- package/dist/server/flow-surfaces/reference-guards.d.ts +19 -0
- package/dist/server/flow-surfaces/reference-guards.js +103 -0
- package/dist/server/flow-surfaces/service-helpers.d.ts +42 -0
- package/dist/server/flow-surfaces/service-helpers.js +377 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +105 -0
- package/dist/server/flow-surfaces/service-utils.js +760 -0
- package/dist/server/flow-surfaces/service.d.ts +199 -104
- package/dist/server/flow-surfaces/service.js +4158 -1890
- package/dist/server/flow-surfaces/template-compatibility.d.ts +42 -0
- package/dist/server/flow-surfaces/template-compatibility.js +189 -0
- package/dist/server/flow-surfaces/template-service-utils.d.ts +62 -0
- package/dist/server/flow-surfaces/template-service-utils.js +281 -0
- package/dist/server/flow-surfaces/types.d.ts +129 -37
- package/dist/swagger/flow-surfaces.d.ts +3777 -1581
- package/dist/swagger/flow-surfaces.examples.d.ts +1246 -0
- package/dist/swagger/flow-surfaces.examples.js +1396 -0
- package/dist/swagger/flow-surfaces.js +2020 -1469
- package/dist/swagger/flow-surfaces.template-action-docs.d.ts +62 -0
- package/dist/swagger/flow-surfaces.template-action-docs.js +121 -0
- package/dist/swagger/flow-surfaces.template-schemas.d.ts +239 -0
- package/dist/swagger/flow-surfaces.template-schemas.js +255 -0
- package/dist/swagger/index.d.ts +3777 -1581
- package/package.json +2 -2
|
@@ -29,13 +29,28 @@ __export(constants_exports, {
|
|
|
29
29
|
FLOW_SURFACES_ACTION_METHODS: () => FLOW_SURFACES_ACTION_METHODS,
|
|
30
30
|
FLOW_SURFACES_ACTION_NAMES: () => FLOW_SURFACES_ACTION_NAMES,
|
|
31
31
|
FLOW_SURFACES_READ_ACTION_NAMES: () => FLOW_SURFACES_READ_ACTION_NAMES,
|
|
32
|
-
FLOW_SURFACE_MUTATE_OP_TYPES: () => FLOW_SURFACE_MUTATE_OP_TYPES
|
|
32
|
+
FLOW_SURFACE_MUTATE_OP_TYPES: () => FLOW_SURFACE_MUTATE_OP_TYPES,
|
|
33
|
+
FLOW_SURFACE_PLAN_STEP_ACTIONS: () => import_action_specs.FLOW_SURFACE_PLAN_STEP_ACTIONS
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(constants_exports);
|
|
36
|
+
var import_action_specs = require("./planning/action-specs");
|
|
35
37
|
const FLOW_SURFACES_ACTION_NAMES = [
|
|
36
38
|
"catalog",
|
|
37
39
|
"context",
|
|
38
40
|
"get",
|
|
41
|
+
"describeSurface",
|
|
42
|
+
"getReactionMeta",
|
|
43
|
+
"setFieldValueRules",
|
|
44
|
+
"setBlockLinkageRules",
|
|
45
|
+
"setFieldLinkageRules",
|
|
46
|
+
"setActionLinkageRules",
|
|
47
|
+
"applyBlueprint",
|
|
48
|
+
"listTemplates",
|
|
49
|
+
"getTemplate",
|
|
50
|
+
"saveTemplate",
|
|
51
|
+
"updateTemplate",
|
|
52
|
+
"destroyTemplate",
|
|
53
|
+
"convertTemplateToCopy",
|
|
39
54
|
"compose",
|
|
40
55
|
"configure",
|
|
41
56
|
"createMenu",
|
|
@@ -69,7 +84,11 @@ const FLOW_SURFACES_ACTION_NAMES = [
|
|
|
69
84
|
const FLOW_SURFACES_READ_ACTION_NAMES = [
|
|
70
85
|
"catalog",
|
|
71
86
|
"context",
|
|
72
|
-
"get"
|
|
87
|
+
"get",
|
|
88
|
+
"describeSurface",
|
|
89
|
+
"getReactionMeta",
|
|
90
|
+
"listTemplates",
|
|
91
|
+
"getTemplate"
|
|
73
92
|
];
|
|
74
93
|
const FLOW_SURFACE_MUTATE_OP_TYPES = [
|
|
75
94
|
"createMenu",
|
|
@@ -98,6 +117,19 @@ const FLOW_SURFACES_ACTION_METHODS = {
|
|
|
98
117
|
catalog: "post",
|
|
99
118
|
context: "post",
|
|
100
119
|
get: "get",
|
|
120
|
+
describeSurface: "post",
|
|
121
|
+
getReactionMeta: "post",
|
|
122
|
+
setFieldValueRules: "post",
|
|
123
|
+
setBlockLinkageRules: "post",
|
|
124
|
+
setFieldLinkageRules: "post",
|
|
125
|
+
setActionLinkageRules: "post",
|
|
126
|
+
applyBlueprint: "post",
|
|
127
|
+
listTemplates: "post",
|
|
128
|
+
getTemplate: "post",
|
|
129
|
+
saveTemplate: "post",
|
|
130
|
+
updateTemplate: "post",
|
|
131
|
+
destroyTemplate: "post",
|
|
132
|
+
convertTemplateToCopy: "post",
|
|
101
133
|
compose: "post",
|
|
102
134
|
configure: "post",
|
|
103
135
|
createMenu: "post",
|
|
@@ -133,5 +165,6 @@ const FLOW_SURFACES_ACTION_METHODS = {
|
|
|
133
165
|
FLOW_SURFACES_ACTION_METHODS,
|
|
134
166
|
FLOW_SURFACES_ACTION_NAMES,
|
|
135
167
|
FLOW_SURFACES_READ_ACTION_NAMES,
|
|
136
|
-
FLOW_SURFACE_MUTATE_OP_TYPES
|
|
168
|
+
FLOW_SURFACE_MUTATE_OP_TYPES,
|
|
169
|
+
FLOW_SURFACE_PLAN_STEP_ACTIONS
|
|
137
170
|
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import _ from 'lodash';
|
|
10
|
+
export type FlowSurfaceDefaultActionPopupType = 'addNew' | 'view' | 'edit';
|
|
11
|
+
export type FlowSurfaceDefaultActionPopupUse = 'AddNewActionModel' | 'ViewActionModel' | 'EditActionModel';
|
|
12
|
+
type FlowSurfaceDefaultActionPopupSubmitAction = {
|
|
13
|
+
key: string;
|
|
14
|
+
type: 'submit';
|
|
15
|
+
settings: {
|
|
16
|
+
title: string;
|
|
17
|
+
type: string;
|
|
18
|
+
confirm: boolean;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type FlowSurfaceDefaultActionPopupConfig = {
|
|
22
|
+
type: FlowSurfaceDefaultActionPopupType;
|
|
23
|
+
use: FlowSurfaceDefaultActionPopupUse;
|
|
24
|
+
defaultButtonTitle: string;
|
|
25
|
+
defaultPopupTabTitle: string;
|
|
26
|
+
blockKey: string;
|
|
27
|
+
blockType: 'createForm' | 'editForm' | 'details';
|
|
28
|
+
blockUse: 'CreateFormModel' | 'EditFormModel' | 'DetailsBlockModel';
|
|
29
|
+
resourceBinding: 'currentCollection' | 'currentRecord';
|
|
30
|
+
blockSettings: Record<string, any>;
|
|
31
|
+
submitAction?: FlowSurfaceDefaultActionPopupSubmitAction;
|
|
32
|
+
};
|
|
33
|
+
export type FlowSurfaceDefaultActionPopupFieldCandidate = {
|
|
34
|
+
field?: any;
|
|
35
|
+
fieldPath?: string;
|
|
36
|
+
};
|
|
37
|
+
type FlowSurfaceDefaultActionPopupFieldFilterOptions = {
|
|
38
|
+
excludeAuditTimestampFields?: boolean;
|
|
39
|
+
};
|
|
40
|
+
export declare const FLOW_SURFACE_DEFAULT_ACTION_POPUP_TYPES: Set<FlowSurfaceDefaultActionPopupType>;
|
|
41
|
+
export declare const FLOW_SURFACE_DEFAULT_ACTION_POPUP_USES: Set<FlowSurfaceDefaultActionPopupUse>;
|
|
42
|
+
export declare function isFlowSurfaceDefaultActionPopupType(type?: string): type is FlowSurfaceDefaultActionPopupType;
|
|
43
|
+
export declare function isFlowSurfaceDefaultActionPopupUse(use?: string): use is FlowSurfaceDefaultActionPopupUse;
|
|
44
|
+
export declare function getFlowSurfaceDefaultActionPopupConfigByUse(use?: string): FlowSurfaceDefaultActionPopupConfig;
|
|
45
|
+
export declare function resolveFlowSurfaceDefaultActionPopupTabTitle(use?: string, currentTitle?: string | null): string;
|
|
46
|
+
export declare function pickFlowSurfaceDefaultActionPopupFieldPaths(candidates: FlowSurfaceDefaultActionPopupFieldCandidate[], options?: FlowSurfaceDefaultActionPopupFieldFilterOptions): string[];
|
|
47
|
+
export declare function buildFlowSurfaceDefaultActionPopupBlocks(use: string | undefined, fieldPaths: string[]): _.Dictionary<string | string[] | Record<string, any> | FlowSurfaceDefaultActionPopupSubmitAction[] | {
|
|
48
|
+
binding: "currentCollection" | "currentRecord";
|
|
49
|
+
}>[];
|
|
50
|
+
export declare function hasFlowSurfaceInlinePopupTemplate(popup?: Record<string, any>): boolean;
|
|
51
|
+
export declare function hasFlowSurfaceInlinePopupBlocks(popup?: Record<string, any>): boolean;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var default_action_popup_exports = {};
|
|
38
|
+
__export(default_action_popup_exports, {
|
|
39
|
+
FLOW_SURFACE_DEFAULT_ACTION_POPUP_TYPES: () => FLOW_SURFACE_DEFAULT_ACTION_POPUP_TYPES,
|
|
40
|
+
FLOW_SURFACE_DEFAULT_ACTION_POPUP_USES: () => FLOW_SURFACE_DEFAULT_ACTION_POPUP_USES,
|
|
41
|
+
buildFlowSurfaceDefaultActionPopupBlocks: () => buildFlowSurfaceDefaultActionPopupBlocks,
|
|
42
|
+
getFlowSurfaceDefaultActionPopupConfigByUse: () => getFlowSurfaceDefaultActionPopupConfigByUse,
|
|
43
|
+
hasFlowSurfaceInlinePopupBlocks: () => hasFlowSurfaceInlinePopupBlocks,
|
|
44
|
+
hasFlowSurfaceInlinePopupTemplate: () => hasFlowSurfaceInlinePopupTemplate,
|
|
45
|
+
isFlowSurfaceDefaultActionPopupType: () => isFlowSurfaceDefaultActionPopupType,
|
|
46
|
+
isFlowSurfaceDefaultActionPopupUse: () => isFlowSurfaceDefaultActionPopupUse,
|
|
47
|
+
pickFlowSurfaceDefaultActionPopupFieldPaths: () => pickFlowSurfaceDefaultActionPopupFieldPaths,
|
|
48
|
+
resolveFlowSurfaceDefaultActionPopupTabTitle: () => resolveFlowSurfaceDefaultActionPopupTabTitle
|
|
49
|
+
});
|
|
50
|
+
module.exports = __toCommonJS(default_action_popup_exports);
|
|
51
|
+
var import_lodash = __toESM(require("lodash"));
|
|
52
|
+
var import_field_semantics = require("./field-semantics");
|
|
53
|
+
var import_service_helpers = require("./service-helpers");
|
|
54
|
+
const DEFAULT_ACTION_POPUP_SYSTEM_FIELD_NAMES = /* @__PURE__ */ new Set(["id", "createdBy", "createdById", "updatedBy", "updatedById"]);
|
|
55
|
+
const DEFAULT_ACTION_POPUP_SYSTEM_FIELD_INTERFACES = /* @__PURE__ */ new Set([
|
|
56
|
+
"id",
|
|
57
|
+
"snowflakeId",
|
|
58
|
+
"createdBy",
|
|
59
|
+
"createdById",
|
|
60
|
+
"updatedBy",
|
|
61
|
+
"updatedById"
|
|
62
|
+
]);
|
|
63
|
+
const DEFAULT_ACTION_POPUP_AUDIT_TIMESTAMP_FIELD_NAMES = /* @__PURE__ */ new Set(["createdAt", "updatedAt"]);
|
|
64
|
+
const DEFAULT_ACTION_POPUP_AUDIT_TIMESTAMP_FIELD_INTERFACES = /* @__PURE__ */ new Set(["createdAt", "updatedAt"]);
|
|
65
|
+
const FLOW_SURFACE_DEFAULT_ACTION_POPUP_CONFIGS = [
|
|
66
|
+
{
|
|
67
|
+
type: "addNew",
|
|
68
|
+
use: "AddNewActionModel",
|
|
69
|
+
defaultButtonTitle: "Add new",
|
|
70
|
+
defaultPopupTabTitle: "Add new",
|
|
71
|
+
blockKey: "defaultCreateForm",
|
|
72
|
+
blockType: "createForm",
|
|
73
|
+
blockUse: "CreateFormModel",
|
|
74
|
+
resourceBinding: "currentCollection",
|
|
75
|
+
blockSettings: {
|
|
76
|
+
layout: "vertical",
|
|
77
|
+
colon: false,
|
|
78
|
+
assignRules: []
|
|
79
|
+
},
|
|
80
|
+
submitAction: {
|
|
81
|
+
key: "defaultSubmit",
|
|
82
|
+
type: "submit",
|
|
83
|
+
settings: {
|
|
84
|
+
title: "Save",
|
|
85
|
+
type: "",
|
|
86
|
+
confirm: false
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: "view",
|
|
92
|
+
use: "ViewActionModel",
|
|
93
|
+
defaultButtonTitle: "View",
|
|
94
|
+
defaultPopupTabTitle: "Details",
|
|
95
|
+
blockKey: "defaultDetails",
|
|
96
|
+
blockType: "details",
|
|
97
|
+
blockUse: "DetailsBlockModel",
|
|
98
|
+
resourceBinding: "currentRecord",
|
|
99
|
+
blockSettings: {
|
|
100
|
+
layout: "vertical",
|
|
101
|
+
colon: true,
|
|
102
|
+
dataScope: {
|
|
103
|
+
logic: "$and",
|
|
104
|
+
items: []
|
|
105
|
+
},
|
|
106
|
+
linkageRules: []
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
type: "edit",
|
|
111
|
+
use: "EditActionModel",
|
|
112
|
+
defaultButtonTitle: "Edit",
|
|
113
|
+
defaultPopupTabTitle: "Edit",
|
|
114
|
+
blockKey: "defaultEditForm",
|
|
115
|
+
blockType: "editForm",
|
|
116
|
+
blockUse: "EditFormModel",
|
|
117
|
+
resourceBinding: "currentRecord",
|
|
118
|
+
blockSettings: {
|
|
119
|
+
layout: "vertical",
|
|
120
|
+
colon: false,
|
|
121
|
+
assignRules: [],
|
|
122
|
+
dataScope: {
|
|
123
|
+
logic: "$and",
|
|
124
|
+
items: []
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
submitAction: {
|
|
128
|
+
key: "defaultSubmit",
|
|
129
|
+
type: "submit",
|
|
130
|
+
settings: {
|
|
131
|
+
title: "Save Changes",
|
|
132
|
+
type: "",
|
|
133
|
+
confirm: false
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
];
|
|
138
|
+
const FLOW_SURFACE_DEFAULT_ACTION_POPUP_TYPES = new Set(
|
|
139
|
+
FLOW_SURFACE_DEFAULT_ACTION_POPUP_CONFIGS.map((item) => item.type)
|
|
140
|
+
);
|
|
141
|
+
const FLOW_SURFACE_DEFAULT_ACTION_POPUP_USES = new Set(
|
|
142
|
+
FLOW_SURFACE_DEFAULT_ACTION_POPUP_CONFIGS.map((item) => item.use)
|
|
143
|
+
);
|
|
144
|
+
const FLOW_SURFACE_DEFAULT_ACTION_POPUP_CONFIG_BY_USE = FLOW_SURFACE_DEFAULT_ACTION_POPUP_CONFIGS.reduce(
|
|
145
|
+
(result, item) => {
|
|
146
|
+
result[item.use] = item;
|
|
147
|
+
return result;
|
|
148
|
+
},
|
|
149
|
+
{}
|
|
150
|
+
);
|
|
151
|
+
function isFlowSurfaceDefaultActionPopupType(type) {
|
|
152
|
+
return FLOW_SURFACE_DEFAULT_ACTION_POPUP_TYPES.has(String(type || "").trim());
|
|
153
|
+
}
|
|
154
|
+
function isFlowSurfaceDefaultActionPopupUse(use) {
|
|
155
|
+
return FLOW_SURFACE_DEFAULT_ACTION_POPUP_USES.has(String(use || "").trim());
|
|
156
|
+
}
|
|
157
|
+
function getFlowSurfaceDefaultActionPopupConfigByUse(use) {
|
|
158
|
+
const normalizedUse = String(use || "").trim();
|
|
159
|
+
if (!isFlowSurfaceDefaultActionPopupUse(normalizedUse)) {
|
|
160
|
+
return void 0;
|
|
161
|
+
}
|
|
162
|
+
return FLOW_SURFACE_DEFAULT_ACTION_POPUP_CONFIG_BY_USE[normalizedUse];
|
|
163
|
+
}
|
|
164
|
+
function resolveFlowSurfaceDefaultActionPopupTabTitle(use, currentTitle) {
|
|
165
|
+
const actionConfig = getFlowSurfaceDefaultActionPopupConfigByUse(use);
|
|
166
|
+
if (!actionConfig) {
|
|
167
|
+
return void 0;
|
|
168
|
+
}
|
|
169
|
+
const normalizedTitle = String(currentTitle || "").trim();
|
|
170
|
+
if (normalizedTitle && normalizedTitle !== actionConfig.defaultButtonTitle) {
|
|
171
|
+
return normalizedTitle;
|
|
172
|
+
}
|
|
173
|
+
return actionConfig.defaultPopupTabTitle;
|
|
174
|
+
}
|
|
175
|
+
function isFlowSurfaceDefaultActionPopupSystemField(field) {
|
|
176
|
+
var _a, _b;
|
|
177
|
+
const fieldName = String((0, import_service_helpers.getFieldName)(field) || "").trim();
|
|
178
|
+
const fieldInterface = String((0, import_service_helpers.getFieldInterface)(field) || "").trim();
|
|
179
|
+
return DEFAULT_ACTION_POPUP_SYSTEM_FIELD_NAMES.has(fieldName) || DEFAULT_ACTION_POPUP_SYSTEM_FIELD_INTERFACES.has(fieldInterface) || !!(field == null ? void 0 : field.primaryKey) || !!((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.primaryKey) || !!(field == null ? void 0 : field.autoIncrement) || !!((_b = field == null ? void 0 : field.options) == null ? void 0 : _b.autoIncrement);
|
|
180
|
+
}
|
|
181
|
+
function isFlowSurfaceDefaultActionPopupTechnicalIdField(field) {
|
|
182
|
+
var _a, _b;
|
|
183
|
+
const fieldName = String((0, import_service_helpers.getFieldName)(field) || "").trim();
|
|
184
|
+
const fieldInterface = String((0, import_service_helpers.getFieldInterface)(field) || "").trim();
|
|
185
|
+
return fieldName === "id" || fieldInterface === "id" || fieldInterface === "snowflakeId" || !!(field == null ? void 0 : field.primaryKey) || !!((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.primaryKey) || !!(field == null ? void 0 : field.autoIncrement) || !!((_b = field == null ? void 0 : field.options) == null ? void 0 : _b.autoIncrement);
|
|
186
|
+
}
|
|
187
|
+
function isFlowSurfaceDefaultActionPopupAuditTimestampField(field) {
|
|
188
|
+
const fieldName = String((0, import_service_helpers.getFieldName)(field) || "").trim();
|
|
189
|
+
const fieldInterface = String((0, import_service_helpers.getFieldInterface)(field) || "").trim();
|
|
190
|
+
return DEFAULT_ACTION_POPUP_AUDIT_TIMESTAMP_FIELD_NAMES.has(fieldName) || DEFAULT_ACTION_POPUP_AUDIT_TIMESTAMP_FIELD_INTERFACES.has(fieldInterface);
|
|
191
|
+
}
|
|
192
|
+
function isFlowSurfaceDefaultActionPopupMultiValueAssociationField(field) {
|
|
193
|
+
const fieldInterface = String((0, import_service_helpers.getFieldInterface)(field) || "").trim();
|
|
194
|
+
return import_field_semantics.MULTI_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface);
|
|
195
|
+
}
|
|
196
|
+
function collectFlowSurfaceDefaultActionPopupAssociationForeignKeys(candidates) {
|
|
197
|
+
return new Set(
|
|
198
|
+
candidates.map((candidate) => candidate == null ? void 0 : candidate.field).filter((field) => (0, import_service_helpers.getFieldType)(field) === "belongsTo").map((field) => {
|
|
199
|
+
var _a;
|
|
200
|
+
return String((field == null ? void 0 : field.foreignKey) || ((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.foreignKey) || "").trim();
|
|
201
|
+
}).filter(Boolean)
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
function isFlowSurfaceDefaultActionPopupAssociationForeignKeyField(field, associationForeignKeys) {
|
|
205
|
+
const fieldName = String((0, import_service_helpers.getFieldName)(field) || "").trim();
|
|
206
|
+
return !!fieldName && associationForeignKeys.has(fieldName);
|
|
207
|
+
}
|
|
208
|
+
function pickFlowSurfaceDefaultActionPopupFieldPaths(candidates, options = {}) {
|
|
209
|
+
const associationForeignKeys = collectFlowSurfaceDefaultActionPopupAssociationForeignKeys(candidates);
|
|
210
|
+
const preferredCandidates = candidates.filter(
|
|
211
|
+
(candidate) => !isFlowSurfaceDefaultActionPopupSystemField(candidate.field) && (!options.excludeAuditTimestampFields || !isFlowSurfaceDefaultActionPopupAuditTimestampField(candidate.field)) && !isFlowSurfaceDefaultActionPopupMultiValueAssociationField(candidate.field) && !isFlowSurfaceDefaultActionPopupAssociationForeignKeyField(candidate.field, associationForeignKeys)
|
|
212
|
+
);
|
|
213
|
+
const fallbackCandidates = candidates.filter(
|
|
214
|
+
(candidate) => !isFlowSurfaceDefaultActionPopupTechnicalIdField(candidate.field) && (!options.excludeAuditTimestampFields || !isFlowSurfaceDefaultActionPopupAuditTimestampField(candidate.field)) && !isFlowSurfaceDefaultActionPopupMultiValueAssociationField(candidate.field) && !isFlowSurfaceDefaultActionPopupAssociationForeignKeyField(candidate.field, associationForeignKeys)
|
|
215
|
+
);
|
|
216
|
+
const baseCandidates = preferredCandidates.length ? preferredCandidates : fallbackCandidates;
|
|
217
|
+
return baseCandidates.map((candidate) => String((candidate == null ? void 0 : candidate.fieldPath) || "").trim()).filter(Boolean);
|
|
218
|
+
}
|
|
219
|
+
function buildFlowSurfaceDefaultActionPopupBlocks(use, fieldPaths) {
|
|
220
|
+
const actionConfig = getFlowSurfaceDefaultActionPopupConfigByUse(use);
|
|
221
|
+
if (!actionConfig) {
|
|
222
|
+
return [];
|
|
223
|
+
}
|
|
224
|
+
return [
|
|
225
|
+
import_lodash.default.pickBy(
|
|
226
|
+
{
|
|
227
|
+
key: actionConfig.blockKey,
|
|
228
|
+
type: actionConfig.blockType,
|
|
229
|
+
resource: {
|
|
230
|
+
binding: actionConfig.resourceBinding
|
|
231
|
+
},
|
|
232
|
+
settings: import_lodash.default.cloneDeep(actionConfig.blockSettings),
|
|
233
|
+
fields: fieldPaths,
|
|
234
|
+
actions: actionConfig.submitAction ? [import_lodash.default.cloneDeep(actionConfig.submitAction)] : void 0
|
|
235
|
+
},
|
|
236
|
+
(value) => !import_lodash.default.isUndefined(value)
|
|
237
|
+
)
|
|
238
|
+
];
|
|
239
|
+
}
|
|
240
|
+
function hasFlowSurfaceInlinePopupTemplate(popup) {
|
|
241
|
+
return typeof popup !== "undefined" && typeof (popup == null ? void 0 : popup.template) !== "undefined";
|
|
242
|
+
}
|
|
243
|
+
function hasFlowSurfaceInlinePopupBlocks(popup) {
|
|
244
|
+
return Array.isArray(popup == null ? void 0 : popup.blocks) && popup.blocks.length > 0;
|
|
245
|
+
}
|
|
246
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
247
|
+
0 && (module.exports = {
|
|
248
|
+
FLOW_SURFACE_DEFAULT_ACTION_POPUP_TYPES,
|
|
249
|
+
FLOW_SURFACE_DEFAULT_ACTION_POPUP_USES,
|
|
250
|
+
buildFlowSurfaceDefaultActionPopupBlocks,
|
|
251
|
+
getFlowSurfaceDefaultActionPopupConfigByUse,
|
|
252
|
+
hasFlowSurfaceInlinePopupBlocks,
|
|
253
|
+
hasFlowSurfaceInlinePopupTemplate,
|
|
254
|
+
isFlowSurfaceDefaultActionPopupType,
|
|
255
|
+
isFlowSurfaceDefaultActionPopupUse,
|
|
256
|
+
pickFlowSurfaceDefaultActionPopupFieldPaths,
|
|
257
|
+
resolveFlowSurfaceDefaultActionPopupTabTitle
|
|
258
|
+
});
|
|
@@ -11,3 +11,13 @@ export declare function executeMutateOps(ops: FlowSurfaceMutateOp[], ctx: FlowSu
|
|
|
11
11
|
opId?: string;
|
|
12
12
|
result: any;
|
|
13
13
|
}[]>;
|
|
14
|
+
export declare function resolveFlowSurfaceValueKeys(input: any, keys: Map<string, any>): any;
|
|
15
|
+
export declare function inspectFlowSurfaceValueKey(path: string, keys: Map<string, any>): {
|
|
16
|
+
found: true;
|
|
17
|
+
value: any;
|
|
18
|
+
missingHead?: undefined;
|
|
19
|
+
} | {
|
|
20
|
+
found: false;
|
|
21
|
+
missingHead: string;
|
|
22
|
+
value?: undefined;
|
|
23
|
+
};
|
|
@@ -36,62 +36,97 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
36
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
37
|
var executor_exports = {};
|
|
38
38
|
__export(executor_exports, {
|
|
39
|
-
executeMutateOps: () => executeMutateOps
|
|
39
|
+
executeMutateOps: () => executeMutateOps,
|
|
40
|
+
inspectFlowSurfaceValueKey: () => inspectFlowSurfaceValueKey,
|
|
41
|
+
resolveFlowSurfaceValueKeys: () => resolveFlowSurfaceValueKeys
|
|
40
42
|
});
|
|
41
43
|
module.exports = __toCommonJS(executor_exports);
|
|
42
44
|
var import_lodash = __toESM(require("lodash"));
|
|
43
45
|
var import_errors = require("./errors");
|
|
46
|
+
var import_reference_guards = require("./reference-guards");
|
|
47
|
+
var import_created_keys = require("./planning/created-keys");
|
|
44
48
|
async function executeMutateOps(ops, ctx, dispatcher) {
|
|
45
49
|
const results = [];
|
|
46
50
|
for (const op of ops) {
|
|
47
|
-
const resolvedValues =
|
|
51
|
+
const resolvedValues = resolveFlowSurfaceValueKeys(
|
|
48
52
|
import_lodash.default.cloneDeep({
|
|
49
53
|
...op.target ? { target: op.target } : {},
|
|
50
54
|
...op.values || {}
|
|
51
55
|
}),
|
|
52
|
-
ctx.
|
|
56
|
+
ctx.keys
|
|
53
57
|
);
|
|
54
58
|
const result = await dispatcher(op, resolvedValues, ctx);
|
|
55
59
|
if (op.opId) {
|
|
56
|
-
ctx.
|
|
60
|
+
ctx.keys.set(op.opId, result);
|
|
57
61
|
}
|
|
58
62
|
results.push({ opId: op.opId, result });
|
|
59
63
|
}
|
|
60
64
|
return results;
|
|
61
65
|
}
|
|
62
|
-
function
|
|
66
|
+
function resolveFlowSurfaceValueKeys(input, keys) {
|
|
63
67
|
if (Array.isArray(input)) {
|
|
64
|
-
return input.map((item) =>
|
|
68
|
+
return input.map((item) => resolveFlowSurfaceValueKeys(item, keys));
|
|
65
69
|
}
|
|
66
70
|
if (import_lodash.default.isPlainObject(input)) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
(0, import_reference_guards.assertNoFlowSurfaceLegacyRef)(input, {
|
|
72
|
+
actionName: "mutate",
|
|
73
|
+
path: "values",
|
|
74
|
+
dollarRefAllowed: "{ key } or { step, path }",
|
|
75
|
+
refAllowed: "{ key } or { step, path }"
|
|
76
|
+
});
|
|
77
|
+
if ((0, import_reference_guards.isFlowSurfacePlanStepValue)(input)) {
|
|
78
|
+
return readStepResult(input, keys);
|
|
71
79
|
}
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
throw new import_errors.FlowSurfaceBadRequestError(`flowSurfaces mutate ref must be a string`);
|
|
75
|
-
}
|
|
76
|
-
return readRef(input.ref, refs);
|
|
80
|
+
if ((0, import_created_keys.isFlowSurfacePureKeyObject)(input)) {
|
|
81
|
+
return readKey(input.key, keys);
|
|
77
82
|
}
|
|
78
|
-
return Object.fromEntries(
|
|
83
|
+
return Object.fromEntries(
|
|
84
|
+
Object.entries(input).map(([key, value]) => [key, resolveFlowSurfaceValueKeys(value, keys)])
|
|
85
|
+
);
|
|
79
86
|
}
|
|
80
87
|
return input;
|
|
81
88
|
}
|
|
82
|
-
function
|
|
89
|
+
function inspectFlowSurfaceValueKey(path, keys) {
|
|
83
90
|
const trimmedPath = String(path || "").trim();
|
|
84
91
|
if (!trimmedPath) {
|
|
85
|
-
throw new import_errors.FlowSurfaceBadRequestError(`flowSurfaces mutate
|
|
92
|
+
throw new import_errors.FlowSurfaceBadRequestError(`flowSurfaces mutate key cannot be empty`);
|
|
93
|
+
}
|
|
94
|
+
if (keys.has(trimmedPath)) {
|
|
95
|
+
return {
|
|
96
|
+
found: true,
|
|
97
|
+
value: keys.get(trimmedPath)
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
found: false,
|
|
102
|
+
missingHead: trimmedPath
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function readKey(path, keys) {
|
|
106
|
+
const resolved = inspectFlowSurfaceValueKey(path, keys);
|
|
107
|
+
if (!resolved.found) {
|
|
108
|
+
throw new import_errors.FlowSurfaceBadRequestError(`flowSurfaces mutate key '${resolved.missingHead}' not found`);
|
|
109
|
+
}
|
|
110
|
+
return resolved.value;
|
|
111
|
+
}
|
|
112
|
+
function readStepResult(input, keys) {
|
|
113
|
+
const step = String(input.step || "").trim();
|
|
114
|
+
if (!step) {
|
|
115
|
+
throw new import_errors.FlowSurfaceBadRequestError(`flowSurfaces mutate step cannot be empty`);
|
|
116
|
+
}
|
|
117
|
+
if (!keys.has(step)) {
|
|
118
|
+
throw new import_errors.FlowSurfaceBadRequestError(`flowSurfaces mutate step '${step}' not found`);
|
|
86
119
|
}
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
120
|
+
const value = keys.get(step);
|
|
121
|
+
const path = import_lodash.default.isUndefined(input.path) ? void 0 : String(input.path || "").trim();
|
|
122
|
+
if (import_lodash.default.has(input, "path") && !path) {
|
|
123
|
+
throw new import_errors.FlowSurfaceBadRequestError(`flowSurfaces mutate path cannot be empty`);
|
|
90
124
|
}
|
|
91
|
-
|
|
92
|
-
return segments.length ? import_lodash.default.get(value, segments.join(".")) : value;
|
|
125
|
+
return path ? import_lodash.default.get(value, path) : value;
|
|
93
126
|
}
|
|
94
127
|
// Annotate the CommonJS export names for ESM import in node:
|
|
95
128
|
0 && (module.exports = {
|
|
96
|
-
executeMutateOps
|
|
129
|
+
executeMutateOps,
|
|
130
|
+
inspectFlowSurfaceValueKey,
|
|
131
|
+
resolveFlowSurfaceValueKeys
|
|
97
132
|
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export type FlowSurfaceFieldBindingScope = 'display' | 'editable' | 'filter';
|
|
10
|
+
export type FlowSurfaceFieldBindingResolution = {
|
|
11
|
+
modelClassName: string;
|
|
12
|
+
ownerPlugin?: string;
|
|
13
|
+
isDefault: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function getRegisteredFieldUses(scope?: FlowSurfaceFieldBindingScope, enabledPackages?: ReadonlySet<string>): ReadonlySet<string>;
|
|
16
|
+
export declare function resolveRegisteredFieldBinding(input: {
|
|
17
|
+
containerUse?: string;
|
|
18
|
+
field: any;
|
|
19
|
+
dataSourceKey?: string;
|
|
20
|
+
enabledPackages?: ReadonlySet<string>;
|
|
21
|
+
getCollection?: (dataSourceKey: string, collectionName: string) => any;
|
|
22
|
+
useStrictOnly?: boolean;
|
|
23
|
+
}): FlowSurfaceFieldBindingResolution | null;
|