@payloadcms/storage-azure 3.69.0-internal.424436e → 3.69.0
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.
|
@@ -4,6 +4,6 @@ export declare const AzureClientUploadHandler: ({ children, collectionSlug, enab
|
|
|
4
4
|
enabled?: boolean;
|
|
5
5
|
extra: Record<string, unknown>;
|
|
6
6
|
prefix?: string;
|
|
7
|
-
serverHandlerPath: string
|
|
7
|
+
serverHandlerPath: `/${string}`;
|
|
8
8
|
}) => import("react").JSX.Element;
|
|
9
9
|
//# sourceMappingURL=AzureClientUploadHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureClientUploadHandler.d.ts","sourceRoot":"","sources":["../../src/client/AzureClientUploadHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AzureClientUploadHandler.d.ts","sourceRoot":"","sources":["../../src/client/AzureClientUploadHandler.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,wBAAwB;;;;;;;aAyBxB,OAAO,aASlB,CAAA"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { createClientUploadHandler } from '@payloadcms/plugin-cloud-storage/client';
|
|
3
|
+
import { formatAdminURL } from 'payload/shared';
|
|
3
4
|
export const AzureClientUploadHandler = createClientUploadHandler({
|
|
4
5
|
handler: async ({ apiRoute, collectionSlug, file, prefix, serverHandlerPath, serverURL })=>{
|
|
5
|
-
const
|
|
6
|
+
const endpointRoute = formatAdminURL({
|
|
7
|
+
apiRoute,
|
|
8
|
+
path: serverHandlerPath,
|
|
9
|
+
serverURL
|
|
10
|
+
});
|
|
11
|
+
const response = await fetch(endpointRoute, {
|
|
6
12
|
body: JSON.stringify({
|
|
7
13
|
collectionSlug,
|
|
8
14
|
filename: file.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/AzureClientUploadHandler.ts"],"sourcesContent":["'use client'\nimport { createClientUploadHandler } from '@payloadcms/plugin-cloud-storage/client'\n\nexport const AzureClientUploadHandler = createClientUploadHandler({\n handler: async ({ apiRoute, collectionSlug, file, prefix, serverHandlerPath, serverURL }) => {\n const
|
|
1
|
+
{"version":3,"sources":["../../src/client/AzureClientUploadHandler.ts"],"sourcesContent":["'use client'\nimport { createClientUploadHandler } from '@payloadcms/plugin-cloud-storage/client'\nimport { formatAdminURL } from 'payload/shared'\n\nexport const AzureClientUploadHandler = createClientUploadHandler({\n handler: async ({ apiRoute, collectionSlug, file, prefix, serverHandlerPath, serverURL }) => {\n const endpointRoute = formatAdminURL({\n apiRoute,\n path: serverHandlerPath,\n serverURL,\n })\n const response = await fetch(endpointRoute, {\n body: JSON.stringify({\n collectionSlug,\n filename: file.name,\n mimeType: file.type,\n }),\n credentials: 'include',\n method: 'POST',\n })\n\n const { url } = (await response.json()) as {\n url: string\n }\n\n await fetch(url, {\n body: file,\n headers: {\n 'Content-Length': file.size.toString(),\n 'Content-Type': file.type,\n // Required for azure\n 'x-ms-blob-type': 'BlockBlob',\n },\n method: 'PUT',\n })\n\n return { prefix }\n },\n})\n"],"names":["createClientUploadHandler","formatAdminURL","AzureClientUploadHandler","handler","apiRoute","collectionSlug","file","prefix","serverHandlerPath","serverURL","endpointRoute","path","response","fetch","body","JSON","stringify","filename","name","mimeType","type","credentials","method","url","json","headers","size","toString"],"mappings":"AAAA;AACA,SAASA,yBAAyB,QAAQ,0CAAyC;AACnF,SAASC,cAAc,QAAQ,iBAAgB;AAE/C,OAAO,MAAMC,2BAA2BF,0BAA0B;IAChEG,SAAS,OAAO,EAAEC,QAAQ,EAAEC,cAAc,EAAEC,IAAI,EAAEC,MAAM,EAAEC,iBAAiB,EAAEC,SAAS,EAAE;QACtF,MAAMC,gBAAgBT,eAAe;YACnCG;YACAO,MAAMH;YACNC;QACF;QACA,MAAMG,WAAW,MAAMC,MAAMH,eAAe;YAC1CI,MAAMC,KAAKC,SAAS,CAAC;gBACnBX;gBACAY,UAAUX,KAAKY,IAAI;gBACnBC,UAAUb,KAAKc,IAAI;YACrB;YACAC,aAAa;YACbC,QAAQ;QACV;QAEA,MAAM,EAAEC,GAAG,EAAE,GAAI,MAAMX,SAASY,IAAI;QAIpC,MAAMX,MAAMU,KAAK;YACfT,MAAMR;YACNmB,SAAS;gBACP,kBAAkBnB,KAAKoB,IAAI,CAACC,QAAQ;gBACpC,gBAAgBrB,KAAKc,IAAI;gBACzB,qBAAqB;gBACrB,kBAAkB;YACpB;YACAE,QAAQ;QACV;QAEA,OAAO;YAAEf;QAAO;IAClB;AACF,GAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/storage-azure",
|
|
3
|
-
"version": "3.69.0
|
|
3
|
+
"version": "3.69.0",
|
|
4
4
|
"description": "Payload storage adapter for Azure Blob Storage",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"@azure/abort-controller": "^1.1.0",
|
|
41
41
|
"@azure/storage-blob": "^12.11.0",
|
|
42
42
|
"range-parser": "^1.2.1",
|
|
43
|
-
"@payloadcms/plugin-cloud-storage": "3.69.0
|
|
43
|
+
"@payloadcms/plugin-cloud-storage": "3.69.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/range-parser": "^1.2.7",
|
|
47
|
-
"payload": "3.69.0
|
|
47
|
+
"payload": "3.69.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"payload": "3.69.0
|
|
50
|
+
"payload": "3.69.0"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|
|
53
53
|
"node": "^18.20.2 || >=20.9.0"
|