From 7a880a7d9d18f88160a8609615099acef13f132d Mon Sep 17 00:00:00 2001 From: Tracy <31976538+tracy-codes@users.noreply.github.com> Date: Fri, 12 Jul 2024 12:25:26 -0700 Subject: [PATCH] feat: incorporate edit changes from @shadowy-drive/sdk 6.0.0. edit-file and upload-multiple-files have new public-facing APIs which may introduce breaking changes for some users. --- package-lock.json | 118 +++++++++++++++------------------------------- package.json | 4 +- src/shdw-drive.ts | 15 +++--- yarn.lock | 43 ++--------------- 4 files changed, 49 insertions(+), 131 deletions(-) diff --git a/package-lock.json b/package-lock.json index eba1cb7..ae664d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,16 @@ { "name": "@shadow-drive/cli", - "version": "0.7.2", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@shadow-drive/cli", - "version": "0.7.2", + "version": "1.0.0", "license": "MIT", "dependencies": { "@coral-xyz/anchor": "^0.27.0", - "@shadow-drive/sdk": "^5.1.1", + "@shadow-drive/sdk": "^6.0.0", "@solana/spl-token": "^0.2.0", "@solana/web3.js": "^1.41.0", "bigint-conversion": "^2.2.1", @@ -39,6 +39,38 @@ "rimraf": "^5.0.1" } }, + "../shadow-drive": { + "name": "@shadow-drive/sdk", + "version": "6.0.0", + "license": "SEE LICENSE IN LICENSE", + "dependencies": { + "@coral-xyz/anchor": "^0.27.0", + "@coral-xyz/borsh": "^0.28.0", + "@solana/spl-token": "^0.2.0", + "@types/bn.js": "^5.1.1", + "cross-fetch": "^3.1.5", + "form-data": "^4.0.0", + "node-fetch": "2", + "rxjs": "^7.5.5", + "tweetnacl": "^1.0.3" + }, + "devDependencies": { + "@types/jest": "^27.5.0", + "@types/node": "^17.0.31", + "@types/node-fetch": "^2.6.2", + "jest": "^28.1.0", + "jest-config": "^28.1.0", + "react": "^18.1.0", + "rimraf": "^3.0.2", + "ts-jest": "^28.0.2", + "ts-jest-resolver": "^2.0.0", + "typedoc": "^0.22.15", + "typescript": "^4.6.4" + }, + "peerDependencies": { + "react": "^17.0.0 || ^18" + } + }, "node_modules/@babel/generator": { "version": "7.18.2", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.2.tgz", @@ -376,46 +408,8 @@ } }, "node_modules/@shadow-drive/sdk": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@shadow-drive/sdk/-/sdk-5.1.1.tgz", - "integrity": "sha512-wCUlJHiL+tjJvSKImGdfMAsDYrDIKs0Ysxm6o3+DoUzSP42cfc493QTfl38mETjD5IrxjjjqdN6fJhnegPpFGA==", - "dependencies": { - "@coral-xyz/anchor": "^0.27.0", - "@coral-xyz/borsh": "^0.28.0", - "@solana/spl-token": "^0.2.0", - "@types/bn.js": "^5.1.1", - "cross-fetch": "^3.1.5", - "form-data": "^4.0.0", - "node-fetch": "2", - "rxjs": "^7.5.5", - "tweetnacl": "^1.0.3" - }, - "peerDependencies": { - "react": "^17.0.0 || ^18" - } - }, - "node_modules/@shadow-drive/sdk/node_modules/@coral-xyz/borsh": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@coral-xyz/borsh/-/borsh-0.28.0.tgz", - "integrity": "sha512-/u1VTzw7XooK7rqeD7JLUSwOyRSesPUk0U37BV9zK0axJc1q0nRbKFGFLYCQ16OtdOJTTwGfGp11Lx9B45bRCQ==", - "dependencies": { - "bn.js": "^5.1.2", - "buffer-layout": "^1.2.0" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "@solana/web3.js": "^1.68.0" - } - }, - "node_modules/@shadow-drive/sdk/node_modules/cross-fetch": { - "version": "3.1.8", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", - "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", - "dependencies": { - "node-fetch": "^2.6.12" - } + "resolved": "../shadow-drive", + "link": true }, "node_modules/@sideway/address": { "version": "4.1.5", @@ -517,14 +511,6 @@ "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz", "integrity": "sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==" }, - "node_modules/@types/bn.js": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.5.tgz", - "integrity": "sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/cli-progress": { "version": "3.11.0", "resolved": "https://registry.npmjs.org/@types/cli-progress/-/cli-progress-3.11.0.tgz", @@ -1820,12 +1806,6 @@ "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "peer": true - }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -1926,18 +1906,6 @@ "url": "https://tidelift.com/funding/github/npm/loglevel" } }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "peer": true, - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, "node_modules/lower-case": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", @@ -2443,18 +2411,6 @@ "rc": "cli.js" } }, - "node_modules/react": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", - "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", - "peer": true, - "dependencies": { - "loose-envify": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/readable-stream": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", diff --git a/package.json b/package.json index d6aae9c..e40fad4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@shadow-drive/cli", - "version": "0.7.2", + "version": "1.0.0", "main": "shdw-drive.js", "bin": { "shdw-drive": "./dist/src/shdw-drive.js" @@ -16,7 +16,7 @@ }, "dependencies": { "@coral-xyz/anchor": "^0.27.0", - "@shadow-drive/sdk": "^5.1.1", + "@shadow-drive/sdk": "^6.0.0", "@solana/spl-token": "^0.2.0", "@solana/web3.js": "^1.41.0", "bigint-conversion": "^2.2.1", diff --git a/src/shdw-drive.ts b/src/shdw-drive.ts index aa28ac5..594ad76 100644 --- a/src/shdw-drive.ts +++ b/src/shdw-drive.ts @@ -278,18 +278,14 @@ programCommand("edit-file") `Sending file edit request to the cluster.` ).start(); try { - const uploadResponse = await drive.editFile( - storageAccount, - options.url, - { - name: fileName, - file: fileData, - } - ); + const uploadResponse = await drive.editFile(storageAccount, { + name: fileName, + file: fileData, + }); txnSpinner.succeed(`File account updated: ${fileName}`); log.info( "Your finalized file location:", - uploadResponse.finalized_location + uploadResponse.finalized_locations ); log.info("Your updated file is immediately accessible."); return process.exit(0); @@ -513,6 +509,7 @@ async function handleUpload( storageAccount, fileDataChunk, concurrent, + false, (items: number) => progress.increment(items) ); return uploadResponse; diff --git a/yarn.lock b/yarn.lock index 3c77ef9..fd9d176 100644 --- a/yarn.lock +++ b/yarn.lock @@ -71,14 +71,6 @@ bn.js "^5.1.2" buffer-layout "^1.2.0" -"@coral-xyz/borsh@^0.28.0": - version "0.28.0" - resolved "https://registry.npmjs.org/@coral-xyz/borsh/-/borsh-0.28.0.tgz" - integrity sha512-/u1VTzw7XooK7rqeD7JLUSwOyRSesPUk0U37BV9zK0axJc1q0nRbKFGFLYCQ16OtdOJTTwGfGp11Lx9B45bRCQ== - dependencies: - bn.js "^5.1.2" - buffer-layout "^1.2.0" - "@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0": version "9.3.0" resolved "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz" @@ -178,10 +170,9 @@ resolved "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== -"@shadow-drive/sdk@^5.1.1": - version "5.1.1" - resolved "https://registry.npmjs.org/@shadow-drive/sdk/-/sdk-5.1.1.tgz" - integrity sha512-wCUlJHiL+tjJvSKImGdfMAsDYrDIKs0Ysxm6o3+DoUzSP42cfc493QTfl38mETjD5IrxjjjqdN6fJhnegPpFGA== +"@shadow-drive/sdk@^6.0.0": + version "6.0.0" + resolved "file:../shadow-drive" dependencies: "@coral-xyz/anchor" "^0.27.0" "@coral-xyz/borsh" "^0.28.0" @@ -258,13 +249,6 @@ rpc-websockets "^7.5.1" superstruct "^0.14.2" -"@types/bn.js@^5.1.1": - version "5.1.5" - resolved "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.5.tgz" - integrity sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A== - dependencies: - "@types/node" "*" - "@types/cli-progress@^3.11.0": version "3.11.0" resolved "https://registry.npmjs.org/@types/cli-progress/-/cli-progress-3.11.0.tgz" @@ -1106,11 +1090,6 @@ js-sha256@^0.9.0: resolved "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz" integrity sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA== -"js-tokens@^3.0.0 || ^4.0.0": - version "4.0.0" - resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - jsesc@^2.5.1: version "2.5.2" resolved "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz" @@ -1171,13 +1150,6 @@ loglevel@^1.8.0: resolved "https://registry.npmjs.org/loglevel/-/loglevel-1.9.1.tgz" integrity sha512-hP3I3kCrDIMuRwAwHltphhDM1r8i55H33GgqjXbrisuJhF4kRhW1dNuxsRklp4bXl8DSdLaNLuiL4A/LWRfxvg== -loose-envify@^1.1.0: - version "1.4.0" - resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz" - integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== - dependencies: - js-tokens "^3.0.0 || ^4.0.0" - lower-case@^2.0.2: version "2.0.2" resolved "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz" @@ -1295,7 +1267,7 @@ node-abi@^3.3.0: dependencies: semver "^7.3.5" -node-fetch@^2.6.12, node-fetch@^2.6.6, node-fetch@^2.6.7, node-fetch@2: +node-fetch@^2.6.12, node-fetch@^2.6.6, node-fetch@^2.6.7: version "2.7.0" resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== @@ -1488,13 +1460,6 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -"react@^17.0.0 || ^18": - version "18.3.1" - resolved "https://registry.npmjs.org/react/-/react-18.3.1.tgz" - integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ== - dependencies: - loose-envify "^1.1.0" - readable-stream@^2.0.0: version "2.3.8" resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz"