@memberjunction/query-processor 0.0.1 → 5.5.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.
- package/README.md +40 -29
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/queryParameterProcessor.d.ts +73 -0
- package/dist/queryParameterProcessor.d.ts.map +1 -0
- package/dist/queryParameterProcessor.js +234 -0
- package/dist/queryParameterProcessor.js.map +1 -0
- package/package.json +30 -7
package/README.md
CHANGED
|
@@ -1,45 +1,56 @@
|
|
|
1
1
|
# @memberjunction/query-processor
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared query template processing for MemberJunction data providers. Handles parameter validation, type conversion, and Nunjucks template rendering for parameterized queries.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Why This Package Exists
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
MemberJunction's `RunQuery` system supports parameterized SQL queries using Nunjucks templates (e.g., `{{ status | sqlString }}`). This package provides the `QueryParameterProcessor` class that both the SQL Server and PostgreSQL data providers use to:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- Validate user-supplied parameters against query definitions
|
|
10
|
+
- Convert parameter values to the correct types (string, number, boolean, date, array)
|
|
11
|
+
- Apply platform-aware boolean handling (SQL Server BIT 1/0 vs PostgreSQL native true/false)
|
|
12
|
+
- Render Nunjucks templates with validated parameters and SQL-safe filters
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `@memberjunction/query-processor`
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
14
|
+
## Platform-Aware Behavior
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
The processor reads the current platform from `RunQuerySQLFilterManager.Instance.Platform` and adjusts behavior accordingly:
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
| Feature | SQL Server | PostgreSQL |
|
|
19
|
+
|---------|-----------|------------|
|
|
20
|
+
| Boolean values | `1` / `0` (BIT) | `true` / `false` |
|
|
21
|
+
| `sqlBoolean` filter | Returns `1` or `0` | Returns `TRUE` or `FALSE` |
|
|
22
|
+
| `sqlIdentifier` filter | `[name]` | `"name"` |
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
The Nunjucks environment is automatically recreated when the platform changes, since filters are baked in at creation time.
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
## Usage
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
28
|
+
```typescript
|
|
29
|
+
import { QueryParameterProcessor } from '@memberjunction/query-processor';
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
// Validate parameters against definitions
|
|
32
|
+
const validation = QueryParameterProcessor.validateParameters(
|
|
33
|
+
{ status: 'Active', limit: '10' },
|
|
34
|
+
query.Parameters
|
|
35
|
+
);
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
if (validation.success) {
|
|
38
|
+
// Process a query template
|
|
39
|
+
const result = QueryParameterProcessor.processQueryTemplate(
|
|
40
|
+
queryInfo,
|
|
41
|
+
userParams,
|
|
42
|
+
platformSpecificSQL // optional override
|
|
43
|
+
);
|
|
36
44
|
|
|
37
|
-
|
|
45
|
+
if (result.success) {
|
|
46
|
+
// result.processedSQL contains the rendered SQL
|
|
47
|
+
await executeSQL(result.processedSQL);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
38
51
|
|
|
39
|
-
|
|
40
|
-
- [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
52
|
+
## Dependencies
|
|
42
53
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
- `@memberjunction/core` - For `RunQuerySQLFilterManager`, `QueryInfo`, `QueryParameterInfo` types
|
|
55
|
+
- `@memberjunction/global` - For `MJGlobal` utilities
|
|
56
|
+
- `nunjucks` - Template rendering engine
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,YAAY,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { QueryInfo, QueryParameterInfo } from '@memberjunction/core';
|
|
2
|
+
/**
|
|
3
|
+
* Result of parameter validation
|
|
4
|
+
*/
|
|
5
|
+
export interface ParameterValidationResult {
|
|
6
|
+
/**
|
|
7
|
+
* Whether all parameters passed validation
|
|
8
|
+
*/
|
|
9
|
+
success: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Error messages for any validation failures
|
|
12
|
+
*/
|
|
13
|
+
errors: string[];
|
|
14
|
+
/**
|
|
15
|
+
* The validated and type-converted parameters
|
|
16
|
+
*/
|
|
17
|
+
validatedParameters: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Result of processing a query template
|
|
21
|
+
*/
|
|
22
|
+
export interface QueryProcessingResult {
|
|
23
|
+
/**
|
|
24
|
+
* Whether template processing was successful
|
|
25
|
+
*/
|
|
26
|
+
success: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The processed SQL query with parameters substituted
|
|
29
|
+
*/
|
|
30
|
+
processedSQL: string;
|
|
31
|
+
/**
|
|
32
|
+
* Error message if processing failed
|
|
33
|
+
*/
|
|
34
|
+
error?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The final parameters that were applied, including defaults
|
|
37
|
+
*/
|
|
38
|
+
appliedParameters: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Handles parameter validation and query template processing for parameterized queries.
|
|
42
|
+
* Provides type conversion, validation, and secure template processing using Nunjucks.
|
|
43
|
+
*
|
|
44
|
+
* Platform-aware: reads the current platform from RunQuerySQLFilterManager to handle
|
|
45
|
+
* boolean conversion correctly (SQL Server BIT 1/0 vs PostgreSQL true/false).
|
|
46
|
+
*
|
|
47
|
+
* Shared between SQL Server and PostgreSQL data providers.
|
|
48
|
+
*/
|
|
49
|
+
export declare class QueryParameterProcessor {
|
|
50
|
+
private static _nunjucksEnv;
|
|
51
|
+
private static _envPlatform;
|
|
52
|
+
/**
|
|
53
|
+
* Gets or creates the Nunjucks environment with custom SQL-safe filters.
|
|
54
|
+
* Recreates the environment if the platform has changed since last creation,
|
|
55
|
+
* because filters (sqlBoolean, sqlIdentifier) are baked in at creation time.
|
|
56
|
+
*/
|
|
57
|
+
private static get nunjucksEnv();
|
|
58
|
+
/**
|
|
59
|
+
* Validates parameters against their definitions.
|
|
60
|
+
* Boolean handling is platform-aware:
|
|
61
|
+
* - SQL Server: converts to 1/0 (BIT fields)
|
|
62
|
+
* - PostgreSQL: keeps as true/false (native boolean)
|
|
63
|
+
*/
|
|
64
|
+
static validateParameters(parameters: Record<string, unknown> | undefined, parameterDefinitions: QueryParameterInfo[]): ParameterValidationResult;
|
|
65
|
+
/**
|
|
66
|
+
* Processes a query template with the provided parameters.
|
|
67
|
+
* @param query The query info containing template SQL and parameter definitions
|
|
68
|
+
* @param parameters User-provided parameter values
|
|
69
|
+
* @param sqlOverride Optional SQL to use instead of query.SQL (e.g., platform-resolved SQL)
|
|
70
|
+
*/
|
|
71
|
+
static processQueryTemplate(query: QueryInfo, parameters: Record<string, unknown> | undefined, sqlOverride?: string): QueryProcessingResult;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=queryParameterProcessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryParameterProcessor.d.ts","sourceRoot":"","sources":["../src/queryParameterProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAA8C,MAAM,sBAAsB,CAAC;AAGjH;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC9C;AAED;;;;;;;;GAQG;AACH,qBAAa,uBAAuB;IAChC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAqC;IAChE,OAAO,CAAC,MAAM,CAAC,YAAY,CAAiC;IAE5D;;;;OAIG;IACH,OAAO,CAAC,MAAM,KAAK,WAAW,GAsB7B;IAED;;;;;OAKG;WACW,kBAAkB,CAC5B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,oBAAoB,EAAE,kBAAkB,EAAE,GAC3C,yBAAyB;IAqI5B;;;;;OAKG;WACW,oBAAoB,CAC9B,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,WAAW,CAAC,EAAE,MAAM,GACrB,qBAAqB;CAuD3B"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { RunQuerySQLFilterManager } from '@memberjunction/core';
|
|
2
|
+
import nunjucks from 'nunjucks';
|
|
3
|
+
/**
|
|
4
|
+
* Handles parameter validation and query template processing for parameterized queries.
|
|
5
|
+
* Provides type conversion, validation, and secure template processing using Nunjucks.
|
|
6
|
+
*
|
|
7
|
+
* Platform-aware: reads the current platform from RunQuerySQLFilterManager to handle
|
|
8
|
+
* boolean conversion correctly (SQL Server BIT 1/0 vs PostgreSQL true/false).
|
|
9
|
+
*
|
|
10
|
+
* Shared between SQL Server and PostgreSQL data providers.
|
|
11
|
+
*/
|
|
12
|
+
export class QueryParameterProcessor {
|
|
13
|
+
static { this._nunjucksEnv = null; }
|
|
14
|
+
static { this._envPlatform = null; }
|
|
15
|
+
/**
|
|
16
|
+
* Gets or creates the Nunjucks environment with custom SQL-safe filters.
|
|
17
|
+
* Recreates the environment if the platform has changed since last creation,
|
|
18
|
+
* because filters (sqlBoolean, sqlIdentifier) are baked in at creation time.
|
|
19
|
+
*/
|
|
20
|
+
static get nunjucksEnv() {
|
|
21
|
+
const currentPlatform = RunQuerySQLFilterManager.Instance.Platform;
|
|
22
|
+
if (!this._nunjucksEnv || this._envPlatform !== currentPlatform) {
|
|
23
|
+
this._nunjucksEnv = new nunjucks.Environment(null, {
|
|
24
|
+
autoescape: false,
|
|
25
|
+
throwOnUndefined: true,
|
|
26
|
+
trimBlocks: true,
|
|
27
|
+
lstripBlocks: true
|
|
28
|
+
});
|
|
29
|
+
// Add custom SQL-safe filters from the RunQuerySQLFilterManager
|
|
30
|
+
const filterManager = RunQuerySQLFilterManager.Instance;
|
|
31
|
+
const filters = filterManager.getAllFilters();
|
|
32
|
+
for (const filter of filters) {
|
|
33
|
+
if (filter.implementation) {
|
|
34
|
+
this._nunjucksEnv.addFilter(filter.name, filter.implementation);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
this._envPlatform = currentPlatform;
|
|
38
|
+
}
|
|
39
|
+
return this._nunjucksEnv;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Validates parameters against their definitions.
|
|
43
|
+
* Boolean handling is platform-aware:
|
|
44
|
+
* - SQL Server: converts to 1/0 (BIT fields)
|
|
45
|
+
* - PostgreSQL: keeps as true/false (native boolean)
|
|
46
|
+
*/
|
|
47
|
+
static validateParameters(parameters, parameterDefinitions) {
|
|
48
|
+
const errors = [];
|
|
49
|
+
const validatedParams = {};
|
|
50
|
+
const platform = RunQuerySQLFilterManager.Instance.Platform;
|
|
51
|
+
// Process each defined parameter
|
|
52
|
+
for (const paramDef of parameterDefinitions) {
|
|
53
|
+
const value = parameters?.[paramDef.Name];
|
|
54
|
+
// Check required parameters
|
|
55
|
+
if (paramDef.IsRequired && (value === undefined || value === null || value === '')) {
|
|
56
|
+
errors.push(`Required parameter '${paramDef.Name}' is missing`);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
// Use default value if not provided
|
|
60
|
+
let finalValue = value;
|
|
61
|
+
if ((finalValue === undefined || finalValue === null) && paramDef.DefaultValue !== null) {
|
|
62
|
+
try {
|
|
63
|
+
// Parse default value based on type
|
|
64
|
+
switch (paramDef.Type) {
|
|
65
|
+
case 'number':
|
|
66
|
+
finalValue = Number(paramDef.DefaultValue);
|
|
67
|
+
break;
|
|
68
|
+
case 'boolean':
|
|
69
|
+
finalValue = paramDef.DefaultValue.toLowerCase() === 'true';
|
|
70
|
+
break;
|
|
71
|
+
case 'date':
|
|
72
|
+
finalValue = new Date(paramDef.DefaultValue);
|
|
73
|
+
break;
|
|
74
|
+
case 'array':
|
|
75
|
+
finalValue = JSON.parse(paramDef.DefaultValue);
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
finalValue = paramDef.DefaultValue;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
83
|
+
errors.push(`Failed to parse default value for parameter '${paramDef.Name}': ${msg}`);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Type conversion and validation
|
|
88
|
+
if (finalValue !== undefined && finalValue !== null) {
|
|
89
|
+
try {
|
|
90
|
+
switch (paramDef.Type) {
|
|
91
|
+
case 'string':
|
|
92
|
+
validatedParams[paramDef.Name] = String(finalValue);
|
|
93
|
+
break;
|
|
94
|
+
case 'number': {
|
|
95
|
+
const num = Number(finalValue);
|
|
96
|
+
if (isNaN(num)) {
|
|
97
|
+
errors.push(`Parameter '${paramDef.Name}' must be a number`);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
validatedParams[paramDef.Name] = num;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
case 'date': {
|
|
104
|
+
const date = finalValue instanceof Date ? finalValue : new Date(finalValue);
|
|
105
|
+
if (isNaN(date.getTime())) {
|
|
106
|
+
errors.push(`Parameter '${paramDef.Name}' must be a valid date`);
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
// Store as ISO string for SQL compatibility
|
|
110
|
+
validatedParams[paramDef.Name] = date.toISOString();
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
case 'boolean': {
|
|
114
|
+
const boolValue = typeof finalValue === 'boolean'
|
|
115
|
+
? finalValue
|
|
116
|
+
: String(finalValue).toLowerCase() === 'true';
|
|
117
|
+
if (platform === 'postgresql') {
|
|
118
|
+
// PostgreSQL natively supports boolean true/false
|
|
119
|
+
validatedParams[paramDef.Name] = boolValue;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
// SQL Server uses BIT (1/0)
|
|
123
|
+
validatedParams[paramDef.Name] = boolValue ? 1 : 0;
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
case 'array':
|
|
128
|
+
if (Array.isArray(finalValue)) {
|
|
129
|
+
validatedParams[paramDef.Name] = finalValue;
|
|
130
|
+
}
|
|
131
|
+
else if (typeof finalValue === 'string') {
|
|
132
|
+
try {
|
|
133
|
+
validatedParams[paramDef.Name] = JSON.parse(finalValue);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
errors.push(`Parameter '${paramDef.Name}' must be a valid JSON array`);
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
errors.push(`Parameter '${paramDef.Name}' must be an array`);
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
break;
|
|
145
|
+
default:
|
|
146
|
+
validatedParams[paramDef.Name] = finalValue;
|
|
147
|
+
}
|
|
148
|
+
// Apply validation filters if any
|
|
149
|
+
if (paramDef.ValidationFilters) {
|
|
150
|
+
const filters = paramDef.ParsedFilters;
|
|
151
|
+
for (const _filter of filters) {
|
|
152
|
+
// Validation filter application placeholder
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch (e) {
|
|
157
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
158
|
+
errors.push(`Error processing parameter '${paramDef.Name}': ${msg}`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// Check for unknown parameters
|
|
163
|
+
if (parameters) {
|
|
164
|
+
const definedParamNames = new Set(parameterDefinitions.map(p => p.Name));
|
|
165
|
+
for (const key of Object.keys(parameters)) {
|
|
166
|
+
if (!definedParamNames.has(key)) {
|
|
167
|
+
errors.push(`Unknown parameter: '${key}'`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
success: errors.length === 0,
|
|
173
|
+
errors,
|
|
174
|
+
validatedParameters: validatedParams
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Processes a query template with the provided parameters.
|
|
179
|
+
* @param query The query info containing template SQL and parameter definitions
|
|
180
|
+
* @param parameters User-provided parameter values
|
|
181
|
+
* @param sqlOverride Optional SQL to use instead of query.SQL (e.g., platform-resolved SQL)
|
|
182
|
+
*/
|
|
183
|
+
static processQueryTemplate(query, parameters, sqlOverride) {
|
|
184
|
+
try {
|
|
185
|
+
const sql = sqlOverride ?? query.SQL;
|
|
186
|
+
// If query doesn't use templates, return the SQL as-is
|
|
187
|
+
if (!query.UsesTemplate) {
|
|
188
|
+
return {
|
|
189
|
+
success: true,
|
|
190
|
+
processedSQL: sql,
|
|
191
|
+
appliedParameters: {}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
// Validate parameters
|
|
195
|
+
const validation = this.validateParameters(parameters, query.Parameters);
|
|
196
|
+
if (!validation.success) {
|
|
197
|
+
return {
|
|
198
|
+
success: false,
|
|
199
|
+
processedSQL: '',
|
|
200
|
+
error: `Parameter validation failed: ${validation.errors.join('; ')}`,
|
|
201
|
+
appliedParameters: {}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
// Process the template
|
|
205
|
+
try {
|
|
206
|
+
const processedSQL = this.nunjucksEnv.renderString(sql, validation.validatedParameters);
|
|
207
|
+
return {
|
|
208
|
+
success: true,
|
|
209
|
+
processedSQL,
|
|
210
|
+
appliedParameters: validation.validatedParameters
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
catch (e) {
|
|
214
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
215
|
+
return {
|
|
216
|
+
success: false,
|
|
217
|
+
processedSQL: '',
|
|
218
|
+
error: `Template processing failed: ${msg}`,
|
|
219
|
+
appliedParameters: validation.validatedParameters
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
catch (e) {
|
|
224
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
225
|
+
return {
|
|
226
|
+
success: false,
|
|
227
|
+
processedSQL: '',
|
|
228
|
+
error: `Unexpected error during query processing: ${msg}`,
|
|
229
|
+
appliedParameters: {}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=queryParameterProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryParameterProcessor.js","sourceRoot":"","sources":["../src/queryParameterProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,wBAAwB,EAAoB,MAAM,sBAAsB,CAAC;AACjH,OAAO,QAAQ,MAAM,UAAU,CAAC;AA0ChC;;;;;;;;GAQG;AACH,MAAM,OAAO,uBAAuB;aACjB,iBAAY,GAAgC,IAAI,CAAC;aACjD,iBAAY,GAA4B,IAAI,CAAC;IAE5D;;;;OAIG;IACK,MAAM,KAAK,WAAW;QAC1B,MAAM,eAAe,GAAG,wBAAwB,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACnE,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,KAAK,eAAe,EAAE,CAAC;YAC9D,IAAI,CAAC,YAAY,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE;gBAC/C,UAAU,EAAE,KAAK;gBACjB,gBAAgB,EAAE,IAAI;gBACtB,UAAU,EAAE,IAAI;gBAChB,YAAY,EAAE,IAAI;aACrB,CAAC,CAAC;YAEH,gEAAgE;YAChE,MAAM,aAAa,GAAG,wBAAwB,CAAC,QAAQ,CAAC;YACxD,MAAM,OAAO,GAAG,aAAa,CAAC,aAAa,EAAE,CAAC;YAE9C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;gBAC3B,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;oBACxB,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC;gBACpE,CAAC;YACL,CAAC;YACD,IAAI,CAAC,YAAY,GAAG,eAAe,CAAC;QACxC,CAAC;QACD,OAAO,IAAI,CAAC,YAAY,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AAC;QAAC,OAAO,CAAU,EAAE,CAAC;YAClB,MAAM,GAAG,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACvD,OAAO;gBACH,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,EAAE;gBAChB,KAAK,EAAE,6CAA6C,GAAG,EAAE;gBACzD,iBAAiB,EAAE,EAAE;aACxB,CAAC;QACN,CAAC;IACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/query-processor",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "5.5.0",
|
|
5
|
+
"description": "Shared query parameter validation and Nunjucks template processing for MemberJunction data providers",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"/dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc && tsc-alias -f",
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"test:watch": "vitest",
|
|
15
|
+
"test:coverage": "vitest run --coverage"
|
|
16
|
+
},
|
|
17
|
+
"author": "MemberJunction.com",
|
|
18
|
+
"license": "ISC",
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/nunjucks": "^3.2.6",
|
|
21
|
+
"typescript": "^5.9.3",
|
|
22
|
+
"vitest": "^3.1.1"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@memberjunction/core": "5.5.0",
|
|
26
|
+
"@memberjunction/global": "5.5.0",
|
|
27
|
+
"nunjucks": "^3.2.4"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/MemberJunction/MJ"
|
|
32
|
+
}
|
|
10
33
|
}
|