@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.
Files changed (244) 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 +969 -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-title-field.d.ts +20 -0
  92. package/dist/server/flow-surfaces/association-title-field.js +192 -0
  93. package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +14 -0
  94. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +1029 -0
  95. package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +13 -0
  96. package/dist/server/flow-surfaces/blueprint/compile-plan.js +308 -0
  97. package/dist/server/flow-surfaces/blueprint/compile-reaction.d.ts +11 -0
  98. package/dist/server/flow-surfaces/blueprint/compile-reaction.js +72 -0
  99. package/dist/server/flow-surfaces/blueprint/defaults.d.ts +26 -0
  100. package/dist/server/flow-surfaces/blueprint/defaults.js +133 -0
  101. package/dist/server/flow-surfaces/blueprint/index.d.ts +12 -0
  102. package/dist/server/flow-surfaces/blueprint/index.js +44 -0
  103. package/dist/server/flow-surfaces/blueprint/normalize-document.d.ts +10 -0
  104. package/dist/server/flow-surfaces/blueprint/normalize-document.js +416 -0
  105. package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +26 -0
  106. package/dist/server/flow-surfaces/blueprint/private-utils.js +182 -0
  107. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +193 -0
  108. package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
  109. package/dist/server/flow-surfaces/builder.d.ts +211 -0
  110. package/dist/server/flow-surfaces/builder.js +1097 -0
  111. package/dist/server/flow-surfaces/catalog-smart.d.ts +18 -0
  112. package/dist/server/flow-surfaces/catalog-smart.js +239 -0
  113. package/dist/server/flow-surfaces/catalog-smart.projector.d.ts +15 -0
  114. package/dist/server/flow-surfaces/catalog-smart.projector.js +157 -0
  115. package/dist/server/flow-surfaces/catalog-smart.types.d.ts +99 -0
  116. package/dist/server/flow-surfaces/catalog-smart.types.js +24 -0
  117. package/dist/server/flow-surfaces/catalog.d.ts +78 -0
  118. package/dist/server/flow-surfaces/catalog.js +3577 -0
  119. package/dist/server/flow-surfaces/chart-config.d.ts +121 -0
  120. package/dist/server/flow-surfaces/chart-config.js +1394 -0
  121. package/dist/server/flow-surfaces/compose-compiler.d.ts +108 -0
  122. package/dist/server/flow-surfaces/compose-compiler.js +167 -0
  123. package/dist/server/flow-surfaces/compose-runtime.d.ts +93 -0
  124. package/dist/server/flow-surfaces/compose-runtime.js +375 -0
  125. package/dist/server/flow-surfaces/configure-options.d.ts +23 -0
  126. package/dist/server/flow-surfaces/configure-options.js +860 -0
  127. package/dist/server/flow-surfaces/constants.d.ts +351 -0
  128. package/dist/server/flow-surfaces/constants.js +104 -0
  129. package/dist/server/flow-surfaces/context.d.ts +72 -0
  130. package/dist/server/flow-surfaces/context.js +556 -0
  131. package/dist/server/flow-surfaces/contract-guard.d.ts +19 -0
  132. package/dist/server/flow-surfaces/contract-guard.js +402 -0
  133. package/dist/server/flow-surfaces/core-field-default-bindings.d.ts +12 -0
  134. package/dist/server/flow-surfaces/core-field-default-bindings.js +157 -0
  135. package/dist/server/flow-surfaces/default-action-popup.d.ts +63 -0
  136. package/dist/server/flow-surfaces/default-action-popup.js +322 -0
  137. package/dist/server/flow-surfaces/default-block-actions.d.ts +32 -0
  138. package/dist/server/flow-surfaces/default-block-actions.js +209 -0
  139. package/dist/server/flow-surfaces/errors.d.ts +47 -0
  140. package/dist/server/flow-surfaces/errors.js +145 -0
  141. package/dist/server/flow-surfaces/executor.d.ts +23 -0
  142. package/dist/server/flow-surfaces/executor.js +132 -0
  143. package/dist/server/flow-surfaces/field-binding-registry.d.ts +23 -0
  144. package/dist/server/flow-surfaces/field-binding-registry.js +391 -0
  145. package/dist/server/flow-surfaces/field-semantics.d.ts +15 -0
  146. package/dist/server/flow-surfaces/field-semantics.js +83 -0
  147. package/dist/server/flow-surfaces/filter-group.d.ts +15 -0
  148. package/dist/server/flow-surfaces/filter-group.js +94 -0
  149. package/dist/server/flow-surfaces/index.d.ts +11 -0
  150. package/dist/server/flow-surfaces/index.js +302 -0
  151. package/dist/server/flow-surfaces/locator.d.ts +28 -0
  152. package/dist/server/flow-surfaces/locator.js +240 -0
  153. package/dist/server/flow-surfaces/node-use-sets.d.ts +15 -0
  154. package/dist/server/flow-surfaces/node-use-sets.js +134 -0
  155. package/dist/server/flow-surfaces/payload-shape.d.ts +9 -0
  156. package/dist/server/flow-surfaces/payload-shape.js +61 -0
  157. package/dist/server/flow-surfaces/placement.d.ts +33 -0
  158. package/dist/server/flow-surfaces/placement.js +198 -0
  159. package/dist/server/flow-surfaces/planning/action-specs.d.ts +179 -0
  160. package/dist/server/flow-surfaces/planning/action-specs.js +190 -0
  161. package/dist/server/flow-surfaces/planning/compiler.d.ts +37 -0
  162. package/dist/server/flow-surfaces/planning/compiler.js +376 -0
  163. package/dist/server/flow-surfaces/planning/context.d.ts +30 -0
  164. package/dist/server/flow-surfaces/planning/context.js +139 -0
  165. package/dist/server/flow-surfaces/planning/created-keys.d.ts +34 -0
  166. package/dist/server/flow-surfaces/planning/created-keys.js +375 -0
  167. package/dist/server/flow-surfaces/planning/key-kind.d.ts +11 -0
  168. package/dist/server/flow-surfaces/planning/key-kind.js +88 -0
  169. package/dist/server/flow-surfaces/planning/key-persistence.d.ts +34 -0
  170. package/dist/server/flow-surfaces/planning/key-persistence.js +148 -0
  171. package/dist/server/flow-surfaces/planning/key-registry.d.ts +40 -0
  172. package/dist/server/flow-surfaces/planning/key-registry.js +206 -0
  173. package/dist/server/flow-surfaces/planning/runtime.d.ts +37 -0
  174. package/dist/server/flow-surfaces/planning/runtime.js +259 -0
  175. package/dist/server/flow-surfaces/planning/step-link.d.ts +14 -0
  176. package/dist/server/flow-surfaces/planning/step-link.js +104 -0
  177. package/dist/server/flow-surfaces/planning/types.d.ts +55 -0
  178. package/dist/server/flow-surfaces/planning/types.js +24 -0
  179. package/dist/server/flow-surfaces/public-data-surface-default-filter.d.ts +24 -0
  180. package/dist/server/flow-surfaces/public-data-surface-default-filter.js +152 -0
  181. package/dist/server/flow-surfaces/reaction/errors.d.ts +20 -0
  182. package/dist/server/flow-surfaces/reaction/errors.js +69 -0
  183. package/dist/server/flow-surfaces/reaction/field-value.d.ts +34 -0
  184. package/dist/server/flow-surfaces/reaction/field-value.js +181 -0
  185. package/dist/server/flow-surfaces/reaction/fingerprint.d.ts +16 -0
  186. package/dist/server/flow-surfaces/reaction/fingerprint.js +71 -0
  187. package/dist/server/flow-surfaces/reaction/linkage.d.ts +136 -0
  188. package/dist/server/flow-surfaces/reaction/linkage.js +882 -0
  189. package/dist/server/flow-surfaces/reaction/meta.d.ts +11 -0
  190. package/dist/server/flow-surfaces/reaction/meta.js +451 -0
  191. package/dist/server/flow-surfaces/reaction/registry.d.ts +156 -0
  192. package/dist/server/flow-surfaces/reaction/registry.js +206 -0
  193. package/dist/server/flow-surfaces/reaction/resolver.d.ts +22 -0
  194. package/dist/server/flow-surfaces/reaction/resolver.js +202 -0
  195. package/dist/server/flow-surfaces/reaction/types.d.ts +241 -0
  196. package/dist/server/flow-surfaces/reaction/types.js +24 -0
  197. package/dist/server/flow-surfaces/reaction/utils.d.ts +17 -0
  198. package/dist/server/flow-surfaces/reaction/utils.js +67 -0
  199. package/dist/server/flow-surfaces/reaction/value-expr.d.ts +15 -0
  200. package/dist/server/flow-surfaces/reaction/value-expr.js +209 -0
  201. package/dist/server/flow-surfaces/reference-guards.d.ts +19 -0
  202. package/dist/server/flow-surfaces/reference-guards.js +103 -0
  203. package/dist/server/flow-surfaces/route-sync.d.ts +47 -0
  204. package/dist/server/flow-surfaces/route-sync.js +392 -0
  205. package/dist/server/flow-surfaces/service-helpers.d.ts +42 -0
  206. package/dist/server/flow-surfaces/service-helpers.js +310 -0
  207. package/dist/server/flow-surfaces/service-utils.d.ts +108 -0
  208. package/dist/server/flow-surfaces/service-utils.js +811 -0
  209. package/dist/server/flow-surfaces/service.d.ts +814 -0
  210. package/dist/server/flow-surfaces/service.js +14276 -0
  211. package/dist/server/flow-surfaces/support-matrix.d.ts +31 -0
  212. package/dist/server/flow-surfaces/support-matrix.js +271 -0
  213. package/dist/server/flow-surfaces/surface-context.d.ts +52 -0
  214. package/dist/server/flow-surfaces/surface-context.js +440 -0
  215. package/dist/server/flow-surfaces/template-compatibility.d.ts +42 -0
  216. package/dist/server/flow-surfaces/template-compatibility.js +189 -0
  217. package/dist/server/flow-surfaces/template-display.d.ts +20 -0
  218. package/dist/server/flow-surfaces/template-display.js +289 -0
  219. package/dist/server/flow-surfaces/template-service-utils.d.ts +62 -0
  220. package/dist/server/flow-surfaces/template-service-utils.js +281 -0
  221. package/dist/server/flow-surfaces/types.d.ts +288 -0
  222. package/dist/server/flow-surfaces/types.js +24 -0
  223. package/dist/server/index.d.ts +1 -0
  224. package/dist/server/index.js +7 -2
  225. package/dist/server/plugin.d.ts +0 -1
  226. package/dist/server/plugin.js +9 -34
  227. package/dist/server/repository.js +0 -5
  228. package/dist/server/variables/resolve.d.ts +21 -0
  229. package/dist/server/variables/resolve.js +79 -0
  230. package/dist/swagger/flow-surfaces.d.ts +5964 -0
  231. package/dist/swagger/flow-surfaces.examples.d.ts +1572 -0
  232. package/dist/swagger/flow-surfaces.examples.js +1805 -0
  233. package/dist/swagger/flow-surfaces.js +5322 -0
  234. package/dist/swagger/flow-surfaces.template-action-docs.d.ts +62 -0
  235. package/dist/swagger/flow-surfaces.template-action-docs.js +121 -0
  236. package/dist/swagger/flow-surfaces.template-schemas.d.ts +239 -0
  237. package/dist/swagger/flow-surfaces.template-schemas.js +255 -0
  238. package/dist/swagger/index.d.ts +5969 -0
  239. package/dist/swagger/index.js +50 -0
  240. package/package.json +3 -3
  241. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.d.ts +0 -0
  242. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.d.ts +0 -0
  243. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.d.ts +0 -0
  244. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.d.ts +0 -0
