@@ -11,12 +11,14 @@ define([
1111 this . blobClient = blobClient ;
1212 this . _files = { } ;
1313 this . _data = { } ;
14+ this . _auth = { } ;
1415 } ;
1516
16- GeneratedFiles . prototype . addUserAsset = function ( path , dataInfo ) {
17+ GeneratedFiles . prototype . addUserAsset = function ( path , dataInfo , creds ) {
1718 assert ( ! ! dataInfo , `Adding undefined user asset: ${ path } ` ) ;
1819 dataInfo = typeof dataInfo === 'object' ? dataInfo : JSON . parse ( dataInfo ) ;
1920 this . _data [ path ] = dataInfo ;
21+ this . _auth [ path ] = creds ;
2022 } ;
2123
2224 GeneratedFiles . prototype . getUserAssetPaths = function ( ) {
@@ -27,6 +29,10 @@ define([
2729 return this . _data [ path ] ;
2830 } ;
2931
32+ GeneratedFiles . prototype . getUserAssetAuth = function ( path ) {
33+ return this . _auth [ path ] ;
34+ } ;
35+
3036 GeneratedFiles . prototype . getUserAssets = function ( ) {
3137 return Object . entries ( this . _data ) ;
3238 } ;
@@ -51,6 +57,7 @@ define([
5157 GeneratedFiles . prototype . remove = function ( path ) {
5258 delete this . _files [ path ] ;
5359 delete this . _data [ path ] ;
60+ delete this . _auth [ path ] ;
5461 } ;
5562
5663 GeneratedFiles . prototype . save = async function ( artifactName ) {
@@ -62,7 +69,11 @@ define([
6269 const objectHashes = { } ;
6370 for ( let i = userAssets . length ; i -- ; ) {
6471 const [ filepath , dataInfo ] = userAssets [ i ] ;
65- const contentsStream = await Storage . getFileStream ( dataInfo ) ;
72+ const creds = this . getUserAssetAuth ( filepath ) ;
73+ const config = { } ;
74+ config [ dataInfo . backend ] = creds ;
75+
76+ const contentsStream = await Storage . getFileStream ( dataInfo , null , config ) ;
6677 const filename = filepath . split ( '/' ) . pop ( ) ;
6778 const hash = await this . blobClient . putFile ( filename , contentsStream ) ;
6879 objectHashes [ filepath ] = hash ;
0 commit comments