@payloadcms/storage-azure 3.0.0-beta.13 → 3.0.0-beta.130
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/LICENSE.md +17 -17
- package/README.md +51 -1
- package/dist/generateURL.js.map +1 -1
- package/dist/handleDelete.d.ts +1 -1
- package/dist/handleDelete.d.ts.map +1 -1
- package/dist/handleDelete.js.map +1 -1
- package/dist/handleUpload.d.ts +1 -1
- package/dist/handleUpload.d.ts.map +1 -1
- package/dist/handleUpload.js.map +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/dist/staticHandler.d.ts +1 -1
- package/dist/staticHandler.d.ts.map +1 -1
- package/dist/staticHandler.js +0 -1
- package/dist/staticHandler.js.map +1 -1
- package/dist/utils/getRangeFromHeader.d.ts.map +1 -1
- package/dist/utils/getRangeFromHeader.js.map +1 -1
- package/dist/utils/getStorageClient.d.ts +4 -0
- package/dist/utils/getStorageClient.d.ts.map +1 -0
- package/dist/utils/getStorageClient.js +13 -0
- package/dist/utils/getStorageClient.js.map +1 -0
- package/package.json +27 -18
package/LICENSE.md
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2018-
|
|
4
|
-
Portions Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
Copyright (c) 2018-2024 Payload CMS, Inc. <info@payloadcms.com>
|
|
5
4
|
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
-
of this software and associated documentation files (the
|
|
8
|
-
in the Software without restriction, including
|
|
9
|
-
to use, copy, modify, merge, publish,
|
|
10
|
-
copies of the Software, and to
|
|
11
|
-
furnished to do so, subject to
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
12
|
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
copies or substantial portions of the Software.
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
15
|
|
|
16
|
-
THE SOFTWARE IS PROVIDED
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
|
|
22
|
-
SOFTWARE.
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1 +1,51 @@
|
|
|
1
|
-
# Azure Storage
|
|
1
|
+
# Azure Blob Storage for Payload
|
|
2
|
+
|
|
3
|
+
This package provides a simple way to use [Azure Blob Storage](https://azure.microsoft.com/en-us/products/storage/blobs) with Payload.
|
|
4
|
+
|
|
5
|
+
**NOTE:** This package removes the need to use `@payloadcms/plugin-cloud-storage` as was needed in Payload 2.x.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @payloadcms/storage-azure
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
- Configure the `collections` object to specify which collections should use the Azure Blob Storage adapter. The slug _must_ match one of your existing collection slugs.
|
|
16
|
+
- When enabled, this package will automatically set `disableLocalStorage` to `true` for each collection.
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { azureStorage } from '@payloadcms/storage-azure'
|
|
20
|
+
import { Media } from './collections/Media'
|
|
21
|
+
import { MediaWithPrefix } from './collections/MediaWithPrefix'
|
|
22
|
+
|
|
23
|
+
export default buildConfig({
|
|
24
|
+
collections: [Media, MediaWithPrefix],
|
|
25
|
+
plugins: [
|
|
26
|
+
azureStorage({
|
|
27
|
+
collections: {
|
|
28
|
+
[mediaSlug]: true,
|
|
29
|
+
[mediaWithPrefixSlug]: {
|
|
30
|
+
prefix,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
allowContainerCreate: process.env.AZURE_STORAGE_ALLOW_CONTAINER_CREATE === 'true',
|
|
34
|
+
baseURL: process.env.AZURE_STORAGE_ACCOUNT_BASEURL,
|
|
35
|
+
connectionString: process.env.AZURE_STORAGE_CONNECTION_STRING,
|
|
36
|
+
containerName: process.env.AZURE_STORAGE_CONTAINER_NAME,
|
|
37
|
+
}),
|
|
38
|
+
],
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Configuration Options
|
|
43
|
+
|
|
44
|
+
| Option | Description | Default |
|
|
45
|
+
| ---------------------- | ------------------------------------------------------------------------ | ------- |
|
|
46
|
+
| `enabled` | Whether or not to enable the plugin | `true` |
|
|
47
|
+
| `collections` | Collections to apply the Azure Blob adapter to | |
|
|
48
|
+
| `allowContainerCreate` | Whether or not to allow the container to be created if it does not exist | `false` |
|
|
49
|
+
| `baseURL` | Base URL for the Azure Blob storage account | |
|
|
50
|
+
| `connectionString` | Azure Blob storage connection string | |
|
|
51
|
+
| `containerName` | Azure Blob storage container name | |
|
package/dist/generateURL.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generateURL.ts"],"sourcesContent":["import type { GenerateURL } from '@payloadcms/plugin-cloud-storage/types'\n\nimport path from 'path'\n\ninterface Args {\n baseURL: string\n containerName: string\n}\n\nexport const getGenerateURL =\n ({ baseURL, containerName }: Args): GenerateURL =>\n ({ filename, prefix = '' }) => {\n return `${baseURL}/${containerName}/${path.posix.join(prefix, filename)}`\n }\n"],"names":["path","getGenerateURL","baseURL","containerName","filename","prefix","posix","join"],"
|
|
1
|
+
{"version":3,"sources":["../src/generateURL.ts"],"sourcesContent":["import type { GenerateURL } from '@payloadcms/plugin-cloud-storage/types'\n\nimport path from 'path'\n\ninterface Args {\n baseURL: string\n containerName: string\n}\n\nexport const getGenerateURL =\n ({ baseURL, containerName }: Args): GenerateURL =>\n ({ filename, prefix = '' }) => {\n return `${baseURL}/${containerName}/${path.posix.join(prefix, filename)}`\n }\n"],"names":["path","getGenerateURL","baseURL","containerName","filename","prefix","posix","join"],"mappings":"AAEA,OAAOA,UAAU,OAAM;AAOvB,OAAO,MAAMC,iBACX,CAAC,EAAEC,OAAO,EAAEC,aAAa,EAAQ,GACjC,CAAC,EAAEC,QAAQ,EAAEC,SAAS,EAAE,EAAE;QACxB,OAAO,CAAC,EAAEH,QAAQ,CAAC,EAAEC,cAAc,CAAC,EAAEH,KAAKM,KAAK,CAACC,IAAI,CAACF,QAAQD,UAAU,CAAC;IAC3E,EAAC"}
|
package/dist/handleDelete.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ContainerClient } from '@azure/storage-blob';
|
|
2
2
|
import type { HandleDelete } from '@payloadcms/plugin-cloud-storage/types';
|
|
3
|
-
import type { CollectionConfig } from 'payload
|
|
3
|
+
import type { CollectionConfig } from 'payload';
|
|
4
4
|
interface Args {
|
|
5
5
|
collection: CollectionConfig;
|
|
6
6
|
getStorageClient: () => ContainerClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleDelete.d.ts","sourceRoot":"","sources":["../src/handleDelete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"handleDelete.d.ts","sourceRoot":"","sources":["../src/handleDelete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAI/C,UAAU,IAAI;IACZ,UAAU,EAAE,gBAAgB,CAAA;IAC5B,gBAAgB,EAAE,MAAM,eAAe,CAAA;CACxC;AAED,eAAO,MAAM,eAAe,yBAA0B,IAAI,KAAG,YAK5D,CAAA"}
|
package/dist/handleDelete.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/handleDelete.ts"],"sourcesContent":["import type { ContainerClient } from '@azure/storage-blob'\nimport type { HandleDelete } from '@payloadcms/plugin-cloud-storage/types'\nimport type { CollectionConfig } from 'payload
|
|
1
|
+
{"version":3,"sources":["../src/handleDelete.ts"],"sourcesContent":["import type { ContainerClient } from '@azure/storage-blob'\nimport type { HandleDelete } from '@payloadcms/plugin-cloud-storage/types'\nimport type { CollectionConfig } from 'payload'\n\nimport path from 'path'\n\ninterface Args {\n collection: CollectionConfig\n getStorageClient: () => ContainerClient\n}\n\nexport const getHandleDelete = ({ getStorageClient }: Args): HandleDelete => {\n return async ({ doc: { prefix = '' }, filename }) => {\n const blockBlobClient = getStorageClient().getBlockBlobClient(path.posix.join(prefix, filename))\n await blockBlobClient.deleteIfExists()\n }\n}\n"],"names":["path","getHandleDelete","getStorageClient","doc","prefix","filename","blockBlobClient","getBlockBlobClient","posix","join","deleteIfExists"],"mappings":"AAIA,OAAOA,UAAU,OAAM;AAOvB,OAAO,MAAMC,kBAAkB,CAAC,EAAEC,gBAAgB,EAAQ;IACxD,OAAO,OAAO,EAAEC,KAAK,EAAEC,SAAS,EAAE,EAAE,EAAEC,QAAQ,EAAE;QAC9C,MAAMC,kBAAkBJ,mBAAmBK,kBAAkB,CAACP,KAAKQ,KAAK,CAACC,IAAI,CAACL,QAAQC;QACtF,MAAMC,gBAAgBI,cAAc;IACtC;AACF,EAAC"}
|
package/dist/handleUpload.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ContainerClient } from '@azure/storage-blob';
|
|
2
2
|
import type { HandleUpload } from '@payloadcms/plugin-cloud-storage/types';
|
|
3
|
-
import type { CollectionConfig } from 'payload
|
|
3
|
+
import type { CollectionConfig } from 'payload';
|
|
4
4
|
interface Args {
|
|
5
5
|
collection: CollectionConfig;
|
|
6
6
|
getStorageClient: () => ContainerClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleUpload.d.ts","sourceRoot":"","sources":["../src/handleUpload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"handleUpload.d.ts","sourceRoot":"","sources":["../src/handleUpload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAO/C,UAAU,IAAI;IACZ,UAAU,EAAE,gBAAgB,CAAA;IAC5B,gBAAgB,EAAE,MAAM,eAAe,CAAA;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAGD,eAAO,MAAM,eAAe,iCAAuC,IAAI,KAAG,YAyBzE,CAAA"}
|
package/dist/handleUpload.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/handleUpload.ts"],"sourcesContent":["import type { ContainerClient } from '@azure/storage-blob'\nimport type { HandleUpload } from '@payloadcms/plugin-cloud-storage/types'\nimport type { CollectionConfig } from 'payload
|
|
1
|
+
{"version":3,"sources":["../src/handleUpload.ts"],"sourcesContent":["import type { ContainerClient } from '@azure/storage-blob'\nimport type { HandleUpload } from '@payloadcms/plugin-cloud-storage/types'\nimport type { CollectionConfig } from 'payload'\n\nimport { AbortController } from '@azure/abort-controller'\nimport fs from 'fs'\nimport path from 'path'\nimport { Readable } from 'stream'\n\ninterface Args {\n collection: CollectionConfig\n getStorageClient: () => ContainerClient\n prefix?: string\n}\n\nconst multipartThreshold = 1024 * 1024 * 50 // 50MB\nexport const getHandleUpload = ({ getStorageClient, prefix = '' }: Args): HandleUpload => {\n return async ({ data, file }) => {\n const fileKey = path.posix.join(data.prefix || prefix, file.filename)\n\n const blockBlobClient = getStorageClient().getBlockBlobClient(fileKey)\n\n // when there are no temp files, or the upload is less than the threshold size, do not stream files\n if (!file.tempFilePath && file.buffer.length > 0 && file.buffer.length < multipartThreshold) {\n await blockBlobClient.upload(file.buffer, file.buffer.byteLength, {\n blobHTTPHeaders: { blobContentType: file.mimeType },\n })\n\n return data\n }\n\n const fileBufferOrStream: Readable = file.tempFilePath\n ? fs.createReadStream(file.tempFilePath)\n : Readable.from(file.buffer)\n\n await blockBlobClient.uploadStream(fileBufferOrStream, 4 * 1024 * 1024, 4, {\n abortSignal: AbortController.timeout(30 * 60 * 1000),\n })\n\n return data\n }\n}\n"],"names":["AbortController","fs","path","Readable","multipartThreshold","getHandleUpload","getStorageClient","prefix","data","file","fileKey","posix","join","filename","blockBlobClient","getBlockBlobClient","tempFilePath","buffer","length","upload","byteLength","blobHTTPHeaders","blobContentType","mimeType","fileBufferOrStream","createReadStream","from","uploadStream","abortSignal","timeout"],"mappings":"AAIA,SAASA,eAAe,QAAQ,0BAAyB;AACzD,OAAOC,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,SAASC,QAAQ,QAAQ,SAAQ;AAQjC,MAAMC,qBAAqB,OAAO,OAAO,GAAG,OAAO;;AACnD,OAAO,MAAMC,kBAAkB,CAAC,EAAEC,gBAAgB,EAAEC,SAAS,EAAE,EAAQ;IACrE,OAAO,OAAO,EAAEC,IAAI,EAAEC,IAAI,EAAE;QAC1B,MAAMC,UAAUR,KAAKS,KAAK,CAACC,IAAI,CAACJ,KAAKD,MAAM,IAAIA,QAAQE,KAAKI,QAAQ;QAEpE,MAAMC,kBAAkBR,mBAAmBS,kBAAkB,CAACL;QAE9D,mGAAmG;QACnG,IAAI,CAACD,KAAKO,YAAY,IAAIP,KAAKQ,MAAM,CAACC,MAAM,GAAG,KAAKT,KAAKQ,MAAM,CAACC,MAAM,GAAGd,oBAAoB;YAC3F,MAAMU,gBAAgBK,MAAM,CAACV,KAAKQ,MAAM,EAAER,KAAKQ,MAAM,CAACG,UAAU,EAAE;gBAChEC,iBAAiB;oBAAEC,iBAAiBb,KAAKc,QAAQ;gBAAC;YACpD;YAEA,OAAOf;QACT;QAEA,MAAMgB,qBAA+Bf,KAAKO,YAAY,GAClDf,GAAGwB,gBAAgB,CAAChB,KAAKO,YAAY,IACrCb,SAASuB,IAAI,CAACjB,KAAKQ,MAAM;QAE7B,MAAMH,gBAAgBa,YAAY,CAACH,oBAAoB,IAAI,OAAO,MAAM,GAAG;YACzEI,aAAa5B,gBAAgB6B,OAAO,CAAC,KAAK,KAAK;QACjD;QAEA,OAAOrB;IACT;AACF,EAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import type { CollectionOptions } from '@payloadcms/plugin-cloud-storage/types';
|
|
2
|
-
import type { Plugin } from 'payload
|
|
2
|
+
import type { Plugin } from 'payload';
|
|
3
|
+
import { getStorageClient as getStorageClientFunc } from './utils/getStorageClient.js';
|
|
3
4
|
export type AzureStorageOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* Whether or not to allow the container to be created if it does not exist
|
|
7
|
+
*
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
4
10
|
allowContainerCreate: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Base URL for the Azure Blob storage account
|
|
13
|
+
*/
|
|
5
14
|
baseURL: string;
|
|
6
15
|
/**
|
|
7
16
|
* Collection options to apply the Azure Blob adapter to.
|
|
@@ -24,5 +33,5 @@ export type AzureStorageOptions = {
|
|
|
24
33
|
};
|
|
25
34
|
type AzureStoragePlugin = (azureStorageArgs: AzureStorageOptions) => Plugin;
|
|
26
35
|
export declare const azureStorage: AzureStoragePlugin;
|
|
27
|
-
export {};
|
|
36
|
+
export { getStorageClientFunc as getStorageClient };
|
|
28
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,iBAAiB,EAElB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,SAAS,CAAA;AAQ7C,OAAO,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAEtF,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;OAIG;IACH,oBAAoB,EAAE,OAAO,CAAA;IAE7B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,CAAA;IAEtE;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IAErB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,kBAAkB,GAAG,CAAC,gBAAgB,EAAE,mBAAmB,KAAK,MAAM,CAAA;AAE3E,eAAO,MAAM,YAAY,EAAE,kBA4CxB,CAAA;AAgCH,OAAO,EAAE,oBAAoB,IAAI,gBAAgB,EAAE,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { cloudStorage } from '@payloadcms/plugin-cloud-storage';
|
|
1
|
+
import { cloudStoragePlugin } from '@payloadcms/plugin-cloud-storage';
|
|
3
2
|
import { getGenerateURL } from './generateURL.js';
|
|
4
3
|
import { getHandleDelete } from './handleDelete.js';
|
|
5
4
|
import { getHandleUpload } from './handleUpload.js';
|
|
6
5
|
import { getHandler } from './staticHandler.js';
|
|
6
|
+
import { getStorageClient as getStorageClientFunc } from './utils/getStorageClient.js';
|
|
7
7
|
export const azureStorage = (azureStorageOptions)=>(incomingConfig)=>{
|
|
8
8
|
if (azureStorageOptions.enabled === false) {
|
|
9
9
|
return incomingConfig;
|
|
@@ -33,25 +33,26 @@ export const azureStorage = (azureStorageOptions)=>(incomingConfig)=>{
|
|
|
33
33
|
};
|
|
34
34
|
})
|
|
35
35
|
};
|
|
36
|
-
return
|
|
36
|
+
return cloudStoragePlugin({
|
|
37
37
|
collections: collectionsWithAdapter
|
|
38
38
|
})(config);
|
|
39
39
|
};
|
|
40
40
|
function azureStorageInternal({ allowContainerCreate, baseURL, connectionString, containerName }) {
|
|
41
|
-
let storageClient = null;
|
|
42
|
-
const getStorageClient = ()=>{
|
|
43
|
-
if (storageClient) return storageClient;
|
|
44
|
-
const blobServiceClient = BlobServiceClient.fromConnectionString(connectionString);
|
|
45
|
-
storageClient = blobServiceClient.getContainerClient(containerName);
|
|
46
|
-
return storageClient;
|
|
47
|
-
};
|
|
48
41
|
const createContainerIfNotExists = ()=>{
|
|
49
|
-
void
|
|
42
|
+
void getStorageClientFunc({
|
|
43
|
+
connectionString,
|
|
44
|
+
containerName
|
|
45
|
+
}).createIfNotExists({
|
|
50
46
|
access: 'blob'
|
|
51
47
|
});
|
|
52
48
|
};
|
|
49
|
+
const getStorageClient = ()=>getStorageClientFunc({
|
|
50
|
+
connectionString,
|
|
51
|
+
containerName
|
|
52
|
+
});
|
|
53
53
|
return ({ collection, prefix })=>{
|
|
54
54
|
return {
|
|
55
|
+
name: 'azure',
|
|
55
56
|
generateURL: getGenerateURL({
|
|
56
57
|
baseURL,
|
|
57
58
|
containerName
|
|
@@ -75,5 +76,6 @@ function azureStorageInternal({ allowContainerCreate, baseURL, connectionString,
|
|
|
75
76
|
};
|
|
76
77
|
};
|
|
77
78
|
}
|
|
79
|
+
export { getStorageClientFunc as getStorageClient };
|
|
78
80
|
|
|
79
81
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {\n Adapter,\n PluginOptions as CloudStoragePluginOptions,\n CollectionOptions,\n GeneratedAdapter,\n} from '@payloadcms/plugin-cloud-storage/types'\nimport type { Config, Plugin } from 'payload'\n\nimport { cloudStoragePlugin } from '@payloadcms/plugin-cloud-storage'\n\nimport { getGenerateURL } from './generateURL.js'\nimport { getHandleDelete } from './handleDelete.js'\nimport { getHandleUpload } from './handleUpload.js'\nimport { getHandler } from './staticHandler.js'\nimport { getStorageClient as getStorageClientFunc } from './utils/getStorageClient.js'\n\nexport type AzureStorageOptions = {\n /**\n * Whether or not to allow the container to be created if it does not exist\n *\n * @default false\n */\n allowContainerCreate: boolean\n\n /**\n * Base URL for the Azure Blob storage account\n */\n baseURL: string\n\n /**\n * Collection options to apply the Azure Blob adapter to.\n */\n collections: Record<string, Omit<CollectionOptions, 'adapter'> | true>\n\n /**\n * Azure Blob storage connection string\n */\n connectionString: string\n\n /**\n * Azure Blob storage container name\n */\n containerName: string\n\n /**\n * Whether or not to enable the plugin\n *\n * Default: true\n */\n enabled?: boolean\n}\n\ntype AzureStoragePlugin = (azureStorageArgs: AzureStorageOptions) => Plugin\n\nexport const azureStorage: AzureStoragePlugin =\n (azureStorageOptions: AzureStorageOptions) =>\n (incomingConfig: Config): Config => {\n if (azureStorageOptions.enabled === false) {\n return incomingConfig\n }\n\n const adapter = azureStorageInternal(azureStorageOptions)\n\n // Add adapter to each collection option object\n const collectionsWithAdapter: CloudStoragePluginOptions['collections'] = Object.entries(\n azureStorageOptions.collections,\n ).reduce(\n (acc, [slug, collOptions]) => ({\n ...acc,\n [slug]: {\n ...(collOptions === true ? {} : collOptions),\n adapter,\n },\n }),\n {} as Record<string, CollectionOptions>,\n )\n\n // Set disableLocalStorage: true for collections specified in the plugin options\n const config = {\n ...incomingConfig,\n collections: (incomingConfig.collections || []).map((collection) => {\n if (!collectionsWithAdapter[collection.slug]) {\n return collection\n }\n\n return {\n ...collection,\n upload: {\n ...(typeof collection.upload === 'object' ? collection.upload : {}),\n disableLocalStorage: true,\n },\n }\n }),\n }\n\n return cloudStoragePlugin({\n collections: collectionsWithAdapter,\n })(config)\n }\n\nfunction azureStorageInternal({\n allowContainerCreate,\n baseURL,\n connectionString,\n containerName,\n}: AzureStorageOptions): Adapter {\n const createContainerIfNotExists = () => {\n void getStorageClientFunc({ connectionString, containerName }).createIfNotExists({\n access: 'blob',\n })\n }\n\n const getStorageClient = () => getStorageClientFunc({ connectionString, containerName })\n\n return ({ collection, prefix }): GeneratedAdapter => {\n return {\n name: 'azure',\n generateURL: getGenerateURL({ baseURL, containerName }),\n handleDelete: getHandleDelete({ collection, getStorageClient }),\n handleUpload: getHandleUpload({\n collection,\n getStorageClient,\n prefix,\n }),\n staticHandler: getHandler({ collection, getStorageClient }),\n ...(allowContainerCreate && { onInit: createContainerIfNotExists }),\n }\n }\n}\n\nexport { getStorageClientFunc as getStorageClient }\n"],"names":["cloudStoragePlugin","getGenerateURL","getHandleDelete","getHandleUpload","getHandler","getStorageClient","getStorageClientFunc","azureStorage","azureStorageOptions","incomingConfig","enabled","adapter","azureStorageInternal","collectionsWithAdapter","Object","entries","collections","reduce","acc","slug","collOptions","config","map","collection","upload","disableLocalStorage","allowContainerCreate","baseURL","connectionString","containerName","createContainerIfNotExists","createIfNotExists","access","prefix","name","generateURL","handleDelete","handleUpload","staticHandler","onInit"],"mappings":"AAQA,SAASA,kBAAkB,QAAQ,mCAAkC;AAErE,SAASC,cAAc,QAAQ,mBAAkB;AACjD,SAASC,eAAe,QAAQ,oBAAmB;AACnD,SAASC,eAAe,QAAQ,oBAAmB;AACnD,SAASC,UAAU,QAAQ,qBAAoB;AAC/C,SAASC,oBAAoBC,oBAAoB,QAAQ,8BAA6B;AAwCtF,OAAO,MAAMC,eACX,CAACC,sBACD,CAACC;QACC,IAAID,oBAAoBE,OAAO,KAAK,OAAO;YACzC,OAAOD;QACT;QAEA,MAAME,UAAUC,qBAAqBJ;QAErC,+CAA+C;QAC/C,MAAMK,yBAAmEC,OAAOC,OAAO,CACrFP,oBAAoBQ,WAAW,EAC/BC,MAAM,CACN,CAACC,KAAK,CAACC,MAAMC,YAAY,GAAM,CAAA;gBAC7B,GAAGF,GAAG;gBACN,CAACC,KAAK,EAAE;oBACN,GAAIC,gBAAgB,OAAO,CAAC,IAAIA,WAAW;oBAC3CT;gBACF;YACF,CAAA,GACA,CAAC;QAGH,gFAAgF;QAChF,MAAMU,SAAS;YACb,GAAGZ,cAAc;YACjBO,aAAa,AAACP,CAAAA,eAAeO,WAAW,IAAI,EAAE,AAAD,EAAGM,GAAG,CAAC,CAACC;gBACnD,IAAI,CAACV,sBAAsB,CAACU,WAAWJ,IAAI,CAAC,EAAE;oBAC5C,OAAOI;gBACT;gBAEA,OAAO;oBACL,GAAGA,UAAU;oBACbC,QAAQ;wBACN,GAAI,OAAOD,WAAWC,MAAM,KAAK,WAAWD,WAAWC,MAAM,GAAG,CAAC,CAAC;wBAClEC,qBAAqB;oBACvB;gBACF;YACF;QACF;QAEA,OAAOzB,mBAAmB;YACxBgB,aAAaH;QACf,GAAGQ;IACL,EAAC;AAEH,SAAST,qBAAqB,EAC5Bc,oBAAoB,EACpBC,OAAO,EACPC,gBAAgB,EAChBC,aAAa,EACO;IACpB,MAAMC,6BAA6B;QACjC,KAAKxB,qBAAqB;YAAEsB;YAAkBC;QAAc,GAAGE,iBAAiB,CAAC;YAC/EC,QAAQ;QACV;IACF;IAEA,MAAM3B,mBAAmB,IAAMC,qBAAqB;YAAEsB;YAAkBC;QAAc;IAEtF,OAAO,CAAC,EAAEN,UAAU,EAAEU,MAAM,EAAE;QAC5B,OAAO;YACLC,MAAM;YACNC,aAAalC,eAAe;gBAAE0B;gBAASE;YAAc;YACrDO,cAAclC,gBAAgB;gBAAEqB;gBAAYlB;YAAiB;YAC7DgC,cAAclC,gBAAgB;gBAC5BoB;gBACAlB;gBACA4B;YACF;YACAK,eAAelC,WAAW;gBAAEmB;gBAAYlB;YAAiB;YACzD,GAAIqB,wBAAwB;gBAAEa,QAAQT;YAA2B,CAAC;QACpE;IACF;AACF;AAEA,SAASxB,wBAAwBD,gBAAgB,GAAE"}
|
package/dist/staticHandler.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ContainerClient } from '@azure/storage-blob';
|
|
2
2
|
import type { StaticHandler } from '@payloadcms/plugin-cloud-storage/types';
|
|
3
|
-
import type { CollectionConfig } from 'payload
|
|
3
|
+
import type { CollectionConfig } from 'payload';
|
|
4
4
|
interface Args {
|
|
5
5
|
collection: CollectionConfig;
|
|
6
6
|
getStorageClient: () => ContainerClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticHandler.d.ts","sourceRoot":"","sources":["../src/staticHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"staticHandler.d.ts","sourceRoot":"","sources":["../src/staticHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAO/C,UAAU,IAAI;IACZ,UAAU,EAAE,gBAAgB,CAAA;IAC5B,gBAAgB,EAAE,MAAM,eAAe,CAAA;CACxC;AAED,eAAO,MAAM,UAAU,qCAAsC,IAAI,KAAG,aA8CnE,CAAA"}
|
package/dist/staticHandler.js
CHANGED
|
@@ -12,7 +12,6 @@ export const getHandler = ({ collection, getStorageClient })=>{
|
|
|
12
12
|
const blockBlobClient = getStorageClient().getBlockBlobClient(path.posix.join(prefix, filename));
|
|
13
13
|
const { end, start } = await getRangeFromHeader(blockBlobClient, String(req.headers.get('range')));
|
|
14
14
|
const blob = await blockBlobClient.download(start, end);
|
|
15
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
16
15
|
const response = blob._response;
|
|
17
16
|
// Manually create a ReadableStream for the web from a Node.js stream.
|
|
18
17
|
const readableStream = new ReadableStream({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/staticHandler.ts"],"sourcesContent":["import type { ContainerClient } from '@azure/storage-blob'\nimport type { StaticHandler } from '@payloadcms/plugin-cloud-storage/types'\nimport type { CollectionConfig } from 'payload
|
|
1
|
+
{"version":3,"sources":["../src/staticHandler.ts"],"sourcesContent":["import type { ContainerClient } from '@azure/storage-blob'\nimport type { StaticHandler } from '@payloadcms/plugin-cloud-storage/types'\nimport type { CollectionConfig } from 'payload'\n\nimport { getFilePrefix } from '@payloadcms/plugin-cloud-storage/utilities'\nimport path from 'path'\n\nimport { getRangeFromHeader } from './utils/getRangeFromHeader.js'\n\ninterface Args {\n collection: CollectionConfig\n getStorageClient: () => ContainerClient\n}\n\nexport const getHandler = ({ collection, getStorageClient }: Args): StaticHandler => {\n return async (req, { params: { filename } }) => {\n try {\n const prefix = await getFilePrefix({ collection, filename, req })\n const blockBlobClient = getStorageClient().getBlockBlobClient(\n path.posix.join(prefix, filename),\n )\n\n const { end, start } = await getRangeFromHeader(\n blockBlobClient,\n String(req.headers.get('range')),\n )\n\n const blob = await blockBlobClient.download(start, end)\n\n const response = blob._response\n\n // Manually create a ReadableStream for the web from a Node.js stream.\n const readableStream = new ReadableStream({\n start(controller) {\n const nodeStream = blob.readableStreamBody\n if (!nodeStream) {\n throw new Error('No readable stream body')\n }\n\n nodeStream.on('data', (chunk) => {\n controller.enqueue(new Uint8Array(chunk))\n })\n nodeStream.on('end', () => {\n controller.close()\n })\n nodeStream.on('error', (err) => {\n controller.error(err)\n })\n },\n })\n\n return new Response(readableStream, {\n headers: response.headers.rawHeaders(),\n status: response.status,\n })\n } catch (err: unknown) {\n req.payload.logger.error(err)\n return new Response('Internal Server Error', { status: 500 })\n }\n }\n}\n"],"names":["getFilePrefix","path","getRangeFromHeader","getHandler","collection","getStorageClient","req","params","filename","prefix","blockBlobClient","getBlockBlobClient","posix","join","end","start","String","headers","get","blob","download","response","_response","readableStream","ReadableStream","controller","nodeStream","readableStreamBody","Error","on","chunk","enqueue","Uint8Array","close","err","error","Response","rawHeaders","status","payload","logger"],"mappings":"AAIA,SAASA,aAAa,QAAQ,6CAA4C;AAC1E,OAAOC,UAAU,OAAM;AAEvB,SAASC,kBAAkB,QAAQ,gCAA+B;AAOlE,OAAO,MAAMC,aAAa,CAAC,EAAEC,UAAU,EAAEC,gBAAgB,EAAQ;IAC/D,OAAO,OAAOC,KAAK,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,EAAE;QACzC,IAAI;YACF,MAAMC,SAAS,MAAMT,cAAc;gBAAEI;gBAAYI;gBAAUF;YAAI;YAC/D,MAAMI,kBAAkBL,mBAAmBM,kBAAkB,CAC3DV,KAAKW,KAAK,CAACC,IAAI,CAACJ,QAAQD;YAG1B,MAAM,EAAEM,GAAG,EAAEC,KAAK,EAAE,GAAG,MAAMb,mBAC3BQ,iBACAM,OAAOV,IAAIW,OAAO,CAACC,GAAG,CAAC;YAGzB,MAAMC,OAAO,MAAMT,gBAAgBU,QAAQ,CAACL,OAAOD;YAEnD,MAAMO,WAAWF,KAAKG,SAAS;YAE/B,sEAAsE;YACtE,MAAMC,iBAAiB,IAAIC,eAAe;gBACxCT,OAAMU,UAAU;oBACd,MAAMC,aAAaP,KAAKQ,kBAAkB;oBAC1C,IAAI,CAACD,YAAY;wBACf,MAAM,IAAIE,MAAM;oBAClB;oBAEAF,WAAWG,EAAE,CAAC,QAAQ,CAACC;wBACrBL,WAAWM,OAAO,CAAC,IAAIC,WAAWF;oBACpC;oBACAJ,WAAWG,EAAE,CAAC,OAAO;wBACnBJ,WAAWQ,KAAK;oBAClB;oBACAP,WAAWG,EAAE,CAAC,SAAS,CAACK;wBACtBT,WAAWU,KAAK,CAACD;oBACnB;gBACF;YACF;YAEA,OAAO,IAAIE,SAASb,gBAAgB;gBAClCN,SAASI,SAASJ,OAAO,CAACoB,UAAU;gBACpCC,QAAQjB,SAASiB,MAAM;YACzB;QACF,EAAE,OAAOJ,KAAc;YACrB5B,IAAIiC,OAAO,CAACC,MAAM,CAACL,KAAK,CAACD;YACzB,OAAO,IAAIE,SAAS,yBAAyB;gBAAEE,QAAQ;YAAI;QAC7D;IACF;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRangeFromHeader.d.ts","sourceRoot":"","sources":["../../src/utils/getRangeFromHeader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAI1D,eAAO,MAAM,kBAAkB,oBACZ,eAAe,gBAClB,MAAM,KACnB,
|
|
1
|
+
{"version":3,"file":"getRangeFromHeader.d.ts","sourceRoot":"","sources":["../../src/utils/getRangeFromHeader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAI1D,eAAO,MAAM,kBAAkB,oBACZ,eAAe,gBAClB,MAAM,KACnB,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAkBpD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/getRangeFromHeader.ts"],"sourcesContent":["import type { BlockBlobClient } from '@azure/storage-blob'\n\nimport parseRange from 'range-parser'\n\nexport const getRangeFromHeader = async (\n blockBlobClient: BlockBlobClient,\n rangeHeader?: string,\n): Promise<{ end: number | undefined; start: number }> => {\n const fullRange = { end: undefined, start: 0 }\n\n if (!rangeHeader) {\n return fullRange\n }\n\n const size = await blockBlobClient.getProperties().then((props) => props.contentLength)\n if (size === undefined) {\n return fullRange\n }\n\n const range = parseRange(size, rangeHeader)\n if (range === -1 || range === -2 || range.type !== 'bytes' || range.length !== 1) {\n return fullRange\n }\n\n return range[0]\n}\n"],"names":["parseRange","getRangeFromHeader","blockBlobClient","rangeHeader","fullRange","end","undefined","start","size","getProperties","then","props","contentLength","range","type","length"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/getRangeFromHeader.ts"],"sourcesContent":["import type { BlockBlobClient } from '@azure/storage-blob'\n\nimport parseRange from 'range-parser'\n\nexport const getRangeFromHeader = async (\n blockBlobClient: BlockBlobClient,\n rangeHeader?: string,\n): Promise<{ end: number | undefined; start: number }> => {\n const fullRange = { end: undefined, start: 0 }\n\n if (!rangeHeader) {\n return fullRange\n }\n\n const size = await blockBlobClient.getProperties().then((props) => props.contentLength)\n if (size === undefined) {\n return fullRange\n }\n\n const range = parseRange(size, rangeHeader)\n if (range === -1 || range === -2 || range.type !== 'bytes' || range.length !== 1) {\n return fullRange\n }\n\n return range[0]\n}\n"],"names":["parseRange","getRangeFromHeader","blockBlobClient","rangeHeader","fullRange","end","undefined","start","size","getProperties","then","props","contentLength","range","type","length"],"mappings":"AAEA,OAAOA,gBAAgB,eAAc;AAErC,OAAO,MAAMC,qBAAqB,OAChCC,iBACAC;IAEA,MAAMC,YAAY;QAAEC,KAAKC;QAAWC,OAAO;IAAE;IAE7C,IAAI,CAACJ,aAAa;QAChB,OAAOC;IACT;IAEA,MAAMI,OAAO,MAAMN,gBAAgBO,aAAa,GAAGC,IAAI,CAAC,CAACC,QAAUA,MAAMC,aAAa;IACtF,IAAIJ,SAASF,WAAW;QACtB,OAAOF;IACT;IAEA,MAAMS,QAAQb,WAAWQ,MAAML;IAC/B,IAAIU,UAAU,CAAC,KAAKA,UAAU,CAAC,KAAKA,MAAMC,IAAI,KAAK,WAAWD,MAAME,MAAM,KAAK,GAAG;QAChF,OAAOX;IACT;IAEA,OAAOS,KAAK,CAAC,EAAE;AACjB,EAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ContainerClient } from '@azure/storage-blob';
|
|
2
|
+
import type { AzureStorageOptions } from '../index.js';
|
|
3
|
+
export declare function getStorageClient(options: Pick<AzureStorageOptions, 'connectionString' | 'containerName'>): ContainerClient;
|
|
4
|
+
//# sourceMappingURL=getStorageClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getStorageClient.d.ts","sourceRoot":"","sources":["../../src/utils/getStorageClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAI1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAItD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,kBAAkB,GAAG,eAAe,CAAC,GACvE,eAAe,CAUjB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BlobServiceClient } from '@azure/storage-blob';
|
|
2
|
+
let storageClient = null;
|
|
3
|
+
export function getStorageClient(options) {
|
|
4
|
+
if (storageClient) {
|
|
5
|
+
return storageClient;
|
|
6
|
+
}
|
|
7
|
+
const { connectionString, containerName } = options;
|
|
8
|
+
const blobServiceClient = BlobServiceClient.fromConnectionString(connectionString);
|
|
9
|
+
storageClient = blobServiceClient.getContainerClient(containerName);
|
|
10
|
+
return storageClient;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=getStorageClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/getStorageClient.ts"],"sourcesContent":["import type { ContainerClient } from '@azure/storage-blob'\n\nimport { BlobServiceClient } from '@azure/storage-blob'\n\nimport type { AzureStorageOptions } from '../index.js'\n\nlet storageClient: ContainerClient | null = null\n\nexport function getStorageClient(\n options: Pick<AzureStorageOptions, 'connectionString' | 'containerName'>,\n): ContainerClient {\n if (storageClient) {\n return storageClient\n }\n\n const { connectionString, containerName } = options\n\n const blobServiceClient = BlobServiceClient.fromConnectionString(connectionString)\n storageClient = blobServiceClient.getContainerClient(containerName)\n return storageClient\n}\n"],"names":["BlobServiceClient","storageClient","getStorageClient","options","connectionString","containerName","blobServiceClient","fromConnectionString","getContainerClient"],"mappings":"AAEA,SAASA,iBAAiB,QAAQ,sBAAqB;AAIvD,IAAIC,gBAAwC;AAE5C,OAAO,SAASC,iBACdC,OAAwE;IAExE,IAAIF,eAAe;QACjB,OAAOA;IACT;IAEA,MAAM,EAAEG,gBAAgB,EAAEC,aAAa,EAAE,GAAGF;IAE5C,MAAMG,oBAAoBN,kBAAkBO,oBAAoB,CAACH;IACjEH,gBAAgBK,kBAAkBE,kBAAkB,CAACH;IACrD,OAAOJ;AACT"}
|
package/package.json
CHANGED
|
@@ -1,49 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/storage-azure",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.130",
|
|
4
4
|
"description": "Payload storage adapter for Azure Blob Storage",
|
|
5
|
+
"homepage": "https://payloadcms.com",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
8
|
"url": "https://github.com/payloadcms/payload.git",
|
|
8
9
|
"directory": "packages/storage-azure"
|
|
9
10
|
},
|
|
10
11
|
"license": "MIT",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
"author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
|
|
13
|
+
"maintainers": [
|
|
14
|
+
{
|
|
15
|
+
"name": "Payload",
|
|
16
|
+
"email": "info@payloadcms.com",
|
|
17
|
+
"url": "https://payloadcms.com"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
15
20
|
"type": "module",
|
|
16
21
|
"exports": {
|
|
17
22
|
".": {
|
|
18
23
|
"import": "./dist/index.js",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"default": "./dist/index.js"
|
|
21
26
|
}
|
|
22
27
|
},
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
23
33
|
"dependencies": {
|
|
24
34
|
"@azure/abort-controller": "^1.1.0",
|
|
25
35
|
"@azure/storage-blob": "^12.11.0",
|
|
26
36
|
"range-parser": "^1.2.1",
|
|
27
|
-
"@payloadcms/plugin-cloud-storage": "3.0.0-beta.
|
|
37
|
+
"@payloadcms/plugin-cloud-storage": "3.0.0-beta.130"
|
|
28
38
|
},
|
|
29
39
|
"devDependencies": {
|
|
30
40
|
"@types/range-parser": "^1.2.7",
|
|
31
|
-
"payload": "3.0.0-beta.
|
|
41
|
+
"payload": "3.0.0-beta.130"
|
|
32
42
|
},
|
|
33
43
|
"peerDependencies": {
|
|
34
|
-
"payload": "3.0.0-beta.
|
|
44
|
+
"payload": "3.0.0-beta.130"
|
|
35
45
|
},
|
|
36
46
|
"engines": {
|
|
37
|
-
"node": "
|
|
47
|
+
"node": "^18.20.2 || >=20.9.0"
|
|
38
48
|
},
|
|
39
|
-
"files": [
|
|
40
|
-
"dist"
|
|
41
|
-
],
|
|
42
49
|
"scripts": {
|
|
43
|
-
"build": "pnpm build:
|
|
44
|
-
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
|
|
45
|
-
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
50
|
+
"build": "pnpm build:types && pnpm build:swc",
|
|
46
51
|
"build:clean": "find . \\( -type d \\( -name build -o -name dist -o -name .cache \\) -o -type f -name tsconfig.tsbuildinfo \\) -exec rm -rf {} + && pnpm build",
|
|
47
|
-
"
|
|
52
|
+
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
|
|
53
|
+
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
54
|
+
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
55
|
+
"lint": "eslint .",
|
|
56
|
+
"lint:fix": "eslint . --fix"
|
|
48
57
|
}
|
|
49
58
|
}
|