@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,116 @@
|
|
|
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_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY, type FlowSurfaceApplyBlueprintPopupDefaultsMetadata } from './blueprint/defaults';
|
|
10
|
+
import type { FlowSurfaceComposeMode } from './types';
|
|
11
|
+
export type FlowSurfaceComposeObject = Record<string, unknown>;
|
|
12
|
+
export type FlowSurfaceComposeTargetKey = {
|
|
13
|
+
uid?: string;
|
|
14
|
+
};
|
|
15
|
+
export type FlowSurfaceComposeNormalizedResource = {
|
|
16
|
+
kind: 'semantic' | 'raw';
|
|
17
|
+
value: FlowSurfaceComposeObject;
|
|
18
|
+
} | undefined;
|
|
19
|
+
export type FlowSurfaceComposeNormalizedFieldSpec = {
|
|
20
|
+
index?: number;
|
|
21
|
+
key: string;
|
|
22
|
+
fieldPath?: string;
|
|
23
|
+
associationPathName?: string;
|
|
24
|
+
renderer?: string;
|
|
25
|
+
type?: string;
|
|
26
|
+
fieldType?: string;
|
|
27
|
+
fields?: string[];
|
|
28
|
+
selectorFields?: string[];
|
|
29
|
+
titleField?: string;
|
|
30
|
+
openMode?: string;
|
|
31
|
+
popupSize?: string;
|
|
32
|
+
pageSize?: number;
|
|
33
|
+
showIndex?: boolean;
|
|
34
|
+
target?: string | Record<string, unknown>;
|
|
35
|
+
settings?: FlowSurfaceComposeObject;
|
|
36
|
+
popup?: FlowSurfaceComposeObject;
|
|
37
|
+
__autoPopupForRelationField?: boolean;
|
|
38
|
+
[FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY]?: FlowSurfaceApplyBlueprintPopupDefaultsMetadata;
|
|
39
|
+
};
|
|
40
|
+
export type FlowSurfaceComposeNormalizedActionSpec = {
|
|
41
|
+
key: string;
|
|
42
|
+
type: string;
|
|
43
|
+
settings?: FlowSurfaceComposeObject;
|
|
44
|
+
popup?: FlowSurfaceComposeObject;
|
|
45
|
+
};
|
|
46
|
+
export type FlowSurfaceComposeNormalizedBlockSpec = {
|
|
47
|
+
index?: number;
|
|
48
|
+
key: string;
|
|
49
|
+
type?: string;
|
|
50
|
+
catalogItem?: FlowSurfaceComposeObject | null;
|
|
51
|
+
resource?: FlowSurfaceComposeNormalizedResource;
|
|
52
|
+
template?: FlowSurfaceComposeObject;
|
|
53
|
+
settings?: FlowSurfaceComposeObject;
|
|
54
|
+
fields: FlowSurfaceComposeNormalizedFieldSpec[];
|
|
55
|
+
fieldsLayout?: FlowSurfaceComposeObject;
|
|
56
|
+
actions: FlowSurfaceComposeNormalizedActionSpec[];
|
|
57
|
+
recordActions: FlowSurfaceComposeNormalizedActionSpec[];
|
|
58
|
+
};
|
|
59
|
+
export type FlowSurfaceComposeBlockCreatePayload = {
|
|
60
|
+
target: {
|
|
61
|
+
uid: string;
|
|
62
|
+
};
|
|
63
|
+
type?: string;
|
|
64
|
+
resource?: FlowSurfaceComposeObject;
|
|
65
|
+
resourceInit?: FlowSurfaceComposeObject;
|
|
66
|
+
template?: FlowSurfaceComposeObject;
|
|
67
|
+
key?: string;
|
|
68
|
+
};
|
|
69
|
+
export type FlowSurfaceCompiledComposeBlockTask = {
|
|
70
|
+
key: string;
|
|
71
|
+
spec: FlowSurfaceComposeNormalizedBlockSpec;
|
|
72
|
+
payload: FlowSurfaceComposeBlockCreatePayload;
|
|
73
|
+
};
|
|
74
|
+
export type FlowSurfaceCompiledComposeFieldTask = {
|
|
75
|
+
blockKey: string;
|
|
76
|
+
spec: FlowSurfaceComposeNormalizedFieldSpec;
|
|
77
|
+
containerSource: 'block' | 'item';
|
|
78
|
+
payload: FlowSurfaceComposeObject;
|
|
79
|
+
};
|
|
80
|
+
export type FlowSurfaceCompiledComposeActionTask = {
|
|
81
|
+
blockKey: string;
|
|
82
|
+
spec: FlowSurfaceComposeNormalizedActionSpec;
|
|
83
|
+
payload: FlowSurfaceComposeObject;
|
|
84
|
+
};
|
|
85
|
+
export type FlowSurfaceCompiledComposeRecordActionTask = {
|
|
86
|
+
blockKey: string;
|
|
87
|
+
spec: FlowSurfaceComposeNormalizedActionSpec;
|
|
88
|
+
payload: FlowSurfaceComposeObject;
|
|
89
|
+
};
|
|
90
|
+
export type FlowSurfaceComposeLayoutPlan = {
|
|
91
|
+
kind: 'none';
|
|
92
|
+
} | {
|
|
93
|
+
kind: 'explicit';
|
|
94
|
+
layout?: FlowSurfaceComposeObject;
|
|
95
|
+
} | {
|
|
96
|
+
kind: 'append';
|
|
97
|
+
};
|
|
98
|
+
export type FlowSurfaceCompiledComposePlan = {
|
|
99
|
+
gridUid: string;
|
|
100
|
+
mode: FlowSurfaceComposeMode;
|
|
101
|
+
existingItemUids: string[];
|
|
102
|
+
blocks: FlowSurfaceCompiledComposeBlockTask[];
|
|
103
|
+
fields: FlowSurfaceCompiledComposeFieldTask[];
|
|
104
|
+
actions: FlowSurfaceCompiledComposeActionTask[];
|
|
105
|
+
recordActions: FlowSurfaceCompiledComposeRecordActionTask[];
|
|
106
|
+
layoutPlan: FlowSurfaceComposeLayoutPlan;
|
|
107
|
+
};
|
|
108
|
+
export declare function compileComposeExecutionPlan(input: {
|
|
109
|
+
gridUid: string;
|
|
110
|
+
mode: FlowSurfaceComposeMode;
|
|
111
|
+
normalizedBlocks: FlowSurfaceComposeNormalizedBlockSpec[];
|
|
112
|
+
existingItemUids?: string[];
|
|
113
|
+
layout?: FlowSurfaceComposeObject;
|
|
114
|
+
}): FlowSurfaceCompiledComposePlan;
|
|
115
|
+
export declare function resolveComposeFieldContainerSource(blockSpec: Pick<FlowSurfaceComposeNormalizedBlockSpec, 'type'>): 'block' | 'item';
|
|
116
|
+
export declare function resolveComposeTargetKey(targetKey: string, keyMap: Record<string, FlowSurfaceComposeTargetKey | undefined>, kind: 'field' | 'layout'): string;
|
|
@@ -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 compose_compiler_exports = {};
|
|
28
|
+
__export(compose_compiler_exports, {
|
|
29
|
+
compileComposeExecutionPlan: () => compileComposeExecutionPlan,
|
|
30
|
+
resolveComposeFieldContainerSource: () => resolveComposeFieldContainerSource,
|
|
31
|
+
resolveComposeTargetKey: () => resolveComposeTargetKey
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(compose_compiler_exports);
|
|
34
|
+
var import_errors = require("./errors");
|
|
35
|
+
var import_defaults = require("./blueprint/defaults");
|
|
36
|
+
const LIST_LIKE_COMPOSE_BLOCK_TYPES = /* @__PURE__ */ new Set(["list", "gridCard", "kanban"]);
|
|
37
|
+
function compileComposeExecutionPlan(input) {
|
|
38
|
+
const blocks = compileComposeBlockTasks(input.gridUid, input.normalizedBlocks);
|
|
39
|
+
const fields = compileComposeFieldTasks(input.normalizedBlocks);
|
|
40
|
+
const actions = compileComposeActionTasks(input.normalizedBlocks);
|
|
41
|
+
const recordActions = compileComposeRecordActionTasks(input.normalizedBlocks);
|
|
42
|
+
return {
|
|
43
|
+
gridUid: input.gridUid,
|
|
44
|
+
mode: input.mode,
|
|
45
|
+
existingItemUids: Array.from(new Set((input.existingItemUids || []).filter(Boolean))),
|
|
46
|
+
blocks,
|
|
47
|
+
fields,
|
|
48
|
+
actions,
|
|
49
|
+
recordActions,
|
|
50
|
+
layoutPlan: buildComposeLayoutPlan({
|
|
51
|
+
mode: input.mode,
|
|
52
|
+
layout: input.layout,
|
|
53
|
+
hasBlocks: blocks.length > 0
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function compileComposeBlockTasks(gridUid, normalizedBlocks) {
|
|
58
|
+
return normalizedBlocks.map((blockSpec) => ({
|
|
59
|
+
key: blockSpec.key,
|
|
60
|
+
spec: blockSpec,
|
|
61
|
+
payload: buildComposeBlockCreatePayload(gridUid, blockSpec)
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
function compileComposeFieldTasks(normalizedBlocks) {
|
|
65
|
+
return normalizedBlocks.flatMap(
|
|
66
|
+
(blockSpec) => blockSpec.fields.map((fieldSpec) => ({
|
|
67
|
+
blockKey: blockSpec.key,
|
|
68
|
+
spec: fieldSpec,
|
|
69
|
+
containerSource: resolveComposeFieldContainerSource(blockSpec),
|
|
70
|
+
payload: buildComposeFieldCreatePayload(fieldSpec)
|
|
71
|
+
}))
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
function compileComposeActionTasks(normalizedBlocks) {
|
|
75
|
+
return normalizedBlocks.flatMap(
|
|
76
|
+
(blockSpec) => blockSpec.actions.map((actionSpec) => ({
|
|
77
|
+
blockKey: blockSpec.key,
|
|
78
|
+
spec: actionSpec,
|
|
79
|
+
payload: buildComposeActionCreatePayload(actionSpec)
|
|
80
|
+
}))
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
function compileComposeRecordActionTasks(normalizedBlocks) {
|
|
84
|
+
return normalizedBlocks.flatMap(
|
|
85
|
+
(blockSpec) => blockSpec.recordActions.map((actionSpec) => ({
|
|
86
|
+
blockKey: blockSpec.key,
|
|
87
|
+
spec: actionSpec,
|
|
88
|
+
payload: buildComposeRecordActionCreatePayload(actionSpec)
|
|
89
|
+
}))
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
function resolveComposeFieldContainerSource(blockSpec) {
|
|
93
|
+
return LIST_LIKE_COMPOSE_BLOCK_TYPES.has(blockSpec.type || "") ? "item" : "block";
|
|
94
|
+
}
|
|
95
|
+
function resolveComposeTargetKey(targetKey, keyMap, kind) {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
const key = String(targetKey || "").trim();
|
|
98
|
+
if (!key) {
|
|
99
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces compose ${kind} target key cannot be empty`);
|
|
100
|
+
}
|
|
101
|
+
if (!((_a = keyMap[key]) == null ? void 0 : _a.uid)) {
|
|
102
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces compose ${kind} target '${key}' was not created in the current compose call`);
|
|
103
|
+
}
|
|
104
|
+
return (_b = keyMap[key]) == null ? void 0 : _b.uid;
|
|
105
|
+
}
|
|
106
|
+
function buildComposeBlockCreatePayload(gridUid, blockSpec) {
|
|
107
|
+
var _a, _b;
|
|
108
|
+
return {
|
|
109
|
+
target: {
|
|
110
|
+
uid: gridUid
|
|
111
|
+
},
|
|
112
|
+
...blockSpec.key ? { key: blockSpec.key } : {},
|
|
113
|
+
...blockSpec.type ? { type: blockSpec.type } : {},
|
|
114
|
+
...((_a = blockSpec.resource) == null ? void 0 : _a.kind) === "semantic" ? { resource: blockSpec.resource.value } : {},
|
|
115
|
+
...((_b = blockSpec.resource) == null ? void 0 : _b.kind) === "raw" ? { resourceInit: blockSpec.resource.value } : {},
|
|
116
|
+
...blockSpec.template ? { template: blockSpec.template } : {}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function buildComposeFieldCreatePayload(fieldSpec) {
|
|
120
|
+
return {
|
|
121
|
+
...fieldSpec.key ? { key: fieldSpec.key } : {},
|
|
122
|
+
...fieldSpec.fieldPath ? { fieldPath: fieldSpec.fieldPath } : {},
|
|
123
|
+
...fieldSpec.associationPathName ? { associationPathName: fieldSpec.associationPathName } : {},
|
|
124
|
+
...fieldSpec.renderer ? { renderer: fieldSpec.renderer } : {},
|
|
125
|
+
...fieldSpec.type ? { type: fieldSpec.type } : {},
|
|
126
|
+
...fieldSpec.fieldType ? { fieldType: fieldSpec.fieldType } : {},
|
|
127
|
+
...typeof fieldSpec.fields !== "undefined" ? { fields: fieldSpec.fields } : {},
|
|
128
|
+
...typeof fieldSpec.selectorFields !== "undefined" ? { selectorFields: fieldSpec.selectorFields } : {},
|
|
129
|
+
...fieldSpec.titleField ? { titleField: fieldSpec.titleField } : {},
|
|
130
|
+
...fieldSpec.openMode ? { openMode: fieldSpec.openMode } : {},
|
|
131
|
+
...fieldSpec.popupSize ? { popupSize: fieldSpec.popupSize } : {},
|
|
132
|
+
...typeof fieldSpec.pageSize !== "undefined" ? { pageSize: fieldSpec.pageSize } : {},
|
|
133
|
+
...typeof fieldSpec.showIndex !== "undefined" ? { showIndex: fieldSpec.showIndex } : {},
|
|
134
|
+
...fieldSpec.popup ? { popup: fieldSpec.popup } : {},
|
|
135
|
+
...fieldSpec.__autoPopupForRelationField ? { __autoPopupForRelationField: true } : {},
|
|
136
|
+
...fieldSpec[import_defaults.FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY] ? {
|
|
137
|
+
[import_defaults.FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY]: fieldSpec[import_defaults.FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY]
|
|
138
|
+
} : {}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function buildComposeActionCreatePayload(actionSpec) {
|
|
142
|
+
return {
|
|
143
|
+
...actionSpec.key ? { key: actionSpec.key } : {},
|
|
144
|
+
type: actionSpec.type
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function buildComposeRecordActionCreatePayload(actionSpec) {
|
|
148
|
+
return {
|
|
149
|
+
...actionSpec.key ? { key: actionSpec.key } : {},
|
|
150
|
+
type: actionSpec.type
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function buildComposeLayoutPlan(input) {
|
|
154
|
+
var _a;
|
|
155
|
+
if (((_a = input.layout) == null ? void 0 : _a.rows) || input.mode === "replace") {
|
|
156
|
+
return {
|
|
157
|
+
kind: "explicit",
|
|
158
|
+
layout: input.layout
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
if (input.mode === "append" && input.hasBlocks) {
|
|
162
|
+
return {
|
|
163
|
+
kind: "append"
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
kind: "none"
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
171
|
+
0 && (module.exports = {
|
|
172
|
+
compileComposeExecutionPlan,
|
|
173
|
+
resolveComposeFieldContainerSource,
|
|
174
|
+
resolveComposeTargetKey
|
|
175
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
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 FlowSurfaceCompiledComposePlan, type FlowSurfaceComposeNormalizedActionSpec, type FlowSurfaceComposeNormalizedBlockSpec, type FlowSurfaceComposeNormalizedFieldSpec, type FlowSurfaceComposeObject, type FlowSurfaceComposeTargetKey } from './compose-compiler';
|
|
10
|
+
export type FlowSurfaceComposeBlockResult = {
|
|
11
|
+
uid: string;
|
|
12
|
+
gridUid?: string;
|
|
13
|
+
itemUid?: string;
|
|
14
|
+
itemGridUid?: string;
|
|
15
|
+
actionsColumnUid?: string;
|
|
16
|
+
};
|
|
17
|
+
export type FlowSurfaceComposeFieldResult = {
|
|
18
|
+
uid?: string;
|
|
19
|
+
wrapperUid?: string;
|
|
20
|
+
fieldUid?: string;
|
|
21
|
+
innerFieldUid?: string;
|
|
22
|
+
popupPageUid?: string;
|
|
23
|
+
popupTabUid?: string;
|
|
24
|
+
popupGridUid?: string;
|
|
25
|
+
};
|
|
26
|
+
export type FlowSurfaceComposeActionResult = {
|
|
27
|
+
uid: string;
|
|
28
|
+
parentUid?: string;
|
|
29
|
+
scope?: string;
|
|
30
|
+
};
|
|
31
|
+
export type FlowSurfaceComposeRuntimeBlockState = {
|
|
32
|
+
spec: FlowSurfaceComposeNormalizedBlockSpec;
|
|
33
|
+
result: FlowSurfaceComposeBlockResult;
|
|
34
|
+
createdFields: Array<{
|
|
35
|
+
spec: FlowSurfaceComposeNormalizedFieldSpec;
|
|
36
|
+
result: FlowSurfaceComposeFieldResult;
|
|
37
|
+
}>;
|
|
38
|
+
fieldResults: Array<Record<string, unknown>>;
|
|
39
|
+
actionResults: Array<Record<string, unknown>>;
|
|
40
|
+
recordActionResults: Array<Record<string, unknown>>;
|
|
41
|
+
};
|
|
42
|
+
export type FlowSurfaceComposeRuntimeState = {
|
|
43
|
+
keyMap: Record<string, FlowSurfaceComposeTargetKey & Partial<FlowSurfaceComposeBlockResult>>;
|
|
44
|
+
blocks: FlowSurfaceComposeRuntimeBlockState[];
|
|
45
|
+
};
|
|
46
|
+
export type FlowSurfaceComposeExecutionResult = {
|
|
47
|
+
target: {
|
|
48
|
+
uid: string;
|
|
49
|
+
};
|
|
50
|
+
mode: FlowSurfaceCompiledComposePlan['mode'];
|
|
51
|
+
blocks: Array<{
|
|
52
|
+
key: string;
|
|
53
|
+
type?: string;
|
|
54
|
+
uid: string;
|
|
55
|
+
gridUid?: string;
|
|
56
|
+
itemUid?: string;
|
|
57
|
+
itemGridUid?: string;
|
|
58
|
+
actionsColumnUid?: string;
|
|
59
|
+
fields: Array<Record<string, unknown>>;
|
|
60
|
+
actions: Array<Record<string, unknown>>;
|
|
61
|
+
recordActions: Array<Record<string, unknown>>;
|
|
62
|
+
}>;
|
|
63
|
+
layout?: unknown;
|
|
64
|
+
};
|
|
65
|
+
export type FlowSurfaceComposeRuntimeDeps = {
|
|
66
|
+
removeExistingItem?: (uid: string) => Promise<void>;
|
|
67
|
+
createBlock: (payload: Record<string, unknown>, spec: FlowSurfaceComposeNormalizedBlockSpec) => Promise<FlowSurfaceComposeBlockResult>;
|
|
68
|
+
applyNodeSettings?: (actionName: string, targetUid: string | undefined, settings?: FlowSurfaceComposeObject) => Promise<void>;
|
|
69
|
+
createField: (payload: Record<string, unknown>, spec: FlowSurfaceComposeNormalizedFieldSpec, blockResult: FlowSurfaceComposeBlockResult) => Promise<FlowSurfaceComposeFieldResult | null>;
|
|
70
|
+
applyFieldSettings?: (actionName: string, result: FlowSurfaceComposeFieldResult, settings?: FlowSurfaceComposeObject) => Promise<void>;
|
|
71
|
+
onFieldError?: (input: {
|
|
72
|
+
error: unknown;
|
|
73
|
+
spec: FlowSurfaceComposeNormalizedFieldSpec;
|
|
74
|
+
blockSpec: FlowSurfaceComposeNormalizedBlockSpec;
|
|
75
|
+
blockResult: FlowSurfaceComposeBlockResult;
|
|
76
|
+
}) => Promise<'continue' | void> | 'continue' | void;
|
|
77
|
+
createAction: (payload: Record<string, unknown>, spec: FlowSurfaceComposeNormalizedActionSpec, blockResult: FlowSurfaceComposeBlockResult) => Promise<FlowSurfaceComposeActionResult>;
|
|
78
|
+
createRecordAction: (payload: Record<string, unknown>, spec: FlowSurfaceComposeNormalizedActionSpec, blockResult: FlowSurfaceComposeBlockResult) => Promise<FlowSurfaceComposeActionResult>;
|
|
79
|
+
applyActionPopup?: (actionName: string, actionUid: string, popup?: FlowSurfaceComposeObject) => Promise<void>;
|
|
80
|
+
collectActionKeys?: (actionUid: string) => Promise<Record<string, unknown>>;
|
|
81
|
+
buildExplicitLayoutPayload?: (input: {
|
|
82
|
+
layout?: FlowSurfaceComposeObject;
|
|
83
|
+
createdByKey: Record<string, FlowSurfaceComposeTargetKey & Partial<FlowSurfaceComposeBlockResult>>;
|
|
84
|
+
targetUid: string;
|
|
85
|
+
}) => Promise<Record<string, unknown>> | Record<string, unknown>;
|
|
86
|
+
buildAppendLayoutPayload?: (input: {
|
|
87
|
+
gridUid: string;
|
|
88
|
+
appendedItemUids: string[];
|
|
89
|
+
}) => Promise<Record<string, unknown>> | Record<string, unknown>;
|
|
90
|
+
setLayout?: (payload: Record<string, unknown>) => Promise<unknown>;
|
|
91
|
+
};
|
|
92
|
+
export declare function executeComposeRuntime(plan: FlowSurfaceCompiledComposePlan, deps: FlowSurfaceComposeRuntimeDeps): Promise<FlowSurfaceComposeExecutionResult>;
|
|
93
|
+
export declare function createComposeRuntimeState(): FlowSurfaceComposeRuntimeState;
|