@nocobase/plugin-flow-engine 2.1.0-beta.15 → 2.1.0-beta.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/dist/ai/ai-employees/nathan/index.d.ts +10 -0
  2. package/dist/ai/ai-employees/nathan/index.js +41 -0
  3. package/dist/ai/ai-employees/nathan/prompt.md +132 -0
  4. package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +69 -0
  5. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.js +2 -2
  6. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.js +2 -2
  7. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.js +2 -2
  8. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.js +2 -2
  9. package/dist/ai/docs/runjs/context/block-model.md +35 -35
  10. package/dist/ai/docs/runjs/context/collection-field.md +53 -51
  11. package/dist/ai/docs/runjs/context/collection.md +39 -39
  12. package/dist/ai/docs/runjs/context/data-source-manager.md +40 -30
  13. package/dist/ai/docs/runjs/context/data-source.md +52 -44
  14. package/dist/ai/docs/runjs/context/element.md +44 -38
  15. package/dist/ai/docs/runjs/context/exit-all.md +37 -35
  16. package/dist/ai/docs/runjs/context/exit.md +38 -35
  17. package/dist/ai/docs/runjs/context/filter-manager.md +36 -30
  18. package/dist/ai/docs/runjs/context/form.md +57 -57
  19. package/dist/ai/docs/runjs/context/get-model.md +22 -21
  20. package/dist/ai/docs/runjs/context/get-value.md +20 -19
  21. package/dist/ai/docs/runjs/context/get-var.md +61 -55
  22. package/dist/ai/docs/runjs/context/i18n.md +17 -14
  23. package/dist/ai/docs/runjs/context/import-async.md +333 -45
  24. package/dist/ai/docs/runjs/context/init-resource.md +20 -20
  25. package/dist/ai/docs/runjs/context/libs.md +31 -31
  26. package/dist/ai/docs/runjs/context/location.md +34 -31
  27. package/dist/ai/docs/runjs/context/logger.md +41 -40
  28. package/dist/ai/docs/runjs/context/make-resource.md +27 -26
  29. package/dist/ai/docs/runjs/context/message.md +42 -41
  30. package/dist/ai/docs/runjs/context/modal.md +44 -44
  31. package/dist/ai/docs/runjs/context/model.md +36 -33
  32. package/dist/ai/docs/runjs/context/notification.md +41 -40
  33. package/dist/ai/docs/runjs/context/off.md +14 -14
  34. package/dist/ai/docs/runjs/context/on.md +30 -29
  35. package/dist/ai/docs/runjs/context/open-view.md +40 -40
  36. package/dist/ai/docs/runjs/context/render.md +37 -32
  37. package/dist/ai/docs/runjs/context/request.md +46 -45
  38. package/dist/ai/docs/runjs/context/require-async.md +28 -25
  39. package/dist/ai/docs/runjs/context/resource.md +34 -34
  40. package/dist/ai/docs/runjs/context/route.md +36 -34
  41. package/dist/ai/docs/runjs/context/router.md +43 -31
  42. package/dist/ai/docs/runjs/context/set-value.md +18 -17
  43. package/dist/ai/docs/runjs/context/t.md +20 -17
  44. package/dist/ai/docs/runjs/context/view.md +49 -46
  45. package/dist/ai/docs/runjs/document.md +1 -0
  46. package/dist/ai/docs/runjs/import-modules.md +32 -32
  47. package/dist/ai/docs/runjs/index.md +13 -13
  48. package/dist/ai/docs/runjs/jsx.md +19 -19
  49. package/dist/ai/docs/runjs/model/form-block-model.md +1 -3
  50. package/dist/ai/docs/runjs/render.md +15 -15
  51. package/dist/ai/docs/runjs/resource/api-resource.md +53 -53
  52. package/dist/ai/docs/runjs/resource/multi-record-resource.md +64 -64
  53. package/dist/ai/docs/runjs/resource/single-record-resource.md +55 -55
  54. package/dist/ai/docs/runjs/resource/sql-resource.md +57 -57
  55. package/dist/ai/docs/runjs/window.md +5 -5
  56. package/dist/client/index.js +1 -1
  57. package/dist/externalVersion.js +11 -10
  58. package/dist/node_modules/ses/dist/ses.cjs +1 -1
  59. package/dist/node_modules/ses/package.json +1 -1
  60. package/dist/node_modules/zod/index.cjs +1 -1
  61. package/dist/node_modules/zod/package.json +1 -1
  62. package/dist/server/flow-surfaces/action-scope.d.ts +38 -0
  63. package/dist/server/flow-surfaces/action-scope.js +152 -0
  64. package/dist/server/flow-surfaces/apply/compiler.d.ts +13 -0
  65. package/dist/server/flow-surfaces/apply/compiler.js +969 -0
  66. package/dist/server/flow-surfaces/apply/layout.d.ts +34 -0
  67. package/dist/server/flow-surfaces/apply/layout.js +175 -0
  68. package/dist/server/flow-surfaces/apply/matching.d.ts +16 -0
  69. package/dist/server/flow-surfaces/apply/matching.js +181 -0
  70. package/dist/server/flow-surfaces/approval/blueprint-service.d.ts +84 -0
  71. package/dist/server/flow-surfaces/approval/blueprint-service.js +589 -0
  72. package/dist/server/flow-surfaces/approval/blueprint.d.ts +21 -0
  73. package/dist/server/flow-surfaces/approval/blueprint.js +187 -0
  74. package/dist/server/flow-surfaces/approval/builder.d.ts +225 -0
  75. package/dist/server/flow-surfaces/approval/builder.js +384 -0
  76. package/dist/server/flow-surfaces/approval/catalog-specs.d.ts +33 -0
  77. package/dist/server/flow-surfaces/approval/catalog-specs.js +156 -0
  78. package/dist/server/flow-surfaces/approval/index.d.ts +14 -0
  79. package/dist/server/flow-surfaces/approval/index.js +40 -0
  80. package/dist/server/flow-surfaces/approval/runtime-config.d.ts +44 -0
  81. package/dist/server/flow-surfaces/approval/runtime-config.js +299 -0
  82. package/dist/server/flow-surfaces/approval/semantic-use.d.ts +23 -0
  83. package/dist/server/flow-surfaces/approval/semantic-use.js +155 -0
  84. package/dist/server/flow-surfaces/association-title-field.d.ts +20 -0
  85. package/dist/server/flow-surfaces/association-title-field.js +158 -0
  86. package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +14 -0
  87. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +1007 -0
  88. package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +13 -0
  89. package/dist/server/flow-surfaces/blueprint/compile-plan.js +308 -0
  90. package/dist/server/flow-surfaces/blueprint/compile-reaction.d.ts +11 -0
  91. package/dist/server/flow-surfaces/blueprint/compile-reaction.js +72 -0
  92. package/dist/server/flow-surfaces/blueprint/defaults.d.ts +26 -0
  93. package/dist/server/flow-surfaces/blueprint/defaults.js +133 -0
  94. package/dist/server/flow-surfaces/blueprint/index.d.ts +12 -0
  95. package/dist/server/flow-surfaces/blueprint/index.js +44 -0
  96. package/dist/server/flow-surfaces/blueprint/normalize-document.d.ts +10 -0
  97. package/dist/server/flow-surfaces/blueprint/normalize-document.js +416 -0
  98. package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +26 -0
  99. package/dist/server/flow-surfaces/blueprint/private-utils.js +182 -0
  100. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +193 -0
  101. package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
  102. package/dist/server/flow-surfaces/builder.d.ts +211 -0
  103. package/dist/server/flow-surfaces/builder.js +1029 -0
  104. package/dist/server/flow-surfaces/catalog-smart.d.ts +18 -0
  105. package/dist/server/flow-surfaces/catalog-smart.js +239 -0
  106. package/dist/server/flow-surfaces/catalog-smart.projector.d.ts +15 -0
  107. package/dist/server/flow-surfaces/catalog-smart.projector.js +157 -0
  108. package/dist/server/flow-surfaces/catalog-smart.types.d.ts +99 -0
  109. package/dist/server/flow-surfaces/catalog-smart.types.js +24 -0
  110. package/dist/server/flow-surfaces/catalog.d.ts +78 -0
  111. package/dist/server/flow-surfaces/catalog.js +3496 -0
  112. package/dist/server/flow-surfaces/chart-config.d.ts +121 -0
  113. package/dist/server/flow-surfaces/chart-config.js +1394 -0
  114. package/dist/server/flow-surfaces/compose-compiler.d.ts +108 -0
  115. package/dist/server/flow-surfaces/compose-compiler.js +167 -0
  116. package/dist/server/flow-surfaces/compose-runtime.d.ts +93 -0
  117. package/dist/server/flow-surfaces/compose-runtime.js +375 -0
  118. package/dist/server/flow-surfaces/configure-options.d.ts +23 -0
  119. package/dist/server/flow-surfaces/configure-options.js +827 -0
  120. package/dist/server/flow-surfaces/constants.d.ts +351 -0
  121. package/dist/server/flow-surfaces/constants.js +104 -0
  122. package/dist/server/flow-surfaces/context.d.ts +72 -0
  123. package/dist/server/flow-surfaces/context.js +556 -0
  124. package/dist/server/flow-surfaces/contract-guard.d.ts +19 -0
  125. package/dist/server/flow-surfaces/contract-guard.js +402 -0
  126. package/dist/server/flow-surfaces/default-action-popup.d.ts +63 -0
  127. package/dist/server/flow-surfaces/default-action-popup.js +322 -0
  128. package/dist/server/flow-surfaces/default-block-actions.d.ts +32 -0
  129. package/dist/server/flow-surfaces/default-block-actions.js +185 -0
  130. package/dist/server/flow-surfaces/errors.d.ts +47 -0
  131. package/dist/server/flow-surfaces/errors.js +145 -0
  132. package/dist/server/flow-surfaces/executor.d.ts +23 -0
  133. package/dist/server/flow-surfaces/executor.js +132 -0
  134. package/dist/server/flow-surfaces/field-binding-registry.d.ts +23 -0
  135. package/dist/server/flow-surfaces/field-binding-registry.js +391 -0
  136. package/dist/server/flow-surfaces/field-semantics.d.ts +15 -0
  137. package/dist/server/flow-surfaces/field-semantics.js +81 -0
  138. package/dist/server/flow-surfaces/filter-group.d.ts +15 -0
  139. package/dist/server/flow-surfaces/filter-group.js +94 -0
  140. package/dist/server/flow-surfaces/index.d.ts +11 -0
  141. package/dist/server/flow-surfaces/index.js +243 -0
  142. package/dist/server/flow-surfaces/locator.d.ts +28 -0
  143. package/dist/server/flow-surfaces/locator.js +240 -0
  144. package/dist/server/flow-surfaces/node-use-sets.d.ts +15 -0
  145. package/dist/server/flow-surfaces/node-use-sets.js +131 -0
  146. package/dist/server/flow-surfaces/payload-shape.d.ts +9 -0
  147. package/dist/server/flow-surfaces/payload-shape.js +61 -0
  148. package/dist/server/flow-surfaces/placement.d.ts +33 -0
  149. package/dist/server/flow-surfaces/placement.js +195 -0
  150. package/dist/server/flow-surfaces/planning/action-specs.d.ts +179 -0
  151. package/dist/server/flow-surfaces/planning/action-specs.js +190 -0
  152. package/dist/server/flow-surfaces/planning/compiler.d.ts +37 -0
  153. package/dist/server/flow-surfaces/planning/compiler.js +376 -0
  154. package/dist/server/flow-surfaces/planning/context.d.ts +30 -0
  155. package/dist/server/flow-surfaces/planning/context.js +139 -0
  156. package/dist/server/flow-surfaces/planning/created-keys.d.ts +34 -0
  157. package/dist/server/flow-surfaces/planning/created-keys.js +375 -0
  158. package/dist/server/flow-surfaces/planning/key-kind.d.ts +11 -0
  159. package/dist/server/flow-surfaces/planning/key-kind.js +88 -0
  160. package/dist/server/flow-surfaces/planning/key-persistence.d.ts +34 -0
  161. package/dist/server/flow-surfaces/planning/key-persistence.js +148 -0
  162. package/dist/server/flow-surfaces/planning/key-registry.d.ts +40 -0
  163. package/dist/server/flow-surfaces/planning/key-registry.js +206 -0
  164. package/dist/server/flow-surfaces/planning/runtime.d.ts +37 -0
  165. package/dist/server/flow-surfaces/planning/runtime.js +259 -0
  166. package/dist/server/flow-surfaces/planning/step-link.d.ts +14 -0
  167. package/dist/server/flow-surfaces/planning/step-link.js +104 -0
  168. package/dist/server/flow-surfaces/planning/types.d.ts +55 -0
  169. package/dist/server/flow-surfaces/planning/types.js +24 -0
  170. package/dist/server/flow-surfaces/public-data-surface-default-filter.d.ts +20 -0
  171. package/dist/server/flow-surfaces/public-data-surface-default-filter.js +111 -0
  172. package/dist/server/flow-surfaces/reaction/errors.d.ts +20 -0
  173. package/dist/server/flow-surfaces/reaction/errors.js +69 -0
  174. package/dist/server/flow-surfaces/reaction/field-value.d.ts +34 -0
  175. package/dist/server/flow-surfaces/reaction/field-value.js +181 -0
  176. package/dist/server/flow-surfaces/reaction/fingerprint.d.ts +16 -0
  177. package/dist/server/flow-surfaces/reaction/fingerprint.js +71 -0
  178. package/dist/server/flow-surfaces/reaction/linkage.d.ts +136 -0
  179. package/dist/server/flow-surfaces/reaction/linkage.js +882 -0
  180. package/dist/server/flow-surfaces/reaction/meta.d.ts +11 -0
  181. package/dist/server/flow-surfaces/reaction/meta.js +451 -0
  182. package/dist/server/flow-surfaces/reaction/registry.d.ts +156 -0
  183. package/dist/server/flow-surfaces/reaction/registry.js +206 -0
  184. package/dist/server/flow-surfaces/reaction/resolver.d.ts +22 -0
  185. package/dist/server/flow-surfaces/reaction/resolver.js +202 -0
  186. package/dist/server/flow-surfaces/reaction/types.d.ts +241 -0
  187. package/dist/server/flow-surfaces/reaction/types.js +24 -0
  188. package/dist/server/flow-surfaces/reaction/utils.d.ts +17 -0
  189. package/dist/server/flow-surfaces/reaction/utils.js +67 -0
  190. package/dist/server/flow-surfaces/reaction/value-expr.d.ts +15 -0
  191. package/dist/server/flow-surfaces/reaction/value-expr.js +209 -0
  192. package/dist/server/flow-surfaces/reference-guards.d.ts +19 -0
  193. package/dist/server/flow-surfaces/reference-guards.js +103 -0
  194. package/dist/server/flow-surfaces/route-sync.d.ts +47 -0
  195. package/dist/server/flow-surfaces/route-sync.js +392 -0
  196. package/dist/server/flow-surfaces/service-helpers.d.ts +42 -0
  197. package/dist/server/flow-surfaces/service-helpers.js +377 -0
  198. package/dist/server/flow-surfaces/service-utils.d.ts +108 -0
  199. package/dist/server/flow-surfaces/service-utils.js +811 -0
  200. package/dist/server/flow-surfaces/service.d.ts +773 -0
  201. package/dist/server/flow-surfaces/service.js +13008 -0
  202. package/dist/server/flow-surfaces/support-matrix.d.ts +31 -0
  203. package/dist/server/flow-surfaces/support-matrix.js +259 -0
  204. package/dist/server/flow-surfaces/surface-context.d.ts +52 -0
  205. package/dist/server/flow-surfaces/surface-context.js +437 -0
  206. package/dist/server/flow-surfaces/template-compatibility.d.ts +42 -0
  207. package/dist/server/flow-surfaces/template-compatibility.js +189 -0
  208. package/dist/server/flow-surfaces/template-display.d.ts +20 -0
  209. package/dist/server/flow-surfaces/template-display.js +289 -0
  210. package/dist/server/flow-surfaces/template-service-utils.d.ts +62 -0
  211. package/dist/server/flow-surfaces/template-service-utils.js +281 -0
  212. package/dist/server/flow-surfaces/types.d.ts +288 -0
  213. package/dist/server/flow-surfaces/types.js +24 -0
  214. package/dist/server/plugin.js +2 -0
  215. package/dist/swagger/flow-surfaces.d.ts +5964 -0
  216. package/dist/swagger/flow-surfaces.examples.d.ts +1533 -0
  217. package/dist/swagger/flow-surfaces.examples.js +1758 -0
  218. package/dist/swagger/flow-surfaces.js +5315 -0
  219. package/dist/swagger/flow-surfaces.template-action-docs.d.ts +62 -0
  220. package/dist/swagger/flow-surfaces.template-action-docs.js +121 -0
  221. package/dist/swagger/flow-surfaces.template-schemas.d.ts +239 -0
  222. package/dist/swagger/flow-surfaces.template-schemas.js +255 -0
  223. package/dist/swagger/index.d.ts +5969 -0
  224. package/dist/swagger/index.js +50 -0
  225. package/package.json +2 -2
  226. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.d.ts +0 -0
  227. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.d.ts +0 -0
  228. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.d.ts +0 -0
  229. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.d.ts +0 -0
