diff --git a/package-lock.json b/package-lock.json index 2393076..4120bcc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,13 +17,13 @@ "@ucanto/client": "^9.0.0", "@ucanto/core": "^9.0.0", "@ucanto/transport": "^9.0.0", - "@web3-storage/access": "18.0.0", + "@web3-storage/access": "^18.0.2", "@web3-storage/data-segment": "^5.0.0", "@web3-storage/did-mailto": "^2.1.0", - "@web3-storage/w3up-client": "^11.0.0", + "@web3-storage/w3up-client": "^11.0.2", "ansi-escapes": "^6.2.0", "chalk": "^5.3.0", - "files-from-path": "^1.0.0", + "files-from-path": "^1.0.2", "open": "^9.1.0", "ora": "^7.0.1", "pretty-tree": "^1.0.0", @@ -40,13 +40,13 @@ "@ucanto/principal": "^9.0.0", "@ucanto/server": "^9.0.1", "@web-std/blob": "^3.0.5", - "@web3-storage/capabilities": "^12.0.0", + "@web3-storage/capabilities": "^12.0.2", "@web3-storage/eslint-config-w3up": "^1.0.0", "@web3-storage/sigv4": "^1.0.2", - "@web3-storage/upload-api": "^7.3.2", - "@web3-storage/upload-client": "^12.0.0", + "@web3-storage/upload-api": "^7.3.3", + "@web3-storage/upload-client": "^12.0.1", "entail": "^2.1.1", - "multiformats": "^12.0.1", + "multiformats": "^12.1.3", "npm-run-all": "^4.1.5", "prettier": "^3.0.3", "typescript": "^5.2.2" @@ -1568,13 +1568,13 @@ } }, "node_modules/@ucanto/validator": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@ucanto/validator/-/validator-9.0.0.tgz", - "integrity": "sha512-ZgwVAHAMOzqNsl4fn1qTP1J5Y8oSB2qGn0NzMtSj2FwWzPUBog0WTXSiDqV6H60aNJt38l4pL+R4JaqUg0Z3uQ==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@ucanto/validator/-/validator-9.0.1.tgz", + "integrity": "sha512-H9GMOXHNW3vCv36eQZN1/h8zOXHEljRV5yNZ/huyOaJLVAKxt7Va1Ww8VBf2Ho/ac6P7jwvQRT7WgxaXx1/3Hg==", "dependencies": { "@ipld/car": "^5.1.0", "@ipld/dag-cbor": "^9.0.0", - "@ucanto/core": "^9.0.0", + "@ucanto/core": "^9.0.1", "@ucanto/interface": "^9.0.0", "multiformats": "^11.0.2" } @@ -1616,9 +1616,9 @@ } }, "node_modules/@web3-storage/access": { - "version": "18.0.0", - "resolved": "https://registry.npmjs.org/@web3-storage/access/-/access-18.0.0.tgz", - "integrity": "sha512-zDw5zlowMytd9HXCUwisYgBhjHohD4wx+Mzq33GfrJyjZOe203CzkuHG2JSsD3d9hx/HxJG2U/NlIJlFRMatSA==", + "version": "18.0.2", + "resolved": "https://registry.npmjs.org/@web3-storage/access/-/access-18.0.2.tgz", + "integrity": "sha512-luXwCNn/e7wBCFgfpW7qwmtjQZC2NuNApeE64x8Ho9ImzOSOpUWSF8CgzGo+XvG00332N1H6ArXsjVWn5OV+GA==", "dependencies": { "@ipld/car": "^5.1.1", "@ipld/dag-ucan": "^3.4.0", @@ -1628,28 +1628,28 @@ "@ucanto/interface": "^9.0.0", "@ucanto/principal": "^9.0.0", "@ucanto/transport": "^9.0.0", - "@ucanto/validator": "^9.0.0", - "@web3-storage/capabilities": "^12.0.0", + "@ucanto/validator": "^9.0.1", + "@web3-storage/capabilities": "^12.0.2", "@web3-storage/did-mailto": "^2.1.0", "bigint-mod-arith": "^3.1.2", "conf": "11.0.2", "multiformats": "^12.1.2", - "one-webcrypto": "git://github.com/web3-storage/one-webcrypto.git", + "one-webcrypto": "git+https://github.com/web3-storage/one-webcrypto.git", "p-defer": "^4.0.0", "type-fest": "^3.3.0", "uint8arrays": "^4.0.6" } }, "node_modules/@web3-storage/capabilities": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-12.0.0.tgz", - "integrity": "sha512-pn7scBIE/ZKc0F8nJlUjMfxU27E7WbRdxyiaSVN2obaKTB5/+QnHkaXv0wvlOzOiM0kpchrcIasJCdyCQdvWJQ==", + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-12.0.2.tgz", + "integrity": "sha512-nln74W3GQtP5mm7hNlJa5lzc0PEu4oTEqWZo5KMyLh+L38cYZOFO3iswPG3GGAv7nIBKs0t8Ij5Jpo0flNAMzw==", "dependencies": { "@ucanto/core": "^9.0.1", "@ucanto/interface": "^9.0.0", "@ucanto/principal": "^9.0.0", "@ucanto/transport": "^9.0.0", - "@ucanto/validator": "^9.0.0", + "@ucanto/validator": "^9.0.1", "@web3-storage/data-segment": "^3.2.0" } }, @@ -1779,48 +1779,16 @@ } }, "node_modules/@web3-storage/filecoin-client": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@web3-storage/filecoin-client/-/filecoin-client-3.1.1.tgz", - "integrity": "sha512-UVSke3IiBHrEvKkwyAjCkttOE2VC+ILEAQg5qVAm7CxApKkhjVHJRh9Xpm8JYI7gZcb6m8/YdgFLOXTjtz3zvQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@web3-storage/filecoin-client/-/filecoin-client-3.1.2.tgz", + "integrity": "sha512-yqZv3H30fKwGbgBbn2qablqtUCXEYp9qaNx431VGQm5YrsUrcE1ENSXX6Z0t0U7qu6QG/4hKuJlmcNxvLiTeQQ==", "dependencies": { "@ipld/dag-ucan": "^3.4.0", "@ucanto/client": "^9.0.0", "@ucanto/core": "^9.0.1", "@ucanto/interface": "^9.0.0", "@ucanto/transport": "^9.0.0", - "@web3-storage/capabilities": "^11.4.1" - } - }, - "node_modules/@web3-storage/filecoin-client/node_modules/@web3-storage/capabilities": { - "version": "11.4.1", - "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-11.4.1.tgz", - "integrity": "sha512-PjIewEg/T3wfNavxzsZZ5MpH2WBldNz94qOQOKg5iH/4UrS8SPWWGsJx/Tu760O+PFhpTFwvi5cHCtkb08OdAA==", - "dependencies": { - "@ucanto/core": "^9.0.1", - "@ucanto/interface": "^9.0.0", - "@ucanto/principal": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@ucanto/validator": "^9.0.0", - "@web3-storage/data-segment": "^3.2.0" - } - }, - "node_modules/@web3-storage/filecoin-client/node_modules/@web3-storage/data-segment": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@web3-storage/data-segment/-/data-segment-3.2.0.tgz", - "integrity": "sha512-SM6eNumXzrXiQE2/J59+eEgCRZNYPxKhRoHX2QvV3/scD4qgcf4g+paWBc3UriLEY1rCboygGoPsnqYJNyZyfA==", - "dependencies": { - "@ipld/dag-cbor": "^9.0.5", - "multiformats": "^11.0.2", - "sync-multihash-sha2": "^1.0.0" - } - }, - "node_modules/@web3-storage/filecoin-client/node_modules/multiformats": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.2.tgz", - "integrity": "sha512-b5mYMkOkARIuVZCpvijFj9a6m5wMVLC7cf/jIPd5D/ARDOfLC5+IFkbgDXQgcU2goIsTD/O9NY4DI/Mt4OGvlg==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" + "@web3-storage/capabilities": "^12.0.2" } }, "node_modules/@web3-storage/sigv4": { @@ -1833,9 +1801,9 @@ } }, "node_modules/@web3-storage/upload-api": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@web3-storage/upload-api/-/upload-api-7.3.2.tgz", - "integrity": "sha512-qCkXosQnkpCiLa1HzeGRPjwgScOUSll2Y+jY18MaKaT7RdWw8kmlTYxnesLXw/+nwTwgFeG0hQ2WFTGGNrKpCA==", + "version": "7.3.3", + "resolved": "https://registry.npmjs.org/@web3-storage/upload-api/-/upload-api-7.3.3.tgz", + "integrity": "sha512-oNWB2IHsUTlsmTnNLk/ZHmxno2YpkamD6xRfmkT/cGt7Wb/uXHdqPz8tRCrQqjLqpTHiwk/bteMijnhJmsz0IA==", "dev": true, "dependencies": { "@ucanto/client": "^9.0.0", @@ -1843,9 +1811,9 @@ "@ucanto/principal": "^9.0.0", "@ucanto/server": "^9.0.1", "@ucanto/transport": "^9.0.0", - "@ucanto/validator": "^9.0.0", - "@web3-storage/access": "^17.1.0", - "@web3-storage/capabilities": "^11.4.1", + "@ucanto/validator": "^9.0.1", + "@web3-storage/access": "^18.0.0", + "@web3-storage/capabilities": "^12.0.1", "@web3-storage/did-mailto": "^2.1.0", "@web3-storage/filecoin-api": "^4.1.1", "multiformats": "^12.1.2", @@ -1855,71 +1823,10 @@ "node": ">=16.15" } }, - "node_modules/@web3-storage/upload-api/node_modules/@web3-storage/access": { - "version": "17.1.0", - "resolved": "https://registry.npmjs.org/@web3-storage/access/-/access-17.1.0.tgz", - "integrity": "sha512-CRVjMfO3LynU9wwCy1XHvWSVlOrccCaqAPPO1siLS/UVYLb4ZT+XuHrM9cYhqZMsBD7yewQ5JG0TDoy/UP7wOQ==", - "dev": true, - "dependencies": { - "@ipld/car": "^5.1.1", - "@ipld/dag-ucan": "^3.4.0", - "@scure/bip39": "^1.2.1", - "@ucanto/client": "^9.0.0", - "@ucanto/core": "^9.0.0", - "@ucanto/interface": "^9.0.0", - "@ucanto/principal": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@ucanto/validator": "^9.0.0", - "@web3-storage/capabilities": "^11.4.0", - "@web3-storage/did-mailto": "^2.1.0", - "bigint-mod-arith": "^3.1.2", - "conf": "11.0.2", - "multiformats": "^12.1.2", - "one-webcrypto": "git://github.com/web3-storage/one-webcrypto.git", - "p-defer": "^4.0.0", - "type-fest": "^3.3.0", - "uint8arrays": "^4.0.6" - } - }, - "node_modules/@web3-storage/upload-api/node_modules/@web3-storage/capabilities": { - "version": "11.4.1", - "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-11.4.1.tgz", - "integrity": "sha512-PjIewEg/T3wfNavxzsZZ5MpH2WBldNz94qOQOKg5iH/4UrS8SPWWGsJx/Tu760O+PFhpTFwvi5cHCtkb08OdAA==", - "dev": true, - "dependencies": { - "@ucanto/core": "^9.0.1", - "@ucanto/interface": "^9.0.0", - "@ucanto/principal": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@ucanto/validator": "^9.0.0", - "@web3-storage/data-segment": "^3.2.0" - } - }, - "node_modules/@web3-storage/upload-api/node_modules/@web3-storage/data-segment": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@web3-storage/data-segment/-/data-segment-3.2.0.tgz", - "integrity": "sha512-SM6eNumXzrXiQE2/J59+eEgCRZNYPxKhRoHX2QvV3/scD4qgcf4g+paWBc3UriLEY1rCboygGoPsnqYJNyZyfA==", - "dev": true, - "dependencies": { - "@ipld/dag-cbor": "^9.0.5", - "multiformats": "^11.0.2", - "sync-multihash-sha2": "^1.0.0" - } - }, - "node_modules/@web3-storage/upload-api/node_modules/@web3-storage/data-segment/node_modules/multiformats": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.2.tgz", - "integrity": "sha512-b5mYMkOkARIuVZCpvijFj9a6m5wMVLC7cf/jIPd5D/ARDOfLC5+IFkbgDXQgcU2goIsTD/O9NY4DI/Mt4OGvlg==", - "dev": true, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/@web3-storage/upload-client": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@web3-storage/upload-client/-/upload-client-12.0.0.tgz", - "integrity": "sha512-iQZFIxjsO/NgkPVgpAaRTWPKhvvf83eQFjws23ZVgc9UNVt0kW5pUb6FdEQauMg2HJ46uoQ2BLVmGrHm9QPagw==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@web3-storage/upload-client/-/upload-client-12.0.1.tgz", + "integrity": "sha512-YndHJ9MbimkzyxzYuKZqKhI22U6zd7lnJpU0hGh37P6ZVK0IyZR6RMV/G9bPcm3mfyGoX6KxHzPF7WxDWdAWrA==", "dependencies": { "@ipld/car": "^5.2.2", "@ipld/dag-cbor": "^9.0.6", @@ -1928,7 +1835,7 @@ "@ucanto/client": "^9.0.0", "@ucanto/interface": "^9.0.0", "@ucanto/transport": "^9.0.0", - "@web3-storage/capabilities": "^11.4.0", + "@web3-storage/capabilities": "^12.0.1", "fr32-sha2-256-trunc254-padded-binary-tree-multihash": "^3.1.0", "ipfs-utils": "^9.0.14", "multiformats": "^12.1.2", @@ -1937,42 +1844,10 @@ "varint": "^6.0.0" } }, - "node_modules/@web3-storage/upload-client/node_modules/@web3-storage/capabilities": { - "version": "11.4.1", - "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-11.4.1.tgz", - "integrity": "sha512-PjIewEg/T3wfNavxzsZZ5MpH2WBldNz94qOQOKg5iH/4UrS8SPWWGsJx/Tu760O+PFhpTFwvi5cHCtkb08OdAA==", - "dependencies": { - "@ucanto/core": "^9.0.1", - "@ucanto/interface": "^9.0.0", - "@ucanto/principal": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@ucanto/validator": "^9.0.0", - "@web3-storage/data-segment": "^3.2.0" - } - }, - "node_modules/@web3-storage/upload-client/node_modules/@web3-storage/data-segment": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@web3-storage/data-segment/-/data-segment-3.2.0.tgz", - "integrity": "sha512-SM6eNumXzrXiQE2/J59+eEgCRZNYPxKhRoHX2QvV3/scD4qgcf4g+paWBc3UriLEY1rCboygGoPsnqYJNyZyfA==", - "dependencies": { - "@ipld/dag-cbor": "^9.0.5", - "multiformats": "^11.0.2", - "sync-multihash-sha2": "^1.0.0" - } - }, - "node_modules/@web3-storage/upload-client/node_modules/@web3-storage/data-segment/node_modules/multiformats": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.2.tgz", - "integrity": "sha512-b5mYMkOkARIuVZCpvijFj9a6m5wMVLC7cf/jIPd5D/ARDOfLC5+IFkbgDXQgcU2goIsTD/O9NY4DI/Mt4OGvlg==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/@web3-storage/w3up-client": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@web3-storage/w3up-client/-/w3up-client-11.0.0.tgz", - "integrity": "sha512-VpS3xBhidcAdsLJdlp/lIAinRq7hug7wXL8M2dMKGG1zus11E4lzJ/uZOHLDbtjXfx58niQcHspZRpMJVCGuaw==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@web3-storage/w3up-client/-/w3up-client-11.0.2.tgz", + "integrity": "sha512-9pcTwqxMJ/z8NzmxYctz1E81z0ySBKZOEP1qfdGqFqpk/JT4qojgNPrHEBRUoIssI8uHuO8bn2gOCtjVhFOPUw==", "dependencies": { "@ipld/dag-ucan": "^3.4.0", "@ucanto/client": "^9.0.0", @@ -1980,11 +1855,11 @@ "@ucanto/interface": "^9.0.0", "@ucanto/principal": "^9.0.0", "@ucanto/transport": "^9.0.0", - "@web3-storage/access": "^18.0.0", - "@web3-storage/capabilities": "^12.0.0", + "@web3-storage/access": "^18.0.2", + "@web3-storage/capabilities": "^12.0.2", "@web3-storage/did-mailto": "^2.1.0", - "@web3-storage/filecoin-client": "^3.1.1", - "@web3-storage/upload-client": "^12.0.0" + "@web3-storage/filecoin-client": "^3.1.2", + "@web3-storage/upload-client": "^12.0.1" } }, "node_modules/@zxing/text-encoding": { @@ -3601,9 +3476,9 @@ } }, "node_modules/files-from-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/files-from-path/-/files-from-path-1.0.0.tgz", - "integrity": "sha512-EobUbrzh1fPOZpQvDdTikGpCs+ZDcTNyBOnFuHvW2BQXEkMSPbEPQ0eVTQrz0oHlBcPS9Lnw+uPzACfft1sDYg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/files-from-path/-/files-from-path-1.0.2.tgz", + "integrity": "sha512-sGHhGxKJ/e52QGF6qRrThkU1tVBIfnFydAP6Ukeg2i/pVDlS3klrWb8azLmh7seqqEiBZfNEWBV9sHgu1RCx5g==", "dependencies": { "graceful-fs": "^4.2.10" }, @@ -4922,9 +4797,9 @@ } }, "node_modules/multiformats": { - "version": "12.1.2", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.2.tgz", - "integrity": "sha512-6mRIsrZXyw5xNPO31IGBMmxgDXBSgCGDsBAtazkZ02ip4hMwZNrQvfxXZtytRoBSWuzSq5f9VmMnXj76fIz5FQ==", + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.3.tgz", + "integrity": "sha512-eajQ/ZH7qXZQR2AgtfpmSMizQzmyYVmCql7pdhldPuYQi4atACekbJaQplk6dWyIi10jCaFnd6pqvcEFXjbaJw==", "engines": { "node": ">=16.0.0", "npm": ">=7.0.0" diff --git a/package.json b/package.json index 498f967..baeeba8 100644 --- a/package.json +++ b/package.json @@ -36,33 +36,33 @@ "@ucanto/principal": "^9.0.0", "@ucanto/server": "^9.0.1", "@web-std/blob": "^3.0.5", - "@web3-storage/capabilities": "^12.0.0", + "@web3-storage/capabilities": "^12.0.2", "@web3-storage/eslint-config-w3up": "^1.0.0", "@web3-storage/sigv4": "^1.0.2", - "@web3-storage/upload-api": "^7.3.2", - "@web3-storage/upload-client": "^12.0.0", + "@web3-storage/upload-api": "^7.3.3", + "@web3-storage/upload-client": "^12.0.1", "entail": "^2.1.1", - "multiformats": "^12.0.1", + "multiformats": "^12.1.3", "npm-run-all": "^4.1.5", "prettier": "^3.0.3", "typescript": "^5.2.2" }, "dependencies": { + "@inquirer/core": "^5.1.1", + "@inquirer/prompts": "^3.3.0", "@ipld/car": "^5.2.4", "@ipld/dag-json": "^10.1.5", "@ipld/dag-ucan": "^3.4.0", "@ucanto/client": "^9.0.0", "@ucanto/core": "^9.0.0", "@ucanto/transport": "^9.0.0", - "@web3-storage/access": "18.0.0", + "@web3-storage/access": "^18.0.2", "@web3-storage/data-segment": "^5.0.0", - "@web3-storage/w3up-client": "^11.0.0", "@web3-storage/did-mailto": "^2.1.0", - "chalk": "^5.3.0", + "@web3-storage/w3up-client": "^11.0.2", "ansi-escapes": "^6.2.0", - "@inquirer/prompts": "^3.3.0", - "@inquirer/core": "^5.1.1", - "files-from-path": "^1.0.0", + "chalk": "^5.3.0", + "files-from-path": "^1.0.2", "open": "^9.1.0", "ora": "^7.0.1", "pretty-tree": "^1.0.0", diff --git a/test/bin.spec.js b/test/bin.spec.js index 22d8c37..6931a42 100644 --- a/test/bin.spec.js +++ b/test/bin.spec.js @@ -314,7 +314,7 @@ export const testSpace = { 'w3 space add': test(async (assert, context) => { const { env } = context - const spaceDID = await createSpace(context, { env: env.alice }) + const spaceDID = await loginAndCreateSpace(context, { env: env.alice }) const whosBob = await w3.args(['whoami']).env(env.bob).join() @@ -388,7 +388,7 @@ export const testSpace = { .env(context.env.alice) .join() - const spaceDID = await createSpace(context) + const spaceDID = await loginAndCreateSpace(context) const spaceList = await w3 .args(['space', 'ls']) @@ -400,7 +400,7 @@ export const testSpace = { }), 'w3 space use': test(async (assert, context) => { - const spaceDID = await createSpace(context, { env: context.env.alice }) + const spaceDID = await loginAndCreateSpace(context, { env: context.env.alice }) const listDefault = await w3 .args(['space', 'ls']) @@ -484,7 +484,7 @@ export const testSpace = { }), 'w3 space info': test(async (assert, context) => { - const spaceDID = await createSpace(context, { + const spaceDID = await loginAndCreateSpace(context, { customer: null, }) @@ -521,7 +521,7 @@ export const testSpace = { }), 'w3 space provision --coupon': test(async (assert, context) => { - const spaceDID = await createSpace(context, { customer: null }) + const spaceDID = await loginAndCreateSpace(context, { customer: null }) assert.deepEqual( await context.provisionsStorage.getStorageProviders(spaceDID), @@ -619,7 +619,7 @@ export const testW3Up = { }), 'w3 ls': test(async (assert, context) => { - await createSpace(context) + await loginAndCreateSpace(context) const list0 = await w3.args(['ls']).env(context.env.alice).join() assert.match(list0.output, /No uploads in space/) @@ -635,7 +635,7 @@ export const testW3Up = { }), 'w3 remove': test(async (assert, context) => { - await createSpace(context) + await loginAndCreateSpace(context) const rm = await w3 .args([ @@ -651,7 +651,7 @@ export const testW3Up = { }), 'w3 remove - no such upload': test(async (assert, context) => { - await createSpace(context) + await loginAndCreateSpace(context) const rm = await w3 .args([ @@ -670,7 +670,7 @@ export const testW3Up = { }), 'w3 remove --shards': test(async (assert, context) => { - await createSpace(context) + await loginAndCreateSpace(context) const up = await w3 .args(['up', 'test/fixtures/pinpie.jpg']) @@ -701,7 +701,7 @@ export const testW3Up = { }), 'w3 remove --shards - no shards to remove': test(async (assert, context) => { - const space = await createSpace(context) + const space = await loginAndCreateSpace(context) const root = parseLink( 'bafybeih2k7ughhfwedltjviunmn3esueijz34snyay77zmsml5w24tqamm' @@ -732,7 +732,7 @@ export const testDelegation = { const env = context.env.alice const { bob } = Test - const spaceDID = await createSpace(context) + const spaceDID = await loginAndCreateSpace(context) const proofPath = path.join( os.tmpdir(), @@ -771,7 +771,7 @@ export const testDelegation = { 'w3 delegation create': test(async (assert, context) => { const env = context.env.alice const { bob } = Test - await createSpace(context) + await loginAndCreateSpace(context) const delegate = await w3 .args(['delegation', 'create', bob.did()]) @@ -785,7 +785,7 @@ export const testDelegation = { 'w3 delegation ls --json': test(async (assert, context) => { const { mallory } = Test - const spaceDID = await createSpace(context) + const spaceDID = await loginAndCreateSpace(context) // delegate to mallory await w3 @@ -809,7 +809,7 @@ export const testDelegation = { 'w3 delegation revoke': test(async (assert, context) => { const env = context.env.alice const { mallory } = Test - await createSpace(context) + await loginAndCreateSpace(context) const delegationPath = `${os.tmpdir()}/delegation-${Date.now()}.ucan` await w3 @@ -840,7 +840,7 @@ export const testDelegation = { assert.match(revoke.output, pattern`delegation ${cid} revoked`) - await createSpace(context, { + await loginAndCreateSpace(context, { env: context.env.bob, customer: 'bob@super.host', }) @@ -874,7 +874,7 @@ export const testProof = { 'w3 proof add': test(async (assert, context) => { const { env } = context - const spaceDID = await createSpace(context, { env: env.alice }) + const spaceDID = await loginAndCreateSpace(context, { env: env.alice }) const whoisbob = await w3.args(['whoami']).env(env.bob).join() const bobDID = DID.parse(whoisbob.output.trim()).did() const proofPath = path.join( @@ -939,7 +939,7 @@ export const testProof = { }), 'w3 proof ls': test(async (assert, context) => { const { env } = context - const spaceDID = await createSpace(context, { env: env.alice }) + const spaceDID = await loginAndCreateSpace(context, { env: env.alice }) const whoisalice = await w3.args(['whoami']).env(env.alice).join() const aliceDID = DID.parse(whoisalice.output.trim()).did() @@ -976,7 +976,7 @@ export const testProof = { export const testStore = { 'w3 can store add': test(async (assert, context) => { - await createSpace(context) + await loginAndCreateSpace(context) const { error } = await w3 .args(['can', 'store', 'add', 'test/fixtures/pinpie.car']) @@ -989,7 +989,7 @@ export const testStore = { export const testCan = { 'w3 can upload add': test(async (assert, context) => { - await createSpace(context) + await loginAndCreateSpace(context) const carPath = 'test/fixtures/pinpie.car' const reader = await CarReader.fromBytes( @@ -1015,7 +1015,7 @@ export const testCan = { }), 'w3 can upload ls': test(async (assert, context) => { - await createSpace(context) + await loginAndCreateSpace(context) await w3 .args(['up', 'test/fixtures/pinpie.jpg']) @@ -1030,7 +1030,7 @@ export const testCan = { assert.ok(dagJSON.parse(list.output)) }), 'w3 can upload rm': test(async (assert, context) => { - await createSpace(context) + await loginAndCreateSpace(context) const up = await w3 .args(['up', 'test/fixtures/pinpie.jpg']) @@ -1071,7 +1071,7 @@ export const testCan = { assert.ok(rm.status.success()) }), 'w3 can store ls': test(async (assert, context) => { - await createSpace(context) + await loginAndCreateSpace(context) await w3 .args(['up', 'test/fixtures/pinpie.jpg']) @@ -1086,7 +1086,7 @@ export const testCan = { assert.ok(dagJSON.parse(list.output)) }), 'w3 can store rm': test(async (assert, context) => { - const space = await createSpace(context) + const space = await loginAndCreateSpace(context) await w3 .args(['up', 'test/fixtures/pinpie.jpg']) @@ -1132,7 +1132,7 @@ export const testCan = { assert.ok(rm.status.success()) }), 'can filecoin info with not found': test(async (assert, context) => { - await createSpace(context) + await loginAndCreateSpace(context) const up = await w3 .args(['up', 'test/fixtures/pinpie.jpg', '--verbose']) @@ -1211,28 +1211,18 @@ export const selectPlan = async ( /** * @param {Test.Context} context * @param {object} options - * @param {DIDMailto.EmailAddress} [options.email] * @param {DIDMailto.EmailAddress|null} [options.customer] * @param {string} [options.name] - * @param {Plan} [options.plan] * @param {Record} [options.env] */ export const createSpace = async ( context, { - email = 'alice@web.mail', - customer = email, + customer = 'alice@web.mail', name = 'home', - plan = 'did:web:free.web3.storage', - env = context.env.alice, + env = context.env.alice } = {} ) => { - await login(context, { email, env }) - - if (customer != null && plan != null) { - await selectPlan(context, { email: customer, plan }) - } - const { output } = await w3 .args([ 'space', @@ -1250,6 +1240,34 @@ export const createSpace = async ( return SpaceDID.from(did) } +/** + * @param {Test.Context} context + * @param {object} options + * @param {DIDMailto.EmailAddress} [options.email] + * @param {DIDMailto.EmailAddress|null} [options.customer] + * @param {string} [options.name] + * @param {Plan} [options.plan] + * @param {Record} [options.env] + */ +export const loginAndCreateSpace = async ( + context, + { + email = 'alice@web.mail', + customer = email, + name = 'home', + plan = 'did:web:free.web3.storage', + env = context.env.alice + } = {} +) => { + await login(context, { email, env }) + + if (customer != null && plan != null) { + await selectPlan(context, { email: customer, plan }) + } + + return createSpace(context, { customer, name, env }) +} + /** * @param {Test.Context} context * @param {object} options