@nexusclawhq/cli 0.3.73 → 0.3.74
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/CHANGELOG.md +6 -0
- package/dist/build-info.json +4 -4
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/en-US.d.ts +59 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/en-US.js +57 -2
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/en-US.js.map +1 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/index.d.ts +118 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/zh-CN.d.ts +59 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/zh-CN.js +57 -2
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/zh-CN.js.map +1 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/actions.d.ts +22 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/actions.js +156 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/actions.js.map +1 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/duplicate.d.ts +20 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/duplicate.js +39 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/duplicate.js.map +1 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/fieldPolicy.d.ts +38 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/fieldPolicy.js +193 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/fieldPolicy.js.map +1 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/icons.d.ts +1 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/icons.js +196 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/icons.js.map +1 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/identity.d.ts +11 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/identity.js +29 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/identity.js.map +1 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/index.d.ts +9 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/index.js +26 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/index.js.map +1 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/recordTypeSemantics.d.ts +23 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/recordTypeSemantics.js +78 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/recordTypeSemantics.js.map +1 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/recordTypes.d.ts +24 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/recordTypes.js +24 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/recordTypes.js.map +1 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/sharing.d.ts +13 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/sharing.js +26 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/sharing.js.map +1 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/visibility.d.ts +211 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/visibility.js +411 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/record-home/visibility.js.map +1 -0
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/package.json +4 -0
- package/dist/nexus-cli/src/commands/data/query.d.ts +5 -0
- package/dist/nexus-cli/src/commands/data/query.js +12 -6
- package/dist/nexus-cli/src/commands/data/query.js.map +1 -1
- package/dist/nexus-cli/src/commands/data/query.test.js +33 -0
- package/dist/nexus-cli/src/commands/data/query.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/source/status.d.ts +7 -0
- package/dist/nexus-cli/src/commands/source/status.js +26 -1
- package/dist/nexus-cli/src/commands/source/status.js.map +1 -1
- package/dist/nexus-cli/src/commands/source/status.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/source/status.test.js +55 -0
- package/dist/nexus-cli/src/commands/source/status.test.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-test-remote.d.ts +1 -1
- package/dist/nexus-cli/src/services/workforce-test-remote.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visibility Engine
|
|
3
|
+
* 可见性引擎 - 控制组件的条件渲染
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* 负责评估可见性条件,决定组件是否应该被渲染。
|
|
7
|
+
* 支持 AND/OR 操作符组合规则、嵌套条件和设备级可见性控制。
|
|
8
|
+
*
|
|
9
|
+
* @requirements
|
|
10
|
+
* - 4.5 THE System SHALL 支持条件渲染(visibility 规则)
|
|
11
|
+
* - 5.3 THE Renderer SHALL 根据 visibility 规则条件渲染组件
|
|
12
|
+
*/
|
|
13
|
+
export type DeviceType = 'mobile' | 'tablet' | 'desktop';
|
|
14
|
+
export interface VisibilityCondition {
|
|
15
|
+
condition: string;
|
|
16
|
+
operator?: 'and' | 'or';
|
|
17
|
+
rules?: VisibilityCondition[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Evaluation context for visibility conditions
|
|
21
|
+
*/
|
|
22
|
+
export interface VisibilityContext {
|
|
23
|
+
/** Data sources for condition evaluation */
|
|
24
|
+
data: Record<string, unknown>;
|
|
25
|
+
/** Current device type for responsive visibility */
|
|
26
|
+
currentDevice?: DeviceType;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* VisibilityEngine class
|
|
30
|
+
* Handles visibility condition evaluation for conditional rendering
|
|
31
|
+
*/
|
|
32
|
+
export declare class VisibilityEngine {
|
|
33
|
+
private context;
|
|
34
|
+
/**
|
|
35
|
+
* Create a new VisibilityEngine instance
|
|
36
|
+
*
|
|
37
|
+
* @param context - Visibility evaluation context
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* const engine = new VisibilityEngine({
|
|
41
|
+
* data: {
|
|
42
|
+
* record: { status: 'active', role: 'admin' },
|
|
43
|
+
* user: { permissions: ['read', 'write'] },
|
|
44
|
+
* },
|
|
45
|
+
* currentDevice: 'desktop',
|
|
46
|
+
* });
|
|
47
|
+
*/
|
|
48
|
+
constructor(context: VisibilityContext);
|
|
49
|
+
/**
|
|
50
|
+
* Evaluate a visibility condition
|
|
51
|
+
* Returns true if the component should be visible
|
|
52
|
+
*
|
|
53
|
+
* @param condition - Visibility condition to evaluate
|
|
54
|
+
* @returns Boolean indicating if component should be rendered
|
|
55
|
+
*
|
|
56
|
+
* @requirements
|
|
57
|
+
* - 4.5 支持条件渲染(visibility 规则)
|
|
58
|
+
* - 5.3 根据 visibility 规则条件渲染组件
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // Simple condition
|
|
62
|
+
* engine.evaluate({ condition: 'record.status === "active"' });
|
|
63
|
+
*
|
|
64
|
+
* // Combined conditions with AND
|
|
65
|
+
* engine.evaluate({
|
|
66
|
+
* operator: 'and',
|
|
67
|
+
* rules: [
|
|
68
|
+
* { condition: 'record.status === "active"' },
|
|
69
|
+
* { condition: 'user.role === "admin"' },
|
|
70
|
+
* ],
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* // Nested conditions
|
|
74
|
+
* engine.evaluate({
|
|
75
|
+
* operator: 'or',
|
|
76
|
+
* rules: [
|
|
77
|
+
* { condition: 'record.type === "premium"' },
|
|
78
|
+
* {
|
|
79
|
+
* operator: 'and',
|
|
80
|
+
* rules: [
|
|
81
|
+
* { condition: 'record.type === "standard"' },
|
|
82
|
+
* { condition: 'record.verified === true' },
|
|
83
|
+
* ],
|
|
84
|
+
* },
|
|
85
|
+
* ],
|
|
86
|
+
* });
|
|
87
|
+
*/
|
|
88
|
+
evaluate(condition: VisibilityCondition | undefined): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Evaluate multiple rules with AND/OR operator
|
|
91
|
+
*
|
|
92
|
+
* @param rules - Array of visibility conditions
|
|
93
|
+
* @param operator - Logical operator ('and' or 'or')
|
|
94
|
+
* @returns Combined boolean result
|
|
95
|
+
*/
|
|
96
|
+
private evaluateRules;
|
|
97
|
+
/**
|
|
98
|
+
* Evaluate a single condition expression safely.
|
|
99
|
+
* Uses a restricted token-based evaluator instead of `new Function()` to prevent XSS.
|
|
100
|
+
*
|
|
101
|
+
* Supported syntax:
|
|
102
|
+
* - Dot-path access: `record.status`, `user.role`
|
|
103
|
+
* - Comparison: `===`, `!==`, `==`, `!=`, `>`, `>=`, `<`, `<=`
|
|
104
|
+
* - Literals: strings (single/double quoted), numbers, booleans, null, undefined
|
|
105
|
+
* - Logical: `&&`, `||`, `!`
|
|
106
|
+
* - Array includes: `record.tags.includes("vip")`
|
|
107
|
+
*
|
|
108
|
+
* @param expression - Condition expression string
|
|
109
|
+
* @returns Boolean result of the expression
|
|
110
|
+
*/
|
|
111
|
+
private evaluateExpression;
|
|
112
|
+
/**
|
|
113
|
+
* Resolve a dot-path (e.g. "record.status") against the data context.
|
|
114
|
+
*/
|
|
115
|
+
private resolvePath;
|
|
116
|
+
/**
|
|
117
|
+
* Parse a literal value from a token string.
|
|
118
|
+
*/
|
|
119
|
+
private parseLiteral;
|
|
120
|
+
/**
|
|
121
|
+
* Safe expression evaluator — handles simple comparisons, logical operators,
|
|
122
|
+
* and `.includes()` calls without using `new Function()` or `eval()`.
|
|
123
|
+
*/
|
|
124
|
+
private safeEvaluate;
|
|
125
|
+
/**
|
|
126
|
+
* Split an expression on a top-level operator, respecting parentheses and quotes.
|
|
127
|
+
*/
|
|
128
|
+
private splitTopLevel;
|
|
129
|
+
/**
|
|
130
|
+
* Check device-specific visibility
|
|
131
|
+
* Returns true if the component should be visible on the current device
|
|
132
|
+
*
|
|
133
|
+
* @param responsiveVisibility - Device visibility map
|
|
134
|
+
* @returns Boolean indicating if component should be visible on current device
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* // Hide on mobile
|
|
138
|
+
* engine.checkDeviceVisibility({ mobile: false, tablet: true, desktop: true });
|
|
139
|
+
*
|
|
140
|
+
* // Show only on desktop
|
|
141
|
+
* engine.checkDeviceVisibility({ mobile: false, tablet: false, desktop: true });
|
|
142
|
+
*/
|
|
143
|
+
checkDeviceVisibility(responsiveVisibility: Record<DeviceType, boolean> | undefined): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Check if a component should be rendered
|
|
146
|
+
* Combines both condition-based and device-based visibility
|
|
147
|
+
*
|
|
148
|
+
* @param condition - Visibility condition
|
|
149
|
+
* @param responsiveVisibility - Device visibility map
|
|
150
|
+
* @returns Boolean indicating if component should be rendered
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* const shouldRender = engine.shouldRender(
|
|
154
|
+
* { condition: 'record.status === "active"' },
|
|
155
|
+
* { mobile: false, tablet: true, desktop: true }
|
|
156
|
+
* );
|
|
157
|
+
*/
|
|
158
|
+
shouldRender(condition: VisibilityCondition | undefined, responsiveVisibility: Record<DeviceType, boolean> | undefined): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Update the evaluation context
|
|
161
|
+
*
|
|
162
|
+
* @param context - New or partial context to merge
|
|
163
|
+
*/
|
|
164
|
+
updateContext(context: Partial<VisibilityContext>): void;
|
|
165
|
+
/**
|
|
166
|
+
* Set the current device type
|
|
167
|
+
*
|
|
168
|
+
* @param device - Device type
|
|
169
|
+
*/
|
|
170
|
+
setCurrentDevice(device: DeviceType): void;
|
|
171
|
+
/**
|
|
172
|
+
* Get the current device type
|
|
173
|
+
*
|
|
174
|
+
* @returns Current device type or undefined
|
|
175
|
+
*/
|
|
176
|
+
getCurrentDevice(): DeviceType | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* Get the current data context
|
|
179
|
+
*
|
|
180
|
+
* @returns Current data object
|
|
181
|
+
*/
|
|
182
|
+
getData(): Record<string, unknown>;
|
|
183
|
+
/**
|
|
184
|
+
* Create a child engine with additional context
|
|
185
|
+
* Useful for nested components that need additional data
|
|
186
|
+
*
|
|
187
|
+
* @param additionalData - Additional data to merge into context
|
|
188
|
+
* @returns New VisibilityEngine instance with merged context
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* const childEngine = engine.createChildEngine({
|
|
192
|
+
* item: { id: 1, name: 'Item 1' },
|
|
193
|
+
* });
|
|
194
|
+
*/
|
|
195
|
+
createChildEngine(additionalData: Record<string, unknown>): VisibilityEngine;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Create a VisibilityEngine instance with the given context
|
|
199
|
+
* Factory function for convenience
|
|
200
|
+
*
|
|
201
|
+
* @param context - Visibility evaluation context
|
|
202
|
+
* @returns New VisibilityEngine instance
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* const engine = createVisibilityEngine({
|
|
206
|
+
* data: { record: { status: 'active' } },
|
|
207
|
+
* currentDevice: 'desktop',
|
|
208
|
+
* });
|
|
209
|
+
*/
|
|
210
|
+
export declare function createVisibilityEngine(context: VisibilityContext): VisibilityEngine;
|
|
211
|
+
export default VisibilityEngine;
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Visibility Engine
|
|
4
|
+
* 可见性引擎 - 控制组件的条件渲染
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* 负责评估可见性条件,决定组件是否应该被渲染。
|
|
8
|
+
* 支持 AND/OR 操作符组合规则、嵌套条件和设备级可见性控制。
|
|
9
|
+
*
|
|
10
|
+
* @requirements
|
|
11
|
+
* - 4.5 THE System SHALL 支持条件渲染(visibility 规则)
|
|
12
|
+
* - 5.3 THE Renderer SHALL 根据 visibility 规则条件渲染组件
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.VisibilityEngine = void 0;
|
|
16
|
+
exports.createVisibilityEngine = createVisibilityEngine;
|
|
17
|
+
/**
|
|
18
|
+
* VisibilityEngine class
|
|
19
|
+
* Handles visibility condition evaluation for conditional rendering
|
|
20
|
+
*/
|
|
21
|
+
class VisibilityEngine {
|
|
22
|
+
/**
|
|
23
|
+
* Create a new VisibilityEngine instance
|
|
24
|
+
*
|
|
25
|
+
* @param context - Visibility evaluation context
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* const engine = new VisibilityEngine({
|
|
29
|
+
* data: {
|
|
30
|
+
* record: { status: 'active', role: 'admin' },
|
|
31
|
+
* user: { permissions: ['read', 'write'] },
|
|
32
|
+
* },
|
|
33
|
+
* currentDevice: 'desktop',
|
|
34
|
+
* });
|
|
35
|
+
*/
|
|
36
|
+
constructor(context) {
|
|
37
|
+
this.context = context;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Evaluate a visibility condition
|
|
41
|
+
* Returns true if the component should be visible
|
|
42
|
+
*
|
|
43
|
+
* @param condition - Visibility condition to evaluate
|
|
44
|
+
* @returns Boolean indicating if component should be rendered
|
|
45
|
+
*
|
|
46
|
+
* @requirements
|
|
47
|
+
* - 4.5 支持条件渲染(visibility 规则)
|
|
48
|
+
* - 5.3 根据 visibility 规则条件渲染组件
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* // Simple condition
|
|
52
|
+
* engine.evaluate({ condition: 'record.status === "active"' });
|
|
53
|
+
*
|
|
54
|
+
* // Combined conditions with AND
|
|
55
|
+
* engine.evaluate({
|
|
56
|
+
* operator: 'and',
|
|
57
|
+
* rules: [
|
|
58
|
+
* { condition: 'record.status === "active"' },
|
|
59
|
+
* { condition: 'user.role === "admin"' },
|
|
60
|
+
* ],
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
63
|
+
* // Nested conditions
|
|
64
|
+
* engine.evaluate({
|
|
65
|
+
* operator: 'or',
|
|
66
|
+
* rules: [
|
|
67
|
+
* { condition: 'record.type === "premium"' },
|
|
68
|
+
* {
|
|
69
|
+
* operator: 'and',
|
|
70
|
+
* rules: [
|
|
71
|
+
* { condition: 'record.type === "standard"' },
|
|
72
|
+
* { condition: 'record.verified === true' },
|
|
73
|
+
* ],
|
|
74
|
+
* },
|
|
75
|
+
* ],
|
|
76
|
+
* });
|
|
77
|
+
*/
|
|
78
|
+
evaluate(condition) {
|
|
79
|
+
// No condition means always visible
|
|
80
|
+
if (!condition) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
// If there are nested rules, evaluate them with the operator
|
|
84
|
+
if (condition.rules && condition.rules.length > 0) {
|
|
85
|
+
return this.evaluateRules(condition.rules, condition.operator || 'and');
|
|
86
|
+
}
|
|
87
|
+
// Evaluate the single condition expression
|
|
88
|
+
if (condition.condition) {
|
|
89
|
+
return this.evaluateExpression(condition.condition);
|
|
90
|
+
}
|
|
91
|
+
// Default to visible if no valid condition
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Evaluate multiple rules with AND/OR operator
|
|
96
|
+
*
|
|
97
|
+
* @param rules - Array of visibility conditions
|
|
98
|
+
* @param operator - Logical operator ('and' or 'or')
|
|
99
|
+
* @returns Combined boolean result
|
|
100
|
+
*/
|
|
101
|
+
evaluateRules(rules, operator) {
|
|
102
|
+
if (rules.length === 0) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
if (operator === 'and') {
|
|
106
|
+
// All rules must be true
|
|
107
|
+
return rules.every((rule) => this.evaluate(rule));
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
// At least one rule must be true
|
|
111
|
+
return rules.some((rule) => this.evaluate(rule));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Evaluate a single condition expression safely.
|
|
116
|
+
* Uses a restricted token-based evaluator instead of `new Function()` to prevent XSS.
|
|
117
|
+
*
|
|
118
|
+
* Supported syntax:
|
|
119
|
+
* - Dot-path access: `record.status`, `user.role`
|
|
120
|
+
* - Comparison: `===`, `!==`, `==`, `!=`, `>`, `>=`, `<`, `<=`
|
|
121
|
+
* - Literals: strings (single/double quoted), numbers, booleans, null, undefined
|
|
122
|
+
* - Logical: `&&`, `||`, `!`
|
|
123
|
+
* - Array includes: `record.tags.includes("vip")`
|
|
124
|
+
*
|
|
125
|
+
* @param expression - Condition expression string
|
|
126
|
+
* @returns Boolean result of the expression
|
|
127
|
+
*/
|
|
128
|
+
evaluateExpression(expression) {
|
|
129
|
+
if (!expression || expression.trim() === '') {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
return this.safeEvaluate(expression.trim());
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
console.warn(`[VisibilityEngine] Failed to evaluate expression: "${expression}"`, error);
|
|
137
|
+
// Default to visible on error to avoid hiding content unexpectedly
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Resolve a dot-path (e.g. "record.status") against the data context.
|
|
143
|
+
*/
|
|
144
|
+
resolvePath(path) {
|
|
145
|
+
const parts = path.split('.');
|
|
146
|
+
let current = this.context.data;
|
|
147
|
+
for (const part of parts) {
|
|
148
|
+
if (current === null || current === undefined)
|
|
149
|
+
return undefined;
|
|
150
|
+
if (typeof current !== 'object')
|
|
151
|
+
return undefined;
|
|
152
|
+
current = current[part];
|
|
153
|
+
}
|
|
154
|
+
return current;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Parse a literal value from a token string.
|
|
158
|
+
*/
|
|
159
|
+
parseLiteral(token) {
|
|
160
|
+
if (token === 'true')
|
|
161
|
+
return true;
|
|
162
|
+
if (token === 'false')
|
|
163
|
+
return false;
|
|
164
|
+
if (token === 'null')
|
|
165
|
+
return null;
|
|
166
|
+
if (token === 'undefined')
|
|
167
|
+
return undefined;
|
|
168
|
+
// Quoted string
|
|
169
|
+
if ((token.startsWith('"') && token.endsWith('"')) ||
|
|
170
|
+
(token.startsWith("'") && token.endsWith("'"))) {
|
|
171
|
+
return token.slice(1, -1);
|
|
172
|
+
}
|
|
173
|
+
// Number
|
|
174
|
+
const num = Number(token);
|
|
175
|
+
if (!isNaN(num) && token.trim() !== '')
|
|
176
|
+
return num;
|
|
177
|
+
// Treat as a data path
|
|
178
|
+
return this.resolvePath(token);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Safe expression evaluator — handles simple comparisons, logical operators,
|
|
182
|
+
* and `.includes()` calls without using `new Function()` or `eval()`.
|
|
183
|
+
*/
|
|
184
|
+
safeEvaluate(expr) {
|
|
185
|
+
// Handle logical NOT
|
|
186
|
+
if (expr.startsWith('!') && !expr.startsWith('!=')) {
|
|
187
|
+
const inner = expr.slice(1).trim();
|
|
188
|
+
// Remove wrapping parens if present
|
|
189
|
+
const unwrapped = inner.startsWith('(') && inner.endsWith(')')
|
|
190
|
+
? inner.slice(1, -1).trim()
|
|
191
|
+
: inner;
|
|
192
|
+
return !this.safeEvaluate(unwrapped);
|
|
193
|
+
}
|
|
194
|
+
// Handle logical OR (lowest precedence) — split on top-level ||
|
|
195
|
+
const orParts = this.splitTopLevel(expr, '||');
|
|
196
|
+
if (orParts.length > 1) {
|
|
197
|
+
return orParts.some((part) => this.safeEvaluate(part.trim()));
|
|
198
|
+
}
|
|
199
|
+
// Handle logical AND
|
|
200
|
+
const andParts = this.splitTopLevel(expr, '&&');
|
|
201
|
+
if (andParts.length > 1) {
|
|
202
|
+
return andParts.every((part) => this.safeEvaluate(part.trim()));
|
|
203
|
+
}
|
|
204
|
+
// Handle parenthesized expression
|
|
205
|
+
if (expr.startsWith('(') && expr.endsWith(')')) {
|
|
206
|
+
return this.safeEvaluate(expr.slice(1, -1).trim());
|
|
207
|
+
}
|
|
208
|
+
// Handle .includes() call: `path.includes(value)`
|
|
209
|
+
const includesMatch = expr.match(/^(.+)\.includes\(\s*(.+?)\s*\)$/);
|
|
210
|
+
if (includesMatch) {
|
|
211
|
+
const targetExpr = includesMatch[1];
|
|
212
|
+
const searchExpr = includesMatch[2];
|
|
213
|
+
if (!targetExpr || !searchExpr) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
const target = this.resolvePath(targetExpr.trim());
|
|
217
|
+
const searchValue = this.parseLiteral(searchExpr.trim());
|
|
218
|
+
if (Array.isArray(target)) {
|
|
219
|
+
return target.includes(searchValue);
|
|
220
|
+
}
|
|
221
|
+
if (typeof target === 'string' && typeof searchValue === 'string') {
|
|
222
|
+
return target.includes(searchValue);
|
|
223
|
+
}
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
// Handle comparison operators
|
|
227
|
+
const comparisonOps = ['===', '!==', '==', '!=', '>=', '<=', '>', '<'];
|
|
228
|
+
for (const op of comparisonOps) {
|
|
229
|
+
const idx = expr.indexOf(op);
|
|
230
|
+
if (idx !== -1) {
|
|
231
|
+
const left = this.parseLiteral(expr.slice(0, idx).trim());
|
|
232
|
+
const right = this.parseLiteral(expr.slice(idx + op.length).trim());
|
|
233
|
+
switch (op) {
|
|
234
|
+
case '===': return left === right;
|
|
235
|
+
case '!==': return left !== right;
|
|
236
|
+
case '==': return left == right;
|
|
237
|
+
case '!=': return left != right;
|
|
238
|
+
case '>': return Number(left) > Number(right);
|
|
239
|
+
case '>=': return Number(left) >= Number(right);
|
|
240
|
+
case '<': return Number(left) < Number(right);
|
|
241
|
+
case '<=': return Number(left) <= Number(right);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// Bare truthy check: just a path reference
|
|
246
|
+
return Boolean(this.parseLiteral(expr));
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Split an expression on a top-level operator, respecting parentheses and quotes.
|
|
250
|
+
*/
|
|
251
|
+
splitTopLevel(expr, operator) {
|
|
252
|
+
const parts = [];
|
|
253
|
+
let depth = 0;
|
|
254
|
+
let inSingle = false;
|
|
255
|
+
let inDouble = false;
|
|
256
|
+
let start = 0;
|
|
257
|
+
for (let i = 0; i < expr.length; i++) {
|
|
258
|
+
const ch = expr[i];
|
|
259
|
+
if (ch === "'" && !inDouble)
|
|
260
|
+
inSingle = !inSingle;
|
|
261
|
+
else if (ch === '"' && !inSingle)
|
|
262
|
+
inDouble = !inDouble;
|
|
263
|
+
else if (!inSingle && !inDouble) {
|
|
264
|
+
if (ch === '(')
|
|
265
|
+
depth++;
|
|
266
|
+
else if (ch === ')')
|
|
267
|
+
depth--;
|
|
268
|
+
else if (depth === 0 &&
|
|
269
|
+
expr.slice(i, i + operator.length) === operator) {
|
|
270
|
+
parts.push(expr.slice(start, i));
|
|
271
|
+
i += operator.length - 1;
|
|
272
|
+
start = i + 1;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
parts.push(expr.slice(start));
|
|
277
|
+
return parts;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Check device-specific visibility
|
|
281
|
+
* Returns true if the component should be visible on the current device
|
|
282
|
+
*
|
|
283
|
+
* @param responsiveVisibility - Device visibility map
|
|
284
|
+
* @returns Boolean indicating if component should be visible on current device
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* // Hide on mobile
|
|
288
|
+
* engine.checkDeviceVisibility({ mobile: false, tablet: true, desktop: true });
|
|
289
|
+
*
|
|
290
|
+
* // Show only on desktop
|
|
291
|
+
* engine.checkDeviceVisibility({ mobile: false, tablet: false, desktop: true });
|
|
292
|
+
*/
|
|
293
|
+
checkDeviceVisibility(responsiveVisibility) {
|
|
294
|
+
// No responsive visibility config means visible on all devices
|
|
295
|
+
if (!responsiveVisibility) {
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
// No current device set means visible
|
|
299
|
+
if (!this.context.currentDevice) {
|
|
300
|
+
return true;
|
|
301
|
+
}
|
|
302
|
+
// Check if explicitly set to false for current device
|
|
303
|
+
const visibility = responsiveVisibility[this.context.currentDevice];
|
|
304
|
+
// If not explicitly set, default to visible
|
|
305
|
+
if (visibility === undefined) {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
return visibility;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Check if a component should be rendered
|
|
312
|
+
* Combines both condition-based and device-based visibility
|
|
313
|
+
*
|
|
314
|
+
* @param condition - Visibility condition
|
|
315
|
+
* @param responsiveVisibility - Device visibility map
|
|
316
|
+
* @returns Boolean indicating if component should be rendered
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* const shouldRender = engine.shouldRender(
|
|
320
|
+
* { condition: 'record.status === "active"' },
|
|
321
|
+
* { mobile: false, tablet: true, desktop: true }
|
|
322
|
+
* );
|
|
323
|
+
*/
|
|
324
|
+
shouldRender(condition, responsiveVisibility) {
|
|
325
|
+
// Check device visibility first (faster check)
|
|
326
|
+
if (!this.checkDeviceVisibility(responsiveVisibility)) {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
// Then check condition-based visibility
|
|
330
|
+
return this.evaluate(condition);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Update the evaluation context
|
|
334
|
+
*
|
|
335
|
+
* @param context - New or partial context to merge
|
|
336
|
+
*/
|
|
337
|
+
updateContext(context) {
|
|
338
|
+
this.context = {
|
|
339
|
+
...this.context,
|
|
340
|
+
...context,
|
|
341
|
+
data: {
|
|
342
|
+
...this.context.data,
|
|
343
|
+
...(context.data || {}),
|
|
344
|
+
},
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Set the current device type
|
|
349
|
+
*
|
|
350
|
+
* @param device - Device type
|
|
351
|
+
*/
|
|
352
|
+
setCurrentDevice(device) {
|
|
353
|
+
this.context.currentDevice = device;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Get the current device type
|
|
357
|
+
*
|
|
358
|
+
* @returns Current device type or undefined
|
|
359
|
+
*/
|
|
360
|
+
getCurrentDevice() {
|
|
361
|
+
return this.context.currentDevice;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Get the current data context
|
|
365
|
+
*
|
|
366
|
+
* @returns Current data object
|
|
367
|
+
*/
|
|
368
|
+
getData() {
|
|
369
|
+
return this.context.data;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Create a child engine with additional context
|
|
373
|
+
* Useful for nested components that need additional data
|
|
374
|
+
*
|
|
375
|
+
* @param additionalData - Additional data to merge into context
|
|
376
|
+
* @returns New VisibilityEngine instance with merged context
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* const childEngine = engine.createChildEngine({
|
|
380
|
+
* item: { id: 1, name: 'Item 1' },
|
|
381
|
+
* });
|
|
382
|
+
*/
|
|
383
|
+
createChildEngine(additionalData) {
|
|
384
|
+
return new VisibilityEngine({
|
|
385
|
+
...this.context,
|
|
386
|
+
data: {
|
|
387
|
+
...this.context.data,
|
|
388
|
+
...additionalData,
|
|
389
|
+
},
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
exports.VisibilityEngine = VisibilityEngine;
|
|
394
|
+
/**
|
|
395
|
+
* Create a VisibilityEngine instance with the given context
|
|
396
|
+
* Factory function for convenience
|
|
397
|
+
*
|
|
398
|
+
* @param context - Visibility evaluation context
|
|
399
|
+
* @returns New VisibilityEngine instance
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* const engine = createVisibilityEngine({
|
|
403
|
+
* data: { record: { status: 'active' } },
|
|
404
|
+
* currentDevice: 'desktop',
|
|
405
|
+
* });
|
|
406
|
+
*/
|
|
407
|
+
function createVisibilityEngine(context) {
|
|
408
|
+
return new VisibilityEngine(context);
|
|
409
|
+
}
|
|
410
|
+
exports.default = VisibilityEngine;
|
|
411
|
+
//# sourceMappingURL=visibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility.js","sourceRoot":"","sources":["../../src/record-home/visibility.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAkcH,wDAIC;AAvbD;;;GAGG;AACH,MAAa,gBAAgB;IAG3B;;;;;;;;;;;;;OAaG;IACH,YAAY,OAA0B;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,QAAQ,CAAC,SAA0C;QACjD,oCAAoC;QACpC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACd,CAAC;QAED,6DAA6D;QAC7D,IAAI,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClD,OAAO,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,QAAQ,IAAI,KAAK,CAAC,CAAC;QAC1E,CAAC;QAED,2CAA2C;QAC3C,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACtD,CAAC;QAED,2CAA2C;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACK,aAAa,CACnB,KAA4B,EAC5B,QAAsB;QAEtB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;YACvB,yBAAyB;YACzB,OAAO,KAAK,CAAC,KAAK,CAAC,CAA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AC;QAED,wCAAwC;QACxC,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,aAAa,CAAC,OAAmC;QAC/C,IAAI,CAAC,OAAO,GAAG;YACb,GAAG,IAAI,CAAC,OAAO;YACf,GAAG,OAAO;YACV,IAAI,EAAE;gBACJ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI;gBACpB,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;aACxB;SACF,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,gBAAgB,CAAC,MAAkB;QACjC,IAAI,CAAC,OAAO,CAAC,aAAa,GAAG,MAAM,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED;;;;;;;;;;;OAWG;IACH,iBAAiB,CAAC,cAAuC;QACvD,OAAO,IAAI,gBAAgB,CAAC;YAC1B,GAAG,IAAI,CAAC,OAAO;YACf,IAAI,EAAE;gBACJ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI;gBACpB,GAAG,cAAc;aAClB;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAhaD,4CAgaC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,sBAAsB,CACpC,OAA0B;IAE1B,OAAO,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC;AAED,kBAAe,gBAAgB,CAAC"}
|
|
@@ -58,6 +58,10 @@
|
|
|
58
58
|
"./agent-avatars/presets": {
|
|
59
59
|
"types": "./dist/agent-avatars/presets.d.ts",
|
|
60
60
|
"default": "./dist/agent-avatars/presets.js"
|
|
61
|
+
},
|
|
62
|
+
"./record-home": {
|
|
63
|
+
"types": "./dist/record-home/index.d.ts",
|
|
64
|
+
"default": "./dist/record-home/index.js"
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
}
|
|
@@ -13,6 +13,11 @@ export interface ProjectionResult {
|
|
|
13
13
|
unknownFields: string[];
|
|
14
14
|
}
|
|
15
15
|
export declare function projectRecordFields(node: Record<string, unknown>, fields: string[]): ProjectionResult;
|
|
16
|
+
export declare function projectRecordCollection(nodes: Record<string, unknown>[], fields: string[]): {
|
|
17
|
+
records: Record<string, unknown>[];
|
|
18
|
+
availableFields: string[];
|
|
19
|
+
unknownFields: string[];
|
|
20
|
+
};
|
|
16
21
|
export declare function parseDataQuery(soql: string): ParsedDataQuery;
|
|
17
22
|
export declare function parseWhereClause(clause: string): Record<string, Record<string, unknown>>;
|
|
18
23
|
export declare const queryCommand: Command;
|