@sanvika/cloudinary 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +15 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -144,16 +144,25 @@ function getAppName() {
144
144
  }
145
145
  async function uploadImage(fileOrBuffer, options = {}) {
146
146
  ensureConfigured();
147
- const { folder, tags = [], transforms, publicId, overwrite = false } = options;
147
+ const {
148
+ folder,
149
+ resourceType = "image",
150
+ tags = [],
151
+ transforms,
152
+ publicId,
153
+ overwrite = false,
154
+ notificationUrl
155
+ } = options;
148
156
  const uploadFolder = getFolderPath(_appName, folder);
149
157
  const uploadOpts = {
150
158
  folder: uploadFolder,
151
- resource_type: "image",
159
+ resource_type: resourceType,
152
160
  overwrite,
153
161
  tags: [_appName, ...tags]
154
162
  };
155
163
  if (publicId) uploadOpts.public_id = publicId;
156
164
  if (transforms) uploadOpts.eager = transforms;
165
+ if (notificationUrl) uploadOpts.notification_url = notificationUrl;
157
166
  return withRetry(
158
167
  () => {
159
168
  if (Buffer.isBuffer(fileOrBuffer)) {
@@ -170,6 +179,9 @@ async function uploadImage(fileOrBuffer, options = {}) {
170
179
  { operationName: "uploadImage", maxAttempts: 3 }
171
180
  );
172
181
  }
182
+ async function uploadVideo(fileOrBuffer, options = {}) {
183
+ return uploadImage(fileOrBuffer, { ...options, resourceType: "video" });
184
+ }
173
185
  async function uploadImages(files, options = {}) {
174
186
  if (!Array.isArray(files) || files.length === 0) return [];
175
187
  return Promise.all(files.map((file) => uploadImage(file, options)));
@@ -333,6 +345,7 @@ export {
333
345
  uploadImage,
334
346
  uploadImages,
335
347
  uploadRawFile,
348
+ uploadVideo,
336
349
  useCloudinaryUpload,
337
350
  useSanvikaCloudinary,
338
351
  validatePublicId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanvika/cloudinary",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Centralized Cloudinary SDK for the Sanvika ecosystem — upload, delete, transform, and manage media across 50+ projects",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",