@nocobase/plugin-flow-engine 2.1.0-alpha.2 → 2.1.0-alpha.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 +11 -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/package.json +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 +37 -0
- package/dist/server/flow-surfaces/action-scope.js +148 -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 +158 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +14 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.js +844 -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 +161 -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 +931 -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 +3254 -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 +106 -0
- package/dist/server/flow-surfaces/compose-compiler.js +163 -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 +751 -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 +411 -0
- package/dist/server/flow-surfaces/default-action-popup.d.ts +53 -0
- package/dist/server/flow-surfaces/default-action-popup.js +262 -0
- package/dist/server/flow-surfaces/default-block-actions.d.ts +32 -0
- package/dist/server/flow-surfaces/default-block-actions.js +178 -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 +81 -0
- package/dist/server/flow-surfaces/index.d.ts +11 -0
- package/dist/server/flow-surfaces/index.js +175 -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 +126 -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 +192 -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/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 +149 -0
- package/dist/server/flow-surfaces/reaction/registry.js +199 -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 +377 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +101 -0
- package/dist/server/flow-surfaces/service-utils.js +762 -0
- package/dist/server/flow-surfaces/service.d.ts +703 -0
- package/dist/server/flow-surfaces/service.js +11376 -0
- package/dist/server/flow-surfaces/support-matrix.d.ts +28 -0
- package/dist/server/flow-surfaces/support-matrix.js +246 -0
- package/dist/server/flow-surfaces/surface-context.d.ts +52 -0
- package/dist/server/flow-surfaces/surface-context.js +436 -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-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 +287 -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 +5804 -0
- package/dist/swagger/flow-surfaces.examples.d.ts +1427 -0
- package/dist/swagger/flow-surfaces.examples.js +1607 -0
- package/dist/swagger/flow-surfaces.js +5195 -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 +5809 -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,175 @@
|
|
|
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 __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var flow_surfaces_exports = {};
|
|
28
|
+
__export(flow_surfaces_exports, {
|
|
29
|
+
registerFlowSurfacesResource: () => registerFlowSurfacesResource
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(flow_surfaces_exports);
|
|
32
|
+
var import_resourcer = require("@nocobase/resourcer");
|
|
33
|
+
var import_constants = require("./constants");
|
|
34
|
+
var import_errors = require("./errors");
|
|
35
|
+
var import_service = require("./service");
|
|
36
|
+
function getValues(ctx) {
|
|
37
|
+
var _a, _b, _c;
|
|
38
|
+
return ((_b = (_a = ctx.action) == null ? void 0 : _a.params) == null ? void 0 : _b.values) ?? ((_c = ctx.action) == null ? void 0 : _c.params) ?? {};
|
|
39
|
+
}
|
|
40
|
+
function isImplicitEmptyValuesBag(value) {
|
|
41
|
+
return !!value && typeof value === "object" && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype && Object.keys(value).length === 0;
|
|
42
|
+
}
|
|
43
|
+
function getRawReadQuery(ctx) {
|
|
44
|
+
var _a;
|
|
45
|
+
const querystring = String(((_a = ctx.request) == null ? void 0 : _a.querystring) ?? "");
|
|
46
|
+
if (!querystring) {
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
return (0, import_resourcer.parseQuery)(querystring) || {};
|
|
51
|
+
} catch {
|
|
52
|
+
return {};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function hasExplicitQueryWrapper(ctx, key) {
|
|
56
|
+
const query = getRawReadQuery(ctx);
|
|
57
|
+
return Object.prototype.hasOwnProperty.call(query, key);
|
|
58
|
+
}
|
|
59
|
+
function hasExplicitRequestBody(ctx) {
|
|
60
|
+
var _a;
|
|
61
|
+
const headers = ((_a = ctx.request) == null ? void 0 : _a.headers) ?? {};
|
|
62
|
+
const contentLength = headers["content-length"];
|
|
63
|
+
if (Array.isArray(contentLength)) {
|
|
64
|
+
return contentLength.some((value) => value !== "0");
|
|
65
|
+
}
|
|
66
|
+
if (typeof contentLength === "string") {
|
|
67
|
+
return contentLength !== "0";
|
|
68
|
+
}
|
|
69
|
+
return Boolean(headers["transfer-encoding"]);
|
|
70
|
+
}
|
|
71
|
+
function getReadValues(ctx) {
|
|
72
|
+
var _a, _b, _c;
|
|
73
|
+
if (((_b = (_a = ctx.request) == null ? void 0 : _a.method) == null ? void 0 : _b.toUpperCase()) !== "GET") {
|
|
74
|
+
(0, import_errors.throwBadRequest)(
|
|
75
|
+
`flowSurfaces:get only supports GET with root query locator fields like /api/flowSurfaces:get?uid=...`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
if (hasExplicitQueryWrapper(ctx, "target")) {
|
|
79
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces:get only accepts root locator fields; do not wrap them in 'target'`);
|
|
80
|
+
}
|
|
81
|
+
if (hasExplicitQueryWrapper(ctx, "values")) {
|
|
82
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces:get only accepts root locator fields; do not wrap them in 'values'`);
|
|
83
|
+
}
|
|
84
|
+
const params = ((_c = ctx.action) == null ? void 0 : _c.params) ?? {};
|
|
85
|
+
if (!Object.prototype.hasOwnProperty.call(params, "values")) {
|
|
86
|
+
return params;
|
|
87
|
+
}
|
|
88
|
+
const values = params.values;
|
|
89
|
+
if (typeof values !== "undefined" && !isImplicitEmptyValuesBag(values)) {
|
|
90
|
+
return params;
|
|
91
|
+
}
|
|
92
|
+
if (hasExplicitRequestBody(ctx)) {
|
|
93
|
+
return params;
|
|
94
|
+
}
|
|
95
|
+
const { values: _values, ...rest } = params;
|
|
96
|
+
return rest;
|
|
97
|
+
}
|
|
98
|
+
function writeFlowSurfaceErrorResponse(ctx, error) {
|
|
99
|
+
const normalized = (0, import_errors.normalizeFlowSurfaceError)(error);
|
|
100
|
+
ctx.withoutDataWrapping = true;
|
|
101
|
+
ctx.type = "application/json";
|
|
102
|
+
ctx.status = normalized.status;
|
|
103
|
+
ctx.body = normalized.toResponseBody();
|
|
104
|
+
}
|
|
105
|
+
function isAclPermissionDeniedForFlowSurfaces(ctx, error) {
|
|
106
|
+
var _a, _b;
|
|
107
|
+
const resourceName = ((_a = ctx.action) == null ? void 0 : _a.resourceName) ?? ((_b = ctx.permission) == null ? void 0 : _b.resourceName);
|
|
108
|
+
return resourceName === "flowSurfaces" && (error == null ? void 0 : error.status) === 403 && (error == null ? void 0 : error.message) === "No permissions";
|
|
109
|
+
}
|
|
110
|
+
function toFlowSurfaceForbiddenError(error) {
|
|
111
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
112
|
+
return new import_errors.FlowSurfaceForbiddenError(message);
|
|
113
|
+
}
|
|
114
|
+
async function runFlowSurfaceAclErrorWrapper(ctx, next) {
|
|
115
|
+
try {
|
|
116
|
+
await next();
|
|
117
|
+
} catch (error) {
|
|
118
|
+
if (!isAclPermissionDeniedForFlowSurfaces(ctx, error)) {
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
writeFlowSurfaceErrorResponse(ctx, toFlowSurfaceForbiddenError(error));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async function runFlowSurfaceAction(ctx, next, handler) {
|
|
125
|
+
try {
|
|
126
|
+
ctx.body = await handler();
|
|
127
|
+
await next();
|
|
128
|
+
} catch (error) {
|
|
129
|
+
writeFlowSurfaceErrorResponse(ctx, error);
|
|
130
|
+
await next();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function invokeFlowSurfaceServiceAction(service, actionName, values, options = {}) {
|
|
134
|
+
const handler = service[actionName];
|
|
135
|
+
return handler.call(service, values, options);
|
|
136
|
+
}
|
|
137
|
+
function registerFlowSurfacesResource(plugin) {
|
|
138
|
+
const service = new import_service.FlowSurfacesService(plugin);
|
|
139
|
+
const actions = Object.fromEntries(
|
|
140
|
+
import_constants.FLOW_SURFACES_ACTION_NAMES.map((actionName) => [
|
|
141
|
+
actionName,
|
|
142
|
+
async (ctx, next) => {
|
|
143
|
+
await runFlowSurfaceAction(ctx, next, async () => {
|
|
144
|
+
const definition = import_constants.FLOW_SURFACE_ACTION_DEFINITIONS[actionName];
|
|
145
|
+
const values = definition.valueSource === "read" ? getReadValues(ctx) : getValues(ctx);
|
|
146
|
+
if (definition.transaction) {
|
|
147
|
+
return service.transaction(
|
|
148
|
+
(transaction) => invokeFlowSurfaceServiceAction(service, actionName, values, { transaction })
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
return invokeFlowSurfaceServiceAction(service, actionName, values);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
])
|
|
155
|
+
);
|
|
156
|
+
plugin.app.acl.registerSnippet({
|
|
157
|
+
name: "ui.flowSurfaces",
|
|
158
|
+
actions: ["flowSurfaces:*"]
|
|
159
|
+
});
|
|
160
|
+
plugin.app.acl.allow("flowSurfaces", [...import_constants.FLOW_SURFACES_READ_ACTION_NAMES], "loggedIn");
|
|
161
|
+
plugin.app.acl.use(runFlowSurfaceAclErrorWrapper, {
|
|
162
|
+
tag: "flow-surfaces-acl-errors",
|
|
163
|
+
after: "allow-manager",
|
|
164
|
+
before: "core"
|
|
165
|
+
});
|
|
166
|
+
plugin.app.resourceManager.define({
|
|
167
|
+
name: "flowSurfaces",
|
|
168
|
+
actions
|
|
169
|
+
});
|
|
170
|
+
return service;
|
|
171
|
+
}
|
|
172
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
173
|
+
0 && (module.exports = {
|
|
174
|
+
registerFlowSurfacesResource
|
|
175
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
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 type FlowModelRepository from '../repository';
|
|
10
|
+
import type { FlowSurfaceResolveTarget, FlowSurfaceResolvedTarget } from './types';
|
|
11
|
+
export declare class SurfaceLocator {
|
|
12
|
+
private readonly db;
|
|
13
|
+
private readonly repository;
|
|
14
|
+
constructor(db: any, repository: FlowModelRepository);
|
|
15
|
+
resolve(target: FlowSurfaceResolveTarget, options?: {
|
|
16
|
+
transaction?: any;
|
|
17
|
+
}): Promise<FlowSurfaceResolvedTarget>;
|
|
18
|
+
findParentUid(uid: string, transaction?: any): Promise<any>;
|
|
19
|
+
findRouteBySchemaUid(schemaUid: string, transaction?: any): Promise<any>;
|
|
20
|
+
resolveCollectionContext(uid: string, transaction?: any): Promise<{
|
|
21
|
+
ownerUid: string;
|
|
22
|
+
model: any;
|
|
23
|
+
resourceInit: any;
|
|
24
|
+
}>;
|
|
25
|
+
private resolveByUid;
|
|
26
|
+
private resolvePageSchemaUid;
|
|
27
|
+
private findPageRouteFromModel;
|
|
28
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
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 locator_exports = {};
|
|
38
|
+
__export(locator_exports, {
|
|
39
|
+
SurfaceLocator: () => SurfaceLocator
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(locator_exports);
|
|
42
|
+
var import_lodash = __toESM(require("lodash"));
|
|
43
|
+
var import_approval = require("./approval");
|
|
44
|
+
var import_chart_config = require("./chart-config");
|
|
45
|
+
var import_errors = require("./errors");
|
|
46
|
+
class SurfaceLocator {
|
|
47
|
+
constructor(db, repository) {
|
|
48
|
+
this.db = db;
|
|
49
|
+
this.repository = repository;
|
|
50
|
+
}
|
|
51
|
+
async resolve(target, options = {}) {
|
|
52
|
+
var _a;
|
|
53
|
+
const transaction = options.transaction;
|
|
54
|
+
if (target.uid) {
|
|
55
|
+
return this.resolveByUid(target.uid, target, transaction);
|
|
56
|
+
}
|
|
57
|
+
if ("tabSchemaUid" in target && target.tabSchemaUid) {
|
|
58
|
+
return this.resolveByUid(target.tabSchemaUid, target, transaction);
|
|
59
|
+
}
|
|
60
|
+
if ("pageSchemaUid" in target && target.pageSchemaUid) {
|
|
61
|
+
return this.resolvePageSchemaUid(target.pageSchemaUid, target, transaction);
|
|
62
|
+
}
|
|
63
|
+
if ("routeId" in target && target.routeId) {
|
|
64
|
+
const route = await this.db.getRepository("desktopRoutes").findOne({
|
|
65
|
+
filterByTk: String(target.routeId),
|
|
66
|
+
transaction
|
|
67
|
+
});
|
|
68
|
+
if (isPageRoute(route)) {
|
|
69
|
+
return this.resolvePageSchemaUid(route.get("schemaUid"), target, transaction);
|
|
70
|
+
}
|
|
71
|
+
if ((_a = route == null ? void 0 : route.get) == null ? void 0 : _a.call(route, "schemaUid")) {
|
|
72
|
+
return this.resolveByUid(route.get("schemaUid"), target, transaction);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
throw new import_errors.FlowSurfaceBadRequestError("flowSurfaces target not found");
|
|
76
|
+
}
|
|
77
|
+
async findParentUid(uid, transaction) {
|
|
78
|
+
var _a;
|
|
79
|
+
const parentPath = await this.db.getRepository("flowModelTreePath").findOne({
|
|
80
|
+
filter: {
|
|
81
|
+
descendant: uid,
|
|
82
|
+
depth: 1
|
|
83
|
+
},
|
|
84
|
+
transaction
|
|
85
|
+
});
|
|
86
|
+
return ((_a = parentPath == null ? void 0 : parentPath.get) == null ? void 0 : _a.call(parentPath, "ancestor")) || null;
|
|
87
|
+
}
|
|
88
|
+
async findRouteBySchemaUid(schemaUid, transaction) {
|
|
89
|
+
return this.db.getRepository("desktopRoutes").findOne({
|
|
90
|
+
filter: {
|
|
91
|
+
schemaUid
|
|
92
|
+
},
|
|
93
|
+
transaction
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
async resolveCollectionContext(uid, transaction) {
|
|
97
|
+
let cursor = uid;
|
|
98
|
+
while (cursor) {
|
|
99
|
+
const model = await this.repository.findModelById(cursor, { transaction, includeAsyncNode: true });
|
|
100
|
+
const resourceInit = import_lodash.default.get(model, ["stepParams", "resourceSettings", "init"]) || import_lodash.default.get(model, ["stepParams", "TriggerChildPageSettings", "init"]) || import_lodash.default.get(model, ["stepParams", "ApprovalChildPageSettings", "init"]) || ((model == null ? void 0 : model.use) === "ChartBlockModel" ? (0, import_chart_config.getChartBuilderResourceInit)(import_lodash.default.get(model, ["stepParams", "chartSettings", "configure"])) : null);
|
|
101
|
+
if ((resourceInit == null ? void 0 : resourceInit.dataSourceKey) && (resourceInit == null ? void 0 : resourceInit.collectionName)) {
|
|
102
|
+
return {
|
|
103
|
+
ownerUid: cursor,
|
|
104
|
+
model,
|
|
105
|
+
resourceInit
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const fieldInit = import_lodash.default.get(model, ["stepParams", "fieldSettings", "init"]);
|
|
109
|
+
if ((fieldInit == null ? void 0 : fieldInit.dataSourceKey) && (fieldInit == null ? void 0 : fieldInit.collectionName)) {
|
|
110
|
+
return {
|
|
111
|
+
ownerUid: cursor,
|
|
112
|
+
model,
|
|
113
|
+
resourceInit: {
|
|
114
|
+
dataSourceKey: fieldInit.dataSourceKey,
|
|
115
|
+
collectionName: fieldInit.collectionName,
|
|
116
|
+
associationPathName: fieldInit.associationPathName
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
cursor = await this.findParentUid(cursor, transaction);
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
async resolveByUid(uid, target, transaction) {
|
|
125
|
+
var _a, _b, _c, _d, _e;
|
|
126
|
+
const node = await this.repository.findModelById(uid, { transaction, includeAsyncNode: true });
|
|
127
|
+
const route = await this.findRouteBySchemaUid(uid, transaction);
|
|
128
|
+
if (!(node == null ? void 0 : node.uid) && !route) {
|
|
129
|
+
throw new import_errors.FlowSurfaceBadRequestError(`flowSurfaces uid '${uid}' not found`);
|
|
130
|
+
}
|
|
131
|
+
let pageRoute = null;
|
|
132
|
+
let tabRoute = null;
|
|
133
|
+
if (((_a = route == null ? void 0 : route.get) == null ? void 0 : _a.call(route, "type")) === "tabs") {
|
|
134
|
+
tabRoute = route;
|
|
135
|
+
pageRoute = route.get("parentId") ? await this.db.getRepository("desktopRoutes").findOne({
|
|
136
|
+
filterByTk: String(route.get("parentId")),
|
|
137
|
+
transaction
|
|
138
|
+
}) : null;
|
|
139
|
+
} else if (((_b = route == null ? void 0 : route.get) == null ? void 0 : _b.call(route, "type")) === "flowPage" || ((_c = route == null ? void 0 : route.get) == null ? void 0 : _c.call(route, "type")) === "page") {
|
|
140
|
+
pageRoute = route;
|
|
141
|
+
} else if (node == null ? void 0 : node.uid) {
|
|
142
|
+
pageRoute = await this.findPageRouteFromModel(node.uid, transaction).catch(() => {
|
|
143
|
+
return null;
|
|
144
|
+
}) || null;
|
|
145
|
+
tabRoute = await this.findRouteBySchemaUid(node.uid, transaction);
|
|
146
|
+
if (((_d = tabRoute == null ? void 0 : tabRoute.get) == null ? void 0 : _d.call(tabRoute, "type")) !== "tabs") {
|
|
147
|
+
tabRoute = null;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
target,
|
|
152
|
+
uid: (node == null ? void 0 : node.uid) || uid,
|
|
153
|
+
kind: ((_e = tabRoute == null ? void 0 : tabRoute.get) == null ? void 0 : _e.call(tabRoute, "type")) === "tabs" ? "tab" : isPageRoute(pageRoute) ? "page" : inferKind(node == null ? void 0 : node.use),
|
|
154
|
+
node,
|
|
155
|
+
route,
|
|
156
|
+
pageRoute,
|
|
157
|
+
tabRoute
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
async resolvePageSchemaUid(pageSchemaUid, target, transaction) {
|
|
161
|
+
var _a;
|
|
162
|
+
const pageModel = await this.repository.findModelByParentId(pageSchemaUid, {
|
|
163
|
+
transaction,
|
|
164
|
+
subKey: "page",
|
|
165
|
+
includeAsyncNode: true
|
|
166
|
+
});
|
|
167
|
+
const route = await this.db.getRepository("desktopRoutes").findOne({
|
|
168
|
+
filter: {
|
|
169
|
+
schemaUid: pageSchemaUid
|
|
170
|
+
},
|
|
171
|
+
transaction
|
|
172
|
+
});
|
|
173
|
+
if (pageModel == null ? void 0 : pageModel.uid) {
|
|
174
|
+
return {
|
|
175
|
+
target,
|
|
176
|
+
uid: pageModel.uid,
|
|
177
|
+
kind: "page",
|
|
178
|
+
node: pageModel,
|
|
179
|
+
route,
|
|
180
|
+
pageRoute: route,
|
|
181
|
+
pageModel
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
if ((_a = route == null ? void 0 : route.get) == null ? void 0 : _a.call(route, "schemaUid")) {
|
|
185
|
+
return {
|
|
186
|
+
target,
|
|
187
|
+
uid: route.get("schemaUid"),
|
|
188
|
+
kind: "page",
|
|
189
|
+
route,
|
|
190
|
+
pageRoute: route,
|
|
191
|
+
pageModel
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
throw new import_errors.FlowSurfaceBadRequestError("flowSurfaces target not found");
|
|
195
|
+
}
|
|
196
|
+
async findPageRouteFromModel(uid, transaction) {
|
|
197
|
+
var _a, _b;
|
|
198
|
+
let cursor = uid;
|
|
199
|
+
while (cursor) {
|
|
200
|
+
const route = await this.findRouteBySchemaUid(cursor, transaction);
|
|
201
|
+
if (((_a = route == null ? void 0 : route.get) == null ? void 0 : _a.call(route, "type")) === "flowPage" || ((_b = route == null ? void 0 : route.get) == null ? void 0 : _b.call(route, "type")) === "page") {
|
|
202
|
+
return route;
|
|
203
|
+
}
|
|
204
|
+
const parentUid = await this.findParentUid(cursor, transaction);
|
|
205
|
+
if (!parentUid) {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
cursor = parentUid;
|
|
209
|
+
}
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function inferKind(use) {
|
|
214
|
+
const normalized = (0, import_approval.normalizeApprovalSemanticUse)(use);
|
|
215
|
+
if (normalized === "RouteModel") {
|
|
216
|
+
return "node";
|
|
217
|
+
}
|
|
218
|
+
if (normalized === "RootPageModel" || normalized === "ChildPageModel") {
|
|
219
|
+
return "page";
|
|
220
|
+
}
|
|
221
|
+
if (normalized === "RootPageTabModel" || normalized === "ChildPageTabModel") {
|
|
222
|
+
return "tab";
|
|
223
|
+
}
|
|
224
|
+
if (/GridModel$/.test(normalized || "")) {
|
|
225
|
+
return "grid";
|
|
226
|
+
}
|
|
227
|
+
if (/BlockModel$/.test(normalized || "")) {
|
|
228
|
+
return "block";
|
|
229
|
+
}
|
|
230
|
+
return "node";
|
|
231
|
+
}
|
|
232
|
+
function isPageRoute(route) {
|
|
233
|
+
var _a;
|
|
234
|
+
const type = ((_a = route == null ? void 0 : route.get) == null ? void 0 : _a.call(route, "type")) || (route == null ? void 0 : route.type);
|
|
235
|
+
return type === "flowPage" || type === "page";
|
|
236
|
+
}
|
|
237
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
238
|
+
0 && (module.exports = {
|
|
239
|
+
SurfaceLocator
|
|
240
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
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 declare const COLLECTION_BLOCK_USES: Set<string>;
|
|
10
|
+
export declare const STATIC_CONTENT_BLOCK_USES: Set<string>;
|
|
11
|
+
export declare const FIELD_WRAPPER_USES: Set<string>;
|
|
12
|
+
export declare const CREATABLE_STANDALONE_FIELD_USES: Set<string>;
|
|
13
|
+
export declare const STANDALONE_FIELD_NODE_USES: Set<string>;
|
|
14
|
+
export declare const ACTION_BUTTON_USES: Set<string>;
|
|
15
|
+
export declare const JS_BLOCK_USES: Set<string>;
|
|
@@ -0,0 +1,126 @@
|
|
|
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 __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var node_use_sets_exports = {};
|
|
28
|
+
__export(node_use_sets_exports, {
|
|
29
|
+
ACTION_BUTTON_USES: () => ACTION_BUTTON_USES,
|
|
30
|
+
COLLECTION_BLOCK_USES: () => COLLECTION_BLOCK_USES,
|
|
31
|
+
CREATABLE_STANDALONE_FIELD_USES: () => CREATABLE_STANDALONE_FIELD_USES,
|
|
32
|
+
FIELD_WRAPPER_USES: () => FIELD_WRAPPER_USES,
|
|
33
|
+
JS_BLOCK_USES: () => JS_BLOCK_USES,
|
|
34
|
+
STANDALONE_FIELD_NODE_USES: () => STANDALONE_FIELD_NODE_USES,
|
|
35
|
+
STATIC_CONTENT_BLOCK_USES: () => STATIC_CONTENT_BLOCK_USES
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(node_use_sets_exports);
|
|
38
|
+
var import_approval = require("./approval");
|
|
39
|
+
const COLLECTION_BLOCK_USES = /* @__PURE__ */ new Set([
|
|
40
|
+
"TableBlockModel",
|
|
41
|
+
"CreateFormModel",
|
|
42
|
+
"EditFormModel",
|
|
43
|
+
"FormBlockModel",
|
|
44
|
+
"DetailsBlockModel",
|
|
45
|
+
"FilterFormBlockModel",
|
|
46
|
+
"ListBlockModel",
|
|
47
|
+
"GridCardBlockModel",
|
|
48
|
+
"MapBlockModel",
|
|
49
|
+
"CommentsBlockModel",
|
|
50
|
+
...import_approval.APPROVAL_FORM_BLOCK_USES,
|
|
51
|
+
...import_approval.APPROVAL_DETAILS_BLOCK_USES
|
|
52
|
+
]);
|
|
53
|
+
const STATIC_CONTENT_BLOCK_USES = /* @__PURE__ */ new Set([
|
|
54
|
+
"MarkdownBlockModel",
|
|
55
|
+
"IframeBlockModel",
|
|
56
|
+
"ChartBlockModel",
|
|
57
|
+
"ActionPanelBlockModel",
|
|
58
|
+
"JSBlockModel"
|
|
59
|
+
]);
|
|
60
|
+
const FIELD_WRAPPER_USES = /* @__PURE__ */ new Set([
|
|
61
|
+
"FormItemModel",
|
|
62
|
+
"FormAssociationItemModel",
|
|
63
|
+
"DetailsItemModel",
|
|
64
|
+
"FilterFormItemModel",
|
|
65
|
+
"TableColumnModel",
|
|
66
|
+
...import_approval.APPROVAL_FIELD_WRAPPER_USES
|
|
67
|
+
]);
|
|
68
|
+
const CREATABLE_STANDALONE_FIELD_USES = /* @__PURE__ */ new Set(["JSColumnModel", "JSItemModel"]);
|
|
69
|
+
const STANDALONE_FIELD_NODE_USES = /* @__PURE__ */ new Set([...CREATABLE_STANDALONE_FIELD_USES, "FormJSFieldItemModel"]);
|
|
70
|
+
const ACTION_BUTTON_USES = /* @__PURE__ */ new Set([
|
|
71
|
+
"AddNewActionModel",
|
|
72
|
+
"ViewActionModel",
|
|
73
|
+
"EditActionModel",
|
|
74
|
+
"PopupCollectionActionModel",
|
|
75
|
+
"DeleteActionModel",
|
|
76
|
+
"BulkDeleteActionModel",
|
|
77
|
+
"BulkEditActionModel",
|
|
78
|
+
"UpdateRecordActionModel",
|
|
79
|
+
"BulkUpdateActionModel",
|
|
80
|
+
"DuplicateActionModel",
|
|
81
|
+
"AddChildActionModel",
|
|
82
|
+
"FilterActionModel",
|
|
83
|
+
"ExpandCollapseActionModel",
|
|
84
|
+
"FormSubmitActionModel",
|
|
85
|
+
"FilterFormSubmitActionModel",
|
|
86
|
+
"FilterFormResetActionModel",
|
|
87
|
+
"FilterFormCollapseActionModel",
|
|
88
|
+
"RefreshActionModel",
|
|
89
|
+
"LinkActionModel",
|
|
90
|
+
"ExportActionModel",
|
|
91
|
+
"ExportAttachmentActionModel",
|
|
92
|
+
"ImportActionModel",
|
|
93
|
+
"UploadActionModel",
|
|
94
|
+
"TemplatePrintCollectionActionModel",
|
|
95
|
+
"TemplatePrintRecordActionModel",
|
|
96
|
+
"CollectionTriggerWorkflowActionModel",
|
|
97
|
+
"RecordTriggerWorkflowActionModel",
|
|
98
|
+
"FormTriggerWorkflowActionModel",
|
|
99
|
+
"WorkbenchTriggerWorkflowActionModel",
|
|
100
|
+
"MailSendActionModel",
|
|
101
|
+
"JSCollectionActionModel",
|
|
102
|
+
"JSRecordActionModel",
|
|
103
|
+
"JSFormActionModel",
|
|
104
|
+
"JSItemActionModel",
|
|
105
|
+
"FilterFormJSActionModel",
|
|
106
|
+
"JSActionModel",
|
|
107
|
+
"ApplyFormSubmitModel",
|
|
108
|
+
"ApplyFormSaveDraftModel",
|
|
109
|
+
"ApplyFormWithdrawModel",
|
|
110
|
+
"ProcessFormApproveModel",
|
|
111
|
+
"ProcessFormRejectModel",
|
|
112
|
+
"ProcessFormReturnModel",
|
|
113
|
+
"ProcessFormDelegateModel",
|
|
114
|
+
"ProcessFormAddAssigneeModel"
|
|
115
|
+
]);
|
|
116
|
+
const JS_BLOCK_USES = /* @__PURE__ */ new Set(["JSBlockModel"]);
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
ACTION_BUTTON_USES,
|
|
120
|
+
COLLECTION_BLOCK_USES,
|
|
121
|
+
CREATABLE_STANDALONE_FIELD_USES,
|
|
122
|
+
FIELD_WRAPPER_USES,
|
|
123
|
+
JS_BLOCK_USES,
|
|
124
|
+
STANDALONE_FIELD_NODE_USES,
|
|
125
|
+
STATIC_CONTENT_BLOCK_USES
|
|
126
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
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 declare function validateFlowSurfacePayloadShape(actionName: string, value: any, path: string): void;
|
|
@@ -0,0 +1,61 @@
|
|
|
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 payload_shape_exports = {};
|
|
38
|
+
__export(payload_shape_exports, {
|
|
39
|
+
validateFlowSurfacePayloadShape: () => validateFlowSurfacePayloadShape
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(payload_shape_exports);
|
|
42
|
+
var import_lodash = __toESM(require("lodash"));
|
|
43
|
+
var import_errors = require("./errors");
|
|
44
|
+
var import_key_registry = require("./planning/key-registry");
|
|
45
|
+
function validateFlowSurfacePayloadShape(actionName, value, path) {
|
|
46
|
+
if (Array.isArray(value)) {
|
|
47
|
+
value.forEach((item, index) => validateFlowSurfacePayloadShape(actionName, item, `${path}[${index}]`));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (!import_lodash.default.isPlainObject(value)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (import_lodash.default.isPlainObject(value.stepParams) && Object.prototype.hasOwnProperty.call(value.stepParams, import_key_registry.FLOW_SURFACE_INTERNAL_META_KEY)) {
|
|
54
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} ${path}.stepParams.${import_key_registry.FLOW_SURFACE_INTERNAL_META_KEY} is reserved`);
|
|
55
|
+
}
|
|
56
|
+
Object.entries(value).forEach(([key, child]) => validateFlowSurfacePayloadShape(actionName, child, `${path}.${key}`));
|
|
57
|
+
}
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
validateFlowSurfacePayloadShape
|
|
61
|
+
});
|