@malloydata/malloy 0.0.240-dev250311213218 → 0.0.240-dev250311214430
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/package.json +3 -3
- package/dist/api/asynchronous.spec.d.ts +0 -1
- package/dist/api/asynchronous.spec.js +0 -240
- package/dist/api/sessioned.spec.d.ts +0 -1
- package/dist/api/sessioned.spec.js +0 -476
- package/dist/api/stateless.spec.d.ts +0 -1
- package/dist/api/stateless.spec.js +0 -400
- package/dist/lang/test/annotation.spec.d.ts +0 -14
- package/dist/lang/test/annotation.spec.js +0 -809
- package/dist/lang/test/composite-field-usage.spec.d.ts +0 -1
- package/dist/lang/test/composite-field-usage.spec.js +0 -261
- package/dist/lang/test/document-help-context-walker.spec.d.ts +0 -1
- package/dist/lang/test/document-help-context-walker.spec.js +0 -55
- package/dist/lang/test/document-symbol-walker.spec.d.ts +0 -1
- package/dist/lang/test/document-symbol-walker.spec.js +0 -209
- package/dist/lang/test/expressions.spec.d.ts +0 -1
- package/dist/lang/test/expressions.spec.js +0 -1181
- package/dist/lang/test/field-symbols.spec.d.ts +0 -1
- package/dist/lang/test/field-symbols.spec.js +0 -194
- package/dist/lang/test/find-table-path-walker.spec.d.ts +0 -1
- package/dist/lang/test/find-table-path-walker.spec.js +0 -50
- package/dist/lang/test/imports.spec.d.ts +0 -1
- package/dist/lang/test/imports.spec.js +0 -283
- package/dist/lang/test/lenses.spec.d.ts +0 -1
- package/dist/lang/test/lenses.spec.js +0 -384
- package/dist/lang/test/literals.spec.d.ts +0 -1
- package/dist/lang/test/literals.spec.js +0 -267
- package/dist/lang/test/locations.spec.d.ts +0 -1
- package/dist/lang/test/locations.spec.js +0 -679
- package/dist/lang/test/malloy-to-stable-query.spec.d.ts +0 -1
- package/dist/lang/test/malloy-to-stable-query.spec.js +0 -365
- package/dist/lang/test/model-annotation-walker.spec.d.ts +0 -1
- package/dist/lang/test/model-annotation-walker.spec.js +0 -46
- package/dist/lang/test/model_serialization.spec.d.ts +0 -5
- package/dist/lang/test/model_serialization.spec.js +0 -116
- package/dist/lang/test/parameters.spec.d.ts +0 -1
- package/dist/lang/test/parameters.spec.js +0 -619
- package/dist/lang/test/parse.spec.d.ts +0 -1
- package/dist/lang/test/parse.spec.js +0 -893
- package/dist/lang/test/pretranslate.spec.d.ts +0 -1
- package/dist/lang/test/pretranslate.spec.js +0 -80
- package/dist/lang/test/query.spec.d.ts +0 -1
- package/dist/lang/test/query.spec.js +0 -1149
- package/dist/lang/test/source.spec.d.ts +0 -1
- package/dist/lang/test/source.spec.js +0 -570
- package/dist/lang/test/sql-block.spec.d.ts +0 -1
- package/dist/lang/test/sql-block.spec.js +0 -145
- package/dist/lang/test/syntax-errors.spec.d.ts +0 -1
- package/dist/lang/test/syntax-errors.spec.js +0 -142
- package/dist/model/utils.spec.d.ts +0 -1
- package/dist/model/utils.spec.js +0 -38
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/malloy",
|
|
3
|
-
"version": "0.0.240-
|
|
3
|
+
"version": "0.0.240-dev250311214430",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"generate-version-file": "VERSION=$(npm pkg get version --workspaces=false | tr -d \\\")\necho \"// generated with 'generate-version-file' script; do not edit manually\\nexport const MALLOY_VERSION = '$VERSION';\" > src/version.ts"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@malloydata/malloy-interfaces": "^0.0.240-
|
|
45
|
-
"@malloydata/malloy-tag": "^0.0.240-
|
|
44
|
+
"@malloydata/malloy-interfaces": "^0.0.240-dev250311214430",
|
|
45
|
+
"@malloydata/malloy-tag": "^0.0.240-dev250311214430",
|
|
46
46
|
"antlr4ts": "^0.5.0-alpha.4",
|
|
47
47
|
"assert": "^2.0.0",
|
|
48
48
|
"jest-diff": "^29.6.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const asynchronous_1 = require("./asynchronous");
|
|
10
|
-
describe('api', () => {
|
|
11
|
-
describe('compile model', () => {
|
|
12
|
-
test('compile model with table dependency', async () => {
|
|
13
|
-
const connection = {
|
|
14
|
-
dialectName: 'duckdb',
|
|
15
|
-
fetchSchemaForTable: async (_name) => {
|
|
16
|
-
return {
|
|
17
|
-
fields: [
|
|
18
|
-
{
|
|
19
|
-
kind: 'dimension',
|
|
20
|
-
name: 'carrier',
|
|
21
|
-
type: { kind: 'string_type' },
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
fetchSchemaForSQLQuery: async (_sql) => {
|
|
27
|
-
throw new Error('not implemented');
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
const urls = {
|
|
31
|
-
readURL: async (_url) => {
|
|
32
|
-
return "source: flights is connection.table('flights')";
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
const connections = {
|
|
36
|
-
lookupConnection: async (_name) => {
|
|
37
|
-
return connection;
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
const fetchers = {
|
|
41
|
-
urls,
|
|
42
|
-
connections,
|
|
43
|
-
};
|
|
44
|
-
const result = await (0, asynchronous_1.compileModel)({
|
|
45
|
-
model_url: 'file://test.malloy',
|
|
46
|
-
}, fetchers);
|
|
47
|
-
const expected = {
|
|
48
|
-
model: {
|
|
49
|
-
entries: [
|
|
50
|
-
{
|
|
51
|
-
kind: 'source',
|
|
52
|
-
name: 'flights',
|
|
53
|
-
schema: {
|
|
54
|
-
fields: [
|
|
55
|
-
{
|
|
56
|
-
kind: 'dimension',
|
|
57
|
-
name: 'carrier',
|
|
58
|
-
type: { kind: 'string_type' },
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
anonymous_queries: [],
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
expect(result).toMatchObject(expected);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
describe('compile query', () => {
|
|
71
|
-
test('compile query with table dependency', async () => {
|
|
72
|
-
const connection = {
|
|
73
|
-
dialectName: 'duckdb',
|
|
74
|
-
fetchSchemaForTable: async (_name) => {
|
|
75
|
-
return {
|
|
76
|
-
fields: [
|
|
77
|
-
{
|
|
78
|
-
kind: 'dimension',
|
|
79
|
-
name: 'carrier',
|
|
80
|
-
type: { kind: 'string_type' },
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
};
|
|
84
|
-
},
|
|
85
|
-
fetchSchemaForSQLQuery: async (_sql) => {
|
|
86
|
-
throw new Error('not implemented');
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
const urls = {
|
|
90
|
-
readURL: async (_url) => {
|
|
91
|
-
return "source: flights is connection.table('flights')";
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
const connections = {
|
|
95
|
-
lookupConnection: async (_name) => {
|
|
96
|
-
return connection;
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
const fetchers = {
|
|
100
|
-
urls,
|
|
101
|
-
connections,
|
|
102
|
-
};
|
|
103
|
-
const result = await (0, asynchronous_1.compileQuery)({
|
|
104
|
-
model_url: 'file://test.malloy',
|
|
105
|
-
query: {
|
|
106
|
-
definition: {
|
|
107
|
-
kind: 'arrow',
|
|
108
|
-
source: { kind: 'source_reference', name: 'flights' },
|
|
109
|
-
view: {
|
|
110
|
-
kind: 'segment',
|
|
111
|
-
operations: [
|
|
112
|
-
{
|
|
113
|
-
kind: 'group_by',
|
|
114
|
-
field: {
|
|
115
|
-
expression: { kind: 'field_reference', name: 'carrier' },
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
}, fetchers);
|
|
123
|
-
const expected = {
|
|
124
|
-
result: {
|
|
125
|
-
connection_name: 'connection',
|
|
126
|
-
sql: `SELECT \n\
|
|
127
|
-
base."carrier" as "carrier"
|
|
128
|
-
FROM flights as base
|
|
129
|
-
GROUP BY 1
|
|
130
|
-
ORDER BY 1 asc NULLS LAST
|
|
131
|
-
`,
|
|
132
|
-
schema: {
|
|
133
|
-
fields: [
|
|
134
|
-
{
|
|
135
|
-
kind: 'dimension',
|
|
136
|
-
name: 'carrier',
|
|
137
|
-
type: { kind: 'string_type' },
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
expect(result).toMatchObject(expected);
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
describe('run query', () => {
|
|
147
|
-
test('run query with table dependency', async () => {
|
|
148
|
-
const data = {
|
|
149
|
-
kind: 'array_cell',
|
|
150
|
-
array_value: [
|
|
151
|
-
{
|
|
152
|
-
kind: 'record_cell',
|
|
153
|
-
record_value: [{ kind: 'string_cell', string_value: 'WN' }],
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
kind: 'record_cell',
|
|
157
|
-
record_value: [{ kind: 'string_cell', string_value: 'AA' }],
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
};
|
|
161
|
-
const connection = {
|
|
162
|
-
dialectName: 'duckdb',
|
|
163
|
-
fetchSchemaForTable: async (_name) => {
|
|
164
|
-
return {
|
|
165
|
-
fields: [
|
|
166
|
-
{
|
|
167
|
-
kind: 'dimension',
|
|
168
|
-
name: 'carrier',
|
|
169
|
-
type: { kind: 'string_type' },
|
|
170
|
-
},
|
|
171
|
-
],
|
|
172
|
-
};
|
|
173
|
-
},
|
|
174
|
-
fetchSchemaForSQLQuery: async (_sql) => {
|
|
175
|
-
throw new Error('not implemented');
|
|
176
|
-
},
|
|
177
|
-
runSQL: async (_sql) => {
|
|
178
|
-
return data;
|
|
179
|
-
},
|
|
180
|
-
};
|
|
181
|
-
const urls = {
|
|
182
|
-
readURL: async (_url) => {
|
|
183
|
-
return "source: flights is connection.table('flights')";
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
const connections = {
|
|
187
|
-
lookupConnection: async (_name) => {
|
|
188
|
-
return connection;
|
|
189
|
-
},
|
|
190
|
-
};
|
|
191
|
-
const fetchers = {
|
|
192
|
-
urls,
|
|
193
|
-
connections,
|
|
194
|
-
};
|
|
195
|
-
const result = await (0, asynchronous_1.runQuery)({
|
|
196
|
-
model_url: 'file://test.malloy',
|
|
197
|
-
query: {
|
|
198
|
-
definition: {
|
|
199
|
-
kind: 'arrow',
|
|
200
|
-
source: { kind: 'source_reference', name: 'flights' },
|
|
201
|
-
view: {
|
|
202
|
-
kind: 'segment',
|
|
203
|
-
operations: [
|
|
204
|
-
{
|
|
205
|
-
kind: 'group_by',
|
|
206
|
-
field: {
|
|
207
|
-
expression: { kind: 'field_reference', name: 'carrier' },
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
],
|
|
211
|
-
},
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
}, fetchers);
|
|
215
|
-
const expected = {
|
|
216
|
-
result: {
|
|
217
|
-
connection_name: 'connection',
|
|
218
|
-
sql: `SELECT \n\
|
|
219
|
-
base."carrier" as "carrier"
|
|
220
|
-
FROM flights as base
|
|
221
|
-
GROUP BY 1
|
|
222
|
-
ORDER BY 1 asc NULLS LAST
|
|
223
|
-
`,
|
|
224
|
-
schema: {
|
|
225
|
-
fields: [
|
|
226
|
-
{
|
|
227
|
-
kind: 'dimension',
|
|
228
|
-
name: 'carrier',
|
|
229
|
-
type: { kind: 'string_type' },
|
|
230
|
-
},
|
|
231
|
-
],
|
|
232
|
-
},
|
|
233
|
-
data,
|
|
234
|
-
},
|
|
235
|
-
};
|
|
236
|
-
expect(result).toMatchObject(expected);
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
//# sourceMappingURL=asynchronous.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|