@malloydata/malloy 0.0.2 → 0.0.4

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 (67) hide show
  1. package/README.md +12 -11
  2. package/dist/dialect/duckdb.d.ts +1 -1
  3. package/dist/dialect/postgres.d.ts +1 -1
  4. package/dist/index.d.ts +4 -4
  5. package/dist/lang/ast/ast-expr.d.ts +0 -1
  6. package/dist/lang/field-space.d.ts +9 -7
  7. package/dist/lang/lib/Malloy/MalloyLexer.d.ts +108 -106
  8. package/dist/lang/lib/Malloy/MalloyLexer.js +1019 -1006
  9. package/dist/lang/lib/Malloy/MalloyParser.d.ts +581 -590
  10. package/dist/lang/lib/Malloy/MalloyParser.js +1141 -1202
  11. package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +2015 -0
  12. package/dist/lang/lib/Malloy/MalloyParserListener.js +4 -0
  13. package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +1269 -0
  14. package/dist/lang/lib/Malloy/MalloyParserVisitor.js +4 -0
  15. package/dist/lang/parse-to-ast.d.ts +3 -4
  16. package/dist/lang/parse-to-ast.js +1 -1
  17. package/dist/lang/parse-tree-walkers/document-completion-walker.js +2 -0
  18. package/dist/lang/parse-tree-walkers/explore-query-walker.d.ts +2 -2
  19. package/dist/malloy.d.ts +1 -1
  20. package/dist/md5.d.ts +1 -0
  21. package/dist/md5.js +30 -0
  22. package/dist/model/malloy_types.d.ts +3 -1
  23. package/package.json +9 -14
  24. package/dist/connection_utils.js +0 -56
  25. package/dist/dialect/dialect-map.d.ts +0 -3
  26. package/dist/dialect/dialect-map.js +0 -33
  27. package/dist/dialect/dialect.js +0 -77
  28. package/dist/dialect/dialect_map.js +0 -35
  29. package/dist/dialect/duckdb.js +0 -349
  30. package/dist/dialect/index.js +0 -27
  31. package/dist/dialect/postgres.js +0 -308
  32. package/dist/dialect/standardsql.js +0 -361
  33. package/dist/index.js +0 -47
  34. package/dist/lang/ast/apply-expr.js +0 -231
  35. package/dist/lang/ast/ast-expr.js +0 -1051
  36. package/dist/lang/ast/ast-main.js +0 -2086
  37. package/dist/lang/ast/ast-time-expr.js +0 -549
  38. package/dist/lang/ast/ast-types.js +0 -215
  39. package/dist/lang/ast/index.js +0 -34
  40. package/dist/lang/ast/time-utils.js +0 -94
  41. package/dist/lang/field-space.js +0 -629
  42. package/dist/lang/field-utils.js +0 -33
  43. package/dist/lang/index.js +0 -22
  44. package/dist/lang/parse-log.js +0 -41
  45. package/dist/lang/reference-list.js +0 -80
  46. package/dist/lang/space-field.js +0 -346
  47. package/dist/lang/test/document-help-context-walker.spec.js +0 -45
  48. package/dist/lang/test/document-symbol-walker.spec.js +0 -100
  49. package/dist/lang/test/field-symbols.spec.js +0 -172
  50. package/dist/lang/test/parse.spec.js +0 -1936
  51. package/dist/lang/test/test-translator.js +0 -334
  52. package/dist/lang/zone.js +0 -97
  53. package/dist/malloy.js +0 -2354
  54. package/dist/model/index.js +0 -34
  55. package/dist/model/malloy-query.d.ts +0 -313
  56. package/dist/model/malloy-query.js +0 -2603
  57. package/dist/model/malloy-types.d.ts +0 -404
  58. package/dist/model/malloy-types.js +0 -242
  59. package/dist/model/malloy_query.js +0 -2996
  60. package/dist/model/malloy_types.js +0 -283
  61. package/dist/model/sql-block.d.ts +0 -11
  62. package/dist/model/sql-block.js +0 -38
  63. package/dist/model/sql_block.js +0 -41
  64. package/dist/model/utils.js +0 -84
  65. package/dist/runtime-types.d.ts +0 -116
  66. package/dist/runtime-types.js +0 -40
  67. package/dist/runtime_types.js +0 -15
@@ -1,172 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2021 Google LLC
4
- *
5
- * This program is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU General Public License
7
- * version 2 as published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- */
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const space_field_1 = require("../space-field");
16
- const field_space_1 = require("../field-space");
17
- const ast_1 = require("../ast");
18
- /*
19
- ** A set of tests to make sure structdefs can become fieldspaces
20
- ** and the fieldspace produces the same strcutdef
21
- */
22
- describe("structdef comprehension", () => {
23
- function mkStructDef(field) {
24
- return {
25
- type: "struct",
26
- name: "test",
27
- dialect: "standardsql",
28
- structSource: { type: "table" },
29
- structRelationship: { type: "basetable", connectionName: "test" },
30
- fields: [field],
31
- };
32
- }
33
- function fieldRef(fieldPath) {
34
- return fieldPath.split(".").map((name) => new ast_1.FieldName(name));
35
- }
36
- test(`import string field`, () => {
37
- const field = {
38
- name: "t",
39
- type: "string",
40
- };
41
- const struct = mkStructDef(field);
42
- const space = new field_space_1.StaticSpace(struct);
43
- expect(space.lookup(fieldRef("t")).found).toBeInstanceOf(space_field_1.ColumnSpaceField);
44
- const oField = space.structDef().fields[0];
45
- expect(oField).toEqual(field);
46
- });
47
- test(`import float field`, () => {
48
- const field = {
49
- name: "t",
50
- type: "number",
51
- numberType: "float",
52
- };
53
- const struct = mkStructDef(field);
54
- const space = new field_space_1.StaticSpace(struct);
55
- expect(space.lookup(fieldRef("t")).found).toBeInstanceOf(space_field_1.ColumnSpaceField);
56
- const oField = space.structDef().fields[0];
57
- expect(oField).toEqual(field);
58
- });
59
- test(`import integer field`, () => {
60
- const field = {
61
- name: "t",
62
- type: "number",
63
- numberType: "integer",
64
- };
65
- const struct = mkStructDef(field);
66
- const space = new field_space_1.StaticSpace(struct);
67
- expect(space.lookup(fieldRef("t")).found).toBeInstanceOf(space_field_1.ColumnSpaceField);
68
- const oField = space.structDef().fields[0];
69
- expect(oField).toEqual(field);
70
- });
71
- test(`import boolean field`, () => {
72
- const field = {
73
- name: "t",
74
- type: "boolean",
75
- };
76
- const struct = mkStructDef(field);
77
- const space = new field_space_1.StaticSpace(struct);
78
- expect(space.lookup(fieldRef("t")).found).toBeInstanceOf(space_field_1.ColumnSpaceField);
79
- const oField = space.structDef().fields[0];
80
- expect(oField).toEqual(field);
81
- });
82
- test(`import nested field`, () => {
83
- const field = {
84
- name: "t",
85
- type: "struct",
86
- dialect: "standardsql",
87
- structRelationship: { type: "nested", field: "a", isArray: false },
88
- structSource: { type: "nested" },
89
- fields: [{ type: "string", name: "b" }],
90
- };
91
- const struct = mkStructDef(field);
92
- const space = new field_space_1.StaticSpace(struct);
93
- expect(space.lookup(fieldRef("t.b")).found).toBeInstanceOf(space_field_1.ColumnSpaceField);
94
- const oField = space.structDef().fields[0];
95
- expect(oField).toEqual(field);
96
- });
97
- test(`import inline field`, () => {
98
- const field = {
99
- name: "t",
100
- type: "struct",
101
- dialect: "standardsql",
102
- structRelationship: { type: "inline" },
103
- structSource: { type: "inline" },
104
- fields: [{ type: "string", name: "a" }],
105
- };
106
- const struct = mkStructDef(field);
107
- const space = new field_space_1.StaticSpace(struct);
108
- expect(space.lookup(fieldRef("t.a")).found).toBeInstanceOf(space_field_1.ColumnSpaceField);
109
- const oField = space.structDef().fields[0];
110
- expect(oField).toEqual(field);
111
- });
112
- test(`import join field`, () => {
113
- const field = {
114
- name: "t",
115
- type: "struct",
116
- dialect: "standardsql",
117
- structRelationship: {
118
- type: "one",
119
- onExpression: [
120
- { type: "field", path: "aKey" },
121
- "=",
122
- { type: "field", path: "t.a" },
123
- ],
124
- },
125
- structSource: { type: "table" },
126
- fields: [{ type: "string", name: "a" }],
127
- };
128
- const struct = mkStructDef(field);
129
- const space = new field_space_1.StaticSpace(struct);
130
- expect(space.lookup(fieldRef("t.a")).found).toBeInstanceOf(space_field_1.ColumnSpaceField);
131
- const oField = space.structDef().fields[0];
132
- expect(oField).toEqual(field);
133
- });
134
- test(`import query stage field`, () => {
135
- const field = {
136
- name: "t",
137
- type: "turtle",
138
- pipeline: [
139
- {
140
- type: "reduce",
141
- fields: ["a"],
142
- },
143
- ],
144
- };
145
- const struct = mkStructDef(field);
146
- const space = new field_space_1.StaticSpace(struct);
147
- expect(space.lookup(fieldRef("t")).found).toBeInstanceOf(space_field_1.QueryFieldStruct);
148
- const oField = space.structDef().fields[0];
149
- expect(oField).toEqual(field);
150
- });
151
- test("import struct with parameters", () => {
152
- const struct = mkStructDef({ name: "f", type: "string" });
153
- struct.parameters = {
154
- cReqStr: {
155
- name: "cReqStr",
156
- type: "string",
157
- value: null,
158
- constant: false,
159
- },
160
- cOptStr: {
161
- name: "cOptStr",
162
- type: "string",
163
- value: ["value"],
164
- constant: false,
165
- },
166
- };
167
- const space = new field_space_1.StaticSpace(struct);
168
- expect(space.lookup(fieldRef("cReqStr")).found).toBeInstanceOf(space_field_1.DefinedParameter);
169
- expect(space.lookup(fieldRef("cOptStr")).found).toBeInstanceOf(space_field_1.DefinedParameter);
170
- });
171
- });
172
- //# sourceMappingURL=field-symbols.spec.js.map