@malloydata/malloy 0.0.412 → 0.0.414
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/dist/api/foundation/core.d.ts +21 -0
- package/dist/api/foundation/core.js +30 -0
- package/dist/dialect/databricks/databricks.d.ts +2 -1
- package/dist/dialect/databricks/databricks.js +12 -6
- package/dist/dialect/dialect.d.ts +12 -1
- package/dist/dialect/dialect.js +25 -0
- package/dist/dialect/duckdb/duckdb.d.ts +2 -1
- package/dist/dialect/duckdb/duckdb.js +9 -2
- package/dist/dialect/mysql/mysql.d.ts +2 -1
- package/dist/dialect/mysql/mysql.js +14 -5
- package/dist/dialect/postgres/postgres.d.ts +2 -1
- package/dist/dialect/postgres/postgres.js +9 -2
- package/dist/dialect/snowflake/snowflake.d.ts +2 -1
- package/dist/dialect/snowflake/snowflake.js +11 -3
- package/dist/dialect/standardsql/standardsql.d.ts +2 -1
- package/dist/dialect/standardsql/standardsql.js +8 -2
- package/dist/dialect/trino/trino.d.ts +2 -1
- package/dist/dialect/trino/trino.js +8 -2
- package/dist/lang/ast/field-space/dynamic-space.js +14 -1
- package/dist/lang/ast/field-space/query-spaces.d.ts +1 -0
- package/dist/lang/ast/field-space/query-spaces.js +5 -0
- package/dist/lang/ast/query-items/field-references.d.ts +10 -1
- package/dist/lang/ast/query-items/field-references.js +67 -4
- package/dist/lang/ast/query-properties/nest.js +15 -0
- package/dist/lang/ast/source-elements/named-source.js +4 -1
- package/dist/lang/ast/statements/define-source.js +9 -2
- package/dist/lang/ast/types/malloy-element.js +3 -4
- package/dist/lang/parse-log.d.ts +10 -0
- package/dist/lang/parse-log.js +3 -0
- package/dist/model/expression_compiler.js +2 -2
- package/dist/model/field_instance.d.ts +1 -0
- package/dist/model/field_instance.js +14 -0
- package/dist/model/index.d.ts +2 -1
- package/dist/model/index.js +3 -1
- package/dist/model/malloy_types.d.ts +25 -6
- package/dist/model/nest-capability.d.ts +37 -0
- package/dist/model/nest-capability.js +31 -0
- package/dist/model/persist_utils.js +1 -1
- package/dist/model/query_query.d.ts +26 -5
- package/dist/model/query_query.js +256 -88
- package/dist/model/source_def_utils.d.ts +31 -7
- package/dist/model/source_def_utils.js +39 -9
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -10,7 +10,9 @@ exports.mkBuildID = mkBuildID;
|
|
|
10
10
|
exports.mkQuerySourceDef = mkQuerySourceDef;
|
|
11
11
|
exports.mkSQLSourceDef = mkSQLSourceDef;
|
|
12
12
|
exports.mkTableSourceDef = mkTableSourceDef;
|
|
13
|
+
exports.resolveSourceRef = resolveSourceRef;
|
|
13
14
|
exports.resolveSourceID = resolveSourceID;
|
|
15
|
+
exports.sourceNamespaceReference = sourceNamespaceReference;
|
|
14
16
|
exports.registerSource = registerSource;
|
|
15
17
|
exports.hasSourceRegistryEntry = hasSourceRegistryEntry;
|
|
16
18
|
const utils_1 = require("./utils");
|
|
@@ -59,8 +61,9 @@ function mkQuerySourceDef(base, query, name) {
|
|
|
59
61
|
dialect: base.dialect,
|
|
60
62
|
partitionComposite: base.partitionComposite,
|
|
61
63
|
errorFactory: base.errorFactory,
|
|
62
|
-
//
|
|
64
|
+
// Identity fields - explicitly NOT copied
|
|
63
65
|
// sourceID: undefined,
|
|
66
|
+
// referenceID: undefined,
|
|
64
67
|
// extends: undefined,
|
|
65
68
|
// persistent: undefined,
|
|
66
69
|
};
|
|
@@ -97,8 +100,9 @@ function mkSQLSourceDef(base, selectStr, selectSegments) {
|
|
|
97
100
|
dialect: base.dialect,
|
|
98
101
|
partitionComposite: base.partitionComposite,
|
|
99
102
|
errorFactory: base.errorFactory,
|
|
100
|
-
//
|
|
103
|
+
// Identity fields - explicitly NOT copied
|
|
101
104
|
// sourceID: undefined,
|
|
105
|
+
// referenceID: undefined,
|
|
102
106
|
// extends: undefined,
|
|
103
107
|
// persistent: undefined,
|
|
104
108
|
};
|
|
@@ -120,25 +124,51 @@ function mkTableSourceDef(name, connection, tablePath, dialect, fields) {
|
|
|
120
124
|
// Source Registry Utilities
|
|
121
125
|
// =============================================================================
|
|
122
126
|
/**
|
|
123
|
-
* Resolve a sourceID
|
|
127
|
+
* Resolve a SourceID (a source's own `sourceID`, or a `referenceID` pointing at
|
|
128
|
+
* one) to its SourceDef using the sourceRegistry, returning any kind of source.
|
|
124
129
|
*
|
|
125
130
|
* @param modelDef The model definition containing the registry
|
|
126
|
-
* @param sourceID The
|
|
131
|
+
* @param sourceID The SourceID to resolve
|
|
127
132
|
* @returns The SourceDef if found, undefined otherwise
|
|
128
133
|
*/
|
|
129
|
-
function
|
|
134
|
+
function resolveSourceRef(modelDef, sourceID) {
|
|
130
135
|
const value = modelDef.sourceRegistry[sourceID];
|
|
131
136
|
if (!value)
|
|
132
137
|
return undefined;
|
|
133
138
|
if ((0, malloy_types_1.isSourceRegistryReference)(value.entry)) {
|
|
134
139
|
const obj = (0, malloy_types_1.safeRecordGet)(modelDef.contents, value.entry.name);
|
|
135
|
-
return obj && (0, malloy_types_1.isSourceDef)(obj)
|
|
136
|
-
? obj
|
|
137
|
-
: undefined;
|
|
140
|
+
return obj && (0, malloy_types_1.isSourceDef)(obj) ? obj : undefined;
|
|
138
141
|
}
|
|
139
|
-
// It's a PersistableSourceDef
|
|
140
142
|
return value.entry;
|
|
141
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Resolve a sourceID to a persistable SourceDef using the sourceRegistry.
|
|
146
|
+
*
|
|
147
|
+
* @param modelDef The model definition containing the registry
|
|
148
|
+
* @param sourceID The sourceID to resolve
|
|
149
|
+
* @returns The PersistableSourceDef if found, undefined otherwise
|
|
150
|
+
*/
|
|
151
|
+
function resolveSourceID(modelDef, sourceID) {
|
|
152
|
+
const sd = resolveSourceRef(modelDef, sourceID);
|
|
153
|
+
return sd && (0, malloy_types_1.isPersistableSourceDef)(sd) ? sd : undefined;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* If `sd` was created as an unmodified reference to another source
|
|
157
|
+
* (`sd.referenceID` is set) and that source is present in this model's
|
|
158
|
+
* namespace, return it together with the name it goes by. Returns undefined
|
|
159
|
+
* when `sd` defines its own shape, or when the referenced source is not in this
|
|
160
|
+
* model's namespace (e.g. an imported source whose own target wasn't imported).
|
|
161
|
+
*/
|
|
162
|
+
function sourceNamespaceReference(modelDef, sd) {
|
|
163
|
+
if (sd.referenceID === undefined)
|
|
164
|
+
return undefined;
|
|
165
|
+
const value = modelDef.sourceRegistry[sd.referenceID];
|
|
166
|
+
if (!value || !(0, malloy_types_1.isSourceRegistryReference)(value.entry))
|
|
167
|
+
return undefined;
|
|
168
|
+
const name = value.entry.name;
|
|
169
|
+
const source = (0, malloy_types_1.safeRecordGet)(modelDef.contents, name);
|
|
170
|
+
return source && (0, malloy_types_1.isSourceDef)(source) ? { name, source } : undefined;
|
|
171
|
+
}
|
|
142
172
|
/**
|
|
143
173
|
* Add an entry to the sourceRegistry.
|
|
144
174
|
*
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MALLOY_VERSION = "0.0.
|
|
1
|
+
export declare const MALLOY_VERSION = "0.0.414";
|
package/dist/version.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MALLOY_VERSION = void 0;
|
|
4
4
|
// generated with 'generate-version-file' script; do not edit manually
|
|
5
|
-
exports.MALLOY_VERSION = '0.0.
|
|
5
|
+
exports.MALLOY_VERSION = '0.0.414';
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/malloy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.414",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"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"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@malloydata/malloy-filter": "0.0.
|
|
55
|
-
"@malloydata/malloy-interfaces": "0.0.
|
|
56
|
-
"@malloydata/malloy-tag": "0.0.
|
|
54
|
+
"@malloydata/malloy-filter": "0.0.414",
|
|
55
|
+
"@malloydata/malloy-interfaces": "0.0.414",
|
|
56
|
+
"@malloydata/malloy-tag": "0.0.414",
|
|
57
57
|
"@noble/hashes": "^1.8.0",
|
|
58
58
|
"antlr4ts": "^0.5.0-alpha.4",
|
|
59
59
|
"assert": "^2.0.0",
|