-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: switch to rust piece CID calculator (#930) Currently blocked on top level await issue. --------- Co-authored-by: Irakli Gozalishvili <contact@gozala.io> feat: add piece CID to car metadata chore(main): release upload-client 9.4.0 (#935) :robot: I have created a release *beep* *boop* --- [9.4.0](upload-client-v9.3.0...upload-client-v9.4.0) (2023-09-20) * add piece CID to car metadata ([1e52687](1e52687)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). fix: only aggregate CID in aggregate offer success response Update packages/capabilities/src/filecoin/aggregator.js Co-authored-by: Vasco Santos <santos.vasco10@gmail.com> Update packages/capabilities/src/filecoin/aggregator.js Co-authored-by: Vasco Santos <santos.vasco10@gmail.com> Update packages/capabilities/src/filecoin/dealer.js Co-authored-by: Vasco Santos <santos.vasco10@gmail.com> Update packages/capabilities/src/types.ts Co-authored-by: Vasco Santos <santos.vasco10@gmail.com> Update packages/capabilities/src/types.ts Co-authored-by: Vasco Santos <santos.vasco10@gmail.com> fix: add missing ContentNotFound definition for filecoin offer failure refactor: storefront caps fix: type errors fix: add missing filecoin submit success and failure types
- Loading branch information
1 parent
84ebb2d
commit c0b97bf
Showing
13 changed files
with
1,310 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* Filecoin Aggregator Capabilities | ||
* | ||
* These can be imported directly with: | ||
* ```js | ||
* import * as Aggregator from '@web3-storage/capabilities/filecoin/aggregator' | ||
* ``` | ||
* | ||
* @module | ||
*/ | ||
|
||
import { capability, Schema, ok } from '@ucanto/validator' | ||
import { PieceLink } from './lib.js' | ||
import { equal, equalWith, checkLink, and } from '../utils.js' | ||
|
||
/** | ||
* Capability that allows a Storefront to request that a piece be aggregated | ||
* for inclusion in an upcoming an Filecoin deal. | ||
*/ | ||
export const pieceOffer = capability({ | ||
can: 'piece/offer', | ||
/** | ||
* DID of an authorized Storefront. | ||
*/ | ||
with: Schema.did(), | ||
nb: Schema.struct({ | ||
/** | ||
* CID of the piece. | ||
*/ | ||
piece: PieceLink, | ||
/** | ||
* Grouping of joining segments into an aggregate. | ||
*/ | ||
group: Schema.text(), | ||
}), | ||
derives: (claim, from) => { | ||
return ( | ||
and(equalWith(claim, from)) || | ||
and(checkLink(claim.nb.piece, from.nb.piece, 'nb.piece')) || | ||
and(equal(claim.nb.group, from.nb.group, 'nb.group')) || | ||
ok({}) | ||
) | ||
}, | ||
}) | ||
|
||
/** | ||
* Capability that allows an Aggregator to signal a piece has been accepted | ||
* or rejected for inclusion in an aggregate. | ||
*/ | ||
export const pieceAccept = capability({ | ||
can: 'piece/accept', | ||
/** | ||
* DID of the Aggregator. | ||
*/ | ||
with: Schema.did(), | ||
nb: Schema.struct({ | ||
/** | ||
* CID of the piece. | ||
* | ||
* @see https://github.com/filecoin-project/FIPs/pull/758/files | ||
*/ | ||
piece: PieceLink, | ||
/** | ||
* Grouping of joining segments into an aggregate. | ||
*/ | ||
group: Schema.text(), | ||
}), | ||
derives: (claim, from) => { | ||
return ( | ||
and(equalWith(claim, from)) || | ||
and(checkLink(claim.nb.piece, from.nb.piece, 'nb.piece')) || | ||
and(equal(claim.nb.group, from.nb.group, 'nb.group')) || | ||
ok({}) | ||
) | ||
}, | ||
}) |
Oops, something went wrong.