From 7f52cc0018f917b4bfa33f19106981ba714a3747 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Mon, 3 Jun 2024 20:34:31 +0200 Subject: [PATCH] feat: upgrade deps for blob (#187) --- README.md | 43 +-- bin.js | 30 ++ can.js | 107 ++++++- index.js | 2 +- lib.js | 53 +++- package-lock.json | 621 +++++++++++++++++++++++----------------- package.json | 23 +- space.js | 7 +- test/bin.spec.js | 100 +++++-- test/helpers/context.js | 2 +- test/helpers/process.js | 2 + test/lib.spec.js | 2 +- 12 files changed, 669 insertions(+), 323 deletions(-) diff --git a/README.md b/README.md index c9cfa32..028d599 100644 --- a/README.md +++ b/README.md @@ -60,11 +60,12 @@ w3 up recipies.txt - UCAN-HTTP Bridge - [`w3 bridge generate-tokens`](#w3-bridge-generate-tokens) - Advanced usage + - [`w3 can blob add`](#w3-can-blob-add-path) + - [`w3 can blob ls`](#w3-can-blob-ls) + - [`w3 can blob rm`](#w3-can-blob-rm-multihash) + - [`w3 can index add`](#w3-can-index-add-cid) - [`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) - - [`w3 can store rm`](#w3-can-store-rm-car-cid) - [`w3 can upload add`](#w3-can-upload-add-root-cid-shard-cid-shard-cid) - [`w3 can upload ls`](#w3-can-upload-ls) - [`w3 can upload rm`](#w3-can-upload-rm-root-cid) @@ -154,8 +155,15 @@ Create a delegation to the passed audience for the given abilities with the _cur # delegate space/info to did:key:z6M..., output as a CAR w3 delegation create did:key:z6M... --can space/info --output ./info.ucan -# delegate store/* and upload/* to did:key:z6M..., output as a string -w3 delegation create did:key:z6M... --can 'store/*' --can 'upload/*' --base64 +# delegate admin capabilities to did:key:z6M..., output as a string +w3 delegation create did:key:z6M... --can 'space/*' --can 'upload/*' --can 'filecoin/*' --base64 + +# delegate write (not remove) capabilities to did:key:z6M..., output as a string +w3 delegation create did:key:z6M... \ + --can 'space/blob/add' \ + --can 'upload/add' \ + --can 'filecoin/offer' \ + --base64 ``` ### `w3 delegation ls` @@ -197,30 +205,29 @@ on how these are expected to be used. - `--expiration` Unix timestamp (in seconds) when the delegation is no longer valid. Zero indicates no expiration. - `--json` If set, output JSON suitable to splat into the `headers` field of a `fetch` request. -### `w3 can space info ` - -### `w3 can space recover ` - -### `w3 can store add ` +### `w3 can blob add [path]` -Store a [CAR](https://ipld.io/specs/transport/car/carv1/) file to web3.storage. +Store a blob file to the service. -### `w3 can store ls` +### `w3 can blob ls` -List CARs in the current space. +List blobs in the current space. - `--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 ` +### `w3 can blob rm ` + +Remove a blob from the store by base58btc encoded multihash. -Remove a CAR from the store. +### `w3 can space info ` + +### `w3 can space recover ` ### `w3 can upload add [shard-cid...]` -Register an upload - a DAG with the given root data CID that is stored in the given CAR shard(s), identified by CAR CIDs. +Register an upload - a DAG with the given root data CID that is stored in the given shard(s), identified by CID. ### `w3 can upload ls` @@ -234,7 +241,7 @@ List uploads in the current space. ### `w3 can upload rm ` -Remove an upload from the current space's upload list. Does not remove CAR from the store. +Remove an upload from the current space's upload list. Does not remove blobs from the store. ## Environment Variables diff --git a/bin.js b/bin.js index 05166d2..6a32341 100755 --- a/bin.js +++ b/bin.js @@ -29,6 +29,10 @@ import { reset, } from './index.js' import { + blobAdd, + blobList, + blobRemove, + indexAdd, storeAdd, storeList, storeRemove, @@ -264,6 +268,32 @@ cli .describe('Claim delegated capabilities for the authorized account.') .action(accessClaim) +cli + .command('can blob add [data-path]') + .describe('Store a blob with the service.') + .action(blobAdd) + +cli + .command('can blob ls') + .describe('List blobs in the current space.') + .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 blob/list response that allows the service to provide the next "page" of results' + ) + .action(blobList) + +cli + .command('can blob rm ') + .describe('Remove a blob from the store by base58btc encoded multihash.') + .action(blobRemove) + +cli + .command('can index add ') + .describe('Register an "index" with the service.') + .action(indexAdd) + cli .command('can store add ') .describe('Store a CAR file with the service.') diff --git a/can.js b/can.js index 67b6025..5fdf63a 100644 --- a/can.js +++ b/can.js @@ -1,6 +1,10 @@ /* eslint-env browser */ -import fs from 'fs' -import { CID } from 'multiformats' +import fs from 'node:fs' +import { Readable } from 'node:stream' +import * as Link from 'multiformats/link' +import * as raw from 'multiformats/codecs/raw' +import { base58btc } from 'multiformats/bases/base58' +import * as Digest from 'multiformats/hashes/digest' import { Piece } from '@web3-storage/data-segment' import ora from 'ora' import { @@ -9,8 +13,98 @@ import { storeListResponseToString, filecoinInfoToString, parseCarLink, + streamToBlob, + blobListResponseToString, } from './lib.js' +/** + * @param {string} [blobPath] + */ +export async function blobAdd(blobPath) { + const client = await getClient() + + const spinner = ora('Reading data').start() + /** @type {Blob} */ + let blob + try { + blob = await streamToBlob( + /** @type {ReadableStream} */ + (Readable.toWeb(blobPath ? fs.createReadStream(blobPath) : process.stdin)) + ) + } catch (/** @type {any} */ err) { + spinner.fail(`Error: failed to read data: ${err.message}`) + process.exit(1) + } + + spinner.start('Storing') + const digest = await client.capability.blob.add(blob) + const cid = Link.create(raw.code, digest) + spinner.stopAndPersist({ symbol: '⁂', text: `Stored ${base58btc.encode(digest.bytes)} (${cid})` }) +} + +/** + * Print out all the blobs in the current space. + * + * @param {object} opts + * @param {boolean} [opts.json] + * @param {string} [opts.cursor] + * @param {number} [opts.size] + */ +export async function blobList(opts = {}) { + const client = await getClient() + const listOptions = {} + if (opts.size) { + listOptions.size = parseInt(String(opts.size)) + } + if (opts.cursor) { + listOptions.cursor = opts.cursor + } + + const spinner = ora('Listing Blobs').start() + const res = await client.capability.blob.list(listOptions) + spinner.stop() + console.log(blobListResponseToString(res, opts)) +} + +/** + * @param {string} digestStr + */ +export async function blobRemove(digestStr) { + const spinner = ora(`Removing ${digestStr}`).start() + let digest + try { + digest = Digest.decode(base58btc.decode(digestStr)) + } catch { + spinner.fail(`Error: "${digestStr}" is not a base58btc encoded multihash`) + process.exit(1) + } + const client = await getClient() + try { + await client.capability.blob.remove(digest) + spinner.stopAndPersist({ symbol: '⁂', text: `Removed ${digestStr}` }) + } catch (/** @type {any} */ err) { + spinner.fail(`Error: blob remove failed: ${err.message ?? err}`) + console.error(err) + process.exit(1) + } +} + +/** + * @param {string} cidStr + */ +export async function indexAdd(cidStr) { + const client = await getClient() + + const spinner = ora('Adding').start() + const cid = parseCarLink(cidStr) + if (!cid) { + spinner.fail(`Error: "${cidStr}" is not a valid index CID`) + process.exit(1) + } + await client.capability.index.add(cid) + spinner.stopAndPersist({ symbol: '⁂', text: `Added index ${cid}` }) +} + /** * @param {string} carPath */ @@ -73,7 +167,7 @@ export async function storeRemove(cidStr) { } const client = await getClient() try { - client.capability.store.remove(shard) + await client.capability.store.remove(shard) } catch (/** @type {any} */ err) { console.error(`Store remove failed: ${err.message ?? err}`) console.error(err) @@ -92,7 +186,7 @@ export async function uploadAdd(root, shard, opts) { let rootCID try { - rootCID = CID.parse(root) + rootCID = Link.parse(root) } catch (/** @type {any} */ err) { console.error(`Error: failed to parse root CID: ${root}: ${err.message}`) process.exit(1) @@ -102,8 +196,7 @@ export async function uploadAdd(root, shard, opts) { const shards = [] for (const str of [shard, ...opts._]) { try { - // @ts-expect-error may not be a CAR CID... - shards.push(CID.parse(str)) + shards.push(Link.parse(str)) } catch (/** @type {any} */ err) { console.error(`Error: failed to parse shard CID: ${str}: ${err.message}`) process.exit(1) @@ -152,7 +245,7 @@ export async function uploadList(opts = {}) { export async function uploadRemove(rootCid) { let root try { - root = CID.parse(rootCid.trim()) + root = Link.parse(rootCid.trim()) } catch (/** @type {any} */ err) { console.error(`Error: ${rootCid} is not a CID`) process.exit(1) diff --git a/index.js b/index.js index 1bffd0f..465c5d7 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ import fs from 'fs' -import ora, { oraPromise } from 'ora' +import ora from 'ora' import { pipeline } from 'node:stream/promises' import { CID } from 'multiformats/cid' import { base64 } from 'multiformats/bases/base64' diff --git a/lib.js b/lib.js index 25b2a0b..48ba49a 100644 --- a/lib.js +++ b/lib.js @@ -7,11 +7,14 @@ import { connect } from '@ucanto/client' import * as CAR from '@ucanto/transport/car' import * as HTTP from '@ucanto/transport/http' import * as Signer from '@ucanto/principal/ed25519' -import { CID } from 'multiformats/cid' +import * as Link from 'multiformats/link' +import { base58btc } from 'multiformats/bases/base58' +import * as Digest from 'multiformats/hashes/digest' +import * as raw from 'multiformats/codecs/raw' import { parse } from '@ipld/dag-ucan/did' import * as dagJSON from '@ipld/dag-json' import { create } from '@web3-storage/w3up-client' -import { StoreConf } from '@web3-storage/access/stores/store-conf' +import { StoreConf } from '@web3-storage/w3up-client/stores/conf' import { CarReader } from '@ipld/car' import chalk from 'chalk' @@ -19,6 +22,7 @@ import chalk from 'chalk' * @typedef {import('@web3-storage/w3up-client/types').AnyLink} AnyLink * @typedef {import('@web3-storage/w3up-client/types').CARLink} CARLink * @typedef {import('@web3-storage/w3up-client/types').FileLike & { size: number }} FileLike + * @typedef {import('@web3-storage/w3up-client/types').BlobListSuccess} BlobListSuccess * @typedef {import('@web3-storage/w3up-client/types').StoreListSuccess} StoreListSuccess * @typedef {import('@web3-storage/w3up-client/types').UploadListSuccess} UploadListSuccess * @typedef {import('@web3-storage/capabilities/types').FilecoinInfoSuccess} FilecoinInfoSuccess @@ -184,6 +188,7 @@ export async function readProofFromBytes(bytes) { * @param {boolean} [opts.raw] * @param {boolean} [opts.json] * @param {boolean} [opts.shards] + * @param {boolean} [opts.plainTree] * @returns {string} */ export function uploadListResponseToString(res, opts = {}) { @@ -193,8 +198,9 @@ export function uploadListResponseToString(res, opts = {}) { .join('\n') } else if (opts.shards) { return res.results - .map(({ root, shards }) => - tree({ + .map(({ root, shards }) => { + const treeBuilder = opts.plainTree ? tree.plain : tree + return treeBuilder({ label: root.toString(), nodes: [ { @@ -202,7 +208,7 @@ export function uploadListResponseToString(res, opts = {}) { leaf: shards?.map((s) => s.toString()), }, ], - }) + })} ) .join('\n') } else { @@ -210,6 +216,29 @@ export function uploadListResponseToString(res, opts = {}) { } } +/** + * @param {BlobListSuccess} res + * @param {object} [opts] + * @param {boolean} [opts.raw] + * @param {boolean} [opts.json] + * @returns {string} + */ +export function blobListResponseToString(res, opts = {}) { + if (opts.json) { + return res.results + .map(({ blob }) => dagJSON.stringify({ blob })) + .join('\n') + } else { + return res.results + .map(({ blob }) => { + const digest = Digest.decode(blob.digest) + const cid = Link.create(raw.code, digest) + return `${base58btc.encode(digest.bytes)} (${cid})` + }) + .join('\n') + } +} + /** * @param {StoreListSuccess} res * @param {object} [opts] @@ -228,7 +257,6 @@ export function storeListResponseToString(res, opts = {}) { } /** - * * @param {FilecoinInfoSuccess} res * @param {object} [opts] * @param {boolean} [opts.raw] @@ -241,7 +269,7 @@ export function filecoinInfoToString(res, opts = {}) { aggregate: deal.aggregate.toString(), provider: deal.provider, dealId: deal.aux.dataSource.dealID, - inclusion: deal.inclusion + inclusion: res.aggregates.find(a => a.aggregate.toString() === deal.aggregate.toString())?.inclusion }))) .join('\n') } else { @@ -281,7 +309,7 @@ export function asCarLink(cid) { */ export function parseCarLink(cidStr) { try { - return asCarLink(CID.parse(cidStr.trim())) + return asCarLink(Link.parse(cidStr.trim())) } catch { return undefined } @@ -304,3 +332,12 @@ export const startOfLastMonth = (now) => { d.setUTCMonth(d.getUTCMonth() - 1) return d } + +/** @param {ReadableStream} source */ +export const streamToBlob = async source => { + const chunks = /** @type {Uint8Array[]} */ ([]) + await source.pipeTo(new WritableStream({ + write: chunk => { chunks.push(chunk) } + })) + return new Blob(chunks) +} diff --git a/package-lock.json b/package-lock.json index 998b548..63acdce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,13 +14,13 @@ "@ipld/car": "^5.2.4", "@ipld/dag-json": "^10.1.5", "@ipld/dag-ucan": "^3.4.0", - "@ucanto/client": "^9.0.0", - "@ucanto/core": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@web3-storage/access": "^18.0.7", + "@ucanto/client": "^9.0.1", + "@ucanto/core": "^10.0.1", + "@ucanto/transport": "^9.1.1", + "@web3-storage/access": "^20.0.0", "@web3-storage/data-segment": "^5.0.0", "@web3-storage/did-mailto": "^2.1.0", - "@web3-storage/w3up-client": "^12.2.0", + "@web3-storage/w3up-client": "^14.0.0-rc.2", "ansi-escapes": "^6.2.0", "chalk": "^5.3.0", "files-from-path": "^1.0.4", @@ -37,17 +37,16 @@ }, "devDependencies": { "@types/update-notifier": "^6.0.5", - "@ucanto/interface": "^9.0.0", - "@ucanto/principal": "^9.0.0", - "@ucanto/server": "^9.0.1", + "@ucanto/interface": "^10.0.1", + "@ucanto/principal": "^9.0.1", + "@ucanto/server": "^10.0.0", "@web-std/blob": "^3.0.5", - "@web3-storage/capabilities": "^12.0.2", + "@web3-storage/capabilities": "17.1.1", "@web3-storage/eslint-config-w3up": "^1.0.0", "@web3-storage/sigv4": "^1.0.2", - "@web3-storage/upload-api": "^7.3.3", - "@web3-storage/upload-client": "^12.0.1", + "@web3-storage/upload-api": "^17.0.0", "entail": "^2.1.1", - "multiformats": "^12.1.3", + "multiformats": "^13.1.1", "npm-run-all": "^4.1.5", "prettier": "^3.0.3", "typescript": "^5.2.2" @@ -890,6 +889,15 @@ "npm": ">=7.0.0" } }, + "node_modules/@ipld/car/node_modules/multiformats": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.3.tgz", + "integrity": "sha512-eajQ/ZH7qXZQR2AgtfpmSMizQzmyYVmCql7pdhldPuYQi4atACekbJaQplk6dWyIi10jCaFnd6pqvcEFXjbaJw==", + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + } + }, "node_modules/@ipld/dag-cbor": { "version": "9.0.6", "resolved": "https://registry.npmjs.org/@ipld/dag-cbor/-/dag-cbor-9.0.6.tgz", @@ -903,6 +911,15 @@ "npm": ">=7.0.0" } }, + "node_modules/@ipld/dag-cbor/node_modules/multiformats": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.3.tgz", + "integrity": "sha512-eajQ/ZH7qXZQR2AgtfpmSMizQzmyYVmCql7pdhldPuYQi4atACekbJaQplk6dWyIi10jCaFnd6pqvcEFXjbaJw==", + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + } + }, "node_modules/@ipld/dag-json": { "version": "10.1.5", "resolved": "https://registry.npmjs.org/@ipld/dag-json/-/dag-json-10.1.5.tgz", @@ -916,12 +933,21 @@ "npm": ">=7.0.0" } }, + "node_modules/@ipld/dag-json/node_modules/multiformats": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.3.tgz", + "integrity": "sha512-eajQ/ZH7qXZQR2AgtfpmSMizQzmyYVmCql7pdhldPuYQi4atACekbJaQplk6dWyIi10jCaFnd6pqvcEFXjbaJw==", + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + } + }, "node_modules/@ipld/dag-pb": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@ipld/dag-pb/-/dag-pb-4.0.6.tgz", - "integrity": "sha512-wOij3jfDKZsb9yjhQeHp+TQy0pu1vmUkGv324xciFFZ7xGbDfAGTQW03lSA5aJ/7HBBNYgjEE0nvHmNW1Qjfag==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@ipld/dag-pb/-/dag-pb-4.1.1.tgz", + "integrity": "sha512-wsSNjIvcABXuH9MKXpvRGMXsS20+Kf2Q0Hq2+2dxN6Wpw/K0kDF3nDmCnO6wlpninQ0vzx1zq54O3ttn5pTH9A==", "dependencies": { - "multiformats": "^12.0.1" + "multiformats": "^13.1.0" }, "engines": { "node": ">=16.0.0", @@ -948,14 +974,13 @@ } }, "node_modules/@ipld/unixfs": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@ipld/unixfs/-/unixfs-2.1.2.tgz", - "integrity": "sha512-yZC2Ih0smcFLNVperNK1eg9fJYOyml3havbvVgUvLkb2M8UDmPGdVnv40SLv/4e4YY6Dg6iSheXEdj4txvmN9w==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@ipld/unixfs/-/unixfs-2.2.0.tgz", + "integrity": "sha512-lDQ2eRhJlbFaBoO3bhOmDVCLmpOnhwtwbilqUgAAhbhoPSmLrnv7gsBuToZjXOdPaEGSL7apkmm6nFrcU6zh4Q==", "dependencies": { "@ipld/dag-pb": "^4.0.0", "@multiformats/murmur3": "^2.1.3", "@perma/map": "^1.0.2", - "@web-std/stream": "1.0.1", "actor": "^2.3.1", "multiformats": "^11.0.1", "protobufjs": "^7.1.2", @@ -972,11 +997,11 @@ } }, "node_modules/@multiformats/murmur3": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/@multiformats/murmur3/-/murmur3-2.1.7.tgz", - "integrity": "sha512-Yf0UpAaONjed+8PTt5NM/GG4Z4Ai4m1qfT7bqevjnkwRQ12K+0jxtRomirz+VJx4PokpA2St1ZSD1iMkZTqPRQ==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@multiformats/murmur3/-/murmur3-2.1.8.tgz", + "integrity": "sha512-6vId1C46ra3R1sbJUOFCZnsUIveR9oF20yhPmAFxPm0JfrX3/ZRCgP3YDrBzlGoEppOXnA9czHeYc0T9mB6hbA==", "dependencies": { - "multiformats": "^12.0.1", + "multiformats": "^13.0.0", "murmurhash3js-revisited": "^3.0.0" }, "engines": { @@ -1477,23 +1502,23 @@ } }, "node_modules/@ucanto/client": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@ucanto/client/-/client-9.0.0.tgz", - "integrity": "sha512-Fl8ZGuWoVQygBtLISPlFb5Ej/LKUofghTTAT4kjFNc8WB9bD7AS+yvSPowwd+4uTnxfEOeKWV2lzO1+gRxQF0w==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@ucanto/client/-/client-9.0.1.tgz", + "integrity": "sha512-cV8w3AnaZaYCdUmyFFICj8YhFckDoy2DvWgAzGDMkPz0WbUW4lw9Tjm4hEE8x5kiP47wYej/pHKWCcoELiU0qw==", "dependencies": { - "@ucanto/core": "^9.0.0", - "@ucanto/interface": "^9.0.0" + "@ucanto/core": "^10.0.0", + "@ucanto/interface": "^10.0.0" } }, "node_modules/@ucanto/core": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/@ucanto/core/-/core-9.0.1.tgz", - "integrity": "sha512-SsYvKCO3FD27roTVcg8ASxnixjn+j96sPlijpVq1uBUxq7SmuNxNPYFZqpxXKj2R4gty/Oc8XTse12ebB9Kofg==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@ucanto/core/-/core-10.0.1.tgz", + "integrity": "sha512-1BfUaJu0/c9Rl/WdZSDbScJJLsPsPe1g4ynl5kubUj3xDD/lyp/Q12PQVQ2X7hDiWwkpwmxCkRMkOxwc70iNKQ==", "dependencies": { "@ipld/car": "^5.1.0", "@ipld/dag-cbor": "^9.0.0", "@ipld/dag-ucan": "^3.4.0", - "@ucanto/interface": "^9.0.0", + "@ucanto/interface": "^10.0.1", "multiformats": "^11.0.2" } }, @@ -1507,9 +1532,9 @@ } }, "node_modules/@ucanto/interface": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@ucanto/interface/-/interface-9.0.0.tgz", - "integrity": "sha512-Y9185yj+CRNpT43EAHTe9MpskCgU9DyWvmYyLMMmF40w+ujp6EYy5JVI/gVjJAsh+2Y9ruvWHOF0M+21TnLQyg==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@ucanto/interface/-/interface-10.0.1.tgz", + "integrity": "sha512-+Vr/N4mLsdynV9/bqtdFiq7WsUf3265/Qx2aHJmPtXo9/QvWKthJtpe0g8U4NWkWpVfqIFvyAO2db6D9zWQfQw==", "dependencies": { "@ipld/dag-ucan": "^3.4.0", "multiformats": "^11.0.2" @@ -1525,15 +1550,15 @@ } }, "node_modules/@ucanto/principal": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@ucanto/principal/-/principal-9.0.0.tgz", - "integrity": "sha512-3KpaZ0mNycDnDx2WJ9p5qnhTlc4YLFqmuClBpNJcGLk+begaeH7dUlzfxNtloSvZAeB67G03Y883CqiVhN6ZmA==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@ucanto/principal/-/principal-9.0.1.tgz", + "integrity": "sha512-8eAvaZHW1vyET4X90rkJv6pmW1IOdEYlZYwO3wDgTkC5m9VytBEywCvpzP57cavdYIbbPse5QS9nMEGvk87zhw==", "dependencies": { "@ipld/dag-ucan": "^3.4.0", "@noble/curves": "^1.2.0", "@noble/ed25519": "^1.7.3", "@noble/hashes": "^1.3.2", - "@ucanto/interface": "^9.0.0", + "@ucanto/interface": "^10.0.0", "multiformats": "^11.0.2", "one-webcrypto": "^1.0.3" } @@ -1548,35 +1573,35 @@ } }, "node_modules/@ucanto/server": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/@ucanto/server/-/server-9.0.1.tgz", - "integrity": "sha512-EGhgKLjPgvM39j86WxSD7UoR0rr7jpTMclCOcpOEVC9r91sob8BReW2i7cm1zPvhSNFqS8rLjlGEgUIAhdAxmg==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@ucanto/server/-/server-10.0.0.tgz", + "integrity": "sha512-JMDMT3tFRE0S1cdtx/Hhh7v9FizV6IS0fPrh6pcli7AzKvXVy8Xu6EQ/66Fax4AQM2tkGxNNxjj2wHM7P4CqAg==", "dev": true, "dependencies": { - "@ucanto/core": "^9.0.0", - "@ucanto/interface": "^9.0.0", + "@ucanto/core": "^10.0.0", + "@ucanto/interface": "^10.0.0", "@ucanto/principal": "^9.0.0", - "@ucanto/validator": "^9.0.0" + "@ucanto/validator": "^9.0.1" } }, "node_modules/@ucanto/transport": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@ucanto/transport/-/transport-9.0.0.tgz", - "integrity": "sha512-eN9kkhdp5vC8iYSlT+4YeqyLdV+3g4kYLvuDojdR1lqEcJM2/1W8KjGgmGt6dhE7eBlMqD2hqujS1ePPtY2mKw==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/@ucanto/transport/-/transport-9.1.1.tgz", + "integrity": "sha512-3CR17nEemOVaTuMZa6waWgVL4sLxSPcxYvpaNeJ6NZo1rfsqdyRXOtbVV/RcI2BtUL0Cao6JM6P9+gdghfc5ng==", "dependencies": { - "@ucanto/core": "^9.0.0", - "@ucanto/interface": "^9.0.0" + "@ucanto/core": "^10.0.0", + "@ucanto/interface": "^10.0.0" } }, "node_modules/@ucanto/validator": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/@ucanto/validator/-/validator-9.0.1.tgz", - "integrity": "sha512-H9GMOXHNW3vCv36eQZN1/h8zOXHEljRV5yNZ/huyOaJLVAKxt7Va1Ww8VBf2Ho/ac6P7jwvQRT7WgxaXx1/3Hg==", + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/@ucanto/validator/-/validator-9.0.2.tgz", + "integrity": "sha512-LxhRbDMIoLt9LYHq/Rz1WCEH8AtmdsBTS/it28Ij/A3W0zyoSwUpAUxBtXaKRh/gpbxdWmjxX+nVfFJYL//b4g==", "dependencies": { "@ipld/car": "^5.1.0", "@ipld/dag-cbor": "^9.0.0", - "@ucanto/core": "^9.0.1", - "@ucanto/interface": "^9.0.0", + "@ucanto/core": "^10.0.0", + "@ucanto/interface": "^10.0.0", "multiformats": "^11.0.2" } }, @@ -1608,29 +1633,21 @@ "web-streams-polyfill": "^3.1.1" } }, - "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": "18.1.1", - "resolved": "https://registry.npmjs.org/@web3-storage/access/-/access-18.1.1.tgz", - "integrity": "sha512-q4hB2eKH0CH+FpN3Sj6fsIPrzqYo7QgG3kKklAt36C+nXHnua2X1TZraCsTcZzCvvV9lYtrRcwuROghi7QQAPA==", + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@web3-storage/access/-/access-20.0.0.tgz", + "integrity": "sha512-kl2b3ZuN3NvAxDM6K8GlPgu1o67JtA3EGId8Bg+tFRqZiQlERQmMMOfLl8zKVOUvlq4bDFtWHl6EViLO4BwSJw==", "dependencies": { "@ipld/car": "^5.1.1", "@ipld/dag-ucan": "^3.4.0", "@scure/bip39": "^1.2.1", - "@ucanto/client": "^9.0.0", - "@ucanto/core": "^9.0.1", - "@ucanto/interface": "^9.0.0", - "@ucanto/principal": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@ucanto/validator": "^9.0.1", - "@web3-storage/capabilities": "^13.0.0", + "@ucanto/client": "^9.0.1", + "@ucanto/core": "^10.0.1", + "@ucanto/interface": "^10.0.1", + "@ucanto/principal": "^9.0.1", + "@ucanto/transport": "^9.1.1", + "@ucanto/validator": "^9.0.2", + "@web3-storage/capabilities": "^17.1.1", "@web3-storage/did-mailto": "^2.1.0", "bigint-mod-arith": "^3.1.2", "conf": "11.0.2", @@ -1641,33 +1658,10 @@ "uint8arrays": "^4.0.6" } }, - "node_modules/@web3-storage/access/node_modules/@web3-storage/capabilities": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-13.0.0.tgz", - "integrity": "sha512-SSviDXFweCu8FhaQ7BjsK1WDPBdwoduJhfD2DFRKkZT/V25vdBkqtW4qVc6tfO5IhTVxRpnn62PmbIbbcHzBRQ==", - "dependencies": { - "@ucanto/core": "^9.0.1", - "@ucanto/interface": "^9.0.0", - "@ucanto/principal": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@ucanto/validator": "^9.0.1", - "@web3-storage/data-segment": "^3.2.0" - } - }, - "node_modules/@web3-storage/access/node_modules/@web3-storage/data-segment": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@web3-storage/data-segment/-/data-segment-3.2.0.tgz", - "integrity": "sha512-SM6eNumXzrXiQE2/J59+eEgCRZNYPxKhRoHX2QvV3/scD4qgcf4g+paWBc3UriLEY1rCboygGoPsnqYJNyZyfA==", - "dependencies": { - "@ipld/dag-cbor": "^9.0.5", - "multiformats": "^11.0.2", - "sync-multihash-sha2": "^1.0.0" - } - }, - "node_modules/@web3-storage/access/node_modules/@web3-storage/data-segment/node_modules/multiformats": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.2.tgz", - "integrity": "sha512-b5mYMkOkARIuVZCpvijFj9a6m5wMVLC7cf/jIPd5D/ARDOfLC5+IFkbgDXQgcU2goIsTD/O9NY4DI/Mt4OGvlg==", + "node_modules/@web3-storage/access/node_modules/multiformats": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.3.tgz", + "integrity": "sha512-eajQ/ZH7qXZQR2AgtfpmSMizQzmyYVmCql7pdhldPuYQi4atACekbJaQplk6dWyIi10jCaFnd6pqvcEFXjbaJw==", "engines": { "node": ">=16.0.0", "npm": ">=7.0.0" @@ -1684,17 +1678,43 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@web3-storage/blob-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@web3-storage/blob-index/-/blob-index-1.0.2.tgz", + "integrity": "sha512-N+yMIk2cmgaGYVy9EewsRx1sxSDv67i2IBlZ4y72a/+lVIAmb3ZP0IwZ+Med0xrNZShA4blxIGJm1LVF7Q4mSg==", + "dependencies": { + "@ipld/dag-cbor": "^9.0.6", + "@ucanto/core": "^10.0.1", + "@ucanto/interface": "^10.0.1", + "@web3-storage/capabilities": "^17.1.0", + "carstream": "^2.1.0", + "multiformats": "^13.0.1", + "uint8arrays": "^5.0.3" + }, + "engines": { + "node": ">=16.15" + } + }, + "node_modules/@web3-storage/blob-index/node_modules/uint8arrays": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-5.1.0.tgz", + "integrity": "sha512-vA6nFepEmlSKkMBnLBaUMVvAC4G3CTmO58C12y4sq6WPDOR7mOFYOi7GlrQ4djeSbP6JG9Pv9tJDM97PedRSww==", + "dependencies": { + "multiformats": "^13.0.0" + } + }, "node_modules/@web3-storage/capabilities": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-12.1.0.tgz", - "integrity": "sha512-SlYdPqCokDHb55zlZOvh+n8uEMOrEU413Z1MzQ8HvULpbzfcEtGyOiDgrAhdNEZtPnWHqaUEtU7o829Yw2Ra5w==", + "version": "17.1.1", + "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-17.1.1.tgz", + "integrity": "sha512-zmDGBN7/HMt8FUZhg+hdc7CHrYBzV2PaRJToPN0mA496EH1rbNY7c1a8eYxqhM1OugoWohCKH6YOdS3V+Eyxig==", "dependencies": { - "@ucanto/core": "^9.0.1", - "@ucanto/interface": "^9.0.0", - "@ucanto/principal": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@ucanto/validator": "^9.0.1", - "@web3-storage/data-segment": "^3.2.0" + "@ucanto/core": "^10.0.1", + "@ucanto/interface": "^10.0.1", + "@ucanto/principal": "^9.0.1", + "@ucanto/transport": "^9.1.1", + "@ucanto/validator": "^9.0.2", + "@web3-storage/data-segment": "^3.2.0", + "uint8arrays": "^5.0.3" } }, "node_modules/@web3-storage/capabilities/node_modules/@web3-storage/data-segment": { @@ -1716,6 +1736,33 @@ "npm": ">=7.0.0" } }, + "node_modules/@web3-storage/capabilities/node_modules/uint8arrays": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-5.1.0.tgz", + "integrity": "sha512-vA6nFepEmlSKkMBnLBaUMVvAC4G3CTmO58C12y4sq6WPDOR7mOFYOi7GlrQ4djeSbP6JG9Pv9tJDM97PedRSww==", + "dependencies": { + "multiformats": "^13.0.0" + } + }, + "node_modules/@web3-storage/capabilities/node_modules/uint8arrays/node_modules/multiformats": { + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-13.1.0.tgz", + "integrity": "sha512-HzdtdBwxsIkzpeXzhQ5mAhhuxcHbjEHH+JQoxt7hG/2HGFjjwyolLo7hbaexcnhoEuV4e0TNJ8kkpMjiEYY4VQ==" + }, + "node_modules/@web3-storage/content-claims": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@web3-storage/content-claims/-/content-claims-5.0.0.tgz", + "integrity": "sha512-HJFRFsR0qHCe0cOERsb3AjAxxzohYMMoIWaGJgrShDycnl6yqXHrGcdua1BWUDu5pmvKzwD9D7VmI8aSfrCcRA==", + "dev": true, + "dependencies": { + "@ucanto/client": "^9.0.1", + "@ucanto/interface": "^10.0.0", + "@ucanto/server": "^10.0.0", + "@ucanto/transport": "^9.1.1", + "carstream": "^2.0.0", + "multiformats": "^13.1.0" + } + }, "node_modules/@web3-storage/data-segment": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/@web3-storage/data-segment/-/data-segment-5.0.0.tgz", @@ -1758,49 +1805,27 @@ } }, "node_modules/@web3-storage/filecoin-api": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@web3-storage/filecoin-api/-/filecoin-api-4.1.1.tgz", - "integrity": "sha512-VOVo+0eigelqHC/vitwEO7wG7oVNhWur9t7LGFKVqjlVZKMuXGS2xtkF7oUn5yRwmckh+4ip3/5Bp+YbpEP/Zg==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@web3-storage/filecoin-api/-/filecoin-api-7.1.0.tgz", + "integrity": "sha512-rf3DhKWv8MGpKj84lSb1lzxAJRIpkNrPFpzs6iP5Es4LVxiRTm7k2L6CxUYMhtfgUegWP0O21xmDh0Y+Yquz9Q==", "dev": true, "dependencies": { "@ipld/dag-ucan": "^3.4.0", - "@ucanto/client": "^9.0.0", - "@ucanto/core": "^9.0.1", - "@ucanto/interface": "^9.0.0", - "@ucanto/server": "^9.0.1", - "@ucanto/transport": "^9.0.0", - "@web3-storage/capabilities": "^11.4.1", - "@web3-storage/data-segment": "^4.0.0" + "@ucanto/client": "^9.0.1", + "@ucanto/core": "^10.0.1", + "@ucanto/interface": "^10.0.1", + "@ucanto/server": "^10.0.0", + "@ucanto/transport": "^9.1.1", + "@web3-storage/capabilities": "^17.1.1", + "@web3-storage/content-claims": "^5.0.0", + "@web3-storage/data-segment": "^4.0.0", + "fr32-sha2-256-trunc254-padded-binary-tree-multihash": "^3.3.0", + "p-map": "^6.0.0" }, "engines": { "node": ">=16.15" } }, - "node_modules/@web3-storage/filecoin-api/node_modules/@web3-storage/capabilities": { - "version": "11.4.1", - "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-11.4.1.tgz", - "integrity": "sha512-PjIewEg/T3wfNavxzsZZ5MpH2WBldNz94qOQOKg5iH/4UrS8SPWWGsJx/Tu760O+PFhpTFwvi5cHCtkb08OdAA==", - "dev": true, - "dependencies": { - "@ucanto/core": "^9.0.1", - "@ucanto/interface": "^9.0.0", - "@ucanto/principal": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@ucanto/validator": "^9.0.0", - "@web3-storage/data-segment": "^3.2.0" - } - }, - "node_modules/@web3-storage/filecoin-api/node_modules/@web3-storage/capabilities/node_modules/@web3-storage/data-segment": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@web3-storage/data-segment/-/data-segment-3.2.0.tgz", - "integrity": "sha512-SM6eNumXzrXiQE2/J59+eEgCRZNYPxKhRoHX2QvV3/scD4qgcf4g+paWBc3UriLEY1rCboygGoPsnqYJNyZyfA==", - "dev": true, - "dependencies": { - "@ipld/dag-cbor": "^9.0.5", - "multiformats": "^11.0.2", - "sync-multihash-sha2": "^1.0.0" - } - }, "node_modules/@web3-storage/filecoin-api/node_modules/@web3-storage/data-segment": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@web3-storage/data-segment/-/data-segment-4.0.0.tgz", @@ -1823,16 +1848,57 @@ } }, "node_modules/@web3-storage/filecoin-client": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@web3-storage/filecoin-client/-/filecoin-client-3.2.0.tgz", - "integrity": "sha512-4kSyXcN7jPAnpO2U8afheYBRJ4E/8aRJvCvPgHF+HZEtEaLHYuuQzU72Aro94qV0bm5ZRxXPNh6wRSlz/XZLlg==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/@web3-storage/filecoin-client/-/filecoin-client-3.3.3.tgz", + "integrity": "sha512-xFL8odr5PpTjQvpfw/4jphcm7ZvcBRMSKHn3ReEaVcFjxQL45Rojjleuq/QEdMwrNfsLCqqAxC54jk55o5/ERQ==", "dependencies": { "@ipld/dag-ucan": "^3.4.0", - "@ucanto/client": "^9.0.0", - "@ucanto/core": "^9.0.1", - "@ucanto/interface": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@web3-storage/capabilities": "^12.1.0" + "@ucanto/client": "^9.0.1", + "@ucanto/core": "^10.0.1", + "@ucanto/interface": "^10.0.1", + "@ucanto/transport": "^9.1.1", + "@web3-storage/capabilities": "^16.0.0" + } + }, + "node_modules/@web3-storage/filecoin-client/node_modules/@web3-storage/capabilities": { + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-16.0.0.tgz", + "integrity": "sha512-wCjLpYc6t8tFRZrF2k2vBteJDWzHkmQjoJG0Yy/fjA04IjNN48iVZaCMQIANHXZxDGlYRGxhwzDwl4dovAdSTQ==", + "dependencies": { + "@ucanto/core": "^10.0.1", + "@ucanto/interface": "^10.0.1", + "@ucanto/principal": "^9.0.1", + "@ucanto/transport": "^9.1.1", + "@ucanto/validator": "^9.0.2", + "@web3-storage/data-segment": "^3.2.0", + "uint8arrays": "^5.0.3" + } + }, + "node_modules/@web3-storage/filecoin-client/node_modules/@web3-storage/data-segment": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@web3-storage/data-segment/-/data-segment-3.2.0.tgz", + "integrity": "sha512-SM6eNumXzrXiQE2/J59+eEgCRZNYPxKhRoHX2QvV3/scD4qgcf4g+paWBc3UriLEY1rCboygGoPsnqYJNyZyfA==", + "dependencies": { + "@ipld/dag-cbor": "^9.0.5", + "multiformats": "^11.0.2", + "sync-multihash-sha2": "^1.0.0" + } + }, + "node_modules/@web3-storage/filecoin-client/node_modules/@web3-storage/data-segment/node_modules/multiformats": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.2.tgz", + "integrity": "sha512-b5mYMkOkARIuVZCpvijFj9a6m5wMVLC7cf/jIPd5D/ARDOfLC5+IFkbgDXQgcU2goIsTD/O9NY4DI/Mt4OGvlg==", + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/@web3-storage/filecoin-client/node_modules/uint8arrays": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-5.1.0.tgz", + "integrity": "sha512-vA6nFepEmlSKkMBnLBaUMVvAC4G3CTmO58C12y4sq6WPDOR7mOFYOi7GlrQ4djeSbP6JG9Pv9tJDM97PedRSww==", + "dependencies": { + "multiformats": "^13.0.0" } }, "node_modules/@web3-storage/sigv4": { @@ -1845,95 +1911,90 @@ } }, "node_modules/@web3-storage/upload-api": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/@web3-storage/upload-api/-/upload-api-7.3.3.tgz", - "integrity": "sha512-oNWB2IHsUTlsmTnNLk/ZHmxno2YpkamD6xRfmkT/cGt7Wb/uXHdqPz8tRCrQqjLqpTHiwk/bteMijnhJmsz0IA==", - "dev": true, - "dependencies": { - "@ucanto/client": "^9.0.0", - "@ucanto/interface": "^9.0.0", - "@ucanto/principal": "^9.0.0", - "@ucanto/server": "^9.0.1", - "@ucanto/transport": "^9.0.0", - "@ucanto/validator": "^9.0.1", - "@web3-storage/access": "^18.0.0", - "@web3-storage/capabilities": "^12.0.1", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/@web3-storage/upload-api/-/upload-api-17.0.0.tgz", + "integrity": "sha512-LXV5Atvyfwvfe0G6g1ym2bn6M1LR/DudCMiJOMpSZxwFtjDxneMaWrE+Nrfns+NIFuqrEhz3MNyRABGuBaPSFg==", + "dev": true, + "dependencies": { + "@ucanto/client": "^9.0.1", + "@ucanto/interface": "^10.0.1", + "@ucanto/principal": "^9.0.1", + "@ucanto/server": "^10.0.0", + "@ucanto/transport": "^9.1.1", + "@ucanto/validator": "^9.0.2", + "@web3-storage/access": "^20.0.0", + "@web3-storage/blob-index": "^1.0.2", + "@web3-storage/capabilities": "^17.1.1", + "@web3-storage/content-claims": "^5.0.0", "@web3-storage/did-mailto": "^2.1.0", - "@web3-storage/filecoin-api": "^4.1.1", + "@web3-storage/filecoin-api": "^7.1.0", "multiformats": "^12.1.2", - "p-retry": "^5.1.2" + "p-retry": "^5.1.2", + "uint8arrays": "^5.0.3" }, "engines": { "node": ">=16.15" } }, - "node_modules/@web3-storage/upload-client": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@web3-storage/upload-client/-/upload-client-12.3.2.tgz", - "integrity": "sha512-vtf8Sb9GWfde9+tL+9Yu6bpB2Erzk/w99LTW55V6VPF6IdhmvPqAD83/X6w5G7VfxfEbFZ3ElRCqA8hOasP8aQ==", + "node_modules/@web3-storage/upload-api/node_modules/multiformats": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.3.tgz", + "integrity": "sha512-eajQ/ZH7qXZQR2AgtfpmSMizQzmyYVmCql7pdhldPuYQi4atACekbJaQplk6dWyIi10jCaFnd6pqvcEFXjbaJw==", + "dev": true, + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/@web3-storage/upload-api/node_modules/uint8arrays": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-5.1.0.tgz", + "integrity": "sha512-vA6nFepEmlSKkMBnLBaUMVvAC4G3CTmO58C12y4sq6WPDOR7mOFYOi7GlrQ4djeSbP6JG9Pv9tJDM97PedRSww==", "dev": true, + "dependencies": { + "multiformats": "^13.0.0" + } + }, + "node_modules/@web3-storage/upload-api/node_modules/uint8arrays/node_modules/multiformats": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-13.1.1.tgz", + "integrity": "sha512-JiptvwMmlxlzIlLLwhCi/srf/nk409UL0eUBr0kioRJq15hqqKyg68iftrBvhCRjR6Rw4fkNnSc4ZJXJDuta/Q==", + "dev": true + }, + "node_modules/@web3-storage/upload-client": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/@web3-storage/upload-client/-/upload-client-16.0.1.tgz", + "integrity": "sha512-PVkeSIaq2MNJxHAA9JUChA8d2rG3LNV5HD1qDlXCXHPZo/bA/eIsjMHBWqysGVYR2aW3gE0v65Xq/YZzDgJVbA==", "dependencies": { "@ipld/car": "^5.2.2", "@ipld/dag-cbor": "^9.0.6", "@ipld/dag-ucan": "^3.4.0", "@ipld/unixfs": "^2.1.1", - "@ucanto/client": "^9.0.0", - "@ucanto/interface": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@web3-storage/capabilities": "^12.1.0", - "fr32-sha2-256-trunc254-padded-binary-tree-multihash": "^3.1.1", + "@ucanto/client": "^9.0.1", + "@ucanto/core": "^10.0.1", + "@ucanto/interface": "^10.0.1", + "@ucanto/transport": "^9.1.1", + "@web3-storage/blob-index": "^1.0.2", + "@web3-storage/capabilities": "^17.1.1", + "@web3-storage/data-segment": "^5.1.0", + "@web3-storage/filecoin-client": "^3.3.3", "ipfs-utils": "^9.0.14", "multiformats": "^12.1.2", "p-retry": "^5.1.2", - "parallel-transform-web": "^1.0.1", "varint": "^6.0.0" } }, - "node_modules/@web3-storage/w3up-client": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/@web3-storage/w3up-client/-/w3up-client-12.2.0.tgz", - "integrity": "sha512-pAB9ZF9tK05thGCWScqb8sSe1EXkUrZVLZOrZbVLRPl2RQYXYKmjhQLimcjmwwmfLOlK3kNZj0JJhhlzzU3WPQ==", - "dependencies": { - "@ipld/dag-ucan": "^3.4.0", - "@ucanto/client": "^9.0.0", - "@ucanto/core": "^9.0.1", - "@ucanto/interface": "^9.0.0", - "@ucanto/principal": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@web3-storage/access": "^18.1.1", - "@web3-storage/capabilities": "^13.0.0", - "@web3-storage/did-mailto": "^2.1.0", - "@web3-storage/filecoin-client": "^3.2.0", - "@web3-storage/upload-client": "^13.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/@web3-storage/w3up-client/node_modules/@web3-storage/capabilities": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/@web3-storage/capabilities/-/capabilities-13.0.0.tgz", - "integrity": "sha512-SSviDXFweCu8FhaQ7BjsK1WDPBdwoduJhfD2DFRKkZT/V25vdBkqtW4qVc6tfO5IhTVxRpnn62PmbIbbcHzBRQ==", - "dependencies": { - "@ucanto/core": "^9.0.1", - "@ucanto/interface": "^9.0.0", - "@ucanto/principal": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@ucanto/validator": "^9.0.1", - "@web3-storage/data-segment": "^3.2.0" - } - }, - "node_modules/@web3-storage/w3up-client/node_modules/@web3-storage/data-segment": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@web3-storage/data-segment/-/data-segment-3.2.0.tgz", - "integrity": "sha512-SM6eNumXzrXiQE2/J59+eEgCRZNYPxKhRoHX2QvV3/scD4qgcf4g+paWBc3UriLEY1rCboygGoPsnqYJNyZyfA==", + "node_modules/@web3-storage/upload-client/node_modules/@web3-storage/data-segment": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@web3-storage/data-segment/-/data-segment-5.1.0.tgz", + "integrity": "sha512-FYdmtKvNiVz+maZ++k4PdD43rfJW5DeagLpstq2y84CyOKNRBWbHLCZ/Ec5zT9iGI+0WgsCGbpC/WlG0jlrnhA==", "dependencies": { "@ipld/dag-cbor": "^9.0.5", "multiformats": "^11.0.2", "sync-multihash-sha2": "^1.0.0" } }, - "node_modules/@web3-storage/w3up-client/node_modules/@web3-storage/data-segment/node_modules/multiformats": { + "node_modules/@web3-storage/upload-client/node_modules/@web3-storage/data-segment/node_modules/multiformats": { "version": "11.0.2", "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.2.tgz", "integrity": "sha512-b5mYMkOkARIuVZCpvijFj9a6m5wMVLC7cf/jIPd5D/ARDOfLC5+IFkbgDXQgcU2goIsTD/O9NY4DI/Mt4OGvlg==", @@ -1942,25 +2003,35 @@ "npm": ">=7.0.0" } }, - "node_modules/@web3-storage/w3up-client/node_modules/@web3-storage/upload-client": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/@web3-storage/upload-client/-/upload-client-13.0.0.tgz", - "integrity": "sha512-NCasbk7msHiQ+e+7TIYiOJyYcoiUlcK44FIYffDX+k4mb9J0qfA93Cw3FQSHe4D/3nEm5nCYs1rNxl07OIOpoQ==", + "node_modules/@web3-storage/upload-client/node_modules/multiformats": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.3.tgz", + "integrity": "sha512-eajQ/ZH7qXZQR2AgtfpmSMizQzmyYVmCql7pdhldPuYQi4atACekbJaQplk6dWyIi10jCaFnd6pqvcEFXjbaJw==", + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/@web3-storage/w3up-client": { + "version": "14.0.0-rc.2", + "resolved": "https://registry.npmjs.org/@web3-storage/w3up-client/-/w3up-client-14.0.0-rc.2.tgz", + "integrity": "sha512-Wt7nBTCoRKvwgZ6vgvFMsCCFNogyPeAmLQxn+/CIDeH5j5qMN120Scqolr3kIlOel7mVaeoHk66vgcjW+b7n6w==", "dependencies": { - "@ipld/car": "^5.2.2", - "@ipld/dag-cbor": "^9.0.6", "@ipld/dag-ucan": "^3.4.0", - "@ipld/unixfs": "^2.1.1", - "@ucanto/client": "^9.0.0", - "@ucanto/interface": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@web3-storage/capabilities": "^13.0.0", - "fr32-sha2-256-trunc254-padded-binary-tree-multihash": "^3.1.1", - "ipfs-utils": "^9.0.14", - "multiformats": "^12.1.2", - "p-retry": "^5.1.2", - "parallel-transform-web": "^1.0.1", - "varint": "^6.0.0" + "@ucanto/client": "^9.0.1", + "@ucanto/core": "^10.0.1", + "@ucanto/interface": "^10.0.1", + "@ucanto/principal": "^9.0.1", + "@ucanto/transport": "^9.1.1", + "@web3-storage/access": "^20.0.0", + "@web3-storage/blob-index": "^1.0.2", + "@web3-storage/capabilities": "^17.1.1", + "@web3-storage/did-mailto": "^2.0.2", + "@web3-storage/filecoin-client": "^3.3.3", + "@web3-storage/upload-client": "^16.0.1" + }, + "engines": { + "node": ">=18" } }, "node_modules/@zxing/text-encoding": { @@ -2439,6 +2510,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/carstream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/carstream/-/carstream-2.2.0.tgz", + "integrity": "sha512-/gHkK0lQjmGM45fhdx8JD+x7a1XS1qUk3T9xWWSt3oZiWPLq4u/lnDstp+N55K7hqTKKlb0CCr43EHTrlbmJSQ==", + "dependencies": { + "@ipld/dag-cbor": "^9.0.3", + "multiformats": "^13.0.1", + "uint8arraylist": "^2.4.3" + } + }, "node_modules/cborg": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/cborg/-/cborg-4.0.3.tgz", @@ -3625,9 +3706,10 @@ } }, "node_modules/fr32-sha2-256-trunc254-padded-binary-tree-multihash": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fr32-sha2-256-trunc254-padded-binary-tree-multihash/-/fr32-sha2-256-trunc254-padded-binary-tree-multihash-3.1.1.tgz", - "integrity": "sha512-4nYelGDFTB/gvCK2QdbAKyLcir0uELmzsFSBAJmqHI6JktlIickWFOITRINGdKQU6nqkg+7kWu7i80w1QjAW9Q==" + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/fr32-sha2-256-trunc254-padded-binary-tree-multihash/-/fr32-sha2-256-trunc254-padded-binary-tree-multihash-3.3.0.tgz", + "integrity": "sha512-O11VDxPmPvbQj5eac2BJXyieNacyd+RCMhwOzXQQM/NCI25x3c32YWB4/JwgOWPCpKnNXF6lpK/j0lj7GWOnYQ==", + "dev": true }, "node_modules/fs.realpath": { "version": "1.0.0", @@ -4868,13 +4950,9 @@ } }, "node_modules/multiformats": { - "version": "12.1.3", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.3.tgz", - "integrity": "sha512-eajQ/ZH7qXZQR2AgtfpmSMizQzmyYVmCql7pdhldPuYQi4atACekbJaQplk6dWyIi10jCaFnd6pqvcEFXjbaJw==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-13.1.1.tgz", + "integrity": "sha512-JiptvwMmlxlzIlLLwhCi/srf/nk409UL0eUBr0kioRJq15hqqKyg68iftrBvhCRjR6Rw4fkNnSc4ZJXJDuta/Q==" }, "node_modules/murmurhash3js-revisited": { "version": "3.0.0", @@ -4893,9 +4971,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "funding": [ { "type": "github", @@ -5392,6 +5470,18 @@ "node": ">=8" } }, + "node_modules/p-map": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-6.0.0.tgz", + "integrity": "sha512-T8BatKGY+k5rU+Q/GTYgrEf2r4xRMevAN5mtXc2aPc4rS1j3s+vWTaO2Wag94neXuCAUAs8cxBL9EeB5EA6diw==", + "dev": true, + "engines": { + "node": ">=16" + }, + "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", @@ -5424,11 +5514,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/parallel-transform-web": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parallel-transform-web/-/parallel-transform-web-1.0.1.tgz", - "integrity": "sha512-RtPU/7IuwPZ4ePcqoPxNCpjtaXYOkCVtnhh5tW3O78wy9jqVoV2hQHms17kUeu8DTYoOP+mykFLg2agwVKlwBw==" - }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -5635,9 +5720,9 @@ "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==" }, "node_modules/protobufjs": { - "version": "7.2.5", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz", - "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.3.0.tgz", + "integrity": "sha512-YWD03n3shzV9ImZRX3ccbjqLxj7NokGN0V/ESiBV5xWqrommYHYiihuIyavq03pWSGqlyvYUFmfoMKd+1rPA/g==", "hasInstallScript": true, "dependencies": { "@protobufjs/aspromise": "^1.1.2", @@ -6598,6 +6683,22 @@ "node": ">=14.17" } }, + "node_modules/uint8arraylist": { + "version": "2.4.8", + "resolved": "https://registry.npmjs.org/uint8arraylist/-/uint8arraylist-2.4.8.tgz", + "integrity": "sha512-vc1PlGOzglLF0eae1M8mLRTBivsvrGsdmJ5RbK3e+QRvRLOZfZhQROTwH/OfyF3+ZVUg9/8hE8bmKP2CvP9quQ==", + "dependencies": { + "uint8arrays": "^5.0.1" + } + }, + "node_modules/uint8arraylist/node_modules/uint8arrays": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-5.1.0.tgz", + "integrity": "sha512-vA6nFepEmlSKkMBnLBaUMVvAC4G3CTmO58C12y4sq6WPDOR7mOFYOi7GlrQ4djeSbP6JG9Pv9tJDM97PedRSww==", + "dependencies": { + "multiformats": "^13.0.0" + } + }, "node_modules/uint8arrays": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-4.0.6.tgz", @@ -6606,6 +6707,15 @@ "multiformats": "^12.0.1" } }, + "node_modules/uint8arrays/node_modules/multiformats": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.3.tgz", + "integrity": "sha512-eajQ/ZH7qXZQR2AgtfpmSMizQzmyYVmCql7pdhldPuYQi4atACekbJaQplk6dWyIi10jCaFnd6pqvcEFXjbaJw==", + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + } + }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -6759,6 +6869,7 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", + "dev": true, "engines": { "node": ">= 8" } diff --git a/package.json b/package.json index a9762f2..029a559 100644 --- a/package.json +++ b/package.json @@ -32,17 +32,16 @@ "homepage": "https://github.com/w3s-project/w3cli#readme", "devDependencies": { "@types/update-notifier": "^6.0.5", - "@ucanto/interface": "^9.0.0", - "@ucanto/principal": "^9.0.0", - "@ucanto/server": "^9.0.1", + "@ucanto/interface": "^10.0.1", + "@ucanto/principal": "^9.0.1", + "@ucanto/server": "^10.0.0", "@web-std/blob": "^3.0.5", - "@web3-storage/capabilities": "^12.0.2", + "@web3-storage/capabilities": "17.1.1", "@web3-storage/eslint-config-w3up": "^1.0.0", "@web3-storage/sigv4": "^1.0.2", - "@web3-storage/upload-api": "^7.3.3", - "@web3-storage/upload-client": "^12.0.1", + "@web3-storage/upload-api": "^17.0.0", "entail": "^2.1.1", - "multiformats": "^12.1.3", + "multiformats": "^13.1.1", "npm-run-all": "^4.1.5", "prettier": "^3.0.3", "typescript": "^5.2.2" @@ -53,13 +52,13 @@ "@ipld/car": "^5.2.4", "@ipld/dag-json": "^10.1.5", "@ipld/dag-ucan": "^3.4.0", - "@ucanto/client": "^9.0.0", - "@ucanto/core": "^9.0.0", - "@ucanto/transport": "^9.0.0", - "@web3-storage/access": "^18.0.7", + "@ucanto/client": "^9.0.1", + "@ucanto/core": "^10.0.1", + "@ucanto/transport": "^9.1.1", + "@web3-storage/access": "^20.0.0", "@web3-storage/data-segment": "^5.0.0", "@web3-storage/did-mailto": "^2.1.0", - "@web3-storage/w3up-client": "^12.2.0", + "@web3-storage/w3up-client": "^14.0.0-rc.2", "ansi-escapes": "^6.2.0", "chalk": "^5.3.0", "files-from-path": "^1.0.4", diff --git a/space.js b/space.js index 41cea8d..5fe3ae3 100644 --- a/space.js +++ b/space.js @@ -113,7 +113,7 @@ export const create = async (name, options) => { /** * @param {import('@web3-storage/w3up-client').Client} client * @param {object} options - * @param {import('@web3-storage/upload-api').SpaceDID} options.space + * @param {import('@web3-storage/w3up-client/types').SpaceDID} options.space * @param {DIDMailto.EmailAddress} [options.customer] * @param {string} [options.message] * @param {string} [options.waitMessage] @@ -233,7 +233,7 @@ export const provision = async (name = '', options = {}) => { } /** - * @typedef {import('@web3-storage/upload-api').SpaceDID} SpaceDID + * @typedef {import('@web3-storage/w3up-client/types').SpaceDID} SpaceDID * * @param {import('@web3-storage/w3up-client').Client} client * @param {object} options @@ -276,8 +276,7 @@ const parseEmail = (email) => { } /** - * - * @param {W3Space.Model} space + * @param {W3Space.OwnedSpace} space * @param {CreateOptions} options */ export const setupRecovery = async (space, options = {}) => { diff --git a/test/bin.spec.js b/test/bin.spec.js index c60eb18..b2a0fb8 100644 --- a/test/bin.spec.js +++ b/test/bin.spec.js @@ -19,7 +19,8 @@ import * as ED25519 from '@ucanto/principal/ed25519' import { sha256, delegate } from '@ucanto/core' import * as Result from '@web3-storage/w3up-client/result' import { base64 } from 'multiformats/bases/base64' -import { info } from 'console' +import { base58btc } from 'multiformats/bases/base58' +import * as Digest from 'multiformats/hashes/digest' const w3 = Command.create('./bin.js') @@ -297,7 +298,7 @@ export const testSpace = { const email = 'alice@web.mail' await login(context, { email }) - context.plansStorage.get = async (account) => { + context.plansStorage.get = async () => { return { ok: { product: 'did:web:free.web3.storage', updatedAt: 'now' }, } @@ -742,6 +743,9 @@ export const testW3Up = { .env(context.env.alice) .join() + // wait a second for invocation to get a different expiry + await new Promise((resolve) => setTimeout(resolve, 1000)) + const list1 = await w3.args(['ls', '--json']).env(context.env.alice).join() assert.ok(dagJSON.parse(list1.output)) @@ -750,10 +754,20 @@ export const testW3Up = { 'w3 remove': test(async (assert, context) => { await loginAndCreateSpace(context) + const up = await w3 + .args(['up', 'test/fixtures/pinpie.jpg']) + .env(context.env.alice) + .join() + + assert.match( + up.output, + /bafybeiajdopsmspomlrpaohtzo5sdnpknbolqjpde6huzrsejqmvijrcea/ + ) + const rm = await w3 .args([ 'rm', - 'bafybeih2k7ughhfwedltjviunmn3esueijz34snyay77zmsml5w24tqamm', + 'bafybeiajdopsmspomlrpaohtzo5sdnpknbolqjpde6huzrsejqmvijrcea', ]) .env(context.env.alice) .join() @@ -779,7 +793,7 @@ export const testW3Up = { assert.equal(rm.status.code, 1) assert.match( rm.error, - /Upload not found/ + /not found/ ) }), } @@ -1070,6 +1084,58 @@ export const testProof = { }), } +export const testBlob = { + 'w3 can blob add': test(async (assert, context) => { + await loginAndCreateSpace(context) + + const { error } = await w3 + .args(['can', 'blob', 'add', 'test/fixtures/pinpie.jpg']) + .env(context.env.alice) + .join() + + assert.match(error, /Stored zQm/) + }), + + 'w3 can blob ls': test(async (assert, context) => { + await loginAndCreateSpace(context) + + await w3 + .args(['can', 'blob', 'add', 'test/fixtures/pinpie.jpg']) + .env(context.env.alice) + .join() + + const list = await w3 + .args(['can', 'blob', 'ls', '--json']) + .env(context.env.alice) + .join() + + assert.ok(dagJSON.parse(list.output)) + }), + + 'w3 can blob rm': test(async (assert, context) => { + await loginAndCreateSpace(context) + + await w3 + .args(['can', 'blob', 'add', 'test/fixtures/pinpie.jpg']) + .env(context.env.alice) + .join() + + const list = await w3 + .args(['can', 'blob', 'ls', '--json']) + .env(context.env.alice) + .join() + + const digest = Digest.decode(dagJSON.parse(list.output).blob.digest) + + const remove = await w3 + .args(['can', 'blob', 'rm', base58btc.encode(digest.bytes)]) + .env(context.env.alice) + .join() + + assert.match(remove.error, /Removed zQm/) + }), +} + export const testStore = { 'w3 can store add': test(async (assert, context) => { await loginAndCreateSpace(context) @@ -1170,7 +1236,7 @@ export const testCan = { await loginAndCreateSpace(context) await w3 - .args(['up', 'test/fixtures/pinpie.jpg']) + .args(['can', 'store', 'add', 'test/fixtures/pinpie.car']) .env(context.env.alice) .join() @@ -1185,16 +1251,14 @@ export const testCan = { const space = await loginAndCreateSpace(context) await w3 - .args(['up', 'test/fixtures/pinpie.jpg']) + .args(['can', 'store', 'add', 'test/fixtures/pinpie.car']) .env(context.env.alice) .join() - const uploads = await context.uploadTable.list(space) - const upload = uploads.results[0] - const shard = upload.shards?.at(0) - - if (!shard) { - return assert.ok(shard, 'shard should been created') + const stores = await context.storeTable.list(space) + const store = stores.ok?.results[0] + if (!store) { + return assert.ok(store, 'stored item should appear in list') } const missingArg = await w3 @@ -1214,14 +1278,14 @@ export const testCan = { assert.match(invalidCID.error, /not a CAR CID/) const notCarCID = await w3 - .args(['can', 'store', 'rm', upload.root.toString()]) + .args(['can', 'store', 'rm', 'bafybeiajdopsmspomlrpaohtzo5sdnpknbolqjpde6huzrsejqmvijrcea']) .env(context.env.alice) .join() .catch() assert.match(notCarCID.error, /not a CAR CID/) const rm = await w3 - .args(['can', 'store', 'rm', shard.toString()]) + .args(['can', 'store', 'rm', store.link.toString()]) .env(context.env.alice) .join() @@ -1259,6 +1323,9 @@ export const testPlan = { await selectPlan(context) + // wait a second for invocation to get a different expiry + await new Promise((resolve) => setTimeout(resolve, 1000)) + const plan = await w3.args(['plan', 'get']).env(context.env.alice).join() assert.match(plan.output, /did:web:free.web3.storage/) }), @@ -1311,14 +1378,15 @@ export const login = async ( * @param {Test.Context} context * @param {object} options * @param {DIDMailto.EmailAddress} [options.email] + * @param {string} [options.billingID] * @param {Plan} [options.plan] */ export const selectPlan = async ( context, - { email = 'alice@web.mail', plan = 'did:web:free.web3.storage' } = {} + { email = 'alice@web.mail', billingID = 'test:cus_alice', plan = 'did:web:free.web3.storage' } = {} ) => { const customer = DIDMailto.fromEmail(email) - await context.plansStorage.set(customer, plan) + Result.try(await context.plansStorage.initialize(customer, billingID, plan)) } /** diff --git a/test/helpers/context.js b/test/helpers/context.js index dfe20b7..1272732 100644 --- a/test/helpers/context.js +++ b/test/helpers/context.js @@ -8,7 +8,7 @@ import { createEnv } from './env.js' import { Signer } from '@ucanto/principal/ed25519' import { createServer as createHTTPServer } from './http-server.js' import http from 'node:http' -import { StoreConf } from '@web3-storage/access/stores/store-conf' +import { StoreConf } from '@web3-storage/w3up-client/stores/conf' import * as FS from 'node:fs/promises' /** did:key:z6Mkqa4oY9Z5Pf5tUcjLHLUsDjKwMC95HGXdE1j22jkbhz6r */ diff --git a/test/helpers/process.js b/test/helpers/process.js index c117415..626fb67 100644 --- a/test/helpers/process.js +++ b/test/helpers/process.js @@ -171,6 +171,8 @@ class Join { const readInto = async (source, output, channel) => { const decoder = new TextDecoder() for await (const chunk of source) { + // Uncomment to debugger easily + // console.log(decoder.decode(chunk)) output[channel] += decoder.decode(chunk) } } diff --git a/test/lib.spec.js b/test/lib.spec.js index 7142efc..c34909d 100644 --- a/test/lib.spec.js +++ b/test/lib.spec.js @@ -81,7 +81,7 @@ bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje` 'uploadListResponseToString can return the upload roots as newline delimited JSON': (assert) => { assert.equal( - uploadListResponseToString(uploadListResponse, { shards: true }), + uploadListResponseToString(uploadListResponse, { shards: true, plainTree: true }), `bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm └─┬ shards └── bagbaierantza4rfjnhqksp2stcnd2tdjrn3f2kgi2wrvaxmayeuolryi66fq