Skip to content

Commit

Permalink
revert: renames for web3.storage capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
alanshaw committed Nov 1, 2024
1 parent 0f797ed commit ac49094
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 33 deletions.
6 changes: 3 additions & 3 deletions packages/capabilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/capabilities/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>}
Expand Down
10 changes: 5 additions & 5 deletions packages/capabilities/src/web3.storage/blob.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
*/
Expand Down Expand Up @@ -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.
*/
Expand Down
4 changes: 2 additions & 2 deletions packages/upload-api/src/blob/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/upload-api/src/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion packages/upload-api/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ export interface Service extends StorefrontService, W3sService {
}

export interface W3sService {
['storacha.network']: {
['web3.storage']: {
blob: {
allocate: ServiceMethod<
BlobAllocate,
Expand Down
2 changes: 1 addition & 1 deletion packages/upload-api/test/handlers/ucan.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
38 changes: 19 additions & 19 deletions packages/upload-api/test/handlers/web3.storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
) => {
Expand Down Expand Up @@ -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,
Expand All @@ -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)

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
) => {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ac49094

Please sign in to comment.