@nocobase/plugin-flow-engine 2.1.0-alpha.20 → 2.1.0-alpha.22
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 -10
- package/dist/node_modules/ses/dist/ses.cjs +1 -1
- package/dist/node_modules/ses/package.json +1 -1
- package/dist/node_modules/zod/index.cjs +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/flow-surfaces/action-scope.d.ts +1 -0
- package/dist/server/flow-surfaces/action-scope.js +4 -0
- package/dist/server/flow-surfaces/apply/compiler.js +1 -1
- package/dist/server/flow-surfaces/approval/builder.js +8 -8
- package/dist/server/flow-surfaces/blueprint/compile-blocks.js +192 -29
- package/dist/server/flow-surfaces/blueprint/defaults.d.ts +26 -0
- package/dist/server/flow-surfaces/blueprint/defaults.js +133 -0
- package/dist/server/flow-surfaces/blueprint/index.d.ts +1 -1
- package/dist/server/flow-surfaces/blueprint/normalize-document.js +121 -1
- package/dist/server/flow-surfaces/blueprint/public-types.d.ts +32 -0
- package/dist/server/flow-surfaces/builder.d.ts +2 -2
- package/dist/server/flow-surfaces/builder.js +148 -50
- package/dist/server/flow-surfaces/catalog.js +276 -34
- package/dist/server/flow-surfaces/compose-compiler.d.ts +2 -0
- package/dist/server/flow-surfaces/compose-compiler.js +5 -1
- package/dist/server/flow-surfaces/configure-options.js +88 -12
- package/dist/server/flow-surfaces/contract-guard.js +60 -69
- package/dist/server/flow-surfaces/default-action-popup.d.ts +11 -1
- package/dist/server/flow-surfaces/default-action-popup.js +72 -12
- package/dist/server/flow-surfaces/default-block-actions.js +8 -1
- package/dist/server/flow-surfaces/filter-group.d.ts +15 -0
- package/dist/server/flow-surfaces/filter-group.js +94 -0
- package/dist/server/flow-surfaces/index.js +70 -2
- package/dist/server/flow-surfaces/node-use-sets.js +6 -1
- package/dist/server/flow-surfaces/placement.js +3 -0
- package/dist/server/flow-surfaces/public-data-surface-default-filter.d.ts +20 -0
- package/dist/server/flow-surfaces/public-data-surface-default-filter.js +111 -0
- package/dist/server/flow-surfaces/reaction/registry.d.ts +7 -0
- package/dist/server/flow-surfaces/reaction/registry.js +7 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +7 -0
- package/dist/server/flow-surfaces/service-utils.js +58 -9
- package/dist/server/flow-surfaces/service.d.ts +73 -3
- package/dist/server/flow-surfaces/service.js +1794 -162
- package/dist/server/flow-surfaces/support-matrix.d.ts +5 -2
- package/dist/server/flow-surfaces/support-matrix.js +16 -3
- package/dist/server/flow-surfaces/surface-context.js +2 -1
- package/dist/server/flow-surfaces/template-display.d.ts +20 -0
- package/dist/server/flow-surfaces/template-display.js +289 -0
- package/dist/server/flow-surfaces/types.d.ts +1 -0
- package/dist/swagger/flow-surfaces.d.ts +160 -0
- package/dist/swagger/flow-surfaces.examples.d.ts +117 -11
- package/dist/swagger/flow-surfaces.examples.js +152 -1
- package/dist/swagger/flow-surfaces.js +141 -21
- package/dist/swagger/index.d.ts +160 -0
- package/package.json +2 -2
|
@@ -0,0 +1,133 @@
|
|
|
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 defaults_exports = {};
|
|
38
|
+
__export(defaults_exports, {
|
|
39
|
+
FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY: () => FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY,
|
|
40
|
+
attachFlowSurfaceApplyBlueprintPopupDefaults: () => attachFlowSurfaceApplyBlueprintPopupDefaults,
|
|
41
|
+
buildFlowSurfaceApplyBlueprintPopupDefaultsMetadata: () => buildFlowSurfaceApplyBlueprintPopupDefaultsMetadata,
|
|
42
|
+
getFlowSurfaceApplyBlueprintDefaultCollection: () => getFlowSurfaceApplyBlueprintDefaultCollection,
|
|
43
|
+
hasFlowSurfaceApplyBlueprintDefaults: () => hasFlowSurfaceApplyBlueprintDefaults,
|
|
44
|
+
readFlowSurfaceApplyBlueprintPopupDefaultsMetadata: () => readFlowSurfaceApplyBlueprintPopupDefaultsMetadata,
|
|
45
|
+
resolveFlowSurfaceApplyBlueprintDefaultPopupMetadata: () => resolveFlowSurfaceApplyBlueprintDefaultPopupMetadata
|
|
46
|
+
});
|
|
47
|
+
module.exports = __toCommonJS(defaults_exports);
|
|
48
|
+
var import_lodash = __toESM(require("lodash"));
|
|
49
|
+
const FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY = "__flowSurfaceApplyBlueprintPopupDefaults";
|
|
50
|
+
function hasFlowSurfaceApplyBlueprintDefaults(defaults) {
|
|
51
|
+
return import_lodash.default.isPlainObject(defaults == null ? void 0 : defaults.collections) && Object.keys((defaults == null ? void 0 : defaults.collections) || {}).length > 0;
|
|
52
|
+
}
|
|
53
|
+
function buildFlowSurfaceApplyBlueprintPopupDefaultsMetadata(defaults) {
|
|
54
|
+
if (!hasFlowSurfaceApplyBlueprintDefaults(defaults)) {
|
|
55
|
+
return void 0;
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
collections: defaults == null ? void 0 : defaults.collections
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function attachFlowSurfaceApplyBlueprintPopupDefaults(popup, metadata) {
|
|
62
|
+
if (!metadata) {
|
|
63
|
+
return popup;
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
...import_lodash.default.isPlainObject(popup) ? import_lodash.default.cloneDeep(popup) : {},
|
|
67
|
+
[FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY]: import_lodash.default.cloneDeep(metadata)
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function readFlowSurfaceApplyBlueprintPopupDefaultsMetadata(value) {
|
|
71
|
+
const metadata = value == null ? void 0 : value[FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY];
|
|
72
|
+
if (!import_lodash.default.isPlainObject(metadata) || !import_lodash.default.isPlainObject(metadata.collections)) {
|
|
73
|
+
return void 0;
|
|
74
|
+
}
|
|
75
|
+
return metadata;
|
|
76
|
+
}
|
|
77
|
+
function getFlowSurfaceApplyBlueprintDefaultCollection(metadata, collectionName) {
|
|
78
|
+
var _a;
|
|
79
|
+
const normalizedCollectionName = String(collectionName || "").trim();
|
|
80
|
+
if (!normalizedCollectionName) {
|
|
81
|
+
return void 0;
|
|
82
|
+
}
|
|
83
|
+
const collectionDefaults = (_a = metadata == null ? void 0 : metadata.collections) == null ? void 0 : _a[normalizedCollectionName];
|
|
84
|
+
return import_lodash.default.isPlainObject(collectionDefaults) ? collectionDefaults : void 0;
|
|
85
|
+
}
|
|
86
|
+
function readPopupMetadata(popupMap, actionType) {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
if (!popupMap || !actionType) {
|
|
89
|
+
return void 0;
|
|
90
|
+
}
|
|
91
|
+
const normalizedName = String(((_a = popupMap[actionType]) == null ? void 0 : _a.name) || "").trim();
|
|
92
|
+
const normalizedDescription = String(((_b = popupMap[actionType]) == null ? void 0 : _b.description) || "").trim();
|
|
93
|
+
if (!normalizedName || !normalizedDescription) {
|
|
94
|
+
return void 0;
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
name: normalizedName,
|
|
98
|
+
description: normalizedDescription
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function resolveFlowSurfaceApplyBlueprintDefaultPopupMetadata(input) {
|
|
102
|
+
var _a;
|
|
103
|
+
const actionType = input.actionType;
|
|
104
|
+
const sourceCollectionDefaults = getFlowSurfaceApplyBlueprintDefaultCollection(
|
|
105
|
+
input.metadata,
|
|
106
|
+
input.sourceCollectionName
|
|
107
|
+
);
|
|
108
|
+
const associationField = String(input.associationField || "").trim();
|
|
109
|
+
if (((_a = sourceCollectionDefaults == null ? void 0 : sourceCollectionDefaults.popups) == null ? void 0 : _a.associations) && associationField) {
|
|
110
|
+
const associationPopupMetadata = readPopupMetadata(
|
|
111
|
+
sourceCollectionDefaults.popups.associations[associationField],
|
|
112
|
+
actionType
|
|
113
|
+
);
|
|
114
|
+
if (associationPopupMetadata) {
|
|
115
|
+
return associationPopupMetadata;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const targetCollectionDefaults = getFlowSurfaceApplyBlueprintDefaultCollection(
|
|
119
|
+
input.metadata,
|
|
120
|
+
input.targetCollectionName
|
|
121
|
+
);
|
|
122
|
+
return readPopupMetadata(targetCollectionDefaults == null ? void 0 : targetCollectionDefaults.popups, actionType);
|
|
123
|
+
}
|
|
124
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
+
0 && (module.exports = {
|
|
126
|
+
FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY,
|
|
127
|
+
attachFlowSurfaceApplyBlueprintPopupDefaults,
|
|
128
|
+
buildFlowSurfaceApplyBlueprintPopupDefaultsMetadata,
|
|
129
|
+
getFlowSurfaceApplyBlueprintDefaultCollection,
|
|
130
|
+
hasFlowSurfaceApplyBlueprintDefaults,
|
|
131
|
+
readFlowSurfaceApplyBlueprintPopupDefaultsMetadata,
|
|
132
|
+
resolveFlowSurfaceApplyBlueprintDefaultPopupMetadata
|
|
133
|
+
});
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
export type { FlowSurfaceApplyBlueprintAssetMap, FlowSurfaceApplyBlueprintAssets, FlowSurfaceApplyBlueprintDocument, FlowSurfaceApplyBlueprintMode, FlowSurfaceApplyBlueprintNavigation, FlowSurfaceApplyBlueprintNavigationGroup, FlowSurfaceApplyBlueprintPage, FlowSurfaceApplyBlueprintProgram, FlowSurfaceApplyBlueprintReaction, FlowSurfaceApplyBlueprintReplaceTargetInfo, FlowSurfaceApplyBlueprintTabDocument, FlowSurfaceApplyBlueprintTarget, } from './public-types';
|
|
9
|
+
export type { FlowSurfaceApplyBlueprintAssetMap, FlowSurfaceApplyBlueprintAssets, FlowSurfaceApplyBlueprintDefaultCollection, FlowSurfaceApplyBlueprintDefaultFieldGroupSpec, FlowSurfaceApplyBlueprintDefaultPopupActionMap, FlowSurfaceApplyBlueprintDefaultPopupName, FlowSurfaceApplyBlueprintDefaultPopups, FlowSurfaceApplyBlueprintDefaults, FlowSurfaceApplyBlueprintDocument, FlowSurfaceApplyBlueprintMode, FlowSurfaceApplyBlueprintNavigation, FlowSurfaceApplyBlueprintNavigationGroup, FlowSurfaceApplyBlueprintPage, FlowSurfaceApplyBlueprintProgram, FlowSurfaceApplyBlueprintReaction, FlowSurfaceApplyBlueprintReplaceTargetInfo, FlowSurfaceApplyBlueprintTabDocument, FlowSurfaceApplyBlueprintTarget, } from './public-types';
|
|
10
10
|
export { prepareFlowSurfaceApplyBlueprintDocument } from './normalize-document';
|
|
11
11
|
export { compileFlowSurfaceApplyBlueprintRequest, resolveApplyBlueprintPageLocator } from './compile-plan';
|
|
12
12
|
export { compileReactionPlanSteps } from './compile-reaction';
|
|
@@ -52,8 +52,14 @@ const APPLY_BLUEPRINT_REACTION_TYPES = [
|
|
|
52
52
|
"setActionLinkageRules"
|
|
53
53
|
];
|
|
54
54
|
const APPLY_BLUEPRINT_REACTION_TYPE_SET = new Set(APPLY_BLUEPRINT_REACTION_TYPES);
|
|
55
|
+
const APPLY_BLUEPRINT_DEFAULT_COLLECTION_ALLOWED_KEYS = ["fieldGroups", "popups"];
|
|
56
|
+
const APPLY_BLUEPRINT_DEFAULT_FIELD_GROUP_ALLOWED_KEYS = ["key", "title", "fields"];
|
|
57
|
+
const APPLY_BLUEPRINT_DEFAULT_POPUPS_ALLOWED_KEYS = ["view", "addNew", "edit", "associations"];
|
|
58
|
+
const APPLY_BLUEPRINT_DEFAULT_POPUP_ACTION_ALLOWED_KEYS = ["name", "description"];
|
|
59
|
+
const APPLY_BLUEPRINT_DEFAULT_POPUP_ASSOCIATION_ALLOWED_KEYS = ["view", "addNew", "edit"];
|
|
60
|
+
const APPLY_BLUEPRINT_DEFAULT_POPUP_ACTIONS = ["view", "addNew", "edit"];
|
|
55
61
|
function assertSupportedApplyBlueprintTopLevelKeys(input) {
|
|
56
|
-
const allowedKeys = ["version", "mode", "target", "navigation", "page", "assets", "tabs", "reaction"];
|
|
62
|
+
const allowedKeys = ["version", "mode", "target", "navigation", "page", "defaults", "assets", "tabs", "reaction"];
|
|
57
63
|
const unsupportedKeys = Object.keys(input).filter((key) => !allowedKeys.includes(key));
|
|
58
64
|
if (!unsupportedKeys.length) {
|
|
59
65
|
return;
|
|
@@ -160,6 +166,118 @@ function normalizeNavigation(input) {
|
|
|
160
166
|
});
|
|
161
167
|
return Object.keys(normalized).length ? normalized : void 0;
|
|
162
168
|
}
|
|
169
|
+
function normalizeDefaultFieldGroups(input, context) {
|
|
170
|
+
if (import_lodash.default.isUndefined(input)) {
|
|
171
|
+
return void 0;
|
|
172
|
+
}
|
|
173
|
+
if (!Array.isArray(input) || !input.length) {
|
|
174
|
+
(0, import_errors.throwBadRequest)(`${context} must be a non-empty array`);
|
|
175
|
+
}
|
|
176
|
+
return input.map((group, groupIndex) => {
|
|
177
|
+
const groupContext = `${context}[${groupIndex}]`;
|
|
178
|
+
(0, import_private_utils.assertPlainObject)(group, groupContext);
|
|
179
|
+
(0, import_private_utils.assertOnlyAllowedKeys)(group, groupContext, APPLY_BLUEPRINT_DEFAULT_FIELD_GROUP_ALLOWED_KEYS);
|
|
180
|
+
if (!Array.isArray(group.fields) || !group.fields.length) {
|
|
181
|
+
(0, import_errors.throwBadRequest)(`${groupContext}.fields must be a non-empty array`);
|
|
182
|
+
}
|
|
183
|
+
return (0, import_service_utils.buildDefinedPayload)({
|
|
184
|
+
key: (0, import_private_utils.readOptionalString)(group.key),
|
|
185
|
+
title: (0, import_private_utils.assertNonEmptyString)(group.title, `${groupContext}.title`),
|
|
186
|
+
fields: group.fields.map(
|
|
187
|
+
(field, fieldIndex) => (0, import_private_utils.assertNonEmptyString)(field, `${groupContext}.fields[${fieldIndex}]`)
|
|
188
|
+
)
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function normalizeDefaultPopupName(input, context) {
|
|
193
|
+
if (import_lodash.default.isUndefined(input)) {
|
|
194
|
+
return void 0;
|
|
195
|
+
}
|
|
196
|
+
(0, import_private_utils.assertPlainObject)(input, context);
|
|
197
|
+
(0, import_private_utils.assertOnlyAllowedKeys)(input, context, APPLY_BLUEPRINT_DEFAULT_POPUP_ACTION_ALLOWED_KEYS);
|
|
198
|
+
return {
|
|
199
|
+
name: (0, import_private_utils.assertNonEmptyString)(input.name, `${context}.name`),
|
|
200
|
+
description: (0, import_private_utils.assertNonEmptyString)(input.description, `${context}.description`)
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function normalizeDefaultPopupActionMap(input, context, allowedKeys) {
|
|
204
|
+
if (import_lodash.default.isUndefined(input)) {
|
|
205
|
+
return void 0;
|
|
206
|
+
}
|
|
207
|
+
(0, import_private_utils.assertPlainObject)(input, context);
|
|
208
|
+
(0, import_private_utils.assertOnlyAllowedKeys)(input, context, [...allowedKeys]);
|
|
209
|
+
const normalized = (0, import_service_utils.buildDefinedPayload)(
|
|
210
|
+
Object.fromEntries(
|
|
211
|
+
APPLY_BLUEPRINT_DEFAULT_POPUP_ACTIONS.map((action) => [
|
|
212
|
+
action,
|
|
213
|
+
normalizeDefaultPopupName(input[action], `${context}.${action}`)
|
|
214
|
+
])
|
|
215
|
+
)
|
|
216
|
+
);
|
|
217
|
+
return Object.keys(normalized).length ? normalized : void 0;
|
|
218
|
+
}
|
|
219
|
+
function normalizeDefaultPopups(input, context) {
|
|
220
|
+
if (import_lodash.default.isUndefined(input)) {
|
|
221
|
+
return void 0;
|
|
222
|
+
}
|
|
223
|
+
const actionMap = normalizeDefaultPopupActionMap(input, context, APPLY_BLUEPRINT_DEFAULT_POPUPS_ALLOWED_KEYS);
|
|
224
|
+
const associationsInput = input.associations;
|
|
225
|
+
const associations = import_lodash.default.isUndefined(associationsInput) ? void 0 : (() => {
|
|
226
|
+
(0, import_private_utils.assertPlainObject)(associationsInput, `${context}.associations`);
|
|
227
|
+
return Object.fromEntries(
|
|
228
|
+
Object.entries(associationsInput).flatMap(([field, value]) => {
|
|
229
|
+
const associationField = (0, import_private_utils.assertNonEmptyString)(field, `${context}.associations key`);
|
|
230
|
+
const normalizedValue = normalizeDefaultPopupActionMap(
|
|
231
|
+
value,
|
|
232
|
+
`${context}.associations.${associationField}`,
|
|
233
|
+
APPLY_BLUEPRINT_DEFAULT_POPUP_ASSOCIATION_ALLOWED_KEYS
|
|
234
|
+
);
|
|
235
|
+
return normalizedValue ? [[associationField, normalizedValue]] : [];
|
|
236
|
+
})
|
|
237
|
+
);
|
|
238
|
+
})();
|
|
239
|
+
const normalized = (0, import_service_utils.buildDefinedPayload)({
|
|
240
|
+
...actionMap,
|
|
241
|
+
associations: associations && Object.keys(associations).length ? associations : void 0
|
|
242
|
+
});
|
|
243
|
+
return Object.keys(normalized).length ? normalized : void 0;
|
|
244
|
+
}
|
|
245
|
+
function normalizeDefaultCollection(input, context) {
|
|
246
|
+
(0, import_private_utils.assertPlainObject)(input, context);
|
|
247
|
+
(0, import_private_utils.assertOnlyAllowedKeys)(input, context, APPLY_BLUEPRINT_DEFAULT_COLLECTION_ALLOWED_KEYS);
|
|
248
|
+
return (0, import_service_utils.buildDefinedPayload)({
|
|
249
|
+
fieldGroups: normalizeDefaultFieldGroups(input.fieldGroups, `${context}.fieldGroups`),
|
|
250
|
+
popups: normalizeDefaultPopups(input.popups, `${context}.popups`)
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
function normalizeDefaults(input) {
|
|
254
|
+
if (import_lodash.default.isUndefined(input)) {
|
|
255
|
+
return void 0;
|
|
256
|
+
}
|
|
257
|
+
(0, import_private_utils.assertPlainObject)(input, "flowSurfaces applyBlueprint defaults");
|
|
258
|
+
(0, import_private_utils.assertOnlyAllowedKeys)(input, "flowSurfaces applyBlueprint defaults", ["collections"]);
|
|
259
|
+
if (import_lodash.default.isUndefined(input.collections)) {
|
|
260
|
+
return {};
|
|
261
|
+
}
|
|
262
|
+
(0, import_private_utils.assertPlainObject)(input.collections, "flowSurfaces applyBlueprint defaults.collections");
|
|
263
|
+
return {
|
|
264
|
+
collections: Object.fromEntries(
|
|
265
|
+
Object.entries(input.collections).map(([collectionName, collectionDefaults]) => {
|
|
266
|
+
const normalizedCollectionName = (0, import_private_utils.assertNonEmptyString)(
|
|
267
|
+
collectionName,
|
|
268
|
+
"flowSurfaces applyBlueprint defaults.collections key"
|
|
269
|
+
);
|
|
270
|
+
return [
|
|
271
|
+
normalizedCollectionName,
|
|
272
|
+
normalizeDefaultCollection(
|
|
273
|
+
collectionDefaults,
|
|
274
|
+
`flowSurfaces applyBlueprint defaults.collections.${normalizedCollectionName}`
|
|
275
|
+
)
|
|
276
|
+
];
|
|
277
|
+
})
|
|
278
|
+
)
|
|
279
|
+
};
|
|
280
|
+
}
|
|
163
281
|
function normalizeTabs(input) {
|
|
164
282
|
const seenTabKeys = /* @__PURE__ */ new Set();
|
|
165
283
|
return input.map((tab, index) => {
|
|
@@ -251,6 +369,7 @@ function prepareFlowSurfaceApplyBlueprintDocument(input) {
|
|
|
251
369
|
}
|
|
252
370
|
const page = normalizePage(input.page);
|
|
253
371
|
const navigation = normalizeNavigation(input.navigation);
|
|
372
|
+
const defaults = normalizeDefaults(input.defaults);
|
|
254
373
|
if (mode === "create" && !import_lodash.default.isUndefined(input.target)) {
|
|
255
374
|
(0, import_errors.throwBadRequest)(`flowSurfaces applyBlueprint create mode does not accept target`);
|
|
256
375
|
}
|
|
@@ -285,6 +404,7 @@ function prepareFlowSurfaceApplyBlueprintDocument(input) {
|
|
|
285
404
|
...target ? { target } : {},
|
|
286
405
|
...navigation ? { navigation } : {},
|
|
287
406
|
...page ? { page } : {},
|
|
407
|
+
...defaults ? { defaults } : {},
|
|
288
408
|
tabs,
|
|
289
409
|
assets,
|
|
290
410
|
...reaction ? { reaction } : {}
|
|
@@ -93,6 +93,35 @@ export type FlowSurfaceApplyBlueprintFieldObjectSpec = {
|
|
|
93
93
|
chart?: string;
|
|
94
94
|
};
|
|
95
95
|
export type FlowSurfaceApplyBlueprintFieldSpec = string | FlowSurfaceApplyBlueprintFieldObjectSpec;
|
|
96
|
+
export type FlowSurfaceApplyBlueprintFieldGroupSpec = {
|
|
97
|
+
key?: string;
|
|
98
|
+
title: string;
|
|
99
|
+
fields: FlowSurfaceApplyBlueprintFieldSpec[];
|
|
100
|
+
};
|
|
101
|
+
export type FlowSurfaceApplyBlueprintDefaultFieldGroupSpec = {
|
|
102
|
+
key?: string;
|
|
103
|
+
title: string;
|
|
104
|
+
fields: string[];
|
|
105
|
+
};
|
|
106
|
+
export type FlowSurfaceApplyBlueprintDefaultPopupName = {
|
|
107
|
+
name: string;
|
|
108
|
+
description: string;
|
|
109
|
+
};
|
|
110
|
+
export type FlowSurfaceApplyBlueprintDefaultPopupActionMap = {
|
|
111
|
+
view?: FlowSurfaceApplyBlueprintDefaultPopupName;
|
|
112
|
+
addNew?: FlowSurfaceApplyBlueprintDefaultPopupName;
|
|
113
|
+
edit?: FlowSurfaceApplyBlueprintDefaultPopupName;
|
|
114
|
+
};
|
|
115
|
+
export type FlowSurfaceApplyBlueprintDefaultPopups = FlowSurfaceApplyBlueprintDefaultPopupActionMap & {
|
|
116
|
+
associations?: Record<string, FlowSurfaceApplyBlueprintDefaultPopupActionMap>;
|
|
117
|
+
};
|
|
118
|
+
export type FlowSurfaceApplyBlueprintDefaultCollection = {
|
|
119
|
+
fieldGroups?: FlowSurfaceApplyBlueprintDefaultFieldGroupSpec[];
|
|
120
|
+
popups?: FlowSurfaceApplyBlueprintDefaultPopups;
|
|
121
|
+
};
|
|
122
|
+
export type FlowSurfaceApplyBlueprintDefaults = {
|
|
123
|
+
collections?: Record<string, FlowSurfaceApplyBlueprintDefaultCollection>;
|
|
124
|
+
};
|
|
96
125
|
export type FlowSurfaceApplyBlueprintActionObjectSpec = {
|
|
97
126
|
key?: string;
|
|
98
127
|
type: string;
|
|
@@ -117,7 +146,9 @@ export type FlowSurfaceApplyBlueprintBlockSpec = {
|
|
|
117
146
|
template?: Record<string, any>;
|
|
118
147
|
settings?: Record<string, any>;
|
|
119
148
|
fields?: FlowSurfaceApplyBlueprintFieldSpec[];
|
|
149
|
+
fieldGroups?: FlowSurfaceApplyBlueprintFieldGroupSpec[];
|
|
120
150
|
fieldsLayout?: FlowSurfaceApplyBlueprintLayout;
|
|
151
|
+
defaultFilter?: Record<string, any>;
|
|
121
152
|
actions?: FlowSurfaceApplyBlueprintActionSpec[];
|
|
122
153
|
recordActions?: FlowSurfaceApplyBlueprintActionSpec[];
|
|
123
154
|
script?: string;
|
|
@@ -140,6 +171,7 @@ export type FlowSurfaceApplyBlueprintDocument = {
|
|
|
140
171
|
target?: FlowSurfaceApplyBlueprintTarget;
|
|
141
172
|
navigation?: FlowSurfaceApplyBlueprintNavigation;
|
|
142
173
|
page?: FlowSurfaceApplyBlueprintPage;
|
|
174
|
+
defaults?: FlowSurfaceApplyBlueprintDefaults;
|
|
143
175
|
tabs: FlowSurfaceApplyBlueprintTabDocument[];
|
|
144
176
|
assets: FlowSurfaceApplyBlueprintAssets;
|
|
145
177
|
reaction?: FlowSurfaceApplyBlueprintReaction;
|
|
@@ -158,14 +158,14 @@ export declare function buildFieldTree(params: BuildFieldParams): {
|
|
|
158
158
|
};
|
|
159
159
|
};
|
|
160
160
|
export declare function buildStandaloneFieldNode(options: {
|
|
161
|
-
use: 'JSColumnModel' | 'JSItemModel';
|
|
161
|
+
use: 'JSColumnModel' | 'JSItemModel' | 'DividerItemModel';
|
|
162
162
|
uid?: string;
|
|
163
163
|
props?: Record<string, any>;
|
|
164
164
|
decoratorProps?: Record<string, any>;
|
|
165
165
|
stepParams?: Record<string, any>;
|
|
166
166
|
}): {
|
|
167
167
|
uid: string;
|
|
168
|
-
use: "JSColumnModel" | "JSItemModel";
|
|
168
|
+
use: "JSColumnModel" | "JSItemModel" | "DividerItemModel";
|
|
169
169
|
props: Record<string, any>;
|
|
170
170
|
decoratorProps: Record<string, any>;
|
|
171
171
|
stepParams: Record<string, any>;
|