@wix/media 1.0.8 → 1.0.10
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/build/cjs/src/media-site-media-v1-file-descriptor.http.d.ts +11 -2
- package/build/cjs/src/media-site-media-v1-file-descriptor.http.js +96 -40
- package/build/cjs/src/media-site-media-v1-file-descriptor.http.js.map +1 -1
- package/build/cjs/src/media-site-media-v1-file-descriptor.public.d.ts +5 -4
- package/build/cjs/src/media-site-media-v1-file-descriptor.public.js +22 -16
- package/build/cjs/src/media-site-media-v1-file-descriptor.public.js.map +1 -1
- package/build/cjs/src/media-site-media-v1-file-descriptor.types.d.ts +69 -16
- package/build/cjs/src/media-site-media-v1-file-descriptor.types.js.map +1 -1
- package/build/cjs/src/media-site-media-v1-file-descriptor.universal.d.ts +178 -24
- package/build/cjs/src/media-site-media-v1-file-descriptor.universal.js +124 -59
- package/build/cjs/src/media-site-media-v1-file-descriptor.universal.js.map +1 -1
- package/build/cjs/src/media-site-media-v1-folder.http.js +30 -27
- package/build/cjs/src/media-site-media-v1-folder.http.js.map +1 -1
- package/build/cjs/src/media-site-media-v1-folder.public.d.ts +1 -1
- package/build/cjs/src/media-site-media-v1-folder.public.js +9 -9
- package/build/cjs/src/media-site-media-v1-folder.public.js.map +1 -1
- package/build/cjs/src/media-site-media-v1-folder.types.d.ts +29 -7
- package/build/cjs/src/media-site-media-v1-folder.types.js.map +1 -1
- package/build/cjs/src/media-site-media-v1-folder.universal.d.ts +68 -9
- package/build/cjs/src/media-site-media-v1-folder.universal.js +37 -34
- package/build/cjs/src/media-site-media-v1-folder.universal.js.map +1 -1
- package/build/es/src/media-site-media-v1-file-descriptor.http.d.ts +11 -2
- package/build/es/src/media-site-media-v1-file-descriptor.http.js +60 -5
- package/build/es/src/media-site-media-v1-file-descriptor.http.js.map +1 -1
- package/build/es/src/media-site-media-v1-file-descriptor.public.d.ts +5 -4
- package/build/es/src/media-site-media-v1-file-descriptor.public.js +8 -3
- package/build/es/src/media-site-media-v1-file-descriptor.public.js.map +1 -1
- package/build/es/src/media-site-media-v1-file-descriptor.types.d.ts +69 -16
- package/build/es/src/media-site-media-v1-file-descriptor.types.js.map +1 -1
- package/build/es/src/media-site-media-v1-file-descriptor.universal.d.ts +178 -24
- package/build/es/src/media-site-media-v1-file-descriptor.universal.js +77 -13
- package/build/es/src/media-site-media-v1-file-descriptor.universal.js.map +1 -1
- package/build/es/src/media-site-media-v1-folder.http.js +9 -6
- package/build/es/src/media-site-media-v1-folder.http.js.map +1 -1
- package/build/es/src/media-site-media-v1-folder.public.d.ts +1 -1
- package/build/es/src/media-site-media-v1-folder.public.js +1 -1
- package/build/es/src/media-site-media-v1-folder.public.js.map +1 -1
- package/build/es/src/media-site-media-v1-folder.types.d.ts +29 -7
- package/build/es/src/media-site-media-v1-folder.types.js.map +1 -1
- package/build/es/src/media-site-media-v1-folder.universal.d.ts +68 -9
- package/build/es/src/media-site-media-v1-folder.universal.js +10 -7
- package/build/es/src/media-site-media-v1-folder.universal.js.map +1 -1
- package/package.json +2 -2
|
@@ -28,7 +28,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.listDeletedFiles = exports.bulkRestoreFilesFromTrashBin = exports.bulkDeleteFiles = exports.generateVideoStreamingUrl = exports.searchFiles = exports.listFiles = exports.bulkImportFiles = exports.importFile = exports.generateFileResumableUploadUrl = exports.generateFileUploadUrl = exports.updateFile = exports.getFileDescriptors = exports.getFileDescriptor = exports.generateFileDownloadUrl = exports.generateFilesDownloadUrl = exports.StreamFormat = exports.RootFolder = exports.SortOrder = exports.UploadProtocol = exports.State = exports.OperationStatus = exports.MediaType = exports.__debug = void 0;
|
|
31
|
+
exports.listDeletedFiles = exports.bulkRestoreFilesFromTrashBin = exports.bulkDeleteFiles = exports.generateVideoStreamingUrl = exports.searchFiles = exports.listFiles = exports.bulkImportFiles = exports.importFile = exports.generateFileResumableUploadUrl = exports.generateFileUploadUrl = exports.updateFileDescriptor = exports.updateFile = exports.getFileDescriptors = exports.getFileDescriptor = exports.generateFileDownloadUrl = exports.generateFilesDownloadUrl = exports.StreamFormat = exports.RootFolder = exports.SortOrder = exports.UploadProtocol = exports.State = exports.OperationStatus = exports.MediaType = exports.__debug = void 0;
|
|
32
32
|
const velo_1 = require("@wix/metro-runtime/velo");
|
|
33
33
|
const ambassadorWixMediaSiteMediaV1FileDescriptor = __importStar(require("./media-site-media-v1-file-descriptor.http"));
|
|
34
34
|
let __verbose = false;
|
|
@@ -135,6 +135,8 @@ const _listFilesRequest = {};
|
|
|
135
135
|
const _listFilesResponse = { files: '_fileDescriptor' };
|
|
136
136
|
const _searchFilesRequest = {};
|
|
137
137
|
const _searchFilesResponse = { files: '_fileDescriptor' };
|
|
138
|
+
const _updateFileDescriptorRequest = { file: '_fileDescriptor' };
|
|
139
|
+
const _updateFileDescriptorResponse = { file: '_fileDescriptor' };
|
|
138
140
|
const _updateFileRequest = {};
|
|
139
141
|
const _updateFileResponse = { file: '_fileDescriptor' };
|
|
140
142
|
/**
|
|
@@ -155,7 +157,7 @@ function generateFilesDownloadUrl(fileIds) {
|
|
|
155
157
|
const responseTransformation = '$';
|
|
156
158
|
// @ts-ignore
|
|
157
159
|
const { httpClient, sideEffects } = arguments[1];
|
|
158
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
160
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
159
161
|
rootSchema: _generateFilesDownloadUrlRequest,
|
|
160
162
|
depSchemas: {},
|
|
161
163
|
fqdnTransformation: {
|
|
@@ -164,7 +166,7 @@ function generateFilesDownloadUrl(fileIds) {
|
|
|
164
166
|
},
|
|
165
167
|
customTransformation: requestTransformation,
|
|
166
168
|
});
|
|
167
|
-
const { fromJSON } = velo_1.serializer({
|
|
169
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
168
170
|
rootSchema: _generateFilesDownloadUrlResponse,
|
|
169
171
|
depSchemas: {},
|
|
170
172
|
fqdnTransformation: {
|
|
@@ -183,7 +185,7 @@ function generateFilesDownloadUrl(fileIds) {
|
|
|
183
185
|
return fromJSON(result.data);
|
|
184
186
|
}
|
|
185
187
|
catch (err) {
|
|
186
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
188
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
187
189
|
'fileIds',
|
|
188
190
|
]);
|
|
189
191
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
@@ -220,7 +222,7 @@ function generateFileDownloadUrl(fileId, options) {
|
|
|
220
222
|
const responseTransformation = '$';
|
|
221
223
|
// @ts-ignore
|
|
222
224
|
const { httpClient, sideEffects } = arguments[2];
|
|
223
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
225
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
224
226
|
rootSchema: _generateFileDownloadUrlRequest,
|
|
225
227
|
depSchemas: {},
|
|
226
228
|
fqdnTransformation: {
|
|
@@ -229,7 +231,7 @@ function generateFileDownloadUrl(fileId, options) {
|
|
|
229
231
|
},
|
|
230
232
|
customTransformation: requestTransformation,
|
|
231
233
|
});
|
|
232
|
-
const { fromJSON } = velo_1.serializer({
|
|
234
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
233
235
|
rootSchema: _generateFileDownloadUrlResponse,
|
|
234
236
|
depSchemas: {},
|
|
235
237
|
fqdnTransformation: {
|
|
@@ -248,7 +250,7 @@ function generateFileDownloadUrl(fileId, options) {
|
|
|
248
250
|
return fromJSON(result.data);
|
|
249
251
|
}
|
|
250
252
|
catch (err) {
|
|
251
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
253
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
252
254
|
'fileId',
|
|
253
255
|
'options',
|
|
254
256
|
]);
|
|
@@ -273,7 +275,7 @@ function getFileDescriptor(fileId) {
|
|
|
273
275
|
const responseTransformation = '$';
|
|
274
276
|
// @ts-ignore
|
|
275
277
|
const { httpClient, sideEffects } = arguments[1];
|
|
276
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
278
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
277
279
|
rootSchema: _getFileDescriptorRequest,
|
|
278
280
|
depSchemas: {},
|
|
279
281
|
fqdnTransformation: {
|
|
@@ -282,7 +284,7 @@ function getFileDescriptor(fileId) {
|
|
|
282
284
|
},
|
|
283
285
|
customTransformation: requestTransformation,
|
|
284
286
|
});
|
|
285
|
-
const { fromJSON } = velo_1.serializer({
|
|
287
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
286
288
|
rootSchema: _getFileDescriptorResponse,
|
|
287
289
|
depSchemas: { _audioV2, _fileDescriptor, _fileMedia, _imageMedia },
|
|
288
290
|
fqdnTransformation: {
|
|
@@ -301,7 +303,7 @@ function getFileDescriptor(fileId) {
|
|
|
301
303
|
return fromJSON(result.data);
|
|
302
304
|
}
|
|
303
305
|
catch (err) {
|
|
304
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
306
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
305
307
|
'fileId',
|
|
306
308
|
]);
|
|
307
309
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
@@ -311,7 +313,8 @@ function getFileDescriptor(fileId) {
|
|
|
311
313
|
}
|
|
312
314
|
exports.getFileDescriptor = getFileDescriptor;
|
|
313
315
|
/**
|
|
314
|
-
* Gets information about
|
|
316
|
+
* Gets information about the specified files in the Media Manager.
|
|
317
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
|
|
315
318
|
* @param fileIds - File IDs.
|
|
316
319
|
* @public
|
|
317
320
|
* @documentationMaturity preview
|
|
@@ -324,7 +327,7 @@ function getFileDescriptors(fileIds) {
|
|
|
324
327
|
const responseTransformation = '$';
|
|
325
328
|
// @ts-ignore
|
|
326
329
|
const { httpClient, sideEffects } = arguments[1];
|
|
327
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
330
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
328
331
|
rootSchema: _getFileDescriptorsRequest,
|
|
329
332
|
depSchemas: {},
|
|
330
333
|
fqdnTransformation: {
|
|
@@ -333,7 +336,7 @@ function getFileDescriptors(fileIds) {
|
|
|
333
336
|
},
|
|
334
337
|
customTransformation: requestTransformation,
|
|
335
338
|
});
|
|
336
|
-
const { fromJSON } = velo_1.serializer({
|
|
339
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
337
340
|
rootSchema: _getFileDescriptorsResponse,
|
|
338
341
|
depSchemas: { _audioV2, _fileDescriptor, _fileMedia, _imageMedia },
|
|
339
342
|
fqdnTransformation: {
|
|
@@ -352,7 +355,7 @@ function getFileDescriptors(fileIds) {
|
|
|
352
355
|
return fromJSON(result.data);
|
|
353
356
|
}
|
|
354
357
|
catch (err) {
|
|
355
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
358
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
356
359
|
'fileIds',
|
|
357
360
|
]);
|
|
358
361
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
@@ -385,7 +388,7 @@ function updateFile(fileId, options) {
|
|
|
385
388
|
const responseTransformation = '$';
|
|
386
389
|
// @ts-ignore
|
|
387
390
|
const { httpClient, sideEffects } = arguments[2];
|
|
388
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
391
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
389
392
|
rootSchema: _updateFileRequest,
|
|
390
393
|
depSchemas: {},
|
|
391
394
|
fqdnTransformation: {
|
|
@@ -394,7 +397,7 @@ function updateFile(fileId, options) {
|
|
|
394
397
|
},
|
|
395
398
|
customTransformation: requestTransformation,
|
|
396
399
|
});
|
|
397
|
-
const { fromJSON } = velo_1.serializer({
|
|
400
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
398
401
|
rootSchema: _updateFileResponse,
|
|
399
402
|
depSchemas: { _audioV2, _fileDescriptor, _fileMedia, _imageMedia },
|
|
400
403
|
fqdnTransformation: {
|
|
@@ -413,7 +416,7 @@ function updateFile(fileId, options) {
|
|
|
413
416
|
return fromJSON(result.data);
|
|
414
417
|
}
|
|
415
418
|
catch (err) {
|
|
416
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
419
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
417
420
|
'fileId',
|
|
418
421
|
'options',
|
|
419
422
|
]);
|
|
@@ -423,6 +426,65 @@ function updateFile(fileId, options) {
|
|
|
423
426
|
});
|
|
424
427
|
}
|
|
425
428
|
exports.updateFile = updateFile;
|
|
429
|
+
/**
|
|
430
|
+
* Updates a file. <br />
|
|
431
|
+
* Supported fields: displayName, parentFolderId, labels. Any unsupported field will be ignored
|
|
432
|
+
* You can use the `parentFolderId` parameter to move a file from its current folder to a different folder.
|
|
433
|
+
* @param _id - File ID. Generated when a file is uploaded to the Media Manager.
|
|
434
|
+
* @public
|
|
435
|
+
* @documentationMaturity preview
|
|
436
|
+
* @requiredField _id
|
|
437
|
+
* @requiredField file
|
|
438
|
+
*/
|
|
439
|
+
function updateFileDescriptor(_id, file, options) {
|
|
440
|
+
var _a, _b, _c;
|
|
441
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
442
|
+
const requestTransformation = {
|
|
443
|
+
file: { '*': '$[1]', id: '$[0]' },
|
|
444
|
+
fieldMask: '$[2].fieldMask',
|
|
445
|
+
};
|
|
446
|
+
const responseTransformation = '$';
|
|
447
|
+
// @ts-ignore
|
|
448
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
449
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
450
|
+
rootSchema: _updateFileDescriptorRequest,
|
|
451
|
+
depSchemas: { _audioV2, _fileDescriptor, _fileMedia, _imageMedia },
|
|
452
|
+
fqdnTransformation: {
|
|
453
|
+
paths: [...['file']],
|
|
454
|
+
transformation: _fromVeloEntity,
|
|
455
|
+
},
|
|
456
|
+
customTransformation: requestTransformation,
|
|
457
|
+
});
|
|
458
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
459
|
+
rootSchema: _updateFileDescriptorResponse,
|
|
460
|
+
depSchemas: { _audioV2, _fileDescriptor, _fileMedia, _imageMedia },
|
|
461
|
+
fqdnTransformation: {
|
|
462
|
+
paths: [...['file']],
|
|
463
|
+
transformation: _toVeloEntity,
|
|
464
|
+
},
|
|
465
|
+
customTransformation: responseTransformation,
|
|
466
|
+
});
|
|
467
|
+
const payload = toAmbassadorRequest([_id, file, options]);
|
|
468
|
+
const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.updateFileDescriptor(payload);
|
|
469
|
+
__log(`"UpdateFileDescriptor" sending request with: ${__inspect(reqOpts)}`);
|
|
470
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
471
|
+
try {
|
|
472
|
+
const result = yield httpClient.request(reqOpts);
|
|
473
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
474
|
+
return fromJSON(result.data);
|
|
475
|
+
}
|
|
476
|
+
catch (err) {
|
|
477
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
478
|
+
'_id',
|
|
479
|
+
'file',
|
|
480
|
+
'options',
|
|
481
|
+
]);
|
|
482
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
483
|
+
throw transformedError;
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
exports.updateFileDescriptor = updateFileDescriptor;
|
|
426
488
|
/**
|
|
427
489
|
* Generates an upload URL to allow external clients to upload a file to the Media Manager.
|
|
428
490
|
*
|
|
@@ -451,7 +513,7 @@ function generateFileUploadUrl(mimeType, options) {
|
|
|
451
513
|
const responseTransformation = '$';
|
|
452
514
|
// @ts-ignore
|
|
453
515
|
const { httpClient, sideEffects } = arguments[2];
|
|
454
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
516
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
455
517
|
rootSchema: _generateFileUploadUrlRequest,
|
|
456
518
|
depSchemas: {},
|
|
457
519
|
fqdnTransformation: {
|
|
@@ -460,7 +522,7 @@ function generateFileUploadUrl(mimeType, options) {
|
|
|
460
522
|
},
|
|
461
523
|
customTransformation: requestTransformation,
|
|
462
524
|
});
|
|
463
|
-
const { fromJSON } = velo_1.serializer({
|
|
525
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
464
526
|
rootSchema: _generateFileUploadUrlResponse,
|
|
465
527
|
depSchemas: {},
|
|
466
528
|
fqdnTransformation: {
|
|
@@ -479,7 +541,7 @@ function generateFileUploadUrl(mimeType, options) {
|
|
|
479
541
|
return fromJSON(result.data);
|
|
480
542
|
}
|
|
481
543
|
catch (err) {
|
|
482
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
544
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
483
545
|
'mimeType',
|
|
484
546
|
'options',
|
|
485
547
|
]);
|
|
@@ -518,7 +580,7 @@ function generateFileResumableUploadUrl(mimeType, options) {
|
|
|
518
580
|
const responseTransformation = '$';
|
|
519
581
|
// @ts-ignore
|
|
520
582
|
const { httpClient, sideEffects } = arguments[2];
|
|
521
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
583
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
522
584
|
rootSchema: _generateFileResumableUploadUrlRequest,
|
|
523
585
|
depSchemas: {},
|
|
524
586
|
fqdnTransformation: {
|
|
@@ -527,7 +589,7 @@ function generateFileResumableUploadUrl(mimeType, options) {
|
|
|
527
589
|
},
|
|
528
590
|
customTransformation: requestTransformation,
|
|
529
591
|
});
|
|
530
|
-
const { fromJSON } = velo_1.serializer({
|
|
592
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
531
593
|
rootSchema: _generateFileResumableUploadUrlResponse,
|
|
532
594
|
depSchemas: {},
|
|
533
595
|
fqdnTransformation: {
|
|
@@ -546,7 +608,7 @@ function generateFileResumableUploadUrl(mimeType, options) {
|
|
|
546
608
|
return fromJSON(result.data);
|
|
547
609
|
}
|
|
548
610
|
catch (err) {
|
|
549
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
611
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
550
612
|
'mimeType',
|
|
551
613
|
'options',
|
|
552
614
|
]);
|
|
@@ -596,7 +658,7 @@ function importFile(url, options) {
|
|
|
596
658
|
const responseTransformation = '$';
|
|
597
659
|
// @ts-ignore
|
|
598
660
|
const { httpClient, sideEffects } = arguments[2];
|
|
599
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
661
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
600
662
|
rootSchema: _importFileRequest,
|
|
601
663
|
depSchemas: {},
|
|
602
664
|
fqdnTransformation: {
|
|
@@ -605,7 +667,7 @@ function importFile(url, options) {
|
|
|
605
667
|
},
|
|
606
668
|
customTransformation: requestTransformation,
|
|
607
669
|
});
|
|
608
|
-
const { fromJSON } = velo_1.serializer({
|
|
670
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
609
671
|
rootSchema: _importFileResponse,
|
|
610
672
|
depSchemas: { _audioV2, _fileDescriptor, _fileMedia, _imageMedia },
|
|
611
673
|
fqdnTransformation: {
|
|
@@ -624,7 +686,7 @@ function importFile(url, options) {
|
|
|
624
686
|
return fromJSON(result.data);
|
|
625
687
|
}
|
|
626
688
|
catch (err) {
|
|
627
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
689
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
628
690
|
'url',
|
|
629
691
|
'options',
|
|
630
692
|
]);
|
|
@@ -648,21 +710,21 @@ exports.importFile = importFile;
|
|
|
648
710
|
* >**Notes:**
|
|
649
711
|
* > - This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
|
|
650
712
|
* > - The `media` property isn't returned in the `files` response object.
|
|
713
|
+
* @param importFileRequests - Information about the files to import.
|
|
651
714
|
* @public
|
|
652
715
|
* @documentationMaturity preview
|
|
653
|
-
* @requiredField
|
|
716
|
+
* @requiredField importFileRequests
|
|
717
|
+
* @requiredField importFileRequests.url
|
|
654
718
|
* @param options - Options to use when uploading multiple files.
|
|
655
719
|
*/
|
|
656
|
-
function bulkImportFiles(
|
|
720
|
+
function bulkImportFiles(importFileRequests) {
|
|
657
721
|
var _a, _b, _c;
|
|
658
722
|
return __awaiter(this, arguments, void 0, function* () {
|
|
659
|
-
const requestTransformation = {
|
|
660
|
-
importFileRequests: '$[0].importFileRequests',
|
|
661
|
-
};
|
|
723
|
+
const requestTransformation = { importFileRequests: '$[0]' };
|
|
662
724
|
const responseTransformation = '$';
|
|
663
725
|
// @ts-ignore
|
|
664
726
|
const { httpClient, sideEffects } = arguments[1];
|
|
665
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
727
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
666
728
|
rootSchema: _bulkImportFilesRequest,
|
|
667
729
|
depSchemas: { _importFileRequest },
|
|
668
730
|
fqdnTransformation: {
|
|
@@ -671,7 +733,7 @@ function bulkImportFiles(options) {
|
|
|
671
733
|
},
|
|
672
734
|
customTransformation: requestTransformation,
|
|
673
735
|
});
|
|
674
|
-
const { fromJSON } = velo_1.serializer({
|
|
736
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
675
737
|
rootSchema: _bulkImportFilesResponse,
|
|
676
738
|
depSchemas: { _audioV2, _fileDescriptor, _fileMedia, _imageMedia },
|
|
677
739
|
fqdnTransformation: {
|
|
@@ -680,7 +742,7 @@ function bulkImportFiles(options) {
|
|
|
680
742
|
},
|
|
681
743
|
customTransformation: responseTransformation,
|
|
682
744
|
});
|
|
683
|
-
const payload = toAmbassadorRequest([
|
|
745
|
+
const payload = toAmbassadorRequest([importFileRequests]);
|
|
684
746
|
const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.bulkImportFiles(payload);
|
|
685
747
|
__log(`"BulkImportFiles" sending request with: ${__inspect(reqOpts)}`);
|
|
686
748
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -690,8 +752,8 @@ function bulkImportFiles(options) {
|
|
|
690
752
|
return fromJSON(result.data);
|
|
691
753
|
}
|
|
692
754
|
catch (err) {
|
|
693
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
694
|
-
'
|
|
755
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
756
|
+
'importFileRequests',
|
|
695
757
|
]);
|
|
696
758
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
697
759
|
throw transformedError;
|
|
@@ -722,7 +784,7 @@ function listFiles(options) {
|
|
|
722
784
|
const responseTransformation = '$';
|
|
723
785
|
// @ts-ignore
|
|
724
786
|
const { httpClient, sideEffects } = arguments[1];
|
|
725
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
787
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
726
788
|
rootSchema: _listFilesRequest,
|
|
727
789
|
depSchemas: {},
|
|
728
790
|
fqdnTransformation: {
|
|
@@ -731,7 +793,7 @@ function listFiles(options) {
|
|
|
731
793
|
},
|
|
732
794
|
customTransformation: requestTransformation,
|
|
733
795
|
});
|
|
734
|
-
const { fromJSON } = velo_1.serializer({
|
|
796
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
735
797
|
rootSchema: _listFilesResponse,
|
|
736
798
|
depSchemas: { _audioV2, _fileDescriptor, _fileMedia, _imageMedia },
|
|
737
799
|
fqdnTransformation: {
|
|
@@ -750,7 +812,7 @@ function listFiles(options) {
|
|
|
750
812
|
return fromJSON(result.data);
|
|
751
813
|
}
|
|
752
814
|
catch (err) {
|
|
753
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
815
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
754
816
|
'options',
|
|
755
817
|
]);
|
|
756
818
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
@@ -783,7 +845,7 @@ function searchFiles(options) {
|
|
|
783
845
|
const responseTransformation = '$';
|
|
784
846
|
// @ts-ignore
|
|
785
847
|
const { httpClient, sideEffects } = arguments[1];
|
|
786
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
848
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
787
849
|
rootSchema: _searchFilesRequest,
|
|
788
850
|
depSchemas: {},
|
|
789
851
|
fqdnTransformation: {
|
|
@@ -792,7 +854,7 @@ function searchFiles(options) {
|
|
|
792
854
|
},
|
|
793
855
|
customTransformation: requestTransformation,
|
|
794
856
|
});
|
|
795
|
-
const { fromJSON } = velo_1.serializer({
|
|
857
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
796
858
|
rootSchema: _searchFilesResponse,
|
|
797
859
|
depSchemas: { _audioV2, _fileDescriptor, _fileMedia, _imageMedia },
|
|
798
860
|
fqdnTransformation: {
|
|
@@ -811,7 +873,7 @@ function searchFiles(options) {
|
|
|
811
873
|
return fromJSON(result.data);
|
|
812
874
|
}
|
|
813
875
|
catch (err) {
|
|
814
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
876
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
815
877
|
'options',
|
|
816
878
|
]);
|
|
817
879
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
@@ -839,7 +901,7 @@ function generateVideoStreamingUrl(fileId, options) {
|
|
|
839
901
|
const responseTransformation = '$';
|
|
840
902
|
// @ts-ignore
|
|
841
903
|
const { httpClient, sideEffects } = arguments[2];
|
|
842
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
904
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
843
905
|
rootSchema: _generateVideoStreamingUrlRequest,
|
|
844
906
|
depSchemas: {},
|
|
845
907
|
fqdnTransformation: {
|
|
@@ -848,7 +910,7 @@ function generateVideoStreamingUrl(fileId, options) {
|
|
|
848
910
|
},
|
|
849
911
|
customTransformation: requestTransformation,
|
|
850
912
|
});
|
|
851
|
-
const { fromJSON } = velo_1.serializer({
|
|
913
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
852
914
|
rootSchema: _generateVideoStreamingUrlResponse,
|
|
853
915
|
depSchemas: {},
|
|
854
916
|
fqdnTransformation: {
|
|
@@ -867,7 +929,7 @@ function generateVideoStreamingUrl(fileId, options) {
|
|
|
867
929
|
return fromJSON(result.data);
|
|
868
930
|
}
|
|
869
931
|
catch (err) {
|
|
870
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
932
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
871
933
|
'fileId',
|
|
872
934
|
'options',
|
|
873
935
|
]);
|
|
@@ -892,21 +954,23 @@ exports.generateVideoStreamingUrl = generateVideoStreamingUrl;
|
|
|
892
954
|
*
|
|
893
955
|
*
|
|
894
956
|
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
|
|
957
|
+
* @param fileIds - IDs of the files to move to the Media Manager's trash bin.
|
|
895
958
|
* @public
|
|
896
959
|
* @documentationMaturity preview
|
|
960
|
+
* @requiredField fileIds
|
|
897
961
|
* @param options - Options to use when deleting files.
|
|
898
962
|
*/
|
|
899
|
-
function bulkDeleteFiles(options) {
|
|
963
|
+
function bulkDeleteFiles(fileIds, options) {
|
|
900
964
|
var _a, _b, _c;
|
|
901
965
|
return __awaiter(this, arguments, void 0, function* () {
|
|
902
966
|
const requestTransformation = {
|
|
903
|
-
fileIds: '$[0]
|
|
904
|
-
permanent: '$[
|
|
967
|
+
fileIds: '$[0]',
|
|
968
|
+
permanent: '$[1].permanent',
|
|
905
969
|
};
|
|
906
970
|
const responseTransformation = '$';
|
|
907
971
|
// @ts-ignore
|
|
908
|
-
const { httpClient, sideEffects } = arguments[
|
|
909
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
972
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
973
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
910
974
|
rootSchema: _bulkDeleteFilesRequest,
|
|
911
975
|
depSchemas: {},
|
|
912
976
|
fqdnTransformation: {
|
|
@@ -915,7 +979,7 @@ function bulkDeleteFiles(options) {
|
|
|
915
979
|
},
|
|
916
980
|
customTransformation: requestTransformation,
|
|
917
981
|
});
|
|
918
|
-
const { fromJSON } = velo_1.serializer({
|
|
982
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
919
983
|
rootSchema: _bulkDeleteFilesResponse,
|
|
920
984
|
depSchemas: {},
|
|
921
985
|
fqdnTransformation: {
|
|
@@ -924,7 +988,7 @@ function bulkDeleteFiles(options) {
|
|
|
924
988
|
},
|
|
925
989
|
customTransformation: responseTransformation,
|
|
926
990
|
});
|
|
927
|
-
const payload = toAmbassadorRequest([options]);
|
|
991
|
+
const payload = toAmbassadorRequest([fileIds, options]);
|
|
928
992
|
const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.bulkDeleteFiles(payload);
|
|
929
993
|
__log(`"BulkDeleteFiles" sending request with: ${__inspect(reqOpts)}`);
|
|
930
994
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -934,7 +998,8 @@ function bulkDeleteFiles(options) {
|
|
|
934
998
|
return fromJSON(result.data);
|
|
935
999
|
}
|
|
936
1000
|
catch (err) {
|
|
937
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
1001
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
1002
|
+
'fileIds',
|
|
938
1003
|
'options',
|
|
939
1004
|
]);
|
|
940
1005
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
@@ -958,7 +1023,7 @@ function bulkRestoreFilesFromTrashBin(fileIds) {
|
|
|
958
1023
|
const responseTransformation = '$';
|
|
959
1024
|
// @ts-ignore
|
|
960
1025
|
const { httpClient, sideEffects } = arguments[1];
|
|
961
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
1026
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
962
1027
|
rootSchema: _bulkRestoreFilesFromTrashBinRequest,
|
|
963
1028
|
depSchemas: {},
|
|
964
1029
|
fqdnTransformation: {
|
|
@@ -967,7 +1032,7 @@ function bulkRestoreFilesFromTrashBin(fileIds) {
|
|
|
967
1032
|
},
|
|
968
1033
|
customTransformation: requestTransformation,
|
|
969
1034
|
});
|
|
970
|
-
const { fromJSON } = velo_1.serializer({
|
|
1035
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
971
1036
|
rootSchema: _bulkRestoreFilesFromTrashBinResponse,
|
|
972
1037
|
depSchemas: {},
|
|
973
1038
|
fqdnTransformation: {
|
|
@@ -986,7 +1051,7 @@ function bulkRestoreFilesFromTrashBin(fileIds) {
|
|
|
986
1051
|
return fromJSON(result.data);
|
|
987
1052
|
}
|
|
988
1053
|
catch (err) {
|
|
989
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
1054
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
990
1055
|
'fileIds',
|
|
991
1056
|
]);
|
|
992
1057
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
@@ -1017,7 +1082,7 @@ function listDeletedFiles(options) {
|
|
|
1017
1082
|
const responseTransformation = '$';
|
|
1018
1083
|
// @ts-ignore
|
|
1019
1084
|
const { httpClient, sideEffects } = arguments[1];
|
|
1020
|
-
const { toAmbassadorRequest } = velo_1.serializer({
|
|
1085
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
1021
1086
|
rootSchema: _listDeletedFilesRequest,
|
|
1022
1087
|
depSchemas: {},
|
|
1023
1088
|
fqdnTransformation: {
|
|
@@ -1026,7 +1091,7 @@ function listDeletedFiles(options) {
|
|
|
1026
1091
|
},
|
|
1027
1092
|
customTransformation: requestTransformation,
|
|
1028
1093
|
});
|
|
1029
|
-
const { fromJSON } = velo_1.serializer({
|
|
1094
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
1030
1095
|
rootSchema: _listDeletedFilesResponse,
|
|
1031
1096
|
depSchemas: { _audioV2, _fileDescriptor, _fileMedia, _imageMedia },
|
|
1032
1097
|
fqdnTransformation: {
|
|
@@ -1045,7 +1110,7 @@ function listDeletedFiles(options) {
|
|
|
1045
1110
|
return fromJSON(result.data);
|
|
1046
1111
|
}
|
|
1047
1112
|
catch (err) {
|
|
1048
|
-
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
1113
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
1049
1114
|
'options',
|
|
1050
1115
|
]);
|
|
1051
1116
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|