@nocobase/plugin-flow-engine 2.1.0-alpha.15 → 2.1.0-alpha.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 (116) hide show
  1. package/dist/externalVersion.js +10 -10
  2. package/dist/node_modules/ses/package.json +1 -1
  3. package/dist/node_modules/zod/package.json +1 -1
  4. package/dist/server/flow-surfaces/{compiler.d.ts → apply/compiler.d.ts} +1 -10
  5. package/dist/server/flow-surfaces/{compiler.js → apply/compiler.js} +41 -280
  6. package/dist/server/flow-surfaces/apply/layout.d.ts +34 -0
  7. package/dist/server/flow-surfaces/apply/layout.js +175 -0
  8. package/dist/server/flow-surfaces/apply/matching.d.ts +16 -0
  9. package/dist/server/flow-surfaces/apply/matching.js +181 -0
  10. package/dist/server/flow-surfaces/association-title-field.d.ts +20 -0
  11. package/dist/server/flow-surfaces/association-title-field.js +158 -0
  12. package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +14 -0
  13. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +717 -0
  14. package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +13 -0
  15. package/dist/server/flow-surfaces/blueprint/compile-plan.js +308 -0
  16. package/dist/server/flow-surfaces/blueprint/compile-reaction.d.ts +11 -0
  17. package/dist/server/flow-surfaces/blueprint/compile-reaction.js +72 -0
  18. package/dist/server/flow-surfaces/blueprint/index.d.ts +12 -0
  19. package/dist/server/flow-surfaces/blueprint/index.js +44 -0
  20. package/dist/server/flow-surfaces/blueprint/normalize-document.d.ts +10 -0
  21. package/dist/server/flow-surfaces/blueprint/normalize-document.js +296 -0
  22. package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +26 -0
  23. package/dist/server/flow-surfaces/blueprint/private-utils.js +182 -0
  24. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +153 -0
  25. package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
  26. package/dist/server/flow-surfaces/catalog-smart.d.ts +18 -0
  27. package/dist/server/flow-surfaces/catalog-smart.js +239 -0
  28. package/dist/server/flow-surfaces/catalog-smart.projector.d.ts +15 -0
  29. package/dist/server/flow-surfaces/catalog-smart.projector.js +157 -0
  30. package/dist/server/flow-surfaces/catalog-smart.types.d.ts +99 -0
  31. package/dist/server/flow-surfaces/catalog-smart.types.js +24 -0
  32. package/dist/server/flow-surfaces/catalog.d.ts +3 -0
  33. package/dist/server/flow-surfaces/catalog.js +163 -34
  34. package/dist/server/flow-surfaces/compose-compiler.d.ts +104 -0
  35. package/dist/server/flow-surfaces/compose-compiler.js +162 -0
  36. package/dist/server/flow-surfaces/compose-runtime.d.ts +89 -0
  37. package/dist/server/flow-surfaces/compose-runtime.js +338 -0
  38. package/dist/server/flow-surfaces/configure-options.js +12 -3
  39. package/dist/server/flow-surfaces/constants.d.ts +3 -2
  40. package/dist/server/flow-surfaces/constants.js +36 -3
  41. package/dist/server/flow-surfaces/default-action-popup.d.ts +52 -0
  42. package/dist/server/flow-surfaces/default-action-popup.js +258 -0
  43. package/dist/server/flow-surfaces/executor.d.ts +10 -0
  44. package/dist/server/flow-surfaces/executor.js +59 -24
  45. package/dist/server/flow-surfaces/field-binding-registry.d.ts +23 -0
  46. package/dist/server/flow-surfaces/field-binding-registry.js +391 -0
  47. package/dist/server/flow-surfaces/field-semantics.d.ts +1 -1
  48. package/dist/server/flow-surfaces/index.js +75 -0
  49. package/dist/server/flow-surfaces/node-use-sets.d.ts +15 -0
  50. package/dist/server/flow-surfaces/node-use-sets.js +114 -0
  51. package/dist/server/flow-surfaces/payload-shape.d.ts +9 -0
  52. package/dist/server/flow-surfaces/payload-shape.js +61 -0
  53. package/dist/server/flow-surfaces/placement.js +2 -6
  54. package/dist/server/flow-surfaces/planning/action-specs.d.ts +179 -0
  55. package/dist/server/flow-surfaces/planning/action-specs.js +190 -0
  56. package/dist/server/flow-surfaces/planning/compiler.d.ts +37 -0
  57. package/dist/server/flow-surfaces/planning/compiler.js +376 -0
  58. package/dist/server/flow-surfaces/planning/context.d.ts +30 -0
  59. package/dist/server/flow-surfaces/planning/context.js +139 -0
  60. package/dist/server/flow-surfaces/planning/created-keys.d.ts +34 -0
  61. package/dist/server/flow-surfaces/planning/created-keys.js +375 -0
  62. package/dist/server/flow-surfaces/planning/key-kind.d.ts +11 -0
  63. package/dist/server/flow-surfaces/planning/key-kind.js +86 -0
  64. package/dist/server/flow-surfaces/planning/key-persistence.d.ts +34 -0
  65. package/dist/server/flow-surfaces/planning/key-persistence.js +148 -0
  66. package/dist/server/flow-surfaces/planning/key-registry.d.ts +40 -0
  67. package/dist/server/flow-surfaces/planning/key-registry.js +206 -0
  68. package/dist/server/flow-surfaces/planning/runtime.d.ts +37 -0
  69. package/dist/server/flow-surfaces/planning/runtime.js +259 -0
  70. package/dist/server/flow-surfaces/planning/step-link.d.ts +14 -0
  71. package/dist/server/flow-surfaces/planning/step-link.js +104 -0
  72. package/dist/server/flow-surfaces/planning/types.d.ts +55 -0
  73. package/dist/server/flow-surfaces/planning/types.js +24 -0
  74. package/dist/server/flow-surfaces/reaction/errors.d.ts +20 -0
  75. package/dist/server/flow-surfaces/reaction/errors.js +69 -0
  76. package/dist/server/flow-surfaces/reaction/field-value.d.ts +34 -0
  77. package/dist/server/flow-surfaces/reaction/field-value.js +181 -0
  78. package/dist/server/flow-surfaces/reaction/fingerprint.d.ts +16 -0
  79. package/dist/server/flow-surfaces/reaction/fingerprint.js +71 -0
  80. package/dist/server/flow-surfaces/reaction/linkage.d.ts +136 -0
  81. package/dist/server/flow-surfaces/reaction/linkage.js +882 -0
  82. package/dist/server/flow-surfaces/reaction/meta.d.ts +11 -0
  83. package/dist/server/flow-surfaces/reaction/meta.js +451 -0
  84. package/dist/server/flow-surfaces/reaction/registry.d.ts +136 -0
  85. package/dist/server/flow-surfaces/reaction/registry.js +186 -0
  86. package/dist/server/flow-surfaces/reaction/resolver.d.ts +22 -0
  87. package/dist/server/flow-surfaces/reaction/resolver.js +202 -0
  88. package/dist/server/flow-surfaces/reaction/types.d.ts +241 -0
  89. package/dist/server/flow-surfaces/reaction/types.js +24 -0
  90. package/dist/server/flow-surfaces/reaction/utils.d.ts +17 -0
  91. package/dist/server/flow-surfaces/reaction/utils.js +67 -0
  92. package/dist/server/flow-surfaces/reaction/value-expr.d.ts +15 -0
  93. package/dist/server/flow-surfaces/reaction/value-expr.js +209 -0
  94. package/dist/server/flow-surfaces/reference-guards.d.ts +19 -0
  95. package/dist/server/flow-surfaces/reference-guards.js +103 -0
  96. package/dist/server/flow-surfaces/service-helpers.d.ts +42 -0
  97. package/dist/server/flow-surfaces/service-helpers.js +377 -0
  98. package/dist/server/flow-surfaces/service-utils.d.ts +105 -0
  99. package/dist/server/flow-surfaces/service-utils.js +760 -0
  100. package/dist/server/flow-surfaces/service.d.ts +199 -104
  101. package/dist/server/flow-surfaces/service.js +4158 -1890
  102. package/dist/server/flow-surfaces/template-compatibility.d.ts +42 -0
  103. package/dist/server/flow-surfaces/template-compatibility.js +189 -0
  104. package/dist/server/flow-surfaces/template-service-utils.d.ts +62 -0
  105. package/dist/server/flow-surfaces/template-service-utils.js +281 -0
  106. package/dist/server/flow-surfaces/types.d.ts +129 -37
  107. package/dist/swagger/flow-surfaces.d.ts +3777 -1581
  108. package/dist/swagger/flow-surfaces.examples.d.ts +1246 -0
  109. package/dist/swagger/flow-surfaces.examples.js +1396 -0
  110. package/dist/swagger/flow-surfaces.js +2020 -1469
  111. package/dist/swagger/flow-surfaces.template-action-docs.d.ts +62 -0
  112. package/dist/swagger/flow-surfaces.template-action-docs.js +121 -0
  113. package/dist/swagger/flow-surfaces.template-schemas.d.ts +239 -0
  114. package/dist/swagger/flow-surfaces.template-schemas.js +255 -0
  115. package/dist/swagger/index.d.ts +3777 -1581
  116. package/package.json +2 -2
