From 9ec9d9b2bb431d7644cf6fc2fb3de4354e231114 Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Mon, 13 Feb 2023 15:59:30 +0800 Subject: [PATCH 01/17] feat: initial pass at can {store|upload} ls implement `can store ls` and `can upload ls` to parity with `ls`. --- bin.js | 15 ++++++++++++++- can.js | 31 ++++++++++++++++++++++++++++++- index.js | 48 ++++++++++++++++-------------------------------- lib.js | 32 ++++++++++++++++++++++++++++++++ tmp.txt | 0 5 files changed, 92 insertions(+), 34 deletions(-) create mode 100644 tmp.txt diff --git a/bin.js b/bin.js index d86998e..02ddd17 100755 --- a/bin.js +++ b/bin.js @@ -20,7 +20,9 @@ import { } from './index.js' import { storeAdd, - uploadAdd + storeList, + uploadAdd, + uploadList } from './can.js' const cli = sade('w3') @@ -112,8 +114,19 @@ cli.command('can store add ') .describe('Store a CAR file with the service.') .action(storeAdd) +cli.command('can store ls') + .describe('List CAR files in the current space.') + .option('--json', 'Format as newline delimted JSON') + .action(storeList) + cli.command('can upload add ') .describe('Register an upload - a DAG with the given root data CID that is stored in the given CAR shard(s), identified by CAR CIDs.') .action(uploadAdd) +cli.command('can upload ls') + .describe('List uploads in the current space.') + .option('--json', 'Format as newline delimted JSON') + .option('--shards', 'Pretty print with shards in output') + .action(uploadList) + cli.parse(process.argv) diff --git a/can.js b/can.js index 658d2e5..7ec6393 100644 --- a/can.js +++ b/can.js @@ -2,7 +2,7 @@ import fs from 'fs' import { CID } from 'multiformats' import ora from 'ora' -import { getClient } from './lib.js' +import { getClient, uploadListResponseToString, storeListResponseToString } from './lib.js' /** * @param {string} carPath @@ -27,6 +27,20 @@ export async function storeAdd (carPath) { spinner.stopAndPersist({ symbol: '⁂', text: `Stored ${cid}` }) } +/** + * Print out all the CARs in the current space. + * @param {object} opts + * @param {boolean} [opts.json] + */ +export async function storeList (opts) { + const client = await getClient() + + const spinner = ora('Listing CARs').start() + const res = await client.capability.store.list() + spinner.stop() + console.log(storeListResponseToString(res, opts)) +} + /** * @param {string} root * @param {string} shard @@ -60,3 +74,18 @@ export async function uploadAdd (root, shard, opts) { await client.capability.upload.add(rootCID, shards) spinner.stopAndPersist({ symbol: '⁂', text: `Upload added ${rootCID}` }) } + +/** + * Print out all the uploads in the current space. + * @param {object} opts + * @param {boolean} [opts.json] + * @param {boolean} [opts.shards] + */ +export async function uploadList (opts) { + const client = await getClient() + + const spinner = ora('Listing uploads').start() + const res = await client.capability.upload.list() + spinner.stop() + console.log(uploadListResponseToString(res, opts)) +} diff --git a/index.js b/index.js index 7efc598..6445074 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,10 @@ import fs from 'fs' import ora, { oraPromise } from 'ora' -import tree from 'pretty-tree' import { Readable } from 'stream' import { CID } from 'multiformats/cid' import * as DID from '@ipld/dag-ucan/did' import { CarWriter } from '@ipld/car' -import { getClient, checkPathsExist, filesize, readProof, filesFromPaths } from './lib.js' +import { getClient, checkPathsExist, filesize, readProof, filesFromPaths, uploadListResponseToString } from './lib.js' /** * @param {string} firstPath @@ -13,7 +12,7 @@ import { getClient, checkPathsExist, filesize, readProof, filesFromPaths } from * @param {string[]} opts._ * @param {boolean} [opts.hidden] */ -export async function upload (firstPath, opts) { +export async function upload(firstPath, opts) { const paths = checkPathsExist([firstPath, ...opts._]) const client = await getClient() const hidden = !!opts.hidden @@ -55,7 +54,7 @@ export async function upload (firstPath, opts) { * @param {boolean} [opts.json] * @param {boolean} [opts.shards] */ -export async function list (opts) { +export async function list(opts) { const client = await getClient() let count = 0 let res @@ -63,22 +62,7 @@ export async function list (opts) { res = await client.capability.upload.list() count += res.results.length if (res.results.length) { - if (opts.json) { - console.log(res.results.map(({ root, shards }) => JSON.stringify({ - root: root.toString(), - shards: shards?.map(s => s.toString()) - })).join('\n')) - } else if (opts.shards) { - console.log(res.results.map(({ root, shards }) => tree({ - label: root.toString(), - nodes: [{ - label: 'shards', - leaf: shards?.map(s => s.toString()) - }] - })).join('\n')) - } else { - console.log(res.results.map(({ root }) => root.toString()).join('\n')) - } + console.log(uploadListResponseToString(res)) } } while (res.cursor && res.results.length) @@ -92,7 +76,7 @@ export async function list (opts) { * @param {object} opts * @param {boolean} [opts.shards] */ -export async function remove (rootCid, opts) { +export async function remove(rootCid, opts) { let root try { root = CID.parse(rootCid.trim()) @@ -122,7 +106,7 @@ export async function remove (rootCid, opts) { const { shards } = upload console.log(`⁂ removing ${shards.length} shard${shards.length === 1 ? '' : 's'}`) - function removeShard (shard) { + function removeShard(shard) { return oraPromise(client.capability.store.remove(shard), { text: `${shard}`, successText: `${shard} removed`, @@ -140,7 +124,7 @@ export async function remove (rootCid, opts) { /** * @param {string} name */ -export async function createSpace (name) { +export async function createSpace(name) { const client = await getClient() const space = await client.createSpace(name) await client.setCurrentSpace(space.did()) @@ -150,7 +134,7 @@ export async function createSpace (name) { /** * @param {string} email */ -export async function registerSpace (email) { +export async function registerSpace(email) { const client = await getClient() let space = client.currentSpace() if (space === undefined) { @@ -180,14 +164,14 @@ export async function registerSpace (email) { /** * @param {string} proofPath */ -export async function addSpace (proofPath) { +export async function addSpace(proofPath) { const client = await getClient() const delegation = await readProof(proofPath) const space = await client.addSpace(delegation) console.log(space.did()) } -export async function listSpaces () { +export async function listSpaces() { const client = await getClient() const current = client.currentSpace() for (const space of client.spaces()) { @@ -199,7 +183,7 @@ export async function listSpaces () { /** * @param {string} did */ -export async function useSpace (did) { +export async function useSpace(did) { const client = await getClient() const spaces = client.spaces() const space = spaces.find(s => s.did() === did) ?? spaces.find(s => s.name() === did) @@ -220,7 +204,7 @@ export async function useSpace (did) { * @param {number} [opts.expiration] * @param {string} [opts.output] */ -export async function createDelegation (audienceDID, opts) { +export async function createDelegation(audienceDID, opts) { const client = await getClient() if (client.currentSpace() == null) { throw new Error('no current space, use `w3 space register` to create one.') @@ -254,7 +238,7 @@ export async function createDelegation (audienceDID, opts) { * @param {object} opts * @param {boolean} [opts.json] */ -export async function listDelegations (opts) { +export async function listDelegations(opts) { const client = await getClient() const delegations = client.delegations() if (opts.json) { @@ -283,7 +267,7 @@ export async function listDelegations (opts) { * @param {boolean} [opts.json] * @param {boolean} [opts.dry-run] */ -export async function addProof (proofPath, opts) { +export async function addProof(proofPath, opts) { const client = await getClient() let proof try { @@ -311,7 +295,7 @@ export async function addProof (proofPath, opts) { * @param {object} opts * @param {boolean} [opts.json] */ -export async function listProofs (opts) { +export async function listProofs(opts) { const client = await getClient() const proofs = client.proofs() if (opts.json) { @@ -334,7 +318,7 @@ export async function listProofs (opts) { } } -export async function whoami () { +export async function whoami() { const client = await getClient() const who = client.agent() console.log(who.did()) diff --git a/lib.js b/lib.js index a82271e..62e13c6 100644 --- a/lib.js +++ b/lib.js @@ -1,5 +1,6 @@ import fs from 'fs' import path from 'path' +import tree from 'pretty-tree' import { Readable } from 'stream' import { importDAG } from '@ucanto/core/delegation' import { connect } from '@ucanto/client' @@ -193,3 +194,34 @@ async function * filesFromDir (dir, filter) { } } } + +export function uploadListResponseToString(res, opts) { + if (opts.json) { + return res.results.map(({ root, shards }) => JSON.stringify({ + root: root.toString(), + shards: shards?.map(s => s.toString()) + })).join('\n') + } else if (opts.shards) { + return res.results.map(({ root, shards }) => tree({ + label: root.toString(), + nodes: [{ + label: 'shards', + leaf: shards?.map(s => s.toString()) + }] + })).join('\n') + } else { + return res.results.map(({ root }) => root.toString()).join('\n') + } +} + +export function storeListResponseToString(res, opts) { + if (opts.json) { + return res.results.map(({ link, size, insertedAt }) => JSON.stringify({ + link: link.toString(), + size, + insertedAt + })).join('\n') + } else { + return res.results.map(({ link }) => link.toString()).join('\n') + } +} diff --git a/tmp.txt b/tmp.txt new file mode 100644 index 0000000..e69de29 From ec98144d2477560e60ba2ddca0b5c8643675f3a9 Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Mon, 13 Feb 2023 16:37:19 +0800 Subject: [PATCH 02/17] chore: documentation improvements - fix spelling error - standardize on * for arg lists in readme - add docs for `can upload ls` and `can store ls` --- README.md | 29 +++++++++++++++++++---------- bin.js | 12 ++++++------ 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 230444e..d8e856a 100644 --- a/README.md +++ b/README.md @@ -68,24 +68,24 @@ w3 up recipies.txt Upload file(s) to web3.storage. The IPFS Content ID (CID) for your files is calculated on your machine, and sent up along with your files. web3.storage makes your content available on the IPFS network -- `--no-wrap` Don't wrap input files with a directory. -- `-H, --hidden` Include paths that start with ".". -- `-c, --car` File is a CAR file. -- `--shard-size` Shard uploads into CAR files of approximately this size in bytes. -- `--concurrent-requests` Send up to this many CAR shards concurrently. +* `--no-wrap` Don't wrap input files with a directory. +* `-H, --hidden` Include paths that start with ".". +* `-c, --car` File is a CAR file. +* `--shard-size` Shard uploads into CAR files of approximately this size in bytes. +* `--concurrent-requests` Send up to this many CAR shards concurrently. ### `w3 ls` List all the uploads registered in the current space. -- `--json` Format as newline delimted JSON -- `--shards` Pretty print with shards in output +* `--json` Format as newline delimted JSON +* `--shards` Pretty print with shards in output ### `w3 rm ` Remove an upload from the uploads listing. Note that this command does not remove the data from the IPFS network, nor does it remove it from space storage (by default). -- `--shards` Also remove all shards referenced by the upload from the store. Use with caution and ensure other uploads do not reference the same shards. +* `--shards` Also remove all shards referenced by the upload from the store. Use with caution and ensure other uploads do not reference the same shards. ### `w3 open ` @@ -136,7 +136,7 @@ Create a delegation to the passed audience for the given abilities with the _cur List delegations created by this agent for others. -- `--json` Format as newline delimted JSON +* `--json` Format as newline delimted JSON ### `w3 proof add ` @@ -146,7 +146,7 @@ Add a proof delegated to this agent. The proof is a CAR encoded delegation to _t List proofs of delegated capabilities. Proofs are delegations with an audience matching the agent DID. -- `--json` Format as newline delimted JSON +* `--json` Format as newline delimted JSON ### `w3 can space info ` @@ -158,6 +158,10 @@ Store a [CAR](https://ipld.io/specs/transport/car/carv1/) file to web3.storage. ### `w3 can store ls` +List CARs in the current space. + +* `--json` Format as newline delimted JSON + ### `w3 can store rm ` ### `w3 can upload add [shard-cid...]` @@ -166,6 +170,11 @@ Register an upload - a DAG with the given root data CID that is stored in the gi ### `w3 can upload ls` +List uploads in the current space. + +* `--json` Format as newline delimted JSON +* `--shards` Pretty print with shards in output + ### `w3 can upload rm ` ## Contributing diff --git a/bin.js b/bin.js index 02ddd17..1c45d1c 100755 --- a/bin.js +++ b/bin.js @@ -48,7 +48,7 @@ cli.command('open ') cli.command('ls') .alias('list') .describe('List uploads in the current space') - .option('--json', 'Format as newline delimted JSON') + .option('--json', 'Format as newline delimited JSON') .option('--shards', 'Pretty print with shards in output') .action(list) @@ -96,18 +96,18 @@ cli.command('delegation create ') cli.command('delegation ls') .describe('List delegations created by this agent for others.') - .option('--json', 'Format as newline delimted JSON') + .option('--json', 'Format as newline delimited JSON') .action(listDelegations) cli.command('proof add ') .describe('Add a proof delegated to this agent.') - .option('--json', 'Format as newline delimted JSON') + .option('--json', 'Format as newline delimited JSON') .option('--dry-run', 'Decode and view the proof but do not add it') .action(addProof) cli.command('proof ls') .describe('List proofs of capabilities delegated to this agent.') - .option('--json', 'Format as newline delimted JSON') + .option('--json', 'Format as newline delimited JSON') .action(listProofs) cli.command('can store add ') @@ -116,7 +116,7 @@ cli.command('can store add ') cli.command('can store ls') .describe('List CAR files in the current space.') - .option('--json', 'Format as newline delimted JSON') + .option('--json', 'Format as newline delimited JSON') .action(storeList) cli.command('can upload add ') @@ -125,7 +125,7 @@ cli.command('can upload add ') cli.command('can upload ls') .describe('List uploads in the current space.') - .option('--json', 'Format as newline delimted JSON') + .option('--json', 'Format as newline delimited JSON') .option('--shards', 'Pretty print with shards in output') .action(uploadList) From 94c1088842ddd583aec33ab99755b5a57b42032d Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Mon, 13 Feb 2023 17:38:22 +0800 Subject: [PATCH 03/17] feat: add --size and --cursor to */list add support for setting size and cursor caveats in `can store ls` and `can upload ls` to support this usage, also add a `--raw` output formatting option to `ls`, `can store ls` and `can upload ls` that will allow users to get paging cursors from the response --- bin.js | 7 +++++++ can.js | 22 +++++++++++++++++++++- index.js | 1 + lib.js | 8 ++++++-- 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/bin.js b/bin.js index 1c45d1c..331ec2b 100755 --- a/bin.js +++ b/bin.js @@ -48,6 +48,7 @@ cli.command('open ') cli.command('ls') .alias('list') .describe('List uploads in the current space') + .option('--raw', 'Format full response as JSON') .option('--json', 'Format as newline delimited JSON') .option('--shards', 'Pretty print with shards in output') .action(list) @@ -116,7 +117,10 @@ cli.command('can store add ') cli.command('can store ls') .describe('List CAR files in the current space.') + .option('--raw', 'Format full response as JSON') .option('--json', 'Format as newline delimited JSON') + .option('--size', 'The desired number of results to return') + .option('--cursor', 'An opaque string included in a prior store/list response that allows the service to provide the next "page" of results') .action(storeList) cli.command('can upload add ') @@ -125,8 +129,11 @@ cli.command('can upload add ') cli.command('can upload ls') .describe('List uploads in the current space.') + .option('--raw', 'Format full response as JSON') .option('--json', 'Format as newline delimited JSON') .option('--shards', 'Pretty print with shards in output') + .option('--size', 'The desired number of results to return') + .option('--cursor', 'An opaque string included in a prior upload/list response that allows the service to provide the next "page" of results') .action(uploadList) cli.parse(process.argv) diff --git a/can.js b/can.js index 7ec6393..e9bf8aa 100644 --- a/can.js +++ b/can.js @@ -30,10 +30,20 @@ export async function storeAdd (carPath) { /** * Print out all the CARs in the current space. * @param {object} opts + * @param {boolean} [opts.raw] * @param {boolean} [opts.json] + * @param {string} [opts.cursor] + * @param {number} [opts.size] */ export async function storeList (opts) { const client = await getClient() + const listOptions = {} + if (opts.size) { + listOptions.size = parseInt(opts.size) + } + if (opts.cursor) { + listOptions.cursor = opts.cursor + } const spinner = ora('Listing CARs').start() const res = await client.capability.store.list() @@ -78,14 +88,24 @@ export async function uploadAdd (root, shard, opts) { /** * Print out all the uploads in the current space. * @param {object} opts + * @param {boolean} [opts.raw] * @param {boolean} [opts.json] * @param {boolean} [opts.shards] + * @param {string} [opts.cursor] + * @param {number} [opts.size] */ export async function uploadList (opts) { const client = await getClient() + const listOptions = {} + if (opts.size) { + listOptions.size = parseInt(opts.size) + } + if (opts.cursor) { + listOptions.cursor = opts.cursor + } const spinner = ora('Listing uploads').start() - const res = await client.capability.upload.list() + const res = await client.capability.upload.list(listOptions) spinner.stop() console.log(uploadListResponseToString(res, opts)) } diff --git a/index.js b/index.js index 6445074..4458702 100644 --- a/index.js +++ b/index.js @@ -51,6 +51,7 @@ export async function upload(firstPath, opts) { /** * Print out all the uploads in the current space. * @param {object} opts + * @param {boolean} [opts.raw] * @param {boolean} [opts.json] * @param {boolean} [opts.shards] */ diff --git a/lib.js b/lib.js index 62e13c6..9b82010 100644 --- a/lib.js +++ b/lib.js @@ -196,7 +196,9 @@ async function * filesFromDir (dir, filter) { } export function uploadListResponseToString(res, opts) { - if (opts.json) { + if (opts.raw) { + return JSON.stringify(res) + } else if (opts.json) { return res.results.map(({ root, shards }) => JSON.stringify({ root: root.toString(), shards: shards?.map(s => s.toString()) @@ -215,7 +217,9 @@ export function uploadListResponseToString(res, opts) { } export function storeListResponseToString(res, opts) { - if (opts.json) { + if (opts.raw) { + return JSON.stringify(res) + } else if (opts.json) { return res.results.map(({ link, size, insertedAt }) => JSON.stringify({ link: link.toString(), size, From a1a2a12f8b022b204ca0d52ef1296e19ef4ee9c1 Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Tue, 14 Feb 2023 00:52:03 +0800 Subject: [PATCH 04/17] feat: add support for `pre` caveat this allows `can store ls` and `can upload ls` to return the results preceding the given cursor. --- bin.js | 2 ++ can.js | 12 ++++++++++-- lib.js | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bin.js b/bin.js index 331ec2b..b1bb12e 100755 --- a/bin.js +++ b/bin.js @@ -121,6 +121,7 @@ cli.command('can store ls') .option('--json', 'Format as newline delimited JSON') .option('--size', 'The desired number of results to return') .option('--cursor', 'An opaque string included in a prior store/list response that allows the service to provide the next "page" of results') + .option('--pre', 'If true, return the page of results preceding the cursor') .action(storeList) cli.command('can upload add ') @@ -134,6 +135,7 @@ cli.command('can upload ls') .option('--shards', 'Pretty print with shards in output') .option('--size', 'The desired number of results to return') .option('--cursor', 'An opaque string included in a prior upload/list response that allows the service to provide the next "page" of results') + .option('--pre', 'If true, return the page of results preceding the cursor') .action(uploadList) cli.parse(process.argv) diff --git a/can.js b/can.js index e9bf8aa..9cab2ff 100644 --- a/can.js +++ b/can.js @@ -34,8 +34,9 @@ export async function storeAdd (carPath) { * @param {boolean} [opts.json] * @param {string} [opts.cursor] * @param {number} [opts.size] + * @param {boolean} [opts.pre] */ -export async function storeList (opts) { +export async function storeList (opts = {}) { const client = await getClient() const listOptions = {} if (opts.size) { @@ -44,6 +45,9 @@ export async function storeList (opts) { if (opts.cursor) { listOptions.cursor = opts.cursor } + if (opts.pre) { + listOptions.pre = opts.pre + } const spinner = ora('Listing CARs').start() const res = await client.capability.store.list() @@ -93,8 +97,9 @@ export async function uploadAdd (root, shard, opts) { * @param {boolean} [opts.shards] * @param {string} [opts.cursor] * @param {number} [opts.size] + * @param {boolean} [opts.pre] */ -export async function uploadList (opts) { +export async function uploadList (opts = {}) { const client = await getClient() const listOptions = {} if (opts.size) { @@ -103,6 +108,9 @@ export async function uploadList (opts) { if (opts.cursor) { listOptions.cursor = opts.cursor } + if (opts.pre) { + listOptions.pre = opts.pre + } const spinner = ora('Listing uploads').start() const res = await client.capability.upload.list(listOptions) diff --git a/lib.js b/lib.js index 9b82010..8db987d 100644 --- a/lib.js +++ b/lib.js @@ -195,7 +195,7 @@ async function * filesFromDir (dir, filter) { } } -export function uploadListResponseToString(res, opts) { +export function uploadListResponseToString(res, opts = {}) { if (opts.raw) { return JSON.stringify(res) } else if (opts.json) { @@ -216,7 +216,7 @@ export function uploadListResponseToString(res, opts) { } } -export function storeListResponseToString(res, opts) { +export function storeListResponseToString(res, opts = {}) { if (opts.raw) { return JSON.stringify(res) } else if (opts.json) { From c67065380aef41bf8210e3b82645dd52a9afc488 Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Tue, 14 Feb 2023 01:00:56 +0800 Subject: [PATCH 05/17] fix: formatting --- index.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/index.js b/index.js index 4458702..a2add8e 100644 --- a/index.js +++ b/index.js @@ -12,7 +12,7 @@ import { getClient, checkPathsExist, filesize, readProof, filesFromPaths, upload * @param {string[]} opts._ * @param {boolean} [opts.hidden] */ -export async function upload(firstPath, opts) { +export async function upload (firstPath, opts) { const paths = checkPathsExist([firstPath, ...opts._]) const client = await getClient() const hidden = !!opts.hidden @@ -55,7 +55,7 @@ export async function upload(firstPath, opts) { * @param {boolean} [opts.json] * @param {boolean} [opts.shards] */ -export async function list(opts) { +export async function list (opts) { const client = await getClient() let count = 0 let res @@ -77,7 +77,7 @@ export async function list(opts) { * @param {object} opts * @param {boolean} [opts.shards] */ -export async function remove(rootCid, opts) { +export async function remove (rootCid, opts) { let root try { root = CID.parse(rootCid.trim()) @@ -107,7 +107,7 @@ export async function remove(rootCid, opts) { const { shards } = upload console.log(`⁂ removing ${shards.length} shard${shards.length === 1 ? '' : 's'}`) - function removeShard(shard) { + function removeShard (shard) { return oraPromise(client.capability.store.remove(shard), { text: `${shard}`, successText: `${shard} removed`, @@ -125,7 +125,7 @@ export async function remove(rootCid, opts) { /** * @param {string} name */ -export async function createSpace(name) { +export async function createSpace (name) { const client = await getClient() const space = await client.createSpace(name) await client.setCurrentSpace(space.did()) @@ -135,7 +135,7 @@ export async function createSpace(name) { /** * @param {string} email */ -export async function registerSpace(email) { +export async function registerSpace (email) { const client = await getClient() let space = client.currentSpace() if (space === undefined) { @@ -165,14 +165,14 @@ export async function registerSpace(email) { /** * @param {string} proofPath */ -export async function addSpace(proofPath) { +export async function addSpace (proofPath) { const client = await getClient() const delegation = await readProof(proofPath) const space = await client.addSpace(delegation) console.log(space.did()) } -export async function listSpaces() { +export async function listSpaces () { const client = await getClient() const current = client.currentSpace() for (const space of client.spaces()) { @@ -184,7 +184,7 @@ export async function listSpaces() { /** * @param {string} did */ -export async function useSpace(did) { +export async function useSpace (did) { const client = await getClient() const spaces = client.spaces() const space = spaces.find(s => s.did() === did) ?? spaces.find(s => s.name() === did) @@ -205,7 +205,7 @@ export async function useSpace(did) { * @param {number} [opts.expiration] * @param {string} [opts.output] */ -export async function createDelegation(audienceDID, opts) { +export async function createDelegation (audienceDID, opts) { const client = await getClient() if (client.currentSpace() == null) { throw new Error('no current space, use `w3 space register` to create one.') @@ -239,7 +239,7 @@ export async function createDelegation(audienceDID, opts) { * @param {object} opts * @param {boolean} [opts.json] */ -export async function listDelegations(opts) { +export async function listDelegations (opts) { const client = await getClient() const delegations = client.delegations() if (opts.json) { @@ -268,7 +268,7 @@ export async function listDelegations(opts) { * @param {boolean} [opts.json] * @param {boolean} [opts.dry-run] */ -export async function addProof(proofPath, opts) { +export async function addProof (proofPath, opts) { const client = await getClient() let proof try { @@ -296,7 +296,7 @@ export async function addProof(proofPath, opts) { * @param {object} opts * @param {boolean} [opts.json] */ -export async function listProofs(opts) { +export async function listProofs (opts) { const client = await getClient() const proofs = client.proofs() if (opts.json) { @@ -319,7 +319,7 @@ export async function listProofs(opts) { } } -export async function whoami() { +export async function whoam () { const client = await getClient() const who = client.agent() console.log(who.did()) From 3f05b40ac31185388ca404e145f39f949cd03cf6 Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Tue, 14 Feb 2023 01:03:01 +0800 Subject: [PATCH 06/17] fix: spacing error --- lib.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib.js b/lib.js index 8db987d..92c3f7b 100644 --- a/lib.js +++ b/lib.js @@ -195,7 +195,7 @@ async function * filesFromDir (dir, filter) { } } -export function uploadListResponseToString(res, opts = {}) { +export function uploadListResponseToString (res, opts = {}) { if (opts.raw) { return JSON.stringify(res) } else if (opts.json) { @@ -216,7 +216,7 @@ export function uploadListResponseToString(res, opts = {}) { } } -export function storeListResponseToString(res, opts = {}) { +export function storeListResponseToString (res, opts = {}) { if (opts.raw) { return JSON.stringify(res) } else if (opts.json) { From c1509b987618070a36991c032c2a1c6a0b4a96e5 Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Tue, 14 Feb 2023 01:09:10 +0800 Subject: [PATCH 07/17] fix: restore prodigal i --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index a2add8e..3ae22c5 100644 --- a/index.js +++ b/index.js @@ -319,7 +319,7 @@ export async function listProofs (opts) { } } -export async function whoam () { +export async function whoami () { const client = await getClient() const who = client.agent() console.log(who.did()) From afc04f603d5cc3d4e98e44d9ba875584ceed855d Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Tue, 14 Feb 2023 12:51:34 +0800 Subject: [PATCH 08/17] fix: pass opts through to formatter in `ls` I had broken json formatting and raw formatting never actually worked --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 3ae22c5..f1f1f46 100644 --- a/index.js +++ b/index.js @@ -55,7 +55,7 @@ export async function upload (firstPath, opts) { * @param {boolean} [opts.json] * @param {boolean} [opts.shards] */ -export async function list (opts) { +export async function list (opts = {}) { const client = await getClient() let count = 0 let res @@ -63,7 +63,7 @@ export async function list (opts) { res = await client.capability.upload.list() count += res.results.length if (res.results.length) { - console.log(uploadListResponseToString(res)) + console.log(uploadListResponseToString(res, opts)) } } while (res.cursor && res.results.length) From 5441b90ee86a42dd5fc2f1f4fd26c33ce98cd79b Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Tue, 14 Feb 2023 12:52:13 +0800 Subject: [PATCH 09/17] chore: document additional options in list commands I added a bunch of new options to the list commands - document them --- README.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d8e856a..b6ab6ad 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,8 @@ Upload file(s) to web3.storage. The IPFS Content ID (CID) for your files is calc List all the uploads registered in the current space. -* `--json` Format as newline delimted JSON +* `--raw` Format full response as JSON +* `--json` Format as newline delimited JSON * `--shards` Pretty print with shards in output ### `w3 rm ` @@ -136,7 +137,7 @@ Create a delegation to the passed audience for the given abilities with the _cur List delegations created by this agent for others. -* `--json` Format as newline delimted JSON +* `--json` Format as newline delimited JSON ### `w3 proof add ` @@ -146,7 +147,7 @@ Add a proof delegated to this agent. The proof is a CAR encoded delegation to _t List proofs of delegated capabilities. Proofs are delegations with an audience matching the agent DID. -* `--json` Format as newline delimted JSON +* `--json` Format as newline delimited JSON ### `w3 can space info ` @@ -160,7 +161,11 @@ Store a [CAR](https://ipld.io/specs/transport/car/carv1/) file to web3.storage. List CARs in the current space. -* `--json` Format as newline delimted JSON +* `--raw` Format full response as JSON +* `--json` Format as newline delimited JSON +* `--size` The desired number of results to return +* `--cursor` An opaque string included in a prior upload/list response that allows the service to provide the next "page" of results +* `--pre` If true, return the page of results preceding the cursor ### `w3 can store rm ` @@ -172,8 +177,12 @@ Register an upload - a DAG with the given root data CID that is stored in the gi List uploads in the current space. -* `--json` Format as newline delimted JSON +* `--raw` Format full response as JSON +* `--json` Format as newline delimited JSON * `--shards` Pretty print with shards in output +* `--size` The desired number of results to return +* `--cursor` An opaque string included in a prior upload/list response that allows the service to provide the next "page" of results +* `--pre` If true, return the page of results preceding the cursor ### `w3 can upload rm ` From a27f71be00dc9ae31860b5b75727cd9d3b398b7a Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Tue, 14 Feb 2023 15:07:02 +0800 Subject: [PATCH 10/17] fix: update tests, fix some bugs I found also improve JSDocs for new lib.js functions I'm not entirely sure the bin test mocks are done properly - would love careful review there --- can.js | 2 +- lib.js | 16 + package-lock.json | 976 ++++++++-------------------------------------- package.json | 3 +- test/bin.spec.js | 86 +++- test/lib.spec.js | 100 ++++- 6 files changed, 371 insertions(+), 812 deletions(-) diff --git a/can.js b/can.js index 9cab2ff..cf9723e 100644 --- a/can.js +++ b/can.js @@ -50,7 +50,7 @@ export async function storeList (opts = {}) { } const spinner = ora('Listing CARs').start() - const res = await client.capability.store.list() + const res = await client.capability.store.list(listOptions) spinner.stop() console.log(storeListResponseToString(res, opts)) } diff --git a/lib.js b/lib.js index 92c3f7b..9f46b6a 100644 --- a/lib.js +++ b/lib.js @@ -14,6 +14,9 @@ import { CarReader } from '@ipld/car' /** * @typedef {import('@web3-storage/w3up-client/types').FileLike & { size: number }} FileLike + * @typedef {import('@web3-storage/w3up-client/src/types').ListResponse} ListResponse + * @typedef {import('@web3-storage/w3up-client/src/types').StoreListResult} StoreListResult + * @typedef {import('@web3-storage/w3up-client/src/types').UploadListResult} UploadListResult */ export function getPkg () { @@ -195,6 +198,13 @@ async function * filesFromDir (dir, filter) { } } +/** + * @param {ListResponse} res + * @param {boolean} [opts.raw] + * @param {boolean} [opts.json] + * @param {boolean} [opts.shards] + * @returns {string} + */ export function uploadListResponseToString (res, opts = {}) { if (opts.raw) { return JSON.stringify(res) @@ -216,6 +226,12 @@ export function uploadListResponseToString (res, opts = {}) { } } +/** + * @param {ListResponse} res + * @param {boolean} [opts.raw] + * @param {boolean} [opts.json] + * @returns {string} + */ export function storeListResponseToString (res, opts = {}) { if (opts.raw) { return JSON.stringify(res) diff --git a/package-lock.json b/package-lock.json index 45258a8..5862626 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,11 +31,43 @@ "@web3-storage/capabilities": "^2.1.0", "ava": "^5.1.0", "execa": "^6.1.0", - "multiformats": "^10.0.2", + "multiformats": "^11.0.0", "npm-run-all": "^4.1.5", "standard": "^17.0.0" } }, + "../w3up-client": { + "name": "@web3-storage/w3up-client", + "version": "4.1.0", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@ipld/dag-ucan": "^3.0.1", + "@ucanto/client": "^4.0.2", + "@ucanto/core": "^4.0.2", + "@ucanto/interface": "^4.0.2", + "@ucanto/principal": "^4.0.2", + "@ucanto/transport": "^4.0.2", + "@web3-storage/access": "^9.1.1", + "@web3-storage/capabilities": "^2.0.0", + "@web3-storage/upload-client": "^5.3.0" + }, + "devDependencies": { + "@docusaurus/core": "^2.2.0", + "@ucanto/server": "^4.0.2", + "assert": "^2.0.0", + "docusaurus-plugin-typedoc": "^0.18.0", + "hundreds": "^0.0.9", + "mocha": "^10.1.0", + "multiformats": "^11.0.0", + "npm-run-all": "^4.1.5", + "playwright-test": "^8.1.1", + "standard": "^17.0.0", + "typedoc": "^0.23.24", + "typedoc-plugin-markdown": "^3.14.0", + "typedoc-plugin-missing-exports": "^1.0.0", + "typescript": "^4.8.3" + } + }, "node_modules/@eslint/eslintrc": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", @@ -129,15 +161,6 @@ "npm": ">=7.0.0" } }, - "node_modules/@ipld/car/node_modules/multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/@ipld/dag-cbor": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/@ipld/dag-cbor/-/dag-cbor-9.0.0.tgz", @@ -151,15 +174,6 @@ "npm": ">=7.0.0" } }, - "node_modules/@ipld/dag-cbor/node_modules/multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/@ipld/dag-json": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/@ipld/dag-json/-/dag-json-10.0.0.tgz", @@ -173,36 +187,6 @@ "npm": ">=7.0.0" } }, - "node_modules/@ipld/dag-json/node_modules/multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@ipld/dag-pb": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@ipld/dag-pb/-/dag-pb-4.0.0.tgz", - "integrity": "sha512-8FB/qTlNowCiszL9Sek8xH6xIQxIioXuzZ5B1jVPknQMVkd08nZUHzDjrn1Y6MqJ5PrXWLrBwNghGMWPPpvNVw==", - "dependencies": { - "multiformats": "^11.0.0" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@ipld/dag-pb/node_modules/multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/@ipld/dag-ucan": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/@ipld/dag-ucan/-/dag-ucan-3.2.0.tgz", @@ -213,37 +197,6 @@ "multiformats": "^11.0.0" } }, - "node_modules/@ipld/dag-ucan/node_modules/multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@ipld/unixfs": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@ipld/unixfs/-/unixfs-2.0.1.tgz", - "integrity": "sha512-W3LD67tLrIGpCVYFN6N/x6bL3o03zmsfd7jPAD1aXfGXaQWWa95qXPwc6PMVRTttxha/bHMKQiG2ZeFCqp83Ew==", - "dependencies": { - "@ipld/dag-pb": "^4.0.0", - "@web-std/stream": "1.0.1", - "actor": "^2.3.1", - "multiformats": "^11.0.1", - "protobufjs": "^7.1.2", - "rabin-rs": "^2.1.0" - } - }, - "node_modules/@ipld/unixfs/node_modules/multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/@noble/ed25519": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.1.tgz", @@ -290,150 +243,46 @@ "node": ">= 8" } }, - "node_modules/@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" - }, - "node_modules/@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" - }, - "node_modules/@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" - }, - "node_modules/@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" - }, - "node_modules/@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", - "dependencies": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "node_modules/@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" - }, - "node_modules/@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" - }, - "node_modules/@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" - }, - "node_modules/@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" - }, - "node_modules/@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" - }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, - "node_modules/@types/node": { - "version": "18.11.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", - "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==" - }, - "node_modules/@types/retry": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.1.tgz", - "integrity": "sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==" - }, "node_modules/@ucanto/client": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@ucanto/client/-/client-4.1.0.tgz", - "integrity": "sha512-Sn24Z5+g+MbuopGEXaBXqrrite8TwSUVHvuXHPfnSco7PtZ0Zu7siTXKrHp15dTbVN2tkvdZTSxB0UZsMmOGPA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@ucanto/client/-/client-4.2.3.tgz", + "integrity": "sha512-vIa0drEAeolQpSePpHtsW1bx8lzDdxtXi2fEdQ4f34xbI2VSOQuAgUURJTtRVmRXa5MweQoEGI9CHPKL4CMyFQ==", "dependencies": { "@ucanto/interface": "^4.1.0", "multiformats": "^11.0.0" } }, - "node_modules/@ucanto/client/node_modules/multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/@ucanto/core": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@ucanto/core/-/core-4.1.0.tgz", - "integrity": "sha512-uH3ViPWB1/K2eeQyTS7nOpupcQ0VC0qzPMYpMD1e0WSTrwVYGwMs0ttG4J77fqXExul46rLCPTY/2R7Tstn7xQ==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@ucanto/core/-/core-4.2.3.tgz", + "integrity": "sha512-udvp7IMRCE3XFhPYiKISt52r8QjbrqG7d1papdtWwF6RAzTbIWhgXSwAjEbroYCr/gQst7U8aYsgr4xvG2miUQ==", "dependencies": { - "@ipld/car": "^5.0.0", - "@ipld/dag-cbor": "^8.0.0", + "@ipld/car": "^5.0.3", + "@ipld/dag-cbor": "^9.0.0", "@ipld/dag-ucan": "^3.2.0", "@ucanto/interface": "^4.1.0", "multiformats": "^11.0.0" } }, - "node_modules/@ucanto/core/node_modules/@ipld/dag-cbor": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@ipld/dag-cbor/-/dag-cbor-8.0.1.tgz", - "integrity": "sha512-mHRuzgGXNk0Y5W7nNQdN37qJiig1Kdgf92icBVFRUNtBc9Ezl5DIdWfiGWBucHBrhqPBncxoH3As9cHPIRozxA==", - "dependencies": { - "cborg": "^1.6.0", - "multiformats": "^11.0.0" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@ucanto/core/node_modules/multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/@ucanto/interface": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@ucanto/interface/-/interface-4.1.0.tgz", - "integrity": "sha512-vqHUcMPk1tPIJbCT2X5dBRrUUSz5CUKiMJv6GOP24JournjqcwHTr4GqhXZEYgA2yAv/H+CcfVR5mWfnmLd+MQ==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@ucanto/interface/-/interface-4.2.3.tgz", + "integrity": "sha512-IoccqMc2/vqaPT6U061ylC138mQ3pLp6coqjXTDmlL9OHmskLcEeQh5Mxe0AYHWMhO1ZuB0LRIysBXk7xoK25Q==", "dependencies": { "@ipld/dag-ucan": "^3.2.0", "multiformats": "^11.0.0" } }, - "node_modules/@ucanto/interface/node_modules/multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/@ucanto/principal": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@ucanto/principal/-/principal-4.1.0.tgz", - "integrity": "sha512-R4YdxXkBr4cbmUj7bZKDtdxkfqlT60jYSS2JCtzzxYsSmxRKIjKR/a4Nmo7pqX40vSfqrvp4WlZAzl9Lczuw2A==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@ucanto/principal/-/principal-4.2.3.tgz", + "integrity": "sha512-S02cKaMcIQhxk9uJfUCUb+f98zEEFsC+5BZC6aBoYVCEpXwVZD6+hc9xI0yIQl8zJyQVA3nnUUpLfLynsSox2A==", "dependencies": { "@ipld/dag-ucan": "^3.2.0", "@noble/ed25519": "^1.7.1", @@ -442,19 +291,10 @@ "one-webcrypto": "^1.0.3" } }, - "node_modules/@ucanto/principal/node_modules/multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/@ucanto/server": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@ucanto/server/-/server-4.1.0.tgz", - "integrity": "sha512-JljZI9rbM82ho3E2AGyPZ7O8EZlrMgBkSmTM4lUYWostAxJdPz8EQvBqK7mBZcPRWE/CmjMRPS7Tu/L9Yw7eQw==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@ucanto/server/-/server-4.2.3.tgz", + "integrity": "sha512-lmDC0d9mVGYfiqwzpiTG6CFZpGVw1GnFx9EOtozKPa+v2nzwqDAkwYAQwNrJ2nbJWQQeFi7/Jiaec9EmdPEpsg==", "dev": true, "dependencies": { "@ucanto/core": "^4.1.0", @@ -463,45 +303,23 @@ } }, "node_modules/@ucanto/transport": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@ucanto/transport/-/transport-4.1.0.tgz", - "integrity": "sha512-Bd/Ma5K0rv+OOBjnisOxfhq1iFWvCn1VtFwtuzqjZGUNt7HdefJazBfpA1wILd+lLw8Krx2gr+7RHbLfQmLXtQ==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@ucanto/transport/-/transport-4.2.3.tgz", + "integrity": "sha512-ZtHB5ybSB/1dBLhzJqjxGDEE+TTTNzc9HMrVA1AP5KHvaHPu2UtAmS2IMr+HrhSjcwWwdavK0qMQbXSfLWM+kg==", "dependencies": { - "@ipld/car": "^5.0.0", - "@ipld/dag-cbor": "^8.0.0", + "@ipld/car": "^5.0.3", + "@ipld/dag-cbor": "^9.0.0", "@ucanto/core": "^4.1.0", "@ucanto/interface": "^4.1.0", "multiformats": "^11.0.0" } }, - "node_modules/@ucanto/transport/node_modules/@ipld/dag-cbor": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@ipld/dag-cbor/-/dag-cbor-8.0.1.tgz", - "integrity": "sha512-mHRuzgGXNk0Y5W7nNQdN37qJiig1Kdgf92icBVFRUNtBc9Ezl5DIdWfiGWBucHBrhqPBncxoH3As9cHPIRozxA==", - "dependencies": { - "cborg": "^1.6.0", - "multiformats": "^11.0.0" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@ucanto/transport/node_modules/multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/@ucanto/validator": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@ucanto/validator/-/validator-4.1.0.tgz", - "integrity": "sha512-YARh2hR4YafJpeKp1UmLzQUjjdpYE5cO9aVfmJVRbQMqyYz50VvkICm1dhp/7VyO4/H8oJM8WVhxiuo5eJv+ZA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@ucanto/validator/-/validator-4.2.3.tgz", + "integrity": "sha512-7lA9PK+c0Hu857eHuZIVX3ZBooqvOT25/CXUxGjqs5YFCY7dUhrNCxJYnWsPZnEdriq6x6VSj8pZPwN8I7CyQw==", "dependencies": { - "@ipld/car": "^5.0.0", + "@ipld/car": "^5.0.3", "@ipld/dag-cbor": "^8.0.0", "@ucanto/core": "^4.1.0", "@ucanto/interface": "^4.1.0", @@ -521,124 +339,56 @@ "npm": ">=7.0.0" } }, - "node_modules/@ucanto/validator/node_modules/multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@web-std/stream": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@web-std/stream/-/stream-1.0.1.tgz", - "integrity": "sha512-tsz4Y0WNDgFA5jwLSeV7/UV5rfMIlj0cPsSLVfTihjaVW0OJPd5NxJ3le1B3yLyqqzRpeG5OAfJAADLc4VoGTA==", - "dependencies": { - "web-streams-polyfill": "^3.1.1" - } - }, "node_modules/@web3-storage/access": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/@web3-storage/access/-/access-9.2.0.tgz", - "integrity": "sha512-6H/MtlTcEsDB7Ek+mTPg3tA5AhvzeMJt68gbcYzl71IooMrTKK46ZCMa//wxt0+fgOFGo0YX0jyE7fcRj4Vmnw==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@web3-storage/access/-/access-9.3.0.tgz", + "integrity": "sha512-j1HUqREA6etXP0/Rcg2+e3Ug6Vi9zgJBxenFSC4U+AyulGtfkKgJrZG8Qabj6L4+UjNxjrEjSmxUn8V8lq/ULw==", "dependencies": { - "@ipld/car": "^5.0.1", - "@ipld/dag-cbor": "^8.0.0", - "@ipld/dag-ucan": "^3.0.1", - "@ucanto/client": "^4.0.3", - "@ucanto/core": "^4.0.3", - "@ucanto/interface": "^4.0.3", - "@ucanto/principal": "^4.0.3", - "@ucanto/transport": "^4.0.3", - "@ucanto/validator": "^4.0.3", - "@web3-storage/capabilities": "^2.1.0", + "@ipld/car": "^5.0.3", + "@ipld/dag-cbor": "^9.0.0", + "@ipld/dag-ucan": "^3.2.0", + "@ucanto/client": "^4.2.3", + "@ucanto/core": "^4.2.3", + "@ucanto/interface": "^4.2.3", + "@ucanto/principal": "^4.2.3", + "@ucanto/transport": "^4.2.3", + "@ucanto/validator": "^4.2.3", + "@web3-storage/capabilities": "^2.2.0", "bigint-mod-arith": "^3.1.2", - "conf": "^10.2.0", + "conf": "10.2.0", "inquirer": "^9.1.4", "isomorphic-ws": "^5.0.0", - "kysely": "^0.22.0", - "multiformats": "^10.0.2", + "kysely": "^0.23.4", + "multiformats": "^11.0.1", "one-webcrypto": "^1.0.3", "ora": "^6.1.2", "p-defer": "^4.0.0", "p-wait-for": "^5.0.0", "type-fest": "^3.3.0", - "uint8arrays": "^4.0.2", + "uint8arrays": "^4.0.3", "varint": "^6.0.0", - "ws": "^8.11.0", + "ws": "^8.12.0", "zod": "^3.20.2" }, "bin": { "w3access": "src/cli/index.js" } }, - "node_modules/@web3-storage/access/node_modules/@ipld/dag-cbor": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@ipld/dag-cbor/-/dag-cbor-8.0.1.tgz", - "integrity": "sha512-mHRuzgGXNk0Y5W7nNQdN37qJiig1Kdgf92icBVFRUNtBc9Ezl5DIdWfiGWBucHBrhqPBncxoH3As9cHPIRozxA==", - "dependencies": { - "cborg": "^1.6.0", - "multiformats": "^11.0.0" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@web3-storage/access/node_modules/@ipld/dag-cbor/node_modules/multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/@web3-storage/capabilities": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-2.1.0.tgz", - "integrity": "sha512-6rbcushGhbaeHC38iTEW8t6QapJutfDxLoKPEVMHTJYUGfKE/bL7M7VYXws6Vdp1XCFaLbLv88OSIR/nq9M9lg==", - "dependencies": { - "@ucanto/core": "^4.0.2", - "@ucanto/interface": "^4.0.2", - "@ucanto/principal": "^4.0.2", - "@ucanto/transport": "^4.0.2", - "@ucanto/validator": "^4.0.2" - } - }, - "node_modules/@web3-storage/upload-client": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/@web3-storage/upload-client/-/upload-client-5.3.0.tgz", - "integrity": "sha512-3vLErJTiigQ/cSlg8mCrOz3ZV1AZeGgeKDvmDhOBSaIY5rBvKzW2Bjcu4Vqv1cLdWOz2qkg6Tp6X+0qRV0cfPA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-2.3.0.tgz", + "integrity": "sha512-+vg61eqK1eqQ+QD1hvChDDx6CXLGFnUsEA+W+g9yagCpq+H9yAqROncEEt+oluIGvAqNbFMrUb+bWRWxk0Tmuw==", "dependencies": { - "@ipld/car": "^5.0.0", - "@ipld/dag-ucan": "^3.0.1", - "@ipld/unixfs": "^2.0.0", - "@ucanto/client": "^4.0.3", - "@ucanto/interface": "^4.0.3", - "@ucanto/transport": "^4.0.3", - "@web3-storage/capabilities": "^2.1.0", - "multiformats": "^10.0.2", - "p-queue": "^7.3.0", - "p-retry": "^5.1.2" + "@ucanto/core": "^4.2.3", + "@ucanto/interface": "^4.2.3", + "@ucanto/principal": "^4.2.3", + "@ucanto/transport": "^4.2.3", + "@ucanto/validator": "^4.2.3" } }, "node_modules/@web3-storage/w3up-client": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@web3-storage/w3up-client/-/w3up-client-4.1.0.tgz", - "integrity": "sha512-ekLo576uFJHYpWG3QXJETydV/Xq+GniouVDN1S6ND5QSBmb/TBRbEnzplohqwLztvlPSrkd1/VL+t+IDuosubQ==", - "dependencies": { - "@ipld/dag-ucan": "^3.0.1", - "@ucanto/client": "^4.0.2", - "@ucanto/core": "^4.0.2", - "@ucanto/interface": "^4.0.2", - "@ucanto/principal": "^4.0.2", - "@ucanto/transport": "^4.0.2", - "@web3-storage/access": "^9.1.1", - "@web3-storage/capabilities": "^2.0.0", - "@web3-storage/upload-client": "^5.3.0" - } + "resolved": "../w3up-client", + "link": true }, "node_modules/acorn": { "version": "8.8.2", @@ -670,11 +420,6 @@ "node": ">=0.4.0" } }, - "node_modules/actor": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/actor/-/actor-2.3.1.tgz", - "integrity": "sha512-ST/3wnvcP2tKDXnum7nLCLXm+/rsf8vPocXH2Fre6D8FQwNkGDd4JEitBlXj007VQJfiGYRQvXqwOBZVi+JtRg==" - }, "node_modules/aggregate-error": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-4.0.1.tgz", @@ -2469,11 +2214,6 @@ "node": ">=0.10.0" } }, - "node_modules/eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" - }, "node_modules/execa": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz", @@ -3665,9 +3405,9 @@ } }, "node_modules/kysely": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/kysely/-/kysely-0.22.0.tgz", - "integrity": "sha512-ZE3qWtnqLOalodzfK5QUEcm7AEulhxsPNuKaGFsC3XiqO92vMLm+mAHk/NnbSIOtC4RmGm0nsv700i8KDp1gfQ==", + "version": "0.23.4", + "resolved": "https://registry.npmjs.org/kysely/-/kysely-0.23.4.tgz", + "integrity": "sha512-3icLnj1fahUtZsP9zzOvF4DcdhekGsLX4ZaoBaIz0ZeHegyRDdbwpJD7zezAJ+KwQZNDeKchel6MikFNLsSZIA==", "engines": { "node": ">=14.0.0" } @@ -3738,11 +3478,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/long": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.1.tgz", - "integrity": "sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A==" - }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -3923,9 +3658,9 @@ "dev": true }, "node_modules/multiformats": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-10.0.3.tgz", - "integrity": "sha512-K2yGSmstS/oEmYiEIieHb53jJCaqp4ERPDQAYrm5sV3UUrVDZeshJQCK6GHAKyIGufU1vAcbS0PdAAZmC7Tzcw==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", + "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", "engines": { "node": ">=16.0.0", "npm": ">=7.0.0" @@ -4453,40 +4188,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/p-queue": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-7.3.0.tgz", - "integrity": "sha512-5fP+yVQ0qp0rEfZoDTlP2c3RYBgxvRsw30qO+VtPPc95lyvSG+x6USSh1TuLB4n96IO6I8/oXQGsTgtna4q2nQ==", - "dependencies": { - "eventemitter3": "^4.0.7", - "p-timeout": "^5.0.2" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-retry": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-5.1.2.tgz", - "integrity": "sha512-couX95waDu98NfNZV+i/iLt+fdVxmI7CbrrdC2uDWfPdUAApyxT4wmDlyOtR5KtTDmkDO0zDScDjDou9YHhd9g==", - "dependencies": { - "@types/retry": "0.12.1", - "retry": "^0.13.1" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/p-timeout": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-5.1.0.tgz", "integrity": "sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==", + "dev": true, "engines": { "node": ">=12" }, @@ -4854,29 +4560,6 @@ "react-is": "^16.13.1" } }, - "node_modules/protobufjs": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.0.tgz", - "integrity": "sha512-hYCqTDuII4iJ4stZqiuGCSU8xxWl5JeXYpwARGtn/tWcKCAro6h3WQz+xpsNbXW0UYqpmTQFEyFWO0G0Kjt64g==", - "hasInstallScript": true, - "dependencies": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/node": ">=13.7.0", - "long": "^5.0.0" - }, - "engines": { - "node": ">=12.0.0" - } - }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", @@ -4905,11 +4588,6 @@ } ] }, - "node_modules/rabin-rs": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/rabin-rs/-/rabin-rs-2.1.0.tgz", - "integrity": "sha512-5y72gAXPzIBsAMHcpxZP8eMDuDT98qMP1BqSDHRbHkJJXEgWIN1lA47LxUqzsK6jknOJtgfkQr9v+7qMlFDm6g==" - }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -5081,14 +4759,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/retry": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", - "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", - "engines": { - "node": ">= 4" - } - }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -5863,15 +5533,6 @@ "npm": ">=7.0.0" } }, - "node_modules/uint8arrays/node_modules/multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -5923,14 +5584,6 @@ "defaults": "^1.0.3" } }, - "node_modules/web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", - "engines": { - "node": ">= 8" - } - }, "node_modules/well-known-symbols": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", @@ -6246,13 +5899,6 @@ "cborg": "^1.9.0", "multiformats": "^11.0.0", "varint": "^6.0.0" - }, - "dependencies": { - "multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" - } } }, "@ipld/dag-cbor": { @@ -6262,13 +5908,6 @@ "requires": { "cborg": "^1.10.0", "multiformats": "^11.0.0" - }, - "dependencies": { - "multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" - } } }, "@ipld/dag-json": { @@ -6278,28 +5917,6 @@ "requires": { "cborg": "^1.10.0", "multiformats": "^11.0.0" - }, - "dependencies": { - "multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" - } - } - }, - "@ipld/dag-pb": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@ipld/dag-pb/-/dag-pb-4.0.0.tgz", - "integrity": "sha512-8FB/qTlNowCiszL9Sek8xH6xIQxIioXuzZ5B1jVPknQMVkd08nZUHzDjrn1Y6MqJ5PrXWLrBwNghGMWPPpvNVw==", - "requires": { - "multiformats": "^11.0.0" - }, - "dependencies": { - "multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" - } } }, "@ipld/dag-ucan": { @@ -6310,33 +5927,6 @@ "@ipld/dag-cbor": "^9.0.0", "@ipld/dag-json": "^10.0.0", "multiformats": "^11.0.0" - }, - "dependencies": { - "multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" - } - } - }, - "@ipld/unixfs": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@ipld/unixfs/-/unixfs-2.0.1.tgz", - "integrity": "sha512-W3LD67tLrIGpCVYFN6N/x6bL3o03zmsfd7jPAD1aXfGXaQWWa95qXPwc6PMVRTttxha/bHMKQiG2ZeFCqp83Ew==", - "requires": { - "@ipld/dag-pb": "^4.0.0", - "@web-std/stream": "1.0.1", - "actor": "^2.3.1", - "multiformats": "^11.0.1", - "protobufjs": "^7.1.2", - "rabin-rs": "^2.1.0" - }, - "dependencies": { - "multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" - } } }, "@noble/ed25519": { @@ -6370,159 +5960,58 @@ "fastq": "^1.6.0" } }, - "@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" - }, - "@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" - }, - "@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" - }, - "@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" - }, - "@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", - "requires": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" - }, - "@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" - }, - "@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" - }, - "@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" - }, - "@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" - }, "@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, - "@types/node": { - "version": "18.11.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", - "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==" - }, - "@types/retry": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.1.tgz", - "integrity": "sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==" - }, "@ucanto/client": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@ucanto/client/-/client-4.1.0.tgz", - "integrity": "sha512-Sn24Z5+g+MbuopGEXaBXqrrite8TwSUVHvuXHPfnSco7PtZ0Zu7siTXKrHp15dTbVN2tkvdZTSxB0UZsMmOGPA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@ucanto/client/-/client-4.2.3.tgz", + "integrity": "sha512-vIa0drEAeolQpSePpHtsW1bx8lzDdxtXi2fEdQ4f34xbI2VSOQuAgUURJTtRVmRXa5MweQoEGI9CHPKL4CMyFQ==", "requires": { "@ucanto/interface": "^4.1.0", "multiformats": "^11.0.0" - }, - "dependencies": { - "multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" - } } }, "@ucanto/core": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@ucanto/core/-/core-4.1.0.tgz", - "integrity": "sha512-uH3ViPWB1/K2eeQyTS7nOpupcQ0VC0qzPMYpMD1e0WSTrwVYGwMs0ttG4J77fqXExul46rLCPTY/2R7Tstn7xQ==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@ucanto/core/-/core-4.2.3.tgz", + "integrity": "sha512-udvp7IMRCE3XFhPYiKISt52r8QjbrqG7d1papdtWwF6RAzTbIWhgXSwAjEbroYCr/gQst7U8aYsgr4xvG2miUQ==", "requires": { - "@ipld/car": "^5.0.0", - "@ipld/dag-cbor": "^8.0.0", + "@ipld/car": "^5.0.3", + "@ipld/dag-cbor": "^9.0.0", "@ipld/dag-ucan": "^3.2.0", "@ucanto/interface": "^4.1.0", "multiformats": "^11.0.0" - }, - "dependencies": { - "@ipld/dag-cbor": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@ipld/dag-cbor/-/dag-cbor-8.0.1.tgz", - "integrity": "sha512-mHRuzgGXNk0Y5W7nNQdN37qJiig1Kdgf92icBVFRUNtBc9Ezl5DIdWfiGWBucHBrhqPBncxoH3As9cHPIRozxA==", - "requires": { - "cborg": "^1.6.0", - "multiformats": "^11.0.0" - } - }, - "multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" - } } }, "@ucanto/interface": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@ucanto/interface/-/interface-4.1.0.tgz", - "integrity": "sha512-vqHUcMPk1tPIJbCT2X5dBRrUUSz5CUKiMJv6GOP24JournjqcwHTr4GqhXZEYgA2yAv/H+CcfVR5mWfnmLd+MQ==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@ucanto/interface/-/interface-4.2.3.tgz", + "integrity": "sha512-IoccqMc2/vqaPT6U061ylC138mQ3pLp6coqjXTDmlL9OHmskLcEeQh5Mxe0AYHWMhO1ZuB0LRIysBXk7xoK25Q==", "requires": { "@ipld/dag-ucan": "^3.2.0", "multiformats": "^11.0.0" - }, - "dependencies": { - "multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" - } } }, "@ucanto/principal": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@ucanto/principal/-/principal-4.1.0.tgz", - "integrity": "sha512-R4YdxXkBr4cbmUj7bZKDtdxkfqlT60jYSS2JCtzzxYsSmxRKIjKR/a4Nmo7pqX40vSfqrvp4WlZAzl9Lczuw2A==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@ucanto/principal/-/principal-4.2.3.tgz", + "integrity": "sha512-S02cKaMcIQhxk9uJfUCUb+f98zEEFsC+5BZC6aBoYVCEpXwVZD6+hc9xI0yIQl8zJyQVA3nnUUpLfLynsSox2A==", "requires": { "@ipld/dag-ucan": "^3.2.0", "@noble/ed25519": "^1.7.1", "@ucanto/interface": "^4.1.0", "multiformats": "^11.0.0", "one-webcrypto": "^1.0.3" - }, - "dependencies": { - "multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" - } } }, "@ucanto/server": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@ucanto/server/-/server-4.1.0.tgz", - "integrity": "sha512-JljZI9rbM82ho3E2AGyPZ7O8EZlrMgBkSmTM4lUYWostAxJdPz8EQvBqK7mBZcPRWE/CmjMRPS7Tu/L9Yw7eQw==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@ucanto/server/-/server-4.2.3.tgz", + "integrity": "sha512-lmDC0d9mVGYfiqwzpiTG6CFZpGVw1GnFx9EOtozKPa+v2nzwqDAkwYAQwNrJ2nbJWQQeFi7/Jiaec9EmdPEpsg==", "dev": true, "requires": { "@ucanto/core": "^4.1.0", @@ -6531,39 +6020,23 @@ } }, "@ucanto/transport": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@ucanto/transport/-/transport-4.1.0.tgz", - "integrity": "sha512-Bd/Ma5K0rv+OOBjnisOxfhq1iFWvCn1VtFwtuzqjZGUNt7HdefJazBfpA1wILd+lLw8Krx2gr+7RHbLfQmLXtQ==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@ucanto/transport/-/transport-4.2.3.tgz", + "integrity": "sha512-ZtHB5ybSB/1dBLhzJqjxGDEE+TTTNzc9HMrVA1AP5KHvaHPu2UtAmS2IMr+HrhSjcwWwdavK0qMQbXSfLWM+kg==", "requires": { - "@ipld/car": "^5.0.0", - "@ipld/dag-cbor": "^8.0.0", + "@ipld/car": "^5.0.3", + "@ipld/dag-cbor": "^9.0.0", "@ucanto/core": "^4.1.0", "@ucanto/interface": "^4.1.0", "multiformats": "^11.0.0" - }, - "dependencies": { - "@ipld/dag-cbor": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@ipld/dag-cbor/-/dag-cbor-8.0.1.tgz", - "integrity": "sha512-mHRuzgGXNk0Y5W7nNQdN37qJiig1Kdgf92icBVFRUNtBc9Ezl5DIdWfiGWBucHBrhqPBncxoH3As9cHPIRozxA==", - "requires": { - "cborg": "^1.6.0", - "multiformats": "^11.0.0" - } - }, - "multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" - } } }, "@ucanto/validator": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@ucanto/validator/-/validator-4.1.0.tgz", - "integrity": "sha512-YARh2hR4YafJpeKp1UmLzQUjjdpYE5cO9aVfmJVRbQMqyYz50VvkICm1dhp/7VyO4/H8oJM8WVhxiuo5eJv+ZA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@ucanto/validator/-/validator-4.2.3.tgz", + "integrity": "sha512-7lA9PK+c0Hu857eHuZIVX3ZBooqvOT25/CXUxGjqs5YFCY7dUhrNCxJYnWsPZnEdriq6x6VSj8pZPwN8I7CyQw==", "requires": { - "@ipld/car": "^5.0.0", + "@ipld/car": "^5.0.3", "@ipld/dag-cbor": "^8.0.0", "@ucanto/core": "^4.1.0", "@ucanto/interface": "^4.1.0", @@ -6578,115 +6051,79 @@ "cborg": "^1.6.0", "multiformats": "^11.0.0" } - }, - "multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" } } }, - "@web-std/stream": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@web-std/stream/-/stream-1.0.1.tgz", - "integrity": "sha512-tsz4Y0WNDgFA5jwLSeV7/UV5rfMIlj0cPsSLVfTihjaVW0OJPd5NxJ3le1B3yLyqqzRpeG5OAfJAADLc4VoGTA==", - "requires": { - "web-streams-polyfill": "^3.1.1" - } - }, "@web3-storage/access": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/@web3-storage/access/-/access-9.2.0.tgz", - "integrity": "sha512-6H/MtlTcEsDB7Ek+mTPg3tA5AhvzeMJt68gbcYzl71IooMrTKK46ZCMa//wxt0+fgOFGo0YX0jyE7fcRj4Vmnw==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@web3-storage/access/-/access-9.3.0.tgz", + "integrity": "sha512-j1HUqREA6etXP0/Rcg2+e3Ug6Vi9zgJBxenFSC4U+AyulGtfkKgJrZG8Qabj6L4+UjNxjrEjSmxUn8V8lq/ULw==", "requires": { - "@ipld/car": "^5.0.1", - "@ipld/dag-cbor": "^8.0.0", - "@ipld/dag-ucan": "^3.0.1", - "@ucanto/client": "^4.0.3", - "@ucanto/core": "^4.0.3", - "@ucanto/interface": "^4.0.3", - "@ucanto/principal": "^4.0.3", - "@ucanto/transport": "^4.0.3", - "@ucanto/validator": "^4.0.3", - "@web3-storage/capabilities": "^2.1.0", + "@ipld/car": "^5.0.3", + "@ipld/dag-cbor": "^9.0.0", + "@ipld/dag-ucan": "^3.2.0", + "@ucanto/client": "^4.2.3", + "@ucanto/core": "^4.2.3", + "@ucanto/interface": "^4.2.3", + "@ucanto/principal": "^4.2.3", + "@ucanto/transport": "^4.2.3", + "@ucanto/validator": "^4.2.3", + "@web3-storage/capabilities": "^2.2.0", "bigint-mod-arith": "^3.1.2", - "conf": "^10.2.0", + "conf": "10.2.0", "inquirer": "^9.1.4", "isomorphic-ws": "^5.0.0", - "kysely": "^0.22.0", - "multiformats": "^10.0.2", + "kysely": "^0.23.4", + "multiformats": "^11.0.1", "one-webcrypto": "^1.0.3", "ora": "^6.1.2", "p-defer": "^4.0.0", "p-wait-for": "^5.0.0", "type-fest": "^3.3.0", - "uint8arrays": "^4.0.2", + "uint8arrays": "^4.0.3", "varint": "^6.0.0", - "ws": "^8.11.0", + "ws": "^8.12.0", "zod": "^3.20.2" - }, - "dependencies": { - "@ipld/dag-cbor": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@ipld/dag-cbor/-/dag-cbor-8.0.1.tgz", - "integrity": "sha512-mHRuzgGXNk0Y5W7nNQdN37qJiig1Kdgf92icBVFRUNtBc9Ezl5DIdWfiGWBucHBrhqPBncxoH3As9cHPIRozxA==", - "requires": { - "cborg": "^1.6.0", - "multiformats": "^11.0.0" - }, - "dependencies": { - "multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" - } - } - } } }, "@web3-storage/capabilities": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-2.1.0.tgz", - "integrity": "sha512-6rbcushGhbaeHC38iTEW8t6QapJutfDxLoKPEVMHTJYUGfKE/bL7M7VYXws6Vdp1XCFaLbLv88OSIR/nq9M9lg==", - "requires": { - "@ucanto/core": "^4.0.2", - "@ucanto/interface": "^4.0.2", - "@ucanto/principal": "^4.0.2", - "@ucanto/transport": "^4.0.2", - "@ucanto/validator": "^4.0.2" - } - }, - "@web3-storage/upload-client": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/@web3-storage/upload-client/-/upload-client-5.3.0.tgz", - "integrity": "sha512-3vLErJTiigQ/cSlg8mCrOz3ZV1AZeGgeKDvmDhOBSaIY5rBvKzW2Bjcu4Vqv1cLdWOz2qkg6Tp6X+0qRV0cfPA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-2.3.0.tgz", + "integrity": "sha512-+vg61eqK1eqQ+QD1hvChDDx6CXLGFnUsEA+W+g9yagCpq+H9yAqROncEEt+oluIGvAqNbFMrUb+bWRWxk0Tmuw==", "requires": { - "@ipld/car": "^5.0.0", - "@ipld/dag-ucan": "^3.0.1", - "@ipld/unixfs": "^2.0.0", - "@ucanto/client": "^4.0.3", - "@ucanto/interface": "^4.0.3", - "@ucanto/transport": "^4.0.3", - "@web3-storage/capabilities": "^2.1.0", - "multiformats": "^10.0.2", - "p-queue": "^7.3.0", - "p-retry": "^5.1.2" + "@ucanto/core": "^4.2.3", + "@ucanto/interface": "^4.2.3", + "@ucanto/principal": "^4.2.3", + "@ucanto/transport": "^4.2.3", + "@ucanto/validator": "^4.2.3" } }, "@web3-storage/w3up-client": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@web3-storage/w3up-client/-/w3up-client-4.1.0.tgz", - "integrity": "sha512-ekLo576uFJHYpWG3QXJETydV/Xq+GniouVDN1S6ND5QSBmb/TBRbEnzplohqwLztvlPSrkd1/VL+t+IDuosubQ==", + "version": "file:../w3up-client", "requires": { + "@docusaurus/core": "^2.2.0", "@ipld/dag-ucan": "^3.0.1", "@ucanto/client": "^4.0.2", "@ucanto/core": "^4.0.2", "@ucanto/interface": "^4.0.2", "@ucanto/principal": "^4.0.2", + "@ucanto/server": "^4.0.2", "@ucanto/transport": "^4.0.2", "@web3-storage/access": "^9.1.1", "@web3-storage/capabilities": "^2.0.0", - "@web3-storage/upload-client": "^5.3.0" + "@web3-storage/upload-client": "^5.3.0", + "assert": "^2.0.0", + "docusaurus-plugin-typedoc": "^0.18.0", + "hundreds": "^0.0.9", + "mocha": "^10.1.0", + "multiformats": "^11.0.0", + "npm-run-all": "^4.1.5", + "playwright-test": "^8.1.1", + "standard": "^17.0.0", + "typedoc": "^0.23.24", + "typedoc-plugin-markdown": "^3.14.0", + "typedoc-plugin-missing-exports": "^1.0.0", + "typescript": "^4.8.3" } }, "acorn": { @@ -6708,11 +6145,6 @@ "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true }, - "actor": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/actor/-/actor-2.3.1.tgz", - "integrity": "sha512-ST/3wnvcP2tKDXnum7nLCLXm+/rsf8vPocXH2Fre6D8FQwNkGDd4JEitBlXj007VQJfiGYRQvXqwOBZVi+JtRg==" - }, "aggregate-error": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-4.0.1.tgz", @@ -7959,11 +7391,6 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" - }, "execa": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz", @@ -8790,9 +8217,9 @@ } }, "kysely": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/kysely/-/kysely-0.22.0.tgz", - "integrity": "sha512-ZE3qWtnqLOalodzfK5QUEcm7AEulhxsPNuKaGFsC3XiqO92vMLm+mAHk/NnbSIOtC4RmGm0nsv700i8KDp1gfQ==" + "version": "0.23.4", + "resolved": "https://registry.npmjs.org/kysely/-/kysely-0.23.4.tgz", + "integrity": "sha512-3icLnj1fahUtZsP9zzOvF4DcdhekGsLX4ZaoBaIz0ZeHegyRDdbwpJD7zezAJ+KwQZNDeKchel6MikFNLsSZIA==" }, "levn": { "version": "0.4.1", @@ -8839,11 +8266,6 @@ "is-unicode-supported": "^1.1.0" } }, - "long": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.1.tgz", - "integrity": "sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A==" - }, "loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -8974,9 +8396,9 @@ "dev": true }, "multiformats": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-10.0.3.tgz", - "integrity": "sha512-K2yGSmstS/oEmYiEIieHb53jJCaqp4ERPDQAYrm5sV3UUrVDZeshJQCK6GHAKyIGufU1vAcbS0PdAAZmC7Tzcw==" + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", + "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" }, "mute-stream": { "version": "0.0.8", @@ -9356,28 +8778,11 @@ "aggregate-error": "^4.0.0" } }, - "p-queue": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-7.3.0.tgz", - "integrity": "sha512-5fP+yVQ0qp0rEfZoDTlP2c3RYBgxvRsw30qO+VtPPc95lyvSG+x6USSh1TuLB4n96IO6I8/oXQGsTgtna4q2nQ==", - "requires": { - "eventemitter3": "^4.0.7", - "p-timeout": "^5.0.2" - } - }, - "p-retry": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-5.1.2.tgz", - "integrity": "sha512-couX95waDu98NfNZV+i/iLt+fdVxmI7CbrrdC2uDWfPdUAApyxT4wmDlyOtR5KtTDmkDO0zDScDjDou9YHhd9g==", - "requires": { - "@types/retry": "0.12.1", - "retry": "^0.13.1" - } - }, "p-timeout": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-5.1.0.tgz", - "integrity": "sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==" + "integrity": "sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==", + "dev": true }, "p-try": { "version": "2.2.0", @@ -9624,25 +9029,6 @@ "react-is": "^16.13.1" } }, - "protobufjs": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.0.tgz", - "integrity": "sha512-hYCqTDuII4iJ4stZqiuGCSU8xxWl5JeXYpwARGtn/tWcKCAro6h3WQz+xpsNbXW0UYqpmTQFEyFWO0G0Kjt64g==", - "requires": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/node": ">=13.7.0", - "long": "^5.0.0" - } - }, "punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", @@ -9654,11 +9040,6 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, - "rabin-rs": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/rabin-rs/-/rabin-rs-2.1.0.tgz", - "integrity": "sha512-5y72gAXPzIBsAMHcpxZP8eMDuDT98qMP1BqSDHRbHkJJXEgWIN1lA47LxUqzsK6jknOJtgfkQr9v+7qMlFDm6g==" - }, "react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -9781,11 +9162,6 @@ "signal-exit": "^3.0.2" } }, - "retry": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", - "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==" - }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -10322,13 +9698,6 @@ "integrity": "sha512-b+aKlI2oTnxnfeSQWV1sMacqSNxqhtXySaH6bflvONGxF8V/fT3ZlYH7z2qgGfydsvpVo4JUgM/Ylyfl2YouCg==", "requires": { "multiformats": "^11.0.0" - }, - "dependencies": { - "multiformats": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.1.tgz", - "integrity": "sha512-atWruyH34YiknSdL5yeIir00EDlJRpHzELYQxG7Iy29eCyL+VrZHpPrX5yqlik3jnuqpLpRKVZ0SGVb9UzKaSA==" - } } }, "unbox-primitive": { @@ -10379,11 +9748,6 @@ "defaults": "^1.0.3" } }, - "web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==" - }, "well-known-symbols": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", diff --git a/package.json b/package.json index aaf7653..403ba19 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "lint": "standard", "test": "npm-run-all -p -r mock test:ava", "test:ava": "ava --verbose", + "test:watch": "ava --watch", "mock": "run-p mock:*", "mock:bucket-200": "PORT=9200 STATUS=200 node test/helpers/bucket-server.js" }, @@ -36,7 +37,7 @@ "@web3-storage/capabilities": "^2.1.0", "ava": "^5.1.0", "execa": "^6.1.0", - "multiformats": "^10.0.2", + "multiformats": "^11.0.0", "npm-run-all": "^4.1.5", "standard": "^17.0.0" }, diff --git a/test/bin.spec.js b/test/bin.spec.js index a11d1dd..84d9037 100644 --- a/test/bin.spec.js +++ b/test/bin.spec.js @@ -234,7 +234,7 @@ test('w3 remove - no such upload', async t => { const service = mockService({ upload: { - remove: provide(UploadCapabilities.remove, () => {}) + remove: provide(UploadCapabilities.remove, () => { }) } }) t.context.setService(service) @@ -251,7 +251,7 @@ test('w3 remove --shards', async t => { const service = mockService({ store: { - remove: provide(StoreCapabilities.remove, () => {}) + remove: provide(StoreCapabilities.remove, () => { }) }, upload: { remove: provide(UploadCapabilities.remove, ({ invocation }) => { @@ -281,7 +281,7 @@ test('w3 remove --shards - no shards to remove', async t => { const service = mockService({ store: { - remove: provide(StoreCapabilities.remove, () => {}) + remove: provide(StoreCapabilities.remove, () => { }) }, upload: { remove: provide(UploadCapabilities.remove, ({ invocation }) => { @@ -592,3 +592,83 @@ test('w3 can upload add', async (t) => { t.regex(out1.stderr, /Upload added/) }) + +test('w3 can upload ls', async (t) => { + const env = t.context.env.alice + + await execa('./bin.js', ['space', 'create'], { env }) + + const uploads = [] + + const service = mockService({ + store: { + add: provide(StoreCapabilities.add, () => ({ + status: 'upload', + headers: { 'x-test': 'true' }, + url: 'http://localhost:9200' + })) + }, + upload: { + add: provide(UploadCapabilities.add, ({ invocation }) => { + const { nb } = invocation.capabilities[0] + if (!nb) throw new Error('missing nb') + uploads.push(nb) + return nb + }), + list: provide(UploadCapabilities.list, () => { + return { results: uploads, size: uploads.length } + }) + } + }) + + t.context.setService(service) + + const list0 = await execa('./bin.js', ['can', 'upload', 'ls', '--raw'], { env }) + t.regex(list0.stdout, /\{"size":0,"results":\[\]\}/) + + await execa('./bin.js', ['up', 'test/fixtures/pinpie.jpg'], { env }) + + const list1 = await execa('./bin.js', ['can', 'upload', 'ls', '--json'], { env }) + t.notThrows(() => CID.parse(JSON.parse(list1.stdout).root)) +}) + +test('w3 can store ls', async (t) => { + const env = t.context.env.alice + + await execa('./bin.js', ['space', 'create'], { env }) + + const cars = [] + + const service = mockService({ + store: { + add: provide(StoreCapabilities.add, ({ invocation }) => { + cars.push({ link: invocation.root.cid }) + return ({ + status: 'upload', + headers: { 'x-test': 'true' }, + url: 'http://localhost:9200' + }) + }), + list: provide(StoreCapabilities.list, () => { + return { results: cars, size: cars.length } + }) + }, + upload: { + add: provide(UploadCapabilities.add, ({ invocation }) => { + const { nb } = invocation.capabilities[0] + if (!nb) throw new Error('missing nb') + return nb + }) + } + }) + + t.context.setService(service) + + const list0 = await execa('./bin.js', ['can', 'store', 'ls', '--raw'], { env }) + t.regex(list0.stdout, /\{"size":0,"results":\[\]\}/) + + await execa('./bin.js', ['up', 'test/fixtures/pinpie.jpg'], { env }) + + const list1 = await execa('./bin.js', ['can', 'store', 'ls', '--json'], { env }) + t.notThrows(() => CID.parse(JSON.parse(list1.stdout).link)) +}) diff --git a/test/lib.spec.js b/test/lib.spec.js index 85766bf..8891e1c 100644 --- a/test/lib.spec.js +++ b/test/lib.spec.js @@ -1,5 +1,11 @@ import test from 'ava' -import { filesFromPaths, filesize } from '../lib.js' +import * as CID from 'multiformats/cid' +import { + filesFromPaths, + filesize, + uploadListResponseToString, + storeListResponseToString +} from '../lib.js' test('filesFromPaths', async (t) => { const files = await filesFromPaths(['node_modules']) @@ -41,3 +47,95 @@ test('filesize', t => { [5_000_000_000, '5.0GB'] ].forEach(([size, str]) => t.is(filesize(size), str)) }) + +const uploadListResponse = { + size: 2, + cursor: 'bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje', + results: [ + { + root: CID.fromJSON({ '/': 'bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm' }), + shards: [CID.fromJSON({ '/': 'bagbaierantza4rfjnhqksp2stcnd2tdjrn3f2kgi2wrvaxmayeuolryi66fq' })], + updatedAt: '2023-02-13T16:29:48.520Z', + insertedAt: '2023-02-13T16:27:36.451Z' + }, + { + root: CID.fromJSON({ '/': 'bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje' }), + shards: [CID.fromJSON({ '/': 'bagbaieraxqbkzwvx5on6an4br5hagfgesdfc6adchy3hf5qt34pupfjd3rbq' })], + updatedAt: '2023-02-13T16:30:22.086Z', + insertedAt: '2023-02-13T16:30:22.086Z' + } + ], + endCursor: 'bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje', + startCursor: 'bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm' +} + +test('uploadListResponseToString can return the upload roots CIDs as strings', (t) => { + t.is( + uploadListResponseToString(uploadListResponse, {}), + `bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm +bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje` + ) +}) + +test('uploadListResponseToString can return the upload roots as newline delimited JSON', (t) => { + t.is( + uploadListResponseToString(uploadListResponse, { shards: true }), + `bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm +└─┬ shards + └── bagbaierantza4rfjnhqksp2stcnd2tdjrn3f2kgi2wrvaxmayeuolryi66fq + +bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje +└─┬ shards + └── bagbaieraxqbkzwvx5on6an4br5hagfgesdfc6adchy3hf5qt34pupfjd3rbq +` + ) +}) + +test('uploadListResponseToString can return the upload roots and shards as a tree', (t) => { + t.is( + uploadListResponseToString(uploadListResponse, { json: true }), + `{"root":"bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm","shards":["bagbaierantza4rfjnhqksp2stcnd2tdjrn3f2kgi2wrvaxmayeuolryi66fq"]} +{"root":"bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje","shards":["bagbaieraxqbkzwvx5on6an4br5hagfgesdfc6adchy3hf5qt34pupfjd3rbq"]}` + ) +}) + +test('uploadListResponseToString can return the response as raw JSON', (t) => { + t.is( + uploadListResponseToString(uploadListResponse, { raw: true }), + '{"size":2,"cursor":"bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje","results":[{"root":{"/":"bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm"},"shards":[{"/":"bagbaierantza4rfjnhqksp2stcnd2tdjrn3f2kgi2wrvaxmayeuolryi66fq"}],"updatedAt":"2023-02-13T16:29:48.520Z","insertedAt":"2023-02-13T16:27:36.451Z"},{"root":{"/":"bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje"},"shards":[{"/":"bagbaieraxqbkzwvx5on6an4br5hagfgesdfc6adchy3hf5qt34pupfjd3rbq"}],"updatedAt":"2023-02-13T16:30:22.086Z","insertedAt":"2023-02-13T16:30:22.086Z"}],"endCursor":"bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje","startCursor":"bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm"}' + ) +}) + +const storeListResponse = { + size: 2, + cursor: 'bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq', + results: [ + { link: CID.fromJSON({ '/': 'bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma' }), size: 5336, insertedAt: '2023-02-13T10:57:23.274Z' }, + { link: CID.fromJSON({ '/': 'bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq' }), size: 3297, insertedAt: '2023-02-13T16:30:02.077Z' } + ], + endCursor: 'bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq', + startCursor: 'bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma' +} + +test('storeListResponseToString can return the CAR CIDs as strings', (t) => { + t.is( + storeListResponseToString(storeListResponse, {}), + `bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma +bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq` + ) +}) + +test('storeListResponseToString can return the CAR CIDs as newline delimited JSON', (t) => { + t.is( + storeListResponseToString(storeListResponse, { json: true }), + `{"link":"bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma","size":5336,"insertedAt":"2023-02-13T10:57:23.274Z"} +{"link":"bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq","size":3297,"insertedAt":"2023-02-13T16:30:02.077Z"}` + ) +}) + +test('storeListResponseToString can return the response as raw JSON', (t) => { + t.is( + storeListResponseToString(storeListResponse, { raw: true }), + '{"size":2,"cursor":"bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq","results":[{"link":{"/":"bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma"},"size":5336,"insertedAt":"2023-02-13T10:57:23.274Z"},{"link":{"/":"bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq"},"size":3297,"insertedAt":"2023-02-13T16:30:02.077Z"}],"endCursor":"bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq","startCursor":"bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma"}' + ) +}) From a568b03ed401328012a4084a6b98ae0f152a5a24 Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Wed, 15 Feb 2023 10:41:00 +0800 Subject: [PATCH 11/17] feat: update to latest dependencies --- package-lock.json | 454 ++++++++++++++++++++++++++++++++++++++++------ package.json | 2 +- 2 files changed, 401 insertions(+), 55 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5862626..7f18782 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@ucanto/core": "^4.0.3", "@ucanto/transport": "^4.0.3", "@web3-storage/access": "^9.1.1", - "@web3-storage/w3up-client": "^4.1.0", + "@web3-storage/w3up-client": "^4.2.0", "open": "^8.4.0", "ora": "^6.1.2", "pretty-tree": "^1.0.0", @@ -36,38 +36,6 @@ "standard": "^17.0.0" } }, - "../w3up-client": { - "name": "@web3-storage/w3up-client", - "version": "4.1.0", - "license": "Apache-2.0 OR MIT", - "dependencies": { - "@ipld/dag-ucan": "^3.0.1", - "@ucanto/client": "^4.0.2", - "@ucanto/core": "^4.0.2", - "@ucanto/interface": "^4.0.2", - "@ucanto/principal": "^4.0.2", - "@ucanto/transport": "^4.0.2", - "@web3-storage/access": "^9.1.1", - "@web3-storage/capabilities": "^2.0.0", - "@web3-storage/upload-client": "^5.3.0" - }, - "devDependencies": { - "@docusaurus/core": "^2.2.0", - "@ucanto/server": "^4.0.2", - "assert": "^2.0.0", - "docusaurus-plugin-typedoc": "^0.18.0", - "hundreds": "^0.0.9", - "mocha": "^10.1.0", - "multiformats": "^11.0.0", - "npm-run-all": "^4.1.5", - "playwright-test": "^8.1.1", - "standard": "^17.0.0", - "typedoc": "^0.23.24", - "typedoc-plugin-markdown": "^3.14.0", - "typedoc-plugin-missing-exports": "^1.0.0", - "typescript": "^4.8.3" - } - }, "node_modules/@eslint/eslintrc": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", @@ -187,6 +155,18 @@ "npm": ">=7.0.0" } }, + "node_modules/@ipld/dag-pb": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@ipld/dag-pb/-/dag-pb-4.0.2.tgz", + "integrity": "sha512-me9oEPb7UNPWSplUFCXyxnQE3/WlsjOljqO2RZN44XOmGkBY0/WVklbXorVE1eiv0Rt3p6dBS2x36Rq8A0Am8A==", + "dependencies": { + "multiformats": "^11.0.0" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + } + }, "node_modules/@ipld/dag-ucan": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/@ipld/dag-ucan/-/dag-ucan-3.2.0.tgz", @@ -197,6 +177,19 @@ "multiformats": "^11.0.0" } }, + "node_modules/@ipld/unixfs": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@ipld/unixfs/-/unixfs-2.0.1.tgz", + "integrity": "sha512-W3LD67tLrIGpCVYFN6N/x6bL3o03zmsfd7jPAD1aXfGXaQWWa95qXPwc6PMVRTttxha/bHMKQiG2ZeFCqp83Ew==", + "dependencies": { + "@ipld/dag-pb": "^4.0.0", + "@web-std/stream": "1.0.1", + "actor": "^2.3.1", + "multiformats": "^11.0.1", + "protobufjs": "^7.1.2", + "rabin-rs": "^2.1.0" + } + }, "node_modules/@noble/ed25519": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.1.tgz", @@ -243,12 +236,76 @@ "node": ">= 8" } }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" + }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "node_modules/@types/node": { + "version": "18.13.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.13.0.tgz", + "integrity": "sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==" + }, + "node_modules/@types/retry": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.1.tgz", + "integrity": "sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==" + }, "node_modules/@ucanto/client": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/@ucanto/client/-/client-4.2.3.tgz", @@ -339,6 +396,14 @@ "npm": ">=7.0.0" } }, + "node_modules/@web-std/stream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@web-std/stream/-/stream-1.0.1.tgz", + "integrity": "sha512-tsz4Y0WNDgFA5jwLSeV7/UV5rfMIlj0cPsSLVfTihjaVW0OJPd5NxJ3le1B3yLyqqzRpeG5OAfJAADLc4VoGTA==", + "dependencies": { + "web-streams-polyfill": "^3.1.1" + } + }, "node_modules/@web3-storage/access": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/@web3-storage/access/-/access-9.3.0.tgz", @@ -386,9 +451,38 @@ "@ucanto/validator": "^4.2.3" } }, + "node_modules/@web3-storage/upload-client": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@web3-storage/upload-client/-/upload-client-5.5.0.tgz", + "integrity": "sha512-mx3L3jpSlKdosNwsswdhGqMI6lektFCONWogw5GP1FAzrUTRLtzCJDMjLDk3umNRy/bIwHZ7PcOmtn8oVlHrzw==", + "dependencies": { + "@ipld/car": "^5.0.3", + "@ipld/dag-ucan": "^3.2.0", + "@ipld/unixfs": "^2.0.1", + "@ucanto/client": "^4.2.3", + "@ucanto/interface": "^4.2.3", + "@ucanto/transport": "^4.2.3", + "@web3-storage/capabilities": "^2.3.0", + "multiformats": "^11.0.1", + "p-queue": "^7.3.0", + "p-retry": "^5.1.2" + } + }, "node_modules/@web3-storage/w3up-client": { - "resolved": "../w3up-client", - "link": true + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@web3-storage/w3up-client/-/w3up-client-4.2.0.tgz", + "integrity": "sha512-6kMCR/jSi2p1NcrxyVRHJNXdZPGvECIrFlzjmijRSTpsjuXexrvDjc7puJPRLTlS7bXQbIv58HefV0BjQEFZVw==", + "dependencies": { + "@ipld/dag-ucan": "^3.0.1", + "@ucanto/client": "^4.0.2", + "@ucanto/core": "^4.0.2", + "@ucanto/interface": "^4.0.2", + "@ucanto/principal": "^4.0.2", + "@ucanto/transport": "^4.0.2", + "@web3-storage/access": "^9.1.1", + "@web3-storage/capabilities": "^2.0.0", + "@web3-storage/upload-client": "^5.3.0" + } }, "node_modules/acorn": { "version": "8.8.2", @@ -420,6 +514,11 @@ "node": ">=0.4.0" } }, + "node_modules/actor": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/actor/-/actor-2.3.1.tgz", + "integrity": "sha512-ST/3wnvcP2tKDXnum7nLCLXm+/rsf8vPocXH2Fre6D8FQwNkGDd4JEitBlXj007VQJfiGYRQvXqwOBZVi+JtRg==" + }, "node_modules/aggregate-error": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-4.0.1.tgz", @@ -2214,6 +2313,11 @@ "node": ">=0.10.0" } }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + }, "node_modules/execa": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz", @@ -3478,6 +3582,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/long": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.1.tgz", + "integrity": "sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A==" + }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -4188,11 +4297,40 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-queue": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-7.3.4.tgz", + "integrity": "sha512-esox8CWt0j9EZECFvkFl2WNPat8LN4t7WWeXq73D9ha0V96qPRufApZi4ZhPwXAln1uVVal429HVVKPa2X0yQg==", + "dependencies": { + "eventemitter3": "^4.0.7", + "p-timeout": "^5.0.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-retry": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-5.1.2.tgz", + "integrity": "sha512-couX95waDu98NfNZV+i/iLt+fdVxmI7CbrrdC2uDWfPdUAApyxT4wmDlyOtR5KtTDmkDO0zDScDjDou9YHhd9g==", + "dependencies": { + "@types/retry": "0.12.1", + "retry": "^0.13.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-timeout": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-5.1.0.tgz", "integrity": "sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==", - "dev": true, "engines": { "node": ">=12" }, @@ -4560,6 +4698,29 @@ "react-is": "^16.13.1" } }, + "node_modules/protobufjs": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.2.tgz", + "integrity": "sha512-++PrQIjrom+bFDPpfmqXfAGSQs40116JRrqqyf53dymUMvvb5d/LMRyicRoF1AUKoXVS1/IgJXlEgcpr4gTF3Q==", + "hasInstallScript": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", @@ -4588,6 +4749,11 @@ } ] }, + "node_modules/rabin-rs": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/rabin-rs/-/rabin-rs-2.1.0.tgz", + "integrity": "sha512-5y72gAXPzIBsAMHcpxZP8eMDuDT98qMP1BqSDHRbHkJJXEgWIN1lA47LxUqzsK6jknOJtgfkQr9v+7qMlFDm6g==" + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -4759,6 +4925,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "engines": { + "node": ">= 4" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -5584,6 +5758,14 @@ "defaults": "^1.0.3" } }, + "node_modules/web-streams-polyfill": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", + "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", + "engines": { + "node": ">= 8" + } + }, "node_modules/well-known-symbols": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", @@ -5919,6 +6101,14 @@ "multiformats": "^11.0.0" } }, + "@ipld/dag-pb": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@ipld/dag-pb/-/dag-pb-4.0.2.tgz", + "integrity": "sha512-me9oEPb7UNPWSplUFCXyxnQE3/WlsjOljqO2RZN44XOmGkBY0/WVklbXorVE1eiv0Rt3p6dBS2x36Rq8A0Am8A==", + "requires": { + "multiformats": "^11.0.0" + } + }, "@ipld/dag-ucan": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/@ipld/dag-ucan/-/dag-ucan-3.2.0.tgz", @@ -5929,6 +6119,19 @@ "multiformats": "^11.0.0" } }, + "@ipld/unixfs": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@ipld/unixfs/-/unixfs-2.0.1.tgz", + "integrity": "sha512-W3LD67tLrIGpCVYFN6N/x6bL3o03zmsfd7jPAD1aXfGXaQWWa95qXPwc6PMVRTttxha/bHMKQiG2ZeFCqp83Ew==", + "requires": { + "@ipld/dag-pb": "^4.0.0", + "@web-std/stream": "1.0.1", + "actor": "^2.3.1", + "multiformats": "^11.0.1", + "protobufjs": "^7.1.2", + "rabin-rs": "^2.1.0" + } + }, "@noble/ed25519": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.1.tgz", @@ -5960,12 +6163,76 @@ "fastq": "^1.6.0" } }, + "@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" + }, + "@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + }, + "@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + }, + "@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" + }, + "@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "requires": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" + }, + "@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" + }, + "@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" + }, + "@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" + }, + "@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" + }, "@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "@types/node": { + "version": "18.13.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.13.0.tgz", + "integrity": "sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==" + }, + "@types/retry": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.1.tgz", + "integrity": "sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==" + }, "@ucanto/client": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/@ucanto/client/-/client-4.2.3.tgz", @@ -6054,6 +6321,14 @@ } } }, + "@web-std/stream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@web-std/stream/-/stream-1.0.1.tgz", + "integrity": "sha512-tsz4Y0WNDgFA5jwLSeV7/UV5rfMIlj0cPsSLVfTihjaVW0OJPd5NxJ3le1B3yLyqqzRpeG5OAfJAADLc4VoGTA==", + "requires": { + "web-streams-polyfill": "^3.1.1" + } + }, "@web3-storage/access": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/@web3-storage/access/-/access-9.3.0.tgz", @@ -6098,32 +6373,37 @@ "@ucanto/validator": "^4.2.3" } }, + "@web3-storage/upload-client": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@web3-storage/upload-client/-/upload-client-5.5.0.tgz", + "integrity": "sha512-mx3L3jpSlKdosNwsswdhGqMI6lektFCONWogw5GP1FAzrUTRLtzCJDMjLDk3umNRy/bIwHZ7PcOmtn8oVlHrzw==", + "requires": { + "@ipld/car": "^5.0.3", + "@ipld/dag-ucan": "^3.2.0", + "@ipld/unixfs": "^2.0.1", + "@ucanto/client": "^4.2.3", + "@ucanto/interface": "^4.2.3", + "@ucanto/transport": "^4.2.3", + "@web3-storage/capabilities": "^2.3.0", + "multiformats": "^11.0.1", + "p-queue": "^7.3.0", + "p-retry": "^5.1.2" + } + }, "@web3-storage/w3up-client": { - "version": "file:../w3up-client", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@web3-storage/w3up-client/-/w3up-client-4.2.0.tgz", + "integrity": "sha512-6kMCR/jSi2p1NcrxyVRHJNXdZPGvECIrFlzjmijRSTpsjuXexrvDjc7puJPRLTlS7bXQbIv58HefV0BjQEFZVw==", "requires": { - "@docusaurus/core": "^2.2.0", "@ipld/dag-ucan": "^3.0.1", "@ucanto/client": "^4.0.2", "@ucanto/core": "^4.0.2", "@ucanto/interface": "^4.0.2", "@ucanto/principal": "^4.0.2", - "@ucanto/server": "^4.0.2", "@ucanto/transport": "^4.0.2", "@web3-storage/access": "^9.1.1", "@web3-storage/capabilities": "^2.0.0", - "@web3-storage/upload-client": "^5.3.0", - "assert": "^2.0.0", - "docusaurus-plugin-typedoc": "^0.18.0", - "hundreds": "^0.0.9", - "mocha": "^10.1.0", - "multiformats": "^11.0.0", - "npm-run-all": "^4.1.5", - "playwright-test": "^8.1.1", - "standard": "^17.0.0", - "typedoc": "^0.23.24", - "typedoc-plugin-markdown": "^3.14.0", - "typedoc-plugin-missing-exports": "^1.0.0", - "typescript": "^4.8.3" + "@web3-storage/upload-client": "^5.3.0" } }, "acorn": { @@ -6145,6 +6425,11 @@ "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true }, + "actor": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/actor/-/actor-2.3.1.tgz", + "integrity": "sha512-ST/3wnvcP2tKDXnum7nLCLXm+/rsf8vPocXH2Fre6D8FQwNkGDd4JEitBlXj007VQJfiGYRQvXqwOBZVi+JtRg==" + }, "aggregate-error": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-4.0.1.tgz", @@ -7391,6 +7676,11 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, + "eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + }, "execa": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz", @@ -8266,6 +8556,11 @@ "is-unicode-supported": "^1.1.0" } }, + "long": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.1.tgz", + "integrity": "sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A==" + }, "loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -8778,11 +9073,28 @@ "aggregate-error": "^4.0.0" } }, + "p-queue": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-7.3.4.tgz", + "integrity": "sha512-esox8CWt0j9EZECFvkFl2WNPat8LN4t7WWeXq73D9ha0V96qPRufApZi4ZhPwXAln1uVVal429HVVKPa2X0yQg==", + "requires": { + "eventemitter3": "^4.0.7", + "p-timeout": "^5.0.2" + } + }, + "p-retry": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-5.1.2.tgz", + "integrity": "sha512-couX95waDu98NfNZV+i/iLt+fdVxmI7CbrrdC2uDWfPdUAApyxT4wmDlyOtR5KtTDmkDO0zDScDjDou9YHhd9g==", + "requires": { + "@types/retry": "0.12.1", + "retry": "^0.13.1" + } + }, "p-timeout": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-5.1.0.tgz", - "integrity": "sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==", - "dev": true + "integrity": "sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==" }, "p-try": { "version": "2.2.0", @@ -9029,6 +9341,25 @@ "react-is": "^16.13.1" } }, + "protobufjs": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.2.tgz", + "integrity": "sha512-++PrQIjrom+bFDPpfmqXfAGSQs40116JRrqqyf53dymUMvvb5d/LMRyicRoF1AUKoXVS1/IgJXlEgcpr4gTF3Q==", + "requires": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + } + }, "punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", @@ -9040,6 +9371,11 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "rabin-rs": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/rabin-rs/-/rabin-rs-2.1.0.tgz", + "integrity": "sha512-5y72gAXPzIBsAMHcpxZP8eMDuDT98qMP1BqSDHRbHkJJXEgWIN1lA47LxUqzsK6jknOJtgfkQr9v+7qMlFDm6g==" + }, "react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -9162,6 +9498,11 @@ "signal-exit": "^3.0.2" } }, + "retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==" + }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -9748,6 +10089,11 @@ "defaults": "^1.0.3" } }, + "web-streams-polyfill": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", + "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==" + }, "well-known-symbols": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", diff --git a/package.json b/package.json index 403ba19..3909ded 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@ucanto/core": "^4.0.3", "@ucanto/transport": "^4.0.3", "@web3-storage/access": "^9.1.1", - "@web3-storage/w3up-client": "^4.1.0", + "@web3-storage/w3up-client": "^4.2.0", "open": "^8.4.0", "ora": "^6.1.2", "pretty-tree": "^1.0.0", From 5f0c1b8f08d0bbaa760b117cd8cf9ce6b749be1a Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Tue, 21 Feb 2023 13:07:32 +0800 Subject: [PATCH 12/17] fix: don't support `--raw` in `w3 ls` because we automatically page through all results in this command, it doesn't make sense to print the raw response. users interested individual page-level responses can use `can upload ls` --- README.md | 1 - bin.js | 1 - index.js | 1 - 3 files changed, 3 deletions(-) diff --git a/README.md b/README.md index b6ab6ad..236c376 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,6 @@ Upload file(s) to web3.storage. The IPFS Content ID (CID) for your files is calc List all the uploads registered in the current space. -* `--raw` Format full response as JSON * `--json` Format as newline delimited JSON * `--shards` Pretty print with shards in output diff --git a/bin.js b/bin.js index b1bb12e..aa7b2ef 100755 --- a/bin.js +++ b/bin.js @@ -48,7 +48,6 @@ cli.command('open ') cli.command('ls') .alias('list') .describe('List uploads in the current space') - .option('--raw', 'Format full response as JSON') .option('--json', 'Format as newline delimited JSON') .option('--shards', 'Pretty print with shards in output') .action(list) diff --git a/index.js b/index.js index f1f1f46..f8f28c9 100644 --- a/index.js +++ b/index.js @@ -51,7 +51,6 @@ export async function upload (firstPath, opts) { /** * Print out all the uploads in the current space. * @param {object} opts - * @param {boolean} [opts.raw] * @param {boolean} [opts.json] * @param {boolean} [opts.shards] */ From 8c5a5e37e43c9913387bcb3855409f542a60149b Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Wed, 22 Feb 2023 22:00:19 +0800 Subject: [PATCH 13/17] fix: update tests to use `before` and `after` Per the change in https://github.com/web3-storage/w3infra/pull/148 --- test/lib.spec.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/lib.spec.js b/test/lib.spec.js index 8891e1c..895efd0 100644 --- a/test/lib.spec.js +++ b/test/lib.spec.js @@ -65,8 +65,8 @@ const uploadListResponse = { insertedAt: '2023-02-13T16:30:22.086Z' } ], - endCursor: 'bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje', - startCursor: 'bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm' + after: 'bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje', + before: 'bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm' } test('uploadListResponseToString can return the upload roots CIDs as strings', (t) => { @@ -102,7 +102,7 @@ test('uploadListResponseToString can return the upload roots and shards as a tre test('uploadListResponseToString can return the response as raw JSON', (t) => { t.is( uploadListResponseToString(uploadListResponse, { raw: true }), - '{"size":2,"cursor":"bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje","results":[{"root":{"/":"bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm"},"shards":[{"/":"bagbaierantza4rfjnhqksp2stcnd2tdjrn3f2kgi2wrvaxmayeuolryi66fq"}],"updatedAt":"2023-02-13T16:29:48.520Z","insertedAt":"2023-02-13T16:27:36.451Z"},{"root":{"/":"bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje"},"shards":[{"/":"bagbaieraxqbkzwvx5on6an4br5hagfgesdfc6adchy3hf5qt34pupfjd3rbq"}],"updatedAt":"2023-02-13T16:30:22.086Z","insertedAt":"2023-02-13T16:30:22.086Z"}],"endCursor":"bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje","startCursor":"bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm"}' + '{"size":2,"cursor":"bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje","results":[{"root":{"/":"bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm"},"shards":[{"/":"bagbaierantza4rfjnhqksp2stcnd2tdjrn3f2kgi2wrvaxmayeuolryi66fq"}],"updatedAt":"2023-02-13T16:29:48.520Z","insertedAt":"2023-02-13T16:27:36.451Z"},{"root":{"/":"bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje"},"shards":[{"/":"bagbaieraxqbkzwvx5on6an4br5hagfgesdfc6adchy3hf5qt34pupfjd3rbq"}],"updatedAt":"2023-02-13T16:30:22.086Z","insertedAt":"2023-02-13T16:30:22.086Z"}],"after":"bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje","before":"bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm"}' ) }) @@ -113,8 +113,8 @@ const storeListResponse = { { link: CID.fromJSON({ '/': 'bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma' }), size: 5336, insertedAt: '2023-02-13T10:57:23.274Z' }, { link: CID.fromJSON({ '/': 'bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq' }), size: 3297, insertedAt: '2023-02-13T16:30:02.077Z' } ], - endCursor: 'bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq', - startCursor: 'bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma' + after: 'bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq', + before: 'bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma' } test('storeListResponseToString can return the CAR CIDs as strings', (t) => { @@ -136,6 +136,6 @@ test('storeListResponseToString can return the CAR CIDs as newline delimited JSO test('storeListResponseToString can return the response as raw JSON', (t) => { t.is( storeListResponseToString(storeListResponse, { raw: true }), - '{"size":2,"cursor":"bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq","results":[{"link":{"/":"bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma"},"size":5336,"insertedAt":"2023-02-13T10:57:23.274Z"},{"link":{"/":"bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq"},"size":3297,"insertedAt":"2023-02-13T16:30:02.077Z"}],"endCursor":"bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq","startCursor":"bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma"}' + '{"size":2,"cursor":"bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq","results":[{"link":{"/":"bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma"},"size":5336,"insertedAt":"2023-02-13T10:57:23.274Z"},{"link":{"/":"bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq"},"size":3297,"insertedAt":"2023-02-13T16:30:02.077Z"}],"after":"bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq","before":"bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma"}' ) }) From bd3ce0fd209d321be9fd772e2ce73d7984246773 Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Wed, 1 Mar 2023 12:17:12 +0800 Subject: [PATCH 14/17] chore: remove "coming soon" and formatting --- README.md | 4 ++-- test/bin.spec.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 236c376..ed8ff0a 100644 --- a/README.md +++ b/README.md @@ -56,10 +56,10 @@ w3 up recipies.txt * [`w3 can space info`](#w3-can-space-info-did) coming soon! * [`w3 can space recover`](#w3-can-space-recover-email) coming soon! * [`w3 can store add`](#w3-can-store-add-car-path) - * [`w3 can store ls`](#w3-can-store-ls) coming soon! + * [`w3 can store ls`](#w3-can-store-ls) * [`w3 can store rm`](#w3-can-store-rm-car-cid) coming soon! * [`w3 can upload add`](#w3-can-upload-add-root-cid-shard-cid-shard-cid) - * [`w3 can upload ls`](#w3-can-upload-ls) coming soon! + * [`w3 can upload ls`](#w3-can-upload-ls) * [`w3 can upload rm`](#w3-can-upload-rm-root-cid) coming soon! --- diff --git a/test/bin.spec.js b/test/bin.spec.js index 84d9037..f0eecb9 100644 --- a/test/bin.spec.js +++ b/test/bin.spec.js @@ -234,7 +234,7 @@ test('w3 remove - no such upload', async t => { const service = mockService({ upload: { - remove: provide(UploadCapabilities.remove, () => { }) + remove: provide(UploadCapabilities.remove, () => {}) } }) t.context.setService(service) @@ -251,7 +251,7 @@ test('w3 remove --shards', async t => { const service = mockService({ store: { - remove: provide(StoreCapabilities.remove, () => { }) + remove: provide(StoreCapabilities.remove, () => {}) }, upload: { remove: provide(UploadCapabilities.remove, ({ invocation }) => { @@ -281,7 +281,7 @@ test('w3 remove --shards - no shards to remove', async t => { const service = mockService({ store: { - remove: provide(StoreCapabilities.remove, () => { }) + remove: provide(StoreCapabilities.remove, () => {}) }, upload: { remove: provide(UploadCapabilities.remove, ({ invocation }) => { From c0c965a278d8e973c21c77806f4eb677e11072c8 Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Wed, 1 Mar 2023 12:18:34 +0800 Subject: [PATCH 15/17] fix: back out "raw" formatting option as requested by @alanshaw in https://github.com/web3-storage/w3cli/pull/45#pullrequestreview-1313250648, back out --raw for now --- README.md | 2 -- bin.js | 2 -- can.js | 2 -- lib.js | 32 ++++++++++++++------------------ test/bin.spec.js | 6 ------ test/lib.spec.js | 14 -------------- 6 files changed, 14 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index ed8ff0a..9552ad5 100644 --- a/README.md +++ b/README.md @@ -160,7 +160,6 @@ Store a [CAR](https://ipld.io/specs/transport/car/carv1/) file to web3.storage. List CARs in the current space. -* `--raw` Format full response as JSON * `--json` Format as newline delimited JSON * `--size` The desired number of results to return * `--cursor` An opaque string included in a prior upload/list response that allows the service to provide the next "page" of results @@ -176,7 +175,6 @@ Register an upload - a DAG with the given root data CID that is stored in the gi List uploads in the current space. -* `--raw` Format full response as JSON * `--json` Format as newline delimited JSON * `--shards` Pretty print with shards in output * `--size` The desired number of results to return diff --git a/bin.js b/bin.js index aa7b2ef..a42fe14 100755 --- a/bin.js +++ b/bin.js @@ -116,7 +116,6 @@ cli.command('can store add ') cli.command('can store ls') .describe('List CAR files in the current space.') - .option('--raw', 'Format full response as JSON') .option('--json', 'Format as newline delimited JSON') .option('--size', 'The desired number of results to return') .option('--cursor', 'An opaque string included in a prior store/list response that allows the service to provide the next "page" of results') @@ -129,7 +128,6 @@ cli.command('can upload add ') cli.command('can upload ls') .describe('List uploads in the current space.') - .option('--raw', 'Format full response as JSON') .option('--json', 'Format as newline delimited JSON') .option('--shards', 'Pretty print with shards in output') .option('--size', 'The desired number of results to return') diff --git a/can.js b/can.js index cf9723e..930d906 100644 --- a/can.js +++ b/can.js @@ -30,7 +30,6 @@ export async function storeAdd (carPath) { /** * Print out all the CARs in the current space. * @param {object} opts - * @param {boolean} [opts.raw] * @param {boolean} [opts.json] * @param {string} [opts.cursor] * @param {number} [opts.size] @@ -92,7 +91,6 @@ export async function uploadAdd (root, shard, opts) { /** * Print out all the uploads in the current space. * @param {object} opts - * @param {boolean} [opts.raw] * @param {boolean} [opts.json] * @param {boolean} [opts.shards] * @param {string} [opts.cursor] diff --git a/lib.js b/lib.js index 9f46b6a..074ec66 100644 --- a/lib.js +++ b/lib.js @@ -19,12 +19,12 @@ import { CarReader } from '@ipld/car' * @typedef {import('@web3-storage/w3up-client/src/types').UploadListResult} UploadListResult */ -export function getPkg () { +export function getPkg() { // @ts-ignore JSON.parse works with Buffer in Node.js return JSON.parse(fs.readFileSync(new URL('./package.json', import.meta.url))) } -export function checkPathsExist (paths) { +export function checkPathsExist(paths) { paths = Array.isArray(paths) ? paths : [paths] for (const p of paths) { if (!fs.existsSync(p)) { @@ -35,7 +35,7 @@ export function checkPathsExist (paths) { return paths } -export function filesize (bytes) { +export function filesize(bytes) { if (bytes < 50) return `${bytes}B` // avoid 0.0KB if (bytes < 50000) return `${(bytes / 1000).toFixed(1)}KB` // avoid 0.0MB if (bytes < 50000000) return `${(bytes / 1000 / 1000).toFixed(1)}MB` // avoid 0.0GB @@ -45,7 +45,7 @@ export function filesize (bytes) { /** * Get a new API client configured from env vars. */ -export function getClient () { +export function getClient() { const store = new StoreConf({ profile: process.env.W3_STORE_NAME ?? 'w3cli' }) let serviceConf @@ -84,7 +84,7 @@ export function getClient () { /** * @param {string} path Path to the proof file. */ -export async function readProof (path) { +export async function readProof(path) { try { await fs.promises.access(path, fs.constants.R_OK) } catch (err) { @@ -118,7 +118,7 @@ export async function readProof (path) { * @param {boolean} [options.hidden] * @returns {Promise} */ -export async function filesFromPaths (paths, options) { +export async function filesFromPaths(paths, options) { /** @type {string[]|undefined} */ let commonParts const files = [] @@ -148,7 +148,7 @@ export async function filesFromPaths (paths, options) { * @param {boolean} [options.hidden] * @returns {AsyncIterableIterator} */ -async function * filesFromPath (filepath, options = {}) { +async function* filesFromPath(filepath, options = {}) { filepath = path.resolve(filepath) const hidden = options.hidden ?? false @@ -170,7 +170,7 @@ async function * filesFromPath (filepath, options = {}) { // @ts-expect-error node web stream not type compatible with web stream yield { name, stream, size: stat.size } } else if (stat.isDirectory()) { - yield * filesFromDir(filepath, filter) + yield* filesFromDir(filepath, filter) } } @@ -179,7 +179,7 @@ async function * filesFromPath (filepath, options = {}) { * @param {(name: string) => boolean} filter * @returns {AsyncIterableIterator} */ -async function * filesFromDir (dir, filter) { +async function* filesFromDir(dir, filter) { const entries = await fs.promises.readdir(path.join(dir), { withFileTypes: true }) for (const entry of entries) { if (!filter(entry.name)) { @@ -193,7 +193,7 @@ async function * filesFromDir (dir, filter) { // @ts-expect-error node web stream not type compatible with web stream yield { name, stream, size } } else if (entry.isDirectory()) { - yield * filesFromDir(path.join(dir, entry.name), filter) + yield* filesFromDir(path.join(dir, entry.name), filter) } } } @@ -205,10 +205,8 @@ async function * filesFromDir (dir, filter) { * @param {boolean} [opts.shards] * @returns {string} */ -export function uploadListResponseToString (res, opts = {}) { - if (opts.raw) { - return JSON.stringify(res) - } else if (opts.json) { +export function uploadListResponseToString(res, opts = {}) { + if (opts.json) { return res.results.map(({ root, shards }) => JSON.stringify({ root: root.toString(), shards: shards?.map(s => s.toString()) @@ -232,10 +230,8 @@ export function uploadListResponseToString (res, opts = {}) { * @param {boolean} [opts.json] * @returns {string} */ -export function storeListResponseToString (res, opts = {}) { - if (opts.raw) { - return JSON.stringify(res) - } else if (opts.json) { +export function storeListResponseToString(res, opts = {}) { + if (opts.json) { return res.results.map(({ link, size, insertedAt }) => JSON.stringify({ link: link.toString(), size, diff --git a/test/bin.spec.js b/test/bin.spec.js index f0eecb9..9d6a658 100644 --- a/test/bin.spec.js +++ b/test/bin.spec.js @@ -623,9 +623,6 @@ test('w3 can upload ls', async (t) => { t.context.setService(service) - const list0 = await execa('./bin.js', ['can', 'upload', 'ls', '--raw'], { env }) - t.regex(list0.stdout, /\{"size":0,"results":\[\]\}/) - await execa('./bin.js', ['up', 'test/fixtures/pinpie.jpg'], { env }) const list1 = await execa('./bin.js', ['can', 'upload', 'ls', '--json'], { env }) @@ -664,9 +661,6 @@ test('w3 can store ls', async (t) => { t.context.setService(service) - const list0 = await execa('./bin.js', ['can', 'store', 'ls', '--raw'], { env }) - t.regex(list0.stdout, /\{"size":0,"results":\[\]\}/) - await execa('./bin.js', ['up', 'test/fixtures/pinpie.jpg'], { env }) const list1 = await execa('./bin.js', ['can', 'store', 'ls', '--json'], { env }) diff --git a/test/lib.spec.js b/test/lib.spec.js index 895efd0..412d304 100644 --- a/test/lib.spec.js +++ b/test/lib.spec.js @@ -99,13 +99,6 @@ test('uploadListResponseToString can return the upload roots and shards as a tre ) }) -test('uploadListResponseToString can return the response as raw JSON', (t) => { - t.is( - uploadListResponseToString(uploadListResponse, { raw: true }), - '{"size":2,"cursor":"bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje","results":[{"root":{"/":"bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm"},"shards":[{"/":"bagbaierantza4rfjnhqksp2stcnd2tdjrn3f2kgi2wrvaxmayeuolryi66fq"}],"updatedAt":"2023-02-13T16:29:48.520Z","insertedAt":"2023-02-13T16:27:36.451Z"},{"root":{"/":"bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje"},"shards":[{"/":"bagbaieraxqbkzwvx5on6an4br5hagfgesdfc6adchy3hf5qt34pupfjd3rbq"}],"updatedAt":"2023-02-13T16:30:22.086Z","insertedAt":"2023-02-13T16:30:22.086Z"}],"after":"bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje","before":"bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm"}' - ) -}) - const storeListResponse = { size: 2, cursor: 'bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq', @@ -132,10 +125,3 @@ test('storeListResponseToString can return the CAR CIDs as newline delimited JSO {"link":"bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq","size":3297,"insertedAt":"2023-02-13T16:30:02.077Z"}` ) }) - -test('storeListResponseToString can return the response as raw JSON', (t) => { - t.is( - storeListResponseToString(storeListResponse, { raw: true }), - '{"size":2,"cursor":"bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq","results":[{"link":{"/":"bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma"},"size":5336,"insertedAt":"2023-02-13T10:57:23.274Z"},{"link":{"/":"bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq"},"size":3297,"insertedAt":"2023-02-13T16:30:02.077Z"}],"after":"bagbaieracmkgwrw6rowsk5jse5eihyhszyrq5w23aqosajyckn2tfbotdcqq","before":"bagbaierablvu5d2q5uoimuy2tlc3tcntahnw2j7s7jjaznawc23zgdgcisma"}' - ) -}) From 755ca62c8f1b397d157f822fd270ca968ae16d5e Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Wed, 1 Mar 2023 13:14:17 +0800 Subject: [PATCH 16/17] chore: linter --- lib.js | 24 ++++++++++++------------ package.json | 1 + 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lib.js b/lib.js index 074ec66..04df527 100644 --- a/lib.js +++ b/lib.js @@ -19,12 +19,12 @@ import { CarReader } from '@ipld/car' * @typedef {import('@web3-storage/w3up-client/src/types').UploadListResult} UploadListResult */ -export function getPkg() { +export function getPkg () { // @ts-ignore JSON.parse works with Buffer in Node.js return JSON.parse(fs.readFileSync(new URL('./package.json', import.meta.url))) } -export function checkPathsExist(paths) { +export function checkPathsExist (paths) { paths = Array.isArray(paths) ? paths : [paths] for (const p of paths) { if (!fs.existsSync(p)) { @@ -35,7 +35,7 @@ export function checkPathsExist(paths) { return paths } -export function filesize(bytes) { +export function filesize (bytes) { if (bytes < 50) return `${bytes}B` // avoid 0.0KB if (bytes < 50000) return `${(bytes / 1000).toFixed(1)}KB` // avoid 0.0MB if (bytes < 50000000) return `${(bytes / 1000 / 1000).toFixed(1)}MB` // avoid 0.0GB @@ -45,7 +45,7 @@ export function filesize(bytes) { /** * Get a new API client configured from env vars. */ -export function getClient() { +export function getClient () { const store = new StoreConf({ profile: process.env.W3_STORE_NAME ?? 'w3cli' }) let serviceConf @@ -84,7 +84,7 @@ export function getClient() { /** * @param {string} path Path to the proof file. */ -export async function readProof(path) { +export async function readProof (path) { try { await fs.promises.access(path, fs.constants.R_OK) } catch (err) { @@ -118,7 +118,7 @@ export async function readProof(path) { * @param {boolean} [options.hidden] * @returns {Promise} */ -export async function filesFromPaths(paths, options) { +export async function filesFromPaths (paths, options) { /** @type {string[]|undefined} */ let commonParts const files = [] @@ -148,7 +148,7 @@ export async function filesFromPaths(paths, options) { * @param {boolean} [options.hidden] * @returns {AsyncIterableIterator} */ -async function* filesFromPath(filepath, options = {}) { +async function * filesFromPath (filepath, options = {}) { filepath = path.resolve(filepath) const hidden = options.hidden ?? false @@ -170,7 +170,7 @@ async function* filesFromPath(filepath, options = {}) { // @ts-expect-error node web stream not type compatible with web stream yield { name, stream, size: stat.size } } else if (stat.isDirectory()) { - yield* filesFromDir(filepath, filter) + yield * filesFromDir(filepath, filter) } } @@ -179,7 +179,7 @@ async function* filesFromPath(filepath, options = {}) { * @param {(name: string) => boolean} filter * @returns {AsyncIterableIterator} */ -async function* filesFromDir(dir, filter) { +async function * filesFromDir (dir, filter) { const entries = await fs.promises.readdir(path.join(dir), { withFileTypes: true }) for (const entry of entries) { if (!filter(entry.name)) { @@ -193,7 +193,7 @@ async function* filesFromDir(dir, filter) { // @ts-expect-error node web stream not type compatible with web stream yield { name, stream, size } } else if (entry.isDirectory()) { - yield* filesFromDir(path.join(dir, entry.name), filter) + yield * filesFromDir(path.join(dir, entry.name), filter) } } } @@ -205,7 +205,7 @@ async function* filesFromDir(dir, filter) { * @param {boolean} [opts.shards] * @returns {string} */ -export function uploadListResponseToString(res, opts = {}) { +export function uploadListResponseToString (res, opts = {}) { if (opts.json) { return res.results.map(({ root, shards }) => JSON.stringify({ root: root.toString(), @@ -230,7 +230,7 @@ export function uploadListResponseToString(res, opts = {}) { * @param {boolean} [opts.json] * @returns {string} */ -export function storeListResponseToString(res, opts = {}) { +export function storeListResponseToString (res, opts = {}) { if (opts.json) { return res.results.map(({ link, size, insertedAt }) => JSON.stringify({ link: link.toString(), diff --git a/package.json b/package.json index 3909ded..3121932 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ }, "scripts": { "lint": "standard", + "lint:fix": "standard --fix", "test": "npm-run-all -p -r mock test:ava", "test:ava": "ava --verbose", "test:watch": "ava --watch", From b6e6e86b8aeda71e8e6c41422812312d6d498543 Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Thu, 2 Mar 2023 11:02:09 +0800 Subject: [PATCH 17/17] fix: better path to types --- lib.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib.js b/lib.js index 04df527..df77202 100644 --- a/lib.js +++ b/lib.js @@ -14,9 +14,9 @@ import { CarReader } from '@ipld/car' /** * @typedef {import('@web3-storage/w3up-client/types').FileLike & { size: number }} FileLike - * @typedef {import('@web3-storage/w3up-client/src/types').ListResponse} ListResponse - * @typedef {import('@web3-storage/w3up-client/src/types').StoreListResult} StoreListResult - * @typedef {import('@web3-storage/w3up-client/src/types').UploadListResult} UploadListResult + * @typedef {import('@web3-storage/w3up-client/types').ListResponse} ListResponse + * @typedef {import('@web3-storage/w3up-client/types').StoreListResult} StoreListResult + * @typedef {import('@web3-storage/w3up-client/types').UploadListResult} UploadListResult */ export function getPkg () {