@nocobase/plugin-flow-engine 3.0.0-alpha.5 → 3.0.0-alpha.7
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.
- package/dist/externalVersion.js +9 -9
- package/dist/node_modules/@ant-design/icons-svg/package.json +1 -1
- package/dist/node_modules/acorn/package.json +1 -1
- package/dist/node_modules/acorn-jsx/package.json +1 -1
- package/dist/node_modules/acorn-walk/package.json +1 -1
- package/dist/node_modules/ses/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/flow-surfaces/builder.js +5 -0
- package/dist/server/flow-surfaces/catalog.js +27 -8
- package/dist/server/flow-surfaces/configure-options.js +17 -1
- package/dist/server/flow-surfaces/service-utils.d.ts +1 -0
- package/dist/server/flow-surfaces/service-utils.js +17 -0
- package/dist/server/flow-surfaces/service.js +9 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +7 -0
- package/dist/server/plugin.d.ts +11 -0
- package/dist/server/plugin.js +85 -3
- package/dist/server/repository.d.ts +8 -0
- package/dist/server/repository.js +29 -0
- package/dist/server/template/context-keys.d.ts +14 -0
- package/dist/server/template/context-keys.js +86 -0
- package/dist/server/template/contexts.d.ts +5 -8
- package/dist/server/template/contexts.js +43 -51
- package/dist/server/template/resolver.d.ts +5 -13
- package/dist/server/template/resolver.js +188 -257
- package/dist/server/template/variable-expression.d.ts +72 -0
- package/dist/server/template/variable-expression.js +597 -0
- package/dist/server/variables/allow-list.d.ts +48 -0
- package/dist/server/variables/allow-list.js +374 -0
- package/dist/server/variables/form-item-record-slot-resolvers.d.ts +10 -0
- package/dist/server/variables/form-item-record-slot-resolvers.js +280 -0
- package/dist/server/variables/record-bindings.d.ts +42 -0
- package/dist/server/variables/record-bindings.js +196 -0
- package/dist/server/variables/record-projection.d.ts +10 -0
- package/dist/server/variables/record-projection.js +140 -0
- package/dist/server/variables/record-slot-policy.d.ts +23 -0
- package/dist/server/variables/record-slot-policy.js +100 -0
- package/dist/server/variables/record-slot-resolvers.d.ts +46 -0
- package/dist/server/variables/record-slot-resolvers.js +115 -0
- package/dist/server/variables/records.d.ts +47 -1
- package/dist/server/variables/records.js +279 -5
- package/dist/server/variables/registry.d.ts +33 -10
- package/dist/server/variables/registry.js +197 -362
- package/dist/server/variables/resolve.d.ts +18 -2
- package/dist/server/variables/resolve.js +79 -13
- package/dist/server/variables/runjs-variable-dependencies.d.ts +21 -0
- package/dist/server/variables/runjs-variable-dependencies.js +313 -0
- package/dist/server/variables/utils.d.ts +3 -6
- package/dist/server/variables/utils.js +50 -111
- package/package.json +2 -2
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
import { HttpRequestContext } from '../template/contexts';
|
|
10
9
|
import { ResourcerContext } from '@nocobase/resourcer';
|
|
10
|
+
import { HttpRequestContext } from '../template/contexts';
|
|
11
|
+
import { type PathSegment, type VariablePathRef } from '../template/variable-expression';
|
|
12
|
+
import { type AuthorizedRecordBinding, type RecordBindingPlan } from './record-bindings';
|
|
11
13
|
export type JSONValue = string | {
|
|
12
14
|
[key: string]: JSONValue;
|
|
13
15
|
} | JSONValue[];
|
|
@@ -15,38 +17,59 @@ export type VarScope = 'global' | 'request';
|
|
|
15
17
|
export interface RequiredParamSpec {
|
|
16
18
|
name: string;
|
|
17
19
|
required?: boolean;
|
|
18
|
-
defaultValue?:
|
|
20
|
+
defaultValue?: unknown;
|
|
19
21
|
}
|
|
22
|
+
export type ValidateContextParamsOptions = {
|
|
23
|
+
contextParams: Record<string, unknown>;
|
|
24
|
+
flowModelUid?: string;
|
|
25
|
+
koaCtx: ResourcerContext;
|
|
26
|
+
usage: readonly VariablePathRef[];
|
|
27
|
+
varName: string;
|
|
28
|
+
};
|
|
29
|
+
export type ValidateContextParamsResult = {
|
|
30
|
+
allowed?: boolean;
|
|
31
|
+
contextParams?: Record<string, unknown>;
|
|
32
|
+
requireFlowModel?: boolean;
|
|
33
|
+
};
|
|
20
34
|
export interface VariableDef {
|
|
21
35
|
name: string;
|
|
22
36
|
scope: VarScope;
|
|
23
37
|
requiredParams?: RequiredParamSpec[];
|
|
24
|
-
attach: (ctx: HttpRequestContext, koaCtx: ResourcerContext, params?:
|
|
38
|
+
attach: (ctx: HttpRequestContext, koaCtx: ResourcerContext, params?: unknown, usage?: VarUsage) => Promise<void> | void;
|
|
39
|
+
validateContextParams?: (options: ValidateContextParamsOptions) => Promise<ValidateContextParamsResult | void> | ValidateContextParamsResult | void;
|
|
25
40
|
}
|
|
26
|
-
export type VarUsage =
|
|
27
|
-
|
|
28
|
-
};
|
|
41
|
+
export type VarUsage = Readonly<Record<string, readonly VariablePathRef[]>>;
|
|
42
|
+
type LegacyVarUsage = Record<string, string[]>;
|
|
29
43
|
declare class VariableRegistry {
|
|
30
44
|
private vars;
|
|
31
45
|
register(def: VariableDef): void;
|
|
32
46
|
get(name: string): VariableDef;
|
|
33
47
|
list(): VariableDef[];
|
|
34
|
-
extractUsage(template: JSONValue):
|
|
35
|
-
validate(template: JSONValue, contextParams:
|
|
48
|
+
extractUsage(template: JSONValue): LegacyVarUsage;
|
|
49
|
+
validate(template: JSONValue, contextParams: unknown): {
|
|
36
50
|
ok: boolean;
|
|
37
51
|
missing?: string[];
|
|
38
52
|
};
|
|
39
|
-
attachUsedVariables(ctx: HttpRequestContext, koaCtx: ResourcerContext, template: JSONValue, contextParams:
|
|
53
|
+
attachUsedVariables(ctx: HttpRequestContext, koaCtx: ResourcerContext, template: JSONValue, contextParams: Record<string, unknown>): Promise<void>;
|
|
54
|
+
attachUsedVariablesFromUsage(ctx: HttpRequestContext, koaCtx: ResourcerContext, usage: VarUsage, contextParams: Record<string, unknown>): Promise<void>;
|
|
55
|
+
attachUsedVariablesFromPlan(ctx: HttpRequestContext, koaCtx: ResourcerContext, usage: VarUsage, plan: RecordBindingPlan): Promise<void>;
|
|
40
56
|
}
|
|
41
57
|
export declare const variables: VariableRegistry;
|
|
42
58
|
/** 仅测试使用:重置变量注册表为内置默认集 */
|
|
59
|
+
export declare function omitVariableContextParams(contextParams: Record<string, unknown>, varName: string): Record<string, unknown>;
|
|
60
|
+
export declare function sanitizeRegisteredVariableContextParams(contextParams: Record<string, unknown>, registry?: {
|
|
61
|
+
get?: (name: string) => VariableDef | undefined;
|
|
62
|
+
list?: () => VariableDef[];
|
|
63
|
+
}): Record<string, unknown>;
|
|
43
64
|
/**
|
|
44
65
|
* 从使用路径推断查询所需的 fields 与 appends。
|
|
45
66
|
* @param paths 使用到的子路径数组
|
|
46
67
|
* @param params 显式参数(仅用于兼容签名)
|
|
47
68
|
*/
|
|
48
|
-
export declare function inferSelectsFromUsage(paths?: string[], _params?: unknown): {
|
|
69
|
+
export declare function inferSelectsFromUsage(paths?: readonly (string | readonly PathSegment[])[], _params?: unknown): {
|
|
49
70
|
generatedAppends?: string[];
|
|
50
71
|
generatedFields?: string[];
|
|
51
72
|
};
|
|
73
|
+
export declare function isSafeRecordBinding(binding: AuthorizedRecordBinding): boolean;
|
|
74
|
+
export declare function registerBuiltInVariables(reg: VariableRegistry): void;
|
|
52
75
|
export {};
|