@twin.org/blob-storage-connector-azure 0.0.1-next.8 → 0.0.1
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 +63 -25
- package/dist/esm/index.mjs +64 -26
- package/dist/types/azureBlobStorageConnector.d.ts +8 -5
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/IAzureBlobStorageConnectorConstructorOptions.d.ts +10 -0
- package/docs/changelog.md +141 -1
- package/docs/reference/classes/AzureBlobStorageConnector.md +43 -13
- package/docs/reference/index.md +1 -0
- package/docs/reference/interfaces/IAzureBlobStorageConnectorConstructorOptions.md +11 -0
- package/locales/en.json +8 -0
- package/package.json +10 -9
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var node_stream = require('node:stream');
|
|
4
3
|
var storageBlob = require('@azure/storage-blob');
|
|
5
4
|
var core = require('@twin.org/core');
|
|
6
5
|
var crypto = require('@twin.org/crypto');
|
|
6
|
+
var loggingModels = require('@twin.org/logging-models');
|
|
7
7
|
|
|
8
8
|
// Copyright 2024 IOTA Stiftung.
|
|
9
9
|
// SPDX-License-Identifier: Apache-2.0.
|
|
@@ -20,6 +20,11 @@ class AzureBlobStorageConnector {
|
|
|
20
20
|
* Runtime name for the class.
|
|
21
21
|
*/
|
|
22
22
|
CLASS_NAME = "AzureBlobStorageConnector";
|
|
23
|
+
/**
|
|
24
|
+
* The configuration for the connector.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
_config;
|
|
23
28
|
/**
|
|
24
29
|
* The Azure Service client.
|
|
25
30
|
* @internal
|
|
@@ -33,7 +38,6 @@ class AzureBlobStorageConnector {
|
|
|
33
38
|
/**
|
|
34
39
|
* Create a new instance of AzureBlobStorageConnector.
|
|
35
40
|
* @param options The options for the connector.
|
|
36
|
-
* @param options.config The configuration for the connector.
|
|
37
41
|
*/
|
|
38
42
|
constructor(options) {
|
|
39
43
|
core.Guards.object(this.CLASS_NAME, "options", options);
|
|
@@ -41,9 +45,63 @@ class AzureBlobStorageConnector {
|
|
|
41
45
|
core.Guards.stringValue(this.CLASS_NAME, "options.config.accountName", options.config.accountName);
|
|
42
46
|
core.Guards.stringValue(this.CLASS_NAME, "options.config.accountKey", options.config.accountKey);
|
|
43
47
|
core.Guards.stringValue(this.CLASS_NAME, "options.config.containerName", options.config.containerName);
|
|
48
|
+
this._config = options.config;
|
|
44
49
|
this._azureBlobServiceClient = new storageBlob.BlobServiceClient((options.config.endpoint ?? "https://{accountName}.blob.core.windows.net/").replace("{accountName}", options.config.accountName), new storageBlob.StorageSharedKeyCredential(options.config.accountName, options.config.accountKey));
|
|
45
50
|
this._azureContainerClient = this._azureBlobServiceClient.getContainerClient(options.config.containerName);
|
|
46
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Bootstrap the component by creating and initializing any resources it needs.
|
|
54
|
+
* @param nodeLoggingConnectorType The node logging connector type, defaults to "node-logging".
|
|
55
|
+
* @returns True if the bootstrapping process was successful.
|
|
56
|
+
*/
|
|
57
|
+
async bootstrap(nodeLoggingConnectorType) {
|
|
58
|
+
const nodeLogging = loggingModels.LoggingConnectorFactory.getIfExists(nodeLoggingConnectorType ?? "node-logging");
|
|
59
|
+
try {
|
|
60
|
+
await nodeLogging?.log({
|
|
61
|
+
level: "info",
|
|
62
|
+
source: this.CLASS_NAME,
|
|
63
|
+
message: "containerCreating",
|
|
64
|
+
data: {
|
|
65
|
+
container: this._config.containerName
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const exists = await this._azureContainerClient.exists();
|
|
69
|
+
if (exists) {
|
|
70
|
+
await nodeLogging?.log({
|
|
71
|
+
level: "info",
|
|
72
|
+
source: this.CLASS_NAME,
|
|
73
|
+
message: "containerExists",
|
|
74
|
+
data: {
|
|
75
|
+
container: this._config.containerName
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
await this._azureContainerClient.create();
|
|
81
|
+
await nodeLogging?.log({
|
|
82
|
+
level: "info",
|
|
83
|
+
source: this.CLASS_NAME,
|
|
84
|
+
message: "containerCreated",
|
|
85
|
+
data: {
|
|
86
|
+
container: this._config.containerName
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
await nodeLogging?.log({
|
|
93
|
+
level: "error",
|
|
94
|
+
source: this.CLASS_NAME,
|
|
95
|
+
message: "containerCreateFailed",
|
|
96
|
+
data: {
|
|
97
|
+
container: this._config.containerName
|
|
98
|
+
},
|
|
99
|
+
error: core.BaseError.fromError(err)
|
|
100
|
+
});
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
47
105
|
/**
|
|
48
106
|
* Set the blob.
|
|
49
107
|
* @param blob The data for the blob.
|
|
@@ -54,18 +112,7 @@ class AzureBlobStorageConnector {
|
|
|
54
112
|
try {
|
|
55
113
|
const id = core.Converter.bytesToHex(crypto.Sha256.sum256(blob));
|
|
56
114
|
const blockBlobClient = this._azureContainerClient.getBlockBlobClient(id);
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Reads data from the blob and pushes it into the stream.
|
|
60
|
-
* This method is automatically called when the stream is read from.
|
|
61
|
-
* It pushes the blob data and signals the end of the stream.
|
|
62
|
-
*/
|
|
63
|
-
read() {
|
|
64
|
-
this.push(blob);
|
|
65
|
-
this.push(null);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
await blockBlobClient.uploadStream(readableStream);
|
|
115
|
+
await blockBlobClient.uploadData(blob);
|
|
69
116
|
return `blob:${new core.Urn(AzureBlobStorageConnector.NAMESPACE, id).toString()}`;
|
|
70
117
|
}
|
|
71
118
|
catch (err) {
|
|
@@ -89,17 +136,8 @@ class AzureBlobStorageConnector {
|
|
|
89
136
|
try {
|
|
90
137
|
const key = urnParsed.namespaceSpecific(1);
|
|
91
138
|
const blobClient = this._azureContainerClient.getBlobClient(key);
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
const readableStream = downloadResponse.readableStreamBody;
|
|
95
|
-
const chunks = [];
|
|
96
|
-
for await (const chunk of readableStream) {
|
|
97
|
-
chunks.push(chunk);
|
|
98
|
-
}
|
|
99
|
-
const buffer = Buffer.concat(chunks);
|
|
100
|
-
return new Uint8Array(buffer);
|
|
101
|
-
}
|
|
102
|
-
return undefined;
|
|
139
|
+
const buffer = await blobClient.downloadToBuffer();
|
|
140
|
+
return new Uint8Array(buffer);
|
|
103
141
|
}
|
|
104
142
|
catch (err) {
|
|
105
143
|
throw new core.GeneralError(this.CLASS_NAME, "getBlobFailed", {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Readable } from 'node:stream';
|
|
2
1
|
import { BlobServiceClient, StorageSharedKeyCredential } from '@azure/storage-blob';
|
|
3
|
-
import { Guards, Converter, Urn, GeneralError } from '@twin.org/core';
|
|
2
|
+
import { Guards, BaseError, Converter, Urn, GeneralError } from '@twin.org/core';
|
|
4
3
|
import { Sha256 } from '@twin.org/crypto';
|
|
4
|
+
import { LoggingConnectorFactory } from '@twin.org/logging-models';
|
|
5
5
|
|
|
6
6
|
// Copyright 2024 IOTA Stiftung.
|
|
7
7
|
// SPDX-License-Identifier: Apache-2.0.
|
|
@@ -18,6 +18,11 @@ class AzureBlobStorageConnector {
|
|
|
18
18
|
* Runtime name for the class.
|
|
19
19
|
*/
|
|
20
20
|
CLASS_NAME = "AzureBlobStorageConnector";
|
|
21
|
+
/**
|
|
22
|
+
* The configuration for the connector.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
_config;
|
|
21
26
|
/**
|
|
22
27
|
* The Azure Service client.
|
|
23
28
|
* @internal
|
|
@@ -31,7 +36,6 @@ class AzureBlobStorageConnector {
|
|
|
31
36
|
/**
|
|
32
37
|
* Create a new instance of AzureBlobStorageConnector.
|
|
33
38
|
* @param options The options for the connector.
|
|
34
|
-
* @param options.config The configuration for the connector.
|
|
35
39
|
*/
|
|
36
40
|
constructor(options) {
|
|
37
41
|
Guards.object(this.CLASS_NAME, "options", options);
|
|
@@ -39,9 +43,63 @@ class AzureBlobStorageConnector {
|
|
|
39
43
|
Guards.stringValue(this.CLASS_NAME, "options.config.accountName", options.config.accountName);
|
|
40
44
|
Guards.stringValue(this.CLASS_NAME, "options.config.accountKey", options.config.accountKey);
|
|
41
45
|
Guards.stringValue(this.CLASS_NAME, "options.config.containerName", options.config.containerName);
|
|
46
|
+
this._config = options.config;
|
|
42
47
|
this._azureBlobServiceClient = new BlobServiceClient((options.config.endpoint ?? "https://{accountName}.blob.core.windows.net/").replace("{accountName}", options.config.accountName), new StorageSharedKeyCredential(options.config.accountName, options.config.accountKey));
|
|
43
48
|
this._azureContainerClient = this._azureBlobServiceClient.getContainerClient(options.config.containerName);
|
|
44
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Bootstrap the component by creating and initializing any resources it needs.
|
|
52
|
+
* @param nodeLoggingConnectorType The node logging connector type, defaults to "node-logging".
|
|
53
|
+
* @returns True if the bootstrapping process was successful.
|
|
54
|
+
*/
|
|
55
|
+
async bootstrap(nodeLoggingConnectorType) {
|
|
56
|
+
const nodeLogging = LoggingConnectorFactory.getIfExists(nodeLoggingConnectorType ?? "node-logging");
|
|
57
|
+
try {
|
|
58
|
+
await nodeLogging?.log({
|
|
59
|
+
level: "info",
|
|
60
|
+
source: this.CLASS_NAME,
|
|
61
|
+
message: "containerCreating",
|
|
62
|
+
data: {
|
|
63
|
+
container: this._config.containerName
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
const exists = await this._azureContainerClient.exists();
|
|
67
|
+
if (exists) {
|
|
68
|
+
await nodeLogging?.log({
|
|
69
|
+
level: "info",
|
|
70
|
+
source: this.CLASS_NAME,
|
|
71
|
+
message: "containerExists",
|
|
72
|
+
data: {
|
|
73
|
+
container: this._config.containerName
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
await this._azureContainerClient.create();
|
|
79
|
+
await nodeLogging?.log({
|
|
80
|
+
level: "info",
|
|
81
|
+
source: this.CLASS_NAME,
|
|
82
|
+
message: "containerCreated",
|
|
83
|
+
data: {
|
|
84
|
+
container: this._config.containerName
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
await nodeLogging?.log({
|
|
91
|
+
level: "error",
|
|
92
|
+
source: this.CLASS_NAME,
|
|
93
|
+
message: "containerCreateFailed",
|
|
94
|
+
data: {
|
|
95
|
+
container: this._config.containerName
|
|
96
|
+
},
|
|
97
|
+
error: BaseError.fromError(err)
|
|
98
|
+
});
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
45
103
|
/**
|
|
46
104
|
* Set the blob.
|
|
47
105
|
* @param blob The data for the blob.
|
|
@@ -52,18 +110,7 @@ class AzureBlobStorageConnector {
|
|
|
52
110
|
try {
|
|
53
111
|
const id = Converter.bytesToHex(Sha256.sum256(blob));
|
|
54
112
|
const blockBlobClient = this._azureContainerClient.getBlockBlobClient(id);
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Reads data from the blob and pushes it into the stream.
|
|
58
|
-
* This method is automatically called when the stream is read from.
|
|
59
|
-
* It pushes the blob data and signals the end of the stream.
|
|
60
|
-
*/
|
|
61
|
-
read() {
|
|
62
|
-
this.push(blob);
|
|
63
|
-
this.push(null);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
await blockBlobClient.uploadStream(readableStream);
|
|
113
|
+
await blockBlobClient.uploadData(blob);
|
|
67
114
|
return `blob:${new Urn(AzureBlobStorageConnector.NAMESPACE, id).toString()}`;
|
|
68
115
|
}
|
|
69
116
|
catch (err) {
|
|
@@ -87,17 +134,8 @@ class AzureBlobStorageConnector {
|
|
|
87
134
|
try {
|
|
88
135
|
const key = urnParsed.namespaceSpecific(1);
|
|
89
136
|
const blobClient = this._azureContainerClient.getBlobClient(key);
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
const readableStream = downloadResponse.readableStreamBody;
|
|
93
|
-
const chunks = [];
|
|
94
|
-
for await (const chunk of readableStream) {
|
|
95
|
-
chunks.push(chunk);
|
|
96
|
-
}
|
|
97
|
-
const buffer = Buffer.concat(chunks);
|
|
98
|
-
return new Uint8Array(buffer);
|
|
99
|
-
}
|
|
100
|
-
return undefined;
|
|
137
|
+
const buffer = await blobClient.downloadToBuffer();
|
|
138
|
+
return new Uint8Array(buffer);
|
|
101
139
|
}
|
|
102
140
|
catch (err) {
|
|
103
141
|
throw new GeneralError(this.CLASS_NAME, "getBlobFailed", {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IBlobStorageConnector } from "@twin.org/blob-storage-models";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IAzureBlobStorageConnectorConstructorOptions } from "./models/IAzureBlobStorageConnectorConstructorOptions";
|
|
3
3
|
/**
|
|
4
4
|
* Class for performing blob storage operations on Azure.
|
|
5
5
|
* See https://learn.microsoft.com/en-us/azure/storage/common/storage-samples-javascript?toc=%2Fazure%2Fstorage%2Fblobs%2Ftoc.json for more information.
|
|
@@ -16,11 +16,14 @@ export declare class AzureBlobStorageConnector implements IBlobStorageConnector
|
|
|
16
16
|
/**
|
|
17
17
|
* Create a new instance of AzureBlobStorageConnector.
|
|
18
18
|
* @param options The options for the connector.
|
|
19
|
-
* @param options.config The configuration for the connector.
|
|
20
19
|
*/
|
|
21
|
-
constructor(options:
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
constructor(options: IAzureBlobStorageConnectorConstructorOptions);
|
|
21
|
+
/**
|
|
22
|
+
* Bootstrap the component by creating and initializing any resources it needs.
|
|
23
|
+
* @param nodeLoggingConnectorType The node logging connector type, defaults to "node-logging".
|
|
24
|
+
* @returns True if the bootstrapping process was successful.
|
|
25
|
+
*/
|
|
26
|
+
bootstrap(nodeLoggingConnectorType?: string): Promise<boolean>;
|
|
24
27
|
/**
|
|
25
28
|
* Set the blob.
|
|
26
29
|
* @param blob The data for the blob.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IAzureBlobStorageConnectorConfig } from "./IAzureBlobStorageConnectorConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the Azure Blob Storage Connector constructor.
|
|
4
|
+
*/
|
|
5
|
+
export interface IAzureBlobStorageConnectorConstructorOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The configuration for the connector.
|
|
8
|
+
*/
|
|
9
|
+
config: IAzureBlobStorageConnectorConfig;
|
|
10
|
+
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,145 @@
|
|
|
1
1
|
# @twin.org/blob-storage-connector-azure - Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.0.1 (2025-07-04)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* release to production ([eacfe75](https://github.com/twinfoundation/blob-storage/commit/eacfe754a0dcd9243d9e13d86422327d0a605164))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/blob-storage-models bumped from ^0.0.0 to ^0.0.1
|
|
16
|
+
|
|
17
|
+
## [0.0.1-next.37](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-azure-v0.0.1-next.36...blob-storage-connector-azure-v0.0.1-next.37) (2025-06-20)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* **blob-storage-connector-azure:** Synchronize repo versions
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.36 to 0.0.1-next.37
|
|
30
|
+
|
|
31
|
+
## [0.0.1-next.36](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-azure-v0.0.1-next.35...blob-storage-connector-azure-v0.0.1-next.36) (2025-06-19)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Miscellaneous Chores
|
|
35
|
+
|
|
36
|
+
* **blob-storage-connector-azure:** Synchronize repo versions
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Dependencies
|
|
40
|
+
|
|
41
|
+
* The following workspace dependencies were updated
|
|
42
|
+
* dependencies
|
|
43
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.35 to 0.0.1-next.36
|
|
44
|
+
|
|
45
|
+
## [0.0.1-next.35](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-azure-v0.0.1-next.34...blob-storage-connector-azure-v0.0.1-next.35) (2025-06-17)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Miscellaneous Chores
|
|
49
|
+
|
|
50
|
+
* **blob-storage-connector-azure:** Synchronize repo versions
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Dependencies
|
|
54
|
+
|
|
55
|
+
* The following workspace dependencies were updated
|
|
56
|
+
* dependencies
|
|
57
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.34 to 0.0.1-next.35
|
|
58
|
+
|
|
59
|
+
## [0.0.1-next.34](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-azure-v0.0.1-next.33...blob-storage-connector-azure-v0.0.1-next.34) (2025-06-12)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Features
|
|
63
|
+
|
|
64
|
+
* update dependencies ([56f0094](https://github.com/twinfoundation/blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Dependencies
|
|
68
|
+
|
|
69
|
+
* The following workspace dependencies were updated
|
|
70
|
+
* dependencies
|
|
71
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.33 to 0.0.1-next.34
|
|
72
|
+
|
|
73
|
+
## [0.0.1-next.33](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-azure-v0.0.1-next.32...blob-storage-connector-azure-v0.0.1-next.33) (2025-06-03)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Miscellaneous Chores
|
|
77
|
+
|
|
78
|
+
* **blob-storage-connector-azure:** Synchronize repo versions
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Dependencies
|
|
82
|
+
|
|
83
|
+
* The following workspace dependencies were updated
|
|
84
|
+
* dependencies
|
|
85
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.32 to 0.0.1-next.33
|
|
86
|
+
|
|
87
|
+
## [0.0.1-next.32](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-azure-v0.0.1-next.31...blob-storage-connector-azure-v0.0.1-next.32) (2025-05-28)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### Miscellaneous Chores
|
|
91
|
+
|
|
92
|
+
* **blob-storage-connector-azure:** Synchronize repo versions
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
### Dependencies
|
|
96
|
+
|
|
97
|
+
* The following workspace dependencies were updated
|
|
98
|
+
* dependencies
|
|
99
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.31 to 0.0.1-next.32
|
|
100
|
+
|
|
101
|
+
## [0.0.1-next.31](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-azure-v0.0.1-next.30...blob-storage-connector-azure-v0.0.1-next.31) (2025-05-08)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### Miscellaneous Chores
|
|
105
|
+
|
|
106
|
+
* **blob-storage-connector-azure:** Synchronize repo versions
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
### Dependencies
|
|
110
|
+
|
|
111
|
+
* The following workspace dependencies were updated
|
|
112
|
+
* dependencies
|
|
113
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.30 to 0.0.1-next.31
|
|
114
|
+
|
|
115
|
+
## [0.0.1-next.30](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-azure-v0.0.1-next.29...blob-storage-connector-azure-v0.0.1-next.30) (2025-04-17)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### Features
|
|
119
|
+
|
|
120
|
+
* use shared store mechanism ([#12](https://github.com/twinfoundation/blob-storage/issues/12)) ([cae8110](https://github.com/twinfoundation/blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Dependencies
|
|
124
|
+
|
|
125
|
+
* The following workspace dependencies were updated
|
|
126
|
+
* dependencies
|
|
127
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.29 to 0.0.1-next.30
|
|
128
|
+
|
|
129
|
+
## [0.0.1-next.29](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-azure-v0.0.1-next.28...blob-storage-connector-azure-v0.0.1-next.29) (2025-03-28)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### Miscellaneous Chores
|
|
133
|
+
|
|
134
|
+
* **blob-storage-connector-azure:** Synchronize repo versions
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
### Dependencies
|
|
138
|
+
|
|
139
|
+
* The following workspace dependencies were updated
|
|
140
|
+
* dependencies
|
|
141
|
+
* @twin.org/blob-storage-models bumped from 0.0.1-next.28 to 0.0.1-next.29
|
|
142
|
+
|
|
143
|
+
## v0.0.1-next.28
|
|
4
144
|
|
|
5
145
|
- Initial Release
|
|
@@ -9,25 +9,23 @@ See https://learn.microsoft.com/en-us/azure/storage/common/storage-samples-javas
|
|
|
9
9
|
|
|
10
10
|
## Constructors
|
|
11
11
|
|
|
12
|
-
###
|
|
12
|
+
### Constructor
|
|
13
13
|
|
|
14
|
-
> **new AzureBlobStorageConnector**(`options`):
|
|
14
|
+
> **new AzureBlobStorageConnector**(`options`): `AzureBlobStorageConnector`
|
|
15
15
|
|
|
16
16
|
Create a new instance of AzureBlobStorageConnector.
|
|
17
17
|
|
|
18
18
|
#### Parameters
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
##### options
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
• **options.config**: [`IAzureBlobStorageConnectorConfig`](../interfaces/IAzureBlobStorageConnectorConfig.md)
|
|
22
|
+
[`IAzureBlobStorageConnectorConstructorOptions`](../interfaces/IAzureBlobStorageConnectorConstructorOptions.md)
|
|
25
23
|
|
|
26
|
-
The
|
|
24
|
+
The options for the connector.
|
|
27
25
|
|
|
28
26
|
#### Returns
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
`AzureBlobStorageConnector`
|
|
31
29
|
|
|
32
30
|
## Properties
|
|
33
31
|
|
|
@@ -51,6 +49,32 @@ Runtime name for the class.
|
|
|
51
49
|
|
|
52
50
|
## Methods
|
|
53
51
|
|
|
52
|
+
### bootstrap()
|
|
53
|
+
|
|
54
|
+
> **bootstrap**(`nodeLoggingConnectorType?`): `Promise`\<`boolean`\>
|
|
55
|
+
|
|
56
|
+
Bootstrap the component by creating and initializing any resources it needs.
|
|
57
|
+
|
|
58
|
+
#### Parameters
|
|
59
|
+
|
|
60
|
+
##### nodeLoggingConnectorType?
|
|
61
|
+
|
|
62
|
+
`string`
|
|
63
|
+
|
|
64
|
+
The node logging connector type, defaults to "node-logging".
|
|
65
|
+
|
|
66
|
+
#### Returns
|
|
67
|
+
|
|
68
|
+
`Promise`\<`boolean`\>
|
|
69
|
+
|
|
70
|
+
True if the bootstrapping process was successful.
|
|
71
|
+
|
|
72
|
+
#### Implementation of
|
|
73
|
+
|
|
74
|
+
`IBlobStorageConnector.bootstrap`
|
|
75
|
+
|
|
76
|
+
***
|
|
77
|
+
|
|
54
78
|
### set()
|
|
55
79
|
|
|
56
80
|
> **set**(`blob`): `Promise`\<`string`\>
|
|
@@ -59,7 +83,9 @@ Set the blob.
|
|
|
59
83
|
|
|
60
84
|
#### Parameters
|
|
61
85
|
|
|
62
|
-
|
|
86
|
+
##### blob
|
|
87
|
+
|
|
88
|
+
`Uint8Array`
|
|
63
89
|
|
|
64
90
|
The data for the blob.
|
|
65
91
|
|
|
@@ -77,19 +103,21 @@ The id of the stored blob in urn format.
|
|
|
77
103
|
|
|
78
104
|
### get()
|
|
79
105
|
|
|
80
|
-
> **get**(`id`): `Promise`\<`undefined` \| `Uint8Array
|
|
106
|
+
> **get**(`id`): `Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\>
|
|
81
107
|
|
|
82
108
|
Get the blob.
|
|
83
109
|
|
|
84
110
|
#### Parameters
|
|
85
111
|
|
|
86
|
-
|
|
112
|
+
##### id
|
|
113
|
+
|
|
114
|
+
`string`
|
|
87
115
|
|
|
88
116
|
The id of the blob to get in urn format.
|
|
89
117
|
|
|
90
118
|
#### Returns
|
|
91
119
|
|
|
92
|
-
`Promise`\<`undefined` \| `Uint8Array
|
|
120
|
+
`Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\>
|
|
93
121
|
|
|
94
122
|
The data for the blob if it can be found or undefined.
|
|
95
123
|
|
|
@@ -107,7 +135,9 @@ Remove the blob.
|
|
|
107
135
|
|
|
108
136
|
#### Parameters
|
|
109
137
|
|
|
110
|
-
|
|
138
|
+
##### id
|
|
139
|
+
|
|
140
|
+
`string`
|
|
111
141
|
|
|
112
142
|
The id of the blob to remove in urn format.
|
|
113
143
|
|
package/docs/reference/index.md
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Interface: IAzureBlobStorageConnectorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the Azure Blob Storage Connector constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### config
|
|
8
|
+
|
|
9
|
+
> **config**: [`IAzureBlobStorageConnectorConfig`](IAzureBlobStorageConnectorConfig.md)
|
|
10
|
+
|
|
11
|
+
The configuration for the connector.
|
package/locales/en.json
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
+
"info": {
|
|
3
|
+
"azureBlobStorageConnector": {
|
|
4
|
+
"containerCreating": "Creating container \"{container}\"",
|
|
5
|
+
"containerCreated": "Created container \"{container}\"",
|
|
6
|
+
"containerExists": "Skipping create container \"{container}\" as it already exists"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
2
9
|
"error": {
|
|
3
10
|
"azureBlobStorageConnector": {
|
|
11
|
+
"containerCreateFailed": "Creating container \"{container}\" failed",
|
|
4
12
|
"namespaceMismatch": "The namespace in the urn \"{id}\" does not match the namespace of the blob storage \"{namespace}\"",
|
|
5
13
|
"getBlobFailed": "Failed to get blob in Azure",
|
|
6
14
|
"setBlobFailed": "Failed to set blob in Azure",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/blob-storage-connector-azure",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "Blob Storage connector implementation using Azure",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,22 +14,23 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@azure/storage-blob": "
|
|
18
|
-
"@twin.org/blob-storage-models": "0.0.1
|
|
19
|
-
"@twin.org/core": "
|
|
20
|
-
"@twin.org/crypto": "
|
|
21
|
-
"@twin.org/
|
|
17
|
+
"@azure/storage-blob": "12.27.0",
|
|
18
|
+
"@twin.org/blob-storage-models": "^0.0.1",
|
|
19
|
+
"@twin.org/core": "^0.0.1",
|
|
20
|
+
"@twin.org/crypto": "^0.0.1",
|
|
21
|
+
"@twin.org/logging-models": "^0.0.1",
|
|
22
|
+
"@twin.org/nameof": "^0.0.1"
|
|
22
23
|
},
|
|
23
24
|
"main": "./dist/cjs/index.cjs",
|
|
24
25
|
"module": "./dist/esm/index.mjs",
|
|
25
26
|
"types": "./dist/types/index.d.ts",
|
|
26
27
|
"exports": {
|
|
27
28
|
".": {
|
|
29
|
+
"types": "./dist/types/index.d.ts",
|
|
28
30
|
"require": "./dist/cjs/index.cjs",
|
|
29
|
-
"import": "./dist/esm/index.mjs"
|
|
30
|
-
"types": "./dist/types/index.d.ts"
|
|
31
|
+
"import": "./dist/esm/index.mjs"
|
|
31
32
|
},
|
|
32
|
-
"./locales": "./locales"
|
|
33
|
+
"./locales/*.json": "./locales/*.json"
|
|
33
34
|
},
|
|
34
35
|
"files": [
|
|
35
36
|
"dist/cjs",
|