trigger_system 1.2.1 → 1.2.5
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/browser/index.browser.js +183 -40
- package/dist/browser/index.browser.js.map +116 -17
- package/dist/core/action-registry.d.ts +29 -3
- package/dist/core/action-registry.d.ts.map +1 -1
- package/dist/core/base-engine.d.ts +3 -3
- package/dist/core/constants.d.ts +95 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/dependency-graph/analyzer.d.ts +60 -0
- package/dist/core/dependency-graph/analyzer.d.ts.map +1 -0
- package/dist/core/dependency-graph/builder.d.ts +28 -0
- package/dist/core/dependency-graph/builder.d.ts.map +1 -0
- package/dist/core/dependency-graph/cycles.d.ts +28 -0
- package/dist/core/dependency-graph/cycles.d.ts.map +1 -0
- package/dist/core/dependency-graph/index.d.ts +11 -0
- package/dist/core/dependency-graph/index.d.ts.map +1 -0
- package/dist/core/dependency-graph/types.d.ts +72 -0
- package/dist/core/dependency-graph/types.d.ts.map +1 -0
- package/dist/core/dependency-graph/utils.d.ts +39 -0
- package/dist/core/dependency-graph/utils.d.ts.map +1 -0
- package/dist/core/dependency-graph/validator.d.ts +28 -0
- package/dist/core/dependency-graph/validator.d.ts.map +1 -0
- package/dist/core/dependency-graph.d.ts +64 -13
- package/dist/core/dependency-graph.d.ts.map +1 -1
- package/dist/core/engine-utils.d.ts +45 -0
- package/dist/core/engine-utils.d.ts.map +1 -0
- package/dist/core/engine.d.ts +0 -8
- package/dist/core/engine.d.ts.map +1 -1
- package/dist/core/expression-engine.d.ts +52 -10
- package/dist/core/expression-engine.d.ts.map +1 -1
- package/dist/core/index.d.ts +2 -4
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/operators.d.ts +48 -0
- package/dist/core/operators.d.ts.map +1 -0
- package/dist/core/persistence-browser.d.ts +25 -2
- package/dist/core/persistence-browser.d.ts.map +1 -1
- package/dist/core/persistence.node.d.ts +25 -2
- package/dist/core/persistence.node.d.ts.map +1 -1
- package/dist/core/rule-engine-new.d.ts +2 -1
- package/dist/core/rule-engine-new.d.ts.map +1 -1
- package/dist/core/rule-engine.d.ts +22 -35
- package/dist/core/rule-engine.d.ts.map +1 -1
- package/dist/core/trigger-engine.d.ts +18 -25
- package/dist/core/trigger-engine.d.ts.map +1 -1
- package/dist/domain/validator.d.ts +36043 -5067
- package/dist/domain/validator.d.ts.map +1 -1
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/io/index.d.ts +6 -1
- package/dist/io/index.d.ts.map +1 -1
- package/dist/io/loader/index.d.ts +48 -0
- package/dist/io/loader/index.d.ts.map +1 -0
- package/dist/io/loader/persistence.d.ts +41 -0
- package/dist/io/loader/persistence.d.ts.map +1 -0
- package/dist/io/loader/query.d.ts +49 -0
- package/dist/io/loader/query.d.ts.map +1 -0
- package/dist/io/loader/registry.d.ts +91 -0
- package/dist/io/loader/registry.d.ts.map +1 -0
- package/dist/io/loader/types.d.ts +32 -0
- package/dist/io/loader/types.d.ts.map +1 -0
- package/dist/io/loader/watch.d.ts +36 -0
- package/dist/io/loader/watch.d.ts.map +1 -0
- package/dist/io/loader.node.d.ts +1 -13
- package/dist/io/loader.node.d.ts.map +1 -1
- package/dist/lsp/hover-constants.d.ts +42 -0
- package/dist/lsp/hover-constants.d.ts.map +1 -0
- package/dist/lsp/server.bundle.d.ts +2 -0
- package/dist/lsp/server.bundle.d.ts.map +1 -0
- package/dist/node/index.js +183 -170
- package/dist/node/index.js.map +116 -91
- package/dist/node/node.js +185 -173
- package/dist/node/node.js.map +122 -93
- package/dist/node.d.ts +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/sdk/builder.d.ts +177 -21
- package/dist/sdk/builder.d.ts.map +1 -1
- package/dist/sdk/builders/action-builder.d.ts +24 -0
- package/dist/sdk/builders/action-builder.d.ts.map +1 -0
- package/dist/sdk/builders/condition-builder.d.ts +26 -0
- package/dist/sdk/builders/condition-builder.d.ts.map +1 -0
- package/dist/sdk/builders/index.d.ts +5 -0
- package/dist/sdk/builders/index.d.ts.map +1 -0
- package/dist/sdk/builders/params-builder.d.ts +59 -0
- package/dist/sdk/builders/params-builder.d.ts.map +1 -0
- package/dist/sdk/constants.d.ts +44 -0
- package/dist/sdk/constants.d.ts.map +1 -0
- package/dist/sdk/exporter.d.ts +16 -0
- package/dist/sdk/exporter.d.ts.map +1 -1
- package/dist/sdk/graph/action-resolver.d.ts +103 -0
- package/dist/sdk/graph/action-resolver.d.ts.map +1 -0
- package/dist/sdk/graph/condition-resolver.d.ts +87 -0
- package/dist/sdk/graph/condition-resolver.d.ts.map +1 -0
- package/dist/sdk/graph/converters.d.ts +152 -0
- package/dist/sdk/graph/converters.d.ts.map +1 -0
- package/dist/sdk/graph/index.d.ts +12 -0
- package/dist/sdk/graph/index.d.ts.map +1 -0
- package/dist/sdk/graph/node-filters.d.ts +96 -0
- package/dist/sdk/graph/node-filters.d.ts.map +1 -0
- package/dist/sdk/graph/traversal.d.ts +105 -0
- package/dist/sdk/graph/traversal.d.ts.map +1 -0
- package/dist/sdk/graph/types.d.ts +28 -0
- package/dist/sdk/graph/types.d.ts.map +1 -0
- package/dist/sdk/graph-parser.d.ts +40 -0
- package/dist/sdk/graph-parser.d.ts.map +1 -0
- package/dist/sdk/index.d.ts +3 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/optimize.d.ts +27 -0
- package/dist/sdk/optimize.d.ts.map +1 -0
- package/dist/sdk/yaml/converter.d.ts +81 -0
- package/dist/sdk/yaml/converter.d.ts.map +1 -0
- package/dist/sdk/yaml/index.d.ts +39 -0
- package/dist/sdk/yaml/index.d.ts.map +1 -0
- package/dist/sdk/yaml/normalizer.d.ts +44 -0
- package/dist/sdk/yaml/normalizer.d.ts.map +1 -0
- package/dist/sdk/yaml/types.d.ts +198 -0
- package/dist/sdk/yaml/types.d.ts.map +1 -0
- package/dist/sdk/yaml/utils.d.ts +131 -0
- package/dist/sdk/yaml/utils.d.ts.map +1 -0
- package/dist/sdk/yaml-parser.d.ts +18 -0
- package/dist/sdk/yaml-parser.d.ts.map +1 -0
- package/dist/types.d.ts +40 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -1
package/dist/node.d.ts
CHANGED
package/dist/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC;AAGxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC;AAGxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC"}
|
package/dist/sdk/builder.d.ts
CHANGED
|
@@ -1,39 +1,195 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export declare class ActionBuilder {
|
|
12
|
-
private actions;
|
|
13
|
-
private mode;
|
|
14
|
-
setMode(mode: ExecutionMode): this;
|
|
15
|
-
add(type: string, params?: ActionParams, options?: {
|
|
16
|
-
delay?: number;
|
|
17
|
-
probability?: number;
|
|
18
|
-
}): this;
|
|
19
|
-
build(): Action | Action[] | ActionGroup;
|
|
20
|
-
}
|
|
1
|
+
export { optimizeCondition, optimizeAction, type OptimizeOptions } from './optimize';
|
|
2
|
+
export { ConditionBuilder, ActionBuilder, ParamsBuilder } from './builders';
|
|
3
|
+
export { type GraphParserOptions, type GraphParserContext } from './graph/types';
|
|
4
|
+
import { type GraphParserOptions, type GraphParserContext } from './graph-parser';
|
|
5
|
+
import { type OptimizeOptions } from './optimize';
|
|
6
|
+
import type { TriggerRule, RuleCondition, Action, ActionGroup, ComparisonOperator, ConditionValue, ActionParams, SDKGraphNode, SDKGraphEdge } from "../types";
|
|
7
|
+
import { ConditionBuilder, ActionBuilder } from './builders';
|
|
8
|
+
/**
|
|
9
|
+
* Main RuleBuilder class for creating trigger rules fluently.
|
|
10
|
+
*/
|
|
21
11
|
export declare class RuleBuilder {
|
|
22
12
|
private rule;
|
|
13
|
+
private optimizeOptions;
|
|
14
|
+
/**
|
|
15
|
+
* Build a TriggerRule strictly from a standard set of nodes and edges.
|
|
16
|
+
* This is useful for UIs (like React Flow) that manage condition topologies.
|
|
17
|
+
*/
|
|
18
|
+
static fromGraph(nodes: SDKGraphNode[], edges: SDKGraphEdge[], options?: GraphParserOptions, transformers?: GraphParserContext['transformers']): RuleBuilder;
|
|
19
|
+
/**
|
|
20
|
+
* Build multiple TriggerRules from a graph with multiple Event nodes.
|
|
21
|
+
* This allows editing multiple rules in a single editor view.
|
|
22
|
+
*
|
|
23
|
+
* @returns Array of TriggerRules, one for each Event node found
|
|
24
|
+
*/
|
|
25
|
+
static fromGraphMultiple(nodes: SDKGraphNode[], edges: SDKGraphEdge[], options?: GraphParserOptions, transformers?: GraphParserContext['transformers']): {
|
|
26
|
+
rules: TriggerRule[];
|
|
27
|
+
errors: string[];
|
|
28
|
+
};
|
|
23
29
|
withId(id: string): this;
|
|
24
30
|
withName(name: string): this;
|
|
25
31
|
withDescription(description: string): this;
|
|
26
32
|
withPriority(priority: number): this;
|
|
27
33
|
withCooldown(cooldown: number): this;
|
|
28
34
|
withTags(tags: string[]): this;
|
|
35
|
+
withEnabled(enabled: boolean): this;
|
|
36
|
+
/**
|
|
37
|
+
* Set optimization options for deduplication behavior.
|
|
38
|
+
* @param options - Options to control how conditions/actions are deduplicated
|
|
39
|
+
*/
|
|
40
|
+
withOptimizeOptions(options: OptimizeOptions): this;
|
|
41
|
+
id(id: string): this;
|
|
42
|
+
name(name: string): this;
|
|
43
|
+
description(desc: string): this;
|
|
44
|
+
priority(p: number): this;
|
|
45
|
+
enabled(e: boolean): this;
|
|
46
|
+
cooldown(c: number): this;
|
|
47
|
+
tags(t: string[]): this;
|
|
48
|
+
optimize(options: OptimizeOptions): this;
|
|
29
49
|
on(event: string): this;
|
|
30
|
-
if(field: string, operator: ComparisonOperator, value
|
|
50
|
+
if(field: string, operator: ComparisonOperator, value?: ConditionValue): this;
|
|
31
51
|
ifComplex(sub: (builder: ConditionBuilder) => ConditionBuilder): this;
|
|
52
|
+
withIf(condition: RuleCondition | RuleCondition[]): this;
|
|
32
53
|
do(type: string, params?: ActionParams, options?: {
|
|
33
54
|
delay?: number;
|
|
34
55
|
probability?: number;
|
|
35
56
|
}): this;
|
|
36
57
|
doComplex(sub: (builder: ActionBuilder) => ActionBuilder): this;
|
|
58
|
+
withDo(action: Action | ActionGroup | (Action | ActionGroup)[]): this;
|
|
59
|
+
/**
|
|
60
|
+
* Add an else clause at the rule level (when rule's 'if' condition is false).
|
|
61
|
+
* This is different from action-level else - it's for when the entire rule's condition fails.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* builder
|
|
65
|
+
* .id("rule-1")
|
|
66
|
+
* .on("event")
|
|
67
|
+
* .if("data.status", "EQ", "active")
|
|
68
|
+
* .do("notify", { message: "Active!" })
|
|
69
|
+
* .elseRule("log", { message: "Not active" })
|
|
70
|
+
*/
|
|
71
|
+
elseRule(action: Action | Action[] | ActionGroup): this;
|
|
72
|
+
/**
|
|
73
|
+
* Start a conditional action block with an 'if' condition.
|
|
74
|
+
* Returns a ConditionalActionBuilder to chain then/do/else actions.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* builder
|
|
78
|
+
* .on("event")
|
|
79
|
+
* .when("data.status", "EQ", "active")
|
|
80
|
+
* .then("notify", { message: "Active!" })
|
|
81
|
+
* .else("log", { message: "Not active" })
|
|
82
|
+
*/
|
|
83
|
+
when(field: string, operator: ComparisonOperator, value?: ConditionValue): ConditionalActionBuilder;
|
|
84
|
+
/**
|
|
85
|
+
* Start a complex conditional action block using a condition builder.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* builder
|
|
89
|
+
* .on("event")
|
|
90
|
+
* .whenComplex(cb => cb.where("data.status", "EQ", "active").and(sub => sub.where("data.priority", "GT", 5)))
|
|
91
|
+
* .then("notify", { message: "Active and high priority!" })
|
|
92
|
+
* .else("log", { message: "Not active or low priority" })
|
|
93
|
+
*/
|
|
94
|
+
whenComplex(sub: (builder: ConditionBuilder) => ConditionBuilder): ConditionalActionBuilder;
|
|
95
|
+
/**
|
|
96
|
+
* Alias for do() - provided for compatibility with then/else syntax.
|
|
97
|
+
* Note: Using 'do' is recommended, 'then' is allowed for compatibility.
|
|
98
|
+
*/
|
|
99
|
+
then(type: string, params?: ActionParams, options?: {
|
|
100
|
+
delay?: number;
|
|
101
|
+
probability?: number;
|
|
102
|
+
}): this;
|
|
103
|
+
/**
|
|
104
|
+
* Add a condition to the last action in the rule.
|
|
105
|
+
* This allows for conditional action execution: if condition is true, execute then actions, else execute else actions.
|
|
106
|
+
* Use with then() and else() methods for full conditional support.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* builder
|
|
110
|
+
* .ifAction("data.status", "EQ", "active")
|
|
111
|
+
* .then("notify", { message: "Active!" })
|
|
112
|
+
* .else("notify", { message: "Not active" })
|
|
113
|
+
*/
|
|
114
|
+
ifAction(field: string, operator: ComparisonOperator, value?: ConditionValue): this;
|
|
115
|
+
/**
|
|
116
|
+
* Add a then clause (actions to run if condition is true) to the last action.
|
|
117
|
+
* This allows for conditional action execution: if condition is true, execute then actions.
|
|
118
|
+
* The previous action must have an 'if' condition for then to work properly.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* builder
|
|
122
|
+
* .do("checkStatus", { status: "active" })
|
|
123
|
+
* .ifAction("data.status", "EQ", "active")
|
|
124
|
+
* .thenAction("notify", { message: "Active!" })
|
|
125
|
+
* .elseAction("notify", { message: "Not active" })
|
|
126
|
+
*/
|
|
127
|
+
thenAction(action: Action | Action[] | ActionGroup): this;
|
|
128
|
+
/**
|
|
129
|
+
* Add an else clause to the last action in the rule.
|
|
130
|
+
* This allows for conditional action execution: if condition is false, execute else actions.
|
|
131
|
+
* The previous action must have an 'if' condition for else to work properly.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* builder
|
|
135
|
+
* .do("checkStatus", { status: "active" })
|
|
136
|
+
* .ifAction("data.status", "EQ", "active")
|
|
137
|
+
* .thenAction({ type: "notify", params: { message: "Active!" } })
|
|
138
|
+
* .elseAction({ type: "notify", params: { message: "Not active" } })
|
|
139
|
+
*/
|
|
140
|
+
else(action: Action | Action[] | ActionGroup): this;
|
|
141
|
+
/**
|
|
142
|
+
* Alias for else() - provided for consistency with thenAction().
|
|
143
|
+
*/
|
|
144
|
+
elseAction(action: Action | Action[] | ActionGroup): this;
|
|
145
|
+
/**
|
|
146
|
+
* Build the final TriggerRule.
|
|
147
|
+
*/
|
|
37
148
|
build(): TriggerRule;
|
|
38
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Builder for creating conditional actions with if/then/else flow.
|
|
152
|
+
* This class is used by RuleBuilder.when() and RuleBuilder.whenComplex() methods.
|
|
153
|
+
*/
|
|
154
|
+
export declare class ConditionalActionBuilder {
|
|
155
|
+
private parent;
|
|
156
|
+
private condition;
|
|
157
|
+
private thenActions;
|
|
158
|
+
private elseActions;
|
|
159
|
+
constructor(parent: RuleBuilder, fieldOrCondition: string | RuleCondition, operator?: ComparisonOperator, value?: ConditionValue);
|
|
160
|
+
/**
|
|
161
|
+
* Set the action(s) to execute when the condition is true.
|
|
162
|
+
* 'then' is an alias for 'do' - both can be used interchangeably.
|
|
163
|
+
*/
|
|
164
|
+
then(type: string, params?: ActionParams, options?: {
|
|
165
|
+
delay?: number;
|
|
166
|
+
probability?: number;
|
|
167
|
+
}): ConditionalActionBuilder;
|
|
168
|
+
then(actions: Action | Action[] | ActionGroup): ConditionalActionBuilder;
|
|
169
|
+
/**
|
|
170
|
+
* Alias for then() - 'do' can be used interchangeably with 'then'.
|
|
171
|
+
*/
|
|
172
|
+
do(type: string, params?: ActionParams, options?: {
|
|
173
|
+
delay?: number;
|
|
174
|
+
probability?: number;
|
|
175
|
+
}): ConditionalActionBuilder;
|
|
176
|
+
do(actions: Action | Action[] | ActionGroup): ConditionalActionBuilder;
|
|
177
|
+
/**
|
|
178
|
+
* Complete the conditional action and return to the RuleBuilder.
|
|
179
|
+
* Call this when you're done building the conditional action.
|
|
180
|
+
*/
|
|
181
|
+
done(): RuleBuilder;
|
|
182
|
+
/**
|
|
183
|
+
* Set the action(s) to execute when the condition is false.
|
|
184
|
+
*/
|
|
185
|
+
else(type: string, params?: ActionParams, options?: {
|
|
186
|
+
delay?: number;
|
|
187
|
+
probability?: number;
|
|
188
|
+
}): RuleBuilder;
|
|
189
|
+
else(actions: Action | Action[] | ActionGroup): RuleBuilder;
|
|
190
|
+
/**
|
|
191
|
+
* Build and add the conditional action to the parent RuleBuilder.
|
|
192
|
+
*/
|
|
193
|
+
build(): RuleBuilder;
|
|
194
|
+
}
|
|
39
195
|
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/sdk/builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/sdk/builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAGrF,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG5E,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAGxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAA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,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,WAAW,GAAG,wBAAwB;IAcxE;;OAEG;IACH,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,wBAAwB;IACrH,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,WAAW,GAAG,wBAAwB;IAStE;;;OAGG;IACH,IAAI,IAAI,WAAW;IAInB;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,WAAW;IAC1G,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,WAAW,GAAG,WAAW;IAc3D;;OAEG;IACH,KAAK,IAAI,WAAW;CAwBrB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ExecutionMode, Action, ActionGroup, ActionParams } from "../../types";
|
|
2
|
+
/**
|
|
3
|
+
* Builder for creating actions fluently.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ActionBuilder {
|
|
6
|
+
private actions;
|
|
7
|
+
private mode;
|
|
8
|
+
/**
|
|
9
|
+
* Set the execution mode for the action group.
|
|
10
|
+
*/
|
|
11
|
+
setMode(mode: ExecutionMode): this;
|
|
12
|
+
/**
|
|
13
|
+
* Add an action to the group.
|
|
14
|
+
*/
|
|
15
|
+
add(type: string, params?: ActionParams, options?: {
|
|
16
|
+
delay?: number;
|
|
17
|
+
probability?: number;
|
|
18
|
+
}): this;
|
|
19
|
+
/**
|
|
20
|
+
* Build the action, action array, or action group.
|
|
21
|
+
*/
|
|
22
|
+
build(): Action | Action[] | ActionGroup;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=action-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-builder.d.ts","sourceRoot":"","sources":["../../../src/sdk/builders/action-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEpF;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,IAAI,CAAwB;IAEpC;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAKlC;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IASlG;;OAEG;IACH,KAAK,IAAI,MAAM,GAAG,MAAM,EAAE,GAAG,WAAW;CAgBzC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ComparisonOperator, ConditionValue, RuleCondition } from "../../types";
|
|
2
|
+
/**
|
|
3
|
+
* Builder for creating conditions fluently.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ConditionBuilder {
|
|
6
|
+
private conditions;
|
|
7
|
+
private op;
|
|
8
|
+
constructor(operator?: 'AND' | 'OR');
|
|
9
|
+
/**
|
|
10
|
+
* Add a simple condition.
|
|
11
|
+
*/
|
|
12
|
+
where(field: string, operator: ComparisonOperator, value: ConditionValue): this;
|
|
13
|
+
/**
|
|
14
|
+
* Add a nested AND group.
|
|
15
|
+
*/
|
|
16
|
+
and(sub: (builder: ConditionBuilder) => ConditionBuilder): this;
|
|
17
|
+
/**
|
|
18
|
+
* Add a nested OR group.
|
|
19
|
+
*/
|
|
20
|
+
or(sub: (builder: ConditionBuilder) => ConditionBuilder): this;
|
|
21
|
+
/**
|
|
22
|
+
* Build the condition or condition group.
|
|
23
|
+
*/
|
|
24
|
+
build(): RuleCondition;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=condition-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"condition-builder.d.ts","sourceRoot":"","sources":["../../../src/sdk/builders/condition-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAA6B,aAAa,EAAE,MAAM,aAAa,CAAC;AAEhH;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,UAAU,CAAsC;IACxD,OAAO,CAAC,EAAE,CAAuB;gBAErB,QAAQ,GAAE,KAAK,GAAG,IAAY;IAI1C;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IAK/E;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,gBAAgB,GAAG,IAAI;IAM/D;;OAEG;IACH,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,gBAAgB,GAAG,IAAI;IAM9D;;OAEG;IACH,KAAK,IAAI,aAAa;CAavB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/builders/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ActionParams, ActionParamValue } from "../../types";
|
|
2
|
+
/**
|
|
3
|
+
* Fluent builder for constructing action parameters.
|
|
4
|
+
* Useful for building complex parameter objects in a readable way.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const params = new ParamsBuilder()
|
|
8
|
+
* .set("message", "Hello world")
|
|
9
|
+
* .set("count", 5)
|
|
10
|
+
* .set("items", [1, 2, 3])
|
|
11
|
+
* .set("nested", new ParamsBuilder().set("key", "value").build())
|
|
12
|
+
* .build();
|
|
13
|
+
*/
|
|
14
|
+
export declare class ParamsBuilder {
|
|
15
|
+
private params;
|
|
16
|
+
/**
|
|
17
|
+
* Set a parameter value.
|
|
18
|
+
*/
|
|
19
|
+
set<T extends ActionParamValue>(key: string, value: T): this;
|
|
20
|
+
/**
|
|
21
|
+
* Set multiple parameters at once.
|
|
22
|
+
*/
|
|
23
|
+
setAll(params: ActionParams): this;
|
|
24
|
+
/**
|
|
25
|
+
* Set a nested parameter using dot notation.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* paramsBuilder.setNested("user.profile.name", "John")
|
|
29
|
+
* // Results in: { user: { profile: { name: "John" } } }
|
|
30
|
+
*/
|
|
31
|
+
setNested(key: string, value: ActionParamValue): this;
|
|
32
|
+
/**
|
|
33
|
+
* Add an item to an array parameter.
|
|
34
|
+
* Creates the array if it doesn't exist.
|
|
35
|
+
*/
|
|
36
|
+
addItem(key: string, item: ActionParamValue): this;
|
|
37
|
+
/**
|
|
38
|
+
* Remove a parameter.
|
|
39
|
+
*/
|
|
40
|
+
remove(key: string): this;
|
|
41
|
+
/**
|
|
42
|
+
* Check if a parameter exists.
|
|
43
|
+
*/
|
|
44
|
+
has(key: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Get a parameter value.
|
|
47
|
+
*/
|
|
48
|
+
get(key: string): ActionParamValue | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Build the final params object.
|
|
51
|
+
*/
|
|
52
|
+
build(): ActionParams;
|
|
53
|
+
/**
|
|
54
|
+
* Get the raw params object (without copying).
|
|
55
|
+
* Use with caution.
|
|
56
|
+
*/
|
|
57
|
+
getRaw(): ActionParams;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=params-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"params-builder.d.ts","sourceRoot":"","sources":["../../../src/sdk/builders/params-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAElE;;;;;;;;;;;GAWG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAoB;IAElC;;OAEG;IACH,GAAG,CAAC,CAAC,SAAS,gBAAgB,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAK5D;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAKlC;;;;;;OAMG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAoBrD;;;OAGG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAQlD;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKzB;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAI9C;;OAEG;IACH,KAAK,IAAI,YAAY;IAIrB;;;OAGG;IACH,MAAM,IAAI,YAAY;CAGvB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Constants for handle IDs and node types
|
|
3
|
+
* These constants are shared between the SDK and the trigger-editor
|
|
4
|
+
*/
|
|
5
|
+
export declare const NodeType: {
|
|
6
|
+
readonly EVENT: "event";
|
|
7
|
+
readonly CONDITION: "condition";
|
|
8
|
+
readonly CONDITION_GROUP: "condition_group";
|
|
9
|
+
readonly ACTION: "action";
|
|
10
|
+
readonly ACTION_GROUP: "action_group";
|
|
11
|
+
readonly DO: "do";
|
|
12
|
+
};
|
|
13
|
+
export type NodeType = typeof NodeType[keyof typeof NodeType];
|
|
14
|
+
export declare const HandleId: {
|
|
15
|
+
readonly EVENT_OUTPUT: "event-output";
|
|
16
|
+
readonly CONDITION_INPUT: "condition-input";
|
|
17
|
+
readonly CONDITION_OUTPUT: "output";
|
|
18
|
+
readonly CONDITION_OUTPUT_LEGACY: "condition-output";
|
|
19
|
+
readonly THEN_OUTPUT: "then-output";
|
|
20
|
+
readonly ELSE_OUTPUT: "else-output";
|
|
21
|
+
readonly CONDITION_GROUP_INPUT: "input";
|
|
22
|
+
readonly CONDITION_GROUP_OUTPUT: "cond-output";
|
|
23
|
+
readonly ACTION_INPUT: "action-input";
|
|
24
|
+
readonly ACTION_OUTPUT: "action-output";
|
|
25
|
+
readonly ACTION_OUTPUT_LEGACY: "action-group-output";
|
|
26
|
+
readonly ACTION_GROUP_INPUT: "input";
|
|
27
|
+
readonly ACTION_GROUP_OUTPUT: "action-output";
|
|
28
|
+
readonly ACTION_GROUP_CONDITION_OUTPUT: "condition-output";
|
|
29
|
+
readonly DO_INPUT: "do-input";
|
|
30
|
+
readonly DO_OUTPUT: "do-output";
|
|
31
|
+
readonly DO_CONDITION_OUTPUT: "do-condition-output";
|
|
32
|
+
};
|
|
33
|
+
export type HandleId = typeof HandleId[keyof typeof HandleId];
|
|
34
|
+
export declare const BranchType: {
|
|
35
|
+
readonly DO: "do";
|
|
36
|
+
readonly ELSE: "else";
|
|
37
|
+
};
|
|
38
|
+
export type BranchType = typeof BranchType[keyof typeof BranchType];
|
|
39
|
+
export declare const ConditionOperator: {
|
|
40
|
+
readonly AND: "AND";
|
|
41
|
+
readonly OR: "OR";
|
|
42
|
+
};
|
|
43
|
+
export type ConditionOperator = typeof ConditionOperator[keyof typeof ConditionOperator];
|
|
44
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/sdk/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,eAAO,MAAM,QAAQ;;;;;;;CAOX,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAG9D,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;CA8BX,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAG9D,eAAO,MAAM,UAAU;;;CAGb,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAGpE,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC"}
|
package/dist/sdk/exporter.d.ts
CHANGED
|
@@ -4,6 +4,22 @@ export declare class RuleExporter {
|
|
|
4
4
|
* Converts a rule or array of rules to a YAML string.
|
|
5
5
|
*/
|
|
6
6
|
static toYaml(rules: TriggerRule | TriggerRule[]): string;
|
|
7
|
+
/**
|
|
8
|
+
* Converts a rule or array of rules to a JSON string.
|
|
9
|
+
*/
|
|
10
|
+
static toJson(rules: TriggerRule | TriggerRule[], pretty?: boolean): string;
|
|
11
|
+
/**
|
|
12
|
+
* Convert a single rule to a clean object (remove undefined/null)
|
|
13
|
+
*/
|
|
14
|
+
static cleanRule(rule: TriggerRule): Record<string, unknown>;
|
|
15
|
+
/**
|
|
16
|
+
* Convert rules to clean YAML (without undefined/null values)
|
|
17
|
+
*/
|
|
18
|
+
static toCleanYaml(rules: TriggerRule | TriggerRule[]): string;
|
|
19
|
+
/**
|
|
20
|
+
* Convert rules to clean JSON (without undefined/null values)
|
|
21
|
+
*/
|
|
22
|
+
static toCleanJson(rules: TriggerRule | TriggerRule[], pretty?: boolean): string;
|
|
7
23
|
/**
|
|
8
24
|
* For Node.js only: Saves a rule or array of rules to a file.
|
|
9
25
|
* This is part of the 'Server SDK' functionality.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../src/sdk/exporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C,qBAAa,YAAY;IACvB;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,EAAE,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../src/sdk/exporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C,qBAAa,YAAY;IACvB;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,EAAE,GAAG,MAAM;IAKzD;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,EAAE,EAAE,MAAM,UAAO,GAAG,MAAM;IAKxE;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IA6B5D;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,EAAE,GAAG,MAAM;IAS9D;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,EAAE,EAAE,MAAM,UAAO,GAAG,MAAM;IAM7E;;;OAGG;WACU,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAY7F"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action Resolver - Handles action collection and resolution
|
|
3
|
+
* Provides utilities for converting graph action nodes to Action/ActionGroup objects
|
|
4
|
+
*/
|
|
5
|
+
import type { SDKGraphNode, SDKGraphEdge, Action, ActionGroup, ExecutionMode, TriggerRule, RuleCondition } from '../../types';
|
|
6
|
+
/**
|
|
7
|
+
* Base context interface for graph resolution
|
|
8
|
+
*/
|
|
9
|
+
export interface GraphResolverContextBase {
|
|
10
|
+
nodes: SDKGraphNode[];
|
|
11
|
+
edges: SDKGraphEdge[];
|
|
12
|
+
options: {
|
|
13
|
+
isCondNode?: (node: SDKGraphNode) => boolean;
|
|
14
|
+
isActNode?: (node: SDKGraphNode) => boolean;
|
|
15
|
+
isEventNode?: (node: SDKGraphNode) => boolean;
|
|
16
|
+
extractEventData?: (node: SDKGraphNode) => Partial<TriggerRule>;
|
|
17
|
+
resolveCondition?: (id: string, ctx: any) => RuleCondition | null;
|
|
18
|
+
resolveAction?: (id: string, ctx: any) => Action | ActionGroup | null;
|
|
19
|
+
};
|
|
20
|
+
transformers?: {
|
|
21
|
+
condition?: (cond: RuleCondition, node: SDKGraphNode) => RuleCondition | null;
|
|
22
|
+
action?: (act: Action | ActionGroup, node: SDKGraphNode) => Action | ActionGroup | null;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Context for action resolution - compatible with GraphParserContext
|
|
27
|
+
*/
|
|
28
|
+
export interface ActionResolverContext extends GraphResolverContextBase {
|
|
29
|
+
visitedActs?: Set<string>;
|
|
30
|
+
visitedConds?: Set<string>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Options for action resolution
|
|
34
|
+
*/
|
|
35
|
+
export interface ActionResolverOptions {
|
|
36
|
+
/** Custom predicate for detecting action nodes */
|
|
37
|
+
isActNode?: (node: SDKGraphNode) => boolean;
|
|
38
|
+
/** Custom function to resolve an action from ID */
|
|
39
|
+
resolveAction?: (id: string, ctx: ActionResolverContext) => Action | ActionGroup | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Transformer for actions during resolution
|
|
43
|
+
*/
|
|
44
|
+
export interface ActionTransformer {
|
|
45
|
+
/** Transform an action after resolution */
|
|
46
|
+
action?: (act: Action | ActionGroup, node: SDKGraphNode) => Action | ActionGroup | null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Result of collecting actions for a group
|
|
50
|
+
*/
|
|
51
|
+
export interface CollectedActions {
|
|
52
|
+
actions: (Action | ActionGroup)[];
|
|
53
|
+
mode: ExecutionMode;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Collect all actions that belong to an action group (directly or via chaining).
|
|
57
|
+
* Returns the actions and the mode of the group.
|
|
58
|
+
*/
|
|
59
|
+
export declare function collectActionsForGroup(groupId: string, ctx: ActionResolverContext): CollectedActions;
|
|
60
|
+
/**
|
|
61
|
+
* Resolve an action from an action node ID
|
|
62
|
+
*/
|
|
63
|
+
export declare function resolveAction(id: string, ctx: ActionResolverContext): Action | ActionGroup | null;
|
|
64
|
+
/**
|
|
65
|
+
* Helper to collect all actions from a DO node
|
|
66
|
+
*/
|
|
67
|
+
export declare function collectActionsFromDoNode(doNodeId: string, ctx: ActionResolverContext): (Action | ActionGroup)[];
|
|
68
|
+
/**
|
|
69
|
+
* DO node category result
|
|
70
|
+
*/
|
|
71
|
+
export interface DoBranches {
|
|
72
|
+
doBranches: string[];
|
|
73
|
+
elseBranches: string[];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Categorize DO nodes by their branch type (do vs else)
|
|
77
|
+
*/
|
|
78
|
+
export declare function categorizeDoNodesByBranch(startConditionId: string, ctx: ActionResolverContext): DoBranches;
|
|
79
|
+
/**
|
|
80
|
+
* ActionResolver class - Fluent interface for action resolution
|
|
81
|
+
*/
|
|
82
|
+
export declare class ActionResolver {
|
|
83
|
+
private ctx;
|
|
84
|
+
private isAct;
|
|
85
|
+
constructor(nodes: SDKGraphNode[], edges: SDKGraphEdge[], visitedActs: Set<string>, options?: ActionResolverOptions, transformers?: ActionTransformer);
|
|
86
|
+
/** Get the resolution context */
|
|
87
|
+
getContext(): ActionResolverContext;
|
|
88
|
+
/** Check if a node is an action */
|
|
89
|
+
isAction(node: SDKGraphNode): boolean;
|
|
90
|
+
/** Check if a node is a DO node */
|
|
91
|
+
isDo(node: SDKGraphNode): boolean;
|
|
92
|
+
/** Resolve an action by ID */
|
|
93
|
+
resolve(id: string): Action | ActionGroup | null;
|
|
94
|
+
/** Collect actions for a group */
|
|
95
|
+
collectForGroup(groupId: string): CollectedActions;
|
|
96
|
+
/** Categorize DO nodes by branch type */
|
|
97
|
+
categorizeDoNodes(conditionId: string): DoBranches;
|
|
98
|
+
/** Create a new resolver with additional options */
|
|
99
|
+
withOptions(options: Partial<ActionResolverOptions>): ActionResolver;
|
|
100
|
+
/** Create a new resolver with transformers */
|
|
101
|
+
withTransformers(transformers: ActionTransformer): ActionResolver;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=action-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-resolver.d.ts","sourceRoot":"","sources":["../../../src/sdk/graph/action-resolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACd,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,OAAO,EAAE;QACP,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;QAC7C,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK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