@nocobase/plugin-flow-engine 2.1.0-beta.15 → 2.1.0-beta.17
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/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/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 -10
- 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/flow-surfaces/action-scope.d.ts +38 -0
- package/dist/server/flow-surfaces/action-scope.js +152 -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 +1007 -0
- package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +13 -0
- package/dist/server/flow-surfaces/blueprint/compile-plan.js +308 -0
- package/dist/server/flow-surfaces/blueprint/compile-reaction.d.ts +11 -0
- package/dist/server/flow-surfaces/blueprint/compile-reaction.js +72 -0
- package/dist/server/flow-surfaces/blueprint/defaults.d.ts +26 -0
- package/dist/server/flow-surfaces/blueprint/defaults.js +133 -0
- package/dist/server/flow-surfaces/blueprint/index.d.ts +12 -0
- package/dist/server/flow-surfaces/blueprint/index.js +44 -0
- package/dist/server/flow-surfaces/blueprint/normalize-document.d.ts +10 -0
- package/dist/server/flow-surfaces/blueprint/normalize-document.js +416 -0
- package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +26 -0
- package/dist/server/flow-surfaces/blueprint/private-utils.js +182 -0
- package/dist/server/flow-surfaces/blueprint/public-types.d.ts +193 -0
- package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
- package/dist/server/flow-surfaces/builder.d.ts +211 -0
- package/dist/server/flow-surfaces/builder.js +1029 -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 +3496 -0
- package/dist/server/flow-surfaces/chart-config.d.ts +121 -0
- package/dist/server/flow-surfaces/chart-config.js +1394 -0
- package/dist/server/flow-surfaces/compose-compiler.d.ts +108 -0
- package/dist/server/flow-surfaces/compose-compiler.js +167 -0
- package/dist/server/flow-surfaces/compose-runtime.d.ts +93 -0
- package/dist/server/flow-surfaces/compose-runtime.js +375 -0
- package/dist/server/flow-surfaces/configure-options.d.ts +23 -0
- package/dist/server/flow-surfaces/configure-options.js +827 -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/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 +185 -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/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 +243 -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 +131 -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 +195 -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 +20 -0
- package/dist/server/flow-surfaces/public-data-surface-default-filter.js +111 -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 +377 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +108 -0
- package/dist/server/flow-surfaces/service-utils.js +811 -0
- package/dist/server/flow-surfaces/service.d.ts +773 -0
- package/dist/server/flow-surfaces/service.js +13008 -0
- package/dist/server/flow-surfaces/support-matrix.d.ts +31 -0
- package/dist/server/flow-surfaces/support-matrix.js +259 -0
- package/dist/server/flow-surfaces/surface-context.d.ts +52 -0
- package/dist/server/flow-surfaces/surface-context.js +437 -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/plugin.js +2 -0
- package/dist/swagger/flow-surfaces.d.ts +5964 -0
- package/dist/swagger/flow-surfaces.examples.d.ts +1533 -0
- package/dist/swagger/flow-surfaces.examples.js +1758 -0
- package/dist/swagger/flow-surfaces.js +5315 -0
- package/dist/swagger/flow-surfaces.template-action-docs.d.ts +62 -0
- package/dist/swagger/flow-surfaces.template-action-docs.js +121 -0
- package/dist/swagger/flow-surfaces.template-schemas.d.ts +239 -0
- package/dist/swagger/flow-surfaces.template-schemas.js +255 -0
- package/dist/swagger/index.d.ts +5969 -0
- package/dist/swagger/index.js +50 -0
- package/package.json +2 -2
- /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,556 @@
|
|
|
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 context_exports = {};
|
|
28
|
+
__export(context_exports, {
|
|
29
|
+
buildFlowSurfaceContextResponse: () => buildFlowSurfaceContextResponse,
|
|
30
|
+
isBareFlowContextPath: () => isBareFlowContextPath
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(context_exports);
|
|
33
|
+
const RELATION_FIELD_TYPES = /* @__PURE__ */ new Set(["belongsTo", "hasOne", "hasMany", "belongsToMany", "belongsToArray"]);
|
|
34
|
+
const NUMERIC_FIELD_TYPES = /* @__PURE__ */ new Set(["integer", "float", "double", "decimal"]);
|
|
35
|
+
const BARE_FLOW_CONTEXT_PATH_RE = /^[A-Za-z_][A-Za-z0-9_-]*(\.[A-Za-z_][A-Za-z0-9_-]*)*$/;
|
|
36
|
+
function isBareFlowContextPath(path) {
|
|
37
|
+
return BARE_FLOW_CONTEXT_PATH_RE.test(path);
|
|
38
|
+
}
|
|
39
|
+
function getCollectionFields(collection) {
|
|
40
|
+
if (!collection) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
if (Array.isArray(collection.fields)) {
|
|
44
|
+
return collection.fields;
|
|
45
|
+
}
|
|
46
|
+
if (collection.fields instanceof Map) {
|
|
47
|
+
return Array.from(collection.fields.values());
|
|
48
|
+
}
|
|
49
|
+
if (collection.fields && typeof collection.fields === "object") {
|
|
50
|
+
return Object.values(collection.fields);
|
|
51
|
+
}
|
|
52
|
+
if (typeof collection.getFields === "function") {
|
|
53
|
+
return collection.getFields() || [];
|
|
54
|
+
}
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
function getCollectionCycleKey(collection) {
|
|
58
|
+
if (!collection) {
|
|
59
|
+
return void 0;
|
|
60
|
+
}
|
|
61
|
+
return `collection:${collection.dataSourceKey || "main"}:${collection.name || collection.title || "unknown"}`;
|
|
62
|
+
}
|
|
63
|
+
function getFieldType(field) {
|
|
64
|
+
const fieldType = field == null ? void 0 : field.type;
|
|
65
|
+
if (RELATION_FIELD_TYPES.has(fieldType)) {
|
|
66
|
+
return "object";
|
|
67
|
+
}
|
|
68
|
+
if (NUMERIC_FIELD_TYPES.has(fieldType)) {
|
|
69
|
+
return "number";
|
|
70
|
+
}
|
|
71
|
+
switch (fieldType) {
|
|
72
|
+
case "boolean":
|
|
73
|
+
return "boolean";
|
|
74
|
+
case "json":
|
|
75
|
+
return "object";
|
|
76
|
+
case "array":
|
|
77
|
+
return "array";
|
|
78
|
+
default:
|
|
79
|
+
return "string";
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function getFieldTargetCollection(field) {
|
|
83
|
+
const targetCollection = typeof (field == null ? void 0 : field.targetCollection) === "function" ? field.targetCollection() : field == null ? void 0 : field.targetCollection;
|
|
84
|
+
return targetCollection && typeof targetCollection === "object" ? targetCollection : null;
|
|
85
|
+
}
|
|
86
|
+
function isAssociationField(field, targetCollection) {
|
|
87
|
+
if (typeof (field == null ? void 0 : field.isAssociationField) === "function") {
|
|
88
|
+
return !!field.isAssociationField();
|
|
89
|
+
}
|
|
90
|
+
return !!targetCollection || RELATION_FIELD_TYPES.has(field == null ? void 0 : field.type);
|
|
91
|
+
}
|
|
92
|
+
function createCollectionFieldSpec(field) {
|
|
93
|
+
const targetCollection = getFieldTargetCollection(field);
|
|
94
|
+
return {
|
|
95
|
+
title: (field == null ? void 0 : field.title) || (field == null ? void 0 : field.name),
|
|
96
|
+
type: getFieldType(field),
|
|
97
|
+
interface: field == null ? void 0 : field.interface,
|
|
98
|
+
...isAssociationField(field, targetCollection) && targetCollection ? {
|
|
99
|
+
cycleKey: getCollectionCycleKey(targetCollection),
|
|
100
|
+
properties: () => buildCollectionProperties(targetCollection)
|
|
101
|
+
} : {}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function buildCollectionProperties(collection) {
|
|
105
|
+
const properties = {};
|
|
106
|
+
for (const field of getCollectionFields(collection)) {
|
|
107
|
+
if (!(field == null ? void 0 : field.name)) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
properties[field.name] = createCollectionFieldSpec(field);
|
|
111
|
+
}
|
|
112
|
+
return properties;
|
|
113
|
+
}
|
|
114
|
+
function createCollectionSpec(collection, title) {
|
|
115
|
+
if (!collection) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
title,
|
|
120
|
+
type: "object",
|
|
121
|
+
cycleKey: getCollectionCycleKey(collection),
|
|
122
|
+
properties: () => buildCollectionProperties(collection)
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function createItemSpec(currentCollection, parentSpec) {
|
|
126
|
+
if (!currentCollection) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
title: "Current item",
|
|
131
|
+
type: "object",
|
|
132
|
+
properties: () => {
|
|
133
|
+
const properties = {
|
|
134
|
+
index: {
|
|
135
|
+
title: "Index (starts from 0)",
|
|
136
|
+
type: "number"
|
|
137
|
+
},
|
|
138
|
+
length: {
|
|
139
|
+
title: "Total count",
|
|
140
|
+
type: "number"
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
const valueSpec = createCollectionSpec(currentCollection, "Attributes");
|
|
144
|
+
if (valueSpec) {
|
|
145
|
+
properties.value = valueSpec;
|
|
146
|
+
}
|
|
147
|
+
if (parentSpec) {
|
|
148
|
+
properties.parentItem = parentSpec;
|
|
149
|
+
}
|
|
150
|
+
return properties;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function buildItemChainSpec(collections, rootCollection) {
|
|
155
|
+
if (!collections.length) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
let parentSpec;
|
|
159
|
+
if (rootCollection) {
|
|
160
|
+
parentSpec = {
|
|
161
|
+
title: "Parent item",
|
|
162
|
+
type: "object",
|
|
163
|
+
properties: () => {
|
|
164
|
+
const properties = {
|
|
165
|
+
index: {
|
|
166
|
+
title: "Index (starts from 0)",
|
|
167
|
+
type: "number"
|
|
168
|
+
},
|
|
169
|
+
length: {
|
|
170
|
+
title: "Total count",
|
|
171
|
+
type: "number"
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const valueSpec = createCollectionSpec(rootCollection, "Attributes");
|
|
175
|
+
if (valueSpec) {
|
|
176
|
+
properties.value = valueSpec;
|
|
177
|
+
}
|
|
178
|
+
return properties;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
for (let index = collections.length - 1; index >= 0; index -= 1) {
|
|
183
|
+
const itemSpec = createItemSpec(collections[index], parentSpec);
|
|
184
|
+
if (!itemSpec) {
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (parentSpec) {
|
|
188
|
+
itemSpec.title = "Parent item";
|
|
189
|
+
}
|
|
190
|
+
parentSpec = itemSpec;
|
|
191
|
+
}
|
|
192
|
+
if (!parentSpec) {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
parentSpec.title = "Current item";
|
|
196
|
+
return parentSpec;
|
|
197
|
+
}
|
|
198
|
+
function buildPopupChainSpec(levels) {
|
|
199
|
+
if (!levels.length) {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
const currentLevel = levels[0] || {};
|
|
203
|
+
const parentLevel = levels[1] || null;
|
|
204
|
+
return {
|
|
205
|
+
title: "Current popup",
|
|
206
|
+
type: "object",
|
|
207
|
+
properties: () => {
|
|
208
|
+
const properties = {
|
|
209
|
+
uid: {
|
|
210
|
+
title: "Popup uid",
|
|
211
|
+
type: "string"
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
const recordSpec = createCollectionSpec(currentLevel.recordCollection, "Current popup record");
|
|
215
|
+
if (recordSpec) {
|
|
216
|
+
properties.record = recordSpec;
|
|
217
|
+
}
|
|
218
|
+
const sourceRecordSpec = createCollectionSpec(currentLevel.sourceRecordCollection, "Current popup parent record");
|
|
219
|
+
if (sourceRecordSpec) {
|
|
220
|
+
properties.sourceRecord = sourceRecordSpec;
|
|
221
|
+
}
|
|
222
|
+
if (parentLevel) {
|
|
223
|
+
properties.parent = {
|
|
224
|
+
title: "Parent popup",
|
|
225
|
+
type: "object",
|
|
226
|
+
properties: () => {
|
|
227
|
+
const parentProperties = {
|
|
228
|
+
uid: {
|
|
229
|
+
title: "Popup uid",
|
|
230
|
+
type: "string"
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
const parentRecordSpec = createCollectionSpec(parentLevel.recordCollection, "Popup record");
|
|
234
|
+
if (parentRecordSpec) {
|
|
235
|
+
parentProperties.record = parentRecordSpec;
|
|
236
|
+
}
|
|
237
|
+
return parentProperties;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
return properties;
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function buildChartQueryOutputsSpec(outputs) {
|
|
246
|
+
if (!outputs.length) {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
title: "Builder query outputs",
|
|
251
|
+
type: "object",
|
|
252
|
+
properties: () => Object.fromEntries(
|
|
253
|
+
outputs.map((output) => {
|
|
254
|
+
const fieldValue = Array.isArray(output.field) ? output.field.join(".") : output.field;
|
|
255
|
+
const descSegments = [
|
|
256
|
+
output.source === "sql" ? "SQL preview output" : output.kind === "measure" ? "Measure output" : output.kind === "dimension" ? "Dimension output" : "",
|
|
257
|
+
fieldValue ? `field=${fieldValue}` : "",
|
|
258
|
+
output.aggregation ? `aggregation=${output.aggregation}` : "",
|
|
259
|
+
output.format ? `format=${output.format}` : ""
|
|
260
|
+
].filter(Boolean);
|
|
261
|
+
return [
|
|
262
|
+
output.alias,
|
|
263
|
+
{
|
|
264
|
+
title: output.alias,
|
|
265
|
+
type: output.type || "string",
|
|
266
|
+
...descSegments.length ? { description: descSegments.join("; ") } : {}
|
|
267
|
+
}
|
|
268
|
+
];
|
|
269
|
+
})
|
|
270
|
+
)
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function buildChartAliasesSpec(aliases) {
|
|
274
|
+
if (!aliases.length) {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
title: "Builder query aliases",
|
|
279
|
+
type: "object",
|
|
280
|
+
properties: () => Object.fromEntries(
|
|
281
|
+
aliases.map((alias) => [
|
|
282
|
+
alias,
|
|
283
|
+
{
|
|
284
|
+
title: alias,
|
|
285
|
+
type: "string",
|
|
286
|
+
description: "Builder query output alias that can be used by visual.mappings.*. Do not assume it is valid for query.sorting.field; aggregated measure outputs and custom measure aliases remain unsupported there."
|
|
287
|
+
}
|
|
288
|
+
])
|
|
289
|
+
)
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function buildChartSupportedMappingsSpec(supportedMappings) {
|
|
293
|
+
if (!supportedMappings || !Object.keys(supportedMappings).length) {
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
return {
|
|
297
|
+
title: "Supported mappings by visual type",
|
|
298
|
+
type: "object",
|
|
299
|
+
properties: () => Object.fromEntries(
|
|
300
|
+
Object.entries(supportedMappings).map(([visualType, support]) => [
|
|
301
|
+
visualType,
|
|
302
|
+
{
|
|
303
|
+
title: visualType,
|
|
304
|
+
type: "object",
|
|
305
|
+
properties: () => Object.fromEntries(
|
|
306
|
+
(support.allowed || []).map((mappingKey) => [
|
|
307
|
+
mappingKey,
|
|
308
|
+
{
|
|
309
|
+
title: mappingKey,
|
|
310
|
+
type: "string",
|
|
311
|
+
description: (support.required || []).includes(mappingKey) ? "Required mapping key" : "Optional mapping key"
|
|
312
|
+
}
|
|
313
|
+
])
|
|
314
|
+
)
|
|
315
|
+
}
|
|
316
|
+
])
|
|
317
|
+
)
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function buildChartSupportedStylesSpec(supportedStyles) {
|
|
321
|
+
if (!supportedStyles || !Object.keys(supportedStyles).length) {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
return {
|
|
325
|
+
title: "Supported style keys by visual type",
|
|
326
|
+
type: "object",
|
|
327
|
+
properties: () => Object.fromEntries(
|
|
328
|
+
Object.entries(supportedStyles).map(([visualType, styles]) => [
|
|
329
|
+
visualType,
|
|
330
|
+
{
|
|
331
|
+
title: visualType,
|
|
332
|
+
type: "object",
|
|
333
|
+
properties: () => Object.fromEntries(
|
|
334
|
+
Object.entries(styles || {}).map(([styleKey, support]) => {
|
|
335
|
+
var _a;
|
|
336
|
+
return [
|
|
337
|
+
styleKey,
|
|
338
|
+
{
|
|
339
|
+
title: styleKey,
|
|
340
|
+
type: support.type,
|
|
341
|
+
...support.description ? { description: support.description } : {},
|
|
342
|
+
...((_a = support.enumValues) == null ? void 0 : _a.length) ? { enumValues: [...support.enumValues] } : {},
|
|
343
|
+
...typeof support.min !== "undefined" ? { min: support.min } : {},
|
|
344
|
+
...typeof support.max !== "undefined" ? { max: support.max } : {}
|
|
345
|
+
}
|
|
346
|
+
];
|
|
347
|
+
})
|
|
348
|
+
)
|
|
349
|
+
}
|
|
350
|
+
])
|
|
351
|
+
)
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
function buildChartSupportedVisualTypesSpec(types) {
|
|
355
|
+
if (!types.length) {
|
|
356
|
+
return null;
|
|
357
|
+
}
|
|
358
|
+
return {
|
|
359
|
+
title: "Supported visual types",
|
|
360
|
+
type: "object",
|
|
361
|
+
properties: () => Object.fromEntries(
|
|
362
|
+
types.map((type) => [
|
|
363
|
+
type,
|
|
364
|
+
{
|
|
365
|
+
title: type,
|
|
366
|
+
type: "string",
|
|
367
|
+
description: "Supported chart visual.type value"
|
|
368
|
+
}
|
|
369
|
+
])
|
|
370
|
+
)
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
function buildChartHintListSpec(title, hints) {
|
|
374
|
+
if (!hints.length) {
|
|
375
|
+
return null;
|
|
376
|
+
}
|
|
377
|
+
return {
|
|
378
|
+
title,
|
|
379
|
+
type: "object",
|
|
380
|
+
properties: () => Object.fromEntries(
|
|
381
|
+
hints.map((hint) => [
|
|
382
|
+
hint.key,
|
|
383
|
+
{
|
|
384
|
+
title: hint.title,
|
|
385
|
+
type: "string",
|
|
386
|
+
description: hint.description
|
|
387
|
+
}
|
|
388
|
+
])
|
|
389
|
+
)
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
function createChartSpec(chart) {
|
|
393
|
+
if (!chart) {
|
|
394
|
+
return null;
|
|
395
|
+
}
|
|
396
|
+
return {
|
|
397
|
+
title: "Chart helpers",
|
|
398
|
+
type: "object",
|
|
399
|
+
properties: () => {
|
|
400
|
+
const properties = {};
|
|
401
|
+
const queryOutputsSpec = buildChartQueryOutputsSpec(chart.queryOutputs || []);
|
|
402
|
+
if (queryOutputsSpec) {
|
|
403
|
+
properties.queryOutputs = queryOutputsSpec;
|
|
404
|
+
}
|
|
405
|
+
const aliasesSpec = buildChartAliasesSpec(chart.aliases || []);
|
|
406
|
+
if (aliasesSpec) {
|
|
407
|
+
properties.aliases = aliasesSpec;
|
|
408
|
+
}
|
|
409
|
+
const supportedMappingsSpec = buildChartSupportedMappingsSpec(chart.supportedMappings);
|
|
410
|
+
if (supportedMappingsSpec) {
|
|
411
|
+
properties.supportedMappings = supportedMappingsSpec;
|
|
412
|
+
}
|
|
413
|
+
const supportedStylesSpec = buildChartSupportedStylesSpec(chart.supportedStyles);
|
|
414
|
+
if (supportedStylesSpec) {
|
|
415
|
+
properties.supportedStyles = supportedStylesSpec;
|
|
416
|
+
}
|
|
417
|
+
const supportedVisualTypesSpec = buildChartSupportedVisualTypesSpec(chart.supportedVisualTypes || []);
|
|
418
|
+
if (supportedVisualTypesSpec) {
|
|
419
|
+
properties.supportedVisualTypes = supportedVisualTypesSpec;
|
|
420
|
+
}
|
|
421
|
+
const safeDefaultsSpec = buildChartHintListSpec("Safe defaults", chart.safeDefaults || []);
|
|
422
|
+
if (safeDefaultsSpec) {
|
|
423
|
+
properties.safeDefaults = safeDefaultsSpec;
|
|
424
|
+
}
|
|
425
|
+
const riskyPatternsSpec = buildChartHintListSpec("Risky patterns", chart.riskyPatterns || []);
|
|
426
|
+
if (riskyPatternsSpec) {
|
|
427
|
+
properties.riskyPatterns = riskyPatternsSpec;
|
|
428
|
+
}
|
|
429
|
+
const unsupportedPatternsSpec = buildChartHintListSpec("Unsupported patterns", chart.unsupportedPatterns || []);
|
|
430
|
+
if (unsupportedPatternsSpec) {
|
|
431
|
+
properties.unsupportedPatterns = unsupportedPatternsSpec;
|
|
432
|
+
}
|
|
433
|
+
return properties;
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
function createSpecMap(input) {
|
|
438
|
+
const specs = {};
|
|
439
|
+
const collectionSpec = createCollectionSpec(input.collection, "Current collection");
|
|
440
|
+
if (collectionSpec) {
|
|
441
|
+
specs.collection = collectionSpec;
|
|
442
|
+
}
|
|
443
|
+
const recordSpec = createCollectionSpec(input.recordCollection, "Current record");
|
|
444
|
+
if (recordSpec) {
|
|
445
|
+
specs.record = recordSpec;
|
|
446
|
+
}
|
|
447
|
+
const formValuesSpec = createCollectionSpec(input.formValuesCollection, "Current form");
|
|
448
|
+
if (formValuesSpec) {
|
|
449
|
+
specs.formValues = formValuesSpec;
|
|
450
|
+
}
|
|
451
|
+
const itemSpec = buildItemChainSpec(input.itemCollections || [], input.itemRootCollection);
|
|
452
|
+
if (itemSpec) {
|
|
453
|
+
specs.item = itemSpec;
|
|
454
|
+
}
|
|
455
|
+
const popupSpec = buildPopupChainSpec(input.popupLevels || []);
|
|
456
|
+
if (popupSpec) {
|
|
457
|
+
specs.popup = popupSpec;
|
|
458
|
+
}
|
|
459
|
+
const chartSpec = createChartSpec(input.chart);
|
|
460
|
+
if (chartSpec) {
|
|
461
|
+
specs.chart = chartSpec;
|
|
462
|
+
}
|
|
463
|
+
return specs;
|
|
464
|
+
}
|
|
465
|
+
function materializeSpecNode(node, depth, maxDepth, visited) {
|
|
466
|
+
const output = {};
|
|
467
|
+
if (typeof node.title !== "undefined") {
|
|
468
|
+
output.title = node.title;
|
|
469
|
+
}
|
|
470
|
+
if (typeof node.type !== "undefined") {
|
|
471
|
+
output.type = node.type;
|
|
472
|
+
}
|
|
473
|
+
if (typeof node.interface !== "undefined") {
|
|
474
|
+
output.interface = node.interface;
|
|
475
|
+
}
|
|
476
|
+
if (typeof node.description !== "undefined") {
|
|
477
|
+
output.description = node.description;
|
|
478
|
+
}
|
|
479
|
+
if (Array.isArray(node.enumValues) && node.enumValues.length) {
|
|
480
|
+
output.enumValues = [...node.enumValues];
|
|
481
|
+
}
|
|
482
|
+
if (typeof node.min !== "undefined") {
|
|
483
|
+
output.min = node.min;
|
|
484
|
+
}
|
|
485
|
+
if (typeof node.max !== "undefined") {
|
|
486
|
+
output.max = node.max;
|
|
487
|
+
}
|
|
488
|
+
if (typeof node.disabled !== "undefined") {
|
|
489
|
+
output.disabled = node.disabled;
|
|
490
|
+
}
|
|
491
|
+
if (typeof node.disabledReason !== "undefined") {
|
|
492
|
+
output.disabledReason = node.disabledReason;
|
|
493
|
+
}
|
|
494
|
+
if (depth >= maxDepth || typeof node.properties !== "function") {
|
|
495
|
+
return output;
|
|
496
|
+
}
|
|
497
|
+
if (node.cycleKey && visited.has(node.cycleKey)) {
|
|
498
|
+
return output;
|
|
499
|
+
}
|
|
500
|
+
const nextVisited = new Set(visited);
|
|
501
|
+
if (node.cycleKey) {
|
|
502
|
+
nextVisited.add(node.cycleKey);
|
|
503
|
+
}
|
|
504
|
+
const properties = node.properties();
|
|
505
|
+
const propertyEntries = Object.entries(properties || {});
|
|
506
|
+
if (!propertyEntries.length) {
|
|
507
|
+
return output;
|
|
508
|
+
}
|
|
509
|
+
output.properties = Object.fromEntries(
|
|
510
|
+
propertyEntries.map(([key, child]) => [key, materializeSpecNode(child, depth + 1, maxDepth, nextVisited)])
|
|
511
|
+
);
|
|
512
|
+
return output;
|
|
513
|
+
}
|
|
514
|
+
function resolveSpecAtPath(specs, path) {
|
|
515
|
+
var _a;
|
|
516
|
+
const segments = String(path || "").split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
517
|
+
if (!segments.length) {
|
|
518
|
+
return void 0;
|
|
519
|
+
}
|
|
520
|
+
let current = specs[segments[0]];
|
|
521
|
+
if (!current) {
|
|
522
|
+
return void 0;
|
|
523
|
+
}
|
|
524
|
+
for (let index = 1; index < segments.length; index += 1) {
|
|
525
|
+
const properties = (_a = current.properties) == null ? void 0 : _a.call(current);
|
|
526
|
+
if (!properties) {
|
|
527
|
+
return void 0;
|
|
528
|
+
}
|
|
529
|
+
current = properties[segments[index]];
|
|
530
|
+
if (!current) {
|
|
531
|
+
return void 0;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
return current;
|
|
535
|
+
}
|
|
536
|
+
function buildFlowSurfaceContextResponse(input) {
|
|
537
|
+
const maxDepthRaw = input.maxDepth ?? 3;
|
|
538
|
+
const maxDepth = Number.isFinite(maxDepthRaw) ? Math.max(1, Math.floor(maxDepthRaw)) : 3;
|
|
539
|
+
const specs = createSpecMap(input.semantic);
|
|
540
|
+
if (input.path) {
|
|
541
|
+
const targetSpec = resolveSpecAtPath(specs, input.path);
|
|
542
|
+
return {
|
|
543
|
+
vars: targetSpec ? { [input.path]: materializeSpecNode(targetSpec, 1, maxDepth, /* @__PURE__ */ new Set()) } : {}
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
return {
|
|
547
|
+
vars: Object.fromEntries(
|
|
548
|
+
Object.entries(specs).map(([key, spec]) => [key, materializeSpecNode(spec, 1, maxDepth, /* @__PURE__ */ new Set())])
|
|
549
|
+
)
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
553
|
+
0 && (module.exports = {
|
|
554
|
+
buildFlowSurfaceContextResponse,
|
|
555
|
+
isBareFlowContextPath
|
|
556
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
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 { FlowSurfaceDomainContract, FlowSurfaceNodeDomain } from './types';
|
|
10
|
+
export declare class FlowSurfaceContractGuard {
|
|
11
|
+
mergeDomainValue(domain: FlowSurfaceNodeDomain, currentValue: any, nextValue: any, contract: FlowSurfaceDomainContract, use: string): any;
|
|
12
|
+
validateFlowRegistry(node: any, flowRegistry: Record<string, any>): void;
|
|
13
|
+
validateLayout(grid: any, layout: {
|
|
14
|
+
rows: Record<string, string[][]>;
|
|
15
|
+
sizes: Record<string, number[]>;
|
|
16
|
+
rowOrder: string[];
|
|
17
|
+
}): void;
|
|
18
|
+
validateNodeTreeAgainstContract(node: any): void;
|
|
19
|
+
}
|