@memberjunction/global 3.2.0 → 3.3.0

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.
@@ -0,0 +1,125 @@
1
+ /**
2
+ * @fileoverview Unified SQL Expression Validation
3
+ *
4
+ * Central utility for validating user-provided SQL expressions against injection attacks.
5
+ * Used by RunView, aggregates, smart filters, and any other feature accepting SQL input.
6
+ *
7
+ * Located in MJGlobal (lowest-level package) so all packages can use it.
8
+ *
9
+ * @module @memberjunction/global/SQLExpressionValidator
10
+ */
11
+ /**
12
+ * Dangerous SQL keywords that are never allowed in user-provided expressions
13
+ */
14
+ export declare const DANGEROUS_SQL_KEYWORDS: readonly ["DROP", "CREATE", "ALTER", "TRUNCATE", "RENAME", "INSERT", "UPDATE", "DELETE", "MERGE", "REPLACE", "GRANT", "REVOKE", "DENY", "EXEC", "EXECUTE", "CALL", "PROCEDURE", "FUNCTION", "BEGIN", "COMMIT", "ROLLBACK", "SAVEPOINT", "USE", "DATABASE", "SCHEMA", "IF", "WHILE", "LOOP", "FOR", "GOTO", "UNION", "INTERSECT", "EXCEPT", "EXISTS", "ANY", "ALL", "SOME", "BULK", "OPENROWSET", "OPENDATASOURCE", "OPENQUERY", "XP_", "SP_", "DYNAMIC", "PREPARE", "DEALLOCATE", "WAITFOR", "DELAY", "SLEEP", "SHUTDOWN", "RECONFIGURE"];
15
+ /**
16
+ * Safe SQL functions allowed in expressions, organized by category
17
+ */
18
+ export declare const ALLOWED_SQL_FUNCTIONS: {
19
+ readonly aggregates: readonly ["COUNT", "COUNT_BIG", "SUM", "AVG", "MIN", "MAX", "STDEV", "STDEVP", "VAR", "VARP", "STRING_AGG", "CHECKSUM_AGG"];
20
+ readonly math: readonly ["ABS", "CEILING", "FLOOR", "ROUND", "POWER", "SQRT", "LOG", "LOG10", "EXP", "SIGN", "RAND"];
21
+ readonly string: readonly ["LEN", "LENGTH", "UPPER", "LOWER", "LTRIM", "RTRIM", "TRIM", "LEFT", "RIGHT", "SUBSTRING", "CHARINDEX", "REPLACE", "CONCAT", "STUFF"];
22
+ readonly date: readonly ["DATEPART", "DATEDIFF", "DATEADD", "YEAR", "MONTH", "DAY", "HOUR", "MINUTE", "SECOND", "GETDATE", "GETUTCDATE", "SYSDATETIME", "EOMONTH"];
23
+ readonly conversion: readonly ["CAST", "CONVERT", "TRY_CAST", "TRY_CONVERT", "FORMAT"];
24
+ readonly nullHandling: readonly ["ISNULL", "COALESCE", "NULLIF", "IIF"];
25
+ readonly conditional: readonly ["CASE", "WHEN", "THEN", "ELSE", "END"];
26
+ readonly logical: readonly ["AND", "OR", "NOT", "IS", "NULL", "LIKE", "BETWEEN", "IN"];
27
+ readonly ordering: readonly ["ASC", "ASCENDING", "DESC", "DESCENDING", "OVER", "PARTITION", "BY", "ORDER", "ROWS", "RANGE", "UNBOUNDED", "PRECEDING", "FOLLOWING", "CURRENT", "ROW"];
28
+ };
29
+ /**
30
+ * Validation context - affects what's allowed
31
+ */
32
+ export type SQLValidationContext = 'where_clause' | 'order_by' | 'aggregate' | 'field_reference';
33
+ /**
34
+ * Validation result with detailed error information
35
+ */
36
+ export interface SQLValidationResult {
37
+ /** Whether the expression passed validation */
38
+ valid: boolean;
39
+ /** Error message if validation failed */
40
+ error?: string;
41
+ /** Specific keyword or pattern that triggered the error */
42
+ trigger?: string;
43
+ /** Suggested fix if available */
44
+ suggestion?: string;
45
+ }
46
+ /**
47
+ * Options for SQL expression validation
48
+ */
49
+ export interface SQLValidationOptions {
50
+ /** Validation context affects what's allowed */
51
+ context: SQLValidationContext;
52
+ /** Entity field names for validation (optional - enables field checking) */
53
+ entityFields?: string[];
54
+ /** Whether to require at least one aggregate function (for 'aggregate' context). Default: true for aggregate context */
55
+ requireAggregate?: boolean;
56
+ /** Whether to allow SELECT keyword (normally blocked for subquery prevention) */
57
+ allowSubqueries?: boolean;
58
+ /** Custom allowed keywords/functions to add */
59
+ additionalAllowed?: string[];
60
+ /** Custom blocked keywords to add */
61
+ additionalBlocked?: string[];
62
+ }
63
+ /**
64
+ * Central SQL expression validator for preventing SQL injection.
65
+ *
66
+ * Provides context-aware validation for different types of SQL expressions
67
+ * (WHERE clauses, ORDER BY, aggregates, etc.) with detailed error reporting.
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * const validator = SQLExpressionValidator.Instance;
72
+ *
73
+ * // Validate an aggregate expression
74
+ * const result = validator.validate('SUM(OrderTotal)', {
75
+ * context: 'aggregate',
76
+ * entityFields: ['OrderTotal', 'Quantity', 'Price']
77
+ * });
78
+ *
79
+ * if (!result.valid) {
80
+ * console.error(result.error);
81
+ * }
82
+ * ```
83
+ */
84
+ export declare class SQLExpressionValidator {
85
+ private static _instance;
86
+ private constructor();
87
+ /**
88
+ * Gets the singleton instance of the validator
89
+ */
90
+ static get Instance(): SQLExpressionValidator;
91
+ /**
92
+ * Validate a SQL expression for injection and allowed patterns.
93
+ *
94
+ * @param expression The SQL expression to validate
95
+ * @param options Validation options including context and entity fields
96
+ * @returns Validation result with error details if invalid
97
+ */
98
+ validate(expression: string, options: SQLValidationOptions): SQLValidationResult;
99
+ /**
100
+ * Remove string literals to avoid false positives in keyword detection.
101
+ * Handles both single and double quoted strings with escaped quotes.
102
+ */
103
+ private removeStringLiterals;
104
+ /**
105
+ * Check for dangerous SQL patterns that indicate injection attempts
106
+ */
107
+ private checkDangerousPatterns;
108
+ /**
109
+ * Check that function names are in the allowlist
110
+ */
111
+ private checkFunctionNames;
112
+ /**
113
+ * Context-specific validation rules
114
+ */
115
+ private checkContextRules;
116
+ /**
117
+ * Validate field references exist in entity (lenient mode - just for logging)
118
+ */
119
+ private checkFieldReferences;
120
+ /**
121
+ * Escape special regex characters in a string
122
+ */
123
+ private escapeRegex;
124
+ }
125
+ //# sourceMappingURL=SQLExpressionValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SQLExpressionValidator.d.ts","sourceRoot":"","sources":["../src/SQLExpressionValidator.ts"],"names":[],"mappings":"AAAA;;;;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;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoBzB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA4B5B;;OAEG;IACH,OAAO,CAAC,WAAW;CAGpB"}
@@ -0,0 +1,270 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Unified SQL Expression Validation
4
+ *
5
+ * Central utility for validating user-provided SQL expressions against injection attacks.
6
+ * Used by RunView, aggregates, smart filters, and any other feature accepting SQL input.
7
+ *
8
+ * Located in MJGlobal (lowest-level package) so all packages can use it.
9
+ *
10
+ * @module @memberjunction/global/SQLExpressionValidator
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.SQLExpressionValidator = exports.ALLOWED_SQL_FUNCTIONS = exports.DANGEROUS_SQL_KEYWORDS = void 0;
14
+ /**
15
+ * Dangerous SQL keywords that are never allowed in user-provided expressions
16
+ */
17
+ exports.DANGEROUS_SQL_KEYWORDS = [
18
+ // DDL (Data Definition Language)
19
+ 'DROP', 'CREATE', 'ALTER', 'TRUNCATE', 'RENAME',
20
+ // DML (Data Manipulation Language)
21
+ 'INSERT', 'UPDATE', 'DELETE', 'MERGE', 'REPLACE',
22
+ // DCL (Data Control Language)
23
+ 'GRANT', 'REVOKE', 'DENY',
24
+ // Execution and procedures
25
+ 'EXEC', 'EXECUTE', 'CALL', 'PROCEDURE', 'FUNCTION',
26
+ // Transaction control
27
+ 'BEGIN', 'COMMIT', 'ROLLBACK', 'SAVEPOINT',
28
+ // Database/schema operations
29
+ 'USE', 'DATABASE', 'SCHEMA',
30
+ // Control flow (dangerous in expressions)
31
+ 'IF', 'WHILE', 'LOOP', 'FOR', 'GOTO',
32
+ // Union/set operations (injection vectors)
33
+ 'UNION', 'INTERSECT', 'EXCEPT',
34
+ // Subquery keywords (when used maliciously)
35
+ 'EXISTS', 'ANY', 'ALL', 'SOME',
36
+ // File/external operations
37
+ 'BULK', 'OPENROWSET', 'OPENDATASOURCE', 'OPENQUERY',
38
+ // Extended stored procedures
39
+ 'XP_', 'SP_',
40
+ // Dynamic SQL
41
+ 'DYNAMIC', 'PREPARE', 'DEALLOCATE',
42
+ // Time-based injection
43
+ 'WAITFOR', 'DELAY', 'SLEEP',
44
+ // System operations
45
+ 'SHUTDOWN', 'RECONFIGURE'
46
+ ];
47
+ /**
48
+ * Safe SQL functions allowed in expressions, organized by category
49
+ */
50
+ exports.ALLOWED_SQL_FUNCTIONS = {
51
+ // Aggregate functions
52
+ aggregates: ['COUNT', 'COUNT_BIG', 'SUM', 'AVG', 'MIN', 'MAX', 'STDEV', 'STDEVP', 'VAR', 'VARP', 'STRING_AGG', 'CHECKSUM_AGG'],
53
+ // Math functions
54
+ math: ['ABS', 'CEILING', 'FLOOR', 'ROUND', 'POWER', 'SQRT', 'LOG', 'LOG10', 'EXP', 'SIGN', 'RAND'],
55
+ // String functions (read-only)
56
+ string: ['LEN', 'LENGTH', 'UPPER', 'LOWER', 'LTRIM', 'RTRIM', 'TRIM', 'LEFT', 'RIGHT', 'SUBSTRING', 'CHARINDEX', 'REPLACE', 'CONCAT', 'STUFF'],
57
+ // Date functions
58
+ date: ['DATEPART', 'DATEDIFF', 'DATEADD', 'YEAR', 'MONTH', 'DAY', 'HOUR', 'MINUTE', 'SECOND', 'GETDATE', 'GETUTCDATE', 'SYSDATETIME', 'EOMONTH'],
59
+ // Type conversion (safe subset)
60
+ conversion: ['CAST', 'CONVERT', 'TRY_CAST', 'TRY_CONVERT', 'FORMAT'],
61
+ // Null handling
62
+ nullHandling: ['ISNULL', 'COALESCE', 'NULLIF', 'IIF'],
63
+ // Case expressions
64
+ conditional: ['CASE', 'WHEN', 'THEN', 'ELSE', 'END'],
65
+ // Logical operators (as keywords)
66
+ logical: ['AND', 'OR', 'NOT', 'IS', 'NULL', 'LIKE', 'BETWEEN', 'IN'],
67
+ // Sort/order and windowing
68
+ ordering: ['ASC', 'ASCENDING', 'DESC', 'DESCENDING', 'OVER', 'PARTITION', 'BY', 'ORDER', 'ROWS', 'RANGE', 'UNBOUNDED', 'PRECEDING', 'FOLLOWING', 'CURRENT', 'ROW']
69
+ };
70
+ /**
71
+ * Central SQL expression validator for preventing SQL injection.
72
+ *
73
+ * Provides context-aware validation for different types of SQL expressions
74
+ * (WHERE clauses, ORDER BY, aggregates, etc.) with detailed error reporting.
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * const validator = SQLExpressionValidator.Instance;
79
+ *
80
+ * // Validate an aggregate expression
81
+ * const result = validator.validate('SUM(OrderTotal)', {
82
+ * context: 'aggregate',
83
+ * entityFields: ['OrderTotal', 'Quantity', 'Price']
84
+ * });
85
+ *
86
+ * if (!result.valid) {
87
+ * console.error(result.error);
88
+ * }
89
+ * ```
90
+ */
91
+ class SQLExpressionValidator {
92
+ constructor() { }
93
+ /**
94
+ * Gets the singleton instance of the validator
95
+ */
96
+ static get Instance() {
97
+ if (!this._instance) {
98
+ this._instance = new SQLExpressionValidator();
99
+ }
100
+ return this._instance;
101
+ }
102
+ /**
103
+ * Validate a SQL expression for injection and allowed patterns.
104
+ *
105
+ * @param expression The SQL expression to validate
106
+ * @param options Validation options including context and entity fields
107
+ * @returns Validation result with error details if invalid
108
+ */
109
+ validate(expression, options) {
110
+ if (!expression || typeof expression !== 'string') {
111
+ return { valid: false, error: 'Expression cannot be empty' };
112
+ }
113
+ const trimmed = expression.trim();
114
+ if (!trimmed) {
115
+ return { valid: false, error: 'Expression cannot be empty' };
116
+ }
117
+ // Step 1: Remove string literals to avoid false positives
118
+ const withoutStrings = this.removeStringLiterals(trimmed);
119
+ // Step 2: Check for dangerous patterns
120
+ const dangerCheck = this.checkDangerousPatterns(withoutStrings, options);
121
+ if (!dangerCheck.valid)
122
+ return dangerCheck;
123
+ // Step 3: Validate function names are in allowlist
124
+ const functionCheck = this.checkFunctionNames(withoutStrings, options);
125
+ if (!functionCheck.valid)
126
+ return functionCheck;
127
+ // Step 4: Context-specific validation
128
+ const contextCheck = this.checkContextRules(withoutStrings, options);
129
+ if (!contextCheck.valid)
130
+ return contextCheck;
131
+ // Step 5: Optional field reference validation (lenient - just logs warnings)
132
+ if (options.entityFields?.length) {
133
+ this.checkFieldReferences(withoutStrings, options.entityFields);
134
+ }
135
+ return { valid: true };
136
+ }
137
+ /**
138
+ * Remove string literals to avoid false positives in keyword detection.
139
+ * Handles both single and double quoted strings with escaped quotes.
140
+ */
141
+ removeStringLiterals(expression) {
142
+ // Match both single and double quoted strings, handling escaped quotes
143
+ const stringPattern = /(['"])(?:(?=(\\?))\2[\s\S])*?\1/g;
144
+ return expression.replace(stringPattern, '');
145
+ }
146
+ /**
147
+ * Check for dangerous SQL patterns that indicate injection attempts
148
+ */
149
+ checkDangerousPatterns(expression, options) {
150
+ const upper = expression.toUpperCase();
151
+ // Build blocked list - explicitly typed as string[] for mutability
152
+ const blocked = [...exports.DANGEROUS_SQL_KEYWORDS];
153
+ if (options.additionalBlocked) {
154
+ blocked.push(...options.additionalBlocked);
155
+ }
156
+ // Add SELECT to blocked unless explicitly allowed (prevents subqueries)
157
+ if (!options.allowSubqueries && !blocked.includes('SELECT')) {
158
+ blocked.push('SELECT');
159
+ }
160
+ for (const keyword of blocked) {
161
+ // Use word boundaries to avoid false positives (e.g., "DESCRIPTION" containing "EXEC")
162
+ const pattern = new RegExp(`\\b${this.escapeRegex(keyword)}\\b`, 'i');
163
+ if (pattern.test(upper)) {
164
+ return {
165
+ valid: false,
166
+ error: `Dangerous SQL keyword detected: ${keyword}`,
167
+ trigger: keyword,
168
+ suggestion: keyword === 'SELECT' ? 'Subqueries are not allowed. Use a direct expression instead.' : undefined
169
+ };
170
+ }
171
+ }
172
+ // Check comment patterns (common injection technique)
173
+ if (upper.includes('--') || upper.includes('/*') || upper.includes('*/')) {
174
+ return {
175
+ valid: false,
176
+ error: 'Comments are not allowed in SQL expressions',
177
+ trigger: 'comment'
178
+ };
179
+ }
180
+ // Check statement terminator (prevents multi-statement injection)
181
+ if (expression.includes(';')) {
182
+ return {
183
+ valid: false,
184
+ error: 'Semicolons are not allowed in SQL expressions',
185
+ trigger: ';'
186
+ };
187
+ }
188
+ return { valid: true };
189
+ }
190
+ /**
191
+ * Check that function names are in the allowlist
192
+ */
193
+ checkFunctionNames(expression, options) {
194
+ // Extract function calls (word followed by opening paren)
195
+ const functionPattern = /\b([A-Z_][A-Z0-9_]*)\s*\(/gi;
196
+ let match;
197
+ // Build allowed functions list from all categories
198
+ const allowed = new Set();
199
+ Object.values(exports.ALLOWED_SQL_FUNCTIONS).flat().forEach(fn => allowed.add(fn.toUpperCase()));
200
+ if (options.additionalAllowed) {
201
+ options.additionalAllowed.forEach(fn => allowed.add(fn.toUpperCase()));
202
+ }
203
+ while ((match = functionPattern.exec(expression)) !== null) {
204
+ const fnName = match[1].toUpperCase();
205
+ if (!allowed.has(fnName)) {
206
+ return {
207
+ valid: false,
208
+ error: `Function '${fnName}' is not allowed`,
209
+ trigger: fnName,
210
+ suggestion: `Allowed functions include: ${exports.ALLOWED_SQL_FUNCTIONS.aggregates.join(', ')}, ${exports.ALLOWED_SQL_FUNCTIONS.math.slice(0, 5).join(', ')}...`
211
+ };
212
+ }
213
+ }
214
+ return { valid: true };
215
+ }
216
+ /**
217
+ * Context-specific validation rules
218
+ */
219
+ checkContextRules(expression, options) {
220
+ // For aggregate context, require at least one aggregate function (unless explicitly disabled)
221
+ if (options.context === 'aggregate' && options.requireAggregate !== false) {
222
+ const hasAggregate = exports.ALLOWED_SQL_FUNCTIONS.aggregates.some(fn => {
223
+ const pattern = new RegExp(`\\b${fn}\\s*\\(`, 'i');
224
+ return pattern.test(expression);
225
+ });
226
+ if (!hasAggregate) {
227
+ return {
228
+ valid: false,
229
+ error: 'Aggregate expression must contain at least one aggregate function',
230
+ suggestion: `Use one of: ${exports.ALLOWED_SQL_FUNCTIONS.aggregates.join(', ')}`
231
+ };
232
+ }
233
+ }
234
+ return { valid: true };
235
+ }
236
+ /**
237
+ * Validate field references exist in entity (lenient mode - just for logging)
238
+ */
239
+ checkFieldReferences(expression, entityFields) {
240
+ // Extract potential field names (words not followed by parentheses)
241
+ const fieldPattern = /\b([A-Z_][A-Z0-9_]*)\b(?!\s*\()/gi;
242
+ const fieldSet = new Set(entityFields.map(f => f.toUpperCase()));
243
+ // Build set of all allowed keywords (not just functions)
244
+ const allAllowed = new Set();
245
+ Object.values(exports.ALLOWED_SQL_FUNCTIONS).flat().forEach(k => allAllowed.add(k.toUpperCase()));
246
+ let match;
247
+ const unknownFields = [];
248
+ while ((match = fieldPattern.exec(expression)) !== null) {
249
+ const word = match[1].toUpperCase();
250
+ // Skip if it's an allowed keyword or a known field
251
+ if (!allAllowed.has(word) && !fieldSet.has(word)) {
252
+ unknownFields.push(match[1]);
253
+ }
254
+ }
255
+ // Lenient mode: just log warnings, don't fail validation
256
+ // This allows computed columns and virtual fields not in the fields array
257
+ if (unknownFields.length > 0) {
258
+ // Could emit a warning here if we had a logging mechanism
259
+ // For now, we allow it to pass
260
+ }
261
+ }
262
+ /**
263
+ * Escape special regex characters in a string
264
+ */
265
+ escapeRegex(str) {
266
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
267
+ }
268
+ }
269
+ exports.SQLExpressionValidator = SQLExpressionValidator;
270
+ //# sourceMappingURL=SQLExpressionValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SQLExpressionValidator.js","sourceRoot":"","sources":["../src/SQLExpressionValidator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH;;GAEG;AACU,QAAA,sBAAsB,GAAG;IACpC,iCAAiC;IACjC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ;IAE/C,mCAAmC;IACnC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS;IAEhD,8BAA8B;IAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM;IAEzB,2BAA2B;IAC3B,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU;IAElD,sBAAsB;IACtB,OAAO,EAAE,QAAQ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E,CAAC,CAAC,CAAC;QAE1F,IAAI,KAAK,CAAC;QACV,MAAM,aAAa,GAAa,EAAE,CAAC;QAEnC,OAAO,CAAC,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACxD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YACpC,mDAAmD;YACnD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACjD,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;QAED,yDAAyD;QACzD,0EAA0E;QAC1E,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,0DAA0D;YAC1D,+BAA+B;QACjC,CAAC;IACH,CAAC;IAED;;OAEG;IACK,WAAW,CAAC,GAAW;QAC7B,OAAO,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;CACF;AA9MD,wDA8MC"}
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './util/PatternUtils';
9
9
  export * from './ValidationTypes';
10
10
  export * from './JSONValidator';
11
11
  export * from './SafeExpressionEvaluator';
12
+ export * from './SQLExpressionValidator';
12
13
  export * from './warningManager';
13
14
  export * from './EncryptionUtils';
14
15
  export * from './Global';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAChE,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA;AACzC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AAMjC,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAChE,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AAMjC,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA"}
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ __exportStar(require("./util/PatternUtils"), exports);
29
29
  __exportStar(require("./ValidationTypes"), exports);
30
30
  __exportStar(require("./JSONValidator"), exports);
31
31
  __exportStar(require("./SafeExpressionEvaluator"), exports);
32
+ __exportStar(require("./SQLExpressionValidator"), exports);
32
33
  __exportStar(require("./warningManager"), exports);
33
34
  __exportStar(require("./EncryptionUtils"), exports);
34
35
  // NOTE: TelemetryManager has moved to @memberjunction/core
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iCAAiC;AACjC,+CAAgE;AAAvD,4GAAA,YAAY,OAAA;AAAE,iHAAA,iBAAiB,OAAA;AACxC,8CAA2B;AAC3B,yCAAsB;AACtB,gDAA6B;AAC7B,kDAA+B;AAC/B,6CAA0B;AAC1B,+CAA4B;AAC5B,sDAAoC;AACpC,oDAAiC;AACjC,kDAA+B;AAC/B,4DAAyC;AACzC,mDAAgC;AAChC,oDAAiC;AAEjC,2DAA2D;AAC3D,oCAAoC;AAEpC,0BAA0B;AAC1B,2CAAwB;AACxB,kDAA+B;AAE/B,6DAA6D;AAC7D,oCAAoC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iCAAiC;AACjC,+CAAgE;AAAvD,4GAAA,YAAY,OAAA;AAAE,iHAAA,iBAAiB,OAAA;AACxC,8CAA2B;AAC3B,yCAAsB;AACtB,gDAA6B;AAC7B,kDAA+B;AAC/B,6CAA0B;AAC1B,+CAA4B;AAC5B,sDAAoC;AACpC,oDAAiC;AACjC,kDAA+B;AAC/B,4DAAyC;AACzC,2DAAwC;AACxC,mDAAgC;AAChC,oDAAiC;AAEjC,2DAA2D;AAC3D,oCAAoC;AAEpC,0BAA0B;AAC1B,2CAAwB;AACxB,kDAA+B;AAE/B,6DAA6D;AAC7D,oCAAoC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/global",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "MemberJunction: Global Object - Needed for ALL other MJ components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",