@malloydata/malloy 0.0.200 → 0.0.201
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/source-query-elements/sq-reference.js +2 -2
- package/dist/lang/ast/types/malloy-element.js +4 -4
- package/dist/lang/parse-malloy.js +1 -1
- package/dist/lang/test/test-translator.js +4 -4
- package/dist/malloy.js +4 -4
- package/dist/model/malloy_query.js +1 -1
- package/dist/model/malloy_types.d.ts +1 -2
- package/dist/model/malloy_types.js +1 -5
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -63,7 +63,7 @@ class SQReference extends source_query_element_1.SourceQueryElement {
|
|
|
63
63
|
}
|
|
64
64
|
isSource() {
|
|
65
65
|
const refTo = this.ref.getNamed();
|
|
66
|
-
return refTo !== undefined && (0, model_1.
|
|
66
|
+
return refTo !== undefined && (0, model_1.isSourceDef)(refTo);
|
|
67
67
|
}
|
|
68
68
|
getSource() {
|
|
69
69
|
if (this.asSource) {
|
|
@@ -82,7 +82,7 @@ class SQReference extends source_query_element_1.SourceQueryElement {
|
|
|
82
82
|
const existingQuery = new query_reference_1.QueryReference(this.ref);
|
|
83
83
|
this.asSource = new query_source_1.QuerySource(existingQuery);
|
|
84
84
|
}
|
|
85
|
-
else if ((0, model_1.
|
|
85
|
+
else if ((0, model_1.isSourceDef)(entry)) {
|
|
86
86
|
this.asSource = new named_source_1.NamedSource(this.ref, undefined, this.args);
|
|
87
87
|
}
|
|
88
88
|
else {
|
|
@@ -120,7 +120,7 @@ class MalloyElement {
|
|
|
120
120
|
location: reference.location,
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
else if (result && (0, malloy_types_1.
|
|
123
|
+
else if (result && (0, malloy_types_1.isSourceDef)(result.entry)) {
|
|
124
124
|
this.addReference({
|
|
125
125
|
type: 'exploreReference',
|
|
126
126
|
text: key,
|
|
@@ -452,7 +452,7 @@ class Document extends MalloyElement {
|
|
|
452
452
|
}
|
|
453
453
|
for (const [nm, orig] of Object.entries(extendingModelDef.contents)) {
|
|
454
454
|
const entry = structuredClone(orig);
|
|
455
|
-
if ((0, malloy_types_1.
|
|
455
|
+
if ((0, malloy_types_1.isSourceDef)(entry) ||
|
|
456
456
|
entry.type === 'query' ||
|
|
457
457
|
entry.type === 'function') {
|
|
458
458
|
const exported = extendingModelDef.exports.includes(nm);
|
|
@@ -511,7 +511,7 @@ class Document extends MalloyElement {
|
|
|
511
511
|
}
|
|
512
512
|
for (const entry in this.documentModel) {
|
|
513
513
|
const entryDef = this.documentModel[entry].entry;
|
|
514
|
-
if ((0, malloy_types_1.
|
|
514
|
+
if ((0, malloy_types_1.isSourceDef)(entryDef) || entryDef.type === 'query') {
|
|
515
515
|
if (this.documentModel[entry].exported) {
|
|
516
516
|
def.exports.push(entry);
|
|
517
517
|
}
|
|
@@ -548,7 +548,7 @@ class Document extends MalloyElement {
|
|
|
548
548
|
if (this.globalNameSpace.getEntry(str) !== undefined) {
|
|
549
549
|
this.logError('name-conflict-with-global', `Cannot redefine '${str}', which is in global namespace`);
|
|
550
550
|
}
|
|
551
|
-
if ((0, malloy_types_1.
|
|
551
|
+
if ((0, malloy_types_1.isSourceDef)(ent.entry)) {
|
|
552
552
|
this.checkExperimentalDialect(this, ent.entry.dialect);
|
|
553
553
|
}
|
|
554
554
|
this.documentModel[str] = ent;
|
|
@@ -680,7 +680,7 @@ class MalloyTranslation {
|
|
|
680
680
|
if (did.translated) {
|
|
681
681
|
for (const fromChild of child.modelDef.exports) {
|
|
682
682
|
const modelEntry = child.modelDef.contents[fromChild];
|
|
683
|
-
if ((0, malloy_types_1.
|
|
683
|
+
if ((0, malloy_types_1.isSourceDef)(modelEntry) || modelEntry.type === 'query') {
|
|
684
684
|
exports[fromChild] = modelEntry;
|
|
685
685
|
}
|
|
686
686
|
}
|
|
@@ -191,7 +191,7 @@ class TestRoot extends ast_1.MalloyElement {
|
|
|
191
191
|
if (global)
|
|
192
192
|
return global;
|
|
193
193
|
const struct = this.modelDef.contents[name];
|
|
194
|
-
if ((0, malloy_types_1.
|
|
194
|
+
if ((0, malloy_types_1.isSourceDef)(struct)) {
|
|
195
195
|
const exported = this.modelDef.exports.includes(name);
|
|
196
196
|
return { entry: struct, exported };
|
|
197
197
|
}
|
|
@@ -345,7 +345,7 @@ class TestTranslator extends parse_malloy_1.MalloyTranslator {
|
|
|
345
345
|
}
|
|
346
346
|
exploreFor(exploreName) {
|
|
347
347
|
const explore = this.nameSpace[exploreName];
|
|
348
|
-
if (explore && (0, malloy_types_1.
|
|
348
|
+
if (explore && (0, malloy_types_1.isSourceDef)(explore)) {
|
|
349
349
|
return explore;
|
|
350
350
|
}
|
|
351
351
|
throw new Error(`Expected model to contain source '${exploreName}'`);
|
|
@@ -365,7 +365,7 @@ class TestTranslator extends parse_malloy_1.MalloyTranslator {
|
|
|
365
365
|
var _a;
|
|
366
366
|
const t = this.translate().translated;
|
|
367
367
|
const s = (_a = t === null || t === void 0 ? void 0 : t.modelDef) === null || _a === void 0 ? void 0 : _a.contents[srcName];
|
|
368
|
-
if (s && (0, malloy_types_1.
|
|
368
|
+
if (s && (0, malloy_types_1.isSourceDef)(s)) {
|
|
369
369
|
return s;
|
|
370
370
|
}
|
|
371
371
|
return undefined;
|
|
@@ -391,7 +391,7 @@ class BetaExpression extends TestTranslator {
|
|
|
391
391
|
}
|
|
392
392
|
testFS() {
|
|
393
393
|
const aStruct = this.internalModel.contents['ab'];
|
|
394
|
-
if ((0, malloy_types_1.
|
|
394
|
+
if ((0, malloy_types_1.isSourceDef)(aStruct)) {
|
|
395
395
|
const tstFS = new static_space_1.StaticSourceSpace(aStruct);
|
|
396
396
|
return tstFS;
|
|
397
397
|
}
|
package/dist/malloy.js
CHANGED
|
@@ -447,7 +447,7 @@ class Model {
|
|
|
447
447
|
*/
|
|
448
448
|
getExploreByName(name) {
|
|
449
449
|
const struct = this.modelDef.contents[name];
|
|
450
|
-
if ((0, model_1.
|
|
450
|
+
if ((0, model_1.isSourceDef)(struct)) {
|
|
451
451
|
return new Explore(struct);
|
|
452
452
|
}
|
|
453
453
|
throw new Error("'name' is not an explore");
|
|
@@ -459,7 +459,7 @@ class Model {
|
|
|
459
459
|
*/
|
|
460
460
|
get explores() {
|
|
461
461
|
return Object.values(this.modelDef.contents)
|
|
462
|
-
.filter(model_1.
|
|
462
|
+
.filter(model_1.isSourceDef)
|
|
463
463
|
.map(structDef => new Explore(structDef));
|
|
464
464
|
}
|
|
465
465
|
/**
|
|
@@ -524,7 +524,7 @@ class PreparedQuery {
|
|
|
524
524
|
const source = typeof sourceRef === 'string'
|
|
525
525
|
? this._modelDef.contents[sourceRef]
|
|
526
526
|
: sourceRef;
|
|
527
|
-
if (!(0, model_1.
|
|
527
|
+
if (!(0, model_1.isSourceDef)(source)) {
|
|
528
528
|
throw new Error('Invalid source for query');
|
|
529
529
|
}
|
|
530
530
|
return source.dialect;
|
|
@@ -818,7 +818,7 @@ class PreparedResult {
|
|
|
818
818
|
if (explore === undefined) {
|
|
819
819
|
throw new Error('Malformed query result.');
|
|
820
820
|
}
|
|
821
|
-
if ((0, model_1.
|
|
821
|
+
if ((0, model_1.isSourceDef)(explore)) {
|
|
822
822
|
return new Explore(explore);
|
|
823
823
|
}
|
|
824
824
|
throw new Error(`'${name} is not an explore`);
|
|
@@ -3410,7 +3410,7 @@ class QueryModel {
|
|
|
3410
3410
|
this.modelDef = modelDef;
|
|
3411
3411
|
for (const s of Object.values(this.modelDef.contents)) {
|
|
3412
3412
|
let qs;
|
|
3413
|
-
if ((0, malloy_types_1.
|
|
3413
|
+
if ((0, malloy_types_1.isSourceDef)(s)) {
|
|
3414
3414
|
qs = new QueryStruct(s, undefined, { model: this }, {});
|
|
3415
3415
|
this.structs.set((0, malloy_types_1.getIdentifier)(s), qs);
|
|
3416
3416
|
qs.resolveQueryFields();
|
|
@@ -595,7 +595,7 @@ export interface FinalizeSourceDef extends SourceDefBase {
|
|
|
595
595
|
type: 'finalize';
|
|
596
596
|
}
|
|
597
597
|
export declare function sourceBase(sd: SourceDefBase): SourceDefBase;
|
|
598
|
-
export declare function isSourceDef(sd:
|
|
598
|
+
export declare function isSourceDef(sd: NamedModelObject | FieldDef): sd is SourceDef;
|
|
599
599
|
export type SourceDef = TableSourceDef | SQLSourceDef | QuerySourceDef | QueryResultDef | FinalizeSourceDef | NestSourceDef;
|
|
600
600
|
/** Is this the "FROM" table of a query tree */
|
|
601
601
|
export declare function isBaseTable(def: StructDef): def is SourceDef;
|
|
@@ -669,7 +669,6 @@ export type QueryFieldDef = AtomicFieldDef | TurtleDef | RefToField;
|
|
|
669
669
|
/** Get the output name for a NamedObject */
|
|
670
670
|
export declare function getIdentifier(n: AliasedName): string;
|
|
671
671
|
export type NamedModelObject = StructDef | NamedQuery | FunctionDef | ConnectionDef;
|
|
672
|
-
export declare function modelObjIsSource(nmo: NamedModelObject): nmo is SourceDef;
|
|
673
672
|
/** Result of parsing a model file */
|
|
674
673
|
export interface ModelDef {
|
|
675
674
|
name: string;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.mergeEvalSpaces = exports.isLiteral = exports.isScalarArray = exports.isBaseTable = exports.isSourceDef = exports.sourceBase = exports.isSegmentSQL = exports.isIndexSegment = exports.isRawSegment = exports.isSamplingEnable = exports.isSamplingPercent = exports.isSamplingRows = exports.isQuerySegment = exports.isProjectSegment = exports.isPartialSegment = exports.isReduceSegment = exports.structHasErrors = exports.segmentHasErrors = exports.refIsStructDef = exports.isByExpression = exports.isByName = exports.ValueType = exports.isExtractUnit = exports.isTimestampUnit = exports.isDateUnit = exports.isJoinedSource = exports.isJoined = exports.isJoinable = exports.isMatrixOperation = exports.isRepeatedRecord = exports.arrayEachFields = exports.fieldIsIntrinsic = exports.isCastType = exports.isAtomicFieldType = exports.isTemporalField = exports.hasExpression = exports.maxOfExpressionTypes = exports.maxExpressionType = exports.isExpressionTypeLEQ = exports.expressionIsAnalytic = exports.expressionIsCalculation = exports.expressionInvolvesAggregate = exports.expressionIsUngroupedAggregate = exports.expressionIsAggregate = exports.expressionIsScalar = exports.paramHasValue = exports.isAsymmetricExpr = exports.exprIsLeaf = exports.exprHasE = exports.exprHasKids = void 0;
|
|
26
|
-
exports.isValueDate = exports.isValueTimestamp = exports.isValueBoolean = exports.isValueNumber = exports.isValueString = exports.getAtomicFields = exports.isAtomic = exports.isTurtleDef = exports.
|
|
26
|
+
exports.isValueDate = exports.isValueTimestamp = exports.isValueBoolean = exports.isValueNumber = exports.isValueString = exports.getAtomicFields = exports.isAtomic = exports.isTurtleDef = exports.getIdentifier = exports.isLeafAtomic = void 0;
|
|
27
27
|
function exprHasKids(e) {
|
|
28
28
|
return 'kids' in e;
|
|
29
29
|
}
|
|
@@ -337,10 +337,6 @@ function getIdentifier(n) {
|
|
|
337
337
|
return n.name;
|
|
338
338
|
}
|
|
339
339
|
exports.getIdentifier = getIdentifier;
|
|
340
|
-
function modelObjIsSource(nmo) {
|
|
341
|
-
return isSourceDef(nmo);
|
|
342
|
-
}
|
|
343
|
-
exports.modelObjIsSource = modelObjIsSource;
|
|
344
340
|
function isTurtleDef(def) {
|
|
345
341
|
return def.type === 'turtle';
|
|
346
342
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MALLOY_VERSION = "0.0.
|
|
1
|
+
export declare const MALLOY_VERSION = "0.0.201";
|
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.201';
|
|
6
6
|
//# sourceMappingURL=version.js.map
|