Skip to content

Commit

Permalink
fix: upgrade ucanto libs and format filecoin api (#1359)
Browse files Browse the repository at this point in the history
So that #1342 does not change
all the packages and appears in changelog
  • Loading branch information
vasco-santos authored Apr 12, 2024
1 parent d51faf2 commit 87ca098
Show file tree
Hide file tree
Showing 15 changed files with 205 additions and 190 deletions.
14 changes: 7 additions & 7 deletions packages/access-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@
"dependencies": {
"@ipld/car": "^5.1.1",
"@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.1.0",
"@ucanto/validator": "^9.0.1",
"@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": "workspace:^",
"@web3-storage/did-mailto": "workspace:^",
"bigint-mod-arith": "^3.1.2",
Expand All @@ -125,7 +125,7 @@
"@types/sinon": "^10.0.19",
"@types/varint": "^6.0.1",
"@types/ws": "^8.5.4",
"@ucanto/server": "^9.0.1",
"@ucanto/server": "^10.0.0",
"assert": "^2.0.0",
"mocha": "^10.2.0",
"playwright-test": "^12.3.4",
Expand Down
10 changes: 5 additions & 5 deletions packages/capabilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@
"dist/src/**/*.d.ts.map"
],
"dependencies": {
"@ucanto/core": "^9.0.1",
"@ucanto/interface": "^9.0.0",
"@ucanto/principal": "^9.0.0",
"@ucanto/transport": "^9.1.0",
"@ucanto/validator": "^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/data-segment": "^3.2.0"
},
"devDependencies": {
Expand Down
16 changes: 8 additions & 8 deletions packages/filecoin-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,22 @@
},
"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.1.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": "workspace:^",
"@web3-storage/content-claims": "^4.0.2",
"@web3-storage/content-claims": "^4.0.4",
"@web3-storage/data-segment": "^4.0.0",
"fr32-sha2-256-trunc254-padded-binary-tree-multihash": "^3.3.0",
"p-map": "^6.0.0"
},
"devDependencies": {
"@ipld/car": "^5.1.1",
"@types/mocha": "^10.0.1",
"@ucanto/client": "^9.0.0",
"@ucanto/principal": "^9.0.0",
"@ucanto/client": "^9.0.1",
"@ucanto/principal": "^9.0.1",
"@web-std/blob": "^3.0.5",
"@web3-storage/eslint-config-w3up": "workspace:^",
"@web3-storage/filecoin-client": "workspace:^",
Expand Down
4 changes: 3 additions & 1 deletion packages/filecoin-api/src/storefront/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ export interface ClaimsClientContext {
*/
claimsService: {
invocationConfig: ClaimsInvocationConfig
connection: ConnectionView<import('@web3-storage/content-claims/server/service/api').Service>
connection: ConnectionView<
import('@web3-storage/content-claims/server/service/api').Service
>
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/filecoin-api/src/storefront/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ async function findDataAggregationProof({ taskStore, receiptStore }, task) {
aggregateAcceptReceipt = receiptRes.ok.out.ok
}
if (!receiptRes.ok.fx.join) break
task = receiptRes.ok.fx.join
task = receiptRes.ok.fx.join.link()
}
if (!inclusion) {
return {
Expand Down
4 changes: 2 additions & 2 deletions packages/filecoin-api/test/context/mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export function mockService(impl) {
info: withCallParams(impl.deal?.info ?? notImplemented),
},
assert: {
equals: withCallParams(impl.assert?.equals ?? notImplemented)
}
equals: withCallParams(impl.assert?.equals ?? notImplemented),
},
}
}

Expand Down
13 changes: 8 additions & 5 deletions packages/filecoin-api/test/context/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,15 @@ export function getMockService() {
}),
},
assert: {
equals: Server.provide(Assert.equals, async ({ capability, invocation }) => {
return {
ok: {}
equals: Server.provide(
Assert.equals,
async ({ capability, invocation }) => {
return {
ok: {},
}
}
})
}
),
},
})
}

Expand Down
50 changes: 27 additions & 23 deletions packages/filecoin-api/test/events/storefront.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as StorefrontEvents from '../../src/storefront/events.js'
import {
StoreOperationErrorName,
UnexpectedStateErrorName,
BlobNotFoundErrorName
BlobNotFoundErrorName,
} from '../../src/errors.js'

