-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #284 from ardriveapp/dev
PE-1558: Release ArDrive CLI v1.15.0
- Loading branch information
Showing
7 changed files
with
133 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file renamed
BIN
+192 KB
...e-js-npm-1.13.0-550896318c-d363267352.zip → ...e-js-npm-1.14.0-f812516345-46c4485354.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import { CLICommand, ParametersHelper } from '../CLICommand'; | ||
import { | ||
BoostParameter, | ||
ConflictResolutionParams, | ||
DestinationFileNameParameter, | ||
DryRunParameter, | ||
ParentFolderIdParameter, | ||
LocalPathParameter, | ||
GatewayParameter, | ||
CustomContentTypeParameter, | ||
TransactionIdParameter, | ||
FileIdParameter, | ||
WalletTypeParameters | ||
} from '../parameter_declarations'; | ||
import { SUCCESS_EXIT_CODE } from '../CLICommand/error_codes'; | ||
import { CLIAction } from '../CLICommand/action'; | ||
import { wrapFileOrFolder, EID, TxID } from 'ardrive-core-js'; | ||
import { cliArDriveFactory } from '..'; | ||
import { getArweaveFromURL } from '../utils/get_arweave_for_url'; | ||
|
||
new CLICommand({ | ||
name: 'retry-tx', | ||
parameters: [ | ||
LocalPathParameter, | ||
{ name: ParentFolderIdParameter, required: false }, | ||
{ name: FileIdParameter, required: false }, | ||
DestinationFileNameParameter, | ||
BoostParameter, | ||
DryRunParameter, | ||
...ConflictResolutionParams, | ||
CustomContentTypeParameter, | ||
GatewayParameter, | ||
{ | ||
name: TransactionIdParameter, | ||
description: '(PUBLIC UNBUNDLED FILES ONLY) The transaction ID of the data transaction to retry' | ||
}, | ||
...WalletTypeParameters | ||
], | ||
action: new CLIAction(async function action(options) { | ||
const parameters = new ParametersHelper(options); | ||
|
||
const conflictResolution = parameters.getFileNameConflictResolution(); | ||
const customContentType = parameters.getParameterValue(CustomContentTypeParameter); | ||
const localFilePath = parameters.getRequiredParameterValue<string>(LocalPathParameter); | ||
|
||
const dataTxId = parameters.getRequiredParameterValue(TransactionIdParameter, TxID); | ||
const wrappedFile = wrapFileOrFolder(localFilePath, customContentType); | ||
|
||
if (wrappedFile.entityType !== 'file') { | ||
throw Error('Retrying folder uploads is not yet supported!'); | ||
} | ||
|
||
const wallet = await parameters.getRequiredWallet(); | ||
const arweave = getArweaveFromURL(parameters.getGateway()); | ||
|
||
const arDrive = cliArDriveFactory({ | ||
wallet, | ||
feeMultiple: parameters.getOptionalBoostSetting(), | ||
dryRun: parameters.isDryRun(), | ||
arweave | ||
}); | ||
|
||
const destinationFolderId = parameters.getParameterValue(ParentFolderIdParameter, EID); | ||
const fileId = parameters.getParameterValue(FileIdParameter, EID); | ||
|
||
const results = await (async () => { | ||
if (fileId) { | ||
return arDrive.retryPublicArFSFileUploadByFileId({ | ||
wrappedFile, | ||
dataTxId, | ||
fileId | ||
}); | ||
} | ||
|
||
if (destinationFolderId) { | ||
return arDrive.retryPublicArFSFileUploadByDestFolderId({ | ||
wrappedFile, | ||
dataTxId, | ||
destinationFolderId, | ||
conflictResolution | ||
}); | ||
} | ||
|
||
throw Error('Must provide a file ID or destination folder ID in order to retry and ArFS file transaction'); | ||
})(); | ||
|
||
console.log(JSON.stringify(results, null, 4)); | ||
return SUCCESS_EXIT_CODE; | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters