@vidispine/vdt-react 23.1.0-pre.2 → 23.1.0-pre.4

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.
@@ -3,7 +3,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
3
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
4
4
  import { storage, library, job, file } from '@vidispine/vdt-api';
5
5
 
6
- function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function defaultOnGetStorage(){var storageData=storage.listStorage().then(function(response){var storage={id:response.data.storage[0].id,uri:response.data.storage[0].method[0].uri};return storage;});return storageData;}function defaultOnCreate(list){return library.createLibrary({itemListDocument:{item:_toConsumableArray(list.item.map(function(_ref){var id=_ref.id;return {id:id};}))}});}function defaultOnList(response,storageInfo,queryParams){var _queryParams$fileName=queryParams.fileName,fileName=_queryParams$fileName===void 0?'output':_queryParams$fileName,_queryParams$outputFo=queryParams.outputFormat,outputFormat=_queryParams$outputFo===void 0?'csv':_queryParams$outputFo;var uri=storageInfo.uri;var _response$data=response.data;_response$data=_response$data===void 0?{}:_response$data;var _response$data$uri=_response$data.uri;_response$data$uri=_response$data$uri===void 0?[]:_response$data$uri;var _response$data$uri2=_slicedToArray(_response$data$uri,1),libraryId=_response$data$uri2[0];var createNewUri=function createNewUri(){if(uri.includes('s3')){var _uri$split=uri.split('?region'),_uri$split2=_slicedToArray(_uri$split,2),uriBeforeRegion=_uri$split2[0],uriAfterRegion=_uri$split2[1];return "".concat(uriBeforeRegion).concat(fileName,".").concat(outputFormat,"?region").concat(uriAfterRegion);}return "".concat(uri).concat(fileName,".").concat(outputFormat);};var newUri=encodeURIComponent(createNewUri());return library.getLibraryBatch({libraryId:libraryId,queryParams:_objectSpread({destinationUri:newUri},queryParams)});}var SUCCESSFUL_STATES=['FINISHED','FINISHED_WARNING'];var INACTIVE_STATES=['FINISHED','FINISHED_WARNING','FAILED_TOTAL','ABORTED'];function defaultOnGetFile(response,storageInfo,params,onError){var _response$data2=response.data;_response$data2=_response$data2===void 0?{}:_response$data2;var jobId=_response$data2.jobId;var id=storageInfo.id;var _params$fileName=params.fileName,fileName=_params$fileName===void 0?'output':_params$fileName,_params$outputFormat=params.outputFormat,outputFormat=_params$outputFormat===void 0?'csv':_params$outputFormat;var filePath="".concat(fileName,".").concat(outputFormat);job.getJob({jobId:jobId}).then(function(){var _ref2=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref2$data=_ref2.data;_ref2$data=_ref2$data===void 0?{}:_ref2$data;var status=_ref2$data.status;if(SUCCESSFUL_STATES.includes(status)){try{file.listFileStorage({storageId:id,queryParams:{path:filePath,methodMetadata:[{key:'format',value:'SIGNED-AUTO'},{key:'contentDisposition',value:"attachment;+filename=".concat(filePath)}],'noauth-url':true}}).then(function(r){return window.open(r.data.file[0].uri[0]);});}catch(error){console.error('Download error:'.concat("\n",error));onError({message:'Download failed'});}}else if(!INACTIVE_STATES.includes(status)){setTimeout(function(){defaultOnGetFile(response,storageInfo,params);},1000);}else {onError({message:'Download failed'});}});}// Note: Not needed as a react-hook since doesn't use react,
6
+ function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function defaultOnGetStorage(){var storageData=storage.listStorage().then(function(response){var storage={id:response.data.storage[0].id,uri:response.data.storage[0].method[0].uri};return storage;});return storageData;}function defaultOnCreate(list){return library.createLibrary({itemListDocument:{item:_toConsumableArray(list.item.map(function(_ref){var id=_ref.id;return {id:id};}))}});}function defaultOnList(response,storageInfo,queryParams){var _queryParams$fileName=queryParams.fileName,fileName=_queryParams$fileName===void 0?'output':_queryParams$fileName,_queryParams$outputFo=queryParams.outputFormat,outputFormat=_queryParams$outputFo===void 0?'csv':_queryParams$outputFo;var uri=storageInfo.uri;var _response$data=response.data;_response$data=_response$data===void 0?{}:_response$data;var _response$data$uri=_response$data.uri;_response$data$uri=_response$data$uri===void 0?[]:_response$data$uri;var _response$data$uri2=_slicedToArray(_response$data$uri,1),libraryId=_response$data$uri2[0];var createNewUri=function createNewUri(){if(uri.includes('s3')){var _uri$split=uri.split('?region'),_uri$split2=_slicedToArray(_uri$split,2),uriBeforeRegion=_uri$split2[0],uriAfterRegion=_uri$split2[1];return "".concat(uriBeforeRegion).concat(fileName,".").concat(outputFormat,"?region").concat(uriAfterRegion);}return "".concat(uri).concat(fileName,".").concat(outputFormat);};var newUri=encodeURIComponent(createNewUri());return library.getLibraryBatch({libraryId:libraryId,queryParams:_objectSpread({destinationUri:newUri},queryParams)});}var SUCCESSFUL_STATES=['FINISHED','FINISHED_WARNING'];var INACTIVE_STATES=['FINISHED','FINISHED_WARNING','FAILED_TOTAL','ABORTED'];function defaultOnGetFile(response,storageInfo,params,onError){var _response$data2=response.data;_response$data2=_response$data2===void 0?{}:_response$data2;var jobId=_response$data2.jobId;var id=storageInfo.id;var _params$fileName=params.fileName,fileName=_params$fileName===void 0?'output':_params$fileName,_params$outputFormat=params.outputFormat,outputFormat=_params$outputFormat===void 0?'csv':_params$outputFormat;var filePath="".concat(fileName,".").concat(outputFormat);job.getJob({jobId:jobId}).then(function(){var _ref2=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref2$data=_ref2.data;_ref2$data=_ref2$data===void 0?{}:_ref2$data;var status=_ref2$data.status;if(SUCCESSFUL_STATES.includes(status)){try{file.listFileStorage({storageId:id,queryParams:{path:filePath,methodMetadata:[{key:'format',value:'SIGNED-AUTO'},{key:'contentDisposition',value:"attachment;+filename=".concat(filePath)}],'noauth-url':true}}).then(function(r){return window.open(r.data.file[0].uri[0]);});}catch(error){console.error('Download error:'.concat("\n",error));onError({message:'Download failed'});}}else if(!INACTIVE_STATES.includes(status)){setTimeout(function(){defaultOnGetFile(response,storageInfo,params,onError);},1000);}else {onError({message:'Download failed'});}});}// Note: Not needed as a react-hook since doesn't use react,
7
7
  // but this is usually where we put logic functions right now
