@malloydata/malloy 0.0.3 → 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 (37) hide show
  1. package/dist/lang/ast/ast-expr.d.ts +0 -1
  2. package/dist/lang/ast/ast-main.d.ts +2 -2
  3. package/package.json +1 -1
  4. package/dist/connection_utils.js +0 -56
  5. package/dist/dialect/dialect.js +0 -77
  6. package/dist/dialect/dialect_map.js +0 -35
  7. package/dist/dialect/duckdb.js +0 -347
  8. package/dist/dialect/index.js +0 -27
  9. package/dist/dialect/postgres.js +0 -315
  10. package/dist/dialect/standardsql.js +0 -362
  11. package/dist/index.js +0 -47
  12. package/dist/lang/ast/apply-expr.js +0 -231
  13. package/dist/lang/ast/ast-expr.js +0 -1041
  14. package/dist/lang/ast/ast-main.js +0 -2087
  15. package/dist/lang/ast/ast-time-expr.js +0 -549
  16. package/dist/lang/ast/ast-types.js +0 -215
  17. package/dist/lang/ast/index.js +0 -34
  18. package/dist/lang/ast/time-utils.js +0 -94
  19. package/dist/lang/field-space.js +0 -631
  20. package/dist/lang/field-utils.js +0 -33
  21. package/dist/lang/index.js +0 -22
  22. package/dist/lang/parse-log.js +0 -41
  23. package/dist/lang/reference-list.js +0 -80
  24. package/dist/lang/space-field.js +0 -346
  25. package/dist/lang/test/document-help-context-walker.spec.js +0 -45
  26. package/dist/lang/test/document-symbol-walker.spec.js +0 -100
  27. package/dist/lang/test/field-symbols.spec.js +0 -172
  28. package/dist/lang/test/parse.spec.js +0 -1951
  29. package/dist/lang/test/test-translator.js +0 -334
  30. package/dist/lang/zone.js +0 -97
  31. package/dist/malloy.js +0 -2360
  32. package/dist/model/index.js +0 -34
  33. package/dist/model/malloy_query.js +0 -2994
  34. package/dist/model/malloy_types.js +0 -283
  35. package/dist/model/sql_block.js +0 -41
  36. package/dist/model/utils.js +0 -84
  37. 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", tablePath: "test" },
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", tablePath: "t" },
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