@@ -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_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
+ });
@@ -0,0 +1,136 @@
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 { FlowSurfaceActionLinkageRule, FlowSurfaceFieldLinkageRule, FlowSurfaceFieldLinkageScene, FlowSurfaceFieldOption, FlowSurfaceFieldPathToUidResolver, FlowSurfaceFieldUidToPathResolver, FlowSurfaceBlockLinkageRule } from './types';
10
+ type NormalizeFieldRuleOptions = {
11
+ scene: FlowSurfaceFieldLinkageScene;
12
+ resolveFieldPath?: FlowSurfaceFieldUidToPathResolver;
13
+ };
14
+ type CompileFieldRuleOptions = {
15
+ scene: FlowSurfaceFieldLinkageScene;
16
+ resolveFieldUid?: FlowSurfaceFieldPathToUidResolver;
17
+ };
18
+ type FlowSurfaceLinkageValidationCapability = {
19
+ conditionMeta: {
20
+ operatorsByPath: Record<string, string[]>;
21
+ };
22
+ };
23
+ type FlowSurfaceFieldLinkageValidationCapability = FlowSurfaceLinkageValidationCapability & {
24
+ targetFields: FlowSurfaceFieldOption[];
25
+ valueExprMeta?: {
26
+ supportedSources: Array<'literal' | 'path' | 'runjs'>;
27
+ };
28
+ };
29
+ export declare function buildReactionFingerprint(value: any): string;
30
+ export declare function normalizeBlockLinkageRules(rawRules: unknown): FlowSurfaceBlockLinkageRule[];
31
+ export declare function normalizeActionLinkageRules(rawRules: unknown): FlowSurfaceActionLinkageRule[];
32
+ export declare function normalizeFieldLinkageRules(rawRules: unknown, options: NormalizeFieldRuleOptions): FlowSurfaceFieldLinkageRule[];
33
+ export declare function validateBlockLinkageSceneSupport(scene: string, rules?: FlowSurfaceBlockLinkageRule[]): void;
34
+ export declare function validateBlockLinkageRulesAgainstCapability(rules: FlowSurfaceBlockLinkageRule[], capability: FlowSurfaceLinkageValidationCapability): void;
35
+ export declare function validateActionLinkageSceneSupport(scene: string, rules?: FlowSurfaceActionLinkageRule[]): void;
36
+ export declare function validateActionLinkageRulesAgainstCapability(rules: FlowSurfaceActionLinkageRule[], capability: FlowSurfaceLinkageValidationCapability): void;
37
+ export declare function validateFieldLinkageSceneSupport(scene: FlowSurfaceFieldLinkageScene, rules?: FlowSurfaceFieldLinkageRule[]): void;
38
+ export declare function validateFieldLinkageRulesAgainstCapability(rules: FlowSurfaceFieldLinkageRule[], capability: FlowSurfaceFieldLinkageValidationCapability): void;
39
+ export declare function compileBlockLinkageCanonicalRules(rules: FlowSurfaceBlockLinkageRule[]): {
40
+ key: string;
41
+ title: string;
42
+ enable: boolean;
43
+ condition: any;
44
+ actions: ({
45
+ key: string;
46
+ name: "linkageSetBlockProps";
47
+ params: {
48
+ value: "visible" | "hidden";
49
+ };
50
+ } | {
51
+ key: string;
52
+ name: "linkageRunjs";
53
+ params: {
54
+ value: {
55
+ version?: "v2" | "v1";
56
+ script: string;
57
+ };
58
+ };
59
+ })[];
60
+ }[];
61
+ export declare function compileActionLinkageCanonicalRules(rules: FlowSurfaceActionLinkageRule[]): {
62
+ key: string;
63
+ title: string;
64
+ enable: boolean;
65
+ condition: any;
66
+ actions: ({
67
+ key: string;
68
+ name: "linkageSetActionProps";
69
+ params: {
70
+ value: "disabled" | "visible" | "hidden" | "hiddenText" | "enabled";
71
+ };
72
+ } | {
73
+ key: string;
74
+ name: "linkageRunjs";
75
+ params: {
76
+ value: {
77
+ version?: "v2" | "v1";
78
+ script: string;
79
+ };
80
+ };
81
+ })[];
82
+ }[];
83
+ export declare function compileFieldLinkageCanonicalRules(rules: FlowSurfaceFieldLinkageRule[], options: CompileFieldRuleOptions): {
84
+ key: string;
85
+ title: string;
86
+ enable: boolean;
87
+ condition: any;
88
+ actions: ({
89
+ key: string;
90
+ name: "linkageSetFieldProps" | "linkageSetDetailsFieldProps" | "subFormLinkageSetFieldProps";
91
+ params: {
92
+ value: {
93
+ fields: string[];
94
+ state: "disabled" | "required" | "visible" | "hidden" | "enabled" | "hiddenReservedValue" | "notRequired";
95
+ };
96
+ };
97
+ } | {
98
+ key: string;
99
+ name: "linkageAssignField" | "subFormLinkageAssignField";
100
+ params: {
101
+ value: {
102
+ key: string;
103
+ enable: boolean;
104
+ targetPath: string;
105
+ mode: "default" | "assign";
106
+ condition: any;
107
+ value: any;
108
+ }[];
109
+ };
110
+ } | {
111
+ key: string;
112
+ name: "setFieldsDefaultValue";
113
+ params: {
114
+ value: {
115
+ key: string;
116
+ enable: boolean;
117
+ targetPath: string;
118
+ mode: "default" | "assign";
119
+ condition: any;
120
+ value: any;
121
+ }[];
122
+ };
123
+ } | {
124
+ key: string;
125
+ name: "linkageRunjs";
126
+ params: {
127
+ value: {
128
+ version?: "v2" | "v1";
129
+ script: string;
130
+ fields?: undefined;
131
+ state?: undefined;
132
+ };
133
+ };
134
+ })[];
135
+ }[];
136
+ export {};