@strapi/provider-upload-cloudinary 5.8.1 → 5.10.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.
- package/dist/index.js +104 -94
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +93 -85
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -7
package/dist/index.js
CHANGED
|
@@ -1,108 +1,118 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var cloudinary = require('cloudinary');
|
|
4
|
+
var intoStream = require('into-stream');
|
|
5
|
+
var utils = require('@strapi/utils');
|
|
6
|
+
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
8
|
+
var n = Object.create(null);
|
|
9
9
|
if (e) {
|
|
10
|
-
|
|
11
|
-
if (k !==
|
|
12
|
-
|
|
10
|
+
Object.keys(e).forEach(function (k) {
|
|
11
|
+
if (k !== 'default') {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
13
|
Object.defineProperty(n, k, d.get ? d : {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: ()
|
|
15
|
+
get: function () { return e[k]; }
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
}
|
|
18
|
+
});
|
|
19
19
|
}
|
|
20
20
|
n.default = e;
|
|
21
21
|
return Object.freeze(n);
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
|
|
24
|
+
var utils__namespace = /*#__PURE__*/_interopNamespaceDefault(utils);
|
|
25
|
+
|
|
26
|
+
var index = {
|
|
27
|
+
init (options) {
|
|
28
|
+
cloudinary.v2.config(options);
|
|
29
|
+
const upload = (file, customConfig = {})=>{
|
|
30
|
+
return new Promise((resolve, reject)=>{
|
|
31
|
+
const config = {
|
|
32
|
+
resource_type: 'auto',
|
|
33
|
+
public_id: file.hash
|
|
34
|
+
};
|
|
35
|
+
if (file.ext) {
|
|
36
|
+
config.filename = `${file.hash}${file.ext}`;
|
|
37
|
+
}
|
|
38
|
+
if (file.path) {
|
|
39
|
+
config.folder = file.path;
|
|
40
|
+
}
|
|
41
|
+
// For files smaller than 99 MB use regular upload as it tends to be faster
|
|
42
|
+
// and fallback to chunked upload for larger files as that's required by Cloudinary.
|
|
43
|
+
// https://support.cloudinary.com/hc/en-us/community/posts/360009586100-Upload-movie-video-with-large-size?page=1#community_comment_360002140099
|
|
44
|
+
// The Cloudinary's max limit for regular upload is actually 100 MB but add some headroom
|
|
45
|
+
// for size counting shenanigans. (Strapi provides the size in kilobytes rounded to two decimal places here).
|
|
46
|
+
const uploadMethod = file.size && file.size < 1000 * 99 ? cloudinary.v2.uploader.upload_stream : cloudinary.v2.uploader.upload_chunked_stream;
|
|
47
|
+
const uploadStream = uploadMethod({
|
|
48
|
+
...config,
|
|
49
|
+
...customConfig
|
|
50
|
+
}, (err, image)=>{
|
|
51
|
+
if (err) {
|
|
52
|
+
if (err.message.includes('File size too large')) {
|
|
53
|
+
reject(new utils__namespace.errors.PayloadTooLargeError());
|
|
54
|
+
} else {
|
|
55
|
+
reject(new Error(`Error uploading to cloudinary: ${err.message}`));
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (!image) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (image.resource_type === 'video') {
|
|
63
|
+
file.previewUrl = cloudinary.v2.url(`${image.public_id}.gif`, {
|
|
64
|
+
video_sampling: 6,
|
|
65
|
+
delay: 200,
|
|
66
|
+
width: 250,
|
|
67
|
+
crop: 'scale',
|
|
68
|
+
resource_type: 'video'
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
file.url = image.secure_url;
|
|
72
|
+
file.provider_metadata = {
|
|
73
|
+
public_id: image.public_id,
|
|
74
|
+
resource_type: image.resource_type
|
|
75
|
+
};
|
|
76
|
+
resolve();
|
|
77
|
+
});
|
|
78
|
+
if (file.stream) {
|
|
79
|
+
file.stream.pipe(uploadStream);
|
|
80
|
+
} else if (file.buffer) {
|
|
81
|
+
intoStream(file.buffer).pipe(uploadStream);
|
|
82
|
+
} else {
|
|
83
|
+
throw new Error('Missing file stream or buffer');
|
|
84
|
+
}
|
|
85
|
+
});
|
|
33
86
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
87
|
+
return {
|
|
88
|
+
uploadStream (file, customConfig = {}) {
|
|
89
|
+
return upload(file, customConfig);
|
|
90
|
+
},
|
|
91
|
+
upload (file, customConfig = {}) {
|
|
92
|
+
return upload(file, customConfig);
|
|
93
|
+
},
|
|
94
|
+
async delete (file, customConfig = {}) {
|
|
95
|
+
try {
|
|
96
|
+
const { resource_type: resourceType, public_id: publicId } = file.provider_metadata ?? {};
|
|
97
|
+
const deleteConfig = {
|
|
98
|
+
resource_type: resourceType || 'image',
|
|
99
|
+
invalidate: true,
|
|
100
|
+
...customConfig
|
|
101
|
+
};
|
|
102
|
+
const response = await cloudinary.v2.uploader.destroy(`${publicId}`, deleteConfig);
|
|
103
|
+
if (response.result !== 'ok' && response.result !== 'not found') {
|
|
104
|
+
throw new Error(response.result);
|
|
105
|
+
}
|
|
106
|
+
} catch (error) {
|
|
107
|
+
if (error instanceof Error) {
|
|
108
|
+
throw new Error(`Error deleting on cloudinary: ${error.message}`);
|
|
109
|
+
}
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
47
112
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (!image) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (image.resource_type === "video") {
|
|
54
|
-
file.previewUrl = cloudinary.v2.url(`${image.public_id}.gif`, {
|
|
55
|
-
video_sampling: 6,
|
|
56
|
-
delay: 200,
|
|
57
|
-
width: 250,
|
|
58
|
-
crop: "scale",
|
|
59
|
-
resource_type: "video"
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
file.url = image.secure_url;
|
|
63
|
-
file.provider_metadata = {
|
|
64
|
-
public_id: image.public_id,
|
|
65
|
-
resource_type: image.resource_type
|
|
66
|
-
};
|
|
67
|
-
resolve();
|
|
68
|
-
});
|
|
69
|
-
if (file.stream) {
|
|
70
|
-
file.stream.pipe(uploadStream);
|
|
71
|
-
} else if (file.buffer) {
|
|
72
|
-
intoStream__default.default(file.buffer).pipe(uploadStream);
|
|
73
|
-
} else {
|
|
74
|
-
throw new Error("Missing file stream or buffer");
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
return {
|
|
79
|
-
uploadStream(file, customConfig = {}) {
|
|
80
|
-
return upload(file, customConfig);
|
|
81
|
-
},
|
|
82
|
-
upload(file, customConfig = {}) {
|
|
83
|
-
return upload(file, customConfig);
|
|
84
|
-
},
|
|
85
|
-
async delete(file, customConfig = {}) {
|
|
86
|
-
try {
|
|
87
|
-
const { resource_type: resourceType, public_id: publicId } = file.provider_metadata ?? {};
|
|
88
|
-
const deleteConfig = {
|
|
89
|
-
resource_type: resourceType || "image",
|
|
90
|
-
invalidate: true,
|
|
91
|
-
...customConfig
|
|
92
|
-
};
|
|
93
|
-
const response = await cloudinary.v2.uploader.destroy(`${publicId}`, deleteConfig);
|
|
94
|
-
if (response.result !== "ok" && response.result !== "not found") {
|
|
95
|
-
throw new Error(response.result);
|
|
96
|
-
}
|
|
97
|
-
} catch (error) {
|
|
98
|
-
if (error instanceof Error) {
|
|
99
|
-
throw new Error(`Error deleting on cloudinary: ${error.message}`);
|
|
100
|
-
}
|
|
101
|
-
throw error;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
106
115
|
};
|
|
116
|
+
|
|
107
117
|
module.exports = index;
|
|
108
118
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import type { ReadStream } from 'node:fs';\nimport { v2 as cloudinary, ConfigOptions, UploadApiOptions } from 'cloudinary';\nimport intoStream from 'into-stream';\nimport * as utils from '@strapi/utils';\n\ninterface File {\n name: string;\n alternativeText?: string;\n caption?: string;\n width?: number;\n height?: number;\n formats?: Record<string, unknown>;\n hash: string;\n ext?: string;\n mime: string;\n size: number;\n sizeInBytes: number;\n url: string;\n previewUrl?: string;\n path?: string;\n provider?: string;\n provider_metadata?: Record<string, unknown>;\n stream?: ReadStream;\n buffer?: Buffer;\n}\n\nexport default {\n init(options: ConfigOptions) {\n cloudinary.config(options);\n\n const upload = (file: File, customConfig = {}): Promise<void> => {\n return new Promise((resolve, reject) => {\n const config: Partial<UploadApiOptions> = {\n resource_type: 'auto',\n public_id: file.hash,\n };\n\n if (file.ext) {\n config.filename = `${file.hash}${file.ext}`;\n }\n\n if (file.path) {\n config.folder = file.path;\n }\n\n // For files smaller than 99 MB use regular upload as it tends to be faster\n // and fallback to chunked upload for larger files as that's required by Cloudinary.\n // https://support.cloudinary.com/hc/en-us/community/posts/360009586100-Upload-movie-video-with-large-size?page=1#community_comment_360002140099\n // The Cloudinary's max limit for regular upload is actually 100 MB but add some headroom\n // for size counting shenanigans. (Strapi provides the size in kilobytes rounded to two decimal places here).\n const uploadMethod =\n file.size && file.size < 1000 * 99\n ? cloudinary.uploader.upload_stream\n : cloudinary.uploader.upload_chunked_stream;\n\n const uploadStream = uploadMethod({ ...config, ...customConfig }, (err, image) => {\n if (err) {\n if (err.message.includes('File size too large')) {\n reject(new utils.errors.PayloadTooLargeError());\n } else {\n reject(new Error(`Error uploading to cloudinary: ${err.message}`));\n }\n return;\n }\n\n if (!image) {\n return;\n }\n\n if (image.resource_type === 'video') {\n file.previewUrl = cloudinary.url(`${image.public_id}.gif`, {\n video_sampling: 6,\n delay: 200,\n width: 250,\n crop: 'scale',\n resource_type: 'video',\n });\n }\n\n file.url = image.secure_url;\n file.provider_metadata = {\n public_id: image.public_id,\n resource_type: image.resource_type,\n };\n\n resolve();\n });\n\n if (file.stream) {\n file.stream.pipe(uploadStream);\n } else if (file.buffer) {\n intoStream(file.buffer).pipe(uploadStream);\n } else {\n throw new Error('Missing file stream or buffer');\n }\n });\n };\n\n return {\n uploadStream(file: File, customConfig = {}) {\n return upload(file, customConfig);\n },\n upload(file: File, customConfig = {}) {\n return upload(file, customConfig);\n },\n async delete(file: File, customConfig = {}) {\n try {\n const { resource_type: resourceType, public_id: publicId } = file.provider_metadata ?? {};\n const deleteConfig = {\n resource_type: (resourceType || 'image') as string,\n invalidate: true,\n ...customConfig,\n };\n\n const response = await cloudinary.uploader.destroy(`${publicId}`, deleteConfig);\n\n if (response.result !== 'ok' && response.result !== 'not found') {\n throw new Error(response.result);\n }\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Error deleting on cloudinary: ${error.message}`);\n }\n\n throw error;\n }\n },\n };\n },\n};\n"],"names":["cloudinary","utils","intoStream"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import type { ReadStream } from 'node:fs';\nimport { v2 as cloudinary, ConfigOptions, UploadApiOptions } from 'cloudinary';\nimport intoStream from 'into-stream';\nimport * as utils from '@strapi/utils';\n\ninterface File {\n name: string;\n alternativeText?: string;\n caption?: string;\n width?: number;\n height?: number;\n formats?: Record<string, unknown>;\n hash: string;\n ext?: string;\n mime: string;\n size: number;\n sizeInBytes: number;\n url: string;\n previewUrl?: string;\n path?: string;\n provider?: string;\n provider_metadata?: Record<string, unknown>;\n stream?: ReadStream;\n buffer?: Buffer;\n}\n\nexport default {\n init(options: ConfigOptions) {\n cloudinary.config(options);\n\n const upload = (file: File, customConfig = {}): Promise<void> => {\n return new Promise((resolve, reject) => {\n const config: Partial<UploadApiOptions> = {\n resource_type: 'auto',\n public_id: file.hash,\n };\n\n if (file.ext) {\n config.filename = `${file.hash}${file.ext}`;\n }\n\n if (file.path) {\n config.folder = file.path;\n }\n\n // For files smaller than 99 MB use regular upload as it tends to be faster\n // and fallback to chunked upload for larger files as that's required by Cloudinary.\n // https://support.cloudinary.com/hc/en-us/community/posts/360009586100-Upload-movie-video-with-large-size?page=1#community_comment_360002140099\n // The Cloudinary's max limit for regular upload is actually 100 MB but add some headroom\n // for size counting shenanigans. (Strapi provides the size in kilobytes rounded to two decimal places here).\n const uploadMethod =\n file.size && file.size < 1000 * 99\n ? cloudinary.uploader.upload_stream\n : cloudinary.uploader.upload_chunked_stream;\n\n const uploadStream = uploadMethod({ ...config, ...customConfig }, (err, image) => {\n if (err) {\n if (err.message.includes('File size too large')) {\n reject(new utils.errors.PayloadTooLargeError());\n } else {\n reject(new Error(`Error uploading to cloudinary: ${err.message}`));\n }\n return;\n }\n\n if (!image) {\n return;\n }\n\n if (image.resource_type === 'video') {\n file.previewUrl = cloudinary.url(`${image.public_id}.gif`, {\n video_sampling: 6,\n delay: 200,\n width: 250,\n crop: 'scale',\n resource_type: 'video',\n });\n }\n\n file.url = image.secure_url;\n file.provider_metadata = {\n public_id: image.public_id,\n resource_type: image.resource_type,\n };\n\n resolve();\n });\n\n if (file.stream) {\n file.stream.pipe(uploadStream);\n } else if (file.buffer) {\n intoStream(file.buffer).pipe(uploadStream);\n } else {\n throw new Error('Missing file stream or buffer');\n }\n });\n };\n\n return {\n uploadStream(file: File, customConfig = {}) {\n return upload(file, customConfig);\n },\n upload(file: File, customConfig = {}) {\n return upload(file, customConfig);\n },\n async delete(file: File, customConfig = {}) {\n try {\n const { resource_type: resourceType, public_id: publicId } = file.provider_metadata ?? {};\n const deleteConfig = {\n resource_type: (resourceType || 'image') as string,\n invalidate: true,\n ...customConfig,\n };\n\n const response = await cloudinary.uploader.destroy(`${publicId}`, deleteConfig);\n\n if (response.result !== 'ok' && response.result !== 'not found') {\n throw new Error(response.result);\n }\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Error deleting on cloudinary: ${error.message}`);\n }\n\n throw error;\n }\n },\n };\n },\n};\n"],"names":["init","options","cloudinary","config","upload","file","customConfig","Promise","resolve","reject","resource_type","public_id","hash","ext","filename","path","folder","uploadMethod","size","uploader","upload_stream","upload_chunked_stream","uploadStream","err","image","message","includes","utils","errors","PayloadTooLargeError","Error","previewUrl","url","video_sampling","delay","width","crop","secure_url","provider_metadata","stream","pipe","buffer","intoStream","delete","resourceType","publicId","deleteConfig","invalidate","response","destroy","result","error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,YAAe;AACbA,IAAAA,IAAAA,CAAAA,CAAKC,OAAsB,EAAA;AACzBC,QAAAA,aAAAA,CAAWC,MAAM,CAACF,OAAAA,CAAAA;AAElB,QAAA,MAAMG,MAAS,GAAA,CAACC,IAAYC,EAAAA,YAAAA,GAAe,EAAE,GAAA;YAC3C,OAAO,IAAIC,OAAQ,CAAA,CAACC,OAASC,EAAAA,MAAAA,GAAAA;AAC3B,gBAAA,MAAMN,MAAoC,GAAA;oBACxCO,aAAe,EAAA,MAAA;AACfC,oBAAAA,SAAAA,EAAWN,KAAKO;AAClB,iBAAA;gBAEA,IAAIP,IAAAA,CAAKQ,GAAG,EAAE;oBACZV,MAAOW,CAAAA,QAAQ,GAAG,CAAC,EAAET,IAAAA,CAAKO,IAAI,CAAC,EAAEP,IAAAA,CAAKQ,GAAG,CAAC,CAAC;AAC7C;gBAEA,IAAIR,IAAAA,CAAKU,IAAI,EAAE;oBACbZ,MAAOa,CAAAA,MAAM,GAAGX,IAAAA,CAAKU,IAAI;AAC3B;;;;;;AAOA,gBAAA,MAAME,eACJZ,IAAKa,CAAAA,IAAI,IAAIb,IAAAA,CAAKa,IAAI,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IAAIpB,KAAMkB,CAAAA,QAAAA,CAASE,MAAM,CAAA;AACjC;AACF,iBAAA,CAAE,OAAOC,KAAO,EAAA;AACd,oBAAA,IAAIA,iBAAiBrB,KAAO,EAAA;wBAC1B,MAAM,IAAIA,MAAM,CAAC,8BAA8B,EAAEqB,KAAM1B,CAAAA,OAAO,CAAC,CAAC,CAAA;AAClE;oBAEA,MAAM0B,KAAAA;AACR;AACF;AACF,SAAA;AACF;AACF,CAAE;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,89 +1,97 @@
|
|
|
1
|
-
import { v2 } from
|
|
2
|
-
import intoStream from
|
|
3
|
-
import * as utils from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { v2 } from 'cloudinary';
|
|
2
|
+
import intoStream from 'into-stream';
|
|
3
|
+
import * as utils from '@strapi/utils';
|
|
4
|
+
|
|
5
|
+
var index = {
|
|
6
|
+
init (options) {
|
|
7
|
+
v2.config(options);
|
|
8
|
+
const upload = (file, customConfig = {})=>{
|
|
9
|
+
return new Promise((resolve, reject)=>{
|
|
10
|
+
const config = {
|
|
11
|
+
resource_type: 'auto',
|
|
12
|
+
public_id: file.hash
|
|
13
|
+
};
|
|
14
|
+
if (file.ext) {
|
|
15
|
+
config.filename = `${file.hash}${file.ext}`;
|
|
16
|
+
}
|
|
17
|
+
if (file.path) {
|
|
18
|
+
config.folder = file.path;
|
|
19
|
+
}
|
|
20
|
+
// For files smaller than 99 MB use regular upload as it tends to be faster
|
|
21
|
+
// and fallback to chunked upload for larger files as that's required by Cloudinary.
|
|
22
|
+
// https://support.cloudinary.com/hc/en-us/community/posts/360009586100-Upload-movie-video-with-large-size?page=1#community_comment_360002140099
|
|
23
|
+
// The Cloudinary's max limit for regular upload is actually 100 MB but add some headroom
|
|
24
|
+
// for size counting shenanigans. (Strapi provides the size in kilobytes rounded to two decimal places here).
|
|
25
|
+
const uploadMethod = file.size && file.size < 1000 * 99 ? v2.uploader.upload_stream : v2.uploader.upload_chunked_stream;
|
|
26
|
+
const uploadStream = uploadMethod({
|
|
27
|
+
...config,
|
|
28
|
+
...customConfig
|
|
29
|
+
}, (err, image)=>{
|
|
30
|
+
if (err) {
|
|
31
|
+
if (err.message.includes('File size too large')) {
|
|
32
|
+
reject(new utils.errors.PayloadTooLargeError());
|
|
33
|
+
} else {
|
|
34
|
+
reject(new Error(`Error uploading to cloudinary: ${err.message}`));
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (!image) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (image.resource_type === 'video') {
|
|
42
|
+
file.previewUrl = v2.url(`${image.public_id}.gif`, {
|
|
43
|
+
video_sampling: 6,
|
|
44
|
+
delay: 200,
|
|
45
|
+
width: 250,
|
|
46
|
+
crop: 'scale',
|
|
47
|
+
resource_type: 'video'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
file.url = image.secure_url;
|
|
51
|
+
file.provider_metadata = {
|
|
52
|
+
public_id: image.public_id,
|
|
53
|
+
resource_type: image.resource_type
|
|
54
|
+
};
|
|
55
|
+
resolve();
|
|
56
|
+
});
|
|
57
|
+
if (file.stream) {
|
|
58
|
+
file.stream.pipe(uploadStream);
|
|
59
|
+
} else if (file.buffer) {
|
|
60
|
+
intoStream(file.buffer).pipe(uploadStream);
|
|
61
|
+
} else {
|
|
62
|
+
throw new Error('Missing file stream or buffer');
|
|
63
|
+
}
|
|
64
|
+
});
|
|
12
65
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
66
|
+
return {
|
|
67
|
+
uploadStream (file, customConfig = {}) {
|
|
68
|
+
return upload(file, customConfig);
|
|
69
|
+
},
|
|
70
|
+
upload (file, customConfig = {}) {
|
|
71
|
+
return upload(file, customConfig);
|
|
72
|
+
},
|
|
73
|
+
async delete (file, customConfig = {}) {
|
|
74
|
+
try {
|
|
75
|
+
const { resource_type: resourceType, public_id: publicId } = file.provider_metadata ?? {};
|
|
76
|
+
const deleteConfig = {
|
|
77
|
+
resource_type: resourceType || 'image',
|
|
78
|
+
invalidate: true,
|
|
79
|
+
...customConfig
|
|
80
|
+
};
|
|
81
|
+
const response = await v2.uploader.destroy(`${publicId}`, deleteConfig);
|
|
82
|
+
if (response.result !== 'ok' && response.result !== 'not found') {
|
|
83
|
+
throw new Error(response.result);
|
|
84
|
+
}
|
|
85
|
+
} catch (error) {
|
|
86
|
+
if (error instanceof Error) {
|
|
87
|
+
throw new Error(`Error deleting on cloudinary: ${error.message}`);
|
|
88
|
+
}
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
26
91
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (!image) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (image.resource_type === "video") {
|
|
33
|
-
file.previewUrl = v2.url(`${image.public_id}.gif`, {
|
|
34
|
-
video_sampling: 6,
|
|
35
|
-
delay: 200,
|
|
36
|
-
width: 250,
|
|
37
|
-
crop: "scale",
|
|
38
|
-
resource_type: "video"
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
file.url = image.secure_url;
|
|
42
|
-
file.provider_metadata = {
|
|
43
|
-
public_id: image.public_id,
|
|
44
|
-
resource_type: image.resource_type
|
|
45
|
-
};
|
|
46
|
-
resolve();
|
|
47
|
-
});
|
|
48
|
-
if (file.stream) {
|
|
49
|
-
file.stream.pipe(uploadStream);
|
|
50
|
-
} else if (file.buffer) {
|
|
51
|
-
intoStream(file.buffer).pipe(uploadStream);
|
|
52
|
-
} else {
|
|
53
|
-
throw new Error("Missing file stream or buffer");
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
return {
|
|
58
|
-
uploadStream(file, customConfig = {}) {
|
|
59
|
-
return upload(file, customConfig);
|
|
60
|
-
},
|
|
61
|
-
upload(file, customConfig = {}) {
|
|
62
|
-
return upload(file, customConfig);
|
|
63
|
-
},
|
|
64
|
-
async delete(file, customConfig = {}) {
|
|
65
|
-
try {
|
|
66
|
-
const { resource_type: resourceType, public_id: publicId } = file.provider_metadata ?? {};
|
|
67
|
-
const deleteConfig = {
|
|
68
|
-
resource_type: resourceType || "image",
|
|
69
|
-
invalidate: true,
|
|
70
|
-
...customConfig
|
|
71
|
-
};
|
|
72
|
-
const response = await v2.uploader.destroy(`${publicId}`, deleteConfig);
|
|
73
|
-
if (response.result !== "ok" && response.result !== "not found") {
|
|
74
|
-
throw new Error(response.result);
|
|
75
|
-
}
|
|
76
|
-
} catch (error) {
|
|
77
|
-
if (error instanceof Error) {
|
|
78
|
-
throw new Error(`Error deleting on cloudinary: ${error.message}`);
|
|
79
|
-
}
|
|
80
|
-
throw error;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
export {
|
|
87
|
-
index as default
|
|
92
|
+
};
|
|
93
|
+
}
|
|
88
94
|
};
|
|
95
|
+
|
|
96
|
+
export { index as default };
|
|
89
97
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import type { ReadStream } from 'node:fs';\nimport { v2 as cloudinary, ConfigOptions, UploadApiOptions } from 'cloudinary';\nimport intoStream from 'into-stream';\nimport * as utils from '@strapi/utils';\n\ninterface File {\n name: string;\n alternativeText?: string;\n caption?: string;\n width?: number;\n height?: number;\n formats?: Record<string, unknown>;\n hash: string;\n ext?: string;\n mime: string;\n size: number;\n sizeInBytes: number;\n url: string;\n previewUrl?: string;\n path?: string;\n provider?: string;\n provider_metadata?: Record<string, unknown>;\n stream?: ReadStream;\n buffer?: Buffer;\n}\n\nexport default {\n init(options: ConfigOptions) {\n cloudinary.config(options);\n\n const upload = (file: File, customConfig = {}): Promise<void> => {\n return new Promise((resolve, reject) => {\n const config: Partial<UploadApiOptions> = {\n resource_type: 'auto',\n public_id: file.hash,\n };\n\n if (file.ext) {\n config.filename = `${file.hash}${file.ext}`;\n }\n\n if (file.path) {\n config.folder = file.path;\n }\n\n // For files smaller than 99 MB use regular upload as it tends to be faster\n // and fallback to chunked upload for larger files as that's required by Cloudinary.\n // https://support.cloudinary.com/hc/en-us/community/posts/360009586100-Upload-movie-video-with-large-size?page=1#community_comment_360002140099\n // The Cloudinary's max limit for regular upload is actually 100 MB but add some headroom\n // for size counting shenanigans. (Strapi provides the size in kilobytes rounded to two decimal places here).\n const uploadMethod =\n file.size && file.size < 1000 * 99\n ? cloudinary.uploader.upload_stream\n : cloudinary.uploader.upload_chunked_stream;\n\n const uploadStream = uploadMethod({ ...config, ...customConfig }, (err, image) => {\n if (err) {\n if (err.message.includes('File size too large')) {\n reject(new utils.errors.PayloadTooLargeError());\n } else {\n reject(new Error(`Error uploading to cloudinary: ${err.message}`));\n }\n return;\n }\n\n if (!image) {\n return;\n }\n\n if (image.resource_type === 'video') {\n file.previewUrl = cloudinary.url(`${image.public_id}.gif`, {\n video_sampling: 6,\n delay: 200,\n width: 250,\n crop: 'scale',\n resource_type: 'video',\n });\n }\n\n file.url = image.secure_url;\n file.provider_metadata = {\n public_id: image.public_id,\n resource_type: image.resource_type,\n };\n\n resolve();\n });\n\n if (file.stream) {\n file.stream.pipe(uploadStream);\n } else if (file.buffer) {\n intoStream(file.buffer).pipe(uploadStream);\n } else {\n throw new Error('Missing file stream or buffer');\n }\n });\n };\n\n return {\n uploadStream(file: File, customConfig = {}) {\n return upload(file, customConfig);\n },\n upload(file: File, customConfig = {}) {\n return upload(file, customConfig);\n },\n async delete(file: File, customConfig = {}) {\n try {\n const { resource_type: resourceType, public_id: publicId } = file.provider_metadata ?? {};\n const deleteConfig = {\n resource_type: (resourceType || 'image') as string,\n invalidate: true,\n ...customConfig,\n };\n\n const response = await cloudinary.uploader.destroy(`${publicId}`, deleteConfig);\n\n if (response.result !== 'ok' && response.result !== 'not found') {\n throw new Error(response.result);\n }\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Error deleting on cloudinary: ${error.message}`);\n }\n\n throw error;\n }\n },\n };\n },\n};\n"],"names":["cloudinary"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import type { ReadStream } from 'node:fs';\nimport { v2 as cloudinary, ConfigOptions, UploadApiOptions } from 'cloudinary';\nimport intoStream from 'into-stream';\nimport * as utils from '@strapi/utils';\n\ninterface File {\n name: string;\n alternativeText?: string;\n caption?: string;\n width?: number;\n height?: number;\n formats?: Record<string, unknown>;\n hash: string;\n ext?: string;\n mime: string;\n size: number;\n sizeInBytes: number;\n url: string;\n previewUrl?: string;\n path?: string;\n provider?: string;\n provider_metadata?: Record<string, unknown>;\n stream?: ReadStream;\n buffer?: Buffer;\n}\n\nexport default {\n init(options: ConfigOptions) {\n cloudinary.config(options);\n\n const upload = (file: File, customConfig = {}): Promise<void> => {\n return new Promise((resolve, reject) => {\n const config: Partial<UploadApiOptions> = {\n resource_type: 'auto',\n public_id: file.hash,\n };\n\n if (file.ext) {\n config.filename = `${file.hash}${file.ext}`;\n }\n\n if (file.path) {\n config.folder = file.path;\n }\n\n // For files smaller than 99 MB use regular upload as it tends to be faster\n // and fallback to chunked upload for larger files as that's required by Cloudinary.\n // https://support.cloudinary.com/hc/en-us/community/posts/360009586100-Upload-movie-video-with-large-size?page=1#community_comment_360002140099\n // The Cloudinary's max limit for regular upload is actually 100 MB but add some headroom\n // for size counting shenanigans. (Strapi provides the size in kilobytes rounded to two decimal places here).\n const uploadMethod =\n file.size && file.size < 1000 * 99\n ? cloudinary.uploader.upload_stream\n : cloudinary.uploader.upload_chunked_stream;\n\n const uploadStream = uploadMethod({ ...config, ...customConfig }, (err, image) => {\n if (err) {\n if (err.message.includes('File size too large')) {\n reject(new utils.errors.PayloadTooLargeError());\n } else {\n reject(new Error(`Error uploading to cloudinary: ${err.message}`));\n }\n return;\n }\n\n if (!image) {\n return;\n }\n\n if (image.resource_type === 'video') {\n file.previewUrl = cloudinary.url(`${image.public_id}.gif`, {\n video_sampling: 6,\n delay: 200,\n width: 250,\n crop: 'scale',\n resource_type: 'video',\n });\n }\n\n file.url = image.secure_url;\n file.provider_metadata = {\n public_id: image.public_id,\n resource_type: image.resource_type,\n };\n\n resolve();\n });\n\n if (file.stream) {\n file.stream.pipe(uploadStream);\n } else if (file.buffer) {\n intoStream(file.buffer).pipe(uploadStream);\n } else {\n throw new Error('Missing file stream or buffer');\n }\n });\n };\n\n return {\n uploadStream(file: File, customConfig = {}) {\n return upload(file, customConfig);\n },\n upload(file: File, customConfig = {}) {\n return upload(file, customConfig);\n },\n async delete(file: File, customConfig = {}) {\n try {\n const { resource_type: resourceType, public_id: publicId } = file.provider_metadata ?? {};\n const deleteConfig = {\n resource_type: (resourceType || 'image') as string,\n invalidate: true,\n ...customConfig,\n };\n\n const response = await cloudinary.uploader.destroy(`${publicId}`, deleteConfig);\n\n if (response.result !== 'ok' && response.result !== 'not found') {\n throw new Error(response.result);\n }\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Error deleting on cloudinary: ${error.message}`);\n }\n\n throw error;\n }\n },\n };\n },\n};\n"],"names":["init","options","cloudinary","config","upload","file","customConfig","Promise","resolve","reject","resource_type","public_id","hash","ext","filename","path","folder","uploadMethod","size","uploader","upload_stream","upload_chunked_stream","uploadStream","err","image","message","includes","utils","errors","PayloadTooLargeError","Error","previewUrl","url","video_sampling","delay","width","crop","secure_url","provider_metadata","stream","pipe","buffer","intoStream","delete","resourceType","publicId","deleteConfig","invalidate","response","destroy","result","error"],"mappings":";;;;AA0BA,YAAe;AACbA,IAAAA,IAAAA,CAAAA,CAAKC,OAAsB,EAAA;AACzBC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A,OAAOF,OAAOC,IAAMC,EAAAA,YAAAA,CAAAA;AACtB,aAAA;AACA,YAAA,MAAMqC,MAAOtC,CAAAA,CAAAA,IAAU,EAAEC,YAAAA,GAAe,EAAE,EAAA;gBACxC,IAAI;oBACF,MAAM,EAAEI,aAAekC,EAAAA,YAAY,EAAEjC,SAAAA,EAAWkC,QAAQ,EAAE,GAAGxC,IAAAA,CAAKiC,iBAAiB,IAAI,EAAC;AACxF,oBAAA,MAAMQ,YAAe,GAAA;AACnBpC,wBAAAA,aAAAA,EAAgBkC,YAAgB,IAAA,OAAA;wBAChCG,UAAY,EAAA,IAAA;AACZ,wBAAA,GAAGzC;AACL,qBAAA;oBAEA,MAAM0C,QAAAA,GAAW,MAAM9C,EAAAA,CAAWiB,QAAQ,CAAC8B,OAAO,CAAC,CAAC,EAAEJ,QAAS,CAAA,CAAC,EAAEC,YAAAA,CAAAA;AAElE,oBAAA,IAAIE,SAASE,MAAM,KAAK,QAAQF,QAASE,CAAAA,MAAM,KAAK,WAAa,EAAA;wBAC/D,MAAM,IAAIpB,KAAMkB,CAAAA,QAAAA,CAASE,MAAM,CAAA;AACjC;AACF,iBAAA,CAAE,OAAOC,KAAO,EAAA;AACd,oBAAA,IAAIA,iBAAiBrB,KAAO,EAAA;wBAC1B,MAAM,IAAIA,MAAM,CAAC,8BAA8B,EAAEqB,KAAM1B,CAAAA,OAAO,CAAC,CAAC,CAAA;AAClE;oBAEA,MAAM0B,KAAAA;AACR;AACF;AACF,SAAA;AACF;AACF,CAAE;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/provider-upload-cloudinary",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.0",
|
|
4
4
|
"description": "Cloudinary provider for strapi upload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"upload",
|
|
@@ -36,20 +36,21 @@
|
|
|
36
36
|
"dist/"
|
|
37
37
|
],
|
|
38
38
|
"scripts": {
|
|
39
|
-
"build": "
|
|
39
|
+
"build": "run -T npm-run-all clean --parallel build:code build:types",
|
|
40
|
+
"build:code": "run -T rollup -c",
|
|
41
|
+
"build:types": "run -T tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
40
42
|
"clean": "run -T rimraf ./dist",
|
|
41
43
|
"lint": "run -T eslint .",
|
|
42
|
-
"watch": "
|
|
44
|
+
"watch": "run -T rollup -c -w"
|
|
43
45
|
},
|
|
44
46
|
"dependencies": {
|
|
45
|
-
"@strapi/utils": "5.
|
|
47
|
+
"@strapi/utils": "5.10.0",
|
|
46
48
|
"cloudinary": "^1.41.0",
|
|
47
49
|
"into-stream": "^5.1.0"
|
|
48
50
|
},
|
|
49
51
|
"devDependencies": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"tsconfig": "5.8.1"
|
|
52
|
+
"eslint-config-custom": "5.10.0",
|
|
53
|
+
"tsconfig": "5.10.0"
|
|
53
54
|
},
|
|
54
55
|
"engines": {
|
|
55
56
|
"node": ">=18.0.0 <=22.x.x",
|