@malloydata/malloy 0.0.341 → 0.0.343
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/compile.d.ts +4 -0
- package/dist/api/foundation/compile.js +6 -0
- package/dist/connection/registry.d.ts +30 -3
- package/dist/connection/registry.js +36 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -65,6 +65,10 @@ export declare class Malloy {
|
|
|
65
65
|
* Get the property definitions for a registered connection type.
|
|
66
66
|
*/
|
|
67
67
|
static getConnectionProperties(typeName: string): ConnectionPropertyDefinition[] | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Get the human-readable display name for a registered connection type.
|
|
70
|
+
*/
|
|
71
|
+
static getConnectionTypeDisplayName(typeName: string): string | undefined;
|
|
68
72
|
/**
|
|
69
73
|
* Get the names of all registered connection types.
|
|
70
74
|
*/
|
|
@@ -57,6 +57,12 @@ class Malloy {
|
|
|
57
57
|
static getConnectionProperties(typeName) {
|
|
58
58
|
return (0, registry_1.getConnectionProperties)(typeName);
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Get the human-readable display name for a registered connection type.
|
|
62
|
+
*/
|
|
63
|
+
static getConnectionTypeDisplayName(typeName) {
|
|
64
|
+
return (0, registry_1.getConnectionTypeDisplayName)(typeName);
|
|
65
|
+
}
|
|
60
66
|
/**
|
|
61
67
|
* Get the names of all registered connection types.
|
|
62
68
|
*/
|
|
@@ -2,11 +2,11 @@ import type { Connection, ConnectionConfig, LookupConnection } from './types';
|
|
|
2
2
|
/**
|
|
3
3
|
* A factory function that creates a Connection from a config object.
|
|
4
4
|
*/
|
|
5
|
-
export type ConnectionTypeFactory = (config: ConnectionConfig) => Connection
|
|
5
|
+
export type ConnectionTypeFactory = (config: ConnectionConfig) => Promise<Connection>;
|
|
6
6
|
/**
|
|
7
7
|
* The type of a connection property value.
|
|
8
8
|
*/
|
|
9
|
-
export type ConnectionPropertyType = 'string' | 'number' | 'boolean' | 'password' | 'file' | 'text';
|
|
9
|
+
export type ConnectionPropertyType = 'string' | 'number' | 'boolean' | 'password' | 'secret' | 'file' | 'text';
|
|
10
10
|
/**
|
|
11
11
|
* Describes a single configuration property for a connection type.
|
|
12
12
|
*/
|
|
@@ -24,15 +24,35 @@ export interface ConnectionPropertyDefinition {
|
|
|
24
24
|
* A connection type definition: factory plus property metadata.
|
|
25
25
|
*/
|
|
26
26
|
export interface ConnectionTypeDef {
|
|
27
|
+
displayName: string;
|
|
27
28
|
factory: ConnectionTypeFactory;
|
|
28
29
|
properties: ConnectionPropertyDefinition[];
|
|
29
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* An environment variable reference in a config file.
|
|
33
|
+
*/
|
|
34
|
+
export type ValueRef = {
|
|
35
|
+
env: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The type of a config property value: a literal, an env reference, or undefined.
|
|
39
|
+
*/
|
|
40
|
+
export type ConfigValue = string | number | boolean | ValueRef | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Type guard for ValueRef.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isValueRef(value: ConfigValue): value is ValueRef;
|
|
45
|
+
/**
|
|
46
|
+
* Resolve a ValueRef to a string by looking up the environment variable.
|
|
47
|
+
* Returns undefined if the env var is not set.
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolveValue(vr: ValueRef): string | undefined;
|
|
30
50
|
/**
|
|
31
51
|
* A single connection entry in a JSON config.
|
|
32
52
|
*/
|
|
33
53
|
export interface ConnectionConfigEntry {
|
|
34
54
|
is: string;
|
|
35
|
-
[key: string]:
|
|
55
|
+
[key: string]: ConfigValue;
|
|
36
56
|
}
|
|
37
57
|
/**
|
|
38
58
|
* The editable intermediate representation of a connections config file.
|
|
@@ -54,6 +74,13 @@ export declare function registerConnectionType(typeName: string, def: Connection
|
|
|
54
74
|
* @returns The property definitions, or undefined if the type is not registered.
|
|
55
75
|
*/
|
|
56
76
|
export declare function getConnectionProperties(typeName: string): ConnectionPropertyDefinition[] | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Get the display name for a registered connection type.
|
|
79
|
+
*
|
|
80
|
+
* @param typeName The connection type name.
|
|
81
|
+
* @returns The human-readable display name, or undefined if the type is not registered.
|
|
82
|
+
*/
|
|
83
|
+
export declare function getConnectionTypeDisplayName(typeName: string): string | undefined;
|
|
57
84
|
/**
|
|
58
85
|
* Get the names of all registered connection types.
|
|
59
86
|
*/
|
|
@@ -4,12 +4,28 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.isValueRef = isValueRef;
|
|
8
|
+
exports.resolveValue = resolveValue;
|
|
7
9
|
exports.registerConnectionType = registerConnectionType;
|
|
8
10
|
exports.getConnectionProperties = getConnectionProperties;
|
|
11
|
+
exports.getConnectionTypeDisplayName = getConnectionTypeDisplayName;
|
|
9
12
|
exports.getRegisteredConnectionTypes = getRegisteredConnectionTypes;
|
|
10
13
|
exports.readConnectionsConfig = readConnectionsConfig;
|
|
11
14
|
exports.writeConnectionsConfig = writeConnectionsConfig;
|
|
12
15
|
exports.createConnectionsFromConfig = createConnectionsFromConfig;
|
|
16
|
+
/**
|
|
17
|
+
* Type guard for ValueRef.
|
|
18
|
+
*/
|
|
19
|
+
function isValueRef(value) {
|
|
20
|
+
return typeof value === 'object' && value !== null && 'env' in value;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Resolve a ValueRef to a string by looking up the environment variable.
|
|
24
|
+
* Returns undefined if the env var is not set.
|
|
25
|
+
*/
|
|
26
|
+
function resolveValue(vr) {
|
|
27
|
+
return process.env[vr.env];
|
|
28
|
+
}
|
|
13
29
|
// Module-level registry
|
|
14
30
|
const registry = new Map();
|
|
15
31
|
/**
|
|
@@ -31,6 +47,16 @@ function getConnectionProperties(typeName) {
|
|
|
31
47
|
var _a;
|
|
32
48
|
return (_a = registry.get(typeName)) === null || _a === void 0 ? void 0 : _a.properties;
|
|
33
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the display name for a registered connection type.
|
|
52
|
+
*
|
|
53
|
+
* @param typeName The connection type name.
|
|
54
|
+
* @returns The human-readable display name, or undefined if the type is not registered.
|
|
55
|
+
*/
|
|
56
|
+
function getConnectionTypeDisplayName(typeName) {
|
|
57
|
+
var _a;
|
|
58
|
+
return (_a = registry.get(typeName)) === null || _a === void 0 ? void 0 : _a.displayName;
|
|
59
|
+
}
|
|
34
60
|
/**
|
|
35
61
|
* Get the names of all registered connection types.
|
|
36
62
|
*/
|
|
@@ -94,10 +120,18 @@ function createConnectionsFromConfig(config) {
|
|
|
94
120
|
if (key === 'is')
|
|
95
121
|
continue;
|
|
96
122
|
if (value !== undefined) {
|
|
97
|
-
|
|
123
|
+
if (isValueRef(value)) {
|
|
124
|
+
const resolved = resolveValue(value);
|
|
125
|
+
if (resolved !== undefined) {
|
|
126
|
+
connConfig[key] = resolved;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
connConfig[key] = value;
|
|
131
|
+
}
|
|
98
132
|
}
|
|
99
133
|
}
|
|
100
|
-
const connection = typeDef.factory(connConfig);
|
|
134
|
+
const connection = await typeDef.factory(connConfig);
|
|
101
135
|
cache.set(connectionName, connection);
|
|
102
136
|
return connection;
|
|
103
137
|
},
|
package/dist/index.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export type { PreparedQuery, Field, AtomicField, ExploreField, QueryField, Sorta
|
|
|
9
9
|
export type { QueryOptionsReader, RunSQLOptions } from './run_sql_options';
|
|
10
10
|
export type { EventStream, ModelString, ModelURL, QueryString, QueryURL, URLReader, InvalidationKey, } from './runtime_types';
|
|
11
11
|
export type { Connection, ConnectionConfig, ConnectionParameterValue, FetchSchemaOptions, InfoConnection, LookupConnection, PersistSQLResults, PooledConnection, TestableConnection, StreamingConnection, } from './connection/types';
|
|
12
|
-
export { registerConnectionType, getConnectionProperties, getRegisteredConnectionTypes, readConnectionsConfig, writeConnectionsConfig, createConnectionsFromConfig, } from './connection/registry';
|
|
13
|
-
export type { ConnectionTypeFactory, ConnectionPropertyType, ConnectionPropertyDefinition, ConnectionTypeDef, ConnectionConfigEntry, ConnectionsConfig, } from './connection/registry';
|
|
12
|
+
export { registerConnectionType, getConnectionProperties, getConnectionTypeDisplayName, getRegisteredConnectionTypes, readConnectionsConfig, writeConnectionsConfig, createConnectionsFromConfig, isValueRef, resolveValue, } from './connection/registry';
|
|
13
|
+
export type { ConnectionTypeFactory, ConnectionPropertyType, ConnectionPropertyDefinition, ConnectionTypeDef, ConnectionConfigEntry, ConnectionsConfig, ConfigValue, ValueRef, } from './connection/registry';
|
|
14
14
|
export { toAsyncGenerator } from './connection_utils';
|
|
15
15
|
export { modelDefToModelInfo, sourceDefToSourceInfo } from './to_stable';
|
|
16
16
|
export * as API from './api';
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Runtime = exports.Malloy = exports.Model = exports.MalloyTranslator = exports.malloyToQuery = exports.constantExprToSQL = exports.isDateUnit = exports.isTimestampUnit = exports.composeSQLExpr = exports.indent = exports.expressionIsUngroupedAggregate = exports.expressionIsScalar = exports.expressionIsCalculation = exports.expressionIsAnalytic = exports.expressionIsAggregate = exports.mkFieldDef = exports.mkArrayDef = exports.isBasicArray = exports.isRepeatedRecord = exports.isSamplingRows = exports.isSamplingPercent = exports.isSamplingEnable = exports.isJoinedSource = exports.isJoined = exports.isCompoundArrayData = exports.isBasicAtomic = exports.isAtomic = exports.isSourceDef = exports.TinyParser = exports.Dialect = exports.spread = exports.literal = exports.variadicParam = exports.param = exports.makeParam = exports.sql = exports.maxScalar = exports.minAggregate = exports.anyExprType = exports.minScalar = exports.overload = exports.qtz = exports.arg = exports.registerDialect = exports.MySQLDialect = exports.SnowflakeDialect = exports.PostgresDialect = exports.TrinoDialect = exports.StandardSQLDialect = exports.DuckDBDialect = void 0;
|
|
37
|
-
exports.makeDigest = exports.PersistSource = exports.annotationToTaglines = exports.annotationToTag = exports.sqlKey = exports.API = exports.sourceDefToSourceInfo = exports.modelDefToModelInfo = exports.toAsyncGenerator = exports.createConnectionsFromConfig = exports.writeConnectionsConfig = exports.readConnectionsConfig = exports.getRegisteredConnectionTypes = exports.getConnectionProperties = exports.registerConnectionType = exports.CacheManager = exports.InMemoryModelCache = exports.Explore = exports.DataWriter = exports.Parse = exports.JSONWriter = exports.CSVWriter = exports.QueryMaterializer = exports.Result = exports.PreparedResult = exports.TimestampTimeframe = exports.DateTimeframe = exports.SourceRelationship = exports.JoinRelationship = exports.MalloyError = exports.FixedConnectionMap = exports.InMemoryURLReader = exports.EmptyURLReader = exports.SingleConnectionRuntime = exports.ConnectionRuntime = exports.AtomicFieldType = void 0;
|
|
37
|
+
exports.makeDigest = exports.PersistSource = exports.annotationToTaglines = exports.annotationToTag = exports.sqlKey = exports.API = exports.sourceDefToSourceInfo = exports.modelDefToModelInfo = exports.toAsyncGenerator = exports.resolveValue = exports.isValueRef = exports.createConnectionsFromConfig = exports.writeConnectionsConfig = exports.readConnectionsConfig = exports.getRegisteredConnectionTypes = exports.getConnectionTypeDisplayName = exports.getConnectionProperties = exports.registerConnectionType = exports.CacheManager = exports.InMemoryModelCache = exports.Explore = exports.DataWriter = exports.Parse = exports.JSONWriter = exports.CSVWriter = exports.QueryMaterializer = exports.Result = exports.PreparedResult = exports.TimestampTimeframe = exports.DateTimeframe = exports.SourceRelationship = exports.JoinRelationship = exports.MalloyError = exports.FixedConnectionMap = exports.InMemoryURLReader = exports.EmptyURLReader = exports.SingleConnectionRuntime = exports.ConnectionRuntime = exports.AtomicFieldType = void 0;
|
|
38
38
|
/*
|
|
39
39
|
* Copyright 2023 Google LLC
|
|
40
40
|
*
|
|
@@ -138,10 +138,13 @@ Object.defineProperty(exports, "CacheManager", { enumerable: true, get: function
|
|
|
138
138
|
var registry_1 = require("./connection/registry");
|
|
139
139
|
Object.defineProperty(exports, "registerConnectionType", { enumerable: true, get: function () { return registry_1.registerConnectionType; } });
|
|
140
140
|
Object.defineProperty(exports, "getConnectionProperties", { enumerable: true, get: function () { return registry_1.getConnectionProperties; } });
|
|
141
|
+
Object.defineProperty(exports, "getConnectionTypeDisplayName", { enumerable: true, get: function () { return registry_1.getConnectionTypeDisplayName; } });
|
|
141
142
|
Object.defineProperty(exports, "getRegisteredConnectionTypes", { enumerable: true, get: function () { return registry_1.getRegisteredConnectionTypes; } });
|
|
142
143
|
Object.defineProperty(exports, "readConnectionsConfig", { enumerable: true, get: function () { return registry_1.readConnectionsConfig; } });
|
|
143
144
|
Object.defineProperty(exports, "writeConnectionsConfig", { enumerable: true, get: function () { return registry_1.writeConnectionsConfig; } });
|
|
144
145
|
Object.defineProperty(exports, "createConnectionsFromConfig", { enumerable: true, get: function () { return registry_1.createConnectionsFromConfig; } });
|
|
146
|
+
Object.defineProperty(exports, "isValueRef", { enumerable: true, get: function () { return registry_1.isValueRef; } });
|
|
147
|
+
Object.defineProperty(exports, "resolveValue", { enumerable: true, get: function () { return registry_1.resolveValue; } });
|
|
145
148
|
var connection_utils_1 = require("./connection_utils");
|
|
146
149
|
Object.defineProperty(exports, "toAsyncGenerator", { enumerable: true, get: function () { return connection_utils_1.toAsyncGenerator; } });
|
|
147
150
|
var to_stable_1 = require("./to_stable");
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MALLOY_VERSION = "0.0.
|
|
1
|
+
export declare const MALLOY_VERSION = "0.0.343";
|
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.343';
|
|
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.343",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"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"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@malloydata/malloy-filter": "0.0.
|
|
49
|
-
"@malloydata/malloy-interfaces": "0.0.
|
|
50
|
-
"@malloydata/malloy-tag": "0.0.
|
|
48
|
+
"@malloydata/malloy-filter": "0.0.343",
|
|
49
|
+
"@malloydata/malloy-interfaces": "0.0.343",
|
|
50
|
+
"@malloydata/malloy-tag": "0.0.343",
|
|
51
51
|
"@noble/hashes": "^1.8.0",
|
|
52
52
|
"antlr4ts": "^0.5.0-alpha.4",
|
|
53
53
|
"assert": "^2.0.0",
|