@nocobase/plugin-flow-engine 2.1.0-beta.2 → 2.1.0-beta.20
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/LICENSE +201 -661
- package/README.md +79 -9
- package/dist/ai/ai-employees/nathan/index.d.ts +10 -0
- package/dist/ai/ai-employees/nathan/index.js +41 -0
- package/dist/ai/ai-employees/nathan/prompt.md +132 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +69 -0
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.js +2 -2
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.js +2 -2
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.js +2 -2
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.js +2 -2
- package/dist/ai/docs/runjs/context/block-model.md +35 -35
- package/dist/ai/docs/runjs/context/collection-field.md +53 -51
- package/dist/ai/docs/runjs/context/collection.md +39 -39
- package/dist/ai/docs/runjs/context/data-source-manager.md +40 -30
- package/dist/ai/docs/runjs/context/data-source.md +52 -44
- package/dist/ai/docs/runjs/context/element.md +44 -38
- package/dist/ai/docs/runjs/context/exit-all.md +37 -35
- package/dist/ai/docs/runjs/context/exit.md +38 -35
- package/dist/ai/docs/runjs/context/filter-manager.md +36 -30
- package/dist/ai/docs/runjs/context/form.md +57 -57
- package/dist/ai/docs/runjs/context/get-model.md +22 -21
- package/dist/ai/docs/runjs/context/get-value.md +20 -19
- package/dist/ai/docs/runjs/context/get-var.md +61 -55
- package/dist/ai/docs/runjs/context/i18n.md +17 -14
- package/dist/ai/docs/runjs/context/import-async.md +333 -45
- package/dist/ai/docs/runjs/context/init-resource.md +20 -20
- package/dist/ai/docs/runjs/context/libs.md +31 -31
- package/dist/ai/docs/runjs/context/location.md +34 -31
- package/dist/ai/docs/runjs/context/logger.md +41 -40
- package/dist/ai/docs/runjs/context/make-resource.md +27 -26
- package/dist/ai/docs/runjs/context/message.md +42 -41
- package/dist/ai/docs/runjs/context/modal.md +44 -44
- package/dist/ai/docs/runjs/context/model.md +36 -33
- package/dist/ai/docs/runjs/context/notification.md +41 -40
- package/dist/ai/docs/runjs/context/off.md +14 -14
- package/dist/ai/docs/runjs/context/on.md +30 -29
- package/dist/ai/docs/runjs/context/open-view.md +40 -40
- package/dist/ai/docs/runjs/context/render.md +37 -32
- package/dist/ai/docs/runjs/context/request.md +46 -45
- package/dist/ai/docs/runjs/context/require-async.md +28 -25
- package/dist/ai/docs/runjs/context/resource.md +34 -34
- package/dist/ai/docs/runjs/context/route.md +36 -34
- package/dist/ai/docs/runjs/context/router.md +43 -31
- package/dist/ai/docs/runjs/context/set-value.md +18 -17
- package/dist/ai/docs/runjs/context/sql.md +7 -15
- package/dist/ai/docs/runjs/context/t.md +20 -17
- package/dist/ai/docs/runjs/context/view.md +49 -46
- package/dist/ai/docs/runjs/document.md +1 -0
- package/dist/ai/docs/runjs/import-modules.md +32 -32
- package/dist/ai/docs/runjs/index.md +13 -13
- package/dist/ai/docs/runjs/jsx.md +19 -19
- package/dist/ai/docs/runjs/model/form-block-model.md +1 -3
- package/dist/ai/docs/runjs/render.md +15 -15
- package/dist/ai/docs/runjs/resource/api-resource.md +53 -53
- package/dist/ai/docs/runjs/resource/multi-record-resource.md +64 -64
- package/dist/ai/docs/runjs/resource/single-record-resource.md +55 -55
- package/dist/ai/docs/runjs/resource/sql-resource.md +57 -57
- package/dist/ai/docs/runjs/window.md +5 -5
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +12 -11
- package/dist/locale/en-US.json +1 -0
- package/dist/locale/index.d.ts +2 -0
- package/dist/locale/zh-CN.json +1 -0
- package/dist/node_modules/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/collections/flowsql.js +1 -0
- package/dist/server/flow-surfaces/action-scope.d.ts +39 -0
- package/dist/server/flow-surfaces/action-scope.js +156 -0
- package/dist/server/flow-surfaces/apply/compiler.d.ts +13 -0
- package/dist/server/flow-surfaces/apply/compiler.js +969 -0
- 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/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 +187 -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/association-title-field.d.ts +20 -0
- package/dist/server/flow-surfaces/association-title-field.js +192 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +14 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.js +1029 -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/defaults.d.ts +26 -0
- package/dist/server/flow-surfaces/blueprint/defaults.js +133 -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 +416 -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 +193 -0
- package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
- package/dist/server/flow-surfaces/builder.d.ts +211 -0
- package/dist/server/flow-surfaces/builder.js +1097 -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 +78 -0
- package/dist/server/flow-surfaces/catalog.js +3577 -0
- package/dist/server/flow-surfaces/chart-config.d.ts +121 -0
- package/dist/server/flow-surfaces/chart-config.js +1394 -0
- package/dist/server/flow-surfaces/compose-compiler.d.ts +108 -0
- package/dist/server/flow-surfaces/compose-compiler.js +167 -0
- package/dist/server/flow-surfaces/compose-runtime.d.ts +93 -0
- package/dist/server/flow-surfaces/compose-runtime.js +375 -0
- package/dist/server/flow-surfaces/configure-options.d.ts +23 -0
- package/dist/server/flow-surfaces/configure-options.js +860 -0
- package/dist/server/flow-surfaces/constants.d.ts +351 -0
- package/dist/server/flow-surfaces/constants.js +104 -0
- package/dist/server/flow-surfaces/context.d.ts +72 -0
- package/dist/server/flow-surfaces/context.js +556 -0
- package/dist/server/flow-surfaces/contract-guard.d.ts +19 -0
- package/dist/server/flow-surfaces/contract-guard.js +402 -0
- package/dist/server/flow-surfaces/core-field-default-bindings.d.ts +12 -0
- package/dist/server/flow-surfaces/core-field-default-bindings.js +157 -0
- package/dist/server/flow-surfaces/default-action-popup.d.ts +63 -0
- package/dist/server/flow-surfaces/default-action-popup.js +322 -0
- package/dist/server/flow-surfaces/default-block-actions.d.ts +32 -0
- package/dist/server/flow-surfaces/default-block-actions.js +209 -0
- package/dist/server/flow-surfaces/errors.d.ts +47 -0
- package/dist/server/flow-surfaces/errors.js +145 -0
- package/dist/server/flow-surfaces/executor.d.ts +23 -0
- package/dist/server/flow-surfaces/executor.js +132 -0
- 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 +15 -0
- package/dist/server/flow-surfaces/field-semantics.js +83 -0
- 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.d.ts +11 -0
- package/dist/server/flow-surfaces/index.js +302 -0
- package/dist/server/flow-surfaces/locator.d.ts +28 -0
- package/dist/server/flow-surfaces/locator.js +240 -0
- package/dist/server/flow-surfaces/node-use-sets.d.ts +15 -0
- package/dist/server/flow-surfaces/node-use-sets.js +134 -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.d.ts +33 -0
- package/dist/server/flow-surfaces/placement.js +198 -0
- 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 +88 -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/public-data-surface-default-filter.d.ts +24 -0
- package/dist/server/flow-surfaces/public-data-surface-default-filter.js +152 -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 +156 -0
- package/dist/server/flow-surfaces/reaction/registry.js +206 -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/route-sync.d.ts +47 -0
- package/dist/server/flow-surfaces/route-sync.js +392 -0
- package/dist/server/flow-surfaces/service-helpers.d.ts +42 -0
- package/dist/server/flow-surfaces/service-helpers.js +310 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +108 -0
- package/dist/server/flow-surfaces/service-utils.js +811 -0
- package/dist/server/flow-surfaces/service.d.ts +814 -0
- package/dist/server/flow-surfaces/service.js +14276 -0
- package/dist/server/flow-surfaces/support-matrix.d.ts +31 -0
- package/dist/server/flow-surfaces/support-matrix.js +271 -0
- package/dist/server/flow-surfaces/surface-context.d.ts +52 -0
- package/dist/server/flow-surfaces/surface-context.js +440 -0
- 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-display.d.ts +20 -0
- package/dist/server/flow-surfaces/template-display.js +289 -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 +288 -0
- package/dist/server/flow-surfaces/types.js +24 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +7 -2
- package/dist/server/plugin.d.ts +0 -1
- package/dist/server/plugin.js +9 -34
- package/dist/server/repository.js +0 -5
- package/dist/server/variables/resolve.d.ts +21 -0
- package/dist/server/variables/resolve.js +79 -0
- package/dist/swagger/flow-surfaces.d.ts +5964 -0
- package/dist/swagger/flow-surfaces.examples.d.ts +1572 -0
- package/dist/swagger/flow-surfaces.examples.js +1805 -0
- package/dist/swagger/flow-surfaces.js +5322 -0
- 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 +5969 -0
- package/dist/swagger/index.js +50 -0
- package/package.json +3 -3
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.d.ts +0 -0
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.d.ts +0 -0
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.d.ts +0 -0
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.d.ts +0 -0
|
@@ -0,0 +1,440 @@
|
|
|
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 surface_context_exports = {};
|
|
38
|
+
__export(surface_context_exports, {
|
|
39
|
+
FlowSurfaceContextResolver: () => FlowSurfaceContextResolver
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(surface_context_exports);
|
|
42
|
+
var import_lodash = __toESM(require("lodash"));
|
|
43
|
+
var import_catalog = require("./catalog");
|
|
44
|
+
var import_chart_config = require("./chart-config");
|
|
45
|
+
var import_errors = require("./errors");
|
|
46
|
+
var import_approval = require("./approval");
|
|
47
|
+
var import_placement = require("./placement");
|
|
48
|
+
const FILTER_TARGET_BLOCK_USES = /* @__PURE__ */ new Set([
|
|
49
|
+
"TableBlockModel",
|
|
50
|
+
"CalendarBlockModel",
|
|
51
|
+
"KanbanBlockModel",
|
|
52
|
+
"DetailsBlockModel",
|
|
53
|
+
"ListBlockModel",
|
|
54
|
+
"GridCardBlockModel",
|
|
55
|
+
"ChartBlockModel",
|
|
56
|
+
"MapBlockModel",
|
|
57
|
+
"CommentsBlockModel"
|
|
58
|
+
]);
|
|
59
|
+
const DETAILS_CARD_BLOCK_USES = /* @__PURE__ */ new Set(["ListBlockModel", "GridCardBlockModel", "KanbanBlockModel"]);
|
|
60
|
+
const DETAILS_CARD_ITEM_USES = /* @__PURE__ */ new Set(["ListItemModel", "GridCardItemModel", "KanbanCardItemModel"]);
|
|
61
|
+
const RECORD_ACTION_ITEM_USES = /* @__PURE__ */ new Set(["ListItemModel", "GridCardItemModel"]);
|
|
62
|
+
const BLOCK_ACTION_CONTAINER_USES = /* @__PURE__ */ new Set(["ListBlockModel", "GridCardBlockModel", "KanbanBlockModel"]);
|
|
63
|
+
function getDefaultGridUse(ownerUse, fallbackUse) {
|
|
64
|
+
return (0, import_approval.getApprovalDefaultGridUse)(ownerUse) || fallbackUse;
|
|
65
|
+
}
|
|
66
|
+
function getFieldWrapperUse(containerUse, fallbackUse) {
|
|
67
|
+
return (0, import_approval.getApprovalFieldWrapperUse)(containerUse) || fallbackUse;
|
|
68
|
+
}
|
|
69
|
+
class FlowSurfaceContextResolver {
|
|
70
|
+
constructor(repository, locator, options) {
|
|
71
|
+
this.repository = repository;
|
|
72
|
+
this.locator = locator;
|
|
73
|
+
this.options = options;
|
|
74
|
+
}
|
|
75
|
+
resolveBlockCatalogContainerUse(targetNode, resolved) {
|
|
76
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
77
|
+
if (!targetNode && !resolved) {
|
|
78
|
+
return void 0;
|
|
79
|
+
}
|
|
80
|
+
if ((_b = (_a = targetNode == null ? void 0 : targetNode.use) == null ? void 0 : _a.endsWith) == null ? void 0 : _b.call(_a, "GridModel")) {
|
|
81
|
+
return targetNode.use;
|
|
82
|
+
}
|
|
83
|
+
if ((_d = (_c = targetNode == null ? void 0 : targetNode.subModels) == null ? void 0 : _c.grid) == null ? void 0 : _d.use) {
|
|
84
|
+
return targetNode.subModels.grid.use;
|
|
85
|
+
}
|
|
86
|
+
const firstTab = import_lodash.default.castArray(((_e = targetNode == null ? void 0 : targetNode.subModels) == null ? void 0 : _e.tabs) || [])[0];
|
|
87
|
+
if ((_g = (_f = firstTab == null ? void 0 : firstTab.subModels) == null ? void 0 : _f.grid) == null ? void 0 : _g.use) {
|
|
88
|
+
return firstTab.subModels.grid.use;
|
|
89
|
+
}
|
|
90
|
+
const directDefaultGridUse = (0, import_approval.getApprovalDefaultGridUse)(targetNode == null ? void 0 : targetNode.use);
|
|
91
|
+
if (directDefaultGridUse) {
|
|
92
|
+
return directDefaultGridUse;
|
|
93
|
+
}
|
|
94
|
+
const firstTabDefaultGridUse = (0, import_approval.getApprovalDefaultGridUse)(firstTab == null ? void 0 : firstTab.use);
|
|
95
|
+
if (firstTabDefaultGridUse) {
|
|
96
|
+
return firstTabDefaultGridUse;
|
|
97
|
+
}
|
|
98
|
+
return void 0;
|
|
99
|
+
}
|
|
100
|
+
filterBlocksByTarget(targetNode, resolved) {
|
|
101
|
+
const containerUse = this.resolveBlockCatalogContainerUse(targetNode, resolved);
|
|
102
|
+
const blocks = (0, import_catalog.getAvailableBlockCatalogItems)(containerUse);
|
|
103
|
+
if (!targetNode && !resolved) {
|
|
104
|
+
return blocks;
|
|
105
|
+
}
|
|
106
|
+
if ((0, import_placement.canCatalogAddBlock)({ node: targetNode, resolved })) {
|
|
107
|
+
return blocks;
|
|
108
|
+
}
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
async resolveFilterFormTarget(filterFormOwnerUid, targetBlockUid, transaction) {
|
|
112
|
+
const targets = await this.collectFilterFormTargets(filterFormOwnerUid, transaction);
|
|
113
|
+
if (!targets.length) {
|
|
114
|
+
(0, import_errors.throwBadRequest)("flowSurfaces addField cannot find filter targets on the current surface");
|
|
115
|
+
}
|
|
116
|
+
if (targetBlockUid) {
|
|
117
|
+
const matched = targets.find((item) => item.ownerUid === targetBlockUid);
|
|
118
|
+
if (!matched) {
|
|
119
|
+
(0, import_errors.throwBadRequest)(
|
|
120
|
+
`flowSurfaces addField filter target '${targetBlockUid}' is not available on the current surface`
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
return matched;
|
|
124
|
+
}
|
|
125
|
+
if (targets.length > 1) {
|
|
126
|
+
(0, import_errors.throwBadRequest)(
|
|
127
|
+
"flowSurfaces addField on filter-form requires defaultTargetUid when multiple target blocks are available"
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
return targets[0];
|
|
131
|
+
}
|
|
132
|
+
async collectFilterFormTargets(uid, transaction) {
|
|
133
|
+
var _a;
|
|
134
|
+
const blockGrid = await this.findOwningBlockGrid(uid, transaction);
|
|
135
|
+
if (!(blockGrid == null ? void 0 : blockGrid.uid)) {
|
|
136
|
+
return [];
|
|
137
|
+
}
|
|
138
|
+
return import_lodash.default.castArray(((_a = blockGrid.subModels) == null ? void 0 : _a.items) || []).filter((item) => FILTER_TARGET_BLOCK_USES.has(item == null ? void 0 : item.use) && (item == null ? void 0 : item.uid)).map((item) => {
|
|
139
|
+
var _a2, _b;
|
|
140
|
+
const resourceInit = import_lodash.default.get(item, ["stepParams", "resourceSettings", "init"]) || ((item == null ? void 0 : item.use) === "ChartBlockModel" ? (0, import_chart_config.getChartBuilderResourceInit)(import_lodash.default.get(item, ["stepParams", "chartSettings", "configure"])) : null);
|
|
141
|
+
if (!(resourceInit == null ? void 0 : resourceInit.dataSourceKey) || !(resourceInit == null ? void 0 : resourceInit.collectionName)) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
const collection = this.options.getCollection(resourceInit.dataSourceKey, resourceInit.collectionName);
|
|
145
|
+
return {
|
|
146
|
+
ownerUid: item.uid,
|
|
147
|
+
label: import_lodash.default.get(item, ["stepParams", "cardSettings", "titleDescription", "title"]) || ((_a2 = item == null ? void 0 : item.decoratorProps) == null ? void 0 : _a2.title) || ((_b = item == null ? void 0 : item.props) == null ? void 0 : _b.title) || (collection == null ? void 0 : collection.title) || (collection == null ? void 0 : collection.name) || item.uid,
|
|
148
|
+
resourceInit
|
|
149
|
+
};
|
|
150
|
+
}).filter(Boolean);
|
|
151
|
+
}
|
|
152
|
+
async resolveBlockParent(target, transaction) {
|
|
153
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
154
|
+
const resolved = await this.locator.resolve(target, { transaction });
|
|
155
|
+
const node = resolved.node || await this.repository.findModelById(resolved.uid, { transaction, includeAsyncNode: true });
|
|
156
|
+
const normalizedUse = (0, import_approval.normalizeApprovalSemanticUse)(node == null ? void 0 : node.use);
|
|
157
|
+
if ((_a = node == null ? void 0 : node.use) == null ? void 0 : _a.endsWith("GridModel")) {
|
|
158
|
+
if ((0, import_approval.isApprovalTaskCardGridUse)(node.use)) {
|
|
159
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces addBlock target '${node.use}' does not support blocks`);
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
parentUid: node.uid,
|
|
163
|
+
subKey: "items",
|
|
164
|
+
subType: "array"
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
if (normalizedUse === "ChildPageTabModel") {
|
|
168
|
+
return {
|
|
169
|
+
parentUid: ((_c = (_b = node == null ? void 0 : node.subModels) == null ? void 0 : _b.grid) == null ? void 0 : _c.uid) || await this.options.ensureGridChild(node.uid, getDefaultGridUse(node.use, "BlockGridModel"), transaction),
|
|
170
|
+
subKey: "items",
|
|
171
|
+
subType: "array"
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
if (normalizedUse === "ChildPageModel") {
|
|
175
|
+
const firstTab = import_lodash.default.castArray(((_d = node == null ? void 0 : node.subModels) == null ? void 0 : _d.tabs) || [])[0];
|
|
176
|
+
if (!(firstTab == null ? void 0 : firstTab.uid)) {
|
|
177
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces addBlock target '${node.use}' is missing its popup tab subtree`);
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
parentUid: ((_f = (_e = firstTab == null ? void 0 : firstTab.subModels) == null ? void 0 : _e.grid) == null ? void 0 : _f.uid) || await this.options.ensureGridChild(
|
|
181
|
+
firstTab.uid,
|
|
182
|
+
getDefaultGridUse(firstTab.use, "BlockGridModel"),
|
|
183
|
+
transaction
|
|
184
|
+
),
|
|
185
|
+
subKey: "items",
|
|
186
|
+
subType: "array"
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
if ((0, import_placement.isPopupHostUse)(node == null ? void 0 : node.use) || (0, import_approval.normalizeApprovalSemanticUse)((_h = (_g = node == null ? void 0 : node.subModels) == null ? void 0 : _g.page) == null ? void 0 : _h.use) === "ChildPageModel") {
|
|
190
|
+
const popupSurface = await this.options.ensurePopupSurface(node.uid, transaction);
|
|
191
|
+
return {
|
|
192
|
+
parentUid: popupSurface.gridUid,
|
|
193
|
+
subKey: "items",
|
|
194
|
+
subType: "array",
|
|
195
|
+
popupSurface
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
if ((0, import_placement.isTabsRouteType)(resolved.tabRoute) || (node == null ? void 0 : node.use) === "RouteModel" && (0, import_placement.isTabsRouteType)(resolved.route)) {
|
|
199
|
+
return {
|
|
200
|
+
parentUid: ((_j = (_i = node == null ? void 0 : node.subModels) == null ? void 0 : _i.grid) == null ? void 0 : _j.uid) || await this.options.ensureGridChild(
|
|
201
|
+
((_l = (_k = resolved.tabRoute) == null ? void 0 : _k.get) == null ? void 0 : _l.call(_k, "schemaUid")) || node.uid,
|
|
202
|
+
getDefaultGridUse(node == null ? void 0 : node.use, "BlockGridModel"),
|
|
203
|
+
transaction
|
|
204
|
+
),
|
|
205
|
+
subKey: "items",
|
|
206
|
+
subType: "array"
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
if ((0, import_placement.isPageRouteType)(resolved.pageRoute)) {
|
|
210
|
+
const pageRoute = await this.options.hydrateRoute(resolved.pageRoute, transaction);
|
|
211
|
+
const firstTab = import_lodash.default.sortBy(
|
|
212
|
+
import_lodash.default.castArray(((_m = pageRoute == null ? void 0 : pageRoute.get) == null ? void 0 : _m.call(pageRoute, "children")) || (pageRoute == null ? void 0 : pageRoute.children) || []).map((item) => {
|
|
213
|
+
var _a2;
|
|
214
|
+
return ((_a2 = item == null ? void 0 : item.toJSON) == null ? void 0 : _a2.call(item)) || item;
|
|
215
|
+
}),
|
|
216
|
+
"sort"
|
|
217
|
+
)[0];
|
|
218
|
+
if (!(firstTab == null ? void 0 : firstTab.schemaUid)) {
|
|
219
|
+
(0, import_errors.throwBadRequest)("flowSurfaces addBlock requires a tab under page");
|
|
220
|
+
}
|
|
221
|
+
return this.resolveBlockParent({ uid: firstTab.schemaUid }, transaction);
|
|
222
|
+
}
|
|
223
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces addBlock target '${(node == null ? void 0 : node.use) || resolved.uid}' is not a grid surface`);
|
|
224
|
+
}
|
|
225
|
+
async resolveFieldContainer(uid, transaction) {
|
|
226
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
227
|
+
const target = await this.locator.resolve({ uid }, { transaction });
|
|
228
|
+
const node = target.node || await this.repository.findModelById(uid, { transaction, includeAsyncNode: true });
|
|
229
|
+
const use = node == null ? void 0 : node.use;
|
|
230
|
+
const normalizedUse = (0, import_approval.normalizeApprovalSemanticUse)(use);
|
|
231
|
+
if ((0, import_placement.isFormBlockUse)(use)) {
|
|
232
|
+
return {
|
|
233
|
+
ownerUid: node.uid,
|
|
234
|
+
ownerUse: use,
|
|
235
|
+
parentUid: ((_b = (_a = node.subModels) == null ? void 0 : _a.grid) == null ? void 0 : _b.uid) || await this.options.ensureGridChild(node.uid, getDefaultGridUse(use, "FormGridModel"), transaction),
|
|
236
|
+
subKey: "items",
|
|
237
|
+
subType: "array",
|
|
238
|
+
wrapperUse: getFieldWrapperUse(use, "FormItemModel")
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
if (normalizedUse === "FormGridModel") {
|
|
242
|
+
const parentUid = await this.locator.findParentUid(node.uid, transaction);
|
|
243
|
+
const parent = parentUid ? await this.repository.findModelById(parentUid, { transaction }) : null;
|
|
244
|
+
return {
|
|
245
|
+
ownerUid: (parent == null ? void 0 : parent.uid) || node.uid,
|
|
246
|
+
ownerUse: (parent == null ? void 0 : parent.use) || use,
|
|
247
|
+
parentUid: node.uid,
|
|
248
|
+
subKey: "items",
|
|
249
|
+
subType: "array",
|
|
250
|
+
wrapperUse: getFieldWrapperUse((parent == null ? void 0 : parent.use) || use, "FormItemModel")
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
if ((0, import_placement.isDetailsBlockUse)(use)) {
|
|
254
|
+
return {
|
|
255
|
+
ownerUid: node.uid,
|
|
256
|
+
ownerUse: use,
|
|
257
|
+
parentUid: ((_d = (_c = node.subModels) == null ? void 0 : _c.grid) == null ? void 0 : _d.uid) || await this.options.ensureGridChild(node.uid, getDefaultGridUse(use, "DetailsGridModel"), transaction),
|
|
258
|
+
subKey: "items",
|
|
259
|
+
subType: "array",
|
|
260
|
+
wrapperUse: getFieldWrapperUse(use, "DetailsItemModel")
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
if (DETAILS_CARD_BLOCK_USES.has(use)) {
|
|
264
|
+
const itemUid = (_f = (_e = node.subModels) == null ? void 0 : _e.item) == null ? void 0 : _f.uid;
|
|
265
|
+
if (!itemUid) {
|
|
266
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces addField target '${use}' is missing its item subtree`);
|
|
267
|
+
}
|
|
268
|
+
return {
|
|
269
|
+
ownerUid: node.uid,
|
|
270
|
+
ownerUse: use,
|
|
271
|
+
parentUid: ((_j = (_i = (_h = (_g = node.subModels) == null ? void 0 : _g.item) == null ? void 0 : _h.subModels) == null ? void 0 : _i.grid) == null ? void 0 : _j.uid) || await this.options.ensureGridChild(itemUid, "DetailsGridModel", transaction),
|
|
272
|
+
subKey: "items",
|
|
273
|
+
subType: "array",
|
|
274
|
+
wrapperUse: "DetailsItemModel"
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
if (DETAILS_CARD_ITEM_USES.has(use)) {
|
|
278
|
+
return {
|
|
279
|
+
ownerUid: node.uid,
|
|
280
|
+
ownerUse: use,
|
|
281
|
+
parentUid: ((_l = (_k = node.subModels) == null ? void 0 : _k.grid) == null ? void 0 : _l.uid) || await this.options.ensureGridChild(node.uid, "DetailsGridModel", transaction),
|
|
282
|
+
subKey: "items",
|
|
283
|
+
subType: "array",
|
|
284
|
+
wrapperUse: "DetailsItemModel"
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
if (normalizedUse === "DetailsGridModel") {
|
|
288
|
+
const parentUid = await this.locator.findParentUid(node.uid, transaction);
|
|
289
|
+
const parent = parentUid ? await this.repository.findModelById(parentUid, { transaction }) : null;
|
|
290
|
+
return {
|
|
291
|
+
ownerUid: (parent == null ? void 0 : parent.uid) || node.uid,
|
|
292
|
+
ownerUse: (parent == null ? void 0 : parent.use) || use,
|
|
293
|
+
parentUid: node.uid,
|
|
294
|
+
subKey: "items",
|
|
295
|
+
subType: "array",
|
|
296
|
+
wrapperUse: getFieldWrapperUse((parent == null ? void 0 : parent.use) || use, "DetailsItemModel")
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
if ((0, import_placement.isFilterFormBlockUse)(use)) {
|
|
300
|
+
return {
|
|
301
|
+
ownerUid: node.uid,
|
|
302
|
+
ownerUse: use,
|
|
303
|
+
parentUid: ((_n = (_m = node.subModels) == null ? void 0 : _m.grid) == null ? void 0 : _n.uid) || await this.options.ensureGridChild(node.uid, "FilterFormGridModel", transaction),
|
|
304
|
+
subKey: "items",
|
|
305
|
+
subType: "array",
|
|
306
|
+
wrapperUse: "FilterFormItemModel"
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
if (use === "FilterFormGridModel") {
|
|
310
|
+
const parentUid = await this.locator.findParentUid(node.uid, transaction);
|
|
311
|
+
const parent = parentUid ? await this.repository.findModelById(parentUid, { transaction }) : null;
|
|
312
|
+
return {
|
|
313
|
+
ownerUid: (parent == null ? void 0 : parent.uid) || node.uid,
|
|
314
|
+
ownerUse: (parent == null ? void 0 : parent.use) || use,
|
|
315
|
+
parentUid: node.uid,
|
|
316
|
+
subKey: "items",
|
|
317
|
+
subType: "array",
|
|
318
|
+
wrapperUse: "FilterFormItemModel"
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
if (use === "TableBlockModel") {
|
|
322
|
+
return {
|
|
323
|
+
ownerUid: node.uid,
|
|
324
|
+
ownerUse: use,
|
|
325
|
+
parentUid: node.uid,
|
|
326
|
+
subKey: "columns",
|
|
327
|
+
subType: "array",
|
|
328
|
+
wrapperUse: "TableColumnModel"
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces addField target '${use || uid}' is not a field container`);
|
|
332
|
+
}
|
|
333
|
+
async resolveActionContainer(target, transaction) {
|
|
334
|
+
var _a;
|
|
335
|
+
const resolved = await this.locator.resolve(target, { transaction });
|
|
336
|
+
const node = resolved.node || await this.repository.findModelById(resolved.uid, { transaction, includeAsyncNode: true });
|
|
337
|
+
if (["TableBlockModel", "CalendarBlockModel", "TableActionsColumnModel"].includes(node == null ? void 0 : node.use) || (node == null ? void 0 : node.use) === "ActionPanelBlockModel" || BLOCK_ACTION_CONTAINER_USES.has(node == null ? void 0 : node.use) || RECORD_ACTION_ITEM_USES.has(node == null ? void 0 : node.use)) {
|
|
338
|
+
return {
|
|
339
|
+
parentUid: node.uid,
|
|
340
|
+
subKey: "actions",
|
|
341
|
+
subType: "array",
|
|
342
|
+
ownerUid: node.uid,
|
|
343
|
+
ownerUse: node.use
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
if ((0, import_placement.isFormBlockUse)(node == null ? void 0 : node.use) || (0, import_placement.isDetailsBlockUse)(node == null ? void 0 : node.use) || (0, import_placement.isFilterFormBlockUse)(node == null ? void 0 : node.use)) {
|
|
347
|
+
return {
|
|
348
|
+
parentUid: node.uid,
|
|
349
|
+
subKey: "actions",
|
|
350
|
+
subType: "array",
|
|
351
|
+
ownerUid: node.uid,
|
|
352
|
+
ownerUse: node.use
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
if ((_a = node == null ? void 0 : node.subModels) == null ? void 0 : _a.actions) {
|
|
356
|
+
return {
|
|
357
|
+
parentUid: node.uid,
|
|
358
|
+
subKey: "actions",
|
|
359
|
+
subType: "array",
|
|
360
|
+
ownerUid: node.uid,
|
|
361
|
+
ownerUse: node.use
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces addAction target '${(node == null ? void 0 : node.use) || resolved.uid}' is not an action container`);
|
|
365
|
+
}
|
|
366
|
+
async resolveGridNode(uid, transaction) {
|
|
367
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
368
|
+
const resolved = await this.locator.resolve({ uid }, { transaction });
|
|
369
|
+
const node = resolved.node || await this.repository.findModelById(uid, { transaction, includeAsyncNode: true });
|
|
370
|
+
const normalizedUse = (0, import_approval.normalizeApprovalSemanticUse)(node == null ? void 0 : node.use);
|
|
371
|
+
if ((_a = node == null ? void 0 : node.use) == null ? void 0 : _a.endsWith("GridModel")) {
|
|
372
|
+
return node;
|
|
373
|
+
}
|
|
374
|
+
if ((((_c = (_b = resolved.tabRoute) == null ? void 0 : _b.get) == null ? void 0 : _c.call(_b, "type")) === "tabs" || ((_e = (_d = resolved.route) == null ? void 0 : _d.get) == null ? void 0 : _e.call(_d, "type")) === "tabs") && (node == null ? void 0 : node.use) === "RouteModel") {
|
|
375
|
+
return this.repository.findModelById(
|
|
376
|
+
((_g = (_f = node == null ? void 0 : node.subModels) == null ? void 0 : _f.grid) == null ? void 0 : _g.uid) || await this.options.ensureGridChild(
|
|
377
|
+
((_i = (_h = resolved.tabRoute) == null ? void 0 : _h.get) == null ? void 0 : _i.call(_h, "schemaUid")) || node.uid,
|
|
378
|
+
getDefaultGridUse(node == null ? void 0 : node.use, "BlockGridModel"),
|
|
379
|
+
transaction
|
|
380
|
+
),
|
|
381
|
+
{ transaction, includeAsyncNode: true }
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
if ((_k = (_j = node == null ? void 0 : node.subModels) == null ? void 0 : _j.grid) == null ? void 0 : _k.uid) {
|
|
385
|
+
return this.repository.findModelById(node.subModels.grid.uid, { transaction, includeAsyncNode: true });
|
|
386
|
+
}
|
|
387
|
+
if (normalizedUse === "ChildPageTabModel") {
|
|
388
|
+
return this.repository.findModelById(
|
|
389
|
+
await this.options.ensureGridChild(node.uid, getDefaultGridUse(node == null ? void 0 : node.use, "BlockGridModel"), transaction),
|
|
390
|
+
{ transaction, includeAsyncNode: true }
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
if (normalizedUse === "ChildPageModel") {
|
|
394
|
+
const firstTab = import_lodash.default.castArray(((_l = node == null ? void 0 : node.subModels) == null ? void 0 : _l.tabs) || [])[0];
|
|
395
|
+
if (!(firstTab == null ? void 0 : firstTab.uid)) {
|
|
396
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces setLayout target '${uid}' is missing its popup tab subtree`);
|
|
397
|
+
}
|
|
398
|
+
const gridUid = ((_n = (_m = firstTab == null ? void 0 : firstTab.subModels) == null ? void 0 : _m.grid) == null ? void 0 : _n.uid) || await this.options.ensureGridChild(
|
|
399
|
+
firstTab.uid,
|
|
400
|
+
getDefaultGridUse(firstTab.use, "BlockGridModel"),
|
|
401
|
+
transaction
|
|
402
|
+
);
|
|
403
|
+
return this.repository.findModelById(gridUid, { transaction, includeAsyncNode: true });
|
|
404
|
+
}
|
|
405
|
+
if ((0, import_placement.isFormBlockUse)(node == null ? void 0 : node.use)) {
|
|
406
|
+
return this.repository.findModelById(
|
|
407
|
+
await this.options.ensureGridChild(node.uid, getDefaultGridUse(node == null ? void 0 : node.use, "FormGridModel"), transaction),
|
|
408
|
+
{ transaction, includeAsyncNode: true }
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
if ((0, import_placement.isDetailsBlockUse)(node == null ? void 0 : node.use)) {
|
|
412
|
+
return this.repository.findModelById(
|
|
413
|
+
await this.options.ensureGridChild(node.uid, getDefaultGridUse(node == null ? void 0 : node.use, "DetailsGridModel"), transaction),
|
|
414
|
+
{ transaction, includeAsyncNode: true }
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
if ((0, import_placement.isFilterFormBlockUse)(node == null ? void 0 : node.use)) {
|
|
418
|
+
return this.repository.findModelById(
|
|
419
|
+
await this.options.ensureGridChild(node.uid, "FilterFormGridModel", transaction),
|
|
420
|
+
{ transaction, includeAsyncNode: true }
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces setLayout target '${uid}' is not a grid node`);
|
|
424
|
+
}
|
|
425
|
+
async findOwningBlockGrid(uid, transaction) {
|
|
426
|
+
let cursor = uid;
|
|
427
|
+
while (cursor) {
|
|
428
|
+
const node = await this.repository.findModelById(cursor, { transaction, includeAsyncNode: true });
|
|
429
|
+
if ((0, import_approval.normalizeApprovalSemanticUse)(node == null ? void 0 : node.use) === "BlockGridModel") {
|
|
430
|
+
return node;
|
|
431
|
+
}
|
|
432
|
+
cursor = await this.locator.findParentUid(cursor, transaction);
|
|
433
|
+
}
|
|
434
|
+
return null;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
438
|
+
0 && (module.exports = {
|
|
439
|
+
FlowSurfaceContextResolver
|
|
440
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
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 FlowSurfaceTemplateCompatibilityRow = {
|
|
10
|
+
uid?: string;
|
|
11
|
+
useModel?: string;
|
|
12
|
+
dataSourceKey?: string;
|
|
13
|
+
collectionName?: string;
|
|
14
|
+
associationName?: string;
|
|
15
|
+
};
|
|
16
|
+
export type FlowSurfaceTemplateResourceInfo = {
|
|
17
|
+
dataSourceKey?: string;
|
|
18
|
+
collectionName?: string;
|
|
19
|
+
associationName?: string;
|
|
20
|
+
};
|
|
21
|
+
export type FlowSurfaceTemplateAssociationMatchMode = 'none' | 'exactIfTemplateHasAssociationName' | 'associationResourceOnly';
|
|
22
|
+
export declare function getFlowTemplateRootUseFamily(use: any): string;
|
|
23
|
+
export declare function areFlowTemplateRootUsesCompatible(hostUse: any, templateUse: any): boolean;
|
|
24
|
+
export declare function buildTemplateMissingResourceReason(): string;
|
|
25
|
+
export declare function buildTemplateDataSourceMismatchReason(expectedDataSourceKey: string, actualDataSourceKey: string): string;
|
|
26
|
+
export declare function buildTemplateCollectionMismatchReason(expectedCollectionName: string, actualCollectionName: string): string;
|
|
27
|
+
export declare function buildTemplateAssociationMismatchReason(expectedAssociationName?: string, actualAssociationName?: string): string;
|
|
28
|
+
export declare function buildTemplateMissingContextReason(param: string): string;
|
|
29
|
+
export declare function resolveAssociationTargetResourceInfo(input: FlowSurfaceTemplateResourceInfo, options: {
|
|
30
|
+
getCollection: (dataSourceKey: string, collectionName: string) => any;
|
|
31
|
+
}): FlowSurfaceTemplateResourceInfo;
|
|
32
|
+
export declare function resolveTemplateResourceInfo(input: FlowSurfaceTemplateResourceInfo, options: {
|
|
33
|
+
getCollection: (dataSourceKey: string, collectionName: string) => any;
|
|
34
|
+
}): FlowSurfaceTemplateResourceInfo;
|
|
35
|
+
export declare function resolveBlockTemplateExpectedResourceInfo(node: any, options: {
|
|
36
|
+
resolveTemplateResourceInfo: (input: FlowSurfaceTemplateResourceInfo) => FlowSurfaceTemplateResourceInfo;
|
|
37
|
+
}): FlowSurfaceTemplateResourceInfo;
|
|
38
|
+
export declare function getTemplateResourceCompatibilityDisabledReason(template: FlowSurfaceTemplateCompatibilityRow, expected: FlowSurfaceTemplateResourceInfo, options: {
|
|
39
|
+
associationMatch?: FlowSurfaceTemplateAssociationMatchMode;
|
|
40
|
+
checkResource?: boolean;
|
|
41
|
+
resolveTemplateResourceInfo: (input: FlowSurfaceTemplateResourceInfo) => FlowSurfaceTemplateResourceInfo;
|
|
42
|
+
}): string;
|
|
@@ -0,0 +1,189 @@
|
|
|
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 template_compatibility_exports = {};
|
|
38
|
+
__export(template_compatibility_exports, {
|
|
39
|
+
areFlowTemplateRootUsesCompatible: () => areFlowTemplateRootUsesCompatible,
|
|
40
|
+
buildTemplateAssociationMismatchReason: () => buildTemplateAssociationMismatchReason,
|
|
41
|
+
buildTemplateCollectionMismatchReason: () => buildTemplateCollectionMismatchReason,
|
|
42
|
+
buildTemplateDataSourceMismatchReason: () => buildTemplateDataSourceMismatchReason,
|
|
43
|
+
buildTemplateMissingContextReason: () => buildTemplateMissingContextReason,
|
|
44
|
+
buildTemplateMissingResourceReason: () => buildTemplateMissingResourceReason,
|
|
45
|
+
getFlowTemplateRootUseFamily: () => getFlowTemplateRootUseFamily,
|
|
46
|
+
getTemplateResourceCompatibilityDisabledReason: () => getTemplateResourceCompatibilityDisabledReason,
|
|
47
|
+
resolveAssociationTargetResourceInfo: () => resolveAssociationTargetResourceInfo,
|
|
48
|
+
resolveBlockTemplateExpectedResourceInfo: () => resolveBlockTemplateExpectedResourceInfo,
|
|
49
|
+
resolveTemplateResourceInfo: () => resolveTemplateResourceInfo
|
|
50
|
+
});
|
|
51
|
+
module.exports = __toCommonJS(template_compatibility_exports);
|
|
52
|
+
var import_lodash = __toESM(require("lodash"));
|
|
53
|
+
var import_service_helpers = require("./service-helpers");
|
|
54
|
+
const FLOW_TEMPLATE_ROOT_USE_FAMILIES = {
|
|
55
|
+
CreateFormModel: "crudForm",
|
|
56
|
+
EditFormModel: "crudForm",
|
|
57
|
+
ApplyFormModel: "approvalForm",
|
|
58
|
+
ProcessFormModel: "approvalForm"
|
|
59
|
+
};
|
|
60
|
+
function getFlowTemplateRootUseFamily(use) {
|
|
61
|
+
const normalizedUse = String(use || "").trim();
|
|
62
|
+
return FLOW_TEMPLATE_ROOT_USE_FAMILIES[normalizedUse] || normalizedUse;
|
|
63
|
+
}
|
|
64
|
+
function areFlowTemplateRootUsesCompatible(hostUse, templateUse) {
|
|
65
|
+
const normalizedHostUse = String(hostUse || "").trim();
|
|
66
|
+
const normalizedTemplateUse = String(templateUse || "").trim();
|
|
67
|
+
if (!normalizedHostUse || !normalizedTemplateUse) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
return getFlowTemplateRootUseFamily(normalizedHostUse) === getFlowTemplateRootUseFamily(normalizedTemplateUse);
|
|
71
|
+
}
|
|
72
|
+
function buildTemplateMissingResourceReason() {
|
|
73
|
+
return "missing data source or collection information";
|
|
74
|
+
}
|
|
75
|
+
function buildTemplateDataSourceMismatchReason(expectedDataSourceKey, actualDataSourceKey) {
|
|
76
|
+
return `data source mismatch: expected '${expectedDataSourceKey}', got '${actualDataSourceKey}'`;
|
|
77
|
+
}
|
|
78
|
+
function buildTemplateCollectionMismatchReason(expectedCollectionName, actualCollectionName) {
|
|
79
|
+
return `collection mismatch: expected '${expectedCollectionName}', got '${actualCollectionName}'`;
|
|
80
|
+
}
|
|
81
|
+
function buildTemplateAssociationMismatchReason(expectedAssociationName, actualAssociationName) {
|
|
82
|
+
return `association mismatch: expected '${expectedAssociationName || "(none)"}', got '${actualAssociationName || "(none)"}'`;
|
|
83
|
+
}
|
|
84
|
+
function buildTemplateMissingContextReason(param) {
|
|
85
|
+
return `cannot resolve template parameter '${param}'`;
|
|
86
|
+
}
|
|
87
|
+
function resolveAssociationTargetResourceInfo(input, options) {
|
|
88
|
+
var _a;
|
|
89
|
+
const dataSourceKey = String((input == null ? void 0 : input.dataSourceKey) || "").trim() || void 0;
|
|
90
|
+
const collectionName = String((input == null ? void 0 : input.collectionName) || "").trim() || void 0;
|
|
91
|
+
const associationName = String((input == null ? void 0 : input.associationName) || "").trim() || void 0;
|
|
92
|
+
if (!associationName) {
|
|
93
|
+
return {
|
|
94
|
+
dataSourceKey,
|
|
95
|
+
collectionName
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
const parts = associationName.split(".").filter(Boolean);
|
|
99
|
+
const baseCollectionName = (parts.length > 1 ? parts[0] : collectionName) || void 0;
|
|
100
|
+
const fieldPath = (parts.length > 1 ? parts.slice(1).join(".") : associationName) || void 0;
|
|
101
|
+
if (!dataSourceKey || !baseCollectionName || !fieldPath) {
|
|
102
|
+
return {
|
|
103
|
+
dataSourceKey,
|
|
104
|
+
collectionName,
|
|
105
|
+
associationName
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const baseCollection = options.getCollection(dataSourceKey, baseCollectionName);
|
|
109
|
+
const associationField = (0, import_service_helpers.resolveFieldFromCollection)(baseCollection, fieldPath);
|
|
110
|
+
const targetCollection = (0, import_service_helpers.resolveFieldTargetCollection)(
|
|
111
|
+
associationField,
|
|
112
|
+
dataSourceKey,
|
|
113
|
+
(resolvedDsKey, targetCollectionName) => options.getCollection(resolvedDsKey, targetCollectionName)
|
|
114
|
+
);
|
|
115
|
+
return {
|
|
116
|
+
dataSourceKey: (targetCollection == null ? void 0 : targetCollection.dataSourceKey) || ((_a = targetCollection == null ? void 0 : targetCollection.options) == null ? void 0 : _a.dataSourceKey) || dataSourceKey,
|
|
117
|
+
collectionName: (0, import_service_helpers.getCollectionName)(targetCollection) || (0, import_service_helpers.getFieldTarget)(associationField) || collectionName || baseCollectionName,
|
|
118
|
+
associationName
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function resolveTemplateResourceInfo(input, options) {
|
|
122
|
+
return resolveAssociationTargetResourceInfo(input, options);
|
|
123
|
+
}
|
|
124
|
+
function resolveBlockTemplateExpectedResourceInfo(node, options) {
|
|
125
|
+
const init = import_lodash.default.get(node, ["stepParams", "resourceSettings", "init"]) || {};
|
|
126
|
+
return options.resolveTemplateResourceInfo({
|
|
127
|
+
dataSourceKey: String(init.dataSourceKey || "").trim() || void 0,
|
|
128
|
+
collectionName: String(init.collectionName || "").trim() || void 0,
|
|
129
|
+
associationName: String(init.associationName || "").trim() || void 0
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function getTemplateResourceCompatibilityDisabledReason(template, expected, options) {
|
|
133
|
+
const associationMatch = options.associationMatch || "none";
|
|
134
|
+
const checkResource = options.checkResource !== false;
|
|
135
|
+
const templateAssociationName = String((template == null ? void 0 : template.associationName) || "").trim() || void 0;
|
|
136
|
+
const expectedAssociationName = String((expected == null ? void 0 : expected.associationName) || "").trim() || void 0;
|
|
137
|
+
const getAssociationMismatchReason = () => {
|
|
138
|
+
if (associationMatch === "none") {
|
|
139
|
+
return void 0;
|
|
140
|
+
}
|
|
141
|
+
if (associationMatch === "exactIfTemplateHasAssociationName") {
|
|
142
|
+
if (!templateAssociationName || templateAssociationName === expectedAssociationName) {
|
|
143
|
+
return void 0;
|
|
144
|
+
}
|
|
145
|
+
return buildTemplateAssociationMismatchReason(expectedAssociationName, templateAssociationName);
|
|
146
|
+
}
|
|
147
|
+
const toAssociationResource = (value) => value && value.includes(".") ? value : void 0;
|
|
148
|
+
const templateAssociationResource = toAssociationResource(templateAssociationName);
|
|
149
|
+
if (!templateAssociationResource) {
|
|
150
|
+
return void 0;
|
|
151
|
+
}
|
|
152
|
+
const expectedAssociationResource = toAssociationResource(expectedAssociationName);
|
|
153
|
+
if (templateAssociationResource === expectedAssociationResource) {
|
|
154
|
+
return void 0;
|
|
155
|
+
}
|
|
156
|
+
return buildTemplateAssociationMismatchReason(expectedAssociationResource, templateAssociationResource);
|
|
157
|
+
};
|
|
158
|
+
if (!checkResource) {
|
|
159
|
+
return getAssociationMismatchReason();
|
|
160
|
+
}
|
|
161
|
+
const templateResource = options.resolveTemplateResourceInfo(template || {});
|
|
162
|
+
const expectedResource = options.resolveTemplateResourceInfo(expected || {});
|
|
163
|
+
if (expectedResource.dataSourceKey && expectedResource.collectionName) {
|
|
164
|
+
if (!templateResource.dataSourceKey || !templateResource.collectionName) {
|
|
165
|
+
return buildTemplateMissingResourceReason();
|
|
166
|
+
}
|
|
167
|
+
if (templateResource.dataSourceKey !== expectedResource.dataSourceKey) {
|
|
168
|
+
return buildTemplateDataSourceMismatchReason(expectedResource.dataSourceKey, templateResource.dataSourceKey);
|
|
169
|
+
}
|
|
170
|
+
if (templateResource.collectionName !== expectedResource.collectionName) {
|
|
171
|
+
return buildTemplateCollectionMismatchReason(expectedResource.collectionName, templateResource.collectionName);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return getAssociationMismatchReason();
|
|
175
|
+
}
|
|
176
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
177
|
+
0 && (module.exports = {
|
|
178
|
+
areFlowTemplateRootUsesCompatible,
|
|
179
|
+
buildTemplateAssociationMismatchReason,
|
|
180
|
+
buildTemplateCollectionMismatchReason,
|
|
181
|
+
buildTemplateDataSourceMismatchReason,
|
|
182
|
+
buildTemplateMissingContextReason,
|
|
183
|
+
buildTemplateMissingResourceReason,
|
|
184
|
+
getFlowTemplateRootUseFamily,
|
|
185
|
+
getTemplateResourceCompatibilityDisabledReason,
|
|
186
|
+
resolveAssociationTargetResourceInfo,
|
|
187
|
+
resolveBlockTemplateExpectedResourceInfo,
|
|
188
|
+
resolveTemplateResourceInfo
|
|
189
|
+
});
|