@nocobase/plugin-flow-engine 2.1.0-beta.2 → 2.1.0-beta.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 +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 +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 +192 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +14 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.js +1029 -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 +1097 -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 +3577 -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 +860 -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 +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 +83 -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 +134 -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 +108 -0
- package/dist/server/flow-surfaces/service-utils.js +811 -0
- package/dist/server/flow-surfaces/service.d.ts +814 -0
- package/dist/server/flow-surfaces/service.js +14276 -0
- package/dist/server/flow-surfaces/support-matrix.d.ts +31 -0
- package/dist/server/flow-surfaces/support-matrix.js +271 -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 +5964 -0
- package/dist/swagger/flow-surfaces.examples.d.ts +1572 -0
- package/dist/swagger/flow-surfaces.examples.js +1805 -0
- package/dist/swagger/flow-surfaces.js +5322 -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 +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,192 @@
|
|
|
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 association_title_field_exports = {};
|
|
28
|
+
__export(association_title_field_exports, {
|
|
29
|
+
assertCollectionTitleFieldExists: () => assertCollectionTitleFieldExists,
|
|
30
|
+
getExplicitCollectionTitleFieldName: () => getExplicitCollectionTitleFieldName,
|
|
31
|
+
isTitleableCollectionField: () => isTitleableCollectionField,
|
|
32
|
+
resolveAssociationSafeTitleField: () => resolveAssociationSafeTitleField,
|
|
33
|
+
resolveAssociationTitleFieldTargetCollection: () => resolveAssociationTitleFieldTargetCollection,
|
|
34
|
+
resolveCollectionSafeTitleField: () => resolveCollectionSafeTitleField
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(association_title_field_exports);
|
|
37
|
+
var import_errors = require("./errors");
|
|
38
|
+
var import_service_helpers = require("./service-helpers");
|
|
39
|
+
const FALLBACK_TITLE_USABLE_INTERFACES = /* @__PURE__ */ new Set([
|
|
40
|
+
"attachmentURL",
|
|
41
|
+
"date",
|
|
42
|
+
"datetime",
|
|
43
|
+
"datetimeNoTz",
|
|
44
|
+
"email",
|
|
45
|
+
"formula",
|
|
46
|
+
"id",
|
|
47
|
+
"input",
|
|
48
|
+
"integer",
|
|
49
|
+
"nanoid",
|
|
50
|
+
"number",
|
|
51
|
+
"percent",
|
|
52
|
+
"phone",
|
|
53
|
+
"radioGroup",
|
|
54
|
+
"select",
|
|
55
|
+
"sequence",
|
|
56
|
+
"snowflakeId",
|
|
57
|
+
"sort",
|
|
58
|
+
"space",
|
|
59
|
+
"textarea",
|
|
60
|
+
"time",
|
|
61
|
+
"unixTimestamp",
|
|
62
|
+
"url",
|
|
63
|
+
"uuid",
|
|
64
|
+
"vditor"
|
|
65
|
+
]);
|
|
66
|
+
const LAST_RESORT_TITLE_FIELD_NAMES = /* @__PURE__ */ new Set(["createdAt", "updatedAt"]);
|
|
67
|
+
const LAST_RESORT_TITLE_FIELD_INTERFACES = /* @__PURE__ */ new Set(["createdAt", "updatedAt"]);
|
|
68
|
+
function isTitleableCollectionField(field) {
|
|
69
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
70
|
+
const configured = (field == null ? void 0 : field.titleable) ?? (field == null ? void 0 : field.titleUsable) ?? ((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.titleable) ?? ((_b = field == null ? void 0 : field.options) == null ? void 0 : _b.titleUsable);
|
|
71
|
+
if (typeof configured === "boolean") {
|
|
72
|
+
return configured;
|
|
73
|
+
}
|
|
74
|
+
const interfaceOptions = typeof (field == null ? void 0 : field.getInterfaceOptions) === "function" ? field.getInterfaceOptions() : void 0;
|
|
75
|
+
if (typeof (interfaceOptions == null ? void 0 : interfaceOptions.titleUsable) === "boolean") {
|
|
76
|
+
return interfaceOptions.titleUsable;
|
|
77
|
+
}
|
|
78
|
+
const interfaceName = typeof (field == null ? void 0 : field.interface) === "string" ? field.interface : typeof ((_c = field == null ? void 0 : field.options) == null ? void 0 : _c.interface) === "string" ? field.options.interface : void 0;
|
|
79
|
+
const interfaceCtor = ((_f = (_e = (_d = field == null ? void 0 : field.collection) == null ? void 0 : _d.collectionManager) == null ? void 0 : _e.getFieldInterface) == null ? void 0 : _f.call(_e, interfaceName)) || ((_j = (_i = (_h = (_g = field == null ? void 0 : field.collection) == null ? void 0 : _g.db) == null ? void 0 : _h.interfaceManager) == null ? void 0 : _i.getInterfaceType) == null ? void 0 : _j.call(_i, interfaceName));
|
|
80
|
+
if (interfaceCtor) {
|
|
81
|
+
const interfaceInstance = typeof interfaceCtor === "function" ? new interfaceCtor(void 0) : interfaceCtor;
|
|
82
|
+
if (typeof (interfaceInstance == null ? void 0 : interfaceInstance.titleUsable) === "boolean") {
|
|
83
|
+
return interfaceInstance.titleUsable;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return !!(interfaceName && FALLBACK_TITLE_USABLE_INTERFACES.has(interfaceName));
|
|
87
|
+
}
|
|
88
|
+
function getExplicitCollectionTitleFieldName(collection) {
|
|
89
|
+
var _a;
|
|
90
|
+
const explicit = (_a = collection == null ? void 0 : collection.options) == null ? void 0 : _a.titleField;
|
|
91
|
+
return typeof explicit === "string" ? explicit.trim() || void 0 : void 0;
|
|
92
|
+
}
|
|
93
|
+
function normalizeTitleFieldName(value) {
|
|
94
|
+
if (typeof value !== "string") {
|
|
95
|
+
return void 0;
|
|
96
|
+
}
|
|
97
|
+
const normalized = value.trim();
|
|
98
|
+
return normalized || void 0;
|
|
99
|
+
}
|
|
100
|
+
function getAssociationConfiguredLabelFieldName(field) {
|
|
101
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
102
|
+
return normalizeTitleFieldName((_c = (_b = (_a = field == null ? void 0 : field.uiSchema) == null ? void 0 : _a["x-component-props"]) == null ? void 0 : _b.fieldNames) == null ? void 0 : _c.label) || normalizeTitleFieldName((_g = (_f = (_e = (_d = field == null ? void 0 : field.options) == null ? void 0 : _d.uiSchema) == null ? void 0 : _e["x-component-props"]) == null ? void 0 : _f.fieldNames) == null ? void 0 : _g.label);
|
|
103
|
+
}
|
|
104
|
+
function isLastResortTitleField(field) {
|
|
105
|
+
const fieldName = (0, import_service_helpers.getFieldName)(field);
|
|
106
|
+
if (fieldName && LAST_RESORT_TITLE_FIELD_NAMES.has(fieldName)) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
const fieldInterface = (0, import_service_helpers.getFieldInterface)(field);
|
|
110
|
+
return !!(fieldInterface && LAST_RESORT_TITLE_FIELD_INTERFACES.has(fieldInterface));
|
|
111
|
+
}
|
|
112
|
+
function assertCollectionTitleFieldExists(collection, fieldName) {
|
|
113
|
+
const normalizedFieldName = typeof fieldName === "string" ? fieldName.trim() : String(fieldName || "").trim();
|
|
114
|
+
if (!normalizedFieldName) {
|
|
115
|
+
(0, import_errors.throwBadRequest)("flowSurfaces association titleField must be a non-empty string");
|
|
116
|
+
}
|
|
117
|
+
const field = (0, import_service_helpers.resolveFieldFromCollection)(collection, normalizedFieldName);
|
|
118
|
+
if (!field) {
|
|
119
|
+
(0, import_errors.throwBadRequest)(
|
|
120
|
+
`flowSurfaces collection '${(0, import_service_helpers.getCollectionName)(collection) || "unknown"}' titleField '${normalizedFieldName}' not found`
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
return field;
|
|
124
|
+
}
|
|
125
|
+
function resolveCollectionSafeTitleField(collection) {
|
|
126
|
+
if (!collection) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
const explicitTitleField = getExplicitCollectionTitleFieldName(collection);
|
|
130
|
+
if (explicitTitleField) {
|
|
131
|
+
const field = assertCollectionTitleFieldExists(collection, explicitTitleField);
|
|
132
|
+
return {
|
|
133
|
+
field,
|
|
134
|
+
fieldName: (0, import_service_helpers.getFieldName)(field) || explicitTitleField,
|
|
135
|
+
source: "explicit",
|
|
136
|
+
targetCollection: collection
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
const firstTitleableField = (0, import_service_helpers.getCollectionFields)(collection).find(
|
|
140
|
+
(field) => !!(0, import_service_helpers.getFieldName)(field) && isTitleableCollectionField(field)
|
|
141
|
+
);
|
|
142
|
+
if (!firstTitleableField) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
const preferredTitleableField = (0, import_service_helpers.getCollectionFields)(collection).find(
|
|
146
|
+
(field) => !!(0, import_service_helpers.getFieldName)(field) && isTitleableCollectionField(field) && !isLastResortTitleField(field)
|
|
147
|
+
) || firstTitleableField;
|
|
148
|
+
return {
|
|
149
|
+
field: preferredTitleableField,
|
|
150
|
+
fieldName: (0, import_service_helpers.getFieldName)(preferredTitleableField),
|
|
151
|
+
source: "firstTitleable",
|
|
152
|
+
targetCollection: collection
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function resolveAssociationTitleFieldTargetCollection(field, dataSourceKey, getCollection) {
|
|
156
|
+
return (0, import_service_helpers.resolveFieldTargetCollection)(field, dataSourceKey, getCollection) || null;
|
|
157
|
+
}
|
|
158
|
+
function resolveAssociationSafeTitleField(field, dataSourceKey, getCollection) {
|
|
159
|
+
const targetCollection = resolveAssociationTitleFieldTargetCollection(field, dataSourceKey, getCollection);
|
|
160
|
+
if (!targetCollection) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
const configuredLabelFieldName = getAssociationConfiguredLabelFieldName(field);
|
|
164
|
+
if (configuredLabelFieldName) {
|
|
165
|
+
const configuredLabelField = (0, import_service_helpers.resolveFieldFromCollection)(targetCollection, configuredLabelFieldName);
|
|
166
|
+
if (configuredLabelField) {
|
|
167
|
+
return {
|
|
168
|
+
field: configuredLabelField,
|
|
169
|
+
fieldName: configuredLabelFieldName,
|
|
170
|
+
source: "relationFieldLabel",
|
|
171
|
+
targetCollection
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
const resolved = resolveCollectionSafeTitleField(targetCollection);
|
|
176
|
+
if (!resolved) {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
...resolved,
|
|
181
|
+
targetCollection
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
185
|
+
0 && (module.exports = {
|
|
186
|
+
assertCollectionTitleFieldExists,
|
|
187
|
+
getExplicitCollectionTitleFieldName,
|
|
188
|
+
isTitleableCollectionField,
|
|
189
|
+
resolveAssociationSafeTitleField,
|
|
190
|
+
resolveAssociationTitleFieldTargetCollection,
|
|
191
|
+
resolveCollectionSafeTitleField
|
|
192
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
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 { FlowSurfaceApplyBlueprintDocument, FlowSurfaceApplyBlueprintLayout, FlowSurfaceApplyBlueprintTabDocument } from './public-types';
|
|
11
|
+
export declare function collectReferencedBlockKeys(layout: FlowSurfaceApplyBlueprintLayout | undefined, context: string): Set<string>;
|
|
12
|
+
export declare function compileTabComposeValues(tab: FlowSurfaceApplyBlueprintTabDocument, document: FlowSurfaceApplyBlueprintDocument, tabIndex: number, options: {
|
|
13
|
+
mode: 'append' | 'replace';
|
|
14
|
+
}): _.Dictionary<any>;
|