@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,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import _ from 'lodash';
|
|
10
|
+
import type { FlowSurfaceWriteTarget } from './types';
|
|
11
|
+
export type FlowSurfaceTemplateRow = {
|
|
12
|
+
uid: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
targetUid?: string;
|
|
16
|
+
useModel?: string;
|
|
17
|
+
type?: string;
|
|
18
|
+
dataSourceKey?: string;
|
|
19
|
+
collectionName?: string;
|
|
20
|
+
associationName?: string;
|
|
21
|
+
filterByTk?: string;
|
|
22
|
+
sourceId?: string;
|
|
23
|
+
usageCount?: number;
|
|
24
|
+
available?: boolean;
|
|
25
|
+
disabledReason?: string;
|
|
26
|
+
};
|
|
27
|
+
export type FlowSurfaceTemplateListValues = {
|
|
28
|
+
search?: string;
|
|
29
|
+
filter?: Record<string, any>;
|
|
30
|
+
sort?: string | string[];
|
|
31
|
+
page?: number;
|
|
32
|
+
pageSize?: number;
|
|
33
|
+
target?: FlowSurfaceWriteTarget;
|
|
34
|
+
type?: 'block' | 'popup';
|
|
35
|
+
usage?: 'block' | 'fields';
|
|
36
|
+
actionType?: string;
|
|
37
|
+
actionScope?: 'block' | 'record';
|
|
38
|
+
};
|
|
39
|
+
export type FlowSurfaceTemplateListPopupActionContext = {
|
|
40
|
+
hasCurrentRecord?: boolean;
|
|
41
|
+
};
|
|
42
|
+
export declare const FLOW_TEMPLATE_SUPPORTED_TYPES: Set<string>;
|
|
43
|
+
export declare const FLOW_TEMPLATE_SUPPORTED_MODES: Set<string>;
|
|
44
|
+
export declare const FLOW_TEMPLATE_BLOCK_USAGES: Set<string>;
|
|
45
|
+
export declare const FLOW_TEMPLATE_UNSUPPORTED_BLOCK_TEMPLATE_SOURCE_USES: Set<string>;
|
|
46
|
+
export declare const POPUP_HOST_STEP_PARAM_PATHS: readonly [readonly ["popupSettings", "openView"], readonly ["selectExitRecordSettings", "openView"], readonly ["openSelectRecordView", "openView"], readonly ["openAddRecordView", "openView"]];
|
|
47
|
+
export declare function normalizeTemplateUidValue(actionName: string, values: Record<string, any>): string;
|
|
48
|
+
export declare function normalizeRequiredTemplateString(actionName: string, value: any, field: string): string;
|
|
49
|
+
export declare function normalizeTemplateSaveMode(actionName: string, value: any): "duplicate" | "convert";
|
|
50
|
+
export declare function buildTemplateListFilter(existingFilter: any, search: any, requestedType?: 'block' | 'popup'): any;
|
|
51
|
+
export declare function findFlowTemplateOpenViewStep(node: any): {
|
|
52
|
+
flowKey: "popupSettings" | "selectExitRecordSettings" | "openSelectRecordView" | "openAddRecordView";
|
|
53
|
+
stepKey: "openView";
|
|
54
|
+
openView: any;
|
|
55
|
+
};
|
|
56
|
+
export declare function buildFlowTemplateReferenceBlockStepParams(template: FlowSurfaceTemplateRow, templateTargetUid: string, resourceInit?: Record<string, any>): _.Dictionary<any>;
|
|
57
|
+
export declare function collectFlowTemplateUsageMapFromModelOptions(modelUid: string, options: any, carry?: Map<string, Set<string>>): Map<string, Set<string>>;
|
|
58
|
+
export declare function collectFlowTemplateModelUids(node: any, carry?: Set<string>): Set<string>;
|
|
59
|
+
export declare function replaceFlowModelTreeUids(node: any, uidMap: Record<string, string>): any;
|
|
60
|
+
export declare function stripTemplateInternalOpenViewFields(openView: any): any;
|
|
61
|
+
export declare function stripTemplateInternalReferenceSettings(node: any): void;
|
|
62
|
+
export declare function findFieldsTemplateReferenceGrid(node: any): import("./types").FlowSurfaceNodeSpec;
|
|
@@ -0,0 +1,281 @@
|
|
|
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_service_utils_exports = {};
|
|
38
|
+
__export(template_service_utils_exports, {
|
|
39
|
+
FLOW_TEMPLATE_BLOCK_USAGES: () => FLOW_TEMPLATE_BLOCK_USAGES,
|
|
40
|
+
FLOW_TEMPLATE_SUPPORTED_MODES: () => FLOW_TEMPLATE_SUPPORTED_MODES,
|
|
41
|
+
FLOW_TEMPLATE_SUPPORTED_TYPES: () => FLOW_TEMPLATE_SUPPORTED_TYPES,
|
|
42
|
+
FLOW_TEMPLATE_UNSUPPORTED_BLOCK_TEMPLATE_SOURCE_USES: () => FLOW_TEMPLATE_UNSUPPORTED_BLOCK_TEMPLATE_SOURCE_USES,
|
|
43
|
+
POPUP_HOST_STEP_PARAM_PATHS: () => POPUP_HOST_STEP_PARAM_PATHS,
|
|
44
|
+
buildFlowTemplateReferenceBlockStepParams: () => buildFlowTemplateReferenceBlockStepParams,
|
|
45
|
+
buildTemplateListFilter: () => buildTemplateListFilter,
|
|
46
|
+
collectFlowTemplateModelUids: () => collectFlowTemplateModelUids,
|
|
47
|
+
collectFlowTemplateUsageMapFromModelOptions: () => collectFlowTemplateUsageMapFromModelOptions,
|
|
48
|
+
findFieldsTemplateReferenceGrid: () => findFieldsTemplateReferenceGrid,
|
|
49
|
+
findFlowTemplateOpenViewStep: () => findFlowTemplateOpenViewStep,
|
|
50
|
+
normalizeRequiredTemplateString: () => normalizeRequiredTemplateString,
|
|
51
|
+
normalizeTemplateSaveMode: () => normalizeTemplateSaveMode,
|
|
52
|
+
normalizeTemplateUidValue: () => normalizeTemplateUidValue,
|
|
53
|
+
replaceFlowModelTreeUids: () => replaceFlowModelTreeUids,
|
|
54
|
+
stripTemplateInternalOpenViewFields: () => stripTemplateInternalOpenViewFields,
|
|
55
|
+
stripTemplateInternalReferenceSettings: () => stripTemplateInternalReferenceSettings
|
|
56
|
+
});
|
|
57
|
+
module.exports = __toCommonJS(template_service_utils_exports);
|
|
58
|
+
var import_lodash = __toESM(require("lodash"));
|
|
59
|
+
var import_service_helpers = require("./service-helpers");
|
|
60
|
+
var import_service_utils = require("./service-utils");
|
|
61
|
+
var import_errors = require("./errors");
|
|
62
|
+
const FLOW_TEMPLATE_SUPPORTED_TYPES = /* @__PURE__ */ new Set(["block", "popup"]);
|
|
63
|
+
const FLOW_TEMPLATE_SUPPORTED_MODES = /* @__PURE__ */ new Set(["reference", "copy"]);
|
|
64
|
+
const FLOW_TEMPLATE_BLOCK_USAGES = /* @__PURE__ */ new Set(["block", "fields"]);
|
|
65
|
+
const FLOW_TEMPLATE_UNSUPPORTED_BLOCK_TEMPLATE_SOURCE_USES = /* @__PURE__ */ new Set([
|
|
66
|
+
"ApplyTaskCardDetailsModel",
|
|
67
|
+
"ApprovalTaskCardDetailsModel"
|
|
68
|
+
]);
|
|
69
|
+
const POPUP_HOST_STEP_PARAM_PATHS = [
|
|
70
|
+
["popupSettings", "openView"],
|
|
71
|
+
["selectExitRecordSettings", "openView"],
|
|
72
|
+
["openSelectRecordView", "openView"],
|
|
73
|
+
["openAddRecordView", "openView"]
|
|
74
|
+
];
|
|
75
|
+
function normalizeTemplateUidValue(actionName, values) {
|
|
76
|
+
const templateUid = String((values == null ? void 0 : values.filterByTk) || (values == null ? void 0 : values.uid) || "").trim();
|
|
77
|
+
if (!templateUid) {
|
|
78
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} template uid is required`, "FLOW_SURFACE_TEMPLATE_UID_REQUIRED");
|
|
79
|
+
}
|
|
80
|
+
return templateUid;
|
|
81
|
+
}
|
|
82
|
+
function normalizeRequiredTemplateString(actionName, value, field) {
|
|
83
|
+
const normalized = String(value || "").trim();
|
|
84
|
+
if (!normalized) {
|
|
85
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} ${field} is required`, "FLOW_SURFACE_TEMPLATE_REQUIRED_FIELD");
|
|
86
|
+
}
|
|
87
|
+
return normalized;
|
|
88
|
+
}
|
|
89
|
+
function normalizeTemplateSaveMode(actionName, value) {
|
|
90
|
+
const normalized = String(value || "duplicate").trim() || "duplicate";
|
|
91
|
+
if (normalized !== "duplicate" && normalized !== "convert") {
|
|
92
|
+
(0, import_errors.throwBadRequest)(
|
|
93
|
+
`flowSurfaces ${actionName} saveMode only supports 'duplicate' or 'convert'`,
|
|
94
|
+
"FLOW_SURFACE_TEMPLATE_SAVE_MODE_UNSUPPORTED"
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return normalized;
|
|
98
|
+
}
|
|
99
|
+
function buildTemplateListFilter(existingFilter, search, requestedType) {
|
|
100
|
+
const typeFilter = requestedType ? { type: requestedType } : void 0;
|
|
101
|
+
return (0, import_service_helpers.buildFlowTemplateSearchFilter)(
|
|
102
|
+
existingFilter && typeFilter ? { $and: [existingFilter, typeFilter] } : existingFilter || typeFilter,
|
|
103
|
+
search
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
function findFlowTemplateOpenViewStep(node) {
|
|
107
|
+
for (const [flowKey, stepKey] of POPUP_HOST_STEP_PARAM_PATHS) {
|
|
108
|
+
const openView = import_lodash.default.get(node, ["stepParams", flowKey, stepKey]);
|
|
109
|
+
if (import_lodash.default.isPlainObject(openView)) {
|
|
110
|
+
return {
|
|
111
|
+
flowKey,
|
|
112
|
+
stepKey,
|
|
113
|
+
openView
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
function buildFlowTemplateReferenceBlockStepParams(template, templateTargetUid, resourceInit) {
|
|
120
|
+
const normalizedResourceInit = (0, import_service_utils.buildDefinedPayload)(resourceInit || {});
|
|
121
|
+
return (0, import_service_utils.buildDefinedPayload)({
|
|
122
|
+
referenceSettings: {
|
|
123
|
+
target: {
|
|
124
|
+
targetUid: templateTargetUid,
|
|
125
|
+
mode: "reference"
|
|
126
|
+
},
|
|
127
|
+
useTemplate: {
|
|
128
|
+
templateUid: template.uid,
|
|
129
|
+
templateName: template.name,
|
|
130
|
+
templateDescription: template.description,
|
|
131
|
+
targetUid: templateTargetUid,
|
|
132
|
+
mode: "reference"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
...Object.keys(normalizedResourceInit).length ? {
|
|
136
|
+
resourceSettings: {
|
|
137
|
+
init: normalizedResourceInit
|
|
138
|
+
}
|
|
139
|
+
} : {}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function collectFlowTemplateUsageMapFromModelOptions(modelUid, options, carry = /* @__PURE__ */ new Map()) {
|
|
143
|
+
const normalizedModelUid = String(modelUid || "").trim();
|
|
144
|
+
if (!normalizedModelUid) {
|
|
145
|
+
return carry;
|
|
146
|
+
}
|
|
147
|
+
const addUsage = (templateUid) => {
|
|
148
|
+
var _a;
|
|
149
|
+
const normalizedTemplateUid = String(templateUid || "").trim();
|
|
150
|
+
if (!normalizedTemplateUid) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (!carry.has(normalizedModelUid)) {
|
|
154
|
+
carry.set(normalizedModelUid, /* @__PURE__ */ new Set());
|
|
155
|
+
}
|
|
156
|
+
(_a = carry.get(normalizedModelUid)) == null ? void 0 : _a.add(normalizedTemplateUid);
|
|
157
|
+
};
|
|
158
|
+
const normalizedOptions = import_lodash.default.isPlainObject(options) || Array.isArray(options) ? options : typeof options === "string" ? JSON.parse(options) : {};
|
|
159
|
+
const useTemplate = import_lodash.default.get(normalizedOptions, ["stepParams", "referenceSettings", "useTemplate"]);
|
|
160
|
+
const useTemplateUid = String((useTemplate == null ? void 0 : useTemplate.templateUid) || "").trim();
|
|
161
|
+
const useTemplateMode = String((useTemplate == null ? void 0 : useTemplate.mode) || "reference").trim() || "reference";
|
|
162
|
+
if (useTemplateUid && useTemplateMode !== "copy") {
|
|
163
|
+
addUsage(useTemplateUid);
|
|
164
|
+
}
|
|
165
|
+
const popupGroups = [
|
|
166
|
+
import_lodash.default.get(normalizedOptions, ["stepParams", "popupSettings"]),
|
|
167
|
+
import_lodash.default.get(normalizedOptions, ["stepParams", "selectExitRecordSettings"])
|
|
168
|
+
];
|
|
169
|
+
for (const group of popupGroups) {
|
|
170
|
+
if (!group || typeof group !== "object") {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
for (const value of Object.values(group)) {
|
|
174
|
+
const popupTemplateUid = String((value == null ? void 0 : value.popupTemplateUid) || "").trim();
|
|
175
|
+
const popupTemplateMode = String((value == null ? void 0 : value.popupTemplateMode) || "reference").trim() || "reference";
|
|
176
|
+
if (popupTemplateUid && popupTemplateMode !== "copy") {
|
|
177
|
+
addUsage(popupTemplateUid);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return carry;
|
|
182
|
+
}
|
|
183
|
+
function collectFlowTemplateModelUids(node, carry = /* @__PURE__ */ new Set()) {
|
|
184
|
+
if (!(node == null ? void 0 : node.uid)) {
|
|
185
|
+
return carry;
|
|
186
|
+
}
|
|
187
|
+
carry.add(String(node.uid));
|
|
188
|
+
for (const child of Object.values(node.subModels || {})) {
|
|
189
|
+
for (const item of import_lodash.default.castArray(child)) {
|
|
190
|
+
collectFlowTemplateModelUids(item, carry);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return carry;
|
|
194
|
+
}
|
|
195
|
+
function replaceFlowModelTreeUids(node, uidMap) {
|
|
196
|
+
const replaceInPlace = (value) => {
|
|
197
|
+
if (Array.isArray(value)) {
|
|
198
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
199
|
+
value[i] = replaceInPlace(value[i]);
|
|
200
|
+
}
|
|
201
|
+
return value;
|
|
202
|
+
}
|
|
203
|
+
if (value && typeof value === "object") {
|
|
204
|
+
for (const key of Object.keys(value)) {
|
|
205
|
+
value[key] = replaceInPlace(value[key]);
|
|
206
|
+
}
|
|
207
|
+
return value;
|
|
208
|
+
}
|
|
209
|
+
return typeof value === "string" && uidMap[value] ? uidMap[value] : value;
|
|
210
|
+
};
|
|
211
|
+
const walk = (current) => {
|
|
212
|
+
if (!current || typeof current !== "object") {
|
|
213
|
+
return current;
|
|
214
|
+
}
|
|
215
|
+
if (typeof current.uid === "string" && uidMap[current.uid]) {
|
|
216
|
+
current.uid = uidMap[current.uid];
|
|
217
|
+
}
|
|
218
|
+
if (typeof current.parent === "string" && uidMap[current.parent]) {
|
|
219
|
+
current.parent = uidMap[current.parent];
|
|
220
|
+
}
|
|
221
|
+
if (typeof current.parentId === "string" && uidMap[current.parentId]) {
|
|
222
|
+
current.parentId = uidMap[current.parentId];
|
|
223
|
+
}
|
|
224
|
+
if (current.stepParams) {
|
|
225
|
+
current.stepParams = replaceInPlace(current.stepParams);
|
|
226
|
+
}
|
|
227
|
+
Object.values(current.subModels || {}).forEach((child) => {
|
|
228
|
+
import_lodash.default.castArray(child).forEach((item) => walk(item));
|
|
229
|
+
});
|
|
230
|
+
return current;
|
|
231
|
+
};
|
|
232
|
+
return walk(import_lodash.default.cloneDeep(node));
|
|
233
|
+
}
|
|
234
|
+
function stripTemplateInternalOpenViewFields(openView) {
|
|
235
|
+
if (!import_lodash.default.isPlainObject(openView)) {
|
|
236
|
+
return openView;
|
|
237
|
+
}
|
|
238
|
+
const hasTemplateState = !!String(openView.popupTemplateUid || "").trim() || !!openView.popupTemplateContext || !!String(openView.popupTemplateMode || "").trim();
|
|
239
|
+
return import_lodash.default.omit(openView, [
|
|
240
|
+
"popupTemplateUid",
|
|
241
|
+
"popupTemplateMode",
|
|
242
|
+
"popupTemplateContext",
|
|
243
|
+
"popupTemplateHasFilterByTk",
|
|
244
|
+
"popupTemplateHasSourceId",
|
|
245
|
+
...hasTemplateState ? ["uid"] : []
|
|
246
|
+
]);
|
|
247
|
+
}
|
|
248
|
+
function stripTemplateInternalReferenceSettings(node) {
|
|
249
|
+
var _a;
|
|
250
|
+
if (!import_lodash.default.isPlainObject((_a = node == null ? void 0 : node.stepParams) == null ? void 0 : _a.referenceSettings)) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
delete node.stepParams.referenceSettings;
|
|
254
|
+
if (import_lodash.default.isPlainObject(node.stepParams) && !Object.keys(node.stepParams).length) {
|
|
255
|
+
delete node.stepParams;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function findFieldsTemplateReferenceGrid(node) {
|
|
259
|
+
var _a;
|
|
260
|
+
return (0, import_service_utils.getSingleNodeSubModel)((_a = node == null ? void 0 : node.subModels) == null ? void 0 : _a.grid);
|
|
261
|
+
}
|
|
262
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
263
|
+
0 && (module.exports = {
|
|
264
|
+
FLOW_TEMPLATE_BLOCK_USAGES,
|
|
265
|
+
FLOW_TEMPLATE_SUPPORTED_MODES,
|
|
266
|
+
FLOW_TEMPLATE_SUPPORTED_TYPES,
|
|
267
|
+
FLOW_TEMPLATE_UNSUPPORTED_BLOCK_TEMPLATE_SOURCE_USES,
|
|
268
|
+
POPUP_HOST_STEP_PARAM_PATHS,
|
|
269
|
+
buildFlowTemplateReferenceBlockStepParams,
|
|
270
|
+
buildTemplateListFilter,
|
|
271
|
+
collectFlowTemplateModelUids,
|
|
272
|
+
collectFlowTemplateUsageMapFromModelOptions,
|
|
273
|
+
findFieldsTemplateReferenceGrid,
|
|
274
|
+
findFlowTemplateOpenViewStep,
|
|
275
|
+
normalizeRequiredTemplateString,
|
|
276
|
+
normalizeTemplateSaveMode,
|
|
277
|
+
normalizeTemplateUidValue,
|
|
278
|
+
replaceFlowModelTreeUids,
|
|
279
|
+
stripTemplateInternalOpenViewFields,
|
|
280
|
+
stripTemplateInternalReferenceSettings
|
|
281
|
+
});
|
|
@@ -0,0 +1,287 @@
|
|
|
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 { FLOW_SURFACE_MUTATE_OP_TYPES, FLOW_SURFACE_PLAN_STEP_ACTIONS } from './constants';
|
|
10
|
+
export type FlowSurfaceNodeDomain = 'props' | 'decoratorProps' | 'stepParams' | 'flowRegistry';
|
|
11
|
+
export type FlowSurfaceMergeStrategy = 'deep' | 'replace';
|
|
12
|
+
export type FlowSurfaceActionScope = 'block' | 'record' | 'form' | 'filterForm' | 'actionPanel';
|
|
13
|
+
export type FlowSurfaceContainerKind = 'page' | 'tab' | 'grid' | 'block' | 'node';
|
|
14
|
+
export type FlowSurfaceReadLocator = {
|
|
15
|
+
uid?: string;
|
|
16
|
+
pageSchemaUid?: string;
|
|
17
|
+
tabSchemaUid?: string;
|
|
18
|
+
routeId?: string;
|
|
19
|
+
};
|
|
20
|
+
export type FlowSurfacePlanStepLink = {
|
|
21
|
+
step: string;
|
|
22
|
+
path?: string;
|
|
23
|
+
};
|
|
24
|
+
export type FlowSurfaceKeySelector = {
|
|
25
|
+
key: string;
|
|
26
|
+
};
|
|
27
|
+
export type FlowSurfaceLocatorSelector = {
|
|
28
|
+
locator: FlowSurfaceReadLocator;
|
|
29
|
+
};
|
|
30
|
+
export type FlowSurfaceSurfaceSelector = FlowSurfaceKeySelector | FlowSurfaceLocatorSelector;
|
|
31
|
+
export type FlowSurfacePlanSelector = FlowSurfaceSurfaceSelector | FlowSurfacePlanStepLink;
|
|
32
|
+
export type FlowSurfaceBindKey = {
|
|
33
|
+
key: string;
|
|
34
|
+
locator: FlowSurfaceReadLocator;
|
|
35
|
+
expectedKind?: 'page' | 'tab' | 'grid' | 'block' | 'fieldHost' | 'action' | 'popupHost' | 'popupPage' | 'popupTab' | 'node';
|
|
36
|
+
rebind?: boolean;
|
|
37
|
+
};
|
|
38
|
+
export type FlowSurfaceWriteTarget = {
|
|
39
|
+
uid: string;
|
|
40
|
+
};
|
|
41
|
+
export type FlowSurfaceResolveTarget = FlowSurfaceReadLocator | FlowSurfaceWriteTarget;
|
|
42
|
+
export type FlowSurfaceConfigureOptionValueType = 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
43
|
+
export type FlowSurfaceConfigureOption = {
|
|
44
|
+
type: FlowSurfaceConfigureOptionValueType;
|
|
45
|
+
description?: string;
|
|
46
|
+
enum?: Array<string | number | boolean>;
|
|
47
|
+
example?: any;
|
|
48
|
+
supportsFlowContext?: boolean;
|
|
49
|
+
};
|
|
50
|
+
export type FlowSurfaceConfigureOptions = Record<string, FlowSurfaceConfigureOption>;
|
|
51
|
+
export type FlowSurfaceReadTarget = {
|
|
52
|
+
locator: FlowSurfaceReadLocator;
|
|
53
|
+
uid: string;
|
|
54
|
+
kind: FlowSurfaceContainerKind;
|
|
55
|
+
};
|
|
56
|
+
export type FlowSurfaceDomainContract = {
|
|
57
|
+
allowedKeys: string[];
|
|
58
|
+
wildcard?: boolean;
|
|
59
|
+
mergeStrategy: FlowSurfaceMergeStrategy;
|
|
60
|
+
schema: Record<string, any>;
|
|
61
|
+
groups?: Record<string, FlowSurfaceDomainGroupContract>;
|
|
62
|
+
};
|
|
63
|
+
export type FlowSurfaceEventCapabilities = {
|
|
64
|
+
direct?: string[];
|
|
65
|
+
object?: string[];
|
|
66
|
+
};
|
|
67
|
+
export type FlowSurfaceDomainGroupContract = {
|
|
68
|
+
allowedPaths: string[];
|
|
69
|
+
clearable?: boolean;
|
|
70
|
+
mergeStrategy: FlowSurfaceMergeStrategy;
|
|
71
|
+
schema: Record<string, any>;
|
|
72
|
+
eventBindingSteps?: string[] | '*';
|
|
73
|
+
pathSchemas?: Record<string, Record<string, any>>;
|
|
74
|
+
};
|
|
75
|
+
export type FlowSurfaceEventBindingContract = {
|
|
76
|
+
stepKeys?: string[] | '*';
|
|
77
|
+
};
|
|
78
|
+
export type FlowSurfaceLayoutCapabilities = {
|
|
79
|
+
supported: boolean;
|
|
80
|
+
};
|
|
81
|
+
export type FlowSurfaceNodeContract = {
|
|
82
|
+
editableDomains: FlowSurfaceNodeDomain[];
|
|
83
|
+
domains: Partial<Record<FlowSurfaceNodeDomain, FlowSurfaceDomainContract>>;
|
|
84
|
+
eventCapabilities?: FlowSurfaceEventCapabilities;
|
|
85
|
+
layoutCapabilities?: FlowSurfaceLayoutCapabilities;
|
|
86
|
+
eventBindings?: Record<string, FlowSurfaceEventBindingContract>;
|
|
87
|
+
};
|
|
88
|
+
export type FlowSurfaceResourceBindingKey = 'currentCollection' | 'currentRecord' | 'associatedRecords' | 'otherRecords';
|
|
89
|
+
export type FlowSurfaceResourceBindingAssociationField = {
|
|
90
|
+
key: string;
|
|
91
|
+
label: string;
|
|
92
|
+
collectionName: string;
|
|
93
|
+
associationName?: string;
|
|
94
|
+
};
|
|
95
|
+
export type FlowSurfaceResourceBindingOption = {
|
|
96
|
+
key: FlowSurfaceResourceBindingKey;
|
|
97
|
+
label: string;
|
|
98
|
+
description?: string;
|
|
99
|
+
requires?: string[];
|
|
100
|
+
dataSourceKey?: string;
|
|
101
|
+
collectionName?: string;
|
|
102
|
+
associationFields?: FlowSurfaceResourceBindingAssociationField[];
|
|
103
|
+
};
|
|
104
|
+
export type FlowSurfaceSemanticResourceInput = {
|
|
105
|
+
binding: FlowSurfaceResourceBindingKey;
|
|
106
|
+
dataSourceKey?: string;
|
|
107
|
+
collectionName?: string;
|
|
108
|
+
associationField?: string;
|
|
109
|
+
};
|
|
110
|
+
export type FlowSurfaceCatalogItem = {
|
|
111
|
+
key: string;
|
|
112
|
+
label: string;
|
|
113
|
+
use: string;
|
|
114
|
+
kind: 'page' | 'tab' | 'block' | 'field' | 'action';
|
|
115
|
+
scope?: FlowSurfaceActionScope;
|
|
116
|
+
scene?: string;
|
|
117
|
+
requiredInitParams?: string[];
|
|
118
|
+
allowedContainerUses?: string[];
|
|
119
|
+
editableDomains?: FlowSurfaceNodeDomain[];
|
|
120
|
+
settingsSchema?: Record<string, any>;
|
|
121
|
+
settingsContract?: Partial<Record<FlowSurfaceNodeDomain, FlowSurfaceDomainContract>>;
|
|
122
|
+
configureOptions?: FlowSurfaceConfigureOptions;
|
|
123
|
+
resourceBindings?: FlowSurfaceResourceBindingOption[];
|
|
124
|
+
eventCapabilities?: FlowSurfaceEventCapabilities;
|
|
125
|
+
layoutCapabilities?: FlowSurfaceLayoutCapabilities;
|
|
126
|
+
createSupported?: boolean;
|
|
127
|
+
fieldUse?: string;
|
|
128
|
+
wrapperUse?: string;
|
|
129
|
+
renderer?: string;
|
|
130
|
+
type?: string;
|
|
131
|
+
associationPathName?: string;
|
|
132
|
+
defaultTargetUid?: string;
|
|
133
|
+
targetBlockUid?: string;
|
|
134
|
+
};
|
|
135
|
+
export type FlowSurfaceCatalogSection = 'blocks' | 'fields' | 'actions' | 'recordActions' | 'node';
|
|
136
|
+
export type FlowSurfaceCatalogExpand = 'item.configureOptions' | 'item.contracts' | 'item.allowedContainerUses' | 'node.contracts';
|
|
137
|
+
export type FlowSurfaceCatalogPopupScenario = {
|
|
138
|
+
kind: 'plainPopup' | 'recordPopup' | 'associationPopup';
|
|
139
|
+
scene: 'new' | 'one' | 'many' | 'select' | 'subForm' | 'bulkEditForm' | 'generic';
|
|
140
|
+
hasCurrentRecord: boolean;
|
|
141
|
+
hasAssociationContext: boolean;
|
|
142
|
+
};
|
|
143
|
+
export type FlowSurfaceCatalogFieldContainerScenario = {
|
|
144
|
+
kind: 'form' | 'details' | 'table' | 'filter-form';
|
|
145
|
+
targetMode?: 'single' | 'multiple';
|
|
146
|
+
};
|
|
147
|
+
export type FlowSurfaceCatalogActionContainerScenario = {
|
|
148
|
+
scope: FlowSurfaceActionScope;
|
|
149
|
+
ownerUse?: string;
|
|
150
|
+
recordActionContainerUse?: string;
|
|
151
|
+
};
|
|
152
|
+
export type FlowSurfaceCatalogScenario = {
|
|
153
|
+
surfaceKind: 'global' | FlowSurfaceContainerKind;
|
|
154
|
+
popup?: FlowSurfaceCatalogPopupScenario;
|
|
155
|
+
fieldContainer?: FlowSurfaceCatalogFieldContainerScenario;
|
|
156
|
+
actionContainer?: FlowSurfaceCatalogActionContainerScenario;
|
|
157
|
+
};
|
|
158
|
+
export type FlowSurfaceCatalogNodeInfo = {
|
|
159
|
+
editableDomains: FlowSurfaceNodeDomain[];
|
|
160
|
+
configureOptions: FlowSurfaceConfigureOptions;
|
|
161
|
+
settingsSchema?: Record<string, any>;
|
|
162
|
+
settingsContract?: Partial<Record<FlowSurfaceNodeDomain, FlowSurfaceDomainContract>>;
|
|
163
|
+
eventCapabilities?: FlowSurfaceEventCapabilities;
|
|
164
|
+
layoutCapabilities?: FlowSurfaceLayoutCapabilities;
|
|
165
|
+
};
|
|
166
|
+
export type FlowSurfaceCatalogValues = {
|
|
167
|
+
target?: FlowSurfaceWriteTarget;
|
|
168
|
+
sections?: FlowSurfaceCatalogSection[];
|
|
169
|
+
expand?: FlowSurfaceCatalogExpand[];
|
|
170
|
+
};
|
|
171
|
+
export type FlowSurfaceResolvedTarget = {
|
|
172
|
+
target: FlowSurfaceResolveTarget;
|
|
173
|
+
uid: string;
|
|
174
|
+
kind: FlowSurfaceContainerKind;
|
|
175
|
+
node?: any;
|
|
176
|
+
route?: any;
|
|
177
|
+
pageRoute?: any;
|
|
178
|
+
tabRoute?: any;
|
|
179
|
+
pageModel?: any;
|
|
180
|
+
};
|
|
181
|
+
export type FlowSurfaceCatalogResponse = {
|
|
182
|
+
target: FlowSurfaceResolvedTarget | null;
|
|
183
|
+
scenario: FlowSurfaceCatalogScenario;
|
|
184
|
+
selectedSections: FlowSurfaceCatalogSection[];
|
|
185
|
+
blocks?: FlowSurfaceCatalogItem[];
|
|
186
|
+
fields?: FlowSurfaceCatalogItem[];
|
|
187
|
+
actions?: FlowSurfaceCatalogItem[];
|
|
188
|
+
recordActions?: FlowSurfaceCatalogItem[];
|
|
189
|
+
node?: FlowSurfaceCatalogNodeInfo;
|
|
190
|
+
};
|
|
191
|
+
export type FlowSurfaceNodeSpec = {
|
|
192
|
+
uid?: string;
|
|
193
|
+
clientKey?: string;
|
|
194
|
+
sortIndex?: number;
|
|
195
|
+
async?: boolean;
|
|
196
|
+
use: string;
|
|
197
|
+
popup?: Record<string, any>;
|
|
198
|
+
props?: Record<string, any>;
|
|
199
|
+
decoratorProps?: Record<string, any>;
|
|
200
|
+
stepParams?: Record<string, any>;
|
|
201
|
+
flowRegistry?: Record<string, any>;
|
|
202
|
+
subModels?: Record<string, FlowSurfaceNodeSpec | FlowSurfaceNodeSpec[]>;
|
|
203
|
+
};
|
|
204
|
+
export type FlowSurfaceNodeSubModel = FlowSurfaceNodeSpec | FlowSurfaceNodeSpec[];
|
|
205
|
+
export type FlowSurfaceNodeDefaults = Partial<Pick<FlowSurfaceNodeSpec, 'async' | 'props' | 'decoratorProps' | 'stepParams' | 'flowRegistry' | 'subModels'>>;
|
|
206
|
+
export type FlowSurfaceApplyMode = 'replace';
|
|
207
|
+
export type FlowSurfaceComposeMode = 'append' | 'replace';
|
|
208
|
+
export type FlowSurfaceApplySpec = {
|
|
209
|
+
popup?: Record<string, any>;
|
|
210
|
+
props?: Record<string, any>;
|
|
211
|
+
decoratorProps?: Record<string, any>;
|
|
212
|
+
stepParams?: Record<string, any>;
|
|
213
|
+
flowRegistry?: Record<string, any>;
|
|
214
|
+
subModels?: Record<string, FlowSurfaceNodeSpec | FlowSurfaceNodeSpec[]>;
|
|
215
|
+
};
|
|
216
|
+
export type FlowSurfaceAtomicFlag = true;
|
|
217
|
+
export type FlowSurfaceMutateValues = {
|
|
218
|
+
ops?: FlowSurfaceMutateOp[];
|
|
219
|
+
atomic?: true;
|
|
220
|
+
};
|
|
221
|
+
export type FlowSurfaceApplyValues = {
|
|
222
|
+
target: FlowSurfaceWriteTarget;
|
|
223
|
+
spec: FlowSurfaceApplySpec;
|
|
224
|
+
mode?: 'replace';
|
|
225
|
+
};
|
|
226
|
+
export type FlowSurfaceComposeValues = {
|
|
227
|
+
target: FlowSurfaceWriteTarget;
|
|
228
|
+
mode?: FlowSurfaceComposeMode;
|
|
229
|
+
blocks?: Array<Record<string, any>>;
|
|
230
|
+
layout?: Record<string, any>;
|
|
231
|
+
};
|
|
232
|
+
export type FlowSurfaceConfigureValues = {
|
|
233
|
+
target: FlowSurfaceWriteTarget;
|
|
234
|
+
changes: Record<string, any>;
|
|
235
|
+
};
|
|
236
|
+
export type FlowSurfaceContextVarInfo = {
|
|
237
|
+
title?: string;
|
|
238
|
+
type?: string;
|
|
239
|
+
interface?: string;
|
|
240
|
+
description?: string;
|
|
241
|
+
enumValues?: string[];
|
|
242
|
+
min?: number;
|
|
243
|
+
max?: number;
|
|
244
|
+
disabled?: boolean;
|
|
245
|
+
disabledReason?: string;
|
|
246
|
+
properties?: Record<string, FlowSurfaceContextVarInfo>;
|
|
247
|
+
};
|
|
248
|
+
export type FlowSurfaceContextValues = {
|
|
249
|
+
target: FlowSurfaceWriteTarget;
|
|
250
|
+
path?: string;
|
|
251
|
+
maxDepth?: number;
|
|
252
|
+
};
|
|
253
|
+
export type FlowSurfaceContextResponse = {
|
|
254
|
+
vars: Record<string, FlowSurfaceContextVarInfo>;
|
|
255
|
+
};
|
|
256
|
+
export type FlowSurfaceDescribeValues = {
|
|
257
|
+
locator: FlowSurfaceReadLocator;
|
|
258
|
+
bindKeys?: FlowSurfaceBindKey[];
|
|
259
|
+
};
|
|
260
|
+
export type FlowSurfacePlanStepAction = (typeof FLOW_SURFACE_PLAN_STEP_ACTIONS)[number];
|
|
261
|
+
export type FlowSurfacePlanStep = {
|
|
262
|
+
id?: string;
|
|
263
|
+
action: FlowSurfacePlanStepAction;
|
|
264
|
+
selectors?: {
|
|
265
|
+
target?: FlowSurfacePlanSelector;
|
|
266
|
+
source?: FlowSurfacePlanSelector;
|
|
267
|
+
};
|
|
268
|
+
values?: Record<string, any>;
|
|
269
|
+
};
|
|
270
|
+
export type FlowSurfacePlanRequestValues = {
|
|
271
|
+
surface?: FlowSurfaceSurfaceSelector;
|
|
272
|
+
plan: {
|
|
273
|
+
steps?: FlowSurfacePlanStep[];
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
export type FlowSurfaceMutateOpType = (typeof FLOW_SURFACE_MUTATE_OP_TYPES)[number];
|
|
277
|
+
export type FlowSurfaceMutateOp = {
|
|
278
|
+
opId?: string;
|
|
279
|
+
type: FlowSurfaceMutateOpType;
|
|
280
|
+
target?: FlowSurfaceWriteTarget;
|
|
281
|
+
values?: Record<string, any>;
|
|
282
|
+
};
|
|
283
|
+
export type FlowSurfaceExecutorContext = {
|
|
284
|
+
transaction?: any;
|
|
285
|
+
keys: Map<string, any>;
|
|
286
|
+
clientKeyToUid: Record<string, string>;
|
|
287
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
+
var types_exports = {};
|
|
24
|
+
module.exports = __toCommonJS(types_exports);
|
package/dist/server/index.d.ts
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -37,12 +37,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
37
37
|
var server_exports = {};
|
|
38
38
|
__export(server_exports, {
|
|
39
39
|
FlowModelRepository: () => import_repository.FlowModelRepository,
|
|
40
|
-
default: () => import_plugin.default
|
|
40
|
+
default: () => import_plugin.default,
|
|
41
|
+
resolveVariablesBatch: () => import_resolve.resolveVariablesBatch,
|
|
42
|
+
resolveVariablesTemplate: () => import_resolve.resolveVariablesTemplate
|
|
41
43
|
});
|
|
42
44
|
module.exports = __toCommonJS(server_exports);
|
|
43
45
|
var import_plugin = __toESM(require("./plugin"));
|
|
44
46
|
var import_repository = require("./repository");
|
|
47
|
+
var import_resolve = require("./variables/resolve");
|
|
45
48
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
49
|
0 && (module.exports = {
|
|
47
|
-
FlowModelRepository
|
|
50
|
+
FlowModelRepository,
|
|
51
|
+
resolveVariablesBatch,
|
|
52
|
+
resolveVariablesTemplate
|
|
48
53
|
});
|