@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.
Files changed (248) hide show
  1. package/LICENSE +201 -661
  2. package/README.md +79 -9
  3. package/dist/ai/ai-employees/nathan/index.d.ts +10 -0
  4. package/dist/ai/ai-employees/nathan/index.js +41 -0
  5. package/dist/ai/ai-employees/nathan/prompt.md +132 -0
  6. package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +69 -0
  7. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.js +2 -2
  8. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.js +2 -2
  9. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.js +2 -2
  10. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.js +2 -2
  11. package/dist/ai/docs/runjs/context/block-model.md +35 -35
  12. package/dist/ai/docs/runjs/context/collection-field.md +53 -51
  13. package/dist/ai/docs/runjs/context/collection.md +39 -39
  14. package/dist/ai/docs/runjs/context/data-source-manager.md +40 -30
  15. package/dist/ai/docs/runjs/context/data-source.md +52 -44
  16. package/dist/ai/docs/runjs/context/element.md +44 -38
  17. package/dist/ai/docs/runjs/context/exit-all.md +37 -35
  18. package/dist/ai/docs/runjs/context/exit.md +38 -35
  19. package/dist/ai/docs/runjs/context/filter-manager.md +36 -30
  20. package/dist/ai/docs/runjs/context/form.md +57 -57
  21. package/dist/ai/docs/runjs/context/get-model.md +22 -21
  22. package/dist/ai/docs/runjs/context/get-value.md +20 -19
  23. package/dist/ai/docs/runjs/context/get-var.md +61 -55
  24. package/dist/ai/docs/runjs/context/i18n.md +17 -14
  25. package/dist/ai/docs/runjs/context/import-async.md +333 -45
  26. package/dist/ai/docs/runjs/context/init-resource.md +20 -20
  27. package/dist/ai/docs/runjs/context/libs.md +31 -31
  28. package/dist/ai/docs/runjs/context/location.md +34 -31
  29. package/dist/ai/docs/runjs/context/logger.md +41 -40
  30. package/dist/ai/docs/runjs/context/make-resource.md +27 -26
  31. package/dist/ai/docs/runjs/context/message.md +42 -41
  32. package/dist/ai/docs/runjs/context/modal.md +44 -44
  33. package/dist/ai/docs/runjs/context/model.md +36 -33
  34. package/dist/ai/docs/runjs/context/notification.md +41 -40
  35. package/dist/ai/docs/runjs/context/off.md +14 -14
  36. package/dist/ai/docs/runjs/context/on.md +30 -29
  37. package/dist/ai/docs/runjs/context/open-view.md +40 -40
  38. package/dist/ai/docs/runjs/context/render.md +37 -32
  39. package/dist/ai/docs/runjs/context/request.md +46 -45
  40. package/dist/ai/docs/runjs/context/require-async.md +28 -25
  41. package/dist/ai/docs/runjs/context/resource.md +34 -34
  42. package/dist/ai/docs/runjs/context/route.md +36 -34
  43. package/dist/ai/docs/runjs/context/router.md +43 -31
  44. package/dist/ai/docs/runjs/context/set-value.md +18 -17
  45. package/dist/ai/docs/runjs/context/sql.md +7 -15
  46. package/dist/ai/docs/runjs/context/t.md +20 -17
  47. package/dist/ai/docs/runjs/context/view.md +49 -46
  48. package/dist/ai/docs/runjs/document.md +1 -0
  49. package/dist/ai/docs/runjs/import-modules.md +32 -32
  50. package/dist/ai/docs/runjs/index.md +13 -13
  51. package/dist/ai/docs/runjs/jsx.md +19 -19
  52. package/dist/ai/docs/runjs/model/form-block-model.md +1 -3
  53. package/dist/ai/docs/runjs/render.md +15 -15
  54. package/dist/ai/docs/runjs/resource/api-resource.md +53 -53
  55. package/dist/ai/docs/runjs/resource/multi-record-resource.md +64 -64
  56. package/dist/ai/docs/runjs/resource/single-record-resource.md +55 -55
  57. package/dist/ai/docs/runjs/resource/sql-resource.md +57 -57
  58. package/dist/ai/docs/runjs/window.md +5 -5
  59. package/dist/client/index.js +1 -1
  60. package/dist/externalVersion.js +12 -11
  61. package/dist/locale/en-US.json +1 -0
  62. package/dist/locale/index.d.ts +2 -0
  63. package/dist/locale/zh-CN.json +1 -0
  64. package/dist/node_modules/ses/dist/ses.cjs +1 -1
  65. package/dist/node_modules/ses/package.json +1 -1
  66. package/dist/node_modules/zod/index.cjs +1 -1
  67. package/dist/node_modules/zod/package.json +1 -1
  68. package/dist/server/collections/flowsql.js +1 -0
  69. package/dist/server/flow-surfaces/action-scope.d.ts +39 -0
  70. package/dist/server/flow-surfaces/action-scope.js +156 -0
  71. package/dist/server/flow-surfaces/apply/compiler.d.ts +13 -0
  72. package/dist/server/flow-surfaces/apply/compiler.js +971 -0
  73. package/dist/server/flow-surfaces/apply/layout.d.ts +34 -0
  74. package/dist/server/flow-surfaces/apply/layout.js +175 -0
  75. package/dist/server/flow-surfaces/apply/matching.d.ts +16 -0
  76. package/dist/server/flow-surfaces/apply/matching.js +181 -0
  77. package/dist/server/flow-surfaces/approval/blueprint-service.d.ts +84 -0
  78. package/dist/server/flow-surfaces/approval/blueprint-service.js +589 -0
  79. package/dist/server/flow-surfaces/approval/blueprint.d.ts +21 -0
  80. package/dist/server/flow-surfaces/approval/blueprint.js +187 -0
  81. package/dist/server/flow-surfaces/approval/builder.d.ts +225 -0
  82. package/dist/server/flow-surfaces/approval/builder.js +384 -0
  83. package/dist/server/flow-surfaces/approval/catalog-specs.d.ts +33 -0
  84. package/dist/server/flow-surfaces/approval/catalog-specs.js +156 -0
  85. package/dist/server/flow-surfaces/approval/index.d.ts +14 -0
  86. package/dist/server/flow-surfaces/approval/index.js +40 -0
  87. package/dist/server/flow-surfaces/approval/runtime-config.d.ts +44 -0
  88. package/dist/server/flow-surfaces/approval/runtime-config.js +299 -0
  89. package/dist/server/flow-surfaces/approval/semantic-use.d.ts +23 -0
  90. package/dist/server/flow-surfaces/approval/semantic-use.js +155 -0
  91. package/dist/server/flow-surfaces/association-interfaces.d.ts +10 -0
  92. package/dist/server/flow-surfaces/association-interfaces.js +39 -0
  93. package/dist/server/flow-surfaces/association-title-field.d.ts +20 -0
  94. package/dist/server/flow-surfaces/association-title-field.js +192 -0
  95. package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +14 -0
  96. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +1074 -0
  97. package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +13 -0
  98. package/dist/server/flow-surfaces/blueprint/compile-plan.js +308 -0
  99. package/dist/server/flow-surfaces/blueprint/compile-reaction.d.ts +11 -0
  100. package/dist/server/flow-surfaces/blueprint/compile-reaction.js +72 -0
  101. package/dist/server/flow-surfaces/blueprint/defaults.d.ts +26 -0
  102. package/dist/server/flow-surfaces/blueprint/defaults.js +133 -0
  103. package/dist/server/flow-surfaces/blueprint/index.d.ts +12 -0
  104. package/dist/server/flow-surfaces/blueprint/index.js +44 -0
  105. package/dist/server/flow-surfaces/blueprint/normalize-document.d.ts +10 -0
  106. package/dist/server/flow-surfaces/blueprint/normalize-document.js +416 -0
  107. package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +26 -0
  108. package/dist/server/flow-surfaces/blueprint/private-utils.js +182 -0
  109. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +201 -0
  110. package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
  111. package/dist/server/flow-surfaces/builder.d.ts +237 -0
  112. package/dist/server/flow-surfaces/builder.js +1129 -0
  113. package/dist/server/flow-surfaces/catalog-smart.d.ts +18 -0
  114. package/dist/server/flow-surfaces/catalog-smart.js +239 -0
  115. package/dist/server/flow-surfaces/catalog-smart.projector.d.ts +15 -0
  116. package/dist/server/flow-surfaces/catalog-smart.projector.js +157 -0
  117. package/dist/server/flow-surfaces/catalog-smart.types.d.ts +99 -0
  118. package/dist/server/flow-surfaces/catalog-smart.types.js +24 -0
  119. package/dist/server/flow-surfaces/catalog.d.ts +79 -0
  120. package/dist/server/flow-surfaces/catalog.js +3693 -0
  121. package/dist/server/flow-surfaces/chart-config.d.ts +121 -0
  122. package/dist/server/flow-surfaces/chart-config.js +1394 -0
  123. package/dist/server/flow-surfaces/compose-compiler.d.ts +116 -0
  124. package/dist/server/flow-surfaces/compose-compiler.js +175 -0
  125. package/dist/server/flow-surfaces/compose-runtime.d.ts +93 -0
  126. package/dist/server/flow-surfaces/compose-runtime.js +375 -0
  127. package/dist/server/flow-surfaces/configure-options.d.ts +23 -0
  128. package/dist/server/flow-surfaces/configure-options.js +893 -0
  129. package/dist/server/flow-surfaces/constants.d.ts +351 -0
  130. package/dist/server/flow-surfaces/constants.js +104 -0
  131. package/dist/server/flow-surfaces/context.d.ts +72 -0
  132. package/dist/server/flow-surfaces/context.js +556 -0
  133. package/dist/server/flow-surfaces/contract-guard.d.ts +19 -0
  134. package/dist/server/flow-surfaces/contract-guard.js +402 -0
  135. package/dist/server/flow-surfaces/core-field-default-bindings.d.ts +12 -0
  136. package/dist/server/flow-surfaces/core-field-default-bindings.js +157 -0
  137. package/dist/server/flow-surfaces/default-action-popup.d.ts +63 -0
  138. package/dist/server/flow-surfaces/default-action-popup.js +322 -0
  139. package/dist/server/flow-surfaces/default-block-actions.d.ts +32 -0
  140. package/dist/server/flow-surfaces/default-block-actions.js +209 -0
  141. package/dist/server/flow-surfaces/errors.d.ts +47 -0
  142. package/dist/server/flow-surfaces/errors.js +145 -0
  143. package/dist/server/flow-surfaces/executor.d.ts +23 -0
  144. package/dist/server/flow-surfaces/executor.js +132 -0
  145. package/dist/server/flow-surfaces/field-binding-registry.d.ts +24 -0
  146. package/dist/server/flow-surfaces/field-binding-registry.js +396 -0
  147. package/dist/server/flow-surfaces/field-semantics.d.ts +15 -0
  148. package/dist/server/flow-surfaces/field-semantics.js +84 -0
  149. package/dist/server/flow-surfaces/field-type-resolver.d.ts +46 -0
  150. package/dist/server/flow-surfaces/field-type-resolver.js +322 -0
  151. package/dist/server/flow-surfaces/filter-group.d.ts +15 -0
  152. package/dist/server/flow-surfaces/filter-group.js +94 -0
  153. package/dist/server/flow-surfaces/index.d.ts +11 -0
  154. package/dist/server/flow-surfaces/index.js +302 -0
  155. package/dist/server/flow-surfaces/locator.d.ts +28 -0
  156. package/dist/server/flow-surfaces/locator.js +240 -0
  157. package/dist/server/flow-surfaces/node-use-sets.d.ts +15 -0
  158. package/dist/server/flow-surfaces/node-use-sets.js +135 -0
  159. package/dist/server/flow-surfaces/payload-shape.d.ts +9 -0
  160. package/dist/server/flow-surfaces/payload-shape.js +61 -0
  161. package/dist/server/flow-surfaces/placement.d.ts +33 -0
  162. package/dist/server/flow-surfaces/placement.js +198 -0
  163. package/dist/server/flow-surfaces/planning/action-specs.d.ts +179 -0
  164. package/dist/server/flow-surfaces/planning/action-specs.js +190 -0
  165. package/dist/server/flow-surfaces/planning/compiler.d.ts +37 -0
  166. package/dist/server/flow-surfaces/planning/compiler.js +376 -0
  167. package/dist/server/flow-surfaces/planning/context.d.ts +30 -0
  168. package/dist/server/flow-surfaces/planning/context.js +139 -0
  169. package/dist/server/flow-surfaces/planning/created-keys.d.ts +34 -0
  170. package/dist/server/flow-surfaces/planning/created-keys.js +375 -0
  171. package/dist/server/flow-surfaces/planning/key-kind.d.ts +11 -0
  172. package/dist/server/flow-surfaces/planning/key-kind.js +88 -0
  173. package/dist/server/flow-surfaces/planning/key-persistence.d.ts +34 -0
  174. package/dist/server/flow-surfaces/planning/key-persistence.js +148 -0
  175. package/dist/server/flow-surfaces/planning/key-registry.d.ts +40 -0
  176. package/dist/server/flow-surfaces/planning/key-registry.js +206 -0
  177. package/dist/server/flow-surfaces/planning/runtime.d.ts +37 -0
  178. package/dist/server/flow-surfaces/planning/runtime.js +259 -0
  179. package/dist/server/flow-surfaces/planning/step-link.d.ts +14 -0
  180. package/dist/server/flow-surfaces/planning/step-link.js +104 -0
  181. package/dist/server/flow-surfaces/planning/types.d.ts +55 -0
  182. package/dist/server/flow-surfaces/planning/types.js +24 -0
  183. package/dist/server/flow-surfaces/public-data-surface-default-filter.d.ts +24 -0
  184. package/dist/server/flow-surfaces/public-data-surface-default-filter.js +152 -0
  185. package/dist/server/flow-surfaces/reaction/errors.d.ts +20 -0
  186. package/dist/server/flow-surfaces/reaction/errors.js +69 -0
  187. package/dist/server/flow-surfaces/reaction/field-value.d.ts +34 -0
  188. package/dist/server/flow-surfaces/reaction/field-value.js +181 -0
  189. package/dist/server/flow-surfaces/reaction/fingerprint.d.ts +16 -0
  190. package/dist/server/flow-surfaces/reaction/fingerprint.js +71 -0
  191. package/dist/server/flow-surfaces/reaction/linkage.d.ts +136 -0
  192. package/dist/server/flow-surfaces/reaction/linkage.js +882 -0
  193. package/dist/server/flow-surfaces/reaction/meta.d.ts +11 -0
  194. package/dist/server/flow-surfaces/reaction/meta.js +451 -0
  195. package/dist/server/flow-surfaces/reaction/registry.d.ts +156 -0
  196. package/dist/server/flow-surfaces/reaction/registry.js +206 -0
  197. package/dist/server/flow-surfaces/reaction/resolver.d.ts +22 -0
  198. package/dist/server/flow-surfaces/reaction/resolver.js +202 -0
  199. package/dist/server/flow-surfaces/reaction/types.d.ts +241 -0
  200. package/dist/server/flow-surfaces/reaction/types.js +24 -0
  201. package/dist/server/flow-surfaces/reaction/utils.d.ts +17 -0
  202. package/dist/server/flow-surfaces/reaction/utils.js +67 -0
  203. package/dist/server/flow-surfaces/reaction/value-expr.d.ts +15 -0
  204. package/dist/server/flow-surfaces/reaction/value-expr.js +209 -0
  205. package/dist/server/flow-surfaces/reference-guards.d.ts +19 -0
  206. package/dist/server/flow-surfaces/reference-guards.js +103 -0
  207. package/dist/server/flow-surfaces/route-sync.d.ts +47 -0
  208. package/dist/server/flow-surfaces/route-sync.js +392 -0
  209. package/dist/server/flow-surfaces/service-helpers.d.ts +42 -0
  210. package/dist/server/flow-surfaces/service-helpers.js +310 -0
  211. package/dist/server/flow-surfaces/service-utils.d.ts +120 -0
  212. package/dist/server/flow-surfaces/service-utils.js +863 -0
  213. package/dist/server/flow-surfaces/service.d.ts +830 -0
  214. package/dist/server/flow-surfaces/service.js +15043 -0
  215. package/dist/server/flow-surfaces/support-matrix.d.ts +31 -0
  216. package/dist/server/flow-surfaces/support-matrix.js +282 -0
  217. package/dist/server/flow-surfaces/surface-context.d.ts +52 -0
  218. package/dist/server/flow-surfaces/surface-context.js +440 -0
  219. package/dist/server/flow-surfaces/template-compatibility.d.ts +42 -0
  220. package/dist/server/flow-surfaces/template-compatibility.js +189 -0
  221. package/dist/server/flow-surfaces/template-display.d.ts +20 -0
  222. package/dist/server/flow-surfaces/template-display.js +289 -0
  223. package/dist/server/flow-surfaces/template-service-utils.d.ts +62 -0
  224. package/dist/server/flow-surfaces/template-service-utils.js +281 -0
  225. package/dist/server/flow-surfaces/types.d.ts +288 -0
  226. package/dist/server/flow-surfaces/types.js +24 -0
  227. package/dist/server/index.d.ts +1 -0
  228. package/dist/server/index.js +7 -2
  229. package/dist/server/plugin.d.ts +0 -1
  230. package/dist/server/plugin.js +9 -34
  231. package/dist/server/repository.js +0 -5
  232. package/dist/server/variables/resolve.d.ts +21 -0
  233. package/dist/server/variables/resolve.js +79 -0
  234. package/dist/swagger/flow-surfaces.d.ts +6135 -0
  235. package/dist/swagger/flow-surfaces.examples.d.ts +1577 -0
  236. package/dist/swagger/flow-surfaces.examples.js +1816 -0
  237. package/dist/swagger/flow-surfaces.js +5384 -0
  238. package/dist/swagger/flow-surfaces.template-action-docs.d.ts +62 -0
  239. package/dist/swagger/flow-surfaces.template-action-docs.js +121 -0
  240. package/dist/swagger/flow-surfaces.template-schemas.d.ts +239 -0
  241. package/dist/swagger/flow-surfaces.template-schemas.js +255 -0
  242. package/dist/swagger/index.d.ts +6140 -0
  243. package/dist/swagger/index.js +50 -0
  244. package/package.json +3 -3
  245. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.d.ts +0 -0
  246. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.d.ts +0 -0
  247. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.d.ts +0 -0
  248. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.d.ts +0 -0
