@nocobase/plugin-flow-engine 2.1.0-beta.14 → 2.1.0-beta.16

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,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,17 @@
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
+ type RunJSValue = {
10
+ code: string;
11
+ version?: string;
12
+ };
13
+ export declare function extractPropertyPath(value: string): string[] | null;
14
+ export declare function formatPathToVariable(path: string[]): string;
15
+ export declare function isVariableExpression(value: unknown): boolean;
16
+ export declare function normalizeRunJSValue(value: RunJSValue | null | undefined): Required<RunJSValue>;
17
+ export {};
@@ -0,0 +1,67 @@
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 utils_exports = {};
28
+ __export(utils_exports, {
29
+ extractPropertyPath: () => extractPropertyPath,
30
+ formatPathToVariable: () => formatPathToVariable,
31
+ isVariableExpression: () => isVariableExpression,
32
+ normalizeRunJSValue: () => normalizeRunJSValue
33
+ });
34
+ module.exports = __toCommonJS(utils_exports);
35
+ function extractPropertyPath(value) {
36
+ if (typeof value !== "string") return null;
37
+ const trimmed = value.trim();
38
+ const variableRegex = /^\{\{\s*ctx(?:\.(.+?))?\s*\}\}$/;
39
+ const match = trimmed.match(variableRegex);
40
+ if (!match) return null;
41
+ const pathString = match[1];
42
+ if (!pathString) return [];
43
+ return pathString.split(".").map((part) => part.trim()).filter((part) => part.length > 0);
44
+ }
45
+ function formatPathToVariable(path) {
46
+ if (path.length === 0) return "{{ ctx }}";
47
+ return `{{ ctx.${path.join(".")} }}`;
48
+ }
49
+ function isVariableExpression(value) {
50
+ if (typeof value !== "string") return false;
51
+ const trimmed = value.trim();
52
+ const variableRegex = /^\{\{\s*ctx(?:\..+?)?\s*\}\}$/;
53
+ return variableRegex.test(trimmed);
54
+ }
55
+ function normalizeRunJSValue(value) {
56
+ return {
57
+ code: String((value == null ? void 0 : value.code) ?? ""),
58
+ version: String((value == null ? void 0 : value.version) ?? "v1")
59
+ };
60
+ }
61
+ // Annotate the CommonJS export names for ESM import in node:
62
+ 0 && (module.exports = {
63
+ extractPropertyPath,
64
+ formatPathToVariable,
65
+ isVariableExpression,
66
+ normalizeRunJSValue
67
+ });
@@ -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
+ import type { FlowSurfaceReactionFilter, FlowSurfaceValueExpr } from './types';
10
+ export declare function barePathToVariableExpression(path: unknown, label?: string): string;
11
+ export declare function normalizeReactionValueExpr(input: any): FlowSurfaceValueExpr;
12
+ export declare function compileReactionValueExpr(input: FlowSurfaceValueExpr | any): any;
13
+ export declare function normalizeReactionFilter(filter: FlowSurfaceReactionFilter | undefined): FlowSurfaceReactionFilter;
14
+ export declare function compileReactionFilter(filter: FlowSurfaceReactionFilter | undefined): FlowSurfaceReactionFilter;
15
+ export declare function normalizeReactionPath(path: unknown, label: string): string;
@@ -0,0 +1,209 @@
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 value_expr_exports = {};
38
+ __export(value_expr_exports, {
39
+ barePathToVariableExpression: () => barePathToVariableExpression,
40
+ compileReactionFilter: () => compileReactionFilter,
41
+ compileReactionValueExpr: () => compileReactionValueExpr,
42
+ normalizeReactionFilter: () => normalizeReactionFilter,
43
+ normalizeReactionPath: () => normalizeReactionPath,
44
+ normalizeReactionValueExpr: () => normalizeReactionValueExpr
45
+ });
46
+ module.exports = __toCommonJS(value_expr_exports);
47
+ var import_lodash = __toESM(require("lodash"));
48
+ var import_errors = require("../errors");
49
+ var import_errors2 = require("./errors");
50
+ var import_utils = require("./utils");
51
+ const EMPTY_CONDITION = Object.freeze({ logic: "$and", items: [] });
52
+ function normalizeBarePath(path, label) {
53
+ if (typeof path === "string" && (0, import_utils.isVariableExpression)(path)) {
54
+ const extracted = (0, import_utils.extractPropertyPath)(path);
55
+ if (Array.isArray(extracted)) {
56
+ return extracted.join(".");
57
+ }
58
+ }
59
+ const normalized = String(path ?? "").trim().split(".").map((segment) => segment.trim()).filter(Boolean).join(".");
60
+ if (!normalized) {
61
+ (0, import_errors.throwBadRequest)(`flowSurfaces reaction ${label} cannot be empty`, import_errors2.FLOW_SURFACE_REACTION_INVALID_CONDITION_PATH);
62
+ }
63
+ return normalized;
64
+ }
65
+ function barePathToVariableExpression(path, label = "path") {
66
+ const normalized = normalizeBarePath(path, label);
67
+ return (0, import_utils.formatPathToVariable)(
68
+ normalized.split(".").map((segment) => segment.trim()).filter(Boolean)
69
+ );
70
+ }
71
+ function normalizeReactionValueExpr(input) {
72
+ if (!import_lodash.default.isPlainObject(input) || !Object.prototype.hasOwnProperty.call(input, "source")) {
73
+ if (typeof input === "string" && (0, import_utils.isVariableExpression)(input)) {
74
+ return {
75
+ source: "path",
76
+ path: normalizeBarePath(input, "value.path")
77
+ };
78
+ }
79
+ if (import_lodash.default.isPlainObject(input) && Object.prototype.hasOwnProperty.call(input, "code")) {
80
+ const normalizedRunjs = (0, import_utils.normalizeRunJSValue)({
81
+ code: String(input.code ?? ""),
82
+ version: input.version == null ? void 0 : String(input.version)
83
+ });
84
+ return {
85
+ source: "runjs",
86
+ code: normalizedRunjs.code,
87
+ version: normalizedRunjs.version
88
+ };
89
+ }
90
+ return {
91
+ source: "literal",
92
+ value: import_lodash.default.cloneDeep(input)
93
+ };
94
+ }
95
+ const source = String(input.source || "").trim();
96
+ if (source === "literal") {
97
+ return {
98
+ source: "literal",
99
+ value: import_lodash.default.cloneDeep(input.value)
100
+ };
101
+ }
102
+ if (source === "path") {
103
+ return {
104
+ source: "path",
105
+ path: normalizeBarePath(input.path, "value.path")
106
+ };
107
+ }
108
+ if (source === "runjs") {
109
+ const normalizedRunjs = (0, import_utils.normalizeRunJSValue)({
110
+ code: String(input.code ?? ""),
111
+ version: input.version == null ? void 0 : String(input.version)
112
+ });
113
+ return {
114
+ source: "runjs",
115
+ code: normalizedRunjs.code,
116
+ version: normalizedRunjs.version
117
+ };
118
+ }
119
+ (0, import_errors.throwBadRequest)(`flowSurfaces reaction value.source '${source}' is unsupported`);
120
+ }
121
+ function compileReactionValueExpr(input) {
122
+ const normalized = normalizeReactionValueExpr(input);
123
+ if (normalized.source === "literal") {
124
+ return import_lodash.default.cloneDeep(normalized.value);
125
+ }
126
+ if (normalized.source === "path") {
127
+ return barePathToVariableExpression(normalized.path, "value.path");
128
+ }
129
+ const normalizedRunjs = (0, import_utils.normalizeRunJSValue)({
130
+ code: normalized.code,
131
+ version: normalized.version
132
+ });
133
+ return {
134
+ code: normalizedRunjs.code,
135
+ version: normalizedRunjs.version
136
+ };
137
+ }
138
+ function compileConditionNode(input) {
139
+ if (Array.isArray(input)) {
140
+ return input.map((item) => compileConditionNode(item));
141
+ }
142
+ if (import_lodash.default.isPlainObject(input)) {
143
+ if (Object.prototype.hasOwnProperty.call(input, "source")) {
144
+ return compileReactionValueExpr(input);
145
+ }
146
+ const output = {};
147
+ for (const [key, value] of Object.entries(input)) {
148
+ if (key === "path") {
149
+ output[key] = barePathToVariableExpression(value, "condition.path");
150
+ continue;
151
+ }
152
+ if (key === "value") {
153
+ output[key] = compileConditionNode(value);
154
+ continue;
155
+ }
156
+ output[key] = compileConditionNode(value);
157
+ }
158
+ return output;
159
+ }
160
+ return import_lodash.default.cloneDeep(input);
161
+ }
162
+ function normalizeReactionFilter(filter) {
163
+ if (import_lodash.default.isNil(filter)) {
164
+ return import_lodash.default.cloneDeep(EMPTY_CONDITION);
165
+ }
166
+ if (!import_lodash.default.isPlainObject(filter)) {
167
+ (0, import_errors.throwBadRequest)("flowSurfaces reaction when must be an object");
168
+ }
169
+ const visit = (input) => {
170
+ if (Array.isArray(input)) {
171
+ return input.map((item) => visit(item));
172
+ }
173
+ if (!import_lodash.default.isPlainObject(input)) {
174
+ return import_lodash.default.cloneDeep(input);
175
+ }
176
+ if (Object.prototype.hasOwnProperty.call(input, "source")) {
177
+ return normalizeReactionValueExpr(input);
178
+ }
179
+ const output = {};
180
+ for (const [key, value] of Object.entries(input)) {
181
+ if (key === "path") {
182
+ output[key] = normalizeBarePath(value, "condition.path");
183
+ continue;
184
+ }
185
+ if (key === "value") {
186
+ output[key] = visit(value);
187
+ continue;
188
+ }
189
+ output[key] = visit(value);
190
+ }
191
+ return output;
192
+ };
193
+ return visit(filter);
194
+ }
195
+ function compileReactionFilter(filter) {
196
+ return compileConditionNode(normalizeReactionFilter(filter));
197
+ }
198
+ function normalizeReactionPath(path, label) {
199
+ return normalizeBarePath(path, label);
200
+ }
201
+ // Annotate the CommonJS export names for ESM import in node:
202
+ 0 && (module.exports = {
203
+ barePathToVariableExpression,
204
+ compileReactionFilter,
205
+ compileReactionValueExpr,
206
+ normalizeReactionFilter,
207
+ normalizeReactionPath,
208
+ normalizeReactionValueExpr
209
+ });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { FlowSurfacePlanStepLink } from './types';
10
+ export declare function isFlowSurfacePlanStepValue(input: any): input is FlowSurfacePlanStepLink;
11
+ export declare function normalizeFlowSurfacePlanStepValue(actionName: string, input: any, fieldName: string): FlowSurfacePlanStepLink;
12
+ export declare function throwUnsupportedFlowSurfaceDollarRef(actionName: string, path: string, allowed: string): never;
13
+ export declare function throwUnsupportedFlowSurfaceRef(actionName: string, path: string, allowed: string): never;
14
+ export declare function assertNoFlowSurfaceLegacyRef(input: any, options: {
15
+ actionName: string;
16
+ path: string;
17
+ dollarRefAllowed?: string;
18
+ refAllowed?: string;
19
+ }): void;
@@ -0,0 +1,103 @@
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 reference_guards_exports = {};
38
+ __export(reference_guards_exports, {
39
+ assertNoFlowSurfaceLegacyRef: () => assertNoFlowSurfaceLegacyRef,
40
+ isFlowSurfacePlanStepValue: () => isFlowSurfacePlanStepValue,
41
+ normalizeFlowSurfacePlanStepValue: () => normalizeFlowSurfacePlanStepValue,
42
+ throwUnsupportedFlowSurfaceDollarRef: () => throwUnsupportedFlowSurfaceDollarRef,
43
+ throwUnsupportedFlowSurfaceRef: () => throwUnsupportedFlowSurfaceRef
44
+ });
45
+ module.exports = __toCommonJS(reference_guards_exports);
46
+ var import_lodash = __toESM(require("lodash"));
47
+ var import_errors = require("./errors");
48
+ function isFlowSurfacePlanStepValue(input) {
49
+ return import_lodash.default.isPlainObject(input) && Object.keys(input).every((key) => ["step", "path"].includes(key)) && typeof input.step === "string" && !!input.step.trim();
50
+ }
51
+ function normalizeFlowSurfacePlanStepValue(actionName, input, fieldName) {
52
+ if (!import_lodash.default.isPlainObject(input)) {
53
+ (0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} ${fieldName} must be an object`);
54
+ }
55
+ if (Object.keys(input).some((key) => !["step", "path"].includes(key))) {
56
+ (0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} ${fieldName} only supports step/path`);
57
+ }
58
+ const step = String(input.step || "").trim();
59
+ if (!step) {
60
+ (0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} ${fieldName}.step cannot be empty`);
61
+ }
62
+ const path = import_lodash.default.isUndefined(input.path) ? void 0 : String(input.path || "").trim();
63
+ if (import_lodash.default.has(input, "path") && !path) {
64
+ (0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} ${fieldName}.path cannot be empty`);
65
+ }
66
+ return {
67
+ step,
68
+ ...path ? { path } : {}
69
+ };
70
+ }
71
+ function throwUnsupportedFlowSurfaceDollarRef(actionName, path, allowed) {
72
+ (0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} ${path} must use ${allowed}; "$ref" is not supported`);
73
+ }
74
+ function throwUnsupportedFlowSurfaceRef(actionName, path, allowed) {
75
+ (0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} ${path} does not support { ref }; use ${allowed}`);
76
+ }
77
+ function assertNoFlowSurfaceLegacyRef(input, options) {
78
+ if (!import_lodash.default.isPlainObject(input)) {
79
+ return;
80
+ }
81
+ if (Object.prototype.hasOwnProperty.call(input, "$ref")) {
82
+ throwUnsupportedFlowSurfaceDollarRef(
83
+ options.actionName,
84
+ options.path,
85
+ options.dollarRefAllowed || options.refAllowed || "key"
86
+ );
87
+ }
88
+ if (Object.prototype.hasOwnProperty.call(input, "ref")) {
89
+ throwUnsupportedFlowSurfaceRef(
90
+ options.actionName,
91
+ options.path,
92
+ options.refAllowed || options.dollarRefAllowed || "key"
93
+ );
94
+ }
95
+ }
96
+ // Annotate the CommonJS export names for ESM import in node:
97
+ 0 && (module.exports = {
98
+ assertNoFlowSurfaceLegacyRef,
99
+ isFlowSurfacePlanStepValue,
100
+ normalizeFlowSurfacePlanStepValue,
101
+ throwUnsupportedFlowSurfaceDollarRef,
102
+ throwUnsupportedFlowSurfaceRef
103
+ });
@@ -0,0 +1,47 @@
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 FlowModelRepository from '../repository';
10
+ export declare class FlowSurfaceRouteSync {
11
+ private readonly db;
12
+ private readonly repository;
13
+ constructor(db: any, repository: FlowModelRepository);
14
+ buildPageTree(pageRouteLike: any, transaction?: any): Promise<any>;
15
+ buildTabAnchor(tabRouteLike: any, transaction?: any): Promise<{
16
+ subModels?: {
17
+ grid: Record<string, any>;
18
+ };
19
+ uid: string;
20
+ use: string;
21
+ props: {
22
+ route: Record<string, any>;
23
+ title: string;
24
+ icon: string;
25
+ };
26
+ decoratorProps: Record<string, any>;
27
+ flowRegistry: Record<string, any>;
28
+ stepParams: {
29
+ pageTabSettings: any;
30
+ };
31
+ }>;
32
+ removeRouteAnchorChildren(schemaUid: string, transaction?: any): Promise<void>;
33
+ removeTabAnchorTree(schemaUid: string, transaction?: any): Promise<void>;
34
+ persistPageSettings(target: any, current: any, nextPayload: Record<string, any>, transaction?: any): Promise<void>;
35
+ persistTabSettings(target: any, current: any, nextPayload: Record<string, any>, transaction?: any): Promise<void>;
36
+ findPersistedTabAnchor(schemaUid: string, transaction?: any): Promise<any>;
37
+ hydrateRoute(routeLike: any, transaction?: any): Promise<any>;
38
+ private readPageRouteBackedState;
39
+ private buildPageRoutePatch;
40
+ private normalizePagePayload;
41
+ private buildTabRoutePatch;
42
+ normalizeTabPayload(current: any, nextPayload: Record<string, any>, routePatch: Record<string, any>): {
43
+ props: any;
44
+ stepParams: any;
45
+ flowRegistry: any;
46
+ };
47
+ }