@twin.org/blob-storage-connector-gcp 0.0.1-next.7 → 0.0.1-next.9
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/cjs/index.cjs
CHANGED
|
@@ -39,11 +39,17 @@ class GcpBlobStorageConnector {
|
|
|
39
39
|
core.Guards.object(this.CLASS_NAME, "options", options);
|
|
40
40
|
core.Guards.object(this.CLASS_NAME, "options.config", options.config);
|
|
41
41
|
core.Guards.stringValue(this.CLASS_NAME, "options.config.projectId", options.config.projectId);
|
|
42
|
+
let credentials;
|
|
43
|
+
if (!core.Is.empty(options.config.credentials)) {
|
|
44
|
+
core.Guards.stringBase64(this.CLASS_NAME, "options.config.credentials", options.config.credentials);
|
|
45
|
+
credentials = core.ObjectHelper.fromBytes(core.Converter.base64ToBytes(options.config.credentials));
|
|
46
|
+
}
|
|
42
47
|
core.Guards.stringValue(this.CLASS_NAME, "options.config.bucketName", options.config.bucketName);
|
|
43
48
|
this._config = options.config;
|
|
44
49
|
this._storage = new storage.Storage({
|
|
45
50
|
projectId: this._config.projectId,
|
|
46
|
-
apiEndpoint: this._config.apiEndpoint
|
|
51
|
+
apiEndpoint: this._config.apiEndpoint,
|
|
52
|
+
credentials
|
|
47
53
|
});
|
|
48
54
|
}
|
|
49
55
|
/**
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Storage } from '@google-cloud/storage';
|
|
2
|
-
import { Guards, Converter, Urn, GeneralError } from '@twin.org/core';
|
|
2
|
+
import { Guards, Is, ObjectHelper, Converter, Urn, GeneralError } from '@twin.org/core';
|
|
3
3
|
import { Sha256 } from '@twin.org/crypto';
|
|
4
4
|
import { MimeTypes } from '@twin.org/web';
|
|
5
5
|
|
|
@@ -37,11 +37,17 @@ class GcpBlobStorageConnector {
|
|
|
37
37
|
Guards.object(this.CLASS_NAME, "options", options);
|
|
38
38
|
Guards.object(this.CLASS_NAME, "options.config", options.config);
|
|
39
39
|
Guards.stringValue(this.CLASS_NAME, "options.config.projectId", options.config.projectId);
|
|
40
|
+
let credentials;
|
|
41
|
+
if (!Is.empty(options.config.credentials)) {
|
|
42
|
+
Guards.stringBase64(this.CLASS_NAME, "options.config.credentials", options.config.credentials);
|
|
43
|
+
credentials = ObjectHelper.fromBytes(Converter.base64ToBytes(options.config.credentials));
|
|
44
|
+
}
|
|
40
45
|
Guards.stringValue(this.CLASS_NAME, "options.config.bucketName", options.config.bucketName);
|
|
41
46
|
this._config = options.config;
|
|
42
47
|
this._storage = new Storage({
|
|
43
48
|
projectId: this._config.projectId,
|
|
44
|
-
apiEndpoint: this._config.apiEndpoint
|
|
49
|
+
apiEndpoint: this._config.apiEndpoint,
|
|
50
|
+
credentials
|
|
45
51
|
});
|
|
46
52
|
}
|
|
47
53
|
/**
|
|
@@ -6,6 +6,10 @@ export interface IGcpBlobStorageConnectorConfig {
|
|
|
6
6
|
* The GCP project ID.
|
|
7
7
|
*/
|
|
8
8
|
projectId: string;
|
|
9
|
+
/**
|
|
10
|
+
* The GCP credentials, a base64 encoded version of the JWTInput data type.
|
|
11
|
+
*/
|
|
12
|
+
credentials?: string;
|
|
9
13
|
/**
|
|
10
14
|
* The GCP bucket name.
|
|
11
15
|
*/
|
|
@@ -14,9 +18,4 @@ export interface IGcpBlobStorageConnectorConfig {
|
|
|
14
18
|
* Optional endpoint for GCP Storage emulator.
|
|
15
19
|
*/
|
|
16
20
|
apiEndpoint?: string;
|
|
17
|
-
/**
|
|
18
|
-
* The protocol to use for GCP Storage (e.g., 'http' or 'https').
|
|
19
|
-
* Defaults to 'https' if not specified.
|
|
20
|
-
*/
|
|
21
|
-
protocol?: "http" | "https";
|
|
22
21
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -12,6 +12,14 @@ The GCP project ID.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
+
### credentials?
|
|
16
|
+
|
|
17
|
+
> `optional` **credentials**: `string`
|
|
18
|
+
|
|
19
|
+
The GCP credentials, a base64 encoded version of the JWTInput data type.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
15
23
|
### bucketName
|
|
16
24
|
|
|
17
25
|
> **bucketName**: `string`
|
|
@@ -25,12 +33,3 @@ The GCP bucket name.
|
|
|
25
33
|
> `optional` **apiEndpoint**: `string`
|
|
26
34
|
|
|
27
35
|
Optional endpoint for GCP Storage emulator.
|
|
28
|
-
|
|
29
|
-
***
|
|
30
|
-
|
|
31
|
-
### protocol?
|
|
32
|
-
|
|
33
|
-
> `optional` **protocol**: `"http"` \| `"https"`
|
|
34
|
-
|
|
35
|
-
The protocol to use for GCP Storage (e.g., 'http' or 'https').
|
|
36
|
-
Defaults to 'https' if not specified.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/blob-storage-connector-gcp",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.9",
|
|
4
4
|
"description": "Blob Storage connector implementation using Google Cloud Storage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@google-cloud/storage": "^7.13.0",
|
|
18
|
-
"@twin.org/blob-storage-models": "0.0.1-next.
|
|
18
|
+
"@twin.org/blob-storage-models": "0.0.1-next.9",
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/crypto": "next",
|
|
21
21
|
"@twin.org/nameof": "next",
|