@malloydata/malloy 0.0.341 → 0.0.342
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/connection/registry.d.ts +14 -2
- package/dist/connection/registry.js +27 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -6,7 +6,7 @@ export type ConnectionTypeFactory = (config: ConnectionConfig) => 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
|
*/
|
|
@@ -27,12 +27,24 @@ export interface ConnectionTypeDef {
|
|
|
27
27
|
factory: ConnectionTypeFactory;
|
|
28
28
|
properties: ConnectionPropertyDefinition[];
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* A sensitive value in a config file. Either a plain string (already resolved)
|
|
32
|
+
* or an environment variable reference.
|
|
33
|
+
*/
|
|
34
|
+
export type SecretValue = string | {
|
|
35
|
+
env: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Resolve a sensitive value. Plain strings pass through, {env: "X"} looks up
|
|
39
|
+
* process.env["X"], anything else returns undefined.
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveSecret(value: unknown): string | undefined;
|
|
30
42
|
/**
|
|
31
43
|
* A single connection entry in a JSON config.
|
|
32
44
|
*/
|
|
33
45
|
export interface ConnectionConfigEntry {
|
|
34
46
|
is: string;
|
|
35
|
-
[key: string]: string | number | boolean | undefined;
|
|
47
|
+
[key: string]: string | number | boolean | SecretValue | undefined;
|
|
36
48
|
}
|
|
37
49
|
/**
|
|
38
50
|
* The editable intermediate representation of a connections config file.
|
|
@@ -4,12 +4,27 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.resolveSecret = resolveSecret;
|
|
7
8
|
exports.registerConnectionType = registerConnectionType;
|
|
8
9
|
exports.getConnectionProperties = getConnectionProperties;
|
|
9
10
|
exports.getRegisteredConnectionTypes = getRegisteredConnectionTypes;
|
|
10
11
|
exports.readConnectionsConfig = readConnectionsConfig;
|
|
11
12
|
exports.writeConnectionsConfig = writeConnectionsConfig;
|
|
12
13
|
exports.createConnectionsFromConfig = createConnectionsFromConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a sensitive value. Plain strings pass through, {env: "X"} looks up
|
|
16
|
+
* process.env["X"], anything else returns undefined.
|
|
17
|
+
*/
|
|
18
|
+
function resolveSecret(value) {
|
|
19
|
+
if (typeof value === 'string')
|
|
20
|
+
return value;
|
|
21
|
+
if (value !== null && typeof value === 'object' && 'env' in value) {
|
|
22
|
+
const envName = value.env;
|
|
23
|
+
if (typeof envName === 'string')
|
|
24
|
+
return process.env[envName];
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
13
28
|
// Module-level registry
|
|
14
29
|
const registry = new Map();
|
|
15
30
|
/**
|
|
@@ -89,12 +104,23 @@ function createConnectionsFromConfig(config) {
|
|
|
89
104
|
throw new Error(`No registered connection type "${entry.is}" for connection "${connectionName}". ` +
|
|
90
105
|
'Did you forget to import the connection package?');
|
|
91
106
|
}
|
|
107
|
+
const sensitiveProps = new Set(typeDef.properties
|
|
108
|
+
.filter(p => p.type === 'password' || p.type === 'secret')
|
|
109
|
+
.map(p => p.name));
|
|
92
110
|
const connConfig = { name: connectionName };
|
|
93
111
|
for (const [key, value] of Object.entries(entry)) {
|
|
94
112
|
if (key === 'is')
|
|
95
113
|
continue;
|
|
96
114
|
if (value !== undefined) {
|
|
97
|
-
|
|
115
|
+
if (sensitiveProps.has(key)) {
|
|
116
|
+
const resolved = resolveSecret(value);
|
|
117
|
+
if (resolved !== undefined) {
|
|
118
|
+
connConfig[key] = resolved;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else if (typeof value !== 'object') {
|
|
122
|
+
connConfig[key] = value;
|
|
123
|
+
}
|
|
98
124
|
}
|
|
99
125
|
}
|
|
100
126
|
const connection = typeDef.factory(connConfig);
|
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, getRegisteredConnectionTypes, readConnectionsConfig, writeConnectionsConfig, createConnectionsFromConfig, resolveSecret, } from './connection/registry';
|
|
13
|
+
export type { ConnectionTypeFactory, ConnectionPropertyType, ConnectionPropertyDefinition, ConnectionTypeDef, ConnectionConfigEntry, ConnectionsConfig, SecretValue, } 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.resolveSecret = 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;
|
|
38
38
|
/*
|
|
39
39
|
* Copyright 2023 Google LLC
|
|
40
40
|
*
|
|
@@ -142,6 +142,7 @@ Object.defineProperty(exports, "getRegisteredConnectionTypes", { enumerable: tru
|
|
|
142
142
|
Object.defineProperty(exports, "readConnectionsConfig", { enumerable: true, get: function () { return registry_1.readConnectionsConfig; } });
|
|
143
143
|
Object.defineProperty(exports, "writeConnectionsConfig", { enumerable: true, get: function () { return registry_1.writeConnectionsConfig; } });
|
|
144
144
|
Object.defineProperty(exports, "createConnectionsFromConfig", { enumerable: true, get: function () { return registry_1.createConnectionsFromConfig; } });
|
|
145
|
+
Object.defineProperty(exports, "resolveSecret", { enumerable: true, get: function () { return registry_1.resolveSecret; } });
|
|
145
146
|
var connection_utils_1 = require("./connection_utils");
|
|
146
147
|
Object.defineProperty(exports, "toAsyncGenerator", { enumerable: true, get: function () { return connection_utils_1.toAsyncGenerator; } });
|
|
147
148
|
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.342";
|
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.342';
|
|
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.342",
|
|
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.342",
|
|
49
|
+
"@malloydata/malloy-interfaces": "0.0.342",
|
|
50
|
+
"@malloydata/malloy-tag": "0.0.342",
|
|
51
51
|
"@noble/hashes": "^1.8.0",
|
|
52
52
|
"antlr4ts": "^0.5.0-alpha.4",
|
|
53
53
|
"assert": "^2.0.0",
|