@malloydata/malloy 0.0.22-dev230126015148 → 0.0.22-dev230206094309

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 (93) hide show
  1. package/package.json +2 -2
  2. package/dist/connection_utils.d.ts +0 -1
  3. package/dist/connection_utils.js +0 -66
  4. package/dist/dialect/dialect.d.ts +0 -66
  5. package/dist/dialect/dialect.js +0 -85
  6. package/dist/dialect/dialect_map.d.ts +0 -3
  7. package/dist/dialect/dialect_map.js +0 -45
  8. package/dist/dialect/duckdb.d.ts +0 -52
  9. package/dist/dialect/duckdb.js +0 -364
  10. package/dist/dialect/index.d.ts +0 -6
  11. package/dist/dialect/index.js +0 -37
  12. package/dist/dialect/postgres.d.ts +0 -52
  13. package/dist/dialect/postgres.js +0 -330
  14. package/dist/dialect/standardsql.d.ts +0 -49
  15. package/dist/dialect/standardsql.js +0 -381
  16. package/dist/index.d.ts +0 -10
  17. package/dist/index.js +0 -59
  18. package/dist/lang/ast/apply-expr.d.ts +0 -3
  19. package/dist/lang/ast/apply-expr.js +0 -34
  20. package/dist/lang/ast/ast-expr.d.ts +0 -206
  21. package/dist/lang/ast/ast-expr.js +0 -781
  22. package/dist/lang/ast/ast-main.d.ts +0 -915
  23. package/dist/lang/ast/ast-main.js +0 -3672
  24. package/dist/lang/ast/ast-time-expr.d.ts +0 -69
  25. package/dist/lang/ast/ast-time-expr.js +0 -389
  26. package/dist/lang/ast/ast-types.d.ts +0 -83
  27. package/dist/lang/ast/ast-types.js +0 -225
  28. package/dist/lang/ast/index.d.ts +0 -5
  29. package/dist/lang/ast/index.js +0 -44
  30. package/dist/lang/ast/time-utils.d.ts +0 -9
  31. package/dist/lang/ast/time-utils.js +0 -104
  32. package/dist/lang/field-utils.d.ts +0 -5
  33. package/dist/lang/field-utils.js +0 -43
  34. package/dist/lang/index.d.ts +0 -9
  35. package/dist/lang/index.js +0 -32
  36. package/dist/lang/lib/Malloy/MalloyLexer.d.ts +0 -165
  37. package/dist/lang/lib/Malloy/MalloyLexer.js +0 -1232
  38. package/dist/lang/lib/Malloy/MalloyParser.d.ts +0 -1947
  39. package/dist/lang/lib/Malloy/MalloyParser.js +0 -11909
  40. package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +0 -2022
  41. package/dist/lang/lib/Malloy/MalloyParserListener.js +0 -4
  42. package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +0 -1274
  43. package/dist/lang/lib/Malloy/MalloyParserVisitor.js +0 -4
  44. package/dist/lang/parse-log.d.ts +0 -27
  45. package/dist/lang/parse-log.js +0 -51
  46. package/dist/lang/parse-malloy.d.ts +0 -236
  47. package/dist/lang/parse-malloy.js +0 -746
  48. package/dist/lang/parse-to-ast.d.ts +0 -155
  49. package/dist/lang/parse-to-ast.js +0 -990
  50. package/dist/lang/parse-tree-walkers/document-completion-walker.d.ts +0 -10
  51. package/dist/lang/parse-tree-walkers/document-completion-walker.js +0 -148
  52. package/dist/lang/parse-tree-walkers/document-help-context-walker.d.ts +0 -9
  53. package/dist/lang/parse-tree-walkers/document-help-context-walker.js +0 -107
  54. package/dist/lang/parse-tree-walkers/document-highlight-walker.d.ts +0 -83
  55. package/dist/lang/parse-tree-walkers/document-highlight-walker.js +0 -385
  56. package/dist/lang/parse-tree-walkers/document-symbol-walker.d.ts +0 -11
  57. package/dist/lang/parse-tree-walkers/document-symbol-walker.js +0 -182
  58. package/dist/lang/parse-tree-walkers/explore-query-walker.d.ts +0 -34
  59. package/dist/lang/parse-tree-walkers/explore-query-walker.js +0 -74
  60. package/dist/lang/parse-tree-walkers/find-external-references.d.ts +0 -11
  61. package/dist/lang/parse-tree-walkers/find-external-references.js +0 -61
  62. package/dist/lang/reference-list.d.ts +0 -10
  63. package/dist/lang/reference-list.js +0 -90
  64. package/dist/lang/space-field.d.ts +0 -17
  65. package/dist/lang/space-field.js +0 -127
  66. package/dist/lang/test/document-help-context-walker.spec.d.ts +0 -1
  67. package/dist/lang/test/document-help-context-walker.spec.js +0 -55
  68. package/dist/lang/test/document-symbol-walker.spec.d.ts +0 -1
  69. package/dist/lang/test/document-symbol-walker.spec.js +0 -110
  70. package/dist/lang/test/field-symbols.spec.d.ts +0 -1
  71. package/dist/lang/test/field-symbols.spec.js +0 -180
  72. package/dist/lang/test/parse.spec.d.ts +0 -14
  73. package/dist/lang/test/parse.spec.js +0 -2134
  74. package/dist/lang/test/test-translator.d.ts +0 -38
  75. package/dist/lang/test/test-translator.js +0 -344
  76. package/dist/lang/zone.d.ts +0 -57
  77. package/dist/lang/zone.js +0 -107
  78. package/dist/malloy.d.ts +0 -1146
  79. package/dist/malloy.js +0 -2413
  80. package/dist/model/index.d.ts +0 -2
  81. package/dist/model/index.js +0 -45
  82. package/dist/model/malloy_query.d.ts +0 -351
  83. package/dist/model/malloy_query.js +0 -3174
  84. package/dist/model/malloy_types.d.ts +0 -551
  85. package/dist/model/malloy_types.js +0 -378
  86. package/dist/model/sql_block.d.ts +0 -7
  87. package/dist/model/sql_block.js +0 -56
  88. package/dist/model/utils.d.ts +0 -22
  89. package/dist/model/utils.js +0 -102
  90. package/dist/run_sql_options.d.ts +0 -3
  91. package/dist/run_sql_options.js +0 -25
  92. package/dist/runtime_types.d.ts +0 -105
  93. package/dist/runtime_types.js +0 -25
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // Generated from MalloyParser.g4 by ANTLR 4.9.0-SNAPSHOT
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- //# sourceMappingURL=MalloyParserVisitor.js.map
@@ -1,27 +0,0 @@
1
- import { DocumentLocation } from "../model/malloy_types";
2
- export declare type LogSeverity = "error" | "warn" | "debug";
3
- /**
4
- * Default severity is "error"
5
- */
6
- export interface LogMessage {
7
- message: string;
8
- at?: DocumentLocation;
9
- severity?: LogSeverity;
10
- }
11
- export interface MessageLogger {
12
- log(logMsg: LogMessage): void;
13
- reset(): void;
14
- getLog(): LogMessage[];
15
- hasErrors(): boolean;
16
- noErrors(): boolean;
17
- empty(): boolean;
18
- }
19
- export declare class MessageLog implements MessageLogger {
20
- private rawLog;
21
- getLog(): LogMessage[];
22
- log(logMsg: LogMessage): void;
23
- reset(): void;
24
- noErrors(): boolean;
25
- hasErrors(): boolean;
26
- empty(): boolean;
27
- }
@@ -1,51 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2023 Google LLC
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining
6
- * a copy of this software and associated documentation files
7
- * (the "Software"), to deal in the Software without restriction,
8
- * including without limitation the rights to use, copy, modify, merge,
9
- * publish, distribute, sublicense, and/or sell copies of the Software,
10
- * and to permit persons to whom the Software is furnished to do so,
11
- * subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be
14
- * included in all copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
- */
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.MessageLog = void 0;
26
- class MessageLog {
27
- constructor() {
28
- this.rawLog = [];
29
- }
30
- getLog() {
31
- return this.rawLog;
32
- }
33
- log(logMsg) {
34
- this.rawLog.push(logMsg);
35
- }
36
- reset() {
37
- this.rawLog.length = 0;
38
- }
39
- noErrors() {
40
- return !this.hasErrors();
41
- }
42
- hasErrors() {
43
- const firstError = this.rawLog.find((l) => l.severity !== "warn");
44
- return firstError !== undefined;
45
- }
46
- empty() {
47
- return this.rawLog.length === 0;
48
- }
49
- }
50
- exports.MessageLog = MessageLog;
51
- //# sourceMappingURL=parse-log.js.map
@@ -1,236 +0,0 @@
1
- import { Token, CommonTokenStream, ParserRuleContext, CodePointCharStream } from "antlr4ts";
2
- import type { ParseTree } from "antlr4ts/tree";
3
- import { Query, NamedStructDefs, StructDef, ModelDef, SQLBlockSource, DocumentReference, DocumentPosition, DocumentLocation, DocumentRange, SQLBlockStructDef } from "../model/malloy_types";
4
- import * as ast from "./ast";
5
- import { LogMessage, MessageLog } from "./parse-log";
6
- import { Zone, ZoneData } from "./zone";
7
- import { DocumentSymbol } from "./parse-tree-walkers/document-symbol-walker";
8
- import { DocumentHighlight } from "./parse-tree-walkers/document-highlight-walker";
9
- import { DocumentCompletion } from "./parse-tree-walkers/document-completion-walker";
10
- import { DocumentHelpContext } from "./parse-tree-walkers/document-help-context-walker";
11
- import { ReferenceList } from "./reference-list";
12
- /**
13
- * The translation interface is essentially a request/respone protocol, and
14
- * this is the list of all the "protocol" messages.
15
- */
16
- interface FinalResponse {
17
- final: true;
18
- }
19
- interface ErrorResponse {
20
- errors: LogMessage[];
21
- }
22
- declare type FatalResponse = FinalResponse & ErrorResponse;
23
- export interface NeedSchemaData {
24
- tables: string[];
25
- }
26
- export interface NeedURLData {
27
- urls: string[];
28
- }
29
- export interface NeedCompileSQL {
30
- compileSQL: SQLBlockSource;
31
- partialModel: ModelDef | undefined;
32
- }
33
- interface NeededData extends NeedURLData, NeedSchemaData, NeedCompileSQL {
34
- }
35
- export declare type DataRequestResponse = Partial<NeededData> | null;
36
- export declare type ModelDataRequest = NeedCompileSQL | undefined;
37
- interface ASTData extends ErrorResponse, NeededData, FinalResponse {
38
- ast: ast.MalloyElement;
39
- }
40
- declare type ASTResponse = Partial<ASTData>;
41
- interface Metadata extends NeededData, ErrorResponse, FinalResponse {
42
- symbols: DocumentSymbol[];
43
- highlights: DocumentHighlight[];
44
- }
45
- declare type MetadataResponse = Partial<Metadata>;
46
- interface Completions extends NeededData, ErrorResponse, FinalResponse {
47
- completions: DocumentCompletion[];
48
- }
49
- declare type CompletionsResponse = Partial<Completions>;
50
- interface HelpContext extends NeededData, ErrorResponse, FinalResponse {
51
- helpContext: DocumentHelpContext | undefined;
52
- }
53
- declare type HelpContextResponse = Partial<HelpContext>;
54
- interface TranslatedResponseData extends NeededData, ErrorResponse, FinalResponse {
55
- translated: {
56
- modelDef: ModelDef;
57
- queryList: Query[];
58
- sqlBlocks: SQLBlockStructDef[];
59
- };
60
- }
61
- export declare type TranslateResponse = Partial<TranslatedResponseData>;
62
- declare type StepResponses = DataRequestResponse | ASTResponse | TranslateResponse | ParseResponse | MetadataResponse;
63
- /**
64
- * A Translation is a series of translation steps. Each step can depend
65
- * on other steps, in which case the preceeding steps will be passed
66
- * to the constructor. The translator methods will then ask the final
67
- * step for the answer, and it will call up the chain asking all the
68
- * steps that it depends on for their answers.
69
- *
70
- * Any step can return a result which will be ...
71
- * "I had errors, go no further"
72
- * "I hit a spot where I need more data before I can continue"
73
- * "I am done, here is the result of this step"
74
- */
75
- interface TranslationStep {
76
- step(that: MalloyTranslation): StepResponses;
77
- }
78
- export interface MalloyParseRoot {
79
- root: ParseTree;
80
- tokenStream: CommonTokenStream;
81
- sourceStream: CodePointCharStream;
82
- subTranslator: MalloyTranslation;
83
- malloyVersion: string;
84
- }
85
- interface ParseData extends ErrorResponse, NeedURLData, FinalResponse {
86
- parse: MalloyParseRoot;
87
- }
88
- declare type ParseResponse = Partial<ParseData>;
89
- /**
90
- * ParseStep -- Parse the source URL
91
- */
92
- interface SourceInfo {
93
- lines: string[];
94
- at: {
95
- begin: number;
96
- end: number;
97
- }[];
98
- length: number;
99
- }
100
- declare class ParseStep implements TranslationStep {
101
- response?: ParseResponse;
102
- sourceInfo?: SourceInfo;
103
- step(that: MalloyTranslation): ParseResponse;
104
- /**
105
- * Split the source up into lines so we can correctly compute offset
106
- * to the line/char positions favored by LSP and VSCode.
107
- */
108
- private getSourceInfo;
109
- private runParser;
110
- }
111
- declare class ImportsAndTablesStep implements TranslationStep {
112
- readonly parseStep: ParseStep;
113
- private alreadyLooked;
114
- constructor(parseStep: ParseStep);
115
- step(that: MalloyTranslation): DataRequestResponse | ParseResponse;
116
- }
117
- declare class ASTStep implements TranslationStep {
118
- readonly importStep: ImportsAndTablesStep;
119
- response?: ASTResponse;
120
- private walked;
121
- constructor(importStep: ImportsAndTablesStep);
122
- step(that: MalloyTranslation): ASTResponse;
123
- }
124
- declare class MetadataStep implements TranslationStep {
125
- readonly parseStep: ParseStep;
126
- response?: MetadataResponse;
127
- constructor(parseStep: ParseStep);
128
- step(that: MalloyTranslation): MetadataResponse;
129
- }
130
- declare class CompletionsStep implements TranslationStep {
131
- readonly parseStep: ParseStep;
132
- constructor(parseStep: ParseStep);
133
- step(that: MalloyTranslation, position?: {
134
- line: number;
135
- character: number;
136
- }): CompletionsResponse;
137
- }
138
- declare class HelpContextStep implements TranslationStep {
139
- readonly parseStep: ParseStep;
140
- constructor(parseStep: ParseStep);
141
- step(that: MalloyTranslation, position?: {
142
- line: number;
143
- character: number;
144
- }): HelpContextResponse;
145
- }
146
- declare class TranslateStep implements TranslationStep {
147
- readonly astStep: ASTStep;
148
- response?: TranslateResponse;
149
- constructor(astStep: ASTStep);
150
- step(that: MalloyTranslation, extendingModel?: ModelDef): TranslateResponse;
151
- }
152
- export declare abstract class MalloyTranslation {
153
- readonly sourceURL: string;
154
- grammarRule: string;
155
- abstract root: MalloyTranslator;
156
- childTranslators: Map<string, MalloyTranslation>;
157
- urlIsFullPath?: boolean;
158
- queryList: Query[];
159
- sqlBlocks: SQLBlockStructDef[];
160
- modelDef: ModelDef;
161
- readonly parseStep: ParseStep;
162
- readonly importsAndTablesStep: ImportsAndTablesStep;
163
- readonly astStep: ASTStep;
164
- readonly metadataStep: MetadataStep;
165
- readonly completionsStep: CompletionsStep;
166
- readonly helpContextStep: HelpContextStep;
167
- readonly translateStep: TranslateStep;
168
- readonly references: ReferenceList;
169
- constructor(sourceURL: string, grammarRule?: string);
170
- addChild(url: string): void;
171
- addReference(reference: DocumentReference): void;
172
- referenceAt(position: DocumentPosition): DocumentReference | undefined;
173
- fatalErrors(): FatalResponse;
174
- /**
175
- * The error log can grow as progressively deeper questions are asked.
176
- * When returning "errors so far", make a snapshot.
177
- */
178
- errors(): ErrorResponse;
179
- getLineMap(url: string): string[] | undefined;
180
- prettyErrors(): string;
181
- childRequest(importURL: string): ModelDataRequest;
182
- getChildExports(importURL: string): NamedStructDefs;
183
- private finalAnswer?;
184
- translate(extendingModel?: ModelDef): TranslateResponse;
185
- metadata(): MetadataResponse;
186
- completions(position: {
187
- line: number;
188
- character: number;
189
- }): CompletionsResponse;
190
- helpContext(position: {
191
- line: number;
192
- character: number;
193
- }): HelpContextResponse;
194
- defaultLocation(): DocumentLocation;
195
- rangeFromContext(pcx: ParserRuleContext): DocumentRange;
196
- rangeFromTokens(startToken: Token, stopToken: Token): DocumentRange;
197
- rangeFromToken(token: Token): DocumentRange;
198
- }
199
- /**
200
- * The main interface to Malloy tranlsation. It has a call pattern
201
- * similar to a server. Once a translator is instantiated
202
- * you can request tralnsations repeatedly. Responses to that request
203
- * will either be "NeedResponse" or "TranslateResponse" objects. The
204
- * correct pattern is to call "translation" in a loop, calling
205
- * "update" in response to each "NeedResponse" until a "TranslateResponse"
206
- * is returned. If you get a response with "final:true", there is
207
- * no need to call again, the translation is finished or error'd.
208
- */
209
- export declare class MalloyTranslator extends MalloyTranslation {
210
- schemaZone: Zone<StructDef>;
211
- importZone: Zone<string>;
212
- sqlQueryZone: Zone<SQLBlockStructDef>;
213
- logger: MessageLog;
214
- readonly root: MalloyTranslator;
215
- constructor(rootURL: string, preload?: ParseUpdate | null);
216
- update(dd: ParseUpdate): void;
217
- }
218
- interface ErrorData {
219
- tables: Record<string, string>;
220
- urls: Record<string, string>;
221
- compileSQL: Record<string, string>;
222
- }
223
- export interface URLData {
224
- urls: ZoneData<string>;
225
- }
226
- export interface SchemaData {
227
- tables: ZoneData<StructDef>;
228
- }
229
- export interface SQLBlockData {
230
- compileSQL: ZoneData<SQLBlockStructDef>;
231
- }
232
- export interface UpdateData extends URLData, SchemaData, SQLBlockData {
233
- errors: Partial<ErrorData>;
234
- }
235
- export declare type ParseUpdate = Partial<UpdateData>;
236
- export {};