@@ -0,0 +1,55 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { FlowSurfaceMutateOp, FlowSurfacePlanStepLink, FlowSurfacePlanStepAction, FlowSurfaceReadLocator, FlowSurfaceReadTarget, FlowSurfaceResolvedTarget, FlowSurfaceSurfaceSelector } from '../types';
10
+ import type { FlowSurfaceCreatedKeySpec } from './created-keys';
11
+ export type FlowSurfaceResolvedKey = {
12
+ key: string;
13
+ uid: string;
14
+ source: 'declared' | 'request' | 'system';
15
+ kind: string;
16
+ locator: FlowSurfaceReadLocator;
17
+ rebind?: boolean;
18
+ reboundFromUid?: string;
19
+ };
20
+ export type FlowSurfaceResolvedSelectorSummary = {
21
+ uid?: string;
22
+ kind?: string;
23
+ key?: string;
24
+ step?: string;
25
+ path?: string;
26
+ source: FlowSurfaceResolvedKey['source'] | 'step' | 'created';
27
+ };
28
+ export type FlowSurfacePlanSurfaceContext = {
29
+ surfaceSelector?: FlowSurfaceSurfaceSelector;
30
+ surfaceTarget?: FlowSurfaceReadLocator;
31
+ surfaceResolved?: FlowSurfaceResolvedTarget;
32
+ rawTree?: any;
33
+ publicTree?: any;
34
+ publicNodeMap: Record<string, any>;
35
+ targetSummary: FlowSurfaceReadTarget | null;
36
+ fingerprint: string | null;
37
+ uidSet: Set<string>;
38
+ keyMap: Map<string, FlowSurfaceResolvedKey>;
39
+ requestKeyMap: Map<string, FlowSurfaceResolvedKey>;
40
+ };
41
+ export type FlowSurfaceCompiledPlanStepSelectorLink = FlowSurfacePlanStepLink & {
42
+ summary: FlowSurfaceResolvedSelectorSummary;
43
+ };
44
+ export type FlowSurfaceCompiledPlanStep = {
45
+ index: number;
46
+ id?: string;
47
+ action: FlowSurfacePlanStepAction;
48
+ payload: Record<string, any>;
49
+ executionPayload?: Record<string, any>;
50
+ resolvedSelectors: Partial<Record<'target' | 'source', FlowSurfaceResolvedSelectorSummary>>;
51
+ usedKeys: FlowSurfaceResolvedKey[];
52
+ usedStepLinks: FlowSurfaceCompiledPlanStepSelectorLink[];
53
+ createdKeys: FlowSurfaceCreatedKeySpec[];
54
+ mutateOp?: FlowSurfaceMutateOp;
55
+ };
@@ -0,0 +1,24 @@
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 __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var types_exports = {};
24
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,20 @@
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_DATA_SURFACE_BLOCK_TYPES: Set<string>;
10
+ export declare function isFlowSurfacePublicDataSurfaceBlockType(blockType?: string): boolean;
11
+ export declare function normalizeFlowSurfacePublicBlockDefaultFilter(actionName: string, defaultFilter: any, options: {
12
+ blockType?: string;
13
+ template?: unknown;
14
+ path?: string;
15
+ }): any;
16
+ export declare function backfillFlowSurfaceDefaultFilterSetting(settings: any, defaultFilter: any): any;
17
+ export declare function backfillFlowSurfaceFilterActionDefaultFilter<T extends {
18
+ type?: string;
19
+ settings?: Record<string, any>;
20
+ }>(actions: T[], defaultFilter: any): T[];
@@ -0,0 +1,111 @@
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 public_data_surface_default_filter_exports = {};
38
+ __export(public_data_surface_default_filter_exports, {
39
+ FLOW_SURFACE_PUBLIC_DATA_SURFACE_BLOCK_TYPES: () => FLOW_SURFACE_PUBLIC_DATA_SURFACE_BLOCK_TYPES,
40
+ backfillFlowSurfaceDefaultFilterSetting: () => backfillFlowSurfaceDefaultFilterSetting,
41
+ backfillFlowSurfaceFilterActionDefaultFilter: () => backfillFlowSurfaceFilterActionDefaultFilter,
42
+ isFlowSurfacePublicDataSurfaceBlockType: () => isFlowSurfacePublicDataSurfaceBlockType,
43
+ normalizeFlowSurfacePublicBlockDefaultFilter: () => normalizeFlowSurfacePublicBlockDefaultFilter
44
+ });
45
+ module.exports = __toCommonJS(public_data_surface_default_filter_exports);
46
+ var import_lodash = __toESM(require("lodash"));
47
+ var import_errors = require("./errors");
48
+ var import_filter_group = require("./filter-group");
49
+ const FLOW_SURFACE_PUBLIC_DATA_SURFACE_BLOCK_TYPES = /* @__PURE__ */ new Set(["table", "list", "gridCard"]);
50
+ function isFlowSurfacePublicDataSurfaceBlockType(blockType) {
51
+ return FLOW_SURFACE_PUBLIC_DATA_SURFACE_BLOCK_TYPES.has(String(blockType || "").trim());
52
+ }
53
+ function normalizeFlowSurfacePublicBlockDefaultFilter(actionName, defaultFilter, options) {
54
+ if (import_lodash.default.isUndefined(defaultFilter)) {
55
+ return void 0;
56
+ }
57
+ const fieldPath = options.path ? `${options.path}.defaultFilter` : "defaultFilter";
58
+ if (!isFlowSurfacePublicDataSurfaceBlockType(options.blockType) || !import_lodash.default.isUndefined(options.template)) {
59
+ (0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} ${fieldPath} is only supported on direct table/list/gridCard blocks`);
60
+ }
61
+ return (0, import_filter_group.normalizeFlowSurfaceFilterGroupValue)(
62
+ defaultFilter,
63
+ `flowSurfaces ${actionName} ${fieldPath} expects FilterGroup like ${import_filter_group.FLOW_SURFACE_FILTER_GROUP_EXAMPLE}`
64
+ );
65
+ }
66
+ function backfillFlowSurfaceDefaultFilterSetting(settings, defaultFilter) {
67
+ if (import_lodash.default.isUndefined(defaultFilter)) {
68
+ return settings;
69
+ }
70
+ if (import_lodash.default.isUndefined(settings)) {
71
+ return {
72
+ defaultFilter: import_lodash.default.cloneDeep(defaultFilter)
73
+ };
74
+ }
75
+ if (!import_lodash.default.isPlainObject(settings)) {
76
+ return settings;
77
+ }
78
+ if (Object.prototype.hasOwnProperty.call(settings, "defaultFilter")) {
79
+ return settings;
80
+ }
81
+ return {
82
+ ...import_lodash.default.cloneDeep(settings),
83
+ defaultFilter: import_lodash.default.cloneDeep(defaultFilter)
84
+ };
85
+ }
86
+ function backfillFlowSurfaceFilterActionDefaultFilter(actions, defaultFilter) {
87
+ if (import_lodash.default.isUndefined(defaultFilter)) {
88
+ return actions;
89
+ }
90
+ return actions.map((action) => {
91
+ if (String((action == null ? void 0 : action.type) || "").trim() !== "filter") {
92
+ return action;
93
+ }
94
+ const settings = backfillFlowSurfaceDefaultFilterSetting(action.settings, defaultFilter);
95
+ if (settings === action.settings) {
96
+ return action;
97
+ }
98
+ return {
99
+ ...action,
100
+ settings
101
+ };
102
+ });
103
+ }
104
+ // Annotate the CommonJS export names for ESM import in node:
105
+ 0 && (module.exports = {
106
+ FLOW_SURFACE_PUBLIC_DATA_SURFACE_BLOCK_TYPES,
107
+ backfillFlowSurfaceDefaultFilterSetting,
108
+ backfillFlowSurfaceFilterActionDefaultFilter,
109
+ isFlowSurfacePublicDataSurfaceBlockType,
110
+ normalizeFlowSurfacePublicBlockDefaultFilter
111
+ });
@@ -0,0 +1,20 @@
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_REACTION_UNSUPPORTED_TARGET_KIND = "FLOW_SURFACE_REACTION_UNSUPPORTED_TARGET_KIND";
10
+ export declare const FLOW_SURFACE_REACTION_AMBIGUOUS_SCENE = "FLOW_SURFACE_REACTION_AMBIGUOUS_SCENE";
11
+ export declare const FLOW_SURFACE_REACTION_UNSUPPORTED_ACTION_FOR_SCENE = "FLOW_SURFACE_REACTION_UNSUPPORTED_ACTION_FOR_SCENE";
12
+ export declare const FLOW_SURFACE_REACTION_UNKNOWN_TARGET_KEY = "FLOW_SURFACE_REACTION_UNKNOWN_TARGET_KEY";
13
+ export declare const FLOW_SURFACE_REACTION_DUPLICATE_SLOT = "FLOW_SURFACE_REACTION_DUPLICATE_SLOT";
14
+ export declare const FLOW_SURFACE_REACTION_INVALID_CONDITION_PATH = "FLOW_SURFACE_REACTION_INVALID_CONDITION_PATH";
15
+ export declare const FLOW_SURFACE_REACTION_INVALID_CONDITION_OPERATOR = "FLOW_SURFACE_REACTION_INVALID_CONDITION_OPERATOR";
16
+ export declare const FLOW_SURFACE_REACTION_INVALID_VALUE_SOURCE = "FLOW_SURFACE_REACTION_INVALID_VALUE_SOURCE";
17
+ export declare const FLOW_SURFACE_REACTION_INVALID_VALUE_PATH = "FLOW_SURFACE_REACTION_INVALID_VALUE_PATH";
18
+ export declare const FLOW_SURFACE_REACTION_INVALID_TARGET_FIELD = "FLOW_SURFACE_REACTION_INVALID_TARGET_FIELD";
19
+ export declare const FLOW_SURFACE_REACTION_FINGERPRINT_CONFLICT = "FLOW_SURFACE_REACTION_FINGERPRINT_CONFLICT";
20
+ export declare const FLOW_SURFACE_REACTION_FORM_ONLY = "FLOW_SURFACE_REACTION_FORM_ONLY";
@@ -0,0 +1,69 @@
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 errors_exports = {};
28
+ __export(errors_exports, {
29
+ FLOW_SURFACE_REACTION_AMBIGUOUS_SCENE: () => FLOW_SURFACE_REACTION_AMBIGUOUS_SCENE,
30
+ FLOW_SURFACE_REACTION_DUPLICATE_SLOT: () => FLOW_SURFACE_REACTION_DUPLICATE_SLOT,
31
+ FLOW_SURFACE_REACTION_FINGERPRINT_CONFLICT: () => FLOW_SURFACE_REACTION_FINGERPRINT_CONFLICT,
32
+ FLOW_SURFACE_REACTION_FORM_ONLY: () => FLOW_SURFACE_REACTION_FORM_ONLY,
33
+ FLOW_SURFACE_REACTION_INVALID_CONDITION_OPERATOR: () => FLOW_SURFACE_REACTION_INVALID_CONDITION_OPERATOR,
34
+ FLOW_SURFACE_REACTION_INVALID_CONDITION_PATH: () => FLOW_SURFACE_REACTION_INVALID_CONDITION_PATH,
35
+ FLOW_SURFACE_REACTION_INVALID_TARGET_FIELD: () => FLOW_SURFACE_REACTION_INVALID_TARGET_FIELD,
36
+ FLOW_SURFACE_REACTION_INVALID_VALUE_PATH: () => FLOW_SURFACE_REACTION_INVALID_VALUE_PATH,
37
+ FLOW_SURFACE_REACTION_INVALID_VALUE_SOURCE: () => FLOW_SURFACE_REACTION_INVALID_VALUE_SOURCE,
38
+ FLOW_SURFACE_REACTION_UNKNOWN_TARGET_KEY: () => FLOW_SURFACE_REACTION_UNKNOWN_TARGET_KEY,
39
+ FLOW_SURFACE_REACTION_UNSUPPORTED_ACTION_FOR_SCENE: () => FLOW_SURFACE_REACTION_UNSUPPORTED_ACTION_FOR_SCENE,
40
+ FLOW_SURFACE_REACTION_UNSUPPORTED_TARGET_KIND: () => FLOW_SURFACE_REACTION_UNSUPPORTED_TARGET_KIND
41
+ });
42
+ module.exports = __toCommonJS(errors_exports);
43
+ const FLOW_SURFACE_REACTION_UNSUPPORTED_TARGET_KIND = "FLOW_SURFACE_REACTION_UNSUPPORTED_TARGET_KIND";
44
+ const FLOW_SURFACE_REACTION_AMBIGUOUS_SCENE = "FLOW_SURFACE_REACTION_AMBIGUOUS_SCENE";
45
+ const FLOW_SURFACE_REACTION_UNSUPPORTED_ACTION_FOR_SCENE = "FLOW_SURFACE_REACTION_UNSUPPORTED_ACTION_FOR_SCENE";
46
+ const FLOW_SURFACE_REACTION_UNKNOWN_TARGET_KEY = "FLOW_SURFACE_REACTION_UNKNOWN_TARGET_KEY";
47
+ const FLOW_SURFACE_REACTION_DUPLICATE_SLOT = "FLOW_SURFACE_REACTION_DUPLICATE_SLOT";
48
+ const FLOW_SURFACE_REACTION_INVALID_CONDITION_PATH = "FLOW_SURFACE_REACTION_INVALID_CONDITION_PATH";
49
+ const FLOW_SURFACE_REACTION_INVALID_CONDITION_OPERATOR = "FLOW_SURFACE_REACTION_INVALID_CONDITION_OPERATOR";
50
+ const FLOW_SURFACE_REACTION_INVALID_VALUE_SOURCE = "FLOW_SURFACE_REACTION_INVALID_VALUE_SOURCE";
51
+ const FLOW_SURFACE_REACTION_INVALID_VALUE_PATH = "FLOW_SURFACE_REACTION_INVALID_VALUE_PATH";
52
+ const FLOW_SURFACE_REACTION_INVALID_TARGET_FIELD = "FLOW_SURFACE_REACTION_INVALID_TARGET_FIELD";
53
+ const FLOW_SURFACE_REACTION_FINGERPRINT_CONFLICT = "FLOW_SURFACE_REACTION_FINGERPRINT_CONFLICT";
54
+ const FLOW_SURFACE_REACTION_FORM_ONLY = "FLOW_SURFACE_REACTION_FORM_ONLY";
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ FLOW_SURFACE_REACTION_AMBIGUOUS_SCENE,
58
+ FLOW_SURFACE_REACTION_DUPLICATE_SLOT,
59
+ FLOW_SURFACE_REACTION_FINGERPRINT_CONFLICT,
60
+ FLOW_SURFACE_REACTION_FORM_ONLY,
61
+ FLOW_SURFACE_REACTION_INVALID_CONDITION_OPERATOR,
62
+ FLOW_SURFACE_REACTION_INVALID_CONDITION_PATH,
63
+ FLOW_SURFACE_REACTION_INVALID_TARGET_FIELD,
64
+ FLOW_SURFACE_REACTION_INVALID_VALUE_PATH,
65
+ FLOW_SURFACE_REACTION_INVALID_VALUE_SOURCE,
66
+ FLOW_SURFACE_REACTION_UNKNOWN_TARGET_KEY,
67
+ FLOW_SURFACE_REACTION_UNSUPPORTED_ACTION_FOR_SCENE,
68
+ FLOW_SURFACE_REACTION_UNSUPPORTED_TARGET_KIND
69
+ });
@@ -0,0 +1,34 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { FlowSurfaceFieldValueRule, FlowSurfaceReactionTargetSummary, FlowSurfaceReactionWriteResult } from './types';
10
+ export type FlowSurfaceFieldValueTarget = FlowSurfaceReactionTargetSummary & {
11
+ use?: string | null;
12
+ collection?: any;
13
+ };
14
+ export type FlowSurfaceFieldValueCompileResult = FlowSurfaceReactionWriteResult<FlowSurfaceFieldValueRule> & {
15
+ updateAssociationValues: string[];
16
+ };
17
+ export declare function isFieldValueTargetUseSupported(use?: string | null): boolean;
18
+ export declare function assertFieldValueTargetSupported(target: FlowSurfaceFieldValueTarget): void;
19
+ export declare function normalizeFieldValueRules(rules: FlowSurfaceFieldValueRule[] | undefined): FlowSurfaceFieldValueRule[];
20
+ export declare function compileFieldValueRulesToCanonical(rules: FlowSurfaceFieldValueRule[] | undefined): {
21
+ key: string;
22
+ enable: boolean;
23
+ targetPath: string;
24
+ mode: string;
25
+ condition: import("./types").FlowSurfaceReactionFilter;
26
+ value: any;
27
+ }[];
28
+ export declare function collectUpdateAssociationValuesFromFieldValueRules(items: Array<{
29
+ targetPath?: string;
30
+ } | any>, rootCollection: any): string[];
31
+ export declare function buildFieldValueWriteResult(params: {
32
+ target: FlowSurfaceFieldValueTarget;
33
+ rules: FlowSurfaceFieldValueRule[] | undefined;
34
+ }): FlowSurfaceFieldValueCompileResult;
@@ -0,0 +1,181 @@
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 field_value_exports = {};
38
+ __export(field_value_exports, {
39
+ assertFieldValueTargetSupported: () => assertFieldValueTargetSupported,
40
+ buildFieldValueWriteResult: () => buildFieldValueWriteResult,
41
+ collectUpdateAssociationValuesFromFieldValueRules: () => collectUpdateAssociationValuesFromFieldValueRules,
42
+ compileFieldValueRulesToCanonical: () => compileFieldValueRulesToCanonical,
43
+ isFieldValueTargetUseSupported: () => isFieldValueTargetUseSupported,
44
+ normalizeFieldValueRules: () => normalizeFieldValueRules
45
+ });
46
+ module.exports = __toCommonJS(field_value_exports);
47
+ var import_lodash = __toESM(require("lodash"));
48
+ var import_errors = require("../errors");
49
+ var import_errors2 = require("./errors");
50
+ var import_fingerprint = require("./fingerprint");
51
+ var import_registry = require("./registry");
52
+ var import_value_expr = require("./value-expr");
53
+ const FLOW_SURFACE_FIELD_VALUE_SUPPORTED_USES = /* @__PURE__ */ new Set(["CreateFormModel", "EditFormModel"]);
54
+ const FLOW_SURFACE_FIELD_VALUE_SCENE = "form";
55
+ const FLOW_SURFACE_FIELD_VALUE_SLOT = (0, import_registry.getReactionSlot)(
56
+ "fieldValue",
57
+ FLOW_SURFACE_FIELD_VALUE_SCENE
58
+ );
59
+ function isFieldValueTargetUseSupported(use) {
60
+ return FLOW_SURFACE_FIELD_VALUE_SUPPORTED_USES.has(String(use || "").trim());
61
+ }
62
+ function assertFieldValueTargetSupported(target) {
63
+ if (isFieldValueTargetUseSupported(target == null ? void 0 : target.use)) {
64
+ return;
65
+ }
66
+ const label = (target == null ? void 0 : target.publicPath) || (target == null ? void 0 : target.uid) || "target";
67
+ (0, import_errors.throwBadRequest)(
68
+ `flowSurfaces field value rules only support createForm/editForm targets; got '${label}' (${(target == null ? void 0 : target.use) || "unknown"})`,
69
+ import_errors2.FLOW_SURFACE_REACTION_FORM_ONLY
70
+ );
71
+ }
72
+ function normalizeFieldValueRule(rule, index) {
73
+ const current = import_lodash.default.isPlainObject(rule) ? rule : {};
74
+ const key = String(current.key || `idx:${index}`).trim();
75
+ return {
76
+ ...key ? { key } : {},
77
+ enabled: current.enabled !== false,
78
+ targetPath: (0, import_value_expr.normalizeReactionPath)(current.targetPath, `rules[${index}].targetPath`),
79
+ mode: current.mode === "default" ? "default" : "assign",
80
+ when: (0, import_value_expr.normalizeReactionFilter)(current.when),
81
+ value: (0, import_value_expr.normalizeReactionValueExpr)(current.value)
82
+ };
83
+ }
84
+ function normalizeFieldValueRules(rules) {
85
+ const list = Array.isArray(rules) ? rules : [];
86
+ return list.map((rule, index) => normalizeFieldValueRule(rule, index));
87
+ }
88
+ function compileFieldValueRulesToCanonical(rules) {
89
+ return normalizeFieldValueRules(rules).map((rule) => ({
90
+ key: rule.key,
91
+ enable: rule.enabled !== false,
92
+ targetPath: rule.targetPath,
93
+ mode: rule.mode === "default" ? "default" : "assign",
94
+ condition: (0, import_value_expr.compileReactionFilter)(rule.when),
95
+ value: (0, import_value_expr.compileReactionValueExpr)(rule.value)
96
+ }));
97
+ }
98
+ function collectUpdateAssociationValuesFromFieldValueRules(items, rootCollection) {
99
+ const list = Array.isArray(items) ? items : [];
100
+ const output = /* @__PURE__ */ new Set();
101
+ const getDeepestAssociationPath = (targetPath) => {
102
+ var _a, _b, _c;
103
+ if (!rootCollection || typeof rootCollection.getField !== "function") return null;
104
+ if (typeof targetPath !== "string" || !targetPath.includes(".")) return null;
105
+ const segments = targetPath.split(".").filter(Boolean);
106
+ if (segments.length < 2) return null;
107
+ let currentCollection = rootCollection;
108
+ const associationSegments = [];
109
+ let deepest = null;
110
+ let deepestField = null;
111
+ for (let index = 0; index < segments.length - 1; index += 1) {
112
+ const segment = segments[index];
113
+ const field = (_a = currentCollection == null ? void 0 : currentCollection.getField) == null ? void 0 : _a.call(currentCollection, segment);
114
+ if (!((_b = field == null ? void 0 : field.isAssociationField) == null ? void 0 : _b.call(field)) || !(field == null ? void 0 : field.targetCollection)) break;
115
+ associationSegments.push(segment);
116
+ deepest = associationSegments.join(".");
117
+ deepestField = field;
118
+ currentCollection = field.targetCollection;
119
+ }
120
+ if (deepest && deepestField) {
121
+ const leaf = segments[segments.length - 1];
122
+ const rawKey = (deepestField == null ? void 0 : deepestField.targetKey) ?? ((_c = deepestField == null ? void 0 : deepestField.targetCollection) == null ? void 0 : _c.filterTargetKey) ?? "id";
123
+ const keyFields = Array.isArray(rawKey) ? rawKey.filter((value) => typeof value === "string" && !!value) : typeof rawKey === "string" && rawKey ? [rawKey] : ["id"];
124
+ if (typeof leaf === "string" && keyFields.includes(leaf)) {
125
+ return null;
126
+ }
127
+ }
128
+ return deepest;
129
+ };
130
+ for (const item of list) {
131
+ const targetPath = typeof (item == null ? void 0 : item.targetPath) === "string" ? item.targetPath : "";
132
+ if (!targetPath) continue;
133
+ const associationPath = getDeepestAssociationPath(targetPath);
134
+ if (associationPath) {
135
+ output.add(associationPath);
136
+ }
137
+ }
138
+ return Array.from(output);
139
+ }
140
+ function buildFieldValueWriteResult(params) {
141
+ assertFieldValueTargetSupported(params.target);
142
+ const normalizedRules = normalizeFieldValueRules(params.rules);
143
+ const canonicalRules = normalizedRules.map((rule) => ({
144
+ key: rule.key,
145
+ enable: rule.enabled !== false,
146
+ targetPath: rule.targetPath,
147
+ mode: rule.mode,
148
+ condition: (0, import_value_expr.compileReactionFilter)(rule.when),
149
+ value: (0, import_value_expr.compileReactionValueExpr)(rule.value)
150
+ }));
151
+ const fingerprint = (0, import_fingerprint.buildReactionFingerprint)({
152
+ kind: "fieldValue",
153
+ scene: FLOW_SURFACE_FIELD_VALUE_SCENE,
154
+ slot: FLOW_SURFACE_FIELD_VALUE_SLOT,
155
+ canonicalRules
156
+ });
157
+ return {
158
+ target: {
159
+ uid: params.target.uid,
160
+ ...params.target.publicPath ? { publicPath: params.target.publicPath } : {}
161
+ },
162
+ resolvedScene: FLOW_SURFACE_FIELD_VALUE_SCENE,
163
+ resolvedSlot: FLOW_SURFACE_FIELD_VALUE_SLOT,
164
+ fingerprint,
165
+ normalizedRules,
166
+ canonicalRules,
167
+ updateAssociationValues: collectUpdateAssociationValuesFromFieldValueRules(
168
+ canonicalRules,
169
+ params.target.collection
170
+ )
171
+ };
172
+ }
173
+ // Annotate the CommonJS export names for ESM import in node:
174
+ 0 && (module.exports = {
175
+ assertFieldValueTargetSupported,
176
+ buildFieldValueWriteResult,
177
+ collectUpdateAssociationValuesFromFieldValueRules,
178
+ compileFieldValueRulesToCanonical,
179
+ isFieldValueTargetUseSupported,
180
+ normalizeFieldValueRules
181
+ });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { FlowSurfaceReactionKind, FlowSurfaceReactionScene, FlowSurfaceReactionSlot } from './types';
10
+ export declare function buildReactionStableFingerprintString(value: any): string;
11
+ export declare function buildReactionFingerprint(params: {
12
+ kind: FlowSurfaceReactionKind;
13
+ scene: FlowSurfaceReactionScene;
14
+ slot: FlowSurfaceReactionSlot;
15
+ canonicalRules: any[];
16
+ }): string;
@@ -0,0 +1,71 @@
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 fingerprint_exports = {};
38
+ __export(fingerprint_exports, {
39
+ buildReactionFingerprint: () => buildReactionFingerprint,
40
+ buildReactionStableFingerprintString: () => buildReactionStableFingerprintString
41
+ });
42
+ module.exports = __toCommonJS(fingerprint_exports);
43
+ var import_crypto = require("crypto");
44
+ var import_lodash = __toESM(require("lodash"));
45
+ function buildReactionStableFingerprintString(value) {
46
+ if (import_lodash.default.isNil(value)) {
47
+ return "null";
48
+ }
49
+ if (Array.isArray(value)) {
50
+ return `[${value.map((item) => buildReactionStableFingerprintString(item)).join(",")}]`;
51
+ }
52
+ if (import_lodash.default.isPlainObject(value)) {
53
+ const entries = Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${buildReactionStableFingerprintString(value[key])}`);
54
+ return `{${entries.join(",")}}`;
55
+ }
56
+ return JSON.stringify(value);
57
+ }
58
+ function buildReactionFingerprint(params) {
59
+ const payload = {
60
+ kind: params.kind,
61
+ scene: params.scene,
62
+ slot: params.slot,
63
+ canonicalRules: Array.isArray(params.canonicalRules) ? params.canonicalRules : []
64
+ };
65
+ return (0, import_crypto.createHash)("sha1").update(buildReactionStableFingerprintString(payload)).digest("hex");
66
+ }
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {
69
+ buildReactionFingerprint,
70
+ buildReactionStableFingerprintString
71
+ });