@memberjunction/core 5.13.0 → 5.14.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/dist/generic/QueryCacheManager.d.ts +12 -2
- package/dist/generic/QueryCacheManager.d.ts.map +1 -1
- package/dist/generic/QueryCacheManager.js +17 -3
- package/dist/generic/QueryCacheManager.js.map +1 -1
- package/dist/generic/databaseProviderBase.d.ts +7 -1
- package/dist/generic/databaseProviderBase.d.ts.map +1 -1
- package/dist/generic/databaseProviderBase.js.map +1 -1
- package/dist/generic/interfaces.d.ts +10 -0
- package/dist/generic/interfaces.d.ts.map +1 -1
- package/dist/generic/interfaces.js.map +1 -1
- package/dist/generic/providerBase.d.ts +15 -18
- package/dist/generic/providerBase.d.ts.map +1 -1
- package/dist/generic/providerBase.js +16 -30
- package/dist/generic/providerBase.js.map +1 -1
- package/dist/generic/queryExecutionSpec.d.ts +68 -0
- package/dist/generic/queryExecutionSpec.d.ts.map +1 -0
- package/dist/generic/queryExecutionSpec.js +45 -0
- package/dist/generic/queryExecutionSpec.js.map +1 -0
- package/dist/generic/runQuery.d.ts +10 -0
- package/dist/generic/runQuery.d.ts.map +1 -1
- package/dist/generic/runQuery.js +11 -0
- package/dist/generic/runQuery.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/generic/queryCompositionEngine.d.ts +0 -165
- package/dist/generic/queryCompositionEngine.d.ts.map +0 -1
- package/dist/generic/queryCompositionEngine.js +0 -464
- package/dist/generic/queryCompositionEngine.js.map +0 -1
package/dist/generic/runQuery.js
CHANGED
|
@@ -44,6 +44,17 @@ export class RunQuery {
|
|
|
44
44
|
// Simple proxy to the provider - telemetry is handled by ProviderBase Pre/Post hooks
|
|
45
45
|
return this.ProviderToUse.RunQueries(params, contextUser);
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Executes a query from a `QueryExecutionSpec` — the lower-layer interface-based entry point.
|
|
49
|
+
* Runs the full pipeline: composition resolution → Nunjucks template processing → SQL execution.
|
|
50
|
+
* Supports both saved queries (via QueryExecutionSpec.FromQueryInfo) and transient test queries.
|
|
51
|
+
* @param spec - The execution spec describing the query, parameters, and inline dependencies
|
|
52
|
+
* @param contextUser - Optional user context for permissions (mainly used server-side)
|
|
53
|
+
* @returns Query results including data rows and execution metadata
|
|
54
|
+
*/
|
|
55
|
+
async ExecuteFromSpec(spec, contextUser) {
|
|
56
|
+
return this.ProviderToUse.ExecuteQueryFromSpec(spec, contextUser);
|
|
57
|
+
}
|
|
47
58
|
static { this._globalProviderKey = 'MJ_RunQueryProvider'; }
|
|
48
59
|
/**
|
|
49
60
|
* Gets the static query provider instance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runQuery.js","sourceRoot":"","sources":["../../src/generic/runQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"runQuery.js","sourceRoot":"","sources":["../../src/generic/runQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AA+FlD;;;;GAIG;AACH,MAAM,OAAO,QAAQ;IAEjB;;OAEG;IACH,YAAY,WAAqC,IAAI;QACjD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,SAAS,IAAI,QAAQ,CAAC,QAAQ,CAAC;IAC/C,CAAC;IACD;;;;;;;;OAQG;IACI,KAAK,CAAC,QAAQ,CAAC,MAAsB,EAAE,WAAsB;QAChE,qFAAqF;QACrF,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,UAAU,CAAC,MAAwB,EAAE,WAAsB;QACpE,qFAAqF;QACrF,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,eAAe,CAAC,IAAwB,EAAE,WAAsB;QACzE,OAAO,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACtE,CAAC;aAEc,uBAAkB,GAAW,qBAAqB,CAAC;IAClE;;;;;OAKG;IACI,MAAM,KAAK,QAAQ;QACtB,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,oBAAoB,EAAE,CAAC;QACnD,IAAI,CAAC;YACD,OAAO,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;;YAEtC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IACtF,CAAC;IACD;;;;;OAKG;IACI,MAAM,KAAK,QAAQ,CAAC,KAAwB;QAC/C,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,oBAAoB,EAAE,CAAC;QACnD,IAAI,CAAC;YACD,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC;;YAEvC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IACtF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export * from "./generic/util.js";
|
|
|
15
15
|
export * from "./generic/logging.js";
|
|
16
16
|
export * from "./generic/queryInfo.js";
|
|
17
17
|
export * from "./generic/queryInfoInterfaces.js";
|
|
18
|
-
export * from "./generic/
|
|
18
|
+
export * from "./generic/queryExecutionSpec.js";
|
|
19
19
|
export * from "./generic/queryPagingEngine.js";
|
|
20
20
|
export * from "./generic/querySQLFilters.js";
|
|
21
21
|
export * from "./generic/runQuerySQLFilterImplementations.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAE3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,qBAAqB,CAAC;AAEpC,wBAAgB,WAAW,CAAC,QAAQ,KAAA,QAMnC"}
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ export * from "./generic/util.js";
|
|
|
20
20
|
export * from "./generic/logging.js";
|
|
21
21
|
export * from "./generic/queryInfo.js";
|
|
22
22
|
export * from "./generic/queryInfoInterfaces.js";
|
|
23
|
-
export * from "./generic/
|
|
23
|
+
export * from "./generic/queryExecutionSpec.js";
|
|
24
24
|
export * from "./generic/queryPagingEngine.js";
|
|
25
25
|
export * from "./generic/querySQLFilters.js";
|
|
26
26
|
export * from "./generic/runQuerySQLFilterImplementations.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C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AA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAE3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,qBAAqB,CAAC;AAEpC,MAAM,UAAU,WAAW,CAAC,QAAQ;IAChC,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC/B,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC5B,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC9B,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.14.0",
|
|
5
5
|
"description": "MemberJunction: Core Library including Metadata, Application, Entity Retrieval and Manipulation, and Utilities",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"vitest": "^3.1.1"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@memberjunction/global": "5.
|
|
29
|
+
"@memberjunction/global": "5.14.0",
|
|
30
30
|
"rxjs": "^7.8.2",
|
|
31
31
|
"zod": "~3.24.4",
|
|
32
32
|
"debug": "^4.4.3"
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { DatabasePlatform } from "./platformSQL.js";
|
|
2
|
-
import { UserInfo } from "./securityInfo.js";
|
|
3
|
-
/**
|
|
4
|
-
* Metadata about a single CTE generated during composition resolution.
|
|
5
|
-
*/
|
|
6
|
-
export interface CompositionCTEInfo {
|
|
7
|
-
/** ID of the referenced query */
|
|
8
|
-
QueryID: string;
|
|
9
|
-
/** Name of the referenced query */
|
|
10
|
-
QueryName: string;
|
|
11
|
-
/** Category path as written in the reference */
|
|
12
|
-
CategoryPath: string;
|
|
13
|
-
/** Generated CTE alias name */
|
|
14
|
-
CTEName: string;
|
|
15
|
-
/** Original SQL of the referenced query before parameter resolution */
|
|
16
|
-
OriginalSQL: string;
|
|
17
|
-
/** SQL after parameter values have been substituted */
|
|
18
|
-
ResolvedSQL: string;
|
|
19
|
-
/** Parameter values applied (key → resolved value) */
|
|
20
|
-
Parameters: Record<string, string>;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Result returned by the composition engine after resolving all {{query:"..."}} tokens.
|
|
24
|
-
*/
|
|
25
|
-
export interface CompositionResult {
|
|
26
|
-
/** The fully resolved SQL with CTEs prepended */
|
|
27
|
-
ResolvedSQL: string;
|
|
28
|
-
/** Metadata about each CTE generated */
|
|
29
|
-
CTEs: CompositionCTEInfo[];
|
|
30
|
-
/** Directed dependency graph: queryId → [dependsOnQueryIds] */
|
|
31
|
-
DependencyGraph: Map<string, string[]>;
|
|
32
|
-
/** Whether any composition tokens were found and resolved */
|
|
33
|
-
HasCompositions: boolean;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Parsed representation of a single {{query:"..."}} token found in SQL.
|
|
37
|
-
*/
|
|
38
|
-
interface ParsedCompositionToken {
|
|
39
|
-
/** The full original token text including {{ and }} */
|
|
40
|
-
FullToken: string;
|
|
41
|
-
/** Category path segments (everything before the query name) */
|
|
42
|
-
CategorySegments: string[];
|
|
43
|
-
/** The query name (last path segment) */
|
|
44
|
-
QueryName: string;
|
|
45
|
-
/** Full path as written (CategorySegments joined with /) */
|
|
46
|
-
FullPath: string;
|
|
47
|
-
/** Parsed parameter mappings */
|
|
48
|
-
Parameters: ParsedParameter[];
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* A single parameter from a composition reference.
|
|
52
|
-
*/
|
|
53
|
-
interface ParsedParameter {
|
|
54
|
-
/** Parameter name */
|
|
55
|
-
Name: string;
|
|
56
|
-
/** If quoted literal: the static value. Otherwise null. */
|
|
57
|
-
StaticValue: string | null;
|
|
58
|
-
/** If bare name: the pass-through parameter name from the outer query. Otherwise null. */
|
|
59
|
-
PassThroughName: string | null;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* QueryCompositionEngine resolves {{query:"CategoryPath/QueryName(params)"}} tokens
|
|
63
|
-
* in query SQL into Common Table Expressions (CTEs). It handles:
|
|
64
|
-
*
|
|
65
|
-
* - Recursive resolution of nested compositions
|
|
66
|
-
* - Cycle detection via an in-progress set
|
|
67
|
-
* - Parameter modes: static literals and pass-through from outer query
|
|
68
|
-
* - Deduplication of identical query+params references
|
|
69
|
-
* - Platform-aware SQL resolution via QueryInfo.GetPlatformSQL()
|
|
70
|
-
*
|
|
71
|
-
* This engine runs BEFORE Nunjucks template processing, so regular {{param}}
|
|
72
|
-
* tokens are preserved for later substitution.
|
|
73
|
-
*/
|
|
74
|
-
export declare class QueryCompositionEngine {
|
|
75
|
-
/**
|
|
76
|
-
* Checks whether SQL contains any {{query:"..."}} composition tokens.
|
|
77
|
-
* Use this as a fast guard before calling ResolveComposition().
|
|
78
|
-
* Only considers tokens outside of SQL comments.
|
|
79
|
-
*/
|
|
80
|
-
HasCompositionTokens(sql: string): boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Parses all {{query:"..."}} tokens from SQL without resolving them.
|
|
83
|
-
* Useful for dependency extraction during the save pipeline.
|
|
84
|
-
* Only considers tokens outside of SQL comments.
|
|
85
|
-
*
|
|
86
|
-
* @param sql - The SQL text to parse
|
|
87
|
-
* @returns Array of parsed token metadata
|
|
88
|
-
*/
|
|
89
|
-
ParseCompositionTokens(sql: string): ParsedCompositionToken[];
|
|
90
|
-
/**
|
|
91
|
-
* Resolves all {{query:"..."}} composition tokens in the given SQL into CTEs.
|
|
92
|
-
*
|
|
93
|
-
* @param sql - The SQL containing composition tokens
|
|
94
|
-
* @param platform - Target database platform for SQL resolution
|
|
95
|
-
* @param contextUser - User context for permission checks on referenced queries
|
|
96
|
-
* @param outerParams - Parameter values from the outer/parent query (for pass-through resolution)
|
|
97
|
-
* @returns CompositionResult with fully resolved SQL and provenance metadata
|
|
98
|
-
* @throws Error if a referenced query is not found, not composable, or creates a cycle
|
|
99
|
-
*/
|
|
100
|
-
ResolveComposition(sql: string, platform: DatabasePlatform, contextUser: UserInfo, outerParams?: Record<string, string>): CompositionResult;
|
|
101
|
-
/**
|
|
102
|
-
* Recursively resolves composition tokens in SQL, building up CTE entries.
|
|
103
|
-
*/
|
|
104
|
-
private resolveTokensRecursive;
|
|
105
|
-
/**
|
|
106
|
-
* Parses the content inside a {{query:"..."}} token.
|
|
107
|
-
*/
|
|
108
|
-
private parseTokenContent;
|
|
109
|
-
/**
|
|
110
|
-
* Splits parameter string by commas, respecting quoted values.
|
|
111
|
-
*/
|
|
112
|
-
private splitParams;
|
|
113
|
-
/**
|
|
114
|
-
* Looks up a query by category path + name in the metadata provider.
|
|
115
|
-
*/
|
|
116
|
-
private lookupQuery;
|
|
117
|
-
/**
|
|
118
|
-
* Validates that a referenced query is eligible for composition.
|
|
119
|
-
*/
|
|
120
|
-
private validateQueryComposable;
|
|
121
|
-
/**
|
|
122
|
-
* Resolves parameter values for a composition reference.
|
|
123
|
-
* Static values are used directly; pass-through values are looked up from outer params.
|
|
124
|
-
*/
|
|
125
|
-
private resolveParameters;
|
|
126
|
-
/**
|
|
127
|
-
* Substitutes resolved parameter values into a query's SQL.
|
|
128
|
-
* - Static values: replaces {{paramName}} with 'value'
|
|
129
|
-
* - Pass-through values: renames {{paramName}} to {{outerParamName}} so
|
|
130
|
-
* the downstream Nunjucks processor can resolve it from the outer query's parameters.
|
|
131
|
-
*/
|
|
132
|
-
private substituteStaticParams;
|
|
133
|
-
/**
|
|
134
|
-
* Builds a deduplication key for a CTE based on query ID and sorted parameter values.
|
|
135
|
-
*/
|
|
136
|
-
private buildDeduplicationKey;
|
|
137
|
-
/**
|
|
138
|
-
* Generates a SQL-safe CTE name from the query name + short hash for uniqueness.
|
|
139
|
-
*/
|
|
140
|
-
private generateCTEName;
|
|
141
|
-
/**
|
|
142
|
-
* Simple string hash for generating short, deterministic suffixes.
|
|
143
|
-
*/
|
|
144
|
-
private simpleHash;
|
|
145
|
-
/**
|
|
146
|
-
* Assembles CTE entries into a WITH clause prepended to the main SQL.
|
|
147
|
-
*/
|
|
148
|
-
private assembleCTEs;
|
|
149
|
-
/**
|
|
150
|
-
* Strips a trailing ORDER BY clause from SQL that will be wrapped in a CTE.
|
|
151
|
-
* SQL Server (and the SQL standard) disallows ORDER BY inside CTEs unless
|
|
152
|
-
* TOP, OFFSET, or FOR XML is also present. Since reusable queries often
|
|
153
|
-
* include ORDER BY for standalone use, we must remove it when composing.
|
|
154
|
-
*/
|
|
155
|
-
private stripTrailingOrderBy;
|
|
156
|
-
/**
|
|
157
|
-
* Strips SQL comments from the input string so that composition tokens
|
|
158
|
-
* inside comments are not treated as real references.
|
|
159
|
-
* Handles both single-line (-- ...) and multi-line block comments.
|
|
160
|
-
* Preserves string literals (single-quoted) to avoid stripping inside them.
|
|
161
|
-
*/
|
|
162
|
-
private stripSQLComments;
|
|
163
|
-
}
|
|
164
|
-
export {};
|
|
165
|
-
//# sourceMappingURL=queryCompositionEngine.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queryCompositionEngine.d.ts","sourceRoot":"","sources":["../../src/generic/queryCompositionEngine.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA0B1C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,+DAA+D;IAC/D,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACvC,6DAA6D;IAC7D,eAAe,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,UAAU,sBAAsB;IAC5B,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,UAAU,EAAE,eAAe,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,UAAU,e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