@alepha/bucket-azure 0.8.0 → 0.8.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/README.md CHANGED
@@ -1,21 +1,28 @@
1
- # alepha/bucket/azure
2
-
3
- ```ts
4
- import { $bucket } from "alepha/bucket";
5
- import { AlephaAzureBucket } from "alepha/bucket/azure";
6
- import { Alepha, run } from "alepha";
7
-
8
- class App {
9
- images = $bucket()
10
- }
11
-
12
- const alepha = Alepha.create( {
13
- env: {
14
- AZ_STORAGE_CONNECTION_STRING: "",
15
- },
16
- })
17
- .with(AlephaAzureBucket)
18
- .with(App);
19
-
20
- run(alepha);
1
+ # Alepha Bucket Azure
2
+
3
+ Azure Blob Storage implementation for the bucket file storage.
4
+
5
+ ## Installation
6
+
7
+ This package is part of the Alepha framework and can be installed via the all-in-one package:
8
+
9
+ ```bash
10
+ npm install alepha
11
+ ```
12
+
13
+ Alternatively, you can install it individually:
14
+
15
+ ```bash
16
+ npm install @alepha/core @alepha/bucket-azure
21
17
  ```
18
+ ## Module
19
+
20
+ Plugin for Alepha Bucket that provides Azure Blob Storage capabilities.
21
+
22
+ ## API Reference
23
+
24
+ ### Providers
25
+
26
+ #### AzureFileStorageProvider
27
+
28
+ Azure Blog Storage implementation of File Storage Provider.
package/dist/index.cjs CHANGED
@@ -30,6 +30,9 @@ const __azure_storage_blob = __toESM(require("@azure/storage-blob"));
30
30
 
31
31
  //#region src/providers/AzureFileStorageProvider.ts
32
32
  const envSchema = __alepha_core.t.object({ AZ_STORAGE_CONNECTION_STRING: __alepha_core.t.string({ size: "long" }) });
33
+ /**
34
+ * Azure Blog Storage implementation of File Storage Provider.
35
+ */
33
36
  var AzureFileStorageProvider = class {
34
37
  log = (0, __alepha_core.$logger)();
35
38
  env = (0, __alepha_core.$inject)(envSchema);
@@ -39,10 +42,7 @@ var AzureFileStorageProvider = class {
39
42
  blobServiceClient;
40
43
  options = {};
41
44
  constructor() {
42
- this.blobServiceClient = __azure_storage_blob.BlobServiceClient.fromConnectionString(this.env.AZ_STORAGE_CONNECTION_STRING, this.storagePipelineOptions());
43
- }
44
- storagePipelineOptions() {
45
- return {};
45
+ this.blobServiceClient = __azure_storage_blob.BlobServiceClient.fromConnectionString(this.env.AZ_STORAGE_CONNECTION_STRING, this.options);
46
46
  }
47
47
  async createContainer(containerName) {
48
48
  if (this.containers[containerName]) return this.containers[containerName];
@@ -116,8 +116,6 @@ var AzureFileStorageProvider = class {
116
116
  //#endregion
117
117
  //#region src/index.ts
118
118
  /**
119
- * Alepha Bucket Azure Module
120
- *
121
119
  * Plugin for Alepha Bucket that provides Azure Blob Storage capabilities.
122
120
  *
123
121
  * @see {@link AzureFileStorageProvider}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["envSchema: TObject<{\n\tAZ_STORAGE_CONNECTION_STRING: TString;\n}>","BucketDescriptorProvider","DateTimeProvider","containerName: string","bucketName: string","file: FileLike","fileId?: string","fileId: string","FileNotFoundError","container: string","name: string","alepha: Alepha","FileStorageProvider","AlephaBucket"],"sources":["../src/providers/AzureFileStorageProvider.ts","../src/index.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport {\n\tBucketDescriptorProvider,\n\tFileNotFoundError,\n\ttype FileStorageProvider,\n} from \"@alepha/bucket\";\nimport {\n\t$hook,\n\t$inject,\n\t$logger,\n\ttype FileLike,\n\ttype HookDescriptor,\n\ttype Logger,\n\ttype Static,\n\ttype TObject,\n\ttype TString,\n\tt,\n} from \"@alepha/core\";\nimport { DateTimeProvider } from \"@alepha/datetime\";\nimport { createFile } from \"@alepha/file\";\nimport {\n\tBlobServiceClient,\n\ttype BlockBlobClient,\n\ttype ContainerClient,\n\ttype StoragePipelineOptions,\n} from \"@azure/storage-blob\";\n\nconst envSchema: TObject<{\n\tAZ_STORAGE_CONNECTION_STRING: TString;\n}> = t.object({\n\tAZ_STORAGE_CONNECTION_STRING: t.string({\n\t\tsize: \"long\",\n\t}),\n});\n\ndeclare module \"@alepha/core\" {\n\tinterface Env extends Partial<Static<typeof envSchema>> {}\n}\n\nexport class AzureFileStorageProvider implements FileStorageProvider {\n\tprotected readonly log: Logger = $logger();\n\tprotected readonly env: Static<typeof envSchema> = $inject(envSchema);\n\tprotected readonly bucket: BucketDescriptorProvider = $inject(\n\t\tBucketDescriptorProvider,\n\t);\n\tprotected readonly time: DateTimeProvider = $inject(DateTimeProvider);\n\tprotected readonly containers: Record<string, ContainerClient> = {};\n\tprotected readonly blobServiceClient: BlobServiceClient;\n\tprotected readonly options: StoragePipelineOptions = {};\n\n\tconstructor() {\n\t\tthis.blobServiceClient = BlobServiceClient.fromConnectionString(\n\t\t\tthis.env.AZ_STORAGE_CONNECTION_STRING,\n\t\t\tthis.storagePipelineOptions(),\n\t\t);\n\t}\n\n\tpublic storagePipelineOptions(): StoragePipelineOptions {\n\t\treturn {};\n\t}\n\n\tpublic async createContainer(\n\t\tcontainerName: string,\n\t): Promise<ContainerClient> {\n\t\tif (this.containers[containerName]) {\n\t\t\treturn this.containers[containerName];\n\t\t}\n\t\tconst container = await this.createContainerClient(containerName);\n\t\tthis.containers[containerName] = container;\n\t\treturn container;\n\t}\n\n\tpublic async upload(\n\t\tbucketName: string,\n\t\tfile: FileLike,\n\t\tfileId?: string,\n\t): Promise<string> {\n\t\tfileId ??= this.createId();\n\t\tconst block = this.getBlock(bucketName, fileId);\n\n\t\tconst metadata = {\n\t\t\tname: file.name,\n\t\t\ttype: file.type,\n\t\t};\n\n\t\tif (file.filepath) {\n\t\t\tawait block.uploadFile(file.filepath, {\n\t\t\t\tmetadata,\n\t\t\t\tblobHTTPHeaders: {\n\t\t\t\t\tblobContentType: file.type,\n\t\t\t\t},\n\t\t\t});\n\t\t} else if (file.size > 0) {\n\t\t\tawait block.uploadData(await file.arrayBuffer(), {\n\t\t\t\tmetadata,\n\t\t\t\tblobHTTPHeaders: {\n\t\t\t\t\tblobContentType: file.type,\n\t\t\t\t},\n\t\t\t});\n\t\t} else {\n\t\t\tthrow new Error(\"Raw stream upload is not supported yet\");\n\t\t}\n\n\t\treturn fileId;\n\t}\n\n\tpublic async download(bucketName: string, fileId: string): Promise<FileLike> {\n\t\tconst block = this.getBlock(bucketName, fileId);\n\n\t\tconst blob = await block.download().catch((error) => {\n\t\t\tif (error instanceof Error) {\n\t\t\t\tthrow new FileNotFoundError(\"Error downloading file\", { cause: error });\n\t\t\t}\n\n\t\t\tthrow error;\n\t\t});\n\n\t\tif (!blob.readableStreamBody) {\n\t\t\tthrow new FileNotFoundError(\"File not found - empty stream body\");\n\t\t}\n\n\t\treturn createFile(blob.readableStreamBody, blob.metadata);\n\t}\n\n\tpublic async exists(bucketName: string, fileId: string): Promise<boolean> {\n\t\treturn await this.getBlock(bucketName, fileId).exists();\n\t}\n\n\tpublic async delete(bucketName: string, fileId: string): Promise<void> {\n\t\ttry {\n\t\t\tawait this.getBlock(bucketName, fileId).delete();\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error) {\n\t\t\t\tthrow new FileNotFoundError(\"Error deleting file\", { cause: error });\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tpublic getBlock(container: string, fileId: string): BlockBlobClient {\n\t\tif (!this.containers[container]) {\n\t\t\tthrow new FileNotFoundError(\n\t\t\t\t`File '${fileId}' not found - container '${container}' does not exists`,\n\t\t\t);\n\t\t}\n\n\t\treturn this.containers[container].getBlockBlobClient(fileId);\n\t}\n\n\tpublic readonly onStart: HookDescriptor<\"start\"> = $hook({\n\t\ton: \"start\",\n\t\thandler: async () => {\n\t\t\tfor (const bucket of this.bucket.getBuckets()) {\n\t\t\t\tconst containerName = bucket.name.replaceAll(\"/\", \"-\").toLowerCase();\n\t\t\t\tthis.log.debug(`Prepare container ${containerName}...`);\n\n\t\t\t\tif (!this.containers[containerName]) {\n\t\t\t\t\tthis.containers[containerName] =\n\t\t\t\t\t\tawait this.createContainerClient(containerName);\n\t\t\t\t}\n\n\t\t\t\tthis.log.info(`Container ${bucket} OK`);\n\t\t\t}\n\t\t},\n\t});\n\n\tprotected async createContainerClient(\n\t\tname: string,\n\t): Promise<ContainerClient> {\n\t\tconst container = this.blobServiceClient.getContainerClient(name);\n\n\t\tawait this.time.deadline(\n\t\t\t(abortSignal) => container.createIfNotExists({ abortSignal }),\n\t\t\t[5, \"seconds\"],\n\t\t);\n\n\t\treturn container;\n\t}\n\n\tprotected createId(): string {\n\t\treturn randomUUID();\n\t}\n}\n","import { AlephaBucket, FileStorageProvider } from \"@alepha/bucket\";\nimport type { Alepha, Module } from \"@alepha/core\";\nimport { AzureFileStorageProvider } from \"./providers/AzureFileStorageProvider.ts\";\n\nexport * from \"./providers/AzureFileStorageProvider.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Alepha Bucket Azure Module\n *\n * Plugin for Alepha Bucket that provides Azure Blob Storage capabilities.\n *\n * @see {@link AzureFileStorageProvider}\n * @module alepha.bucket.azure\n */\nexport class AlephaBucketAzure implements Module {\n\tpublic readonly name = \"alepha.bucket.azure\";\n\tpublic readonly $services = (alepha: Alepha): void => {\n\t\talepha\n\t\t\t.with({\n\t\t\t\tprovide: FileStorageProvider,\n\t\t\t\tuse: AzureFileStorageProvider,\n\t\t\t\toptional: true,\n\t\t\t})\n\t\t\t.with(AlephaBucket);\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAMA,YAED,gBAAE,OAAO,EACb,8BAA8B,gBAAE,OAAO,EACtC,MAAM,OACN,EAAC,CACF,EAAC;AAMF,IAAa,2BAAb,MAAqE;CACpE,AAAmB,MAAc,4BAAS;CAC1C,AAAmB,MAAgC,2BAAQ,UAAU;CACrE,AAAmB,SAAmC,2BACrDC,yCACA;CACD,AAAmB,OAAyB,2BAAQC,mCAAiB;CACrE,AAAmB,aAA8C,CAAE;CACnE,AAAmB;CACnB,AAAmB,UAAkC,CAAE;CAEvD,cAAc;AACb,OAAK,oBAAoB,uCAAkB,qBAC1C,KAAK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AI,iBAAiB,MACpB,OAAM,IAAIC,kCAAkB,uBAAuB,EAAE,OAAO,MAAO;AAEpE,SAAM;EACN;CACD;CAED,AAAO,SAASC,WAAmBF,QAAiC;AACnE,OAAK,KAAK,WAAW,WACpB,OAAM,IAAIC,mCACR,QAAQ,OAAO,2BAA2B,UAAU;AAIvD,SAAO,KAAK,WAAW,WAAW,mBAAmB,OAAO;CAC5D;CAED,AAAgB,UAAmC,yBAAM;EACxD,IAAI;EACJ,SAAS,YAAY;AACpB,QAAK,MAAM,UAAU,KAAK,OAAO,YAAY,EAAE;IAC9C,MAAM,gBAAgB,OAAO,KAAK,WAAW,KAAK,IAAI,CAAC,aAAa;AACpE,SAAK,IAAI,OAAO,oBAAoB,cAAc,KAAK;AAEvD,SAAK,KAAK,WAAW,eACpB,MAAK,WAAW,iBACf,MAAM,KAAK,sBAAsB,cAAc;AAGjD,SAAK,IAAI,MAAM,YAAY,OAAO,KAAK;GACvC;EACD;CACD,EAAC;CAEF,MAAgB,sBACfE,MAC2B;EAC3B,MAAM,YAAY,KAAK,kBAAkB,mBAAmB,KAAK;AAEjE,QAAM,KAAK,KAAK,SACf,CAAC,gBAAgB,UAAU,kBAAkB,EAAE,YAAa,EAAC,EAC7D,CAAC,GAAG,SAAU,EACd;AAED,SAAO;CACP;CAED,AAAU,WAAmB;AAC5B,SAAO,6BAAY;CACnB;AACD;;;;;;;;;;;;ACtKD,IAAa,oBAAb,MAAiD;CAChD,AAAgB,OAAO;CACvB,AAAgB,YAAY,CAACC,WAAyB;AACrD,SACE,KAAK;GACL,SAASC;GACT,KAAK;GACL,UAAU;EACV,EAAC,CACD,KAAKC,6BAAa;CACpB;AACD"}
1
+ {"version":3,"file":"index.cjs","names":["envSchema: TObject<{\n\tAZ_STORAGE_CONNECTION_STRING: TString;\n}>","BucketDescriptorProvider","DateTimeProvider","containerName: string","bucketName: string","file: FileLike","fileId?: string","fileId: string","FileNotFoundError","container: string","name: string","alepha: Alepha","FileStorageProvider","AlephaBucket"],"sources":["../src/providers/AzureFileStorageProvider.ts","../src/index.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport {\n\tBucketDescriptorProvider,\n\tFileNotFoundError,\n\ttype FileStorageProvider,\n} from \"@alepha/bucket\";\nimport {\n\t$hook,\n\t$inject,\n\t$logger,\n\ttype FileLike,\n\ttype HookDescriptor,\n\ttype Logger,\n\ttype Static,\n\ttype TObject,\n\ttype TString,\n\tt,\n} from \"@alepha/core\";\nimport { DateTimeProvider } from \"@alepha/datetime\";\nimport { createFile } from \"@alepha/file\";\nimport {\n\tBlobServiceClient,\n\ttype BlockBlobClient,\n\ttype ContainerClient,\n\ttype StoragePipelineOptions,\n} from \"@azure/storage-blob\";\n\nconst envSchema: TObject<{\n\tAZ_STORAGE_CONNECTION_STRING: TString;\n}> = t.object({\n\tAZ_STORAGE_CONNECTION_STRING: t.string({\n\t\tsize: \"long\",\n\t}),\n});\n\ndeclare module \"@alepha/core\" {\n\tinterface Env extends Partial<Static<typeof envSchema>> {}\n}\n\n/**\n * Azure Blog Storage implementation of File Storage Provider.\n */\nexport class AzureFileStorageProvider implements FileStorageProvider {\n\tprotected readonly log: Logger = $logger();\n\tprotected readonly env: Static<typeof envSchema> = $inject(envSchema);\n\tprotected readonly bucket: BucketDescriptorProvider = $inject(\n\t\tBucketDescriptorProvider,\n\t);\n\tprotected readonly time: DateTimeProvider = $inject(DateTimeProvider);\n\tprotected readonly containers: Record<string, ContainerClient> = {};\n\tprotected readonly blobServiceClient: BlobServiceClient;\n\n\tpublic readonly options: StoragePipelineOptions = {};\n\n\tconstructor() {\n\t\tthis.blobServiceClient = BlobServiceClient.fromConnectionString(\n\t\t\tthis.env.AZ_STORAGE_CONNECTION_STRING,\n\t\t\tthis.options,\n\t\t);\n\t}\n\n\tpublic async createContainer(\n\t\tcontainerName: string,\n\t): Promise<ContainerClient> {\n\t\tif (this.containers[containerName]) {\n\t\t\treturn this.containers[containerName];\n\t\t}\n\t\tconst container = await this.createContainerClient(containerName);\n\t\tthis.containers[containerName] = container;\n\t\treturn container;\n\t}\n\n\tpublic async upload(\n\t\tbucketName: string,\n\t\tfile: FileLike,\n\t\tfileId?: string,\n\t): Promise<string> {\n\t\tfileId ??= this.createId();\n\t\tconst block = this.getBlock(bucketName, fileId);\n\n\t\tconst metadata = {\n\t\t\tname: file.name,\n\t\t\ttype: file.type,\n\t\t};\n\n\t\tif (file.filepath) {\n\t\t\tawait block.uploadFile(file.filepath, {\n\t\t\t\tmetadata,\n\t\t\t\tblobHTTPHeaders: {\n\t\t\t\t\tblobContentType: file.type,\n\t\t\t\t},\n\t\t\t});\n\t\t} else if (file.size > 0) {\n\t\t\tawait block.uploadData(await file.arrayBuffer(), {\n\t\t\t\tmetadata,\n\t\t\t\tblobHTTPHeaders: {\n\t\t\t\t\tblobContentType: file.type,\n\t\t\t\t},\n\t\t\t});\n\t\t} else {\n\t\t\tthrow new Error(\"Raw stream upload is not supported yet\");\n\t\t}\n\n\t\treturn fileId;\n\t}\n\n\tpublic async download(bucketName: string, fileId: string): Promise<FileLike> {\n\t\tconst block = this.getBlock(bucketName, fileId);\n\n\t\tconst blob = await block.download().catch((error) => {\n\t\t\tif (error instanceof Error) {\n\t\t\t\tthrow new FileNotFoundError(\"Error downloading file\", { cause: error });\n\t\t\t}\n\n\t\t\tthrow error;\n\t\t});\n\n\t\tif (!blob.readableStreamBody) {\n\t\t\tthrow new FileNotFoundError(\"File not found - empty stream body\");\n\t\t}\n\n\t\treturn createFile(blob.readableStreamBody, blob.metadata);\n\t}\n\n\tpublic async exists(bucketName: string, fileId: string): Promise<boolean> {\n\t\treturn await this.getBlock(bucketName, fileId).exists();\n\t}\n\n\tpublic async delete(bucketName: string, fileId: string): Promise<void> {\n\t\ttry {\n\t\t\tawait this.getBlock(bucketName, fileId).delete();\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error) {\n\t\t\t\tthrow new FileNotFoundError(\"Error deleting file\", { cause: error });\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tpublic getBlock(container: string, fileId: string): BlockBlobClient {\n\t\tif (!this.containers[container]) {\n\t\t\tthrow new FileNotFoundError(\n\t\t\t\t`File '${fileId}' not found - container '${container}' does not exists`,\n\t\t\t);\n\t\t}\n\n\t\treturn this.containers[container].getBlockBlobClient(fileId);\n\t}\n\n\tpublic readonly onStart: HookDescriptor<\"start\"> = $hook({\n\t\ton: \"start\",\n\t\thandler: async () => {\n\t\t\tfor (const bucket of this.bucket.getBuckets()) {\n\t\t\t\tconst containerName = bucket.name.replaceAll(\"/\", \"-\").toLowerCase();\n\t\t\t\tthis.log.debug(`Prepare container ${containerName}...`);\n\n\t\t\t\tif (!this.containers[containerName]) {\n\t\t\t\t\tthis.containers[containerName] =\n\t\t\t\t\t\tawait this.createContainerClient(containerName);\n\t\t\t\t}\n\n\t\t\t\tthis.log.info(`Container ${bucket} OK`);\n\t\t\t}\n\t\t},\n\t});\n\n\tprotected async createContainerClient(\n\t\tname: string,\n\t): Promise<ContainerClient> {\n\t\tconst container = this.blobServiceClient.getContainerClient(name);\n\n\t\tawait this.time.deadline(\n\t\t\t(abortSignal) => container.createIfNotExists({ abortSignal }),\n\t\t\t[5, \"seconds\"],\n\t\t);\n\n\t\treturn container;\n\t}\n\n\tprotected createId(): string {\n\t\treturn randomUUID();\n\t}\n}\n","import { AlephaBucket, FileStorageProvider } from \"@alepha/bucket\";\nimport type { Alepha, Module } from \"@alepha/core\";\nimport { AzureFileStorageProvider } from \"./providers/AzureFileStorageProvider.ts\";\n\nexport * from \"./providers/AzureFileStorageProvider.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Plugin for Alepha Bucket that provides Azure Blob Storage capabilities.\n *\n * @see {@link AzureFileStorageProvider}\n * @module alepha.bucket.azure\n */\nexport class AlephaBucketAzure implements Module {\n\tpublic readonly name = \"alepha.bucket.azure\";\n\tpublic readonly $services = (alepha: Alepha): void => {\n\t\talepha\n\t\t\t.with({\n\t\t\t\tprovide: F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AC7D,CAAC,GAAG,SAAU,EACd;AAED,SAAO;CACP;CAED,AAAU,WAAmB;AAC5B,SAAO,6BAAY;CACnB;AACD;;;;;;;;;;ACxKD,IAAa,oBAAb,MAAiD;CAChD,AAAgB,OAAO;CACvB,AAAgB,YAAY,CAACC,WAAyB;AACrD,SACE,KAAK;GACL,SAASC;GACT,KAAK;GACL,UAAU;EACV,EAAC,CACD,KAAKC,6BAAa;CACpB;AACD"}
package/dist/index.d.cts CHANGED
@@ -10,6 +10,9 @@ declare const envSchema: TObject<{
10
10
  declare module "@alepha/core" {
11
11
  interface Env extends Partial<Static<typeof envSchema>> {}
12
12
  }
13
+ /**
14
+ * Azure Blog Storage implementation of File Storage Provider.
15
+ */
13
16
  declare class AzureFileStorageProvider implements FileStorageProvider {
14
17
  protected readonly log: Logger;
15
18
  protected readonly env: Static<typeof envSchema>;
@@ -17,9 +20,8 @@ declare class AzureFileStorageProvider implements FileStorageProvider {
17
20
  protected readonly time: DateTimeProvider;
18
21
  protected readonly containers: Record<string, ContainerClient>;
19
22
  protected readonly blobServiceClient: BlobServiceClient;
20
- protected readonly options: StoragePipelineOptions;
23
+ readonly options: StoragePipelineOptions;
21
24
  constructor();
22
- storagePipelineOptions(): StoragePipelineOptions;
23
25
  createContainer(containerName: string): Promise<ContainerClient>;
24
26
  upload(bucketName: string, file: FileLike, fileId?: string): Promise<string>;
25
27
  download(bucketName: string, fileId: string): Promise<FileLike>;
@@ -34,8 +36,6 @@ declare class AzureFileStorageProvider implements FileStorageProvider {
34
36
  //#region src/index.d.ts
35
37
  // ---------------------------------------------------------------------------------------------------------------------
36
38
  /**
37
- * Alepha Bucket Azure Module
38
- *
39
39
  * Plugin for Alepha Bucket that provides Azure Blob Storage capabilities.
40
40
  *
41
41
  * @see {@link AzureFileStorageProvider}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":["envSchema: TObject<{\n\tAZ_STORAGE_CONNECTION_STRING: TString;\n}>","containerName: string","bucketName: string","file: FileLike","fileId?: string","fileId: string","container: string","name: string","alepha: Alepha"],"sources":["../src/providers/AzureFileStorageProvider.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;cA2BMA,WAAW;gCACc;AAHF,CAAA,CAAA;eAI5B,cAAA,CAAA;EAAA,UAD8B,GAAA,SAQR,OARQ,CAQA,MARA,CAAA,OAQc,SARd,CAAA,CAAA,CAAA,CAAA;;AADd,cAYJ,wBAAA,YAAoC,mBAZhC,CAAA;EAAA,mBAAA,GAAA,EAaQ,MAbR;EAAA,mBAAA,GAAA,EAcQ,MAdR,CAAA,OAcsB,SAdtB,CAAA;EAAA,mBAS4B,MAAA,EAMjB,wBANiB;EAAA,mBAAd,IAAA,EASL,gBATK;EAAA,mBAAR,UAAA,EAUS,MAVT,CAAA,MAAA,EAUwB,eAVxB,CAAA;EAAA,mBAAA,iBAAA,EAWgB,iBAXhB;EAAA,mBAAA,OAAA,EAYM,sBAZN;EAGvB,WAAa,CAAA;EAAA,sBAAA,CAAA,CAAA,EAkBqB,sBAlBrB;EAAA,eACY,CAAA,aAAA,EAAA,MAAA,CAAA,EAuBrB,OAvBqB,CAuBb,eAvBa,CAAA;EAAA,MACc,CAAA,UAAA,EAAA,MAAA,EAAA,IAAA,EAiC/B,QAjC+B,EAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EAmCnC,OAnCmC,CAAA,MAAA,CAAA;EAAA,QAAd,CAAA,UAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAiEmC,OAjEnC,CAiE2C,QAjE3C,CAAA;EAAA,MACG,CAAA,UAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAkF8B,OAlF9B,CAAA,OAAA,CAAA;EAAA,MAGF,CAAA,UAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAmFgC,OAnFhC,CAAA,IAAA,CAAA;EAAA,QACqB,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EA6FM,eA7FN;EAAA,SAAf,OAAA,EAuGN,cAvGM,CAAA,OAAA,CAAA;EAAA,UACO,qBAAA,CAAA,IAAA,EAAA,MAAA,CAAA,EAyHnC,OAzHmC,CAyH3B,eAzH2B,CAAA;EAAA,UACV,QAAA,CAAA,CAAA,EAAA,MAAA;;;;;;;;AAvBA;;;;AAEZ;AAAA,cCXJ,iBAAA,YAA6B,MDWzB,CAAA;EAAA,SAAA,IAAA,GAAA,qBAAA;EAAA,SAS4B,SAAA,EAAA,CAAA,MAAA,EClBP,MDkBO,EAAA,GAAA,IAAA"}
1
+ {"version":3,"file":"index.d.cts","names":["envSchema: TObject<{\n\tAZ_STORAGE_CONNECTION_STRING: TString;\n}>","containerName: string","bucketName: string","file: FileLike","fileId?: string","fileId: string","container: string","name: string","alepha: Alepha"],"sources":["../src/providers/AzureFileStorageProvider.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;cA2BMA,WAAW;gCACc;AAHF,CAAA,CAAA;eAI5B,cAAA,CAAA;EAAA,UAD8B,GAAA,SAQR,OARQ,CAQA,MARA,CAAA,OAQc,SARd,CAAA,CAAA,CAAA,CAAA;;AADd;AAAA;;AAS4B,cAMhC,wBAAA,YAAoC,mBANJ,CAAA;EAAA,mBAAd,GAAA,EAON,MAPM;EAAA,mBAAR,GAAA,EAQE,MARF,CAAA,OAQgB,SARhB,CAAA;EAAA,mBAAA,MAAA,EASK,wBATL;EAAA,mBAAA,IAAA,EAYG,gBAZH;EAMvB,mBAAa,UAAA,EAOmB,MAPnB,CAAA,MAAA,EAOkC,eAPlC,CAAA;EAAA,mBAAA,iBAAA,EAQ0B,iBAR1B;EAAA,SACY,OAAA,EASC,sBATD;EAAA,WACc,CAAA;EAAA,eAAd,CAAA,aAAA,EAAA,MAAA,CAAA,EAmBrB,OAnBqB,CAmBb,eAnBa,CAAA;EAAA,MACG,CAAA,UAAA,EAAA,MAAA,EAAA,IAAA,EA6BpB,QA7BoB,EAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EA+BxB,OA/BwB,CAAA,MAAA,CAAA;EAAA,QAGF,CAAA,UAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EA0DkC,OA1DlC,CA0D0C,QA1D1C,CAAA;EAAA,MACqB,CAAA,UAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EA2EW,OA3EX,CAAA,OAAA,CAAA;EAAA,MAAf,CAAA,UAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EA+E0B,OA/E1B,CAAA,IAAA,CAAA;EAAA,QACO,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAyFc,eAzFd;EAAA,SAEb,OAAA,EAiGA,cAjGA,CAAA,OAAA,CAAA;EAAA,UAWd,qBAAA,CAAA,IAAA,EAAA,MAAA,CAAA,EAyGR,OAzGQ,CAyGA,eAzGA,CAAA;EAAA,UAAR,QAAA,CAAA,CAAA,EAAA,MAAA;;;;;;;;AAtCyB;;;AAEZ,cCbJ,iBAAA,YAA6B,MDazB,CAAA;EAAA,SAAA,IAAA,GAAA,qBAAA;EAAA,SAAA,SAAA,EAAA,CAAA,MAAA,ECXqB,MDWrB,EAAA,GAAA,IAAA"}
package/dist/index.d.ts CHANGED
@@ -10,6 +10,9 @@ declare const envSchema: TObject<{
10
10
  declare module "@alepha/core" {
11
11
  interface Env extends Partial<Static<typeof envSchema>> {}
12
12
  }
13
+ /**
14
+ * Azure Blog Storage implementation of File Storage Provider.
15
+ */
13
16
  declare class AzureFileStorageProvider implements FileStorageProvider {
14
17
  protected readonly log: Logger;
15
18
  protected readonly env: Static<typeof envSchema>;
@@ -17,9 +20,8 @@ declare class AzureFileStorageProvider implements FileStorageProvider {
17
20
  protected readonly time: DateTimeProvider;
18
21
  protected readonly containers: Record<string, ContainerClient>;
19
22
  protected readonly blobServiceClient: BlobServiceClient;
20
- protected readonly options: StoragePipelineOptions;
23
+ readonly options: StoragePipelineOptions;
21
24
  constructor();
22
- storagePipelineOptions(): StoragePipelineOptions;
23
25
  createContainer(containerName: string): Promise<ContainerClient>;
24
26
  upload(bucketName: string, file: FileLike, fileId?: string): Promise<string>;
25
27
  download(bucketName: string, fileId: string): Promise<FileLike>;
@@ -34,8 +36,6 @@ declare class AzureFileStorageProvider implements FileStorageProvider {
34
36
  //#region src/index.d.ts
35
37
  // ---------------------------------------------------------------------------------------------------------------------
36
38
  /**
37
- * Alepha Bucket Azure Module
38
- *
39
39
  * Plugin for Alepha Bucket that provides Azure Blob Storage capabilities.
40
40
  *
41
41
  * @see {@link AzureFileStorageProvider}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["envSchema: TObject<{\n\tAZ_STORAGE_CONNECTION_STRING: TString;\n}>","containerName: string","bucketName: string","file: FileLike","fileId?: string","fileId: string","container: string","name: string","alepha: Alepha"],"sources":["../src/providers/AzureFileStorageProvider.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;cA2BMA,WAAW;gCACc;AAHF,CAAA,CAAA;eAI5B,cAAA,CAAA;EAAA,UAD8B,GAAA,SAQR,OARQ,CAQA,MARA,CAAA,OAQc,SARd,CAAA,CAAA,CAAA,CAAA;;AADd,cAYJ,wBAAA,YAAoC,mBAZhC,CAAA;EAAA,mBAAA,GAAA,EAaQ,MAbR;EAAA,mBAAA,GAAA,EAcQ,MAdR,CAAA,OAcsB,SAdtB,CAAA;EAAA,mBAS4B,MAAA,EAMjB,wBANiB;EAAA,mBAAd,IAAA,EASL,gBATK;EAAA,mBAAR,UAAA,EAUS,MAVT,CAAA,MAAA,EAUwB,eAVxB,CAAA;EAAA,mBAAA,iBAAA,EAWgB,iBAXhB;EAAA,mBAAA,OAAA,EAYM,sBAZN;EAGvB,WAAa,CAAA;EAAA,sBAAA,CAAA,CAAA,EAkBqB,sBAlBrB;EAAA,eACY,CAAA,aAAA,EAAA,MAAA,CAAA,EAuBrB,OAvBqB,CAuBb,eAvBa,CAAA;EAAA,MACc,CAAA,UAAA,EAAA,MAAA,EAAA,IAAA,EAiC/B,QAjC+B,EAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EAmCnC,OAnCmC,CAAA,MAAA,CAAA;EAAA,QAAd,CAAA,UAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAiEmC,OAjEnC,CAiE2C,QAjE3C,CAAA;EAAA,MACG,CAAA,UAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAkF8B,OAlF9B,CAAA,OAAA,CAAA;EAAA,MAGF,CAAA,UAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAmFgC,OAnFhC,CAAA,IAAA,CAAA;EAAA,QACqB,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EA6FM,eA7FN;EAAA,SAAf,OAAA,EAuGN,cAvGM,CAAA,OAAA,CAAA;EAAA,UACO,qBAAA,CAAA,IAAA,EAAA,MAAA,CAAA,EAyHnC,OAzHmC,CAyH3B,eAzH2B,CAAA;EAAA,UACV,QAAA,CAAA,CAAA,EAAA,MAAA;;;;;;;;AAvBA;;;;AAEZ;AAAA,cCXJ,iBAAA,YAA6B,MDWzB,CAAA;EAAA,SAAA,IAAA,GAAA,qBAAA;EAAA,SAS4B,SAAA,EAAA,CAAA,MAAA,EClBP,MDkBO,EAAA,GAAA,IAAA"}
1
+ {"version":3,"file":"index.d.ts","names":["envSchema: TObject<{\n\tAZ_STORAGE_CONNECTION_STRING: TString;\n}>","containerName: string","bucketName: string","file: FileLike","fileId?: string","fileId: string","container: string","name: string","alepha: Alepha"],"sources":["../src/providers/AzureFileStorageProvider.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;cA2BMA,WAAW;gCACc;AAHF,CAAA,CAAA;eAI5B,cAAA,CAAA;EAAA,UAD8B,GAAA,SAQR,OARQ,CAQA,MARA,CAAA,OAQc,SARd,CAAA,CAAA,CAAA,CAAA;;AADd;AAAA;;AAS4B,cAMhC,wBAAA,Y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rB,EAAA,GAAA,IAAA"}
package/dist/index.js CHANGED
@@ -7,6 +7,9 @@ import { BlobServiceClient } from "@azure/storage-blob";
7
7
 
8
8
  //#region src/providers/AzureFileStorageProvider.ts
9
9
  const envSchema = t.object({ AZ_STORAGE_CONNECTION_STRING: t.string({ size: "long" }) });
10
+ /**
11
+ * Azure Blog Storage implementation of File Storage Provider.
12
+ */
10
13
  var AzureFileStorageProvider = class {
11
14
  log = $logger();
12
15
  env = $inject(envSchema);
@@ -16,10 +19,7 @@ var AzureFileStorageProvider = class {
16
19
  blobServiceClient;
17
20
  options = {};
18
21
  constructor() {
19
- this.blobServiceClient = BlobServiceClient.fromConnectionString(this.env.AZ_STORAGE_CONNECTION_STRING, this.storagePipelineOptions());
20
- }
21
- storagePipelineOptions() {
22
- return {};
22
+ this.blobServiceClient = BlobServiceClient.fromConnectionString(this.env.AZ_STORAGE_CONNECTION_STRING, this.options);
23
23
  }
24
24
  async createContainer(containerName) {
25
25
  if (this.containers[containerName]) return this.containers[containerName];
@@ -93,8 +93,6 @@ var AzureFileStorageProvider = class {
93
93
  //#endregion
94
94
  //#region src/index.ts
95
95
  /**
96
- * Alepha Bucket Azure Module
97
- *
98
96
  * Plugin for Alepha Bucket that provides Azure Blob Storage capabilities.
99
97
  *
100
98
  * @see {@link AzureFileStorageProvider}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["envSchema: TObject<{\n\tAZ_STORAGE_CONNECTION_STRING: TString;\n}>","containerName: string","bucketName: string","file: FileLike","fileId?: string","fileId: string","container: string","name: string","alepha: Alepha"],"sources":["../src/providers/AzureFileStorageProvider.ts","../src/index.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport {\n\tBucketDescriptorProvider,\n\tFileNotFoundError,\n\ttype FileStorageProvider,\n} from \"@alepha/bucket\";\nimport {\n\t$hook,\n\t$inject,\n\t$logger,\n\ttype FileLike,\n\ttype HookDescriptor,\n\ttype Logger,\n\ttype Static,\n\ttype TObject,\n\ttype TString,\n\tt,\n} from \"@alepha/core\";\nimport { DateTimeProvider } from \"@alepha/datetime\";\nimport { createFile } from \"@alepha/file\";\nimport {\n\tBlobServiceClient,\n\ttype BlockBlobClient,\n\ttype ContainerClient,\n\ttype StoragePipelineOptions,\n} from \"@azure/storage-blob\";\n\nconst envSchema: TObject<{\n\tAZ_STORAGE_CONNECTION_STRING: TString;\n}> = t.object({\n\tAZ_STORAGE_CONNECTION_STRING: t.string({\n\t\tsize: \"long\",\n\t}),\n});\n\ndeclare module \"@alepha/core\" {\n\tinterface Env extends Partial<Static<typeof envSchema>> {}\n}\n\nexport class AzureFileStorageProvider implements FileStorageProvider {\n\tprotected readonly log: Logger = $logger();\n\tprotected readonly env: Static<typeof envSchema> = $inject(envSchema);\n\tprotected readonly bucket: BucketDescriptorProvider = $inject(\n\t\tBucketDescriptorProvider,\n\t);\n\tprotected readonly time: DateTimeProvider = $inject(DateTimeProvider);\n\tprotected readonly containers: Record<string, ContainerClient> = {};\n\tprotected readonly blobServiceClient: BlobServiceClient;\n\tprotected readonly options: StoragePipelineOptions = {};\n\n\tconstructor() {\n\t\tthis.blobServiceClient = BlobServiceClient.fromConnectionString(\n\t\t\tthis.env.AZ_STORAGE_CONNECTION_STRING,\n\t\t\tthis.storagePipelineOptions(),\n\t\t);\n\t}\n\n\tpublic storagePipelineOptions(): StoragePipelineOptions {\n\t\treturn {};\n\t}\n\n\tpublic async createContainer(\n\t\tcontainerName: string,\n\t): Promise<ContainerClient> {\n\t\tif (this.containers[containerName]) {\n\t\t\treturn this.containers[containerName];\n\t\t}\n\t\tconst container = await this.createContainerClient(containerName);\n\t\tthis.containers[containerName] = container;\n\t\treturn container;\n\t}\n\n\tpublic async upload(\n\t\tbucketName: string,\n\t\tfile: FileLike,\n\t\tfileId?: string,\n\t): Promise<string> {\n\t\tfileId ??= this.createId();\n\t\tconst block = this.getBlock(bucketName, fileId);\n\n\t\tconst metadata = {\n\t\t\tname: file.name,\n\t\t\ttype: file.type,\n\t\t};\n\n\t\tif (file.filepath) {\n\t\t\tawait block.uploadFile(file.filepath, {\n\t\t\t\tmetadata,\n\t\t\t\tblobHTTPHeaders: {\n\t\t\t\t\tblobContentType: file.type,\n\t\t\t\t},\n\t\t\t});\n\t\t} else if (file.size > 0) {\n\t\t\tawait block.uploadData(await file.arrayBuffer(), {\n\t\t\t\tmetadata,\n\t\t\t\tblobHTTPHeaders: {\n\t\t\t\t\tblobContentType: file.type,\n\t\t\t\t},\n\t\t\t});\n\t\t} else {\n\t\t\tthrow new Error(\"Raw stream upload is not supported yet\");\n\t\t}\n\n\t\treturn fileId;\n\t}\n\n\tpublic async download(bucketName: string, fileId: string): Promise<FileLike> {\n\t\tconst block = this.getBlock(bucketName, fileId);\n\n\t\tconst blob = await block.download().catch((error) => {\n\t\t\tif (error instanceof Error) {\n\t\t\t\tthrow new FileNotFoundError(\"Error downloading file\", { cause: error });\n\t\t\t}\n\n\t\t\tthrow error;\n\t\t});\n\n\t\tif (!blob.readableStreamBody) {\n\t\t\tthrow new FileNotFoundError(\"File not found - empty stream body\");\n\t\t}\n\n\t\treturn createFile(blob.readableStreamBody, blob.metadata);\n\t}\n\n\tpublic async exists(bucketName: string, fileId: string): Promise<boolean> {\n\t\treturn await this.getBlock(bucketName, fileId).exists();\n\t}\n\n\tpublic async delete(bucketName: string, fileId: string): Promise<void> {\n\t\ttry {\n\t\t\tawait this.getBlock(bucketName, fileId).delete();\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error) {\n\t\t\t\tthrow new FileNotFoundError(\"Error deleting file\", { cause: error });\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tpublic getBlock(container: string, fileId: string): BlockBlobClient {\n\t\tif (!this.containers[container]) {\n\t\t\tthrow new FileNotFoundError(\n\t\t\t\t`File '${fileId}' not found - container '${container}' does not exists`,\n\t\t\t);\n\t\t}\n\n\t\treturn this.containers[container].getBlockBlobClient(fileId);\n\t}\n\n\tpublic readonly onStart: HookDescriptor<\"start\"> = $hook({\n\t\ton: \"start\",\n\t\thandler: async () => {\n\t\t\tfor (const bucket of this.bucket.getBuckets()) {\n\t\t\t\tconst containerName = bucket.name.replaceAll(\"/\", \"-\").toLowerCase();\n\t\t\t\tthis.log.debug(`Prepare container ${containerName}...`);\n\n\t\t\t\tif (!this.containers[containerName]) {\n\t\t\t\t\tthis.containers[containerName] =\n\t\t\t\t\t\tawait this.createContainerClient(containerName);\n\t\t\t\t}\n\n\t\t\t\tthis.log.info(`Container ${bucket} OK`);\n\t\t\t}\n\t\t},\n\t});\n\n\tprotected async createContainerClient(\n\t\tname: string,\n\t): Promise<ContainerClient> {\n\t\tconst container = this.blobServiceClient.getContainerClient(name);\n\n\t\tawait this.time.deadline(\n\t\t\t(abortSignal) => container.createIfNotExists({ abortSignal }),\n\t\t\t[5, \"seconds\"],\n\t\t);\n\n\t\treturn container;\n\t}\n\n\tprotected createId(): string {\n\t\treturn randomUUID();\n\t}\n}\n","import { AlephaBucket, FileStorageProvider } from \"@alepha/bucket\";\nimport type { Alepha, Module } from \"@alepha/core\";\nimport { AzureFileStorageProvider } from \"./providers/AzureFileStorageProvider.ts\";\n\nexport * from \"./providers/AzureFileStorageProvider.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Alepha Bucket Azure Module\n *\n * Plugin for Alepha Bucket that provides Azure Blob Storage capabilities.\n *\n * @see {@link AzureFileStorageProvider}\n * @module alepha.bucket.azure\n */\nexport class AlephaBucketAzure implements Module {\n\tpublic readonly name = \"alepha.bucket.azure\";\n\tpublic readonly $services = (alepha: Alepha): void => {\n\t\talepha\n\t\t\t.with({\n\t\t\t\tprovide: FileStorageProvider,\n\t\t\t\tuse: AzureFileStorageProvider,\n\t\t\t\toptional: true,\n\t\t\t})\n\t\t\t.with(AlephaBucket);\n\t};\n}\n"],"mappings":";;;;;;;;AA2BA,MAAMA,YAED,EAAE,OAAO,EACb,8BAA8B,EAAE,OAAO,EACtC,MAAM,OACN,E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SACE,KAAK;GACL,SAAS;GACT,KAAK;GACL,UAAU;EACV,EAAC,CACD,KAAK,aAAa;CACpB;AACD"}
1
+ {"version":3,"file":"index.js","names":["envSchema: TObject<{\n\tAZ_STORAGE_CONNECTION_STRING: TString;\n}>","containerName: string","bucketName: string","file: FileLike","fileId?: string","fileId: string","container: string","name: string","alepha: Alepha"],"sources":["../src/providers/AzureFileStorageProvider.ts","../src/index.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport {\n\tBucketDescriptorProvider,\n\tFileNotFoundError,\n\ttype FileStorageProvider,\n} from \"@alepha/bucket\";\nimport {\n\t$hook,\n\t$inject,\n\t$logger,\n\ttype FileLike,\n\ttype HookDescriptor,\n\ttype Logger,\n\ttype Static,\n\ttype TObject,\n\ttype TString,\n\tt,\n} from \"@alepha/core\";\nimport { DateTimeProvider } from \"@alepha/datetime\";\nimport { createFile } from \"@alepha/file\";\nimport {\n\tBlobServiceClient,\n\ttype BlockBlobClient,\n\ttype ContainerClient,\n\ttype StoragePipelineOptions,\n} from \"@azure/storage-blob\";\n\nconst envSchema: TObject<{\n\tAZ_STORAGE_CONNECTION_STRING: TString;\n}> = t.object({\n\tAZ_STORAGE_CONNECTION_STRING: t.string({\n\t\tsize: \"long\",\n\t}),\n});\n\ndeclare module \"@alepha/core\" {\n\tinterface Env extends Partial<Static<typeof envSchema>> {}\n}\n\n/**\n * Azure Blog Storage implementation of File Storage Provider.\n */\nexport class AzureFileStorageProvider implements FileStorageProvider {\n\tprotected readonly log: Logger = $logger();\n\tprotected readonly env: Static<typeof envSchema> = $inject(envSchema);\n\tprotected readonly bucket: BucketDescriptorProvider = $inject(\n\t\tBucketDescriptorProvider,\n\t);\n\tprotected readonly time: DateTimeProvider = $inject(DateTimeProvider);\n\tprotected readonly containers: Record<string, ContainerClient> = {};\n\tprotected readonly blobServiceClient: BlobServiceClient;\n\n\tpublic readonly options: StoragePipelineOptions = {};\n\n\tconstructor() {\n\t\tthis.blobServiceClient = BlobServiceClient.fromConnectionString(\n\t\t\tthis.env.AZ_STORAGE_CONNECTION_STRING,\n\t\t\tthis.options,\n\t\t);\n\t}\n\n\tpublic async createContainer(\n\t\tcontainerName: string,\n\t): Promise<ContainerClient> {\n\t\tif (this.containers[containerName]) {\n\t\t\treturn this.containers[containerName];\n\t\t}\n\t\tconst container = await this.createContainerClient(containerName);\n\t\tthis.containers[containerName] = container;\n\t\treturn container;\n\t}\n\n\tpublic async upload(\n\t\tbucketName: string,\n\t\tfile: FileLike,\n\t\tfileId?: string,\n\t): Promise<string> {\n\t\tfileId ??= this.createId();\n\t\tconst block = this.getBlock(bucketName, fileId);\n\n\t\tconst metadata = {\n\t\t\tname: file.name,\n\t\t\ttype: file.type,\n\t\t};\n\n\t\tif (file.filepath) {\n\t\t\tawait block.uploadFile(file.filepath, {\n\t\t\t\tmetadata,\n\t\t\t\tblobHTTPHeaders: {\n\t\t\t\t\tblobContentType: file.type,\n\t\t\t\t},\n\t\t\t});\n\t\t} else if (file.size > 0) {\n\t\t\tawait block.uploadData(await file.arrayBuffer(), {\n\t\t\t\tmetadata,\n\t\t\t\tblobHTTPHeaders: {\n\t\t\t\t\tblobContentType: file.type,\n\t\t\t\t},\n\t\t\t});\n\t\t} else {\n\t\t\tthrow new Error(\"Raw stream upload is not supported yet\");\n\t\t}\n\n\t\treturn fileId;\n\t}\n\n\tpublic async download(bucketName: string, fileId: string): Promise<FileLike> {\n\t\tconst block = this.getBlock(bucketName, fileId);\n\n\t\tconst blob = await block.download().catch((error) => {\n\t\t\tif (error instanceof Error) {\n\t\t\t\tthrow new FileNotFoundError(\"Error downloading file\", { cause: error });\n\t\t\t}\n\n\t\t\tthrow error;\n\t\t});\n\n\t\tif (!blob.readableStreamBody) {\n\t\t\tthrow new FileNotFoundError(\"File not found - empty stream body\");\n\t\t}\n\n\t\treturn createFile(blob.readableStreamBody, blob.metadata);\n\t}\n\n\tpublic async exists(bucketName: string, fileId: string): Promise<boolean> {\n\t\treturn await this.getBlock(bucketName, fileId).exists();\n\t}\n\n\tpublic async delete(bucketName: string, fileId: string): Promise<void> {\n\t\ttry {\n\t\t\tawait this.getBlock(bucketName, fileId).delete();\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error) {\n\t\t\t\tthrow new FileNotFoundError(\"Error deleting file\", { cause: error });\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tpublic getBlock(container: string, fileId: string): BlockBlobClient {\n\t\tif (!this.containers[container]) {\n\t\t\tthrow new FileNotFoundError(\n\t\t\t\t`File '${fileId}' not found - container '${container}' does not exists`,\n\t\t\t);\n\t\t}\n\n\t\treturn this.containers[container].getBlockBlobClient(fileId);\n\t}\n\n\tpublic readonly onStart: HookDescriptor<\"start\"> = $hook({\n\t\ton: \"start\",\n\t\thandler: async () => {\n\t\t\tfor (const bucket of this.bucket.getBuckets()) {\n\t\t\t\tconst containerName = bucket.name.replaceAll(\"/\", \"-\").toLowerCase();\n\t\t\t\tthis.log.debug(`Prepare container ${containerName}...`);\n\n\t\t\t\tif (!this.containers[containerName]) {\n\t\t\t\t\tthis.containers[containerName] =\n\t\t\t\t\t\tawait this.createContainerClient(containerName);\n\t\t\t\t}\n\n\t\t\t\tthis.log.info(`Container ${bucket} OK`);\n\t\t\t}\n\t\t},\n\t});\n\n\tprotected async createContainerClient(\n\t\tname: string,\n\t): Promise<ContainerClient> {\n\t\tconst container = this.blobServiceClient.getContainerClient(name);\n\n\t\tawait this.time.deadline(\n\t\t\t(abortSignal) => container.createIfNotExists({ abortSignal }),\n\t\t\t[5, \"seconds\"],\n\t\t);\n\n\t\treturn container;\n\t}\n\n\tprotected createId(): string {\n\t\treturn randomUUID();\n\t}\n}\n","import { AlephaBucket, FileStorageProvider } from \"@alepha/bucket\";\nimport type { Alepha, Module } from \"@alepha/core\";\nimport { AzureFileStorageProvider } from \"./providers/AzureFileStorageProvider.ts\";\n\nexport * from \"./providers/AzureFileStorageProvider.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Plugin for Alepha Bucket that provides Azure Blob Storage capabilities.\n *\n * @see {@link AzureFileStorageProvider}\n * @module alepha.bucket.azure\n */\nexport class AlephaBucketAzure implements Module {\n\tpublic readonly name = \"alepha.bucket.azure\";\n\tpublic readonly $services = (alepha: Alepha): void => {\n\t\talepha\n\t\t\t.with({\n\t\t\t\tprovide: FileStorageProvider,\n\t\t\t\tuse: AzureFileStorageProvider,\n\t\t\t\toptional: true,\n\t\t\t})\n\t\t\t.with(AlephaBucket);\n\t};\n}\n"],"mappings":";;;;;;;;AA2BA,MAAMA,YAED,EAAE,OAAO,EACb,8BAA8B,EAAE,OAAO,EACtC,MAAM,OACN,EAAC,CACF,EAAC;;;;AASF,IAAa,2BAAb,MAAqE;CACpE,AAAmB,MAAc,SAAS;CAC1C,AAAmB,MAAgC,QAAQ,UAAU;CACrE,AAAmB,SAAmC,QACrD,yBACA;CACD,AAAmB,OAAyB,QAAQ,iBAAiB;CACrE,AAAmB,aAA8C,CAAE;CACnE,AAAmB;CAEnB,AAAgB,UAAkC,CAAE;CAEpD,cAAc;AACb,OAAK,oBAAoB,kBAAkB,qBAC1C,KAAK,IAAI,8BACT,KAAK,QACL;CACD;CAED,MAAa,gBACZC,eAC2B;AAC3B,MAAI,KAAK,WAAW,eACnB,QAAO,KAAK,WAAW;EAExB,MAAM,YAAY,MAAM,KAAK,sBAAsB,cAAc;AACjE,OAAK,WAAW,iBAAiB;AACjC,SAAO;CACP;CAED,MAAa,OACZC,YACAC,MACAC,QACkB;AAClB,aAAW,KAAK,UAAU;EAC1B,MAAM,QAAQ,KAAK,SAAS,YAAY,OAAO;EAE/C,MAAM,WAAW;GAChB,MAAM,KAAK;GACX,MAAM,KAAK;EACX;AAED,MAAI,KAAK,SACR,OAAM,MAAM,WAAW,KAAK,UAAU;GACrC;GACA,iBAAiB,EAChB,iBAAiB,KAAK,KACtB;EACD,EAAC;WACQ,KAAK,OAAO,EACtB,OAAM,MAAM,WAAW,MAAM,KAAK,aAAa,E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ACvC;EACD;CACD,EAAC;CAEF,MAAgB,sBACfE,MAC2B;EAC3B,MAAM,YAAY,KAAK,kBAAkB,mBAAmB,KAAK;AAEjE,QAAM,KAAK,KAAK,SACf,CAAC,gBAAgB,UAAU,kBAAkB,EAAE,YAAa,EAAC,EAC7D,CAAC,GAAG,SAAU,EACd;AAED,SAAO;CACP;CAED,AAAU,WAAmB;AAC5B,SAAO,YAAY;CACnB;AACD;;;;;;;;;;ACxKD,IAAa,oBAAb,MAAiD;CAChD,AAAgB,OAAO;CACvB,AAAgB,YAAY,CAACC,WAAyB;AACrD,SACE,KAAK;GACL,SAAS;GACT,KAAK;GACL,UAAU;EACV,EAAC,CACD,KAAK,aAAa;CACpB;AACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alepha/bucket-azure",
3
- "description": "Azure Blob Storage file storage implementation for Alepha Bucket.",
3
+ "description": "Azure Blob Storage implementation for the bucket file storage.",
4
4
  "keywords": [
5
5
  "alepha",
6
6
  "bucket",
@@ -10,7 +10,7 @@
10
10
  "storage-blob"
11
11
  ],
12
12
  "author": "Feunard",
13
- "version": "0.8.0",
13
+ "version": "0.8.1",
14
14
  "type": "module",
15
15
  "engines": {
16
16
  "node": ">=22.0.0"
@@ -23,10 +23,10 @@
23
23
  "src"
24
24
  ],
25
25
  "dependencies": {
26
- "@alepha/bucket": "0.8.0",
27
- "@alepha/core": "0.8.0",
28
- "@alepha/datetime": "0.8.0",
29
- "@alepha/file": "0.8.0",
26
+ "@alepha/bucket": "0.8.1",
27
+ "@alepha/core": "0.8.1",
28
+ "@alepha/datetime": "0.8.1",
29
+ "@alepha/file": "0.8.1",
30
30
  "@azure/storage-blob": "^12.27.0"
31
31
  },
32
32
  "devDependencies": {
package/src/index.ts CHANGED
@@ -7,8 +7,6 @@ export * from "./providers/AzureFileStorageProvider.ts";
7
7
  // ---------------------------------------------------------------------------------------------------------------------
8
8
 
9
9
  /**
10
- * Alepha Bucket Azure Module
11
- *
12
10
  * Plugin for Alepha Bucket that provides Azure Blob Storage capabilities.
13
11
  *
14
12
  * @see {@link AzureFileStorageProvider}
@@ -37,6 +37,9 @@ declare module "@alepha/core" {
37
37
  interface Env extends Partial<Static<typeof envSchema>> {}
38
38
  }
39
39
 
40
+ /**
41
+ * Azure Blog Storage implementation of File Storage Provider.
42
+ */
40
43
  export class AzureFileStorageProvider implements FileStorageProvider {
41
44
  protected readonly log: Logger = $logger();
42
45
  protected readonly env: Static<typeof envSchema> = $inject(envSchema);
@@ -46,19 +49,16 @@ export class AzureFileStorageProvider implements FileStorageProvider {
46
49
  protected readonly time: DateTimeProvider = $inject(DateTimeProvider);
47
50
  protected readonly containers: Record<string, ContainerClient> = {};
48
51
  protected readonly blobServiceClient: BlobServiceClient;
49
- protected readonly options: StoragePipelineOptions = {};
52
+
53
+ public readonly options: StoragePipelineOptions = {};
50
54
 
51
55
  constructor() {
52
56
  this.blobServiceClient = BlobServiceClient.fromConnectionString(
53
57
  this.env.AZ_STORAGE_CONNECTION_STRING,
54
- this.storagePipelineOptions(),
58
+ this.options,
55
59
  );
56
60
  }
57
61
 
58
- public storagePipelineOptions(): StoragePipelineOptions {
59
- return {};
60
- }
61
-
62
62
  public async createContainer(
63
63
  containerName: string,
64
64
  ): Promise<ContainerClient> {