@malloydata/malloy-interfaces 0.0.79-dev230822044438 → 0.0.79-dev230822184259
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.
|
@@ -19,7 +19,7 @@ export interface QueryInfo {
|
|
|
19
19
|
export declare const dayIndex: number;
|
|
20
20
|
export declare function inDays(units: string): boolean;
|
|
21
21
|
export declare function qtz(qi: QueryInfo): string | undefined;
|
|
22
|
-
export
|
|
22
|
+
export type DialectFieldList = DialectField[];
|
|
23
23
|
export declare abstract class Dialect {
|
|
24
24
|
abstract name: string;
|
|
25
25
|
abstract defaultNumberType: string;
|
|
@@ -3,8 +3,8 @@ interface ParamBase {
|
|
|
3
3
|
name: string;
|
|
4
4
|
type: AtomicFieldType;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type ConstantExpr = Expr;
|
|
7
|
+
type Condition = Expr;
|
|
8
8
|
interface ParamCondition extends ParamBase {
|
|
9
9
|
condition: Condition | null;
|
|
10
10
|
}
|
|
@@ -12,7 +12,7 @@ interface ParamValue extends ParamBase {
|
|
|
12
12
|
value: ConstantExpr | null;
|
|
13
13
|
constant: boolean;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export type Parameter = ParamCondition | ParamValue;
|
|
16
16
|
export declare function isValueParameter(p: Parameter): p is ParamValue;
|
|
17
17
|
export declare function isConditionParameter(p: Parameter): p is ParamCondition;
|
|
18
18
|
export declare function paramHasValue(p: Parameter): boolean;
|
|
@@ -57,7 +57,7 @@ export interface DocumentFieldReference extends DocumentReferenceBase {
|
|
|
57
57
|
type: 'fieldReference';
|
|
58
58
|
definition: FieldDef;
|
|
59
59
|
}
|
|
60
|
-
export
|
|
60
|
+
export type DocumentReference = DocumentExploreReference | DocumentQueryReference | DocumentSQLBlockReference | DocumentFieldReference | DocumentJoinReference;
|
|
61
61
|
/** put location into the parse tree. */
|
|
62
62
|
export interface HasLocation {
|
|
63
63
|
location?: DocumentLocation;
|
|
@@ -229,9 +229,9 @@ export interface NumberLiteralFragment extends DialectFragmentBase {
|
|
|
229
229
|
function: 'numberLiteral';
|
|
230
230
|
literal: string;
|
|
231
231
|
}
|
|
232
|
-
export
|
|
233
|
-
export
|
|
234
|
-
export
|
|
232
|
+
export type DialectFragment = DivFragment | TimeLiteralFragment | NowFragment | TimeDeltaFragment | TimeDiffFragment | TimeTruncFragment | TypecastFragment | TimeExtractFragment | StringLiteralFragment | RegexpLiteralFragment | NumberLiteralFragment | RegexpMatchFragment;
|
|
233
|
+
export type Fragment = string | ApplyFragment | ApplyValueFragment | FieldFragment | ParameterFragment | FilterFragment | OutputFieldFragment | AggregateFragment | UngroupFragment | DialectFragment | FunctionParameterFragment | FunctionCallFragment | SQLExpressionFragment | SpreadFragment;
|
|
234
|
+
export type Expr = Fragment[];
|
|
235
235
|
export interface TypedValue {
|
|
236
236
|
value: Expr;
|
|
237
237
|
valueType: AtomicFieldType;
|
|
@@ -239,7 +239,7 @@ export interface TypedValue {
|
|
|
239
239
|
export interface TimeValue extends TypedValue {
|
|
240
240
|
valueType: TimeFieldType;
|
|
241
241
|
}
|
|
242
|
-
|
|
242
|
+
type TagElement = Expr | string;
|
|
243
243
|
/**
|
|
244
244
|
* Return an Expr based on the string template, subsittutions can be
|
|
245
245
|
* either strings, or other Exprs.
|
|
@@ -251,7 +251,7 @@ declare type TagElement = Expr | string;
|
|
|
251
251
|
* ```
|
|
252
252
|
*/
|
|
253
253
|
export declare function mkExpr(src: TemplateStringsArray, ...exprs: TagElement[]): Expr;
|
|
254
|
-
export
|
|
254
|
+
export type ExpressionType = 'scalar' | 'aggregate' | 'scalar_analytic' | 'aggregate_analytic' | 'ungrouped_aggregate';
|
|
255
255
|
export interface Expression {
|
|
256
256
|
e?: Expr;
|
|
257
257
|
expressionType?: ExpressionType;
|
|
@@ -269,12 +269,12 @@ export declare function maxOfExpressionTypes(types: ExpressionType[]): Expressio
|
|
|
269
269
|
interface JustExpression {
|
|
270
270
|
e: Expr;
|
|
271
271
|
}
|
|
272
|
-
|
|
272
|
+
type HasExpression = FieldDef & JustExpression;
|
|
273
273
|
/** Grants access to the expression property of a FieldDef */
|
|
274
274
|
export declare function hasExpression(f: FieldDef): f is HasExpression;
|
|
275
|
-
export
|
|
275
|
+
export type TimeFieldType = 'date' | 'timestamp';
|
|
276
276
|
export declare function isTimeFieldType(s: string): s is TimeFieldType;
|
|
277
|
-
export
|
|
277
|
+
export type AtomicFieldType = 'string' | 'number' | TimeFieldType | 'boolean' | 'unsupported' | 'json' | 'error';
|
|
278
278
|
export declare function isAtomicFieldType(s: string): s is AtomicFieldType;
|
|
279
279
|
/**
|
|
280
280
|
* Fields which contain scalar data all inherit from this. The field
|
|
@@ -313,11 +313,11 @@ export interface FieldUnsupportedDef extends FieldAtomicDef {
|
|
|
313
313
|
export interface FieldErrorDef extends FieldAtomicDef {
|
|
314
314
|
type: 'error';
|
|
315
315
|
}
|
|
316
|
-
export
|
|
316
|
+
export type DateUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
317
317
|
export declare function isDateUnit(str: string): str is DateUnit;
|
|
318
|
-
export
|
|
318
|
+
export type TimestampUnit = DateUnit | 'hour' | 'minute' | 'second';
|
|
319
319
|
export declare function isTimestampUnit(s: string): s is TimestampUnit;
|
|
320
|
-
export
|
|
320
|
+
export type ExtractUnit = TimestampUnit | 'day_of_week' | 'day_of_year';
|
|
321
321
|
export declare function isExtractUnit(s: string): s is ExtractUnit;
|
|
322
322
|
/** Value types distinguished by their usage in generated SQL, particularly with respect to filters. */
|
|
323
323
|
export declare enum ValueType {
|
|
@@ -326,7 +326,7 @@ export declare enum ValueType {
|
|
|
326
326
|
Number = "number",
|
|
327
327
|
String = "string"
|
|
328
328
|
}
|
|
329
|
-
export
|
|
329
|
+
export type TimeValueType = ValueType.Date | ValueType.Timestamp;
|
|
330
330
|
/** Scalar Date Field. */
|
|
331
331
|
export interface FieldDateDef extends FieldAtomicDef {
|
|
332
332
|
type: 'date';
|
|
@@ -350,11 +350,11 @@ export interface ByExpression {
|
|
|
350
350
|
by: 'expression';
|
|
351
351
|
e: Expr;
|
|
352
352
|
}
|
|
353
|
-
export
|
|
353
|
+
export type By = ByName | ByExpression;
|
|
354
354
|
export declare function isByName(by: By | undefined): by is ByName;
|
|
355
355
|
export declare function isByExpression(by: By | undefined): by is ByExpression;
|
|
356
356
|
/** reference to a data source */
|
|
357
|
-
export
|
|
357
|
+
export type StructRef = string | StructDef;
|
|
358
358
|
export declare function refIsStructDef(ref: StructRef): ref is StructDef;
|
|
359
359
|
/** join pattern structs is a struct. */
|
|
360
360
|
export interface JoinedStruct {
|
|
@@ -381,8 +381,8 @@ export interface Query extends Pipeline, Filtered, HasLocation {
|
|
|
381
381
|
annotation?: Annotation;
|
|
382
382
|
modelAnnotation?: Annotation;
|
|
383
383
|
}
|
|
384
|
-
export
|
|
385
|
-
export
|
|
384
|
+
export type NamedQuery = Query & NamedObject;
|
|
385
|
+
export type PipeSegment = QuerySegment | IndexSegment;
|
|
386
386
|
export interface ReduceSegment extends QuerySegment {
|
|
387
387
|
type: 'reduce';
|
|
388
388
|
}
|
|
@@ -392,7 +392,7 @@ export interface ProjectSegment extends QuerySegment {
|
|
|
392
392
|
}
|
|
393
393
|
export declare function isProjectSegment(pe: PipeSegment): pe is ProjectSegment;
|
|
394
394
|
export declare function isQuerySegment(pe: PipeSegment): pe is QuerySegment;
|
|
395
|
-
export
|
|
395
|
+
export type Sampling = SamplingRows | SamplingEnable | SamplingPercent;
|
|
396
396
|
interface SamplingRows {
|
|
397
397
|
rows: number;
|
|
398
398
|
}
|
|
@@ -426,14 +426,14 @@ export interface TurtleDef extends NamedObject, Pipeline {
|
|
|
426
426
|
type: 'turtle';
|
|
427
427
|
annotation?: Annotation;
|
|
428
428
|
}
|
|
429
|
-
export
|
|
429
|
+
export type JoinRelationship = 'one_to_one' | 'one_to_many' | 'many_to_one' | 'many_to_many';
|
|
430
430
|
export interface JoinOn {
|
|
431
431
|
type: 'one' | 'many' | 'cross';
|
|
432
432
|
onExpression?: Expr;
|
|
433
433
|
}
|
|
434
434
|
export declare function isJoinOn(sr: StructRelationship): sr is JoinOn;
|
|
435
435
|
/** types of joins. */
|
|
436
|
-
export
|
|
436
|
+
export type StructRelationship = {
|
|
437
437
|
type: 'basetable';
|
|
438
438
|
connectionName: string;
|
|
439
439
|
} | JoinOn | {
|
|
@@ -446,7 +446,7 @@ export declare type StructRelationship = {
|
|
|
446
446
|
export interface SQLFragment {
|
|
447
447
|
sql: string;
|
|
448
448
|
}
|
|
449
|
-
export
|
|
449
|
+
export type SQLPhrase = Query | SQLFragment;
|
|
450
450
|
export declare function isSQLFragment(f: SQLPhrase): f is SQLFragment;
|
|
451
451
|
/**
|
|
452
452
|
* A source reference to an SQL block. The compiler uses these to request
|
|
@@ -469,7 +469,7 @@ interface SubquerySource {
|
|
|
469
469
|
sqlBlock: SQLBlock;
|
|
470
470
|
}
|
|
471
471
|
/** where does the struct come from? */
|
|
472
|
-
export
|
|
472
|
+
export type StructSource = {
|
|
473
473
|
type: 'table';
|
|
474
474
|
tablePath: string;
|
|
475
475
|
} | {
|
|
@@ -498,8 +498,8 @@ export interface StructDef extends NamedObject, ResultStructMetadata, Filtered {
|
|
|
498
498
|
annotation?: Annotation;
|
|
499
499
|
modelAnnotation?: ModelAnnotation;
|
|
500
500
|
}
|
|
501
|
-
export
|
|
502
|
-
export
|
|
501
|
+
export type ExpressionValueType = AtomicFieldType | 'null' | 'duration' | 'any' | 'regular expression';
|
|
502
|
+
export type FieldValueType = ExpressionValueType | 'turtle' | 'struct';
|
|
503
503
|
export interface ExpressionTypeDesc {
|
|
504
504
|
dataType: FieldValueType;
|
|
505
505
|
expressionType: ExpressionType;
|
|
@@ -511,7 +511,7 @@ export interface FunctionParamTypeDesc {
|
|
|
511
511
|
expressionType: ExpressionType | undefined;
|
|
512
512
|
evalSpace: EvalSpace;
|
|
513
513
|
}
|
|
514
|
-
export
|
|
514
|
+
export type EvalSpace = 'constant' | 'input' | 'output' | 'literal';
|
|
515
515
|
export declare function mergeEvalSpaces(...evalSpaces: EvalSpace[]): EvalSpace;
|
|
516
516
|
export interface TypeDesc {
|
|
517
517
|
dataType: FieldValueType;
|
|
@@ -549,20 +549,20 @@ export interface SQLBlockStructDef extends StructDef {
|
|
|
549
549
|
}
|
|
550
550
|
export declare function isSQLBlockStruct(sd: StructDef): sd is SQLBlockStructDef;
|
|
551
551
|
/** any of the different field types */
|
|
552
|
-
export
|
|
552
|
+
export type FieldTypeDef = FieldStringDef | FieldDateDef | FieldTimestampDef | FieldNumberDef | FieldBooleanDef | FieldJSONDef | FieldUnsupportedDef | FieldErrorDef;
|
|
553
553
|
export declare function isFieldTypeDef(f: FieldDef): f is FieldTypeDef;
|
|
554
554
|
export declare function isFieldTimeBased(f: FieldDef): f is FieldTimestampDef | FieldDateDef;
|
|
555
555
|
export declare function isFieldStructDef(f: FieldDef): f is StructDef;
|
|
556
556
|
/** field reference in a query */
|
|
557
|
-
export
|
|
557
|
+
export type FieldTypeRef = string | FieldTypeDef | FilteredAliasedName;
|
|
558
558
|
/** field reference with with possibly and order by. */
|
|
559
|
-
export
|
|
559
|
+
export type QueryFieldDef = FieldTypeRef | TurtleDef;
|
|
560
560
|
/** basics statement */
|
|
561
|
-
export
|
|
561
|
+
export type FieldDef = FieldTypeDef | StructDef | TurtleDef;
|
|
562
562
|
/** reference to a field */
|
|
563
|
-
export
|
|
563
|
+
export type FieldRef = string | FieldDef;
|
|
564
564
|
/** which field is the primary key in this struct */
|
|
565
|
-
export
|
|
565
|
+
export type PrimaryKeyRef = string;
|
|
566
566
|
/** filters */
|
|
567
567
|
export interface FilterExpression {
|
|
568
568
|
expression: Expr;
|
|
@@ -571,7 +571,7 @@ export interface FilterExpression {
|
|
|
571
571
|
}
|
|
572
572
|
/** Get the output name for a NamedObject */
|
|
573
573
|
export declare function getIdentifier(n: AliasedName): string;
|
|
574
|
-
export
|
|
574
|
+
export type NamedModelObject = StructDef | NamedQuery | FunctionDef | ConnectionDef;
|
|
575
575
|
/** Result of parsing a model file */
|
|
576
576
|
export interface ModelDef {
|
|
577
577
|
name: string;
|
|
@@ -580,8 +580,8 @@ export interface ModelDef {
|
|
|
580
580
|
annotation?: ModelAnnotation;
|
|
581
581
|
}
|
|
582
582
|
/** Very common record type */
|
|
583
|
-
export
|
|
584
|
-
export
|
|
583
|
+
export type NamedStructDefs = Record<string, StructDef>;
|
|
584
|
+
export type NamedModelObjects = Record<string, NamedModelObject>;
|
|
585
585
|
/** Malloy source annotations attached to objects */
|
|
586
586
|
export interface Annotation {
|
|
587
587
|
inherits?: Annotation;
|
|
@@ -596,21 +596,21 @@ export interface Note {
|
|
|
596
596
|
export interface ModelAnnotation extends Annotation {
|
|
597
597
|
id: string;
|
|
598
598
|
}
|
|
599
|
-
export
|
|
599
|
+
export type QueryScalar = string | boolean | number | Date | Buffer | null;
|
|
600
600
|
/** One value in one column of returned data. */
|
|
601
|
-
export
|
|
601
|
+
export type QueryValue = QueryScalar | QueryData | QueryDataRow;
|
|
602
602
|
/** A row of returned data. */
|
|
603
|
-
export
|
|
603
|
+
export type QueryDataRow = {
|
|
604
604
|
[columnName: string]: QueryValue;
|
|
605
605
|
};
|
|
606
606
|
/** Returned query data. */
|
|
607
|
-
export
|
|
607
|
+
export type QueryData = QueryDataRow[];
|
|
608
608
|
/** Query execution stats. */
|
|
609
|
-
export
|
|
609
|
+
export type QueryRunStats = {
|
|
610
610
|
queryCostBytes?: number;
|
|
611
611
|
};
|
|
612
612
|
/** Returned Malloy query data */
|
|
613
|
-
export
|
|
613
|
+
export type MalloyQueryData = {
|
|
614
614
|
rows: QueryDataRow[];
|
|
615
615
|
totalRows: number;
|
|
616
616
|
runStats?: QueryRunStats;
|
|
@@ -642,7 +642,7 @@ export interface SearchResultRow {
|
|
|
642
642
|
field_value: string;
|
|
643
643
|
weight: number;
|
|
644
644
|
}
|
|
645
|
-
export
|
|
645
|
+
export type SearchResult = SearchResultRow[];
|
|
646
646
|
export declare function isDimensional(field: FieldDef): boolean;
|
|
647
647
|
export declare function isPhysical(field: FieldDef): boolean;
|
|
648
648
|
export declare function getDimensions(structDef: StructDef): FieldAtomicDef[];
|
|
@@ -258,7 +258,7 @@ var ValueType;
|
|
|
258
258
|
ValueType["Timestamp"] = "timestamp";
|
|
259
259
|
ValueType["Number"] = "number";
|
|
260
260
|
ValueType["String"] = "string";
|
|
261
|
-
})(ValueType
|
|
261
|
+
})(ValueType || (exports.ValueType = ValueType = {}));
|
|
262
262
|
function isByName(by) {
|
|
263
263
|
if (by === undefined) {
|
|
264
264
|
return false;
|
package/dist/runtime_types.d.ts
CHANGED
|
@@ -4,19 +4,19 @@ import { Dialect } from './dialect';
|
|
|
4
4
|
/**
|
|
5
5
|
* The contents of a Malloy query document.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type QueryString = string;
|
|
8
8
|
/**
|
|
9
9
|
* The contents of a Malloy model document.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type ModelString = string;
|
|
12
12
|
/**
|
|
13
13
|
* A URL whose contents is a Malloy model.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type ModelURL = URL;
|
|
16
16
|
/**
|
|
17
17
|
* A URL whose contents is a Malloy query.
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export type QueryURL = URL;
|
|
20
20
|
/**
|
|
21
21
|
* An object capable of reading the contents of a URL in some context.
|
|
22
22
|
*/
|
|
@@ -62,7 +62,7 @@ export interface InfoConnection {
|
|
|
62
62
|
*/
|
|
63
63
|
get name(): string;
|
|
64
64
|
}
|
|
65
|
-
export
|
|
65
|
+
export type ConnectionParameterValue = string | number | boolean;
|
|
66
66
|
export interface ConnectionParameter {
|
|
67
67
|
name: string;
|
|
68
68
|
label: string;
|
|
@@ -71,8 +71,8 @@ export interface ConnectionParameter {
|
|
|
71
71
|
isSecret?: boolean;
|
|
72
72
|
defaultValue?: ConnectionParameterValue;
|
|
73
73
|
}
|
|
74
|
-
export
|
|
75
|
-
export
|
|
74
|
+
export type ConnectionConfigSchema = ConnectionParameter[];
|
|
75
|
+
export type ConnectionConfig = Record<string, ConnectionParameterValue>;
|
|
76
76
|
export interface ConnectionFactory {
|
|
77
77
|
connectionName: string;
|
|
78
78
|
configSchema: ConnectionConfigSchema;
|