import { randomCargo, randomAggregate } from '../utils.js'
Expand Down Expand Up @@ -53,23 +53,24 @@ export const test = {
assert.ok(hasStoredPiece.ok)
assert.equal(hasStoredPiece.ok?.status, 'submitted')
},
'handles filecoin submit messages with error if blob of content is not stored': async (assert, context) => {
// Generate piece for test
const [cargo] = await randomCargo(1, 128)

// Store piece into store
const message = {
piece: cargo.link.link(),
content: cargo.content.link(),
group: context.id.did(),
}
'handles filecoin submit messages with error if blob of content is not stored':
async (assert, context) => {
// Generate piece for test
const [cargo] = await randomCargo(1, 128)

// Store piece into store
const message = {
piece: cargo.link.link(),
content: cargo.content.link(),
group: context.id.did(),
}

// Handle message
const handledMessageRes =
await StorefrontEvents.handleFilecoinSubmitMessage(context, message)
assert.ok(handledMessageRes.error)
assert.equal(handledMessageRes.error?.name, BlobNotFoundErrorName)
},
// Handle message
const handledMessageRes =
await StorefrontEvents.handleFilecoinSubmitMessage(context, message)
assert.ok(handledMessageRes.error)
assert.equal(handledMessageRes.error?.name, BlobNotFoundErrorName)
},
'handles filecoin submit messages deduping when stored': async (
assert,
context
Expand Down Expand Up @@ -255,7 +256,10 @@ export const test = {
)
)
},
'handles piece insert event to issue equivalency claims successfully': async (assert, context) => {
'handles piece insert event to issue equivalency claims successfully': async (
assert,
context
) => {
// Generate piece for test
const [cargo] = await randomCargo(1, 128)

Expand All @@ -274,10 +278,11 @@ export const test = {
}

// Handle message
const handledMessageRes = await StorefrontEvents.handlePieceInsertToEquivalencyClaim(
context,
pieceRecord
)
const handledMessageRes =
await StorefrontEvents.handlePieceInsertToEquivalencyClaim(
context,
pieceRecord
)
assert.ok(handledMessageRes.ok)
// Verify invocation
// @ts-expect-error not typed hooks
Expand All @@ -294,7 +299,6 @@ export const test = {
context.service.assert?.equals?._params[0].nb.equals
)
)

},
'handles piece status update event successfully': async (assert, context) => {
// Generate piece for test
Expand Down
4 changes: 3 additions & 1 deletion packages/filecoin-api/test/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export interface StorefrontTestEventsContext
piece: Partial<import('../src/types.js').AggregatorService['piece']>
aggregate: Partial<import('../src/types.js').DealerService['aggregate']>
deal: Partial<import('../src/types.js').DealTrackerService['deal']>
assert: Partial<import('@web3-storage/content-claims/server/service/api').AssertService>
assert: Partial<
import('@web3-storage/content-claims/server/service/api').AssertService
>
}>
}
12 changes: 6 additions & 6 deletions packages/filecoin-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@
],
"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.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": "workspace:^"
},
"devDependencies": {
"@ipld/car": "^5.1.1",
"@ipld/dag-json": "^10.1.4",
"@types/assert": "^1.5.6",
"@types/mocha": "^10.0.1",
"@ucanto/principal": "^9.0.0",
"@ucanto/server": "^9.0.1",
"@ucanto/principal": "^9.0.1",
"@ucanto/server": "^10.0.0",
"@web3-storage/data-segment": "^4.0.0",
"@web3-storage/eslint-config-w3up": "workspace:^",
"assert": "^2.0.0",
Expand Down
14 changes: 7 additions & 7 deletions packages/upload-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@
"test-watch": "pnpm build && mocha --bail --timeout 10s --watch --parallel -n no-warnings -n experimental-vm-modules -n experimental-fetch --watch-files src,test"
},
"dependencies": {
"@ucanto/client": "^9.0.0",
"@ucanto/interface": "^9.0.0",
"@ucanto/principal": "^9.0.0",
"@ucanto/server": "^9.0.1",
"@ucanto/transport": "^9.1.0",
"@ucanto/validator": "^9.0.1",
"@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": "workspace:^",
"@web3-storage/capabilities": "workspace:^",
"@web3-storage/did-mailto": "workspace:^",
Expand All @@ -188,7 +188,7 @@
"@ipld/car": "^5.1.1",
"@ipld/dag-ucan": "^3.4.0",
"@types/mocha": "^10.0.1",
"@ucanto/core": "^9.0.1",
"@ucanto/core": "^10.0.1",
"@web-std/blob": "^3.0.5",
"@web3-storage/eslint-config-w3up": "workspace:^",
"@web3-storage/sigv4": "^1.0.2",
Expand Down
6 changes: 5 additions & 1 deletion packages/upload-api/src/types/usage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { Failure, Result } from '@ucanto/interface'
import { ProviderDID, SpaceDID, UsageData } from '@web3-storage/capabilities/types'
import {
ProviderDID,
SpaceDID,
UsageData,
} from '@web3-storage/capabilities/types'

export type { UsageData }

Expand Down
10 changes: 5 additions & 5 deletions packages/upload-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
"@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.1.0",
"@ucanto/client": "^9.0.1",
"@ucanto/interface": "^10.0.1",
"@ucanto/transport": "^9.1.1",
"@web3-storage/capabilities": "workspace:^",
"@web3-storage/data-segment": "^5.1.0",
"@web3-storage/filecoin-client": "workspace:^",
Expand All @@ -86,8 +86,8 @@
"@types/assert": "^1.5.6",
"@types/mocha": "^10.0.1",
"@types/varint": "^6.0.1",
"@ucanto/principal": "^9.0.0",
"@ucanto/server": "^9.0.1",
"@ucanto/principal": "^9.0.1",
"@ucanto/server": "^10.0.0",
"@web3-storage/eslint-config-w3up": "workspace:^",
"assert": "^2.0.0",
"blockstore-core": "^3.0.0",
Expand Down
12 changes: 6 additions & 6 deletions packages/w3up-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@
},
"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.1.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": "workspace:^",
"@web3-storage/capabilities": "workspace:^",
"@web3-storage/did-mailto": "workspace:^",
Expand All @@ -126,7 +126,7 @@
"@types/assert": "^1.5.6",
"@types/mocha": "^10.0.1",
"@types/node": "^20.8.4",
"@ucanto/server": "^9.0.1",
"@ucanto/server": "^10.0.0",
"@web3-storage/data-segment": "^5.0.0",
"@web3-storage/eslint-config-w3up": "workspace:^",
"@web3-storage/upload-api": "workspace:^",
Expand Down
Loading

0 comments on commit 87ca098

Please sign in to comment.