@@ -0,0 +1,310 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var service_helpers_exports = {};
38
+ __export(service_helpers_exports, {
39
+ buildCatalogCollectionCycleKey: () => buildCatalogCollectionCycleKey,
40
+ buildFilterFieldMeta: () => buildFilterFieldMeta,
41
+ buildFlowTemplateSearchFilter: () => buildFlowTemplateSearchFilter,
42
+ dedupeVisibleFieldCandidates: () => dedupeVisibleFieldCandidates,
43
+ getAssociationFilterTargetKey: () => getAssociationFilterTargetKey,
44
+ getCollectionFields: () => getCollectionFields,
45
+ getCollectionName: () => getCollectionName,
46
+ getCollectionTitle: () => getCollectionTitle,
47
+ getCollectionTitleFieldName: () => getCollectionTitleFieldName,
48
+ getFieldFilterable: () => getFieldFilterable,
49
+ getFieldInterface: () => getFieldInterface,
50
+ getFieldName: () => getFieldName,
51
+ getFieldTarget: () => getFieldTarget,
52
+ getFieldTitle: () => getFieldTitle,
53
+ getFieldType: () => getFieldType,
54
+ hasConfiguredFlowContextValue: () => hasConfiguredFlowContextValue,
55
+ inferAssociationLeafDisplayFieldUse: () => inferAssociationLeafDisplayFieldUse,
56
+ inferFieldMenuEditableFieldUse: () => inferFieldMenuEditableFieldUse,
57
+ inferFlowContextTypeFromField: () => inferFlowContextTypeFromField,
58
+ isAssociationField: () => isAssociationField,
59
+ normalizeFieldPath: () => normalizeFieldPath,
60
+ normalizeTemplatePage: () => normalizeTemplatePage,
61
+ normalizeTemplatePageSize: () => normalizeTemplatePageSize,
62
+ resolveAssociationNameFromField: () => resolveAssociationNameFromField,
63
+ resolveFieldFromCollection: () => resolveFieldFromCollection,
64
+ resolveFieldTargetCollection: () => resolveFieldTargetCollection,
65
+ toTemplatePlainRow: () => toTemplatePlainRow
66
+ });
67
+ module.exports = __toCommonJS(service_helpers_exports);
68
+ var import_lodash = __toESM(require("lodash"));
69
+ var import_core_field_default_bindings = require("./core-field-default-bindings");
70
+ const FLOW_SURFACE_TEMPLATE_DEFAULT_PAGE = 1;
71
+ const FLOW_SURFACE_TEMPLATE_DEFAULT_PAGE_SIZE = 50;
72
+ function toTemplatePlainRow(row) {
73
+ if (!row) {
74
+ return row;
75
+ }
76
+ if (typeof row.toJSON === "function") {
77
+ return row.toJSON();
78
+ }
79
+ return row;
80
+ }
81
+ function buildFlowTemplateSearchFilter(existing, search) {
82
+ const filters = [];
83
+ if (existing) {
84
+ filters.push(existing);
85
+ }
86
+ const normalizedSearch = String(search || "").trim();
87
+ if (normalizedSearch) {
88
+ filters.push({
89
+ $or: [{ name: { $includes: normalizedSearch } }, { description: { $includes: normalizedSearch } }]
90
+ });
91
+ }
92
+ if (!filters.length) {
93
+ return void 0;
94
+ }
95
+ if (filters.length === 1) {
96
+ return filters[0];
97
+ }
98
+ return { $and: filters };
99
+ }
100
+ function normalizeTemplatePage(value) {
101
+ const num = Number(value || FLOW_SURFACE_TEMPLATE_DEFAULT_PAGE);
102
+ if (!Number.isFinite(num) || num < 1) {
103
+ return FLOW_SURFACE_TEMPLATE_DEFAULT_PAGE;
104
+ }
105
+ return Math.floor(num);
106
+ }
107
+ function normalizeTemplatePageSize(value) {
108
+ const num = Number(value || FLOW_SURFACE_TEMPLATE_DEFAULT_PAGE_SIZE);
109
+ if (!Number.isFinite(num) || num < 1) {
110
+ return FLOW_SURFACE_TEMPLATE_DEFAULT_PAGE_SIZE;
111
+ }
112
+ return Math.floor(num);
113
+ }
114
+ function normalizeFieldPath(fieldPath, associationPathName) {
115
+ const normalizedFieldPath = String(fieldPath || "").trim();
116
+ const normalizedAssociationPath = String(associationPathName || "").trim();
117
+ if (!normalizedAssociationPath || !normalizedFieldPath || normalizedFieldPath.includes(".")) {
118
+ return normalizedFieldPath;
119
+ }
120
+ return `${normalizedAssociationPath}.${normalizedFieldPath}`;
121
+ }
122
+ function hasConfiguredFlowContextValue(value) {
123
+ return !import_lodash.default.isNil(value) && value !== "";
124
+ }
125
+ function buildFilterFieldMeta(field) {
126
+ return import_lodash.default.pickBy(
127
+ {
128
+ name: getFieldName(field),
129
+ title: getFieldTitle(field),
130
+ interface: getFieldInterface(field),
131
+ type: getFieldType(field)
132
+ },
133
+ (value) => !import_lodash.default.isUndefined(value)
134
+ );
135
+ }
136
+ function getCollectionFields(collection) {
137
+ var _a, _b, _c;
138
+ return import_lodash.default.castArray(((_a = collection == null ? void 0 : collection.getFields) == null ? void 0 : _a.call(collection)) || Array.from(((_c = (_b = collection == null ? void 0 : collection.fields) == null ? void 0 : _b.values) == null ? void 0 : _c.call(_b)) || []));
139
+ }
140
+ function getCollectionTitle(collection) {
141
+ var _a, _b;
142
+ return (collection == null ? void 0 : collection.title) || ((_a = collection == null ? void 0 : collection.options) == null ? void 0 : _a.title) || (collection == null ? void 0 : collection.name) || ((_b = collection == null ? void 0 : collection.options) == null ? void 0 : _b.name);
143
+ }
144
+ function getCollectionName(collection) {
145
+ var _a;
146
+ return (collection == null ? void 0 : collection.name) || ((_a = collection == null ? void 0 : collection.options) == null ? void 0 : _a.name);
147
+ }
148
+ function getCollectionTitleFieldName(collection) {
149
+ var _a, _b, _c, _d, _e;
150
+ const filterTargetKey = (collection == null ? void 0 : collection.filterTargetKey) || ((_a = collection == null ? void 0 : collection.options) == null ? void 0 : _a.filterTargetKey);
151
+ return ((_b = collection == null ? void 0 : collection.options) == null ? void 0 : _b.titleField) || ((_c = collection == null ? void 0 : collection.titleCollectionField) == null ? void 0 : _c.name) || ((_e = (_d = collection == null ? void 0 : collection.titleCollectionField) == null ? void 0 : _d.options) == null ? void 0 : _e.name) || (Array.isArray(filterTargetKey) ? filterTargetKey[0] : filterTargetKey) || (collection == null ? void 0 : collection.titleField);
152
+ }
153
+ function getFieldName(field) {
154
+ var _a;
155
+ return (field == null ? void 0 : field.name) || ((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.name);
156
+ }
157
+ function getFieldTitle(field) {
158
+ var _a;
159
+ return (field == null ? void 0 : field.title) || ((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.title) || getFieldName(field);
160
+ }
161
+ function resolveAssociationNameFromField(field, fallbackCollection) {
162
+ const resourceName = typeof (field == null ? void 0 : field.resourceName) === "string" ? field.resourceName.trim() : "";
163
+ if (resourceName) {
164
+ return resourceName;
165
+ }
166
+ const fieldName = getFieldName(field);
167
+ if (!fieldName) {
168
+ return void 0;
169
+ }
170
+ const sourceCollectionName = getCollectionName(field == null ? void 0 : field.collection) || getCollectionName(fallbackCollection);
171
+ return sourceCollectionName ? `${sourceCollectionName}.${fieldName}` : void 0;
172
+ }
173
+ function getFieldInterface(field) {
174
+ var _a;
175
+ return (field == null ? void 0 : field.interface) || ((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.interface);
176
+ }
177
+ function getFieldType(field) {
178
+ var _a;
179
+ return (field == null ? void 0 : field.type) || ((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.type);
180
+ }
181
+ function inferFlowContextTypeFromField(field) {
182
+ switch (getFieldType(field)) {
183
+ case "boolean":
184
+ return "boolean";
185
+ case "integer":
186
+ case "float":
187
+ case "double":
188
+ case "decimal":
189
+ return "number";
190
+ case "json":
191
+ return "object";
192
+ case "array":
193
+ return "array";
194
+ default:
195
+ return "string";
196
+ }
197
+ }
198
+ function getFieldTarget(field) {
199
+ var _a;
200
+ return (field == null ? void 0 : field.target) || ((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.target);
201
+ }
202
+ function getFieldFilterable(field) {
203
+ var _a;
204
+ if (!import_lodash.default.isUndefined(field == null ? void 0 : field.filterable)) {
205
+ return field.filterable;
206
+ }
207
+ return (_a = field == null ? void 0 : field.options) == null ? void 0 : _a.filterable;
208
+ }
209
+ function inferAssociationLeafDisplayFieldUse(fieldInterface) {
210
+ return (0, import_core_field_default_bindings.getSharedFieldDefaultBindingUse)("display", fieldInterface);
211
+ }
212
+ function inferFieldMenuEditableFieldUse(fieldInterface) {
213
+ const normalized = String(fieldInterface || "").trim();
214
+ if (["m2m", "m2o", "o2o", "o2m", "oho", "obo", "updatedBy", "createdBy", "mbm"].includes(normalized)) {
215
+ return "RecordSelectFieldModel";
216
+ }
217
+ return (0, import_core_field_default_bindings.getSharedFieldDefaultBindingUse)("editable", normalized);
218
+ }
219
+ function isAssociationField(field) {
220
+ if (typeof (field == null ? void 0 : field.isAssociationField) === "function") {
221
+ return field.isAssociationField();
222
+ }
223
+ return ["belongsTo", "hasOne", "hasMany", "belongsToMany", "belongsToArray"].includes(getFieldType(field));
224
+ }
225
+ function resolveFieldFromCollection(collection, fieldPath) {
226
+ var _a, _b, _c;
227
+ if (!collection || !fieldPath) {
228
+ return null;
229
+ }
230
+ if (typeof (collection == null ? void 0 : collection.getFieldByPath) === "function") {
231
+ const direct = collection.getFieldByPath(fieldPath);
232
+ if (direct) {
233
+ return direct;
234
+ }
235
+ }
236
+ const [head, ...rest] = String(fieldPath || "").split(".").filter(Boolean);
237
+ const field = ((_a = collection == null ? void 0 : collection.getField) == null ? void 0 : _a.call(collection, head)) || ((_c = (_b = collection == null ? void 0 : collection.fields) == null ? void 0 : _b.get) == null ? void 0 : _c.call(_b, head));
238
+ if (!field || rest.length === 0) {
239
+ return field || null;
240
+ }
241
+ const targetCollection = resolveFieldTargetCollection(field, collection == null ? void 0 : collection.dataSourceKey, () => null);
242
+ if (!targetCollection) {
243
+ return null;
244
+ }
245
+ return resolveFieldFromCollection(targetCollection, rest.join("."));
246
+ }
247
+ function resolveFieldTargetCollection(field, dataSourceKey, getCollection) {
248
+ return (typeof (field == null ? void 0 : field.targetCollection) === "function" ? field.targetCollection() : field == null ? void 0 : field.targetCollection) || (getFieldTarget(field) ? getCollection(dataSourceKey || "main", getFieldTarget(field)) : null);
249
+ }
250
+ function buildCatalogCollectionCycleKey(collection, dataSourceKey) {
251
+ var _a;
252
+ if (!collection) {
253
+ return void 0;
254
+ }
255
+ return `${dataSourceKey || (collection == null ? void 0 : collection.dataSourceKey) || "main"}:${(collection == null ? void 0 : collection.name) || ((_a = collection == null ? void 0 : collection.options) == null ? void 0 : _a.name) || (collection == null ? void 0 : collection.title) || "unknown"}`;
256
+ }
257
+ function dedupeVisibleFieldCandidates(candidates) {
258
+ const seen = /* @__PURE__ */ new Set();
259
+ return candidates.filter((candidate) => {
260
+ const dedupeKey = [
261
+ normalizeFieldPath(candidate.fieldPath, candidate.associationPathName),
262
+ candidate.explicitWrapperUse || "",
263
+ candidate.explicitFieldUse || ""
264
+ ].join("::");
265
+ if (seen.has(dedupeKey)) {
266
+ return false;
267
+ }
268
+ seen.add(dedupeKey);
269
+ return true;
270
+ });
271
+ }
272
+ function getAssociationFilterTargetKey(field, targetCollection) {
273
+ var _a;
274
+ const resolvedTargetCollection = targetCollection || resolveFieldTargetCollection(field, "", () => null);
275
+ const filterTargetKey = (resolvedTargetCollection == null ? void 0 : resolvedTargetCollection.filterTargetKey) || ((_a = resolvedTargetCollection == null ? void 0 : resolvedTargetCollection.options) == null ? void 0 : _a.filterTargetKey);
276
+ if (Array.isArray(filterTargetKey)) {
277
+ return filterTargetKey[0] || "id";
278
+ }
279
+ return filterTargetKey || "id";
280
+ }
281
+ // Annotate the CommonJS export names for ESM import in node:
282
+ 0 && (module.exports = {
283
+ buildCatalogCollectionCycleKey,
284
+ buildFilterFieldMeta,
285
+ buildFlowTemplateSearchFilter,
286
+ dedupeVisibleFieldCandidates,
287
+ getAssociationFilterTargetKey,
288
+ getCollectionFields,
289
+ getCollectionName,
290
+ getCollectionTitle,
291
+ getCollectionTitleFieldName,
292
+ getFieldFilterable,
293
+ getFieldInterface,
294
+ getFieldName,
295
+ getFieldTarget,
296
+ getFieldTitle,
297
+ getFieldType,
298
+ hasConfiguredFlowContextValue,
299
+ inferAssociationLeafDisplayFieldUse,
300
+ inferFieldMenuEditableFieldUse,
301
+ inferFlowContextTypeFromField,
302
+ isAssociationField,
303
+ normalizeFieldPath,
304
+ normalizeTemplatePage,
305
+ normalizeTemplatePageSize,
306
+ resolveAssociationNameFromField,
307
+ resolveFieldFromCollection,
308
+ resolveFieldTargetCollection,
309
+ toTemplatePlainRow
310
+ });
@@ -0,0 +1,108 @@
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 { FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY, type FlowSurfaceApplyBlueprintPopupDefaultsMetadata } from './blueprint/defaults';
11
+ import type { FlowSurfaceNodeSpec, FlowSurfaceNodeSubModel } from './types';
12
+ export declare function buildDefinedPayload(payload: Record<string, any>): _.Dictionary<any>;
13
+ export declare function normalizeFlowSurfaceComposeKey(key: any, context: string): string;
14
+ export declare function assertFlowSurfaceComposeUniqueKeys(items: Array<{
15
+ key?: string;
16
+ }>, context: string): void;
17
+ export declare function normalizeChartCardSettings(cardSettings: any): any;
18
+ export declare function normalizeBlockTitleDescriptionValue(value: any): any;
19
+ export declare function normalizeBlockTitleDescription(titleDescription: any): any;
20
+ export declare function buildBlockTitleDescriptionFromSemanticChanges(changes: Record<string, any>): {
21
+ titleDescription: _.Dictionary<any>;
22
+ };
23
+ export declare function buildChartCardSettingsFromSemanticChanges(currentCardSettings: any, changes: Record<string, any>): any;
24
+ export declare function buildPopupTabTree(options: {
25
+ tabUid?: string;
26
+ gridUid?: string;
27
+ title?: string;
28
+ icon?: string;
29
+ documentTitle?: string;
30
+ flowRegistry?: Record<string, any>;
31
+ }): {
32
+ subModels: {
33
+ grid: {
34
+ uid: string;
35
+ use: string;
36
+ };
37
+ };
38
+ flowRegistry?: Record<string, any>;
39
+ uid: string;
40
+ use: string;
41
+ props: _.Dictionary<any>;
42
+ stepParams: {
43
+ pageTabSettings: {
44
+ tab: _.Dictionary<any>;
45
+ };
46
+ };
47
+ };
48
+ export declare function getSingleNodeSubModel(subModel?: FlowSurfaceNodeSubModel | null): FlowSurfaceNodeSpec | undefined;
49
+ export declare function getNodeSubModelList(subModel?: FlowSurfaceNodeSubModel | null): FlowSurfaceNodeSpec[];
50
+ export declare function flattenModel(node: any, carry?: Record<string, any>): Record<string, any>;
51
+ export declare function buildDefaultFieldState(containerUse: string, fieldUse: string, field: any): {
52
+ wrapperProps: {};
53
+ fieldProps: Record<string, any>;
54
+ };
55
+ export declare function hasOwnDefined(input: Record<string, any>, key: string): boolean;
56
+ export declare function hasMeaningfulChartSemanticPatch(input: Record<string, any>, key: string): boolean;
57
+ export declare function hasDefinedValue(input: Record<string, any>, keys: string[]): boolean;
58
+ export declare function ensureNoRawSimpleChangeKeys(changes: Record<string, any>): void;
59
+ export declare function ensureNoRawDirectAddKeys(actionName: string, values: Record<string, any>, rawKeys: string[]): void;
60
+ export declare function ensureNoDirectActionScopeKey(actionName: 'addAction' | 'addRecordAction', values: Record<string, any>): void;
61
+ export type NormalizedComposeFieldSpec = {
62
+ index: number;
63
+ key: string;
64
+ fieldPath?: string;
65
+ associationPathName?: string;
66
+ renderer?: string;
67
+ type?: string;
68
+ target?: string;
69
+ settings: Record<string, any>;
70
+ popup?: Record<string, any>;
71
+ __autoPopupForRelationField?: boolean;
72
+ [FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY]?: FlowSurfaceApplyBlueprintPopupDefaultsMetadata;
73
+ };
74
+ export declare function normalizeComposeFieldSpec(input: any, index: number): NormalizedComposeFieldSpec;
75
+ export declare function normalizeComposeActionSpec(input: any, index: number): {
76
+ popup?: any;
77
+ key: string;
78
+ type: string;
79
+ settings: any;
80
+ };
81
+ export declare function normalizeSimpleResourceInit(input: any): _.Dictionary<any>;
82
+ export declare function isMissingRequiredResourceInitValue(value: any): boolean;
83
+ export declare function joinRequiredFieldPaths(paths: string[]): string;
84
+ export declare function normalizeSimpleLayoutValue(layout: any): any;
85
+ export declare function normalizeGridCardColumns(columns: any): _.Dictionary<any>;
86
+ export declare function normalizeSimpleConfirm(confirm: any): _.Dictionary<any>;
87
+ export declare function assertSupportedSimpleChanges(context: string, changes: Record<string, any>, allowedKeys: string[]): void;
88
+ export declare function hasLegacyLocatorFields(input: any, options?: {
89
+ allowRootUid?: boolean;
90
+ }): boolean;
91
+ export declare function rethrowInlineConfigurationError(error: any, prefix: string): never;
92
+ export declare function toFlowSurfaceBatchItemError(error: any): {
93
+ code: string;
94
+ message: string;
95
+ status: number;
96
+ type: import("./errors").FlowSurfaceErrorType;
97
+ };
98
+ export declare function splitComposeFieldChanges(changes: Record<string, any>, wrapperUse?: string): {
99
+ wrapperChanges: _.Dictionary<any>;
100
+ fieldChanges: _.Dictionary<any>;
101
+ };
102
+ export declare function getCatalogRecordActionContainerUse(use?: string): "DetailsBlockModel" | "TableActionsColumnModel" | "ListItemModel" | "GridCardItemModel";
103
+ export declare function normalizeRowSpans(spans?: Array<number | undefined>): number[];
104
+ export declare function normalizePublicBlockHeightMode(input: any): string;
105
+ export declare function normalizeStoredChartCardHeightMode(input: any): string;
106
+ export declare function normalizeChartCardHeightModeForWrite(input: any): string;
107
+ export declare function isFieldNodeUse(use?: string): boolean;
108
+ export declare function getFieldBindingDefaultProps(containerUse: string, fieldUse: string, field: any): Record<string, any>;