From ac4909477ed918f33768b1b0d1ba7cfcfa55e8dd Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Fri, 1 Nov 2024 11:23:10 +0000 Subject: [PATCH] revert: renames for web3.storage capabilities --- packages/capabilities/package.json | 6 +-- packages/capabilities/src/utils.js | 2 +- .../capabilities/src/web3.storage/blob.js | 10 ++--- packages/upload-api/src/blob/add.js | 4 +- packages/upload-api/src/lib.js | 2 +- packages/upload-api/src/types.ts | 2 +- packages/upload-api/test/handlers/ucan.js | 2 +- .../upload-api/test/handlers/web3.storage.js | 38 +++++++++---------- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/packages/capabilities/package.json b/packages/capabilities/package.json index 7b76025f8..650dd8991 100644 --- a/packages/capabilities/package.json +++ b/packages/capabilities/package.json @@ -61,9 +61,9 @@ "types": "./dist/src/index/index.d.ts", "import": "./src/index/index.js" }, - "./storacha.network/blob": { - "types": "./dist/src/storacha.network/blob.d.ts", - "import": "./src/storacha.network/blob.js" + "./web3.storage/blob": { + "types": "./dist/src/web3.storage/blob.d.ts", + "import": "./src/web3.storage/blob.js" }, "./types": { "types": "./dist/src/types.d.ts", diff --git a/packages/capabilities/src/utils.js b/packages/capabilities/src/utils.js index b4c173525..619fab0fb 100644 --- a/packages/capabilities/src/utils.js +++ b/packages/capabilities/src/utils.js @@ -92,7 +92,7 @@ export const equalLink = (claimed, delegated) => { } /** - * @template {Types.ParsedCapability<"space/blob/add"|"space/blob/remove"|"storacha.network/blob/allocate"|"storacha.network/blob/accept", Types.URI<'did:'>, {blob: { digest: Uint8Array, size: number }}>} T + * @template {Types.ParsedCapability<"space/blob/add"|"space/blob/remove"|"web3.storage/blob/allocate"|"web3.storage/blob/accept", Types.URI<'did:'>, {blob: { digest: Uint8Array, size: number }}>} T * @param {T} claimed * @param {T} delegated * @returns {Types.Result<{}, Types.Failure>} diff --git a/packages/capabilities/src/web3.storage/blob.js b/packages/capabilities/src/web3.storage/blob.js index ce9de543c..42085380f 100644 --- a/packages/capabilities/src/web3.storage/blob.js +++ b/packages/capabilities/src/web3.storage/blob.js @@ -15,11 +15,11 @@ import { */ /** * Capability can only be delegated (but not invoked) allowing audience to - * derived any `storacha.network/blob/` prefixed capability for the (memory) space identified + * derived any `web3.storage/blob/` prefixed capability for the (memory) space identified * by DID in the `with` field. */ export const blob = capability({ - can: 'storacha.network/blob/*', + can: 'web3.storage/blob/*', /** * DID of the (memory) space where Blob is intended to * be stored. @@ -29,11 +29,11 @@ export const blob = capability({ }) /** - * `storacha.network/blob//allocate` capability can be invoked to create a memory + * `web3.storage/blob//allocate` capability can be invoked to create a memory * address where blob content can be written via HTTP PUT request. */ export const allocate = capability({ - can: 'storacha.network/blob/allocate', + can: 'web3.storage/blob/allocate', /** * Provider DID. */ @@ -69,7 +69,7 @@ export const allocate = capability({ * without content being delivered. */ export const accept = capability({ - can: 'storacha.network/blob/accept', + can: 'web3.storage/blob/accept', /** * Provider DID. */ diff --git a/packages/upload-api/src/blob/add.js b/packages/upload-api/src/blob/add.js index cb0735504..f2045f457 100644 --- a/packages/upload-api/src/blob/add.js +++ b/packages/upload-api/src/blob/add.js @@ -89,7 +89,7 @@ export function blobAddProvider(context) { * @param {API.Link} allocate.cause */ async function allocate({ context, blob, space, cause }) { - // 1. Create storacha.network/blob/allocate invocation and task + // 1. Create web3.storage/blob/allocate invocation and task const allocate = W3sBlob.allocate.invoke({ issuer: context.id, audience: context.id, @@ -213,7 +213,7 @@ async function put({ blob, allocation }) { * @param {API.Receipt|null} input.delivery.receipt */ async function accept({ context, blob, space, delivery }) { - // 1. Create storacha.network/blob/accept invocation and task + // 1. Create web3.storage/blob/accept invocation and task const accept = W3sBlob.accept.invoke({ issuer: context.id, audience: context.id, diff --git a/packages/upload-api/src/lib.js b/packages/upload-api/src/lib.js index 18d491e2f..cc477da51 100644 --- a/packages/upload-api/src/lib.js +++ b/packages/upload-api/src/lib.js @@ -187,7 +187,7 @@ export const createService = (context) => ({ upload: createUploadService(context), ucan: createUcanService(context), plan: createPlanService(context), - ['storacha.network']: createW3sService(context), + ['web3.storage']: createW3sService(context), // storefront of filecoin pipeline filecoin: createFilecoinService(context).filecoin, usage: createUsageService(context), diff --git a/packages/upload-api/src/types.ts b/packages/upload-api/src/types.ts index ecaf2732d..9ab7059ba 100644 --- a/packages/upload-api/src/types.ts +++ b/packages/upload-api/src/types.ts @@ -354,7 +354,7 @@ export interface Service extends StorefrontService, W3sService { } export interface W3sService { - ['storacha.network']: { + ['web3.storage']: { blob: { allocate: ServiceMethod< BlobAllocate, diff --git a/packages/upload-api/test/handlers/ucan.js b/packages/upload-api/test/handlers/ucan.js index 15a96b175..4a4313e8c 100644 --- a/packages/upload-api/test/handlers/ucan.js +++ b/packages/upload-api/test/handlers/ucan.js @@ -419,7 +419,7 @@ export const test = { invocation.link().toString() ) }, - 'ucan/conclude schedules storacha.network/blob/accept if invoked with the http/put receipt': + 'ucan/conclude schedules web3.storage/blob/accept if invoked with the http/put receipt': async (assert, context) => { const { proof, spaceDid } = await registerSpace(alice, context) diff --git a/packages/upload-api/test/handlers/web3.storage.js b/packages/upload-api/test/handlers/web3.storage.js index 10d4a3386..c6d08a3fa 100644 --- a/packages/upload-api/test/handlers/web3.storage.js +++ b/packages/upload-api/test/handlers/web3.storage.js @@ -18,7 +18,7 @@ import * as Result from '../helpers/result.js' * @type {API.Tests} */ export const test = { - 'storacha.network/blob/allocate must be invoked on service did': async ( + 'web3.storage/blob/allocate must be invoked on service did': async ( assert, context ) => { @@ -50,7 +50,7 @@ export const test = { proofs: [proof], }) - // invoke `storacha.network/blob/allocate` + // invoke `web3.storage/blob/allocate` const serviceBlobAllocate = W3sBlobCapabilities.allocate.invoke({ issuer: alice, audience: context.id, @@ -72,7 +72,7 @@ export const test = { ) ) }, - 'storacha.network/blob/allocate allocates to space and returns presigned url': + 'web3.storage/blob/allocate allocates to space and returns presigned url': async (assert, context) => { const { proof, spaceDid } = await registerSpace(alice, context) @@ -102,7 +102,7 @@ export const test = { proofs: [proof], }) - // invoke `storacha.network/blob/allocate` + // invoke `web3.storage/blob/allocate` const serviceBlobAllocate = W3sBlobCapabilities.allocate.invoke({ issuer: context.id, audience: context.id, @@ -171,7 +171,7 @@ export const test = { assert.equal(goodPut.status, 200, await goodPut.text()) }, - 'storacha.network/blob/allocate does not allocate more space to already allocated content': + 'web3.storage/blob/allocate does not allocate more space to already allocated content': async (assert, context) => { const { proof, spaceDid } = await registerSpace(alice, context) // prepare data @@ -200,7 +200,7 @@ export const test = { proofs: [proof], }) - // invoke `storacha.network/blob/allocate` + // invoke `web3.storage/blob/allocate` const allocation = await W3sBlobCapabilities.allocate .invoke({ issuer: context.id, @@ -246,7 +246,7 @@ export const test = { assert.equal(reallocation.out.ok.size, 0) assert.ok(!!reallocation.out.ok.address) }, - 'storacha.network/blob/allocate can allocate to different space after write to one space': + 'web3.storage/blob/allocate can allocate to different space after write to one space': async (assert, context) => { const { proof: aliceProof, spaceDid: aliceSpaceDid } = await registerSpace(alice, context) @@ -294,7 +294,7 @@ export const test = { proofs: [bobProof], }) - // invoke `storacha.network/blob/allocate` capabilities on alice space + // invoke `web3.storage/blob/allocate` capabilities on alice space const aliceServiceBlobAllocate = W3sBlobCapabilities.allocate.invoke({ issuer: context.id, audience: context.id, @@ -334,7 +334,7 @@ export const test = { assert.equal(goodPut.status, 200, await goodPut.text()) - // invoke `storacha.network/blob/allocate` capabilities on bob space + // invoke `web3.storage/blob/allocate` capabilities on bob space const bobServiceBlobAllocate = W3sBlobCapabilities.allocate.invoke({ issuer: context.id, audience: context.id, @@ -369,7 +369,7 @@ export const test = { assert.ok(bobSpaceAllocations.ok) assert.equal(bobSpaceAllocations.ok?.size, 1) }, - 'storacha.network/blob/allocate creates presigned url that can only PUT a payload with right length': + 'web3.storage/blob/allocate creates presigned url that can only PUT a payload with right length': async (assert, context) => { const { proof, spaceDid } = await registerSpace(alice, context) @@ -400,7 +400,7 @@ export const test = { proofs: [proof], }) - // invoke `storacha.network/blob/allocate` + // invoke `web3.storage/blob/allocate` const serviceBlobAllocate = W3sBlobCapabilities.allocate.invoke({ issuer: context.id, audience: context.id, @@ -445,7 +445,7 @@ export const test = { 'should fail to upload as content-length differs from that used to sign the url' ) }, - 'storacha.network/blob/allocate creates presigned url that can PUT a payload with exact bytes': + 'web3.storage/blob/allocate creates presigned url that can PUT a payload with exact bytes': async (assert, context) => { const { proof, spaceDid } = await registerSpace(alice, context) @@ -476,7 +476,7 @@ export const test = { proofs: [proof], }) - // invoke `storacha.network/blob/allocate` + // invoke `web3.storage/blob/allocate` const serviceBlobAllocate = W3sBlobCapabilities.allocate.invoke({ issuer: context.id, audience: context.id, @@ -518,7 +518,7 @@ export const test = { 'should fail to upload any other data.' ) }, - 'storacha.network/blob/allocate disallowed if invocation fails access verification': + 'web3.storage/blob/allocate disallowed if invocation fails access verification': async (assert, context) => { const { proof, space, spaceDid } = await createSpace(alice) @@ -548,7 +548,7 @@ export const test = { proofs: [proof], }) - // invoke `storacha.network/blob/allocate` + // invoke `web3.storage/blob/allocate` const task = { issuer: context.id, audience: context.id, @@ -590,7 +590,7 @@ export const test = { .execute(connection) assert.equal(retryBlobAllocate.out.error, undefined) }, - 'storacha.network/blob/accept returns site delegation': async ( + 'web3.storage/blob/accept returns site delegation': async ( assert, context ) => { @@ -642,7 +642,7 @@ export const test = { }) assert.equal(goodPut.status, 200, await goodPut.text()) - // invoke `storacha.network/blob/accept` + // invoke `web3.storage/blob/accept` const serviceBlobAccept = W3sBlobCapabilities.accept.invoke({ issuer: context.id, audience: context.id, @@ -687,7 +687,7 @@ export const test = { ) assert.ok(locations.includes(loc)) }, - 'storacha.network/blob/accept fails to provide site delegation when blob was not stored': + 'web3.storage/blob/accept fails to provide site delegation when blob was not stored': async (assert, context) => { const { proof, spaceDid } = await registerSpace(alice, context) @@ -724,7 +724,7 @@ export const test = { // parse receipt next const next = parseBlobAddReceiptNext(blobAdd) - // invoke `storacha.network/blob/accept` + // invoke `web3.storage/blob/accept` const serviceBlobAccept = W3sBlobCapabilities.accept.invoke({ issuer: context.id, audience: context.id,