8
8
  var useCsvDownload=function useCsvDownload(_ref3){var itemListType=_ref3.itemListType,queryParams=_ref3.queryParams,onSuccess=_ref3.onSuccess,_ref3$onError=_ref3.onError,onError=_ref3$onError===void 0?function(_ref4){var message=_ref4.message,error=_ref4.error;return console.error("".concat(message,"\n").concat(error));}:_ref3$onError,_ref3$onGetFile=_ref3.onGetFile,onGetFile=_ref3$onGetFile===void 0?defaultOnGetFile:_ref3$onGetFile,_ref3$onCreateList=_ref3.onCreateList,onCreateList=_ref3$onCreateList===void 0?defaultOnCreate:_ref3$onCreateList,_ref3$onList=_ref3.onList,onList=_ref3$onList===void 0?defaultOnList:_ref3$onList,_ref3$onGetStorage=_ref3.onGetStorage,onGetStorage=_ref3$onGetStorage===void 0?defaultOnGetStorage:_ref3$onGetStorage;var onDownload=function onDownload(){return onGetStorage().then(function(storageInfo){return Promise.all([onCreateList(itemListType).then(function(response){return onList(response,storageInfo,queryParams);}).then(onSuccess()).then(function(response){return onGetFile(response,storageInfo,queryParams,onError);})]);});};return {onDownload:onDownload};};var useCsvDownload$1 = useCsvDownload;
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vidispine/vdt-react",
3
- "version": "23.1.0-pre.2",
3
+ "version": "23.1.0-pre.4",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -25,8 +25,8 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@babel/runtime": "^7.20.1",
28
- "@vidispine/vdt-api": "23.1.0-pre.2",
29
- "@vidispine/vdt-js": "23.1.0-pre.2",
28
+ "@vidispine/vdt-api": "23.1.0-pre.4",
29
+ "@vidispine/vdt-js": "23.1.0-pre.4",
30
30
  "lodash.debounce": "^4.0.8",
31
31
  "lz-string": "^1.4.4",
32
32
  "react-cookie": "^4.1.1",
@@ -44,9 +44,9 @@
44
44
  "@rollup/plugin-babel": "5.3.1",
45
45
  "@rollup/plugin-commonjs": "21.1.0",
46
46
  "@rollup/plugin-node-resolve": "13.3.0",
47
- "@vidispine/eslint-config-react": "23.1.0-pre.2",
48
- "@vidispine/eslint-config-storybook": "23.1.0-pre.2",
49
- "@vidispine/prettier-config": "23.1.0-pre.2",
47
+ "@vidispine/eslint-config-react": "23.1.0-pre.4",
48
+ "@vidispine/eslint-config-storybook": "23.1.0-pre.4",
49
+ "@vidispine/prettier-config": "23.1.0-pre.4",
50
50
  "babel-plugin-transform-react-remove-prop-types": "0.4.24",
51
51
  "eslint": "8.28.0",
52
52
  "prettier": "2.8.0",