@malloydata/db-bigquery 0.0.378 → 0.0.380

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.
@@ -1,7 +1,7 @@
1
1
  import type { RowMetadata } from '@google-cloud/bigquery';
2
2
  import type bigquery from '@google-cloud/bigquery/build/src/types';
3
3
  import type { ResourceStream } from '@google-cloud/paginator';
4
- import type { Connection, ConnectionConfig, MalloyQueryData, PersistSQLResults, QueryData, QueryRecord, QueryOptionsReader, QueryRunStats, RunSQLOptions, StreamingConnection, TableSourceDef, SQLSourceDef, SQLSourceRequest } from '@malloydata/malloy';
4
+ import type { Connection, ConnectionConfig, ConnectionParameterValue, MalloyQueryData, PersistSQLResults, QueryData, QueryRecord, QueryOptionsReader, QueryRunStats, RunSQLOptions, StreamingConnection, TableSourceDef, SQLSourceDef, SQLSourceRequest } from '@malloydata/malloy';
5
5
  import type { TableMetadata } from '@malloydata/malloy/connection';
6
6
  import { BaseConnection } from '@malloydata/malloy/connection';
7
7
  export interface BigQueryManagerOptions {
@@ -25,13 +25,18 @@ interface BigQueryConnectionConfiguration {
25
25
  maximumBytesBilled?: string;
26
26
  timeoutMs?: string;
27
27
  billingProjectId?: string;
28
- credentials?: CredentialBody;
28
+ credentials?: CredentialBody | {
29
+ [key: string]: ConnectionParameterValue;
30
+ };
29
31
  setupSQL?: string;
30
32
  }
31
33
  interface BigQueryConnectionOptions extends ConnectionConfig {
32
34
  /** This ID is used for Bigquery Table Normalization */
33
35
  projectId?: string;
34
36
  serviceAccountKeyPath?: string;
37
+ serviceAccountKey?: {
38
+ [key: string]: ConnectionParameterValue;
39
+ };
35
40
  location?: string;
36
41
  maximumBytesBilled?: string;
37
42
  timeoutMs?: string;
@@ -106,10 +106,13 @@ class BigQueryConnection extends connection_1.BaseConnection {
106
106
  this.name = arg;
107
107
  }
108
108
  else {
109
- const { name, client_email, private_key, ...args } = arg;
109
+ const { name, client_email, private_key, serviceAccountKey, ...args } = arg;
110
110
  this.name = name;
111
111
  config = args;
112
- if (client_email || private_key) {
112
+ if (serviceAccountKey) {
113
+ config.credentials = serviceAccountKey;
114
+ }
115
+ else if (client_email || private_key) {
113
116
  config.credentials = {
114
117
  client_email,
115
118
  private_key,
package/dist/index.js CHANGED
@@ -41,11 +41,17 @@ const bigquery_connection_2 = require("./bigquery_connection");
41
41
  },
42
42
  {
43
43
  name: 'serviceAccountKeyPath',
44
- displayName: 'Service Account Key',
44
+ displayName: 'Service Account Key Path',
45
45
  type: 'file',
46
46
  optional: true,
47
47
  fileFilters: { JSON: ['json'] },
48
48
  },
49
+ {
50
+ name: 'serviceAccountKey',
51
+ displayName: 'Service Account Key',
52
+ type: 'json',
53
+ optional: true,
54
+ },
49
55
  {
50
56
  name: 'location',
51
57
  displayName: 'Location',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/db-bigquery",
3
- "version": "0.0.378",
3
+ "version": "0.0.380",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "@google-cloud/bigquery": "^7.3.0",
26
26
  "@google-cloud/common": "^5.0.1",
27
27
  "@google-cloud/paginator": "^5.0.0",
28
- "@malloydata/malloy": "0.0.378",
28
+ "@malloydata/malloy": "0.0.380",
29
29
  "gaxios": "^4.2.0"
30
30
  }
31
31
  }