From df594071b6d6c376cea633c3c60c06f576822e82 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Mon, 11 Nov 2024 07:47:59 +0700 Subject: [PATCH] chore: format --- packages/cli/bin.js | 17 +++- packages/cli/bridge.js | 10 +- packages/cli/can.js | 11 ++- packages/cli/index.js | 67 +++++++------ packages/cli/lib.js | 52 +++++++---- packages/cli/space.js | 4 +- packages/cli/test/bin.spec.js | 93 ++++++++++++------- packages/cli/test/helpers/context.js | 3 +- packages/cli/test/helpers/env.js | 2 +- packages/cli/test/helpers/process.js | 1 - packages/cli/test/lib.spec.js | 5 +- packages/upload-api/src/types.ts | 6 +- .../upload-api/test/external-service/index.js | 8 +- .../test/external-service/storage-node.js | 12 ++- packages/upload-api/test/handlers/blob.js | 2 +- packages/w3up-client/src/service.js | 12 ++- 16 files changed, 202 insertions(+), 103 deletions(-) diff --git a/packages/cli/bin.js b/packages/cli/bin.js index b40254216..2b5769a35 100755 --- a/packages/cli/bin.js +++ b/packages/cli/bin.js @@ -76,7 +76,11 @@ cli .describe('Store a file(s) to the service and register an upload.') .option('-H, --hidden', 'Include paths that start with ".".', false) .option('-c, --car', 'File is a CAR file.', false) - .option('--wrap', "Wrap single input file in a directory. Has no effect on directory or CAR uploads. Pass --no-wrap to disable.", true) + .option( + '--wrap', + 'Wrap single input file in a directory. Has no effect on directory or CAR uploads. Pass --no-wrap to disable.', + true + ) .option('--json', 'Format as newline delimited JSON', false) .option('--verbose', 'Output more details.', false) .option( @@ -181,7 +185,7 @@ cli ) .action(Coupon.issue) - cli +cli .command('bridge generate-tokens ') .option('-c, --can', 'One or more abilities to delegate.') .option( @@ -195,7 +199,6 @@ cli ) .action(Bridge.generateTokens) - cli .command('delegation create ') .describe( @@ -323,13 +326,17 @@ cli cli .command('key create') - .describe('Generate and print a new ed25519 key pair. Does not change your current signing key.') + .describe( + 'Generate and print a new ed25519 key pair. Does not change your current signing key.' + ) .option('--json', 'output as json') .action(createKey) cli .command('reset') - .describe('Remove all proofs/delegations from the store but retain the agent DID.') + .describe( + 'Remove all proofs/delegations from the store but retain the agent DID.' + ) .action(reset) // show help text if no command provided diff --git a/packages/cli/bridge.js b/packages/cli/bridge.js index ad6d0d7cb..f3df16c32 100644 --- a/packages/cli/bridge.js +++ b/packages/cli/bridge.js @@ -52,10 +52,12 @@ export const generateTokens = async ( const authorization = base64url.encode(bytes) if (json) { - console.log(JSON.stringify({ - "X-Auth-Secret": xAuthSecret, - "Authorization": authorization - })) + console.log( + JSON.stringify({ + 'X-Auth-Secret': xAuthSecret, + Authorization: authorization, + }) + ) } else { console.log(` X-Auth-Secret header: ${xAuthSecret} diff --git a/packages/cli/can.js b/packages/cli/can.js index 6e6a42ab5..569848642 100644 --- a/packages/cli/can.js +++ b/packages/cli/can.js @@ -37,10 +37,13 @@ export async function blobAdd(blobPath) { spinner.start('Storing') const { digest } = await client.capability.blob.add(blob, { - receiptsEndpoint: client._receiptsEndpoint.toString() + receiptsEndpoint: client._receiptsEndpoint.toString(), }) const cid = Link.create(raw.code, digest) - spinner.stopAndPersist({ symbol: '⁂', text: `Stored ${base58btc.encode(digest.bytes)} (${cid})` }) + spinner.stopAndPersist({ + symbol: '⁂', + text: `Stored ${base58btc.encode(digest.bytes)} (${cid})`, + }) } /** @@ -211,7 +214,9 @@ export async function filecoinInfo(pieceCid, opts) { const client = await getClient() const info = await client.capability.filecoin.info(pieceInfo.link) if (info.out.error) { - spinner.fail(`Error: failed to get filecoin info: ${info.out.error.message}`) + spinner.fail( + `Error: failed to get filecoin info: ${info.out.error.message}` + ) process.exit(1) } spinner.stop() diff --git a/packages/cli/index.js b/packages/cli/index.js index 43ed81623..35b4ed585 100644 --- a/packages/cli/index.js +++ b/packages/cli/index.js @@ -135,12 +135,14 @@ export async function upload(firstPath, opts) { } } else { spinner = ora({ text: 'Reading from stdin', isSilent: opts?.json }).start() - files = [{ - name: 'stdin', - stream: () => - /** @type {ReadableStream} */ - (Readable.toWeb(process.stdin)) - }] + files = [ + { + name: 'stdin', + stream: () => + /** @type {ReadableStream} */ + (Readable.toWeb(process.stdin)), + }, + ] totalSize = -1 opts = opts ?? { _: [] } opts.wrap = false @@ -155,26 +157,27 @@ export async function upload(firstPath, opts) { : client.uploadDirectory.bind(client, files) let totalSent = 0 - const getStoringMessage = () => totalSize == -1 - // for unknown size, display the amount sent so far - ? `Storing ${filesizeMB(totalSent)}` - // for known size, display percentage of total size that has been sent - : `Storing ${Math.min(Math.round((totalSent / totalSize) * 100), 100)}%` + const getStoringMessage = () => + totalSize == -1 + ? // for unknown size, display the amount sent so far + `Storing ${filesizeMB(totalSent)}` + : // for known size, display percentage of total size that has been sent + `Storing ${Math.min(Math.round((totalSent / totalSize) * 100), 100)}%` const root = await uploadFn({ pieceHasher: { code: PieceHasher.code, name: 'fr32-sha2-256-trunc254-padded-binary-tree-multihash', - async digest (input) { + async digest(input) { const hasher = PieceHasher.create() hasher.write(input) - + const bytes = new Uint8Array(hasher.multihashByteLength()) hasher.digestInto(bytes, 0, true) hasher.free() return Digest.decode(bytes) - } + }, }, onShardStored: ({ cid, size, piece }) => { totalSent += size @@ -196,7 +199,7 @@ export async function upload(firstPath, opts) { concurrentRequests: opts?.['concurrent-requests'] && parseInt(String(opts?.['concurrent-requests'])), - receiptsEndpoint: client._receiptsEndpoint.toString() + receiptsEndpoint: client._receiptsEndpoint.toString(), }) spinner.stopAndPersist({ symbol: '⁂', @@ -278,7 +281,9 @@ export async function addSpace(proofPathOrCid) { cid = CID.parse(proofPathOrCid, base64) } catch (/** @type {any} */ err) { if (err?.message?.includes('Unexpected end of data')) { - console.error(`Error: failed to read proof. The string has been truncated.`) + console.error( + `Error: failed to read proof. The string has been truncated.` + ) process.exit(1) } /* otherwise, try as path */ @@ -287,7 +292,9 @@ export async function addSpace(proofPathOrCid) { let delegation if (cid) { if (cid.multihash.code !== identity.code) { - console.error(`Error: failed to read proof. Must be identity CID. Fetching of remote proof CARs not supported by this command yet`) + console.error( + `Error: failed to read proof. Must be identity CID. Fetching of remote proof CARs not supported by this command yet` + ) process.exit(1) } delegation = await readProofFromBytes(cid.multihash.digest) @@ -386,7 +393,9 @@ export async function createDelegation(audienceDID, opts) { const client = await getClient() if (client.currentSpace() == null) { - throw new Error('no current space, use `storacha space register` to create one.') + throw new Error( + 'no current space, use `storacha space register` to create one.' + ) } const audience = DID.parse(audienceDID) @@ -603,10 +612,7 @@ export async function usageReport(opts) { } const failures = [] let total = 0 - for await (const result of getSpaceUsageReports( - client, - period - )) { + for await (const result of getSpaceUsageReports(client, period)) { if ('error' in result) { failures.push(result) } else { @@ -637,9 +643,15 @@ export async function usageReport(opts) { console.log(` Total: ${opts?.human ? filesize(total) : total}`) if (failures.length) { console.warn(``) - console.warn(` WARNING: there were ${failures.length} errors getting usage reports for some spaces.`) - console.warn(` This may happen if your agent does not have usage/report authorization for a space.`) - console.warn(` These spaces were not included in the usage report total:`) + console.warn( + ` WARNING: there were ${failures.length} errors getting usage reports for some spaces.` + ) + console.warn( + ` This may happen if your agent does not have usage/report authorization for a space.` + ) + console.warn( + ` These spaces were not included in the usage report total:` + ) for (const fail of failures) { console.warn(` * space: ${fail.space}`) // @ts-expect-error error is unknown @@ -697,7 +709,10 @@ export const reset = async () => { if (exportData) { let data = AgentData.fromExport(exportData) // do not reset the principal - data = await AgentData.create({ principal: data.principal, meta: data.meta }) + data = await AgentData.create({ + principal: data.principal, + meta: data.meta, + }) await store.save(data.export()) } console.log('⁂ Agent reset.') diff --git a/packages/cli/lib.js b/packages/cli/lib.js index 262cca01d..8215b3363 100644 --- a/packages/cli/lib.js +++ b/packages/cli/lib.js @@ -61,7 +61,9 @@ export function filesizeMB(bytes) { /** Get a configured w3up store used by the CLI. */ export function getStore() { - return new StoreConf({ profile: process.env.STORACHA_STORE_NAME ?? 'storacha-cli' }) + return new StoreConf({ + profile: process.env.STORACHA_STORE_NAME ?? 'storacha-cli', + }) } /** @@ -81,7 +83,7 @@ export function getClient() { if (receiptsEndpointString) { receiptsEndpoint = new URL(receiptsEndpointString) } - + let serviceConf if (uploadServiceDID && uploadServiceURL) { serviceConf = @@ -180,8 +182,8 @@ export function uploadListResponseToString(res, opts = {}) { leaf: shards?.map((s) => s.toString()), }, ], - })} - ) + }) + }) .join('\n') } else { return res.results.map(({ root }) => root.toString()).join('\n') @@ -197,9 +199,7 @@ export function uploadListResponseToString(res, opts = {}) { */ export function blobListResponseToString(res, opts = {}) { if (opts.json) { - return res.results - .map(({ blob }) => dagJSON.stringify({ blob })) - .join('\n') + return res.results.map(({ blob }) => dagJSON.stringify({ blob })).join('\n') } else { return res.results .map(({ blob }) => { @@ -212,7 +212,7 @@ export function blobListResponseToString(res, opts = {}) { } /** - * @param {FilecoinInfoSuccess} res + * @param {FilecoinInfoSuccess} res * @param {object} [opts] * @param {boolean} [opts.raw] * @param {boolean} [opts.json] @@ -220,12 +220,16 @@ export function blobListResponseToString(res, opts = {}) { export function filecoinInfoToString(res, opts = {}) { if (opts.json) { return res.deals - .map(deal => dagJSON.stringify(({ - aggregate: deal.aggregate.toString(), - provider: deal.provider, - dealId: deal.aux.dataSource.dealID, - inclusion: res.aggregates.find(a => a.aggregate.toString() === deal.aggregate.toString())?.inclusion - }))) + .map((deal) => + dagJSON.stringify({ + aggregate: deal.aggregate.toString(), + provider: deal.provider, + dealId: deal.aux.dataSource.dealID, + inclusion: res.aggregates.find( + (a) => a.aggregate.toString() === deal.aggregate.toString() + )?.inclusion, + }) + ) .join('\n') } else { if (!res.deals.length) { @@ -237,11 +241,15 @@ export function filecoinInfoToString(res, opts = {}) { // not showing inclusion proof as it would just be bytes return ` Piece CID: ${res.piece.toString()} - Deals: ${res.deals.map((deal) => ` + Deals: ${res.deals + .map( + (deal) => ` Aggregate: ${deal.aggregate.toString()} Provider: ${deal.provider} Deal ID: ${deal.aux.dataSource.dealID} - `).join('')} + ` + ) + .join('')} ` } } @@ -289,10 +297,14 @@ export const startOfLastMonth = (now) => { } /** @param {ReadableStream} source */ -export const streamToBlob = async source => { +export const streamToBlob = async (source) => { const chunks = /** @type {Uint8Array[]} */ ([]) - await source.pipeTo(new WritableStream({ - write: chunk => { chunks.push(chunk) } - })) + await source.pipeTo( + new WritableStream({ + write: (chunk) => { + chunks.push(chunk) + }, + }) + ) return new Blob(chunks) } diff --git a/packages/cli/space.js b/packages/cli/space.js index c96540385..93afd8cd5 100644 --- a/packages/cli/space.js +++ b/packages/cli/space.js @@ -323,8 +323,8 @@ const chooseName = async (name, spaces) => { name === '' ? 'What would you like to call this space?' : space - ? `Name "${space.name}" is already taken, please choose a different one` - : null + ? `Name "${space.name}" is already taken, please choose a different one` + : null if (message == null) { return name diff --git a/packages/cli/test/bin.spec.js b/packages/cli/test/bin.spec.js index 7b451e086..f1cd1b73a 100644 --- a/packages/cli/test/bin.spec.js +++ b/packages/cli/test/bin.spec.js @@ -101,7 +101,10 @@ export const testAccount = { export const testSpace = { 'storacha space create': test(async (assert, context) => { - const command = storacha.args(['space', 'create']).env(context.env.alice).fork() + const command = storacha + .args(['space', 'create']) + .env(context.env.alice) + .fork() const line = await command.output.take(1).text() @@ -154,18 +157,20 @@ export const testSpace = { await create.terminate().join().catch() }), - 'storacha space create my-space --no-recovery': test(async (assert, context) => { - const create = storacha - .args(['space', 'create', 'home', '--no-recovery']) - .env(context.env.alice) - .fork() + 'storacha space create my-space --no-recovery': test( + async (assert, context) => { + const create = storacha + .args(['space', 'create', 'home', '--no-recovery']) + .env(context.env.alice) + .fork() - const line = await create.output.lines().take().text() + const line = await create.output.lines().take().text() - assert.match(line, /billing account/, 'no paper recovery') + assert.match(line, /billing account/, 'no paper recovery') - await create.terminate().join().catch() - }), + await create.terminate().join().catch() + } + ), 'storacha space create my-space --no-recovery (logged-in)': test( async (assert, context) => { @@ -294,8 +299,8 @@ export const testSpace = { ) }), - 'storacha space create home --no-recovery (blocks until plan is selected)': test( - async (assert, context) => { + 'storacha space create home --no-recovery (blocks until plan is selected)': + test(async (assert, context) => { const email = 'alice@web.mail' await login(context, { email }) @@ -312,8 +317,7 @@ export const testSpace = { assert.match(output, /billing account is set/i) assert.match(error, /wait.*plan.*select/i) - } - ), + }), 'storacha space add': test(async (assert, context) => { const { env } = context @@ -346,7 +350,10 @@ export const testSpace = { const listNone = await storacha.args(['space', 'ls']).env(env.bob).join() assert.ok(!listNone.output.includes(spaceDID)) - const add = await storacha.args(['space', 'add', proofPath]).env(env.bob).join() + const add = await storacha + .args(['space', 'add', proofPath]) + .env(env.bob) + .join() assert.equal(add.output.trim(), spaceDID) const listSome = await storacha.args(['space', 'ls']).env(env.bob).join() @@ -366,7 +373,7 @@ export const testSpace = { '-c', 'store/*', 'upload/*', - '--base64' + '--base64', ]) .env(env.alice) .join() @@ -374,7 +381,10 @@ export const testSpace = { const listNone = await storacha.args(['space', 'ls']).env(env.bob).join() assert.ok(!listNone.output.includes(spaceDID)) - const add = await storacha.args(['space', 'add', res.output]).env(env.bob).join() + const add = await storacha + .args(['space', 'add', res.output]) + .env(env.bob) + .join() assert.equal(add.output.trim(), spaceDID) const listSome = await storacha.args(['space', 'ls']).env(env.bob).join() @@ -468,7 +478,10 @@ export const testSpace = { 'old space is still listed' ) - await storacha.args(['space', 'use', spaceDID]).env(context.env.alice).join() + await storacha + .args(['space', 'use', spaceDID]) + .env(context.env.alice) + .join() const listSetDefault = await storacha .args(['space', 'ls']) .env(context.env.alice) @@ -485,7 +498,10 @@ export const testSpace = { 'new space is not default' ) - await storacha.args(['space', 'use', spaceName]).env(context.env.alice).join() + await storacha + .args(['space', 'use', spaceName]) + .env(context.env.alice) + .join() const listNamedDefault = await storacha .args(['space', 'ls']) .env(context.env.alice) @@ -567,7 +583,7 @@ export const testSpace = { assert.deepEqual(JSON.parse(infoWithProviderJson.output), { did: spaceDID, providers: [providerDID], - name: 'home' + name: 'home', }) }), @@ -597,7 +613,10 @@ export const testSpace = { assert.match(provision.output, /Billing account is set/) - const info = await storacha.env(context.env.alice).args(['space', 'info']).join() + const info = await storacha + .env(context.env.alice) + .args(['space', 'info']) + .join() assert.match( info.output, @@ -747,7 +766,10 @@ export const testStorachaUp = { // wait a second for invocation to get a different expiry await new Promise((resolve) => setTimeout(resolve, 1000)) - const list1 = await storacha.args(['ls', '--json']).env(context.env.alice).join() + const list1 = await storacha + .args(['ls', '--json']) + .env(context.env.alice) + .join() assert.ok(dagJSON.parse(list1.output)) }), @@ -792,10 +814,7 @@ export const testStorachaUp = { .catch() assert.equal(rm.status.code, 1) - assert.match( - rm.error, - /not found/ - ) + assert.match(rm.error, /not found/) }), } @@ -869,7 +888,7 @@ export const testDelegation = { 'store/add', '-c', 'upload/add', - '--base64' + '--base64', ]) .env(env) .join() @@ -1057,7 +1076,10 @@ export const testProof = { const whoisbob = await storacha.args(['whoami']).env(env.bob).join() const bobDID = DID.parse(whoisbob.output.trim()).did() - const proofPath = path.join(os.tmpdir(), `storacha-cli-test-proof-${Date.now()}`) + const proofPath = path.join( + os.tmpdir(), + `storacha-cli-test-proof-${Date.now()}` + ) await storacha .args([ 'delegation', @@ -1256,7 +1278,10 @@ export const testPlan = { // wait a second for invocation to get a different expiry await new Promise((resolve) => setTimeout(resolve, 1000)) - const plan = await storacha.args(['plan', 'get']).env(context.env.alice).join() + const plan = await storacha + .args(['plan', 'get']) + .env(context.env.alice) + .join() assert.match(plan.output, /did:web:free.web3.storage/) }), } @@ -1272,7 +1297,9 @@ export const testKey = { export const testBridge = { 'storacha bridge generate-tokens': test(async (assert, context) => { const spaceDID = await loginAndCreateSpace(context) - const res = await storacha.args(['bridge', 'generate-tokens', spaceDID]).join() + const res = await storacha + .args(['bridge', 'generate-tokens', spaceDID]) + .join() assert.match(res.output, /X-Auth-Secret header: u/) assert.match(res.output, /Authorization header: u/) }), @@ -1313,7 +1340,11 @@ export const login = async ( */ export const selectPlan = async ( context, - { email = 'alice@web.mail', billingID = 'test:cus_alice', 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) Result.try(await context.plansStorage.initialize(customer, billingID, plan)) diff --git a/packages/cli/test/helpers/context.js b/packages/cli/test/helpers/context.js index 4264183a9..98ed86bfb 100644 --- a/packages/cli/test/helpers/context.js +++ b/packages/cli/test/helpers/context.js @@ -62,7 +62,8 @@ export const setup = async () => { const { server, serverURL, router } = await createHTTPServer({ '/': context.connection.channel.request.bind(context.connection.channel), }) - const { server: receiptsServer, serverURL: receiptsServerUrl } = await createReceiptsServer() + const { server: receiptsServer, serverURL: receiptsServerUrl } = + await createReceiptsServer() return Object.assign(context, { server, diff --git a/packages/cli/test/helpers/env.js b/packages/cli/test/helpers/env.js index c8024b436..58249539e 100644 --- a/packages/cli/test/helpers/env.js +++ b/packages/cli/test/helpers/env.js @@ -12,7 +12,7 @@ export function createEnv(options = {}) { Object.assign(env, { STORACHA_SERVICE_DID: servicePrincipal.did(), STORACHA_SERVICE_URL: serviceURL.toString(), - STORACHA_RECEIPTS_URL: receiptsEndpoint?.toString() + STORACHA_RECEIPTS_URL: receiptsEndpoint?.toString(), }) } return env diff --git a/packages/cli/test/helpers/process.js b/packages/cli/test/helpers/process.js index 385410d13..70eb682e1 100644 --- a/packages/cli/test/helpers/process.js +++ b/packages/cli/test/helpers/process.js @@ -161,7 +161,6 @@ class Join { } } - /** * @template {string} Channel * @param {AsyncIterable} source diff --git a/packages/cli/test/lib.spec.js b/packages/cli/test/lib.spec.js index 92e0d1705..6ed711154 100644 --- a/packages/cli/test/lib.spec.js +++ b/packages/cli/test/lib.spec.js @@ -75,7 +75,10 @@ bafybeibvbxjeodaa6hdqlgbwmv4qzdp3bxnwdoukay4dpl7aemkiwc2eje` 'uploadListResponseToString can return the upload roots as newline delimited JSON': (assert) => { assert.equal( - uploadListResponseToString(uploadListResponse, { shards: true, plainTree: true }), + uploadListResponseToString(uploadListResponse, { + shards: true, + plainTree: true, + }), `bafybeia7tr4dgyln7zeyyyzmkppkcts6azdssykuluwzmmswysieyadcbm └─┬ shards └── bagbaierantza4rfjnhqksp2stcnd2tdjrn3f2kgi2wrvaxmayeuolryi66fq diff --git a/packages/upload-api/src/types.ts b/packages/upload-api/src/types.ts index 375409ebb..18101f195 100644 --- a/packages/upload-api/src/types.ts +++ b/packages/upload-api/src/types.ts @@ -161,7 +161,11 @@ import { RevocationsStorage } from './types/revocations.js' export * from '@storacha/capabilities/types' export * from '@ucanto/interface' -export type { ProvisionsStorage, Provision, Subscription } from './types/provisions.js' +export type { + ProvisionsStorage, + Provision, + Subscription, +} from './types/provisions.js' export type { DelegationsStorage, Query as DelegationsStorageQuery, diff --git a/packages/upload-api/test/external-service/index.js b/packages/upload-api/test/external-service/index.js index 6dedf1842..98c1e274f 100644 --- a/packages/upload-api/test/external-service/index.js +++ b/packages/upload-api/test/external-service/index.js @@ -5,7 +5,13 @@ import { BrowserStorageNode, StorageNode } from './storage-node.js' import * as BlobRetriever from './blob-retriever.js' import * as RoutingService from './router.js' -export { ClaimsService, BrowserStorageNode, StorageNode, BlobRetriever, RoutingService } +export { + ClaimsService, + BrowserStorageNode, + StorageNode, + BlobRetriever, + RoutingService, +} /** * @param {object} config diff --git a/packages/upload-api/test/external-service/storage-node.js b/packages/upload-api/test/external-service/storage-node.js index 77cb74a03..614ea780a 100644 --- a/packages/upload-api/test/external-service/storage-node.js +++ b/packages/upload-api/test/external-service/storage-node.js @@ -10,7 +10,10 @@ import { ed25519 } from '@ucanto/principal' import { CAR, HTTP } from '@ucanto/transport' import * as Server from '@ucanto/server' import { connect } from '@ucanto/client' -import { AllocatedMemoryNotWrittenError, BlobSizeLimitExceededError } from '../../src/blob.js' +import { + AllocatedMemoryNotWrittenError, + BlobSizeLimitExceededError, +} from '../../src/blob.js' /** * @typedef {{ @@ -61,7 +64,12 @@ const createService = ({ const digest = Digest.decode(capability.nb.blob.digest) const checksum = base64pad.baseEncode(digest.digest) if (capability.nb.blob.size > MaxUploadSize) { - return error(new BlobSizeLimitExceededError(capability.nb.blob.size, MaxUploadSize)) + return error( + new BlobSizeLimitExceededError( + capability.nb.blob.size, + MaxUploadSize + ) + ) } if (await contentStore.has(digest)) { return ok({ size: 0 }) diff --git a/packages/upload-api/test/handlers/blob.js b/packages/upload-api/test/handlers/blob.js index 5ea71ce60..3a491f49b 100644 --- a/packages/upload-api/test/handlers/blob.js +++ b/packages/upload-api/test/handlers/blob.js @@ -115,7 +115,7 @@ export const test = { proofs: [proof], // Note: we have to set an expiration, or the default expiration value // will be set when the invocation is executed and the UCAN issued. - expiration: (Math.floor(Date.now() / 1000)) + 10 + expiration: Math.floor(Date.now() / 1000) + 10, }) // Invoke `blob/add` for the first time const firstBlobAdd = await invocation.execute(connection) diff --git a/packages/w3up-client/src/service.js b/packages/w3up-client/src/service.js index 48af26bc9..41bdec60c 100644 --- a/packages/w3up-client/src/service.js +++ b/packages/w3up-client/src/service.js @@ -4,7 +4,9 @@ import * as DID from '@ipld/dag-ucan/did' import { receiptsEndpoint } from '@storacha/upload-client' export const accessServiceURL = new URL('https://upload.storacha.network') -export const accessServicePrincipal = DID.parse('did:web:upload.storacha.network') +export const accessServicePrincipal = DID.parse( + 'did:web:upload.storacha.network' +) export const accessServiceConnection = client.connect({ id: accessServicePrincipal, @@ -13,7 +15,9 @@ export const accessServiceConnection = client.connect({ }) export const uploadServiceURL = new URL('https://upload.storacha.network') -export const uploadServicePrincipal = DID.parse('did:web:upload.storacha.network') +export const uploadServicePrincipal = DID.parse( + 'did:web:upload.storacha.network' +) export const uploadServiceConnection = client.connect({ id: uploadServicePrincipal, @@ -22,7 +26,9 @@ export const uploadServiceConnection = client.connect({ }) export const filecoinServiceURL = new URL('https://upload.storacha.network') -export const filecoinServicePrincipal = DID.parse('did:web:upload.storacha.network') +export const filecoinServicePrincipal = DID.parse( + 'did:web:upload.storacha.network' +) export const filecoinServiceConnection = client.connect({ id: filecoinServicePrincipal,