@malloydata/malloy 0.0.5 → 0.0.6-221108175803
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/lang/ast/ast-main.js +6 -0
- package/dist/lang/test/parse.spec.js +24 -1
- package/package.json +1 -1
- package/dist/lang/lib/Malloy/MalloyListener.d.ts +0 -2026
- package/dist/lang/lib/Malloy/MalloyListener.js +0 -4
- package/dist/lang/lib/Malloy/MalloyVisitor.d.ts +0 -1276
- package/dist/lang/lib/Malloy/MalloyVisitor.js +0 -4
- package/dist/md5.d.ts +0 -1
- package/dist/md5.js +0 -30
|
@@ -616,6 +616,12 @@ class NamedSource extends Mallobj {
|
|
|
616
616
|
if (this.isBlock) {
|
|
617
617
|
return this.structDef();
|
|
618
618
|
}
|
|
619
|
+
const modelEnt = this.modelEntry(this.ref);
|
|
620
|
+
if (modelEnt && !modelEnt.exported) {
|
|
621
|
+
// If we are not exporting the referenced structdef, don't
|
|
622
|
+
// use the reference
|
|
623
|
+
return this.structDef();
|
|
624
|
+
}
|
|
619
625
|
return this.refName;
|
|
620
626
|
}
|
|
621
627
|
modelStruct() {
|
|
@@ -61,7 +61,7 @@ class BetaModel extends Testable {
|
|
|
61
61
|
const s = typeof queryName == "string"
|
|
62
62
|
? t.modelDef.contents[queryName]
|
|
63
63
|
: t.queryList[queryName];
|
|
64
|
-
if (s.type == "query") {
|
|
64
|
+
if ((s === null || s === void 0 ? void 0 : s.type) == "query") {
|
|
65
65
|
return s;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -498,6 +498,29 @@ describe("model statements", () => {
|
|
|
498
498
|
});
|
|
499
499
|
expect(docParse).compileToFailWith("Cannot redefine 'astr'");
|
|
500
500
|
});
|
|
501
|
+
test("source references expanded when not exported", () => {
|
|
502
|
+
const srcFiles = {
|
|
503
|
+
"internal://test/langtests/middle": `
|
|
504
|
+
import "bottom"
|
|
505
|
+
source: midSrc is from(bottomSrc -> { group_by: astr })
|
|
506
|
+
`,
|
|
507
|
+
"internal://test/langtests/bottom": `source: bottomSrc is table('aTable')`,
|
|
508
|
+
};
|
|
509
|
+
const fullModel = new BetaModel(`
|
|
510
|
+
import "middle"
|
|
511
|
+
`);
|
|
512
|
+
fullModel.update({ urls: srcFiles });
|
|
513
|
+
expect(fullModel).toTranslate();
|
|
514
|
+
const ms = fullModel.getSourceDef("midSrc");
|
|
515
|
+
expect(ms).toBeDefined();
|
|
516
|
+
if (ms) {
|
|
517
|
+
expect(ms.structSource.type).toBe("query");
|
|
518
|
+
if (ms.structSource.type == "query") {
|
|
519
|
+
const qs = ms.structSource.query.structRef;
|
|
520
|
+
expect(typeof qs).not.toBe("string");
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
});
|
|
501
524
|
});
|
|
502
525
|
});
|
|
503
526
|
describe("explore properties", () => {
|