@malloydata/db-snowflake 0.0.336 → 0.0.337

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/index.js CHANGED
@@ -25,4 +25,59 @@ Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.SnowflakeConnection = void 0;
26
26
  var snowflake_connection_1 = require("./snowflake_connection");
27
27
  Object.defineProperty(exports, "SnowflakeConnection", { enumerable: true, get: function () { return snowflake_connection_1.SnowflakeConnection; } });
28
+ const malloy_1 = require("@malloydata/malloy");
29
+ const snowflake_connection_2 = require("./snowflake_connection");
30
+ (0, malloy_1.registerConnectionType)('snowflake', {
31
+ factory: (config) => {
32
+ const { name, ...props } = config;
33
+ // ConnectionConfig values are trusted to match ConnectionOptions fields
34
+ // because the property definitions below declare matching names/types.
35
+ // The double cast bridges Malloy's generic config to snowflake-sdk's
36
+ // external typed interface — unavoidable without enumerating every
37
+ // ConnectionOptions field.
38
+ const connOptions = props;
39
+ return new snowflake_connection_2.SnowflakeConnection(name, { connOptions });
40
+ },
41
+ properties: [
42
+ { name: 'account', displayName: 'Account', type: 'string' },
43
+ { name: 'username', displayName: 'Username', type: 'string', optional: true },
44
+ {
45
+ name: 'password',
46
+ displayName: 'Password',
47
+ type: 'password',
48
+ optional: true,
49
+ },
50
+ { name: 'role', displayName: 'Role', type: 'string', optional: true },
51
+ {
52
+ name: 'warehouse',
53
+ displayName: 'Warehouse',
54
+ type: 'string',
55
+ optional: true,
56
+ },
57
+ { name: 'database', displayName: 'Database', type: 'string', optional: true },
58
+ { name: 'schema', displayName: 'Schema', type: 'string', optional: true },
59
+ {
60
+ name: 'privateKeyPath',
61
+ displayName: 'Private Key Path',
62
+ type: 'file',
63
+ optional: true,
64
+ fileFilters: {
65
+ 'Private Key Files': ['pem', 'key', 'rsa'],
66
+ 'All Files': ['*'],
67
+ },
68
+ },
69
+ {
70
+ name: 'privateKeyPass',
71
+ displayName: 'Private Key Passphrase',
72
+ type: 'password',
73
+ optional: true,
74
+ },
75
+ {
76
+ name: 'timeoutMs',
77
+ displayName: 'Timeout (ms)',
78
+ type: 'number',
79
+ optional: true,
80
+ },
81
+ ],
82
+ });
28
83
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAEH,+DAA2D;AAAnD,2HAAA,mBAAmB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAEH,+DAA2D;AAAnD,2HAAA,mBAAmB,OAAA;AAE3B,+CAA0D;AAG1D,iEAA2D;AAE3D,IAAA,+BAAsB,EAAC,WAAW,EAAE;IAClC,OAAO,EAAE,CAAC,MAAwB,EAAE,EAAE;QACpC,MAAM,EAAC,IAAI,EAAE,GAAG,KAAK,EAAC,GAAG,MAAM,CAAC;QAChC,wEAAwE;QACxE,uEAAuE;QACvE,qEAAqE;QACrE,mEAAmE;QACnE,2BAA2B;QAC3B,MAAM,WAAW,GAAG,KAAqC,CAAC;QAC1D,OAAO,IAAI,0CAAmB,CAAC,IAAI,EAAE,EAAC,WAAW,EAAC,CAAC,CAAC;IACtD,CAAC;IACD,UAAU,EAAE;QACV,EAAC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAC;QACzD,EAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAC;QAC3E;YACE,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,IAAI;SACf;QACD,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAC;QACnE;YACE,IAAI,EAAE,WAAW;YACjB,WAAW,EAAE,WAAW;YACxB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,EAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAC;QAC3E,EAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAC;QACvE;YACE,IAAI,EAAE,gBAAgB;YACtB,WAAW,EAAE,kBAAkB;YAC/B,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE;gBACX,mBAAmB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;gBAC1C,WAAW,EAAE,CAAC,GAAG,CAAC;aACnB;SACF;QACD;YACE,IAAI,EAAE,gBAAgB;YACtB,WAAW,EAAE,wBAAwB;YACrC,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,WAAW;YACjB,WAAW,EAAE,cAAc;YAC3B,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;KACF;CACF,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/db-snowflake",
3
- "version": "0.0.336",
3
+ "version": "0.0.337",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "prepublishOnly": "npm run build"
23
23
  },
24
24
  "dependencies": {
25
- "@malloydata/malloy": "0.0.336",
25
+ "@malloydata/malloy": "0.0.337",
26
26
  "generic-pool": "^3.9.0",
27
27
  "snowflake-sdk": "2.3.1",
28
28
  "toml": "^3.0.0"
package/src/index.ts CHANGED
@@ -22,3 +22,62 @@
22
22
  */
23
23
 
24
24
  export {SnowflakeConnection} from './snowflake_connection';
25
+
26
+ import {registerConnectionType} from '@malloydata/malloy';
27
+ import type {ConnectionConfig} from '@malloydata/malloy';
28
+ import type {ConnectionOptions} from 'snowflake-sdk';
29
+ import {SnowflakeConnection} from './snowflake_connection';
30
+
31
+ registerConnectionType('snowflake', {
32
+ factory: (config: ConnectionConfig) => {
33
+ const {name, ...props} = config;
34
+ // ConnectionConfig values are trusted to match ConnectionOptions fields
35
+ // because the property definitions below declare matching names/types.
36
+ // The double cast bridges Malloy's generic config to snowflake-sdk's
37
+ // external typed interface — unavoidable without enumerating every
38
+ // ConnectionOptions field.
39
+ const connOptions = props as unknown as ConnectionOptions;
40
+ return new SnowflakeConnection(name, {connOptions});
41
+ },
42
+ properties: [
43
+ {name: 'account', displayName: 'Account', type: 'string'},
44
+ {name: 'username', displayName: 'Username', type: 'string', optional: true},
45
+ {
46
+ name: 'password',
47
+ displayName: 'Password',
48
+ type: 'password',
49
+ optional: true,
50
+ },
51
+ {name: 'role', displayName: 'Role', type: 'string', optional: true},
52
+ {
53
+ name: 'warehouse',
54
+ displayName: 'Warehouse',
55
+ type: 'string',
56
+ optional: true,
57
+ },
58
+ {name: 'database', displayName: 'Database', type: 'string', optional: true},
59
+ {name: 'schema', displayName: 'Schema', type: 'string', optional: true},
60
+ {
61
+ name: 'privateKeyPath',
62
+ displayName: 'Private Key Path',
63
+ type: 'file',
64
+ optional: true,
65
+ fileFilters: {
66
+ 'Private Key Files': ['pem', 'key', 'rsa'],
67
+ 'All Files': ['*'],
68
+ },
69
+ },
70
+ {
71
+ name: 'privateKeyPass',
72
+ displayName: 'Private Key Passphrase',
73
+ type: 'password',
74
+ optional: true,
75
+ },
76
+ {
77
+ name: 'timeoutMs',
78
+ displayName: 'Timeout (ms)',
79
+ type: 'number',
80
+ optional: true,
81
+ },
82
+ ],
83
+ });