@malloydata/malloy 0.0.195-dev241003204819 → 0.0.195-dev241007154000
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/connection/base_connection.d.ts +21 -7
- package/dist/connection/base_connection.js +62 -0
- package/dist/connection/types.d.ts +5 -5
- package/dist/dialect/dialect.d.ts +5 -3
- package/dist/dialect/dialect.js +15 -0
- package/dist/dialect/duckdb/duckdb.d.ts +3 -3
- package/dist/dialect/duckdb/duckdb.js +8 -3
- package/dist/dialect/postgres/postgres.d.ts +3 -3
- package/dist/dialect/postgres/postgres.js +5 -2
- package/dist/dialect/snowflake/snowflake.d.ts +3 -3
- package/dist/dialect/snowflake/snowflake.js +4 -1
- package/dist/dialect/standardsql/standardsql.d.ts +3 -3
- package/dist/dialect/standardsql/standardsql.js +5 -2
- package/dist/dialect/trino/trino.d.ts +3 -3
- package/dist/dialect/trino/trino.js +35 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -2
- package/dist/lang/ast/error-factory.d.ts +4 -3
- package/dist/lang/ast/error-factory.js +27 -17
- package/dist/lang/ast/expressions/constant-expression.d.ts +1 -0
- package/dist/lang/ast/expressions/constant-expression.js +3 -0
- package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +3 -7
- package/dist/lang/ast/expressions/expr-aggregate-function.js +50 -54
- package/dist/lang/ast/expressions/expr-cast.js +2 -4
- package/dist/lang/ast/expressions/expr-func.js +1 -1
- package/dist/lang/ast/expressions/expr-granular-time.js +1 -1
- package/dist/lang/ast/expressions/expr-record-literal.d.ts +16 -0
- package/dist/lang/ast/expressions/expr-record-literal.js +57 -0
- package/dist/lang/ast/expressions/expr-time-extract.js +3 -3
- package/dist/lang/ast/expressions/expr-time.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-time.js +1 -1
- package/dist/lang/ast/expressions/time-literal.d.ts +6 -6
- package/dist/lang/ast/expressions/time-literal.js +1 -1
- package/dist/lang/ast/field-space/column-space-field.d.ts +6 -5
- package/dist/lang/ast/field-space/column-space-field.js +7 -4
- package/dist/lang/ast/field-space/dynamic-space.d.ts +8 -6
- package/dist/lang/ast/field-space/dynamic-space.js +35 -11
- package/dist/lang/ast/field-space/index-field-space.js +6 -3
- package/dist/lang/ast/field-space/ir-view-field.d.ts +1 -0
- package/dist/lang/ast/field-space/ir-view-field.js +3 -1
- package/dist/lang/ast/field-space/join-space-field.d.ts +2 -2
- package/dist/lang/ast/field-space/join-space-field.js +2 -2
- package/dist/lang/ast/field-space/parameter-space.d.ts +1 -0
- package/dist/lang/ast/field-space/parameter-space.js +4 -1
- package/dist/lang/ast/field-space/query-input-space.d.ts +4 -4
- package/dist/lang/ast/field-space/query-input-space.js +3 -5
- package/dist/lang/ast/field-space/query-spaces.d.ts +4 -4
- package/dist/lang/ast/field-space/query-spaces.js +1 -1
- package/dist/lang/ast/field-space/reference-field.js +10 -8
- package/dist/lang/ast/field-space/refined-space.d.ts +2 -2
- package/dist/lang/ast/field-space/static-space.d.ts +14 -5
- package/dist/lang/ast/field-space/static-space.js +45 -20
- package/dist/lang/ast/field-space/struct-space-field-base.d.ts +6 -5
- package/dist/lang/ast/field-space/struct-space-field-base.js +12 -4
- package/dist/lang/ast/index.d.ts +2 -1
- package/dist/lang/ast/index.js +2 -1
- package/dist/lang/ast/query-builders/index-builder.d.ts +2 -2
- package/dist/lang/ast/query-builders/project-builder.d.ts +2 -2
- package/dist/lang/ast/query-builders/reduce-builder.d.ts +2 -2
- package/dist/lang/ast/query-elements/query-arrow.js +2 -2
- package/dist/lang/ast/query-elements/query-head-struct.d.ts +2 -2
- package/dist/lang/ast/query-elements/query-head-struct.js +2 -2
- package/dist/lang/ast/query-elements/query-raw.js +2 -2
- package/dist/lang/ast/query-elements/query-reference.js +1 -1
- package/dist/lang/ast/query-items/field-declaration.d.ts +8 -6
- package/dist/lang/ast/query-items/field-declaration.js +66 -24
- package/dist/lang/ast/query-properties/qop-desc.d.ts +2 -2
- package/dist/lang/ast/query-properties/qop-desc.js +1 -1
- package/dist/lang/ast/source-elements/named-source.d.ts +4 -4
- package/dist/lang/ast/source-elements/named-source.js +16 -8
- package/dist/lang/ast/source-elements/query-source.d.ts +3 -3
- package/dist/lang/ast/source-elements/query-source.js +5 -2
- package/dist/lang/ast/source-elements/refined-source.d.ts +3 -3
- package/dist/lang/ast/source-elements/refined-source.js +4 -4
- package/dist/lang/ast/source-elements/source.d.ts +2 -2
- package/dist/lang/ast/source-elements/source.js +2 -2
- package/dist/lang/ast/source-elements/sql-source.d.ts +4 -4
- package/dist/lang/ast/source-elements/sql-source.js +6 -6
- package/dist/lang/ast/source-elements/table-source.d.ts +2 -2
- package/dist/lang/ast/source-elements/table-source.js +1 -1
- package/dist/lang/ast/source-properties/{joins.d.ts → join.d.ts} +11 -14
- package/dist/lang/ast/source-properties/{joins.js → join.js} +35 -52
- package/dist/lang/ast/source-query-elements/sq-reference.js +6 -5
- package/dist/lang/ast/sql-elements/sql-string.d.ts +2 -2
- package/dist/lang/ast/statements/define-source.js +1 -1
- package/dist/lang/ast/struct-utils.d.ts +3 -3
- package/dist/lang/ast/struct-utils.js +12 -3
- package/dist/lang/ast/time-utils.d.ts +3 -3
- package/dist/lang/ast/types/document-compile-result.d.ts +2 -2
- package/dist/lang/ast/types/expression-def.js +4 -4
- package/dist/lang/ast/types/field-space.d.ts +8 -3
- package/dist/lang/ast/types/lookup-result.d.ts +8 -5
- package/dist/lang/ast/types/malloy-element.d.ts +3 -3
- package/dist/lang/ast/types/malloy-element.js +10 -21
- package/dist/lang/ast/types/op-desc.d.ts +2 -2
- package/dist/lang/ast/types/pipeline-comp.d.ts +2 -2
- package/dist/lang/ast/types/query-comp.d.ts +3 -3
- package/dist/lang/ast/types/query-extend-property.d.ts +1 -2
- package/dist/lang/ast/types/query-extend-property.js +4 -2
- package/dist/lang/ast/types/source-property.d.ts +2 -2
- package/dist/lang/ast/types/source-property.js +2 -2
- package/dist/lang/ast/types/space-field.d.ts +10 -3
- package/dist/lang/ast/types/space-field.js +11 -2
- package/dist/lang/ast/types/time-result.d.ts +2 -2
- package/dist/lang/ast/view-elements/qop-desc-view.d.ts +3 -3
- package/dist/lang/ast/view-elements/qop-desc-view.js +1 -1
- package/dist/lang/ast/view-elements/reference-view.d.ts +4 -4
- package/dist/lang/ast/view-elements/reference-view.js +2 -6
- package/dist/lang/ast/view-elements/view-refine.d.ts +2 -2
- package/dist/lang/index.d.ts +1 -1
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +54 -21
- package/dist/lang/lib/Malloy/MalloyParser.js +1647 -1457
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +57 -9
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +35 -5
- package/dist/lang/malloy-to-ast.d.ts +4 -4
- package/dist/lang/malloy-to-ast.js +32 -4
- package/dist/lang/parse-log.d.ts +5 -9
- package/dist/lang/parse-malloy.d.ts +10 -10
- package/dist/lang/parse-malloy.js +2 -1
- package/dist/lang/test/annotation.spec.js +7 -1
- package/dist/lang/test/field-symbols.spec.js +21 -25
- package/dist/lang/test/imports.spec.js +12 -10
- package/dist/lang/test/lenses.spec.js +2 -2
- package/dist/lang/test/model_serialization.spec.d.ts +4 -4
- package/dist/lang/test/model_serialization.spec.js +19 -31
- package/dist/lang/test/parse.spec.js +3 -4
- package/dist/lang/test/query.spec.js +3 -2
- package/dist/lang/test/source.spec.js +7 -0
- package/dist/lang/test/sql-block.spec.js +8 -19
- package/dist/lang/test/test-translator.d.ts +4 -4
- package/dist/lang/test/test-translator.js +53 -61
- package/dist/lang/translate-response.d.ts +3 -3
- package/dist/malloy.d.ts +31 -149
- package/dist/malloy.js +111 -269
- package/dist/model/malloy_query.d.ts +25 -23
- package/dist/model/malloy_query.js +262 -323
- package/dist/model/malloy_types.d.ts +145 -155
- package/dist/model/malloy_types.js +81 -84
- package/dist/model/sql_block.d.ts +4 -4
- package/dist/model/sql_block.js +9 -12
- package/dist/tags.js +2 -2
- package/dist/version.d.ts +1 -0
- package/dist/version.js +6 -0
- package/package.json +3 -2
- package/dist/lang/ast/space-seed.d.ts +0 -16
- package/dist/lang/ast/space-seed.js +0 -59
package/dist/malloy.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { RunSQLOptions } from './run_sql_options';
|
|
3
3
|
import { DocumentCompletion as DocumentCompletionDefinition, DocumentSymbol as DocumentSymbolDefinition, LogMessage, MalloyTranslator } from './lang';
|
|
4
4
|
import { DocumentHelpContext } from './lang/parse-tree-walkers/document-help-context-walker';
|
|
5
|
-
import { CompiledQuery, DocumentLocation, DocumentReference,
|
|
5
|
+
import { CompiledQuery, DocumentLocation, DocumentReference, BooleanFieldDef, JSONFieldDef, NumberFieldDef, StringFieldDef, FilterCondition, Query as InternalQuery, ModelDef, DocumentPosition as ModelDocumentPosition, NamedQuery, QueryData, QueryDataRow, QueryResult, SearchIndexResult, SearchValueMapResult, StructDef, TurtleDef, NativeUnsupportedFieldDef, QueryRunStats, ImportLocation, Annotation, SQLSentence, SQLSourceDef, AtomicFieldDef, DateFieldDef, TimestampFieldDef, SourceDef, QueryToMaterialize } from './model';
|
|
6
6
|
import { EventStream, ModelString, ModelURL, QueryString, QueryURL, URLReader } from './runtime_types';
|
|
7
|
-
import { Connection, InfoConnection, LookupConnection } from './connection/types';
|
|
7
|
+
import { Connection, FetchSchemaOptions, InfoConnection, LookupConnection } from './connection/types';
|
|
8
8
|
import { Tag, TagParse, TagParseSpec, Taggable } from './tags';
|
|
9
9
|
import { Dialect } from './dialect';
|
|
10
10
|
import { PathInfo } from './lang/parse-tree-walkers/find-table-path-walker';
|
|
@@ -74,7 +74,16 @@ export declare class Malloy {
|
|
|
74
74
|
model?: Model;
|
|
75
75
|
replaceMaterializedReferences?: boolean;
|
|
76
76
|
} & CompileOptions & CompileQueryOptions): Promise<Model>;
|
|
77
|
-
|
|
77
|
+
/**
|
|
78
|
+
* A dialect must provide a response for every table, or the translator loop
|
|
79
|
+
* will never exit. Because there was a time when this happened, we throw
|
|
80
|
+
* instead of looping forever, but the fix is to correct the dialect.
|
|
81
|
+
*/
|
|
82
|
+
static safelyFetchTableSchema(connection: InfoConnection, toFetch: Record<string, string>, opts: FetchSchemaOptions): Promise<{
|
|
83
|
+
schemas: Record<string, import("./model").TableSourceDef>;
|
|
84
|
+
errors: Record<string, string>;
|
|
85
|
+
}>;
|
|
86
|
+
static compileSQLBlock(dialect: string, partialModel: ModelDef | undefined, toCompile: SQLSentence, options?: CompileQueryOptions): SQLSourceDef;
|
|
78
87
|
/**
|
|
79
88
|
* Run a fully-prepared query.
|
|
80
89
|
*
|
|
@@ -94,22 +103,22 @@ export declare class Malloy {
|
|
|
94
103
|
}): Promise<Result>;
|
|
95
104
|
static run(params: {
|
|
96
105
|
connection: Connection;
|
|
97
|
-
sqlStruct:
|
|
106
|
+
sqlStruct: SQLSourceDef;
|
|
98
107
|
options?: RunSQLOptions;
|
|
99
108
|
}): Promise<Result>;
|
|
100
109
|
static run(params: {
|
|
101
110
|
connections: LookupConnection<Connection>;
|
|
102
|
-
sqlStruct:
|
|
111
|
+
sqlStruct: SQLSourceDef;
|
|
103
112
|
options?: RunSQLOptions;
|
|
104
113
|
}): Promise<Result>;
|
|
105
114
|
static run(params: {
|
|
106
115
|
connection: Connection;
|
|
107
|
-
sqlStruct:
|
|
116
|
+
sqlStruct: SQLSourceDef;
|
|
108
117
|
options?: RunSQLOptions;
|
|
109
118
|
}): Promise<Result>;
|
|
110
119
|
static run(params: {
|
|
111
120
|
connections: LookupConnection<Connection>;
|
|
112
|
-
sqlStruct:
|
|
121
|
+
sqlStruct: SQLSourceDef;
|
|
113
122
|
options?: RunSQLOptions;
|
|
114
123
|
}): Promise<Result>;
|
|
115
124
|
static runStream(params: {
|
|
@@ -124,22 +133,12 @@ export declare class Malloy {
|
|
|
124
133
|
}): AsyncIterableIterator<DataRecord>;
|
|
125
134
|
static runStream(params: {
|
|
126
135
|
connection: Connection;
|
|
127
|
-
sqlStruct:
|
|
128
|
-
options?: RunSQLOptions;
|
|
129
|
-
}): AsyncIterableIterator<DataRecord>;
|
|
130
|
-
static runStream(params: {
|
|
131
|
-
connections: LookupConnection<Connection>;
|
|
132
|
-
sqlBlock: SQLBlock;
|
|
133
|
-
options?: RunSQLOptions;
|
|
134
|
-
}): AsyncIterableIterator<DataRecord>;
|
|
135
|
-
static runStream(params: {
|
|
136
|
-
connection: Connection;
|
|
137
|
-
sqlStruct: SQLBlockStructDef;
|
|
136
|
+
sqlStruct: SQLSourceDef;
|
|
138
137
|
options?: RunSQLOptions;
|
|
139
138
|
}): AsyncIterableIterator<DataRecord>;
|
|
140
139
|
static runStream(params: {
|
|
141
140
|
connections: LookupConnection<Connection>;
|
|
142
|
-
sqlStruct:
|
|
141
|
+
sqlStruct: SQLSourceDef;
|
|
143
142
|
options?: RunSQLOptions;
|
|
144
143
|
}): AsyncIterableIterator<DataRecord>;
|
|
145
144
|
static estimateQueryCost(params: {
|
|
@@ -148,7 +147,7 @@ export declare class Malloy {
|
|
|
148
147
|
}): Promise<QueryRunStats>;
|
|
149
148
|
static estimateQueryCost(params: {
|
|
150
149
|
connections: LookupConnection<Connection>;
|
|
151
|
-
sqlStruct:
|
|
150
|
+
sqlStruct: SQLSourceDef;
|
|
152
151
|
}): Promise<QueryRunStats>;
|
|
153
152
|
}
|
|
154
153
|
/**
|
|
@@ -167,12 +166,11 @@ export declare class MalloyError extends Error {
|
|
|
167
166
|
export declare class Model implements Taggable {
|
|
168
167
|
private modelDef;
|
|
169
168
|
private queryList;
|
|
170
|
-
private sqlBlocks;
|
|
171
169
|
readonly problems: LogMessage[];
|
|
172
170
|
readonly fromSources: string[];
|
|
173
171
|
_referenceAt: (location: ModelDocumentPosition) => DocumentReference | undefined;
|
|
174
172
|
_importAt: (location: ModelDocumentPosition) => ImportLocation | undefined;
|
|
175
|
-
constructor(modelDef: ModelDef, queryList: InternalQuery[],
|
|
173
|
+
constructor(modelDef: ModelDef, queryList: InternalQuery[], problems: LogMessage[], fromSources: string[], referenceAt?: (location: ModelDocumentPosition) => DocumentReference | undefined, importAt?: (location: ModelDocumentPosition) => ImportLocation | undefined);
|
|
176
174
|
tagParse(spec?: TagParseSpec): TagParse;
|
|
177
175
|
getTaglines(prefix?: RegExp): string[];
|
|
178
176
|
/**
|
|
@@ -205,20 +203,6 @@ export declare class Model implements Taggable {
|
|
|
205
203
|
* @return A prepared query.
|
|
206
204
|
*/
|
|
207
205
|
getPreparedQueryByIndex(index: number): PreparedQuery;
|
|
208
|
-
/**
|
|
209
|
-
* Retrieve a prepared query by the name of a query at the top level of the model.
|
|
210
|
-
*
|
|
211
|
-
* @param queryName Name of the query to retrieve.
|
|
212
|
-
* @return A prepared query.
|
|
213
|
-
*/
|
|
214
|
-
getSQLBlockByName(sqlBlockName: string): SQLBlockStructDef;
|
|
215
|
-
/**
|
|
216
|
-
* Retrieve a prepared query by the name of a query at the top level of the model.
|
|
217
|
-
*
|
|
218
|
-
* @param index Index of the SQL Block to retrieve.
|
|
219
|
-
* @return A prepared query.
|
|
220
|
-
*/
|
|
221
|
-
getSQLBlockByIndex(index: number): SQLBlockStructDef;
|
|
222
206
|
/**
|
|
223
207
|
* Retrieve a prepared query for the final unnamed query at the top level of a model.
|
|
224
208
|
*
|
|
@@ -598,12 +582,12 @@ export declare class Explore extends Entity implements Taggable {
|
|
|
598
582
|
getFieldByNameIfExists(fieldName: string): Field | undefined;
|
|
599
583
|
get primaryKey(): string | undefined;
|
|
600
584
|
get parentExplore(): Explore | undefined;
|
|
601
|
-
get sourceRelationship(): SourceRelationship;
|
|
602
585
|
hasParentExplore(): this is ExploreField;
|
|
603
586
|
get filters(): FilterCondition[];
|
|
604
587
|
get limit(): number | undefined;
|
|
605
588
|
get structDef(): StructDef;
|
|
606
589
|
get queryTimezone(): string | undefined;
|
|
590
|
+
get sourceStructDef(): SourceDef | undefined;
|
|
607
591
|
toJSON(): SerializedExplore;
|
|
608
592
|
static fromJSON(main_explore: SerializedExplore): Explore;
|
|
609
593
|
get location(): DocumentLocation | undefined;
|
|
@@ -619,9 +603,9 @@ export declare enum AtomicFieldType {
|
|
|
619
603
|
Error = "error"
|
|
620
604
|
}
|
|
621
605
|
export declare class AtomicField extends Entity implements Taggable {
|
|
622
|
-
protected fieldTypeDef:
|
|
606
|
+
protected fieldTypeDef: AtomicFieldDef;
|
|
623
607
|
protected parent: Explore;
|
|
624
|
-
constructor(fieldTypeDef:
|
|
608
|
+
constructor(fieldTypeDef: AtomicFieldDef, parent: Explore, source?: AtomicField);
|
|
625
609
|
get type(): AtomicFieldType;
|
|
626
610
|
tagParse(spec?: TagParseSpec): TagParse;
|
|
627
611
|
getTaglines(prefix?: RegExp): string[];
|
|
@@ -674,34 +658,34 @@ export declare enum TimestampTimeframe {
|
|
|
674
658
|
}
|
|
675
659
|
export declare class DateField extends AtomicField {
|
|
676
660
|
private fieldDateDef;
|
|
677
|
-
constructor(fieldDateDef:
|
|
661
|
+
constructor(fieldDateDef: DateFieldDef, parent: Explore, source?: AtomicField);
|
|
678
662
|
get timeframe(): DateTimeframe | undefined;
|
|
679
663
|
}
|
|
680
664
|
export declare class TimestampField extends AtomicField {
|
|
681
665
|
private fieldTimestampDef;
|
|
682
|
-
constructor(fieldTimestampDef:
|
|
666
|
+
constructor(fieldTimestampDef: TimestampFieldDef, parent: Explore, source?: AtomicField);
|
|
683
667
|
get timeframe(): TimestampTimeframe | undefined;
|
|
684
668
|
}
|
|
685
669
|
export declare class NumberField extends AtomicField {
|
|
686
670
|
private fieldNumberDef;
|
|
687
|
-
constructor(fieldNumberDef:
|
|
671
|
+
constructor(fieldNumberDef: NumberFieldDef, parent: Explore, source?: AtomicField);
|
|
688
672
|
}
|
|
689
673
|
export declare class BooleanField extends AtomicField {
|
|
690
674
|
private fieldBooleanDef;
|
|
691
|
-
constructor(fieldBooleanDef:
|
|
675
|
+
constructor(fieldBooleanDef: BooleanFieldDef, parent: Explore, source?: AtomicField);
|
|
692
676
|
}
|
|
693
677
|
export declare class JSONField extends AtomicField {
|
|
694
678
|
private fieldJSONDef;
|
|
695
|
-
constructor(fieldJSONDef:
|
|
679
|
+
constructor(fieldJSONDef: JSONFieldDef, parent: Explore, source?: AtomicField);
|
|
696
680
|
}
|
|
697
681
|
export declare class UnsupportedField extends AtomicField {
|
|
698
682
|
private fieldUnsupportedDef;
|
|
699
|
-
constructor(fieldUnsupportedDef:
|
|
683
|
+
constructor(fieldUnsupportedDef: NativeUnsupportedFieldDef, parent: Explore, source?: AtomicField);
|
|
700
684
|
get rawType(): string | undefined;
|
|
701
685
|
}
|
|
702
686
|
export declare class StringField extends AtomicField {
|
|
703
687
|
private fieldStringDef;
|
|
704
|
-
constructor(fieldStringDef:
|
|
688
|
+
constructor(fieldStringDef: StringFieldDef, parent: Explore, source?: AtomicField);
|
|
705
689
|
}
|
|
706
690
|
export declare class Query extends Entity {
|
|
707
691
|
protected turtleDef: TurtleDef;
|
|
@@ -804,26 +788,6 @@ export declare class Runtime {
|
|
|
804
788
|
* or loading further related objects.
|
|
805
789
|
*/
|
|
806
790
|
loadQueryByName(model: ModelURL | ModelString, name: string, options?: ParseOptions & CompileOptions & CompileQueryOptions): QueryMaterializer;
|
|
807
|
-
/**
|
|
808
|
-
* Load a SQL block by the URL or contents of a Malloy model document
|
|
809
|
-
* and the name of a query contained in the model.
|
|
810
|
-
*
|
|
811
|
-
* @param model The model URL or contents to load and (eventually) compile to retrieve the requested query.
|
|
812
|
-
* @param name The name of the sql block to use within the model.
|
|
813
|
-
* @return A `SQLBlockMaterializer` capable of materializing the requested query, running it,
|
|
814
|
-
* or loading further related objects.
|
|
815
|
-
*/
|
|
816
|
-
loadSQLBlockByName(model: ModelURL | ModelString, name: string, options?: ParseOptions & CompileOptions & CompileQueryOptions): SQLBlockMaterializer;
|
|
817
|
-
/**
|
|
818
|
-
* Load a SQL block by the URL or contents of a Malloy model document
|
|
819
|
-
* and the name of a query contained in the model.
|
|
820
|
-
*
|
|
821
|
-
* @param model The model URL or contents to load and (eventually) compile to retrieve the requested query.
|
|
822
|
-
* @param index The index of the SQL block to use within the model. Note: named blocks are indexable, too.
|
|
823
|
-
* @return A `SQLBlockMaterializer` capable of materializing the requested query, running it,
|
|
824
|
-
* or loading further related objects.
|
|
825
|
-
*/
|
|
826
|
-
loadSQLBlockByIndex(model: ModelURL | ModelString, index: number, options?: ParseOptions & CompileOptions): SQLBlockMaterializer;
|
|
827
791
|
/**
|
|
828
792
|
* Compile a Malloy model by URL or contents.
|
|
829
793
|
*
|
|
@@ -856,24 +820,6 @@ export declare class Runtime {
|
|
|
856
820
|
* @return A promise of a compiled `PreparedQuery`.
|
|
857
821
|
*/
|
|
858
822
|
getQueryByName(model: ModelURL | ModelString, name: string, options?: ParseOptions & CompileOptions): Promise<PreparedQuery>;
|
|
859
|
-
/**
|
|
860
|
-
* Get a SQL block by the URL or contents of a Malloy model document
|
|
861
|
-
* and the name of a SQL block contained in the model.
|
|
862
|
-
*
|
|
863
|
-
* @param model The model URL or contents to load and (eventually) compile to retrieve the requested query.
|
|
864
|
-
* @param name The name of the sql block to use within the model.
|
|
865
|
-
* @return A promise of a `CompiledSQLBlock`.
|
|
866
|
-
*/
|
|
867
|
-
getSQLBlockByName(model: ModelURL | ModelString, name: string, options?: ParseOptions & CompileOptions): Promise<SQLBlockStructDef>;
|
|
868
|
-
/**
|
|
869
|
-
* Get a SQL block by the URL or contents of a Malloy model document
|
|
870
|
-
* and the name of a query contained in the model.
|
|
871
|
-
*
|
|
872
|
-
* @param model The model URL or contents to load and (eventually) compile to retrieve the requested query.
|
|
873
|
-
* @param index The index of the SQL block to use within the model. Note: named blocks are indexable, too.
|
|
874
|
-
* @return A promise of a `SQLBlock`.
|
|
875
|
-
*/
|
|
876
|
-
getSQLBlockByIndex(model: ModelURL | ModelString, index: number, options?: ParseOptions & CompileOptions): Promise<SQLBlockStructDef>;
|
|
877
823
|
}
|
|
878
824
|
export declare class ConnectionRuntime extends Runtime {
|
|
879
825
|
readonly rawConnections: Connection[];
|
|
@@ -901,8 +847,6 @@ declare class FluentState<T> {
|
|
|
901
847
|
protected makeQueryMaterializer(materialize: () => Promise<PreparedQuery>, options?: CompileQueryOptions): QueryMaterializer;
|
|
902
848
|
protected makeExploreMaterializer(materialize: () => Promise<Explore>, options?: CompileQueryOptions): ExploreMaterializer;
|
|
903
849
|
protected makePreparedResultMaterializer(materialize: () => Promise<PreparedResult>): PreparedResultMaterializer;
|
|
904
|
-
protected makeSQLBlockMaterializer(materialize: () => Promise<SQLBlockStructDef>): SQLBlockMaterializer;
|
|
905
|
-
get eventStream(): EventStream | undefined;
|
|
906
850
|
}
|
|
907
851
|
/**
|
|
908
852
|
* An object representing the task of loading a `Model`, capable of
|
|
@@ -954,24 +898,6 @@ export declare class ModelMaterializer extends FluentState<Model> {
|
|
|
954
898
|
extendModel(query: QueryString | QueryURL, options?: ParseOptions & CompileOptions & CompileQueryOptions): ModelMaterializer;
|
|
955
899
|
search(sourceName: string, searchTerm: string, limit?: number, searchField?: string | undefined, eventStream?: EventStream): Promise<SearchIndexResult[] | undefined>;
|
|
956
900
|
searchValueMap(sourceName: string, limit?: number, options?: ParseOptions): Promise<SearchValueMapResult[] | undefined>;
|
|
957
|
-
/**
|
|
958
|
-
* Load a SQL Block by name.
|
|
959
|
-
*
|
|
960
|
-
* @param name The name of the SQL Block to load.
|
|
961
|
-
* @return A `SQLBlockMaterializer` capable of materializing the requested sql block, running it,
|
|
962
|
-
* or loading further related objects.
|
|
963
|
-
*/
|
|
964
|
-
loadSQLBlockByName(name: string): SQLBlockMaterializer;
|
|
965
|
-
/**
|
|
966
|
-
* Load a SQL Block by index.
|
|
967
|
-
*
|
|
968
|
-
* @param index The index of the SQL Block to load. Note: named SQL blocks are indexable, too.
|
|
969
|
-
* @return A `SQLBlockMaterializer` capable of materializing the requested sql block, running it,
|
|
970
|
-
* or loading further related objects.
|
|
971
|
-
*
|
|
972
|
-
* TODO feature-sql-block Should named SQL blocks be indexable? This is not the way unnamed queries work.
|
|
973
|
-
*/
|
|
974
|
-
loadSQLBlockByIndex(index: number): SQLBlockMaterializer;
|
|
975
901
|
/**
|
|
976
902
|
* Materialize the final query contained within this loaded `Model`.
|
|
977
903
|
*
|
|
@@ -999,22 +925,6 @@ export declare class ModelMaterializer extends FluentState<Model> {
|
|
|
999
925
|
* @return A promise to a prepared query.
|
|
1000
926
|
*/
|
|
1001
927
|
getQuery(query: QueryString | QueryURL, options?: ParseOptions): Promise<PreparedQuery>;
|
|
1002
|
-
/**
|
|
1003
|
-
* Get a SQL Block by name.
|
|
1004
|
-
*
|
|
1005
|
-
* @param name The name of the SQL Block to load.
|
|
1006
|
-
* @return A promise of a `SQLBlock`.
|
|
1007
|
-
*/
|
|
1008
|
-
getSQLBlockByName(name: string): Promise<SQLBlockStructDef>;
|
|
1009
|
-
/**
|
|
1010
|
-
* Get a SQL Block by index.
|
|
1011
|
-
*
|
|
1012
|
-
* @param index The index of the SQL Block to load. Note: named SQL blocks are indexable, too.
|
|
1013
|
-
* @return A promise of a `SQLBlock`.
|
|
1014
|
-
*
|
|
1015
|
-
* TODO feature-sql-block Should named SQL blocks be indexable? This is not the way unnamed queries work.
|
|
1016
|
-
*/
|
|
1017
|
-
getSQLBlockByIndex(index: number): Promise<SQLBlockStructDef>;
|
|
1018
928
|
_loadQueryFromQueryDef(query: InternalQuery, options?: CompileQueryOptions): QueryMaterializer;
|
|
1019
929
|
/**
|
|
1020
930
|
* Load an explore contained within this loaded `Model` by name.
|
|
@@ -1085,6 +995,7 @@ export declare class QueryMaterializer extends FluentState<PreparedQuery> {
|
|
|
1085
995
|
* @return The estimated cost of running this loaded query.
|
|
1086
996
|
*/
|
|
1087
997
|
estimateQueryCost(options?: CompileQueryOptions): Promise<QueryRunStats>;
|
|
998
|
+
get eventStream(): EventStream | undefined;
|
|
1088
999
|
}
|
|
1089
1000
|
/**
|
|
1090
1001
|
* An object representing the task of loading a `PreparedResult`, capable of
|
|
@@ -1114,35 +1025,6 @@ export declare class PreparedResultMaterializer extends FluentState<PreparedResu
|
|
|
1114
1025
|
*/
|
|
1115
1026
|
getSQL(): Promise<string>;
|
|
1116
1027
|
}
|
|
1117
|
-
/**
|
|
1118
|
-
* An object representing the task of loading a `SQLBlock`, capable of
|
|
1119
|
-
* materializing the SQLBlock (via `getSQLBlock()`) or extending the task run
|
|
1120
|
-
* the query.
|
|
1121
|
-
*/
|
|
1122
|
-
export declare class SQLBlockMaterializer extends FluentState<SQLBlockStructDef> {
|
|
1123
|
-
/**
|
|
1124
|
-
* Run this SQL block.
|
|
1125
|
-
*
|
|
1126
|
-
* @return A promise to the query result data.
|
|
1127
|
-
*/
|
|
1128
|
-
run(options?: RunSQLOptions): Promise<Result>;
|
|
1129
|
-
runStream(options?: {
|
|
1130
|
-
rowLimit?: number;
|
|
1131
|
-
}): AsyncIterableIterator<DataRecord>;
|
|
1132
|
-
/**
|
|
1133
|
-
* Materialize this loaded SQL block.
|
|
1134
|
-
*
|
|
1135
|
-
* @return A promise of a SQL block.
|
|
1136
|
-
*/
|
|
1137
|
-
getSQLBlock(): Promise<SQLBlockStructDef>;
|
|
1138
|
-
/**
|
|
1139
|
-
* Materialize the SQL of this loaded SQL block.
|
|
1140
|
-
*
|
|
1141
|
-
* @return A promise to the SQL string.
|
|
1142
|
-
*/
|
|
1143
|
-
getSQL(): Promise<string>;
|
|
1144
|
-
estimateQueryCost(): Promise<QueryRunStats>;
|
|
1145
|
-
}
|
|
1146
1028
|
/**
|
|
1147
1029
|
* An object representing the task of loading an `Explore`, capable of
|
|
1148
1030
|
* materializing the explore (via `getExplore()`) or extending the task to produce
|