@nocobase/plugin-flow-engine 2.1.0-beta.2 → 2.1.0-beta.21
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 +971 -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-interfaces.d.ts +10 -0
- package/dist/server/flow-surfaces/association-interfaces.js +39 -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 +1074 -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 +201 -0
- package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
- package/dist/server/flow-surfaces/builder.d.ts +237 -0
- package/dist/server/flow-surfaces/builder.js +1129 -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 +79 -0
- package/dist/server/flow-surfaces/catalog.js +3693 -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 +116 -0
- package/dist/server/flow-surfaces/compose-compiler.js +175 -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 +893 -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 +24 -0
- package/dist/server/flow-surfaces/field-binding-registry.js +396 -0
- package/dist/server/flow-surfaces/field-semantics.d.ts +15 -0
- package/dist/server/flow-surfaces/field-semantics.js +84 -0
- package/dist/server/flow-surfaces/field-type-resolver.d.ts +46 -0
- package/dist/server/flow-surfaces/field-type-resolver.js +322 -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 +135 -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 +120 -0
- package/dist/server/flow-surfaces/service-utils.js +863 -0
- package/dist/server/flow-surfaces/service.d.ts +830 -0
- package/dist/server/flow-surfaces/service.js +15043 -0
- package/dist/server/flow-surfaces/support-matrix.d.ts +31 -0
- package/dist/server/flow-surfaces/support-matrix.js +282 -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 +6135 -0
- package/dist/swagger/flow-surfaces.examples.d.ts +1577 -0
- package/dist/swagger/flow-surfaces.examples.js +1816 -0
- package/dist/swagger/flow-surfaces.js +5384 -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 +6140 -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,181 @@
|
|
|
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 field_value_exports = {};
|
|
38
|
+
__export(field_value_exports, {
|
|
39
|
+
assertFieldValueTargetSupported: () => assertFieldValueTargetSupported,
|
|
40
|
+
buildFieldValueWriteResult: () => buildFieldValueWriteResult,
|
|
41
|
+
collectUpdateAssociationValuesFromFieldValueRules: () => collectUpdateAssociationValuesFromFieldValueRules,
|
|
42
|
+
compileFieldValueRulesToCanonical: () => compileFieldValueRulesToCanonical,
|
|
43
|
+
isFieldValueTargetUseSupported: () => isFieldValueTargetUseSupported,
|
|
44
|
+
normalizeFieldValueRules: () => normalizeFieldValueRules
|
|
45
|
+
});
|
|
46
|
+
module.exports = __toCommonJS(field_value_exports);
|
|
47
|
+
var import_lodash = __toESM(require("lodash"));
|
|
48
|
+
var import_errors = require("../errors");
|
|
49
|
+
var import_errors2 = require("./errors");
|
|
50
|
+
var import_fingerprint = require("./fingerprint");
|
|
51
|
+
var import_registry = require("./registry");
|
|
52
|
+
var import_value_expr = require("./value-expr");
|
|
53
|
+
const FLOW_SURFACE_FIELD_VALUE_SUPPORTED_USES = /* @__PURE__ */ new Set(["CreateFormModel", "EditFormModel"]);
|
|
54
|
+
const FLOW_SURFACE_FIELD_VALUE_SCENE = "form";
|
|
55
|
+
const FLOW_SURFACE_FIELD_VALUE_SLOT = (0, import_registry.getReactionSlot)(
|
|
56
|
+
"fieldValue",
|
|
57
|
+
FLOW_SURFACE_FIELD_VALUE_SCENE
|
|
58
|
+
);
|
|
59
|
+
function isFieldValueTargetUseSupported(use) {
|
|
60
|
+
return FLOW_SURFACE_FIELD_VALUE_SUPPORTED_USES.has(String(use || "").trim());
|
|
61
|
+
}
|
|
62
|
+
function assertFieldValueTargetSupported(target) {
|
|
63
|
+
if (isFieldValueTargetUseSupported(target == null ? void 0 : target.use)) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const label = (target == null ? void 0 : target.publicPath) || (target == null ? void 0 : target.uid) || "target";
|
|
67
|
+
(0, import_errors.throwBadRequest)(
|
|
68
|
+
`flowSurfaces field value rules only support createForm/editForm targets; got '${label}' (${(target == null ? void 0 : target.use) || "unknown"})`,
|
|
69
|
+
import_errors2.FLOW_SURFACE_REACTION_FORM_ONLY
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
function normalizeFieldValueRule(rule, index) {
|
|
73
|
+
const current = import_lodash.default.isPlainObject(rule) ? rule : {};
|
|
74
|
+
const key = String(current.key || `idx:${index}`).trim();
|
|
75
|
+
return {
|
|
76
|
+
...key ? { key } : {},
|
|
77
|
+
enabled: current.enabled !== false,
|
|
78
|
+
targetPath: (0, import_value_expr.normalizeReactionPath)(current.targetPath, `rules[${index}].targetPath`),
|
|
79
|
+
mode: current.mode === "default" ? "default" : "assign",
|
|
80
|
+
when: (0, import_value_expr.normalizeReactionFilter)(current.when),
|
|
81
|
+
value: (0, import_value_expr.normalizeReactionValueExpr)(current.value)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function normalizeFieldValueRules(rules) {
|
|
85
|
+
const list = Array.isArray(rules) ? rules : [];
|
|
86
|
+
return list.map((rule, index) => normalizeFieldValueRule(rule, index));
|
|
87
|
+
}
|
|
88
|
+
function compileFieldValueRulesToCanonical(rules) {
|
|
89
|
+
return normalizeFieldValueRules(rules).map((rule) => ({
|
|
90
|
+
key: rule.key,
|
|
91
|
+
enable: rule.enabled !== false,
|
|
92
|
+
targetPath: rule.targetPath,
|
|
93
|
+
mode: rule.mode === "default" ? "default" : "assign",
|
|
94
|
+
condition: (0, import_value_expr.compileReactionFilter)(rule.when),
|
|
95
|
+
value: (0, import_value_expr.compileReactionValueExpr)(rule.value)
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
function collectUpdateAssociationValuesFromFieldValueRules(items, rootCollection) {
|
|
99
|
+
const list = Array.isArray(items) ? items : [];
|
|
100
|
+
const output = /* @__PURE__ */ new Set();
|
|
101
|
+
const getDeepestAssociationPath = (targetPath) => {
|
|
102
|
+
var _a, _b, _c;
|
|
103
|
+
if (!rootCollection || typeof rootCollection.getField !== "function") return null;
|
|
104
|
+
if (typeof targetPath !== "string" || !targetPath.includes(".")) return null;
|
|
105
|
+
const segments = targetPath.split(".").filter(Boolean);
|
|
106
|
+
if (segments.length < 2) return null;
|
|
107
|
+
let currentCollection = rootCollection;
|
|
108
|
+
const associationSegments = [];
|
|
109
|
+
let deepest = null;
|
|
110
|
+
let deepestField = null;
|
|
111
|
+
for (let index = 0; index < segments.length - 1; index += 1) {
|
|
112
|
+
const segment = segments[index];
|
|
113
|
+
const field = (_a = currentCollection == null ? void 0 : currentCollection.getField) == null ? void 0 : _a.call(currentCollection, segment);
|
|
114
|
+
if (!((_b = field == null ? void 0 : field.isAssociationField) == null ? void 0 : _b.call(field)) || !(field == null ? void 0 : field.targetCollection)) break;
|
|
115
|
+
associationSegments.push(segment);
|
|
116
|
+
deepest = associationSegments.join(".");
|
|
117
|
+
deepestField = field;
|
|
118
|
+
currentCollection = field.targetCollection;
|
|
119
|
+
}
|
|
120
|
+
if (deepest && deepestField) {
|
|
121
|
+
const leaf = segments[segments.length - 1];
|
|
122
|
+
const rawKey = (deepestField == null ? void 0 : deepestField.targetKey) ?? ((_c = deepestField == null ? void 0 : deepestField.targetCollection) == null ? void 0 : _c.filterTargetKey) ?? "id";
|
|
123
|
+
const keyFields = Array.isArray(rawKey) ? rawKey.filter((value) => typeof value === "string" && !!value) : typeof rawKey === "string" && rawKey ? [rawKey] : ["id"];
|
|
124
|
+
if (typeof leaf === "string" && keyFields.includes(leaf)) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return deepest;
|
|
129
|
+
};
|
|
130
|
+
for (const item of list) {
|
|
131
|
+
const targetPath = typeof (item == null ? void 0 : item.targetPath) === "string" ? item.targetPath : "";
|
|
132
|
+
if (!targetPath) continue;
|
|
133
|
+
const associationPath = getDeepestAssociationPath(targetPath);
|
|
134
|
+
if (associationPath) {
|
|
135
|
+
output.add(associationPath);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return Array.from(output);
|
|
139
|
+
}
|
|
140
|
+
function buildFieldValueWriteResult(params) {
|
|
141
|
+
assertFieldValueTargetSupported(params.target);
|
|
142
|
+
const normalizedRules = normalizeFieldValueRules(params.rules);
|
|
143
|
+
const canonicalRules = normalizedRules.map((rule) => ({
|
|
144
|
+
key: rule.key,
|
|
145
|
+
enable: rule.enabled !== false,
|
|
146
|
+
targetPath: rule.targetPath,
|
|
147
|
+
mode: rule.mode,
|
|
148
|
+
condition: (0, import_value_expr.compileReactionFilter)(rule.when),
|
|
149
|
+
value: (0, import_value_expr.compileReactionValueExpr)(rule.value)
|
|
150
|
+
}));
|
|
151
|
+
const fingerprint = (0, import_fingerprint.buildReactionFingerprint)({
|
|
152
|
+
kind: "fieldValue",
|
|
153
|
+
scene: FLOW_SURFACE_FIELD_VALUE_SCENE,
|
|
154
|
+
slot: FLOW_SURFACE_FIELD_VALUE_SLOT,
|
|
155
|
+
canonicalRules
|
|
156
|
+
});
|
|
157
|
+
return {
|
|
158
|
+
target: {
|
|
159
|
+
uid: params.target.uid,
|
|
160
|
+
...params.target.publicPath ? { publicPath: params.target.publicPath } : {}
|
|
161
|
+
},
|
|
162
|
+
resolvedScene: FLOW_SURFACE_FIELD_VALUE_SCENE,
|
|
163
|
+
resolvedSlot: FLOW_SURFACE_FIELD_VALUE_SLOT,
|
|
164
|
+
fingerprint,
|
|
165
|
+
normalizedRules,
|
|
166
|
+
canonicalRules,
|
|
167
|
+
updateAssociationValues: collectUpdateAssociationValuesFromFieldValueRules(
|
|
168
|
+
canonicalRules,
|
|
169
|
+
params.target.collection
|
|
170
|
+
)
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
174
|
+
0 && (module.exports = {
|
|
175
|
+
assertFieldValueTargetSupported,
|
|
176
|
+
buildFieldValueWriteResult,
|
|
177
|
+
collectUpdateAssociationValuesFromFieldValueRules,
|
|
178
|
+
compileFieldValueRulesToCanonical,
|
|
179
|
+
isFieldValueTargetUseSupported,
|
|
180
|
+
normalizeFieldValueRules
|
|
181
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { FlowSurfaceReactionKind, FlowSurfaceReactionScene, FlowSurfaceReactionSlot } from './types';
|
|
10
|
+
export declare function buildReactionStableFingerprintString(value: any): string;
|
|
11
|
+
export declare function buildReactionFingerprint(params: {
|
|
12
|
+
kind: FlowSurfaceReactionKind;
|
|
13
|
+
scene: FlowSurfaceReactionScene;
|
|
14
|
+
slot: FlowSurfaceReactionSlot;
|
|
15
|
+
canonicalRules: any[];
|
|
16
|
+
}): string;
|
|
@@ -0,0 +1,71 @@
|
|
|
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 fingerprint_exports = {};
|
|
38
|
+
__export(fingerprint_exports, {
|
|
39
|
+
buildReactionFingerprint: () => buildReactionFingerprint,
|
|
40
|
+
buildReactionStableFingerprintString: () => buildReactionStableFingerprintString
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(fingerprint_exports);
|
|
43
|
+
var import_crypto = require("crypto");
|
|
44
|
+
var import_lodash = __toESM(require("lodash"));
|
|
45
|
+
function buildReactionStableFingerprintString(value) {
|
|
46
|
+
if (import_lodash.default.isNil(value)) {
|
|
47
|
+
return "null";
|
|
48
|
+
}
|
|
49
|
+
if (Array.isArray(value)) {
|
|
50
|
+
return `[${value.map((item) => buildReactionStableFingerprintString(item)).join(",")}]`;
|
|
51
|
+
}
|
|
52
|
+
if (import_lodash.default.isPlainObject(value)) {
|
|
53
|
+
const entries = Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${buildReactionStableFingerprintString(value[key])}`);
|
|
54
|
+
return `{${entries.join(",")}}`;
|
|
55
|
+
}
|
|
56
|
+
return JSON.stringify(value);
|
|
57
|
+
}
|
|
58
|
+
function buildReactionFingerprint(params) {
|
|
59
|
+
const payload = {
|
|
60
|
+
kind: params.kind,
|
|
61
|
+
scene: params.scene,
|
|
62
|
+
slot: params.slot,
|
|
63
|
+
canonicalRules: Array.isArray(params.canonicalRules) ? params.canonicalRules : []
|
|
64
|
+
};
|
|
65
|
+
return (0, import_crypto.createHash)("sha1").update(buildReactionStableFingerprintString(payload)).digest("hex");
|
|
66
|
+
}
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
69
|
+
buildReactionFingerprint,
|
|
70
|
+
buildReactionStableFingerprintString
|
|
71
|
+
});
|
|
@@ -0,0 +1,136 @@
|
|
|
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 { FlowSurfaceActionLinkageRule, FlowSurfaceFieldLinkageRule, FlowSurfaceFieldLinkageScene, FlowSurfaceFieldOption, FlowSurfaceFieldPathToUidResolver, FlowSurfaceFieldUidToPathResolver, FlowSurfaceBlockLinkageRule } from './types';
|
|
10
|
+
type NormalizeFieldRuleOptions = {
|
|
11
|
+
scene: FlowSurfaceFieldLinkageScene;
|
|
12
|
+
resolveFieldPath?: FlowSurfaceFieldUidToPathResolver;
|
|
13
|
+
};
|
|
14
|
+
type CompileFieldRuleOptions = {
|
|
15
|
+
scene: FlowSurfaceFieldLinkageScene;
|
|
16
|
+
resolveFieldUid?: FlowSurfaceFieldPathToUidResolver;
|
|
17
|
+
};
|
|
18
|
+
type FlowSurfaceLinkageValidationCapability = {
|
|
19
|
+
conditionMeta: {
|
|
20
|
+
operatorsByPath: Record<string, string[]>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
type FlowSurfaceFieldLinkageValidationCapability = FlowSurfaceLinkageValidationCapability & {
|
|
24
|
+
targetFields: FlowSurfaceFieldOption[];
|
|
25
|
+
valueExprMeta?: {
|
|
26
|
+
supportedSources: Array<'literal' | 'path' | 'runjs'>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare function buildReactionFingerprint(value: any): string;
|
|
30
|
+
export declare function normalizeBlockLinkageRules(rawRules: unknown): FlowSurfaceBlockLinkageRule[];
|
|
31
|
+
export declare function normalizeActionLinkageRules(rawRules: unknown): FlowSurfaceActionLinkageRule[];
|
|
32
|
+
export declare function normalizeFieldLinkageRules(rawRules: unknown, options: NormalizeFieldRuleOptions): FlowSurfaceFieldLinkageRule[];
|
|
33
|
+
export declare function validateBlockLinkageSceneSupport(scene: string, rules?: FlowSurfaceBlockLinkageRule[]): void;
|
|
34
|
+
export declare function validateBlockLinkageRulesAgainstCapability(rules: FlowSurfaceBlockLinkageRule[], capability: FlowSurfaceLinkageValidationCapability): void;
|
|
35
|
+
export declare function validateActionLinkageSceneSupport(scene: string, rules?: FlowSurfaceActionLinkageRule[]): void;
|
|
36
|
+
export declare function validateActionLinkageRulesAgainstCapability(rules: FlowSurfaceActionLinkageRule[], capability: FlowSurfaceLinkageValidationCapability): void;
|
|
37
|
+
export declare function validateFieldLinkageSceneSupport(scene: FlowSurfaceFieldLinkageScene, rules?: FlowSurfaceFieldLinkageRule[]): void;
|
|
38
|
+
export declare function validateFieldLinkageRulesAgainstCapability(rules: FlowSurfaceFieldLinkageRule[], capability: FlowSurfaceFieldLinkageValidationCapability): void;
|
|
39
|
+
export declare function compileBlockLinkageCanonicalRules(rules: FlowSurfaceBlockLinkageRule[]): {
|
|
40
|
+
key: string;
|
|
41
|
+
title: string;
|
|
42
|
+
enable: boolean;
|
|
43
|
+
condition: any;
|
|
44
|
+
actions: ({
|
|
45
|
+
key: string;
|
|
46
|
+
name: "linkageSetBlockProps";
|
|
47
|
+
params: {
|
|
48
|
+
value: "visible" | "hidden";
|
|
49
|
+
};
|
|
50
|
+
} | {
|
|
51
|
+
key: string;
|
|
52
|
+
name: "linkageRunjs";
|
|
53
|
+
params: {
|
|
54
|
+
value: {
|
|
55
|
+
version?: "v2" | "v1";
|
|
56
|
+
script: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
})[];
|
|
60
|
+
}[];
|
|
61
|
+
export declare function compileActionLinkageCanonicalRules(rules: FlowSurfaceActionLinkageRule[]): {
|
|
62
|
+
key: string;
|
|
63
|
+
title: string;
|
|
64
|
+
enable: boolean;
|
|
65
|
+
condition: any;
|
|
66
|
+
actions: ({
|
|
67
|
+
key: string;
|
|
68
|
+
name: "linkageSetActionProps";
|
|
69
|
+
params: {
|
|
70
|
+
value: "disabled" | "visible" | "hidden" | "hiddenText" | "enabled";
|
|
71
|
+
};
|
|
72
|
+
} | {
|
|
73
|
+
key: string;
|
|
74
|
+
name: "linkageRunjs";
|
|
75
|
+
params: {
|
|
76
|
+
value: {
|
|
77
|
+
version?: "v2" | "v1";
|
|
78
|
+
script: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
})[];
|
|
82
|
+
}[];
|
|
83
|
+
export declare function compileFieldLinkageCanonicalRules(rules: FlowSurfaceFieldLinkageRule[], options: CompileFieldRuleOptions): {
|
|
84
|
+
key: string;
|
|
85
|
+
title: string;
|
|
86
|
+
enable: boolean;
|
|
87
|
+
condition: any;
|
|
88
|
+
actions: ({
|
|
89
|
+
key: string;
|
|
90
|
+
name: "linkageSetFieldProps" | "linkageSetDetailsFieldProps" | "subFormLinkageSetFieldProps";
|
|
91
|
+
params: {
|
|
92
|
+
value: {
|
|
93
|
+
fields: string[];
|
|
94
|
+
state: "disabled" | "required" | "visible" | "hidden" | "enabled" | "hiddenReservedValue" | "notRequired";
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
} | {
|
|
98
|
+
key: string;
|
|
99
|
+
name: "linkageAssignField" | "subFormLinkageAssignField";
|
|
100
|
+
params: {
|
|
101
|
+
value: {
|
|
102
|
+
key: string;
|
|
103
|
+
enable: boolean;
|
|
104
|
+
targetPath: string;
|
|
105
|
+
mode: "default" | "assign";
|
|
106
|
+
condition: any;
|
|
107
|
+
value: any;
|
|
108
|
+
}[];
|
|
109
|
+
};
|
|
110
|
+
} | {
|
|
111
|
+
key: string;
|
|
112
|
+
name: "setFieldsDefaultValue";
|
|
113
|
+
params: {
|
|
114
|
+
value: {
|
|
115
|
+
key: string;
|
|
116
|
+
enable: boolean;
|
|
117
|
+
targetPath: string;
|
|
118
|
+
mode: "default" | "assign";
|
|
119
|
+
condition: any;
|
|
120
|
+
value: any;
|
|
121
|
+
}[];
|
|
122
|
+
};
|
|
123
|
+
} | {
|
|
124
|
+
key: string;
|
|
125
|
+
name: "linkageRunjs";
|
|
126
|
+
params: {
|
|
127
|
+
value: {
|
|
128
|
+
version?: "v2" | "v1";
|
|
129
|
+
script: string;
|
|
130
|
+
fields?: undefined;
|
|
131
|
+
state?: undefined;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
})[];
|
|
135
|
+
}[];
|
|
136
|
+
export {};
|