@@ -0,0 +1,396 @@
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 field_binding_registry_exports = {};
28
+ __export(field_binding_registry_exports, {
29
+ MULTI_VALUE_ASSOCIATION_INTERFACES: () => import_association_interfaces2.MULTI_VALUE_ASSOCIATION_INTERFACES,
30
+ SINGLE_VALUE_ASSOCIATION_INTERFACES: () => import_association_interfaces2.SINGLE_VALUE_ASSOCIATION_INTERFACES,
31
+ getRegisteredFieldUses: () => getRegisteredFieldUses,
32
+ resolveRegisteredFieldBinding: () => resolveRegisteredFieldBinding
33
+ });
34
+ module.exports = __toCommonJS(field_binding_registry_exports);
35
+ var import_field_semantics = require("./field-semantics");
36
+ var import_service_helpers = require("./service-helpers");
37
+ var import_association_interfaces2 = require("./association-interfaces");
38
+ const FILE_MANAGER_PLUGIN = "@nocobase/plugin-file-manager";
39
+ const ATTACHMENT_URL_PLUGIN = "@nocobase/plugin-field-attachment-url";
40
+ const CODE_PLUGIN = "@nocobase/plugin-field-code";
41
+ const FORMULA_PLUGIN = "@nocobase/plugin-field-formula";
42
+ const CHINA_REGION_PLUGIN = "@nocobase/plugin-field-china-region";
43
+ const MAP_PLUGIN = "@nocobase/plugin-map";
44
+ const MARKDOWN_VDITOR_PLUGIN = "@nocobase/plugin-field-markdown-vditor";
45
+ const SORT_PLUGIN = "@nocobase/plugin-field-sort";
46
+ function getCollectionTemplate(collection) {
47
+ var _a;
48
+ return (collection == null ? void 0 : collection.template) || ((_a = collection == null ? void 0 : collection.options) == null ? void 0 : _a.template);
49
+ }
50
+ function isAttachmentInterface(field) {
51
+ return String((0, import_service_helpers.getFieldInterface)(field) || "").trim() === "attachment";
52
+ }
53
+ function getFieldDataType(field) {
54
+ var _a;
55
+ return (field == null ? void 0 : field.dataType) || ((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.dataType);
56
+ }
57
+ function isNumericFormulaDataType(dataType) {
58
+ return ["integer", "bigInt", "double", "decimal", "number"].includes(String(dataType || "").trim());
59
+ }
60
+ function resolveTargetCollection(input) {
61
+ var _a;
62
+ if ((_a = input.field) == null ? void 0 : _a.targetCollection) {
63
+ return input.field.targetCollection;
64
+ }
65
+ if (!input.getCollection || !input.dataSourceKey) {
66
+ return null;
67
+ }
68
+ return (0, import_service_helpers.resolveFieldTargetCollection)(input.field, input.dataSourceKey, input.getCollection);
69
+ }
70
+ function normalizeBindingContainerUse(containerUse) {
71
+ const normalized = String(containerUse || "").trim();
72
+ if (normalized === "FormAssociationItemModel") {
73
+ return "DetailsItemModel";
74
+ }
75
+ return normalized;
76
+ }
77
+ function resolveBindingScope(containerUse) {
78
+ switch ((0, import_field_semantics.normalizeFieldContainerKind)(normalizeBindingContainerUse(containerUse))) {
79
+ case "table":
80
+ case "details":
81
+ return "display";
82
+ case "form":
83
+ return "editable";
84
+ case "filter-form":
85
+ return "filter";
86
+ default:
87
+ return null;
88
+ }
89
+ }
90
+ function isRuleAvailable(rule, enabledPackages) {
91
+ if (!rule.ownerPlugin || !enabledPackages) {
92
+ return true;
93
+ }
94
+ return enabledPackages.has(rule.ownerPlugin);
95
+ }
96
+ function selectPreferredDefaultRule(rules) {
97
+ if (!rules.length) {
98
+ return null;
99
+ }
100
+ return rules.find((rule) => typeof rule.when === "function") || rules[0];
101
+ }
102
+ const FIELD_BINDING_RULE_DEFINITIONS = [
103
+ {
104
+ scope: "display",
105
+ modelClassName: "DisplayPreviewFieldModel",
106
+ interfaces: ["url", "attachment", "attachmentURL", "m2m", "m2o", "o2o", "o2m", "oho", "obo", "mbm"],
107
+ ownerPlugin: FILE_MANAGER_PLUGIN,
108
+ isDefault: true,
109
+ when: ({ field, targetCollection }) => isAttachmentInterface(field) || !targetCollection || getCollectionTemplate(targetCollection) === "file"
110
+ },
111
+ {
112
+ scope: "editable",
113
+ modelClassName: "UploadFieldModel",
114
+ interfaces: ["attachment", "m2m", "m2o", "o2o", "o2m", "oho", "obo", "updatedBy", "createdBy", "mbm"],
115
+ ownerPlugin: FILE_MANAGER_PLUGIN,
116
+ isDefault: true,
117
+ order: 30,
118
+ when: ({ field, targetCollection }) => isAttachmentInterface(field) || !targetCollection || getCollectionTemplate(targetCollection) === "file"
119
+ },
120
+ {
121
+ scope: "editable",
122
+ modelClassName: "AttachmentURLFieldModel",
123
+ interfaces: ["attachmentURL"],
124
+ ownerPlugin: ATTACHMENT_URL_PLUGIN,
125
+ isDefault: true
126
+ },
127
+ {
128
+ scope: "display",
129
+ modelClassName: "DisplayTextFieldModel",
130
+ interfaces: ["attachmentURL"],
131
+ ownerPlugin: ATTACHMENT_URL_PLUGIN,
132
+ isDefault: true
133
+ },
134
+ {
135
+ scope: "editable",
136
+ modelClassName: "CodeFieldModel",
137
+ interfaces: ["code"],
138
+ ownerPlugin: CODE_PLUGIN,
139
+ isDefault: true
140
+ },
141
+ {
142
+ scope: "display",
143
+ modelClassName: "DisplayCodeFieldModel",
144
+ interfaces: ["code"],
145
+ ownerPlugin: CODE_PLUGIN,
146
+ isDefault: true
147
+ },
148
+ {
149
+ scope: "filter",
150
+ modelClassName: "InputFieldModel",
151
+ interfaces: ["code"],
152
+ ownerPlugin: CODE_PLUGIN,
153
+ isDefault: true
154
+ },
155
+ {
156
+ scope: "editable",
157
+ modelClassName: "VditorFieldModel",
158
+ interfaces: ["vditor", "markdown"],
159
+ ownerPlugin: MARKDOWN_VDITOR_PLUGIN,
160
+ isDefault: true
161
+ },
162
+ {
163
+ scope: "display",
164
+ modelClassName: "DisplayVditorFieldModel",
165
+ interfaces: ["vditor", "markdown"],
166
+ ownerPlugin: MARKDOWN_VDITOR_PLUGIN,
167
+ isDefault: true
168
+ },
169
+ {
170
+ scope: "editable",
171
+ modelClassName: "ChinaRegionFieldModel",
172
+ interfaces: ["chinaRegion"],
173
+ ownerPlugin: CHINA_REGION_PLUGIN,
174
+ isDefault: true
175
+ },
176
+ {
177
+ scope: "display",
178
+ modelClassName: "DisplayChinaRegionFieldModel",
179
+ interfaces: ["chinaRegion"],
180
+ ownerPlugin: CHINA_REGION_PLUGIN,
181
+ isDefault: true
182
+ },
183
+ {
184
+ scope: "editable",
185
+ modelClassName: "SortFieldModel",
186
+ interfaces: ["sort"],
187
+ ownerPlugin: SORT_PLUGIN,
188
+ isDefault: true
189
+ },
190
+ {
191
+ scope: "display",
192
+ modelClassName: "DisplayNumberFieldModel",
193
+ interfaces: ["sort"],
194
+ ownerPlugin: SORT_PLUGIN,
195
+ isDefault: true
196
+ },
197
+ {
198
+ scope: "editable",
199
+ modelClassName: "PointFieldModel",
200
+ interfaces: ["point"],
201
+ ownerPlugin: MAP_PLUGIN,
202
+ isDefault: true
203
+ },
204
+ {
205
+ scope: "editable",
206
+ modelClassName: "CircleFieldModel",
207
+ interfaces: ["circle"],
208
+ ownerPlugin: MAP_PLUGIN,
209
+ isDefault: true
210
+ },
211
+ {
212
+ scope: "editable",
213
+ modelClassName: "PolygonFieldModel",
214
+ interfaces: ["polygon"],
215
+ ownerPlugin: MAP_PLUGIN,
216
+ isDefault: true
217
+ },
218
+ {
219
+ scope: "editable",
220
+ modelClassName: "LineStringFieldModel",
221
+ interfaces: ["lineString"],
222
+ ownerPlugin: MAP_PLUGIN,
223
+ isDefault: true
224
+ },
225
+ {
226
+ scope: "display",
227
+ modelClassName: "DisplayPointFieldModel",
228
+ interfaces: ["point"],
229
+ ownerPlugin: MAP_PLUGIN,
230
+ isDefault: true
231
+ },
232
+ {
233
+ scope: "display",
234
+ modelClassName: "DisplayCircleFieldModel",
235
+ interfaces: ["circle"],
236
+ ownerPlugin: MAP_PLUGIN,
237
+ isDefault: true
238
+ },
239
+ {
240
+ scope: "display",
241
+ modelClassName: "DisplayPolygonFieldModel",
242
+ interfaces: ["polygon"],
243
+ ownerPlugin: MAP_PLUGIN,
244
+ isDefault: true
245
+ },
246
+ {
247
+ scope: "display",
248
+ modelClassName: "DisplayLineStringFieldModel",
249
+ interfaces: ["lineString"],
250
+ ownerPlugin: MAP_PLUGIN,
251
+ isDefault: true
252
+ },
253
+ {
254
+ scope: "editable",
255
+ modelClassName: "FormulaFieldModel",
256
+ interfaces: ["formula"],
257
+ ownerPlugin: FORMULA_PLUGIN,
258
+ isDefault: true
259
+ },
260
+ {
261
+ scope: "display",
262
+ modelClassName: "DisplayCheckboxFieldModel",
263
+ interfaces: ["formula"],
264
+ ownerPlugin: FORMULA_PLUGIN,
265
+ isDefault: true,
266
+ when: ({ field }) => getFieldDataType(field) === "boolean"
267
+ },
268
+ {
269
+ scope: "display",
270
+ modelClassName: "DisplayDateTimeFieldModel",
271
+ interfaces: ["formula"],
272
+ ownerPlugin: FORMULA_PLUGIN,
273
+ isDefault: true,
274
+ when: ({ field }) => getFieldDataType(field) === "date"
275
+ },
276
+ {
277
+ scope: "display",
278
+ modelClassName: "DisplayTextFieldModel",
279
+ interfaces: ["formula"],
280
+ ownerPlugin: FORMULA_PLUGIN,
281
+ isDefault: true,
282
+ when: ({ field }) => getFieldDataType(field) === "string"
283
+ },
284
+ {
285
+ scope: "display",
286
+ modelClassName: "DisplayNumberFieldModel",
287
+ interfaces: ["formula"],
288
+ ownerPlugin: FORMULA_PLUGIN,
289
+ isDefault: true,
290
+ when: ({ field }) => ["double", "bigInt", "integer"].includes(String(getFieldDataType(field) || "").trim())
291
+ },
292
+ {
293
+ scope: "filter",
294
+ modelClassName: "InputFieldModel",
295
+ interfaces: ["formula"],
296
+ ownerPlugin: FORMULA_PLUGIN,
297
+ when: ({ field }) => {
298
+ const dataType = String(getFieldDataType(field) || "").trim();
299
+ return !["date", "boolean", "integer", "bigInt", "double", "decimal", "number"].includes(dataType);
300
+ }
301
+ },
302
+ {
303
+ scope: "filter",
304
+ modelClassName: "DateTimeFilterFieldModel",
305
+ interfaces: ["formula"],
306
+ ownerPlugin: FORMULA_PLUGIN,
307
+ when: ({ field }) => getFieldDataType(field) === "date"
308
+ },
309
+ {
310
+ scope: "filter",
311
+ modelClassName: "CheckboxFieldModel",
312
+ interfaces: ["formula"],
313
+ ownerPlugin: FORMULA_PLUGIN,
314
+ when: ({ field }) => getFieldDataType(field) === "boolean"
315
+ },
316
+ {
317
+ scope: "filter",
318
+ modelClassName: "NumberFieldModel",
319
+ interfaces: ["formula"],
320
+ ownerPlugin: FORMULA_PLUGIN,
321
+ when: ({ field }) => isNumericFormulaDataType(getFieldDataType(field))
322
+ }
323
+ ];
324
+ const FIELD_BINDING_RULES = FIELD_BINDING_RULE_DEFINITIONS.map((rule, index) => ({
325
+ ...rule,
326
+ index
327
+ }));
328
+ function getRegisteredFieldUses(scope, enabledPackages) {
329
+ const uses = /* @__PURE__ */ new Set();
330
+ FIELD_BINDING_RULES.forEach((rule) => {
331
+ if (scope && rule.scope !== scope) {
332
+ return;
333
+ }
334
+ if (!isRuleAvailable(rule, enabledPackages)) {
335
+ return;
336
+ }
337
+ uses.add(rule.modelClassName);
338
+ });
339
+ return uses;
340
+ }
341
+ function resolveRegisteredFieldBinding(input) {
342
+ const scope = resolveBindingScope(input.containerUse);
343
+ const fieldInterface = String((0, import_service_helpers.getFieldInterface)(input.field) || "").trim();
344
+ if (!scope || !fieldInterface) {
345
+ return null;
346
+ }
347
+ const targetCollection = resolveTargetCollection(input);
348
+ const candidates = FIELD_BINDING_RULES.filter((rule) => {
349
+ if (rule.scope !== scope) {
350
+ return false;
351
+ }
352
+ if (!rule.interfaces.includes(fieldInterface)) {
353
+ return false;
354
+ }
355
+ if (!isRuleAvailable(rule, input.enabledPackages)) {
356
+ return false;
357
+ }
358
+ if (!rule.when) {
359
+ return true;
360
+ }
361
+ return rule.when({
362
+ ...input,
363
+ targetCollection
364
+ });
365
+ }).sort((a, b) => {
366
+ const orderDelta = Number(a.order || 0) - Number(b.order || 0);
367
+ return orderDelta || a.index - b.index;
368
+ });
369
+ const defaultRule = selectPreferredDefaultRule(candidates.filter((rule) => rule.isDefault));
370
+ if (defaultRule) {
371
+ return {
372
+ modelClassName: defaultRule.modelClassName,
373
+ ownerPlugin: defaultRule.ownerPlugin,
374
+ isDefault: true
375
+ };
376
+ }
377
+ if (input.useStrictOnly) {
378
+ return null;
379
+ }
380
+ const fallbackRule = candidates[0];
381
+ if (!fallbackRule) {
382
+ return null;
383
+ }
384
+ return {
385
+ modelClassName: fallbackRule.modelClassName,
386
+ ownerPlugin: fallbackRule.ownerPlugin,
387
+ isDefault: !!fallbackRule.isDefault
388
+ };
389
+ }
390
+ // Annotate the CommonJS export names for ESM import in node:
391
+ 0 && (module.exports = {
392
+ MULTI_VALUE_ASSOCIATION_INTERFACES,
393
+ SINGLE_VALUE_ASSOCIATION_INTERFACES,
394
+ getRegisteredFieldUses,
395
+ resolveRegisteredFieldBinding
396
+ });
@@ -0,0 +1,15 @@
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
+ export { MULTI_VALUE_ASSOCIATION_INTERFACES } from './association-interfaces';
10
+ export declare function normalizeFieldContainerKind(containerUse?: string): "form" | "details" | "table" | "filter-form";
11
+ export declare function shouldUseAssociationTitleTextDisplay(input: {
12
+ containerUse?: string;
13
+ associationPathName?: string;
14
+ fieldInterface?: string | null;
15
+ }): boolean;
@@ -0,0 +1,84 @@
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 field_semantics_exports = {};
28
+ __export(field_semantics_exports, {
29
+ MULTI_VALUE_ASSOCIATION_INTERFACES: () => import_association_interfaces2.MULTI_VALUE_ASSOCIATION_INTERFACES,
30
+ normalizeFieldContainerKind: () => normalizeFieldContainerKind,
31
+ shouldUseAssociationTitleTextDisplay: () => shouldUseAssociationTitleTextDisplay
32
+ });
33
+ module.exports = __toCommonJS(field_semantics_exports);
34
+ var import_approval = require("./approval");
35
+ var import_association_interfaces = require("./association-interfaces");
36
+ var import_association_interfaces2 = require("./association-interfaces");
37
+ const FORM_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set([
38
+ "FormBlockModel",
39
+ "CreateFormModel",
40
+ "EditFormModel",
41
+ "FormGridModel",
42
+ "FormItemModel",
43
+ "AssignFormModel",
44
+ "AssignFormGridModel"
45
+ ]);
46
+ const DETAILS_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set([
47
+ "DetailsBlockModel",
48
+ "DetailsGridModel",
49
+ "DetailsItemModel",
50
+ "ListBlockModel",
51
+ "GridCardBlockModel",
52
+ "KanbanBlockModel",
53
+ "ListItemModel",
54
+ "GridCardItemModel",
55
+ "KanbanCardItemModel"
56
+ ]);
57
+ const FILTER_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set(["FilterFormBlockModel", "FilterFormGridModel", "FilterFormItemModel"]);
58
+ const TABLE_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set(["TableBlockModel", "TableColumnModel"]);
59
+ function normalizeFieldContainerKind(containerUse) {
60
+ const normalized = (0, import_approval.normalizeApprovalSemanticUse)(containerUse);
61
+ if (FORM_FIELD_CONTAINER_USES.has(normalized)) {
62
+ return "form";
63
+ }
64
+ if (DETAILS_FIELD_CONTAINER_USES.has(normalized)) {
65
+ return "details";
66
+ }
67
+ if (FILTER_FIELD_CONTAINER_USES.has(normalized)) {
68
+ return "filter-form";
69
+ }
70
+ if (TABLE_FIELD_CONTAINER_USES.has(normalized)) {
71
+ return "table";
72
+ }
73
+ return null;
74
+ }
75
+ function shouldUseAssociationTitleTextDisplay(input) {
76
+ const containerKind = normalizeFieldContainerKind(input.containerUse);
77
+ return (containerKind === "table" || containerKind === "details") && !String(input.associationPathName || "").trim() && import_association_interfaces.MULTI_VALUE_ASSOCIATION_INTERFACES.has(String(input.fieldInterface || "").trim());
78
+ }
79
+ // Annotate the CommonJS export names for ESM import in node:
80
+ 0 && (module.exports = {
81
+ MULTI_VALUE_ASSOCIATION_INTERFACES,
82
+ normalizeFieldContainerKind,
83
+ shouldUseAssociationTitleTextDisplay
84
+ });
@@ -0,0 +1,46 @@
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
+ export declare const FLOW_SURFACE_PUBLIC_RELATION_FIELD_TYPES: readonly ["text", "select", "picker", "subForm", "subFormList", "subDetails", "subDetailsList", "subTable", "popupSubTable"];
10
+ export type FlowSurfacePublicRelationFieldType = (typeof FLOW_SURFACE_PUBLIC_RELATION_FIELD_TYPES)[number];
11
+ export declare const FLOW_SURFACE_RESERVED_RELATION_FIELD_TYPES: readonly ["cascade", "upload", "preview"];
12
+ export declare const FLOW_SURFACE_PUBLIC_FIELD_TYPE_SET: Set<string>;
13
+ export declare const FLOW_SURFACE_INTERNAL_FIELD_KEYS: string[];
14
+ export declare function assertNoInternalFieldKeys(input: Record<string, any> | undefined, context: string): void;
15
+ export declare function normalizePublicFieldType(value: any, context: string): FlowSurfacePublicRelationFieldType | undefined;
16
+ export declare function normalizePublicFieldNameList(value: any, context: string): string[] | undefined;
17
+ export declare function getPublicFieldTypeForUse(use?: string): FlowSurfacePublicRelationFieldType | undefined;
18
+ export declare function resolveRelationFieldType(input: {
19
+ fieldType: any;
20
+ containerUse: string;
21
+ field: any;
22
+ dataSourceKey: string;
23
+ getCollection: (dataSourceKey: string, collectionName: string) => any;
24
+ fields?: any;
25
+ selectorFields?: any;
26
+ titleField?: any;
27
+ openMode?: any;
28
+ popupSize?: any;
29
+ pageSize?: any;
30
+ showIndex?: any;
31
+ applyDefaults?: boolean;
32
+ context: string;
33
+ }): {
34
+ fieldType: "select" | "subForm" | "text" | "picker" | "subFormList" | "subDetails" | "subDetailsList" | "subTable" | "popupSubTable";
35
+ fieldUse: string;
36
+ cardinality: "single" | "multi";
37
+ targetCollection: any;
38
+ fields: any[];
39
+ selectorFields: any[];
40
+ titleField: any;
41
+ openMode: any;
42
+ popupSize: any;
43
+ pageSize: any;
44
+ showIndex: any;
45
+ };
46
+ export declare function usesNestedRelationFields(fieldUse?: string): boolean;