@edgestore/server 0.2.1 → 0.2.2

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,4 +1,17 @@
1
1
  import { type Provider } from '@edgestore/shared';
2
+ /**
3
+ * Options for the Azure provider. Compatible with Azure Blob Storage and Azurite.
4
+ * Use Azure Storage Explorer for local development with Azurite.
5
+ * @see https://azure.microsoft.com/de-de/products/storage/storage-explorer
6
+ * @category Providers
7
+ * @example
8
+ * AzureProvider({
9
+ * storageAccountName: 'devstoreaccount1',
10
+ * sasToken: 'some-generated-token-from-azure-storage-explorer',
11
+ * containerName: 'some-container-name',
12
+ * customBaseUrl: 'http://localhost:10000/devstoreaccount1',
13
+ * })
14
+ */
2
15
  export type AzureProviderOptions = {
3
16
  /**
4
17
  * The storage account name for Azure Blob Storage
@@ -15,6 +28,12 @@ export type AzureProviderOptions = {
15
28
  * Can also be set via the `ES_AZURE_CONTAINER_NAME` environment variable.
16
29
  */
17
30
  containerName?: string;
31
+ /**
32
+ * Optional base URL for the Azure Blob Storage.
33
+ * Useful for local development with Azurite. For example: `http://localhost:10000/devstoreaccount1`
34
+ * Can also be set via the `ES_AZURE_BASE_URL` environment variable.
35
+ */
36
+ customBaseUrl?: string;
18
37
  };
19
38
  export declare function AzureProvider(options?: AzureProviderOptions): Provider;
20
39
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/azure/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,QAAQ,CAkEtE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/azure/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,QAAQ,CAoEtE"}
@@ -6,8 +6,8 @@ var storageBlob = require('@azure/storage-blob');
6
6
  var uuid = require('uuid');
7
7
 
8
8
  function AzureProvider(options) {
9
- const { storageAccountName = process.env.ES_AZURE_ACCOUNT_NAME, sasToken = process.env.ES_AZURE_SAS_TOKEN, containerName = process.env.ES_AZURE_CONTAINER_NAME } = options ?? {};
10
- const baseUrl = `https://${storageAccountName}.blob.core.windows.net`;
9
+ const { storageAccountName = process.env.ES_AZURE_ACCOUNT_NAME, sasToken = process.env.ES_AZURE_SAS_TOKEN, containerName = process.env.ES_AZURE_CONTAINER_NAME, customBaseUrl = process.env.ES_AZURE_BASE_URL } = options ?? {};
10
+ const baseUrl = customBaseUrl ?? `https://${storageAccountName}.blob.core.windows.net`;
11
11
  const blobServiceClient = new storageBlob.BlobServiceClient(`${baseUrl}?${sasToken}`);
12
12
  const containerClient = blobServiceClient.getContainerClient(containerName ?? '');
13
13
  return {
@@ -2,8 +2,8 @@ import { BlobServiceClient } from '@azure/storage-blob';
2
2
  import { v4 } from 'uuid';
3
3
 
4
4
  function AzureProvider(options) {
5
- const { storageAccountName = process.env.ES_AZURE_ACCOUNT_NAME, sasToken = process.env.ES_AZURE_SAS_TOKEN, containerName = process.env.ES_AZURE_CONTAINER_NAME } = options ?? {};
6
- const baseUrl = `https://${storageAccountName}.blob.core.windows.net`;
5
+ const { storageAccountName = process.env.ES_AZURE_ACCOUNT_NAME, sasToken = process.env.ES_AZURE_SAS_TOKEN, containerName = process.env.ES_AZURE_CONTAINER_NAME, customBaseUrl = process.env.ES_AZURE_BASE_URL } = options ?? {};
6
+ const baseUrl = customBaseUrl ?? `https://${storageAccountName}.blob.core.windows.net`;
7
7
  const blobServiceClient = new BlobServiceClient(`${baseUrl}?${sasToken}`);
8
8
  const containerClient = blobServiceClient.getContainerClient(containerName ?? '');
9
9
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgestore/server",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Upload files with ease from React/Next.js",
5
5
  "homepage": "https://edgestore.dev",
6
6
  "repository": "https://github.com/edgestorejs/edgestore.git",
@@ -84,7 +84,7 @@
84
84
  },
85
85
  "license": "MIT",
86
86
  "dependencies": {
87
- "@edgestore/shared": "0.2.1",
87
+ "@edgestore/shared": "0.2.2",
88
88
  "@panva/hkdf": "^1.0.4",
89
89
  "cookie": "^0.5.0",
90
90
  "jose": "^4.13.1",
@@ -123,5 +123,5 @@
123
123
  "typescript": "^5.1.6",
124
124
  "zod": "3.21.4"
125
125
  },
126
- "gitHead": "821e2f3e366a83a75aa7b84d4750e6d3e32c992d"
126
+ "gitHead": "bd03bcad0f78780b171bb809e34e4b1b2f11ab3c"
127
127
  }
@@ -2,6 +2,19 @@ import { BlobServiceClient } from '@azure/storage-blob';
2
2
  import { type Provider } from '@edgestore/shared';
3
3
  import { v4 as uuidv4 } from 'uuid';
4
4
 
5
+ /**
6
+ * Options for the Azure provider. Compatible with Azure Blob Storage and Azurite.
7
+ * Use Azure Storage Explorer for local development with Azurite.
8
+ * @see https://azure.microsoft.com/de-de/products/storage/storage-explorer
9
+ * @category Providers
10
+ * @example
11
+ * AzureProvider({
12
+ * storageAccountName: 'devstoreaccount1',
13
+ * sasToken: 'some-generated-token-from-azure-storage-explorer',
14
+ * containerName: 'some-container-name',
15
+ * customBaseUrl: 'http://localhost:10000/devstoreaccount1',
16
+ * })
17
+ */
5
18
  export type AzureProviderOptions = {
6
19
  /**
7
20
  * The storage account name for Azure Blob Storage
@@ -18,6 +31,12 @@ export type AzureProviderOptions = {
18
31
  * Can also be set via the `ES_AZURE_CONTAINER_NAME` environment variable.
19
32
  */
20
33
  containerName?: string;
34
+ /**
35
+ * Optional base URL for the Azure Blob Storage.
36
+ * Useful for local development with Azurite. For example: `http://localhost:10000/devstoreaccount1`
37
+ * Can also be set via the `ES_AZURE_BASE_URL` environment variable.
38
+ */
39
+ customBaseUrl?: string;
21
40
  };
22
41
 
23
42
  export function AzureProvider(options?: AzureProviderOptions): Provider {
@@ -25,9 +44,11 @@ export function AzureProvider(options?: AzureProviderOptions): Provider {
25
44
  storageAccountName = process.env.ES_AZURE_ACCOUNT_NAME,
26
45
  sasToken = process.env.ES_AZURE_SAS_TOKEN,
27
46
  containerName = process.env.ES_AZURE_CONTAINER_NAME,
47
+ customBaseUrl = process.env.ES_AZURE_BASE_URL,
28
48
  } = options ?? {};
29
49
 
30
- const baseUrl = `https://${storageAccountName}.blob.core.windows.net`;
50
+ const baseUrl =
51
+ customBaseUrl ?? `https://${storageAccountName}.blob.core.windows.net`;
31
52
  const blobServiceClient = new BlobServiceClient(`${baseUrl}?${sasToken}`);
32
53
  const containerClient = blobServiceClient.getContainerClient(
33
54
  containerName ?? '',