@malloydata/malloy 0.0.362 → 0.0.363
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/api/core.js +21 -3
- package/dist/api/foundation/compile.js +20 -0
- package/dist/api/foundation/runtime.d.ts +16 -4
- package/dist/api/foundation/runtime.js +22 -4
- package/dist/api/foundation/types.d.ts +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/lang/ast/index.d.ts +5 -0
- package/dist/lang/ast/index.js +5 -0
- package/dist/lang/ast/source-elements/named-source.js +4 -0
- package/dist/lang/ast/source-elements/typed-source.d.ts +23 -0
- package/dist/lang/ast/source-elements/typed-source.js +133 -0
- package/dist/lang/ast/source-elements/virtual-source.d.ts +10 -0
- package/dist/lang/ast/source-elements/virtual-source.js +47 -0
- package/dist/lang/ast/source-properties/user-type-shape.d.ts +29 -0
- package/dist/lang/ast/source-properties/user-type-shape.js +100 -0
- package/dist/lang/ast/source-query-elements/sq-reference.js +1 -1
- package/dist/lang/ast/source-query-elements/sq-typed-source.d.ts +18 -0
- package/dist/lang/ast/source-query-elements/sq-typed-source.js +39 -0
- package/dist/lang/ast/statements/define-user-type.d.ts +28 -0
- package/dist/lang/ast/statements/define-user-type.js +82 -0
- package/dist/lang/ast/types/malloy-element.js +14 -6
- package/dist/lang/lib/Malloy/MalloyLexer.d.ts +146 -144
- package/dist/lang/lib/Malloy/MalloyLexer.js +1408 -1391
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +491 -307
- package/dist/lang/lib/Malloy/MalloyParser.js +7907 -6680
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +186 -0
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +117 -0
- package/dist/lang/malloy-to-ast.d.ts +17 -0
- package/dist/lang/malloy-to-ast.js +118 -0
- package/dist/lang/parse-log.d.ts +12 -1
- package/dist/lang/parse-malloy.d.ts +6 -1
- package/dist/lang/parse-malloy.js +17 -1
- package/dist/lang/parse-tree-walkers/find-external-references.d.ts +4 -0
- package/dist/lang/parse-tree-walkers/find-external-references.js +10 -0
- package/dist/lang/test/test-translator.d.ts +2 -1
- package/dist/lang/test/test-translator.js +10 -0
- package/dist/lang/translate-response.d.ts +6 -1
- package/dist/lang/translate-response.js +3 -1
- package/dist/model/malloy_types.d.ts +23 -2
- package/dist/model/malloy_types.js +12 -2
- package/dist/model/query_model_impl.js +3 -0
- package/dist/model/query_query.js +11 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
package/dist/lang/parse-log.d.ts
CHANGED
|
@@ -223,6 +223,9 @@ type MessageParameterTypes = {
|
|
|
223
223
|
'invalid-source-from-query': string;
|
|
224
224
|
'invalid-source-from-function': string;
|
|
225
225
|
'invalid-source-from-connection': string;
|
|
226
|
+
'invalid-source-from-user-type': string;
|
|
227
|
+
'user-type-not-found': string;
|
|
228
|
+
'not-a-user-type': string;
|
|
226
229
|
'invalid-source-source': string;
|
|
227
230
|
'unnamed-source-argument': string;
|
|
228
231
|
'duplicate-source-argument': string;
|
|
@@ -249,10 +252,11 @@ type MessageParameterTypes = {
|
|
|
249
252
|
'failed-to-compute-arrow-source': string;
|
|
250
253
|
'failed-to-compute-source-from-query': string;
|
|
251
254
|
'failed-to-compute-source-to-extend': string;
|
|
255
|
+
'failed-to-compute-source-to-type': string;
|
|
252
256
|
'cannot-use-as-query': string;
|
|
253
257
|
'source-or-query-not-found': string;
|
|
254
258
|
'illegal-query-argument': string;
|
|
255
|
-
'cannot-use-
|
|
259
|
+
'cannot-use-user-type-as-source': string;
|
|
256
260
|
'illegal-refinement-of-source': string;
|
|
257
261
|
'invalid-source-as-query': string;
|
|
258
262
|
'invalid-sql-source-interpolation': string;
|
|
@@ -260,6 +264,13 @@ type MessageParameterTypes = {
|
|
|
260
264
|
'query-definition-name-conflict': string;
|
|
261
265
|
'query-definition-from-non-query': string;
|
|
262
266
|
'source-definition-name-conflict': string;
|
|
267
|
+
'user-type-definition-name-conflict': string;
|
|
268
|
+
'virtual-source-not-yet-implemented': string;
|
|
269
|
+
'virtual-source-missing-user-type-refs': string;
|
|
270
|
+
'virtual-source-unknown-dialect': string;
|
|
271
|
+
'user-type-field-missing': string;
|
|
272
|
+
'user-type-type-mismatch': string;
|
|
273
|
+
'user-type-field-conflict': string;
|
|
263
274
|
'parameter-name-conflict': string;
|
|
264
275
|
'parameter-shadowing-field': string;
|
|
265
276
|
'invalid-import-url': string;
|
|
@@ -197,6 +197,7 @@ export declare class MalloyTranslator extends MalloyTranslation {
|
|
|
197
197
|
importZone: Zone<string>;
|
|
198
198
|
pretranslatedModels: Map<string, ModelDef>;
|
|
199
199
|
sqlQueryZone: Zone<SQLSourceDef>;
|
|
200
|
+
connectionDialectZone: Zone<string>;
|
|
200
201
|
logger: BaseMessageLogger;
|
|
201
202
|
readonly root: MalloyTranslator;
|
|
202
203
|
constructor(rootURL: string, importURL?: string | null, preload?: ParseUpdate | null, eventStream?: EventStream | null);
|
|
@@ -208,6 +209,7 @@ interface ErrorData {
|
|
|
208
209
|
urls: Record<string, string>;
|
|
209
210
|
compileSQL: Record<string, string>;
|
|
210
211
|
translations: Record<string, string>;
|
|
212
|
+
connectionDialects: Record<string, string>;
|
|
211
213
|
}
|
|
212
214
|
export interface URLData {
|
|
213
215
|
urls: ZoneData<string>;
|
|
@@ -221,7 +223,10 @@ export interface SchemaData {
|
|
|
221
223
|
export interface SQLSources {
|
|
222
224
|
compileSQL: ZoneData<SQLSourceDef>;
|
|
223
225
|
}
|
|
224
|
-
export interface
|
|
226
|
+
export interface ConnectionDialects {
|
|
227
|
+
connectionDialects: ZoneData<string>;
|
|
228
|
+
}
|
|
229
|
+
export interface UpdateData extends URLData, SchemaData, SQLSources, ModelData, ConnectionDialects {
|
|
225
230
|
errors: Partial<ErrorData>;
|
|
226
231
|
}
|
|
227
232
|
export type ParseUpdate = Partial<UpdateData>;
|
|
@@ -146,6 +146,12 @@ class ImportsAndTablesStep {
|
|
|
146
146
|
range: this.parseReferences.tables[ref].firstReference,
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
+
for (const connName in this.parseReferences.connectionDialects) {
|
|
150
|
+
that.root.connectionDialectZone.reference(connName, {
|
|
151
|
+
url: that.sourceURL,
|
|
152
|
+
range: this.parseReferences.connectionDialects[connName].firstReference,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
149
155
|
for (const relativeRef in this.parseReferences.urls) {
|
|
150
156
|
const firstRef = this.parseReferences.urls[relativeRef];
|
|
151
157
|
try {
|
|
@@ -186,6 +192,14 @@ class ImportsAndTablesStep {
|
|
|
186
192
|
}
|
|
187
193
|
allMissing = { tables };
|
|
188
194
|
}
|
|
195
|
+
const missingDialects = that.root.connectionDialectZone.getUndefined();
|
|
196
|
+
if (missingDialects) {
|
|
197
|
+
const connectionDialects = {};
|
|
198
|
+
for (const connName of missingDialects) {
|
|
199
|
+
connectionDialects[connName] = { connectionName: connName };
|
|
200
|
+
}
|
|
201
|
+
allMissing = { ...allMissing, connectionDialects };
|
|
202
|
+
}
|
|
189
203
|
const missingImports = ((_a = that.root.importZone.getUndefined()) !== null && _a !== void 0 ? _a : []).filter(url => that.root.pretranslatedModels.get(url) === undefined);
|
|
190
204
|
if (missingImports.length > 0) {
|
|
191
205
|
allMissing = {
|
|
@@ -784,6 +798,7 @@ class MalloyTranslator extends MalloyTranslation {
|
|
|
784
798
|
this.importZone = new zone_1.Zone();
|
|
785
799
|
this.pretranslatedModels = new Map();
|
|
786
800
|
this.sqlQueryZone = new zone_1.Zone();
|
|
801
|
+
this.connectionDialectZone = new zone_1.Zone();
|
|
787
802
|
this.root = this;
|
|
788
803
|
this.logger = new parse_log_1.BaseMessageLogger(eventStream);
|
|
789
804
|
if (preload) {
|
|
@@ -791,10 +806,11 @@ class MalloyTranslator extends MalloyTranslation {
|
|
|
791
806
|
}
|
|
792
807
|
}
|
|
793
808
|
update(dd) {
|
|
794
|
-
var _a, _b, _c;
|
|
809
|
+
var _a, _b, _c, _d;
|
|
795
810
|
this.schemaZone.updateFrom(dd.tables, (_a = dd.errors) === null || _a === void 0 ? void 0 : _a.tables);
|
|
796
811
|
this.importZone.updateFrom(dd.urls, (_b = dd.errors) === null || _b === void 0 ? void 0 : _b.urls);
|
|
797
812
|
this.sqlQueryZone.updateFrom(dd.compileSQL, (_c = dd.errors) === null || _c === void 0 ? void 0 : _c.compileSQL);
|
|
813
|
+
this.connectionDialectZone.updateFrom(dd.connectionDialects, (_d = dd.errors) === null || _d === void 0 ? void 0 : _d.connectionDialects);
|
|
798
814
|
for (const url in dd.translations) {
|
|
799
815
|
this.pretranslatedModels.set(url, dd.translations[url]);
|
|
800
816
|
}
|
|
@@ -8,6 +8,9 @@ type NeedTables = Record<string, {
|
|
|
8
8
|
tablePath: string;
|
|
9
9
|
firstReference: DocumentRange;
|
|
10
10
|
}>;
|
|
11
|
+
type NeedConnectionDialects = Record<string, {
|
|
12
|
+
firstReference: DocumentRange;
|
|
13
|
+
}>;
|
|
11
14
|
export declare function constructTableKey(connectionName: string | undefined, tablePath: string): string;
|
|
12
15
|
/**
|
|
13
16
|
* This function parses an old-style `tableURI` into a connection name and
|
|
@@ -25,6 +28,7 @@ export declare function deprecatedParseTableURI(tableURI: string): {
|
|
|
25
28
|
export interface FindReferencesData {
|
|
26
29
|
tables: NeedTables;
|
|
27
30
|
urls: NeedImports;
|
|
31
|
+
connectionDialects: NeedConnectionDialects;
|
|
28
32
|
}
|
|
29
33
|
export declare function findReferences(trans: MalloyTranslation, tokens: CommonTokenStream, parseTree: ParseTree): FindReferencesData;
|
|
30
34
|
export {};
|
|
@@ -53,6 +53,7 @@ class FindExternalReferences {
|
|
|
53
53
|
this.tokens = tokens;
|
|
54
54
|
this.needTables = {};
|
|
55
55
|
this.needImports = {};
|
|
56
|
+
this.needConnectionDialects = {};
|
|
56
57
|
}
|
|
57
58
|
registerTableReference(connectionName, tablePath, reference) {
|
|
58
59
|
const key = constructTableKey(connectionName, tablePath);
|
|
@@ -70,6 +71,14 @@ class FindExternalReferences {
|
|
|
70
71
|
const reference = this.trans.rangeFromContext(pcx);
|
|
71
72
|
this.registerTableReference(connId, tablePath, reference);
|
|
72
73
|
}
|
|
74
|
+
enterVirtualSource(pcx) {
|
|
75
|
+
const connId = (0, parse_utils_1.getId)(pcx.connectionId());
|
|
76
|
+
if (connId && !this.needConnectionDialects[connId]) {
|
|
77
|
+
this.needConnectionDialects[connId] = {
|
|
78
|
+
firstReference: this.trans.rangeFromContext(pcx),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
73
82
|
enterImportURL(pcx) {
|
|
74
83
|
const url = getPlainString(pcx);
|
|
75
84
|
if (!this.needImports[url]) {
|
|
@@ -108,6 +117,7 @@ function findReferences(trans, tokens, parseTree) {
|
|
|
108
117
|
return {
|
|
109
118
|
tables: finder.needTables,
|
|
110
119
|
urls: finder.needImports,
|
|
120
|
+
connectionDialects: finder.needConnectionDialects,
|
|
111
121
|
};
|
|
112
122
|
}
|
|
113
123
|
//# sourceMappingURL=find-external-references.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DocumentLocation, FieldDef, ModelDef, NamedModelObject, PipeSegment, Query, QueryFieldDef, StructDef, TurtleDef, SourceDef, TableSourceDef, SQLSourceDef } from '../../model/malloy_types';
|
|
1
|
+
import type { DocumentLocation, FieldDef, ModelDef, NamedModelObject, PipeSegment, Query, QueryFieldDef, StructDef, TurtleDef, SourceDef, TableSourceDef, SQLSourceDef, UserTypeDef } from '../../model/malloy_types';
|
|
2
2
|
import { MalloyElement } from '../ast';
|
|
3
3
|
import type { NameSpace } from '../ast/types/name-space';
|
|
4
4
|
import type { ModelEntry } from '../ast/types/model-entry';
|
|
@@ -59,6 +59,7 @@ export declare class TestTranslator extends MalloyTranslator {
|
|
|
59
59
|
unresolved(): DataRequestResponse;
|
|
60
60
|
getSourceDef(srcName: string): SourceDef | undefined;
|
|
61
61
|
getQuery(queryName: string | number): Query | undefined;
|
|
62
|
+
getUserTypeDef(name: string): UserTypeDef | undefined;
|
|
62
63
|
}
|
|
63
64
|
export declare class BetaExpression extends TestTranslator {
|
|
64
65
|
readonly sourceName: string;
|
|
@@ -423,6 +423,8 @@ class TestTranslator extends parse_malloy_1.MalloyTranslator {
|
|
|
423
423
|
for (const actualSchema of exports.mockSchema) {
|
|
424
424
|
this.schemaZone.define(`${actualSchema.connection}:${actualSchema.tablePath}`, actualSchema);
|
|
425
425
|
}
|
|
426
|
+
this.connectionDialectZone.define('_db_', exports.TEST_DIALECT);
|
|
427
|
+
this.connectionDialectZone.define('_bq_', 'standardsql');
|
|
426
428
|
}
|
|
427
429
|
translate() {
|
|
428
430
|
return super.translate(this.internalModel);
|
|
@@ -518,6 +520,14 @@ class TestTranslator extends parse_malloy_1.MalloyTranslator {
|
|
|
518
520
|
}
|
|
519
521
|
return undefined;
|
|
520
522
|
}
|
|
523
|
+
getUserTypeDef(name) {
|
|
524
|
+
const t = this.translate().modelDef;
|
|
525
|
+
const s = t === null || t === void 0 ? void 0 : t.contents[name];
|
|
526
|
+
if (s && (0, malloy_types_1.isUserTypeDef)(s)) {
|
|
527
|
+
return s;
|
|
528
|
+
}
|
|
529
|
+
return undefined;
|
|
530
|
+
}
|
|
521
531
|
}
|
|
522
532
|
exports.TestTranslator = TestTranslator;
|
|
523
533
|
TestTranslator.inspectCompile = false;
|
|
@@ -36,7 +36,12 @@ export interface SQLSourceRequest {
|
|
|
36
36
|
export interface NeedCompileSQL {
|
|
37
37
|
compileSQL: SQLSourceRequest;
|
|
38
38
|
}
|
|
39
|
-
interface
|
|
39
|
+
export interface NeedConnectionDialects {
|
|
40
|
+
connectionDialects: Record<string, {
|
|
41
|
+
connectionName: string;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
44
|
+
interface NeededData extends NeedURLData, NeedSchemaData, NeedCompileSQL, NeedConnectionDialects {
|
|
40
45
|
}
|
|
41
46
|
export type DataRequestResponse = Partial<NeededData> & ResponseBase;
|
|
42
47
|
export declare function isNeedResponse(dr: DataRequestResponse): dr is NeededData;
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.isNeedResponse = isNeedResponse;
|
|
26
26
|
function isNeedResponse(dr) {
|
|
27
|
-
return !!dr &&
|
|
27
|
+
return (!!dr &&
|
|
28
|
+
(dr.tables || dr.urls || dr.compileSQL || dr.connectionDialects) !==
|
|
29
|
+
undefined);
|
|
28
30
|
}
|
|
29
31
|
//# sourceMappingURL=translate-response.js.map
|
|
@@ -728,6 +728,9 @@ export interface CompositeSourceDef extends SourceDefBase {
|
|
|
728
728
|
type: 'composite';
|
|
729
729
|
sources: SourceDef[];
|
|
730
730
|
}
|
|
731
|
+
export interface VirtualSourceDef extends SourceDefBase {
|
|
732
|
+
type: 'virtual';
|
|
733
|
+
}
|
|
731
734
|
export interface SQLStringSegment {
|
|
732
735
|
sql: string;
|
|
733
736
|
}
|
|
@@ -797,7 +800,7 @@ export declare function isSourceDef(sd: NamedModelObject | FieldDef): sd is Sour
|
|
|
797
800
|
* These factories explicitly copy only safe fields, preventing accidental
|
|
798
801
|
* propagation of sourceID/extends which must only be set in DefineSource.
|
|
799
802
|
*/
|
|
800
|
-
export type SourceDef = TableSourceDef | SQLSourceDef | QuerySourceDef | QueryResultDef | FinalizeSourceDef | NestSourceDef | CompositeSourceDef;
|
|
803
|
+
export type SourceDef = TableSourceDef | SQLSourceDef | QuerySourceDef | QueryResultDef | FinalizeSourceDef | NestSourceDef | VirtualSourceDef | CompositeSourceDef;
|
|
801
804
|
/** Sources that can be persisted (materialized to tables) */
|
|
802
805
|
export type PersistableSourceDef = SQLSourceDef | QuerySourceDef;
|
|
803
806
|
export declare function isPersistableSourceDef(sd: SourceDef): sd is PersistableSourceDef;
|
|
@@ -953,7 +956,18 @@ export type QueryFieldDef = AtomicFieldDef | TurtleDef | RefToField;
|
|
|
953
956
|
export type TypedDef = AtomicTypeDef | JoinFieldDef | TurtleDef | RefToField | StructDef;
|
|
954
957
|
/** Get the output name for a NamedObject */
|
|
955
958
|
export declare function getIdentifier(n: AliasedName): string;
|
|
956
|
-
export
|
|
959
|
+
export interface UserTypeFieldDef {
|
|
960
|
+
name: string;
|
|
961
|
+
typeDef: AtomicTypeDef;
|
|
962
|
+
annotation?: Annotation;
|
|
963
|
+
}
|
|
964
|
+
export interface UserTypeDef extends NamedObject {
|
|
965
|
+
type: 'userType';
|
|
966
|
+
fields: UserTypeFieldDef[];
|
|
967
|
+
annotation?: Annotation;
|
|
968
|
+
}
|
|
969
|
+
export declare function isUserTypeDef(sd: NamedModelObject): sd is UserTypeDef;
|
|
970
|
+
export type NamedModelObject = SourceDef | NamedQueryDef | FunctionDef | ConnectionDef | UserTypeDef;
|
|
957
971
|
export interface DependencyTree {
|
|
958
972
|
[url: string]: DependencyTree;
|
|
959
973
|
}
|
|
@@ -1069,6 +1083,11 @@ export interface SearchValueMapResult {
|
|
|
1069
1083
|
weight: number;
|
|
1070
1084
|
}[];
|
|
1071
1085
|
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Maps virtual source names to actual table paths, keyed by connection name.
|
|
1088
|
+
* Uses Map instead of Record because both keys are user-provided strings.
|
|
1089
|
+
*/
|
|
1090
|
+
export type VirtualMap = Map<string, Map<string, string>>;
|
|
1072
1091
|
export interface PrepareResultOptions {
|
|
1073
1092
|
defaultRowLimit?: number;
|
|
1074
1093
|
isPartialQuery?: boolean;
|
|
@@ -1077,6 +1096,8 @@ export interface PrepareResultOptions {
|
|
|
1077
1096
|
buildManifest?: BuildManifest;
|
|
1078
1097
|
/** Map from connectionName to connectionDigest (from Connection.getDigest()) */
|
|
1079
1098
|
connectionDigests?: SafeRecord<string>;
|
|
1099
|
+
/** Map from connectionName → virtualName → tablePath for virtual source resolution */
|
|
1100
|
+
virtualMap?: VirtualMap;
|
|
1080
1101
|
}
|
|
1081
1102
|
type UTD = AtomicTypeDef | TypedDef | FunctionParameterTypeDef | FunctionReturnTypeDef | undefined;
|
|
1082
1103
|
/**
|
|
@@ -89,6 +89,7 @@ exports.isLiteral = isLiteral;
|
|
|
89
89
|
exports.mergeEvalSpaces = mergeEvalSpaces;
|
|
90
90
|
exports.isBasicAtomic = isBasicAtomic;
|
|
91
91
|
exports.getIdentifier = getIdentifier;
|
|
92
|
+
exports.isUserTypeDef = isUserTypeDef;
|
|
92
93
|
exports.isCompoundArrayData = isCompoundArrayData;
|
|
93
94
|
exports.isTurtle = isTurtle;
|
|
94
95
|
exports.isAtomic = isAtomic;
|
|
@@ -478,6 +479,7 @@ function isSourceDef(sd) {
|
|
|
478
479
|
sd.type === 'query_result' ||
|
|
479
480
|
sd.type === 'finalize' ||
|
|
480
481
|
sd.type === 'nest_source' ||
|
|
482
|
+
sd.type === 'virtual' ||
|
|
481
483
|
sd.type === 'composite');
|
|
482
484
|
}
|
|
483
485
|
function isPersistableSourceDef(sd) {
|
|
@@ -524,6 +526,9 @@ function getIdentifier(n) {
|
|
|
524
526
|
}
|
|
525
527
|
return n.name;
|
|
526
528
|
}
|
|
529
|
+
function isUserTypeDef(sd) {
|
|
530
|
+
return sd.type === 'userType';
|
|
531
|
+
}
|
|
527
532
|
/** Type guard: is this array value compound (array of records) vs basic (array of scalars)? */
|
|
528
533
|
function isCompoundArrayData(v) {
|
|
529
534
|
return (Array.isArray(v) &&
|
|
@@ -585,7 +590,12 @@ exports.TD = {
|
|
|
585
590
|
}
|
|
586
591
|
function checkFields(a, b) {
|
|
587
592
|
const aSchema = {};
|
|
588
|
-
|
|
593
|
+
const aFields = a['fields'] || [];
|
|
594
|
+
const bFields = b['fields'] || [];
|
|
595
|
+
if (aFields.length !== bFields.length) {
|
|
596
|
+
return false;
|
|
597
|
+
}
|
|
598
|
+
for (const aEnt of aFields) {
|
|
589
599
|
if (aEnt.name) {
|
|
590
600
|
aSchema[aEnt.name] = aEnt;
|
|
591
601
|
}
|
|
@@ -593,7 +603,7 @@ exports.TD = {
|
|
|
593
603
|
return false;
|
|
594
604
|
}
|
|
595
605
|
}
|
|
596
|
-
for (const bEnt of
|
|
606
|
+
for (const bEnt of bFields) {
|
|
597
607
|
if (!exports.TD.eq(aSchema[bEnt.name], bEnt)) {
|
|
598
608
|
return false;
|
|
599
609
|
}
|
|
@@ -514,10 +514,18 @@ class QueryQuery extends query_node_1.QueryField {
|
|
|
514
514
|
return outputStruct;
|
|
515
515
|
}
|
|
516
516
|
getStructSourceSQL(qs, stageWriter) {
|
|
517
|
-
var _a, _b;
|
|
517
|
+
var _a, _b, _c, _d;
|
|
518
518
|
switch (qs.structDef.type) {
|
|
519
519
|
case 'table':
|
|
520
520
|
return this.parent.dialect.quoteTablePath(qs.structDef.tablePath);
|
|
521
|
+
case 'virtual': {
|
|
522
|
+
const virtualMap = (_a = qs.prepareResultOptions) === null || _a === void 0 ? void 0 : _a.virtualMap;
|
|
523
|
+
const tablePath = (_b = virtualMap === null || virtualMap === void 0 ? void 0 : virtualMap.get(qs.structDef.connection)) === null || _b === void 0 ? void 0 : _b.get(qs.structDef.name);
|
|
524
|
+
if (!tablePath) {
|
|
525
|
+
throw new Error(`No virtual map entry for '${qs.structDef.name}' on connection '${qs.structDef.connection}'`);
|
|
526
|
+
}
|
|
527
|
+
return this.parent.dialect.quoteTablePath(tablePath);
|
|
528
|
+
}
|
|
521
529
|
case 'composite':
|
|
522
530
|
// TODO: throw an error here; not simple because we call into this
|
|
523
531
|
// code currently before the composite source is resolved in some cases
|
|
@@ -525,7 +533,7 @@ class QueryQuery extends query_node_1.QueryField {
|
|
|
525
533
|
case 'finalize':
|
|
526
534
|
return qs.structDef.name;
|
|
527
535
|
case 'sql_select':
|
|
528
|
-
return `(${(0, sql_compiled_1.getCompiledSQL)(qs.structDef, (
|
|
536
|
+
return `(${(0, sql_compiled_1.getCompiledSQL)(qs.structDef, (_c = qs.prepareResultOptions) !== null && _c !== void 0 ? _c : {}, path => this.parent.dialect.quoteTablePath(path), (query, opts) => {
|
|
529
537
|
// Compile query to isolated SQL (not into parent's stageWriter)
|
|
530
538
|
const ret = this.compileQueryToStages(query, opts !== null && opts !== void 0 ? opts : {}, undefined, false);
|
|
531
539
|
return ret.sql;
|
|
@@ -533,7 +541,7 @@ class QueryQuery extends query_node_1.QueryField {
|
|
|
533
541
|
case 'nest_source':
|
|
534
542
|
return qs.structDef.pipeSQL;
|
|
535
543
|
case 'query_source': {
|
|
536
|
-
const { buildManifest, connectionDigests } = (
|
|
544
|
+
const { buildManifest, connectionDigests } = (_d = qs.prepareResultOptions) !== null && _d !== void 0 ? _d : {};
|
|
537
545
|
// Check manifest for this source
|
|
538
546
|
if (buildManifest && connectionDigests) {
|
|
539
547
|
const connDigest = (0, malloy_types_1.safeRecordGet)(connectionDigests, qs.structDef.connection);
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MALLOY_VERSION = "0.0.
|
|
1
|
+
export declare const MALLOY_VERSION = "0.0.363";
|
package/dist/version.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MALLOY_VERSION = void 0;
|
|
4
4
|
// generated with 'generate-version-file' script; do not edit manually
|
|
5
|
-
exports.MALLOY_VERSION = '0.0.
|
|
5
|
+
exports.MALLOY_VERSION = '0.0.363';
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/malloy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.363",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"generate-version-file": "VERSION=$(npm pkg get version --workspaces=false | tr -d \\\")\necho \"// generated with 'generate-version-file' script; do not edit manually\\nexport const MALLOY_VERSION = '$VERSION';\" > src/version.ts"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@malloydata/malloy-filter": "0.0.
|
|
51
|
-
"@malloydata/malloy-interfaces": "0.0.
|
|
52
|
-
"@malloydata/malloy-tag": "0.0.
|
|
50
|
+
"@malloydata/malloy-filter": "0.0.363",
|
|
51
|
+
"@malloydata/malloy-interfaces": "0.0.363",
|
|
52
|
+
"@malloydata/malloy-tag": "0.0.363",
|
|
53
53
|
"@noble/hashes": "^1.8.0",
|
|
54
54
|
"antlr4ts": "^0.5.0-alpha.4",
|
|
55
55
|
"assert": "^2.0.0",
|