@malloydata/malloy 0.0.334 → 0.0.336

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.
Files changed (91) hide show
  1. package/CONTEXT.md +4 -3
  2. package/MALLOY_API.md +129 -0
  3. package/dist/annotation.d.ts +0 -2
  4. package/dist/annotation.js +29 -23
  5. package/dist/api/asynchronous.d.ts +1 -1
  6. package/dist/api/foundation/cache.d.ts +32 -0
  7. package/dist/api/foundation/cache.js +92 -0
  8. package/dist/api/foundation/compile.d.ts +175 -0
  9. package/dist/api/foundation/compile.js +391 -0
  10. package/dist/api/foundation/core.d.ts +493 -0
  11. package/dist/api/foundation/core.js +1247 -0
  12. package/dist/api/foundation/document.d.ts +167 -0
  13. package/dist/api/foundation/document.js +206 -0
  14. package/dist/api/foundation/index.d.ts +10 -0
  15. package/dist/api/foundation/index.js +77 -0
  16. package/dist/api/foundation/readers.d.ts +53 -0
  17. package/dist/api/foundation/readers.js +134 -0
  18. package/dist/api/foundation/result.d.ts +185 -0
  19. package/dist/api/foundation/result.js +704 -0
  20. package/dist/api/foundation/runtime.d.ts +361 -0
  21. package/dist/api/foundation/runtime.js +733 -0
  22. package/dist/api/foundation/types.d.ts +54 -0
  23. package/dist/api/foundation/types.js +7 -0
  24. package/dist/api/foundation/writers.d.ts +42 -0
  25. package/dist/api/foundation/writers.js +230 -0
  26. package/dist/api/util.d.ts +1 -1
  27. package/dist/connection/base_connection.d.ts +5 -0
  28. package/dist/connection/types.d.ts +5 -0
  29. package/dist/dialect/duckdb/duckdb.js +2 -1
  30. package/dist/dialect/snowflake/snowflake.js +7 -1
  31. package/dist/dialect/trino/trino.js +7 -2
  32. package/dist/index.d.ts +6 -3
  33. package/dist/index.js +30 -26
  34. package/dist/lang/ast/error-factory.js +3 -5
  35. package/dist/lang/ast/expressions/expr-count-distinct.js +7 -1
  36. package/dist/lang/ast/expressions/expr-granular-time.js +1 -1
  37. package/dist/lang/ast/expressions/expr-max.js +7 -1
  38. package/dist/lang/ast/expressions/expr-min.js +7 -1
  39. package/dist/lang/ast/expressions/for-range.js +1 -1
  40. package/dist/lang/ast/source-elements/query-source.js +2 -7
  41. package/dist/lang/ast/source-elements/refined-source.js +11 -1
  42. package/dist/lang/ast/source-elements/sql-source.d.ts +1 -1
  43. package/dist/lang/ast/source-elements/sql-source.js +18 -3
  44. package/dist/lang/ast/sql-elements/sql-string.d.ts +2 -2
  45. package/dist/lang/ast/sql-elements/sql-string.js +18 -1
  46. package/dist/lang/ast/statements/define-source.js +7 -2
  47. package/dist/lang/ast/statements/import-statement.js +53 -21
  48. package/dist/lang/ast/types/document-compile-result.d.ts +1 -0
  49. package/dist/lang/ast/types/expression-def.js +1 -1
  50. package/dist/lang/ast/types/malloy-element.d.ts +3 -1
  51. package/dist/lang/ast/types/malloy-element.js +23 -7
  52. package/dist/lang/malloy-to-ast.d.ts +1 -1
  53. package/dist/lang/malloy-to-ast.js +1 -1
  54. package/dist/lang/parse-malloy.d.ts +3 -2
  55. package/dist/lang/parse-malloy.js +14 -25
  56. package/dist/lang/test/test-translator.d.ts +9 -2
  57. package/dist/lang/test/test-translator.js +103 -77
  58. package/dist/lang/translate-response.d.ts +1 -0
  59. package/dist/model/constant_expression_compiler.js +6 -7
  60. package/dist/model/index.d.ts +3 -1
  61. package/dist/model/index.js +15 -9
  62. package/dist/model/malloy_types.d.ts +89 -15
  63. package/dist/model/malloy_types.js +12 -0
  64. package/dist/model/persist_utils.d.ts +47 -0
  65. package/dist/model/persist_utils.js +257 -0
  66. package/dist/model/query_model_impl.d.ts +2 -4
  67. package/dist/model/query_model_impl.js +5 -13
  68. package/dist/model/query_node.d.ts +1 -2
  69. package/dist/model/query_node.js +3 -13
  70. package/dist/model/query_query.d.ts +17 -1
  71. package/dist/model/query_query.js +81 -36
  72. package/dist/model/source_def_utils.d.ts +50 -0
  73. package/dist/model/source_def_utils.js +154 -0
  74. package/dist/model/sql_block.d.ts +5 -1
  75. package/dist/model/sql_block.js +29 -4
  76. package/dist/model/sql_compiled.d.ts +29 -0
  77. package/dist/model/sql_compiled.js +102 -0
  78. package/dist/model/stage_writer.d.ts +1 -3
  79. package/dist/model/stage_writer.js +7 -25
  80. package/dist/model/utils.d.ts +20 -1
  81. package/dist/model/utils.js +40 -0
  82. package/dist/run_sql_options.d.ts +0 -1
  83. package/dist/taggable.d.ts +10 -0
  84. package/dist/taggable.js +7 -0
  85. package/dist/version.d.ts +1 -1
  86. package/dist/version.js +1 -1
  87. package/package.json +6 -4
  88. package/dist/malloy.d.ts +0 -1365
  89. package/dist/malloy.js +0 -3421
  90. package/dist/model/materialization/utils.d.ts +0 -3
  91. package/dist/model/materialization/utils.js +0 -41
@@ -0,0 +1,493 @@
1
+ import type { LogMessage } from '../../lang';
2
+ import type { BuildID, CompiledQuery, DocumentLocation, BooleanFieldDef, JSONFieldDef, NumberFieldDef, StringFieldDef, FilterCondition, Query as InternalQuery, ModelDef, DocumentPosition as ModelDocumentPosition, NamedQueryDef, StructDef, TurtleDef, NativeUnsupportedFieldDef, ImportLocation, Annotation, AtomicFieldDef, DateFieldDef, ATimestampFieldDef, SourceDef, Argument, SourceComponentInfo, DocumentReference, PersistableSourceDef } from '../../model';
3
+ import { QueryModel } from '../../model';
4
+ import type { Dialect } from '../../dialect';
5
+ import type { BuildGraph, CompileQueryOptions } from './types';
6
+ import type { Tag } from '@malloydata/malloy-tag';
7
+ import type { MalloyTagParse, TagParseSpec } from '../../annotation';
8
+ import type { Taggable } from '../../taggable';
9
+ declare abstract class Entity {
10
+ private readonly _name;
11
+ protected readonly _parent?: Explore;
12
+ private readonly _source?;
13
+ constructor(name: string, parent?: Explore, source?: Entity);
14
+ get source(): Entity | undefined;
15
+ get name(): string;
16
+ get sourceClasses(): string[];
17
+ get fieldPath(): string[];
18
+ hasParentExplore(): this is Field;
19
+ isExplore(): this is Explore;
20
+ isQuery(): this is Query;
21
+ abstract isIntrinsic(): boolean;
22
+ abstract get location(): DocumentLocation | undefined;
23
+ }
24
+ /**
25
+ * The relationship of an `Explore` to its source.
26
+ */
27
+ export declare enum SourceRelationship {
28
+ /**
29
+ * The `Explore` is nested data within the source's rows.
30
+ */
31
+ Nested = "nested",
32
+ /**
33
+ * The `Explore` is the base table.
34
+ */
35
+ BaseTable = "base_table",
36
+ /**
37
+ * The `Explore` is joined to its source
38
+ */
39
+ Cross = "cross",
40
+ One = "one",
41
+ Many = "many",
42
+ Inline = "inline"
43
+ }
44
+ export declare enum AtomicFieldType {
45
+ String = "string",
46
+ Number = "number",
47
+ Boolean = "boolean",
48
+ Date = "date",
49
+ Timestamp = "timestamp",
50
+ Timestamptz = "timestamptz",
51
+ Json = "json",
52
+ NativeUnsupported = "sql native",
53
+ Error = "error"
54
+ }
55
+ export declare enum DateTimeframe {
56
+ Day = "day",
57
+ Week = "week",
58
+ Month = "month",
59
+ Quarter = "quarter",
60
+ Year = "year"
61
+ }
62
+ export declare enum TimestampTimeframe {
63
+ Day = "day",
64
+ Week = "week",
65
+ Month = "month",
66
+ Quarter = "quarter",
67
+ Year = "year",
68
+ Second = "second",
69
+ Hour = "hour",
70
+ Minute = "minute"
71
+ }
72
+ export declare enum JoinRelationship {
73
+ OneToOne = "one_to_one",
74
+ OneToMany = "one_to_many",
75
+ ManyToOne = "many_to_one"
76
+ }
77
+ export type Field = AtomicField | QueryField | ExploreField;
78
+ export type SerializedExplore = {
79
+ _structDef: StructDef;
80
+ sourceExplore?: SerializedExplore;
81
+ _parentExplore?: SerializedExplore;
82
+ };
83
+ export type SortableField = {
84
+ field: Field;
85
+ dir: 'asc' | 'desc' | undefined;
86
+ };
87
+ export type PreparedResultJSON = {
88
+ query: CompiledQuery;
89
+ modelDef: ModelDef;
90
+ };
91
+ export declare class Explore extends Entity implements Taggable {
92
+ protected readonly _structDef: StructDef;
93
+ protected readonly _parentExplore?: Explore;
94
+ private _fieldMap;
95
+ private sourceExplore;
96
+ private _allFieldsWithOrder;
97
+ constructor(structDef: StructDef, parentExplore?: Explore, source?: Explore);
98
+ get source(): Explore | undefined;
99
+ isIntrinsic(): boolean;
100
+ isExploreField(): this is ExploreField;
101
+ tagParse(spec?: TagParseSpec): MalloyTagParse;
102
+ getTaglines(prefix?: RegExp): string[];
103
+ private parsedModelTag?;
104
+ get modelTag(): Tag;
105
+ /**
106
+ * @return The name of the entity.
107
+ */
108
+ get name(): string;
109
+ getQueryByName(name: string): PreparedQuery;
110
+ private get modelDef();
111
+ getSingleExploreModel(): Model;
112
+ private get fieldMap();
113
+ get allFields(): Field[];
114
+ get allFieldsWithOrder(): SortableField[];
115
+ get intrinsicFields(): Field[];
116
+ get dimensions(): SortableField[];
117
+ getFieldByName(fieldName: string): Field;
118
+ getFieldByNameIfExists(fieldName: string): Field | undefined;
119
+ get primaryKey(): string | undefined;
120
+ get parentExplore(): Explore | undefined;
121
+ hasParentExplore(): this is ExploreField;
122
+ get filters(): FilterCondition[];
123
+ get limit(): number | undefined;
124
+ get structDef(): StructDef;
125
+ get queryTimezone(): string | undefined;
126
+ get sourceStructDef(): SourceDef | undefined;
127
+ toJSON(): SerializedExplore;
128
+ static fromJSON(main_explore: SerializedExplore): Explore;
129
+ get location(): DocumentLocation | undefined;
130
+ private collectSourceComponents;
131
+ /**
132
+ * THIS IS A HIGHLY EXPERIMENTAL API AND MAY VANISH OR CHANGE WITHOUT NOTICE
133
+ */
134
+ getSourceComponents(): SourceComponentInfo[];
135
+ }
136
+ export declare class AtomicField extends Entity implements Taggable {
137
+ protected fieldTypeDef: AtomicFieldDef;
138
+ protected parent: Explore;
139
+ constructor(fieldTypeDef: AtomicFieldDef, parent: Explore, source?: AtomicField);
140
+ get type(): AtomicFieldType;
141
+ tagParse(spec?: TagParseSpec): MalloyTagParse;
142
+ getTaglines(prefix?: RegExp): string[];
143
+ isIntrinsic(): boolean;
144
+ isQueryField(): this is QueryField;
145
+ isExploreField(): this is ExploreField;
146
+ isAtomicField(): this is AtomicField;
147
+ isCalculation(): boolean;
148
+ get sourceField(): Field;
149
+ get sourceClasses(): string[];
150
+ get referenceId(): string | undefined;
151
+ sourceWasMeasure(): boolean;
152
+ sourceWasMeasureLike(): boolean;
153
+ sourceWasDimension(): boolean;
154
+ hasParentExplore(): this is Field;
155
+ isString(): this is StringField;
156
+ isNumber(): this is NumberField;
157
+ isDate(): this is DateField;
158
+ isBoolean(): this is BooleanField;
159
+ isJSON(): this is JSONField;
160
+ isTimestamp(): this is TimestampField;
161
+ isUnsupported(): this is UnsupportedField;
162
+ get parentExplore(): Explore;
163
+ get expression(): string;
164
+ get location(): DocumentLocation | undefined;
165
+ }
166
+ export declare class DateField extends AtomicField {
167
+ private fieldDateDef;
168
+ constructor(fieldDateDef: DateFieldDef, parent: Explore, source?: AtomicField);
169
+ get timeframe(): DateTimeframe | undefined;
170
+ }
171
+ export declare class TimestampField extends AtomicField {
172
+ private fieldTimestampDef;
173
+ constructor(fieldTimestampDef: ATimestampFieldDef, parent: Explore, source?: AtomicField);
174
+ get timeframe(): TimestampTimeframe | undefined;
175
+ }
176
+ export declare class NumberField extends AtomicField {
177
+ private fieldNumberDef;
178
+ constructor(fieldNumberDef: NumberFieldDef, parent: Explore, source?: AtomicField);
179
+ }
180
+ export declare class BooleanField extends AtomicField {
181
+ private fieldBooleanDef;
182
+ constructor(fieldBooleanDef: BooleanFieldDef, parent: Explore, source?: AtomicField);
183
+ }
184
+ export declare class JSONField extends AtomicField {
185
+ private fieldJSONDef;
186
+ constructor(fieldJSONDef: JSONFieldDef, parent: Explore, source?: AtomicField);
187
+ }
188
+ export declare class UnsupportedField extends AtomicField {
189
+ private fieldUnsupportedDef;
190
+ constructor(fieldUnsupportedDef: NativeUnsupportedFieldDef, parent: Explore, source?: AtomicField);
191
+ get rawType(): string | undefined;
192
+ }
193
+ export declare class StringField extends AtomicField {
194
+ private fieldStringDef;
195
+ constructor(fieldStringDef: StringFieldDef, parent: Explore, source?: AtomicField);
196
+ }
197
+ export declare class Query extends Entity {
198
+ protected turtleDef: TurtleDef;
199
+ private sourceQuery?;
200
+ constructor(turtleDef: TurtleDef, parent?: Explore, source?: Query);
201
+ get source(): Query | undefined;
202
+ isIntrinsic(): boolean;
203
+ get location(): DocumentLocation | undefined;
204
+ }
205
+ export declare class QueryField extends Query implements Taggable {
206
+ protected parent: Explore;
207
+ constructor(turtleDef: TurtleDef, parent: Explore, source?: Query);
208
+ tagParse(spec?: TagParseSpec): MalloyTagParse;
209
+ getTaglines(prefix?: RegExp): string[];
210
+ isQueryField(): this is QueryField;
211
+ isExploreField(): this is ExploreField;
212
+ isAtomicField(): this is AtomicField;
213
+ get sourceClasses(): string[];
214
+ hasParentExplore(): this is Field;
215
+ get parentExplore(): Explore;
216
+ get expression(): string;
217
+ }
218
+ export declare class ExploreField extends Explore {
219
+ protected _parentExplore: Explore;
220
+ constructor(structDef: StructDef, parentExplore: Explore, source?: Explore);
221
+ get joinRelationship(): JoinRelationship;
222
+ get isRecord(): boolean;
223
+ get isArray(): boolean;
224
+ tagParse(spec?: TagParseSpec): MalloyTagParse;
225
+ isQueryField(): this is QueryField;
226
+ isExploreField(): this is ExploreField;
227
+ isAtomicField(): this is AtomicField;
228
+ get parentExplore(): Explore;
229
+ get sourceClasses(): string[];
230
+ get queryTimezone(): string | undefined;
231
+ }
232
+ export declare class Model implements Taggable {
233
+ private modelDef;
234
+ readonly problems: LogMessage[];
235
+ readonly fromSources: string[];
236
+ private readonly references;
237
+ private _queryModel?;
238
+ constructor(modelDef: ModelDef, problems: LogMessage[], fromSources: string[], existingQueryModel?: QueryModel);
239
+ get queryModel(): QueryModel;
240
+ /**
241
+ * Returns the cached QueryModel if it exists, without creating one.
242
+ * Used internally to share QueryModel between Model instances when
243
+ * the model wasn't modified (only queries were added).
244
+ */
245
+ getExistingQueryModel(): QueryModel | undefined;
246
+ tagParse(spec?: TagParseSpec): MalloyTagParse;
247
+ getTaglines(prefix?: RegExp): string[];
248
+ /**
249
+ * Retrieve a document reference for the token at the given position within
250
+ * the document that produced this model.
251
+ *
252
+ * @param position A position within the document.
253
+ * @return A `DocumentReference` at that position if one exists.
254
+ */
255
+ getReference(position: ModelDocumentPosition): DocumentReference | undefined;
256
+ /**
257
+ * Retrieve an import for the token at the given position within
258
+ * the document that produced this model.
259
+ *
260
+ * @param position A position within the document.
261
+ * @return An `ImportLocation` at that position if one exists.
262
+ */
263
+ getImport(position: ModelDocumentPosition): ImportLocation | undefined;
264
+ /**
265
+ * Retrieve a prepared query by the name of a query at the top level of the model.
266
+ *
267
+ * @param queryName Name of the query to retrieve.
268
+ * @return A prepared query.
269
+ */
270
+ getPreparedQueryByName(queryName: string): PreparedQuery;
271
+ /**
272
+ * Retrieve a prepared query by the index of an unnamed query at the top level of a model.
273
+ *
274
+ * @param index The index of the query to retrieve.
275
+ * @return A prepared query.
276
+ */
277
+ getPreparedQueryByIndex(index: number): PreparedQuery;
278
+ /**
279
+ * Retrieve a prepared query for the final unnamed query at the top level of a model.
280
+ *
281
+ * @return A prepared query.
282
+ */
283
+ get preparedQuery(): PreparedQuery;
284
+ /**
285
+ * Retrieve a prepared query for the final unnamed query at the top level of a model.
286
+ *
287
+ * @return A prepared query.
288
+ */
289
+ getPreparedQuery(): PreparedQuery;
290
+ /**
291
+ * Retrieve an `Explore` from the model by name.
292
+ *
293
+ * @param name The name of the `Explore` to retrieve.
294
+ * @return An `Explore`.
295
+ */
296
+ getExploreByName(name: string): Explore;
297
+ /**
298
+ * Get an array of `Explore`s contained in the model.
299
+ *
300
+ * @return An array of `Explore`s contained in the model.
301
+ */
302
+ get explores(): Explore[];
303
+ /**
304
+ * Get an array of `NamedQueryDef`s contained in the model.
305
+ *
306
+ * @return An array of `NamedQueryDef`s contained in the model.
307
+ */
308
+ get namedQueries(): NamedQueryDef[];
309
+ get exportedExplores(): Explore[];
310
+ get _modelDef(): ModelDef;
311
+ /**
312
+ * Get the build plan for all #@ persist sources.
313
+ *
314
+ * Walks through ALL queries and sources in the model, finding any persistent
315
+ * dependencies they reference (including hidden dependencies from imports).
316
+ *
317
+ * Returns a BuildPlan containing:
318
+ * - `graphs`: Build graphs for root sources only (minimal build set)
319
+ * - `sources`: Map from sourceId to PersistSource (all persist sources)
320
+ *
321
+ * The minimal build set contains only "root" sources - those not depended
322
+ * on by any other persist source. Each root includes its transitive
323
+ * dependencies in the dependsOn field, preserving the tree structure
324
+ * for parallel building.
325
+ *
326
+ * @return BuildPlan with graphs and sources map
327
+ */
328
+ getBuildPlan(): BuildPlan;
329
+ }
330
+ /**
331
+ * The complete build plan for persistent sources in a model.
332
+ *
333
+ * Returned by `Model.getBuildPlan()`. Contains:
334
+ * - `graphs`: Dependency-ordered build graphs grouped by connection
335
+ * - `sources`: Map from sourceId to PersistSource for accessing source details
336
+ */
337
+ export interface BuildPlan {
338
+ /** Build graphs grouped by connection, with leveled nodes for parallel execution */
339
+ graphs: BuildGraph[];
340
+ /** Map from sourceId to PersistSource for accessing source details */
341
+ sources: Record<string, PersistSource>;
342
+ }
343
+ /**
344
+ * A wrapper around a source that has #@ persist annotation.
345
+ *
346
+ * Only sources backed by queries can be persisted:
347
+ * - `query_source`: `source: x is y -> {...}`
348
+ * - `sql_select`: `source: x is conn.sql("...")`
349
+ *
350
+ * Provides access to source identity, SQL generation, and metadata needed
351
+ * for building and caching source results.
352
+ */
353
+ export declare class PersistSource implements Taggable {
354
+ private readonly explore;
355
+ private readonly model;
356
+ private readonly persistableDef;
357
+ constructor(explore: Explore, model: Model);
358
+ /**
359
+ * The name of this source.
360
+ */
361
+ get name(): string;
362
+ /**
363
+ * The stable identity of this source: "sourceName@modelURL".
364
+ * Used as lookup key during compilation and in build graphs.
365
+ */
366
+ get sourceID(): string;
367
+ /**
368
+ * The underlying Explore.
369
+ */
370
+ get _explore(): Explore;
371
+ /**
372
+ * The annotation on this source.
373
+ */
374
+ get annotation(): Annotation | undefined;
375
+ /**
376
+ * Parse the source's tags.
377
+ */
378
+ tagParse(spec?: TagParseSpec): MalloyTagParse;
379
+ /**
380
+ * Get annotation taglines matching an optional prefix.
381
+ */
382
+ getTaglines(prefix?: RegExp): string[];
383
+ /**
384
+ * The connection name for this source.
385
+ */
386
+ get connectionName(): string;
387
+ /**
388
+ * The dialect name for this source.
389
+ */
390
+ get dialectName(): string;
391
+ /**
392
+ * The dialect for this source.
393
+ */
394
+ get dialect(): Dialect;
395
+ /**
396
+ * Compute the BuildID for this source.
397
+ *
398
+ * BuildID is a hash of the connection config and SQL content.
399
+ * Different connection configs or SQL changes produce different BuildIDs.
400
+ *
401
+ * @param connectionDigest - Digest from connection.getDigest()
402
+ * @param sql - The SQL for this source (from getSQL())
403
+ * @return The BuildID for manifest lookup
404
+ */
405
+ makeBuildId(connectionDigest: string, sql: string): BuildID;
406
+ /**
407
+ * Get the SQL for this persist source.
408
+ *
409
+ * For sql_select sources, returns the SQL string (with segment expansion).
410
+ * For query_source sources, compiles the inner query to SQL.
411
+ *
412
+ * @param options - Compile options including buildManifest for persistence.
413
+ * @return The SQL string for this source.
414
+ */
415
+ getSQL(options?: CompileQueryOptions): string;
416
+ /**
417
+ * Get the underlying persistable source definition.
418
+ */
419
+ get _sourceDef(): PersistableSourceDef;
420
+ /**
421
+ * Get the Model this source belongs to.
422
+ */
423
+ get _model(): Model;
424
+ }
425
+ export declare class PreparedQuery implements Taggable {
426
+ private _model;
427
+ problems: LogMessage[];
428
+ name?: string | undefined;
429
+ _query: InternalQuery | NamedQueryDef;
430
+ constructor(query: InternalQuery, _model: Model, problems: LogMessage[], name?: string | undefined);
431
+ get _modelDef(): ModelDef;
432
+ tagParse(spec?: TagParseSpec): MalloyTagParse;
433
+ getTaglines(prefix?: RegExp): string[];
434
+ /**
435
+ * Generate the SQL for this query.
436
+ *
437
+ * @return A fully-prepared query (which contains the generated SQL).
438
+ */
439
+ get preparedResult(): PreparedResult;
440
+ /**
441
+ * Generate the SQL for this query.
442
+ *
443
+ * @return A fully-prepared query (which contains the generated SQL).
444
+ * @param options.eventStream An event stream to use when compiling the SQL
445
+ */
446
+ getPreparedResult(options?: CompileQueryOptions): PreparedResult;
447
+ get dialect(): string;
448
+ /**
449
+ * Get the flattened version of a query -- one that does not have a `pipeHead`.
450
+ * @deprecated Because queries can no longer have `pipeHead`s.
451
+ */
452
+ getFlattenedQuery(_defaultName: string): PreparedQuery;
453
+ /**
454
+ * Get the Model this query belongs to.
455
+ */
456
+ get model(): Model;
457
+ }
458
+ export declare class PreparedResult implements Taggable {
459
+ protected modelDef: ModelDef;
460
+ protected inner: CompiledQuery;
461
+ constructor(query: CompiledQuery, modelDef: ModelDef);
462
+ static fromJson({ query, modelDef, }: PreparedResultJSON): PreparedResult;
463
+ tagParse(spec?: TagParseSpec): MalloyTagParse;
464
+ getTaglines(prefix?: RegExp): string[];
465
+ get annotation(): Annotation | undefined;
466
+ get modelAnnotation(): Annotation | undefined;
467
+ get modelTag(): Tag;
468
+ /**
469
+ * @return The name of the connection this query should be run against.
470
+ */
471
+ get connectionName(): string;
472
+ get _rawQuery(): CompiledQuery;
473
+ get _modelDef(): ModelDef;
474
+ /**
475
+ * @return The SQL that should be run against the SQL runner
476
+ * with the connection name `this.getConnectionName()`.
477
+ */
478
+ get sql(): string;
479
+ /**
480
+ * @return The `Explore` representing the data that will be returned by running this query.
481
+ */
482
+ get resultExplore(): Explore;
483
+ get sourceExplore(): Explore | undefined;
484
+ get _sourceExploreName(): string;
485
+ get _sourceArguments(): Record<string, Argument> | undefined;
486
+ get _sourceFilters(): FilterCondition[];
487
+ /**
488
+ * @return Whether this result has a schema. DDL statements (INSTALL, LOAD,
489
+ * CREATE SECRET, etc.) do not return a schema.
490
+ */
491
+ get hasSchema(): boolean;
492
+ }
493
+ export {};