@web3-storage/capabilities
Advanced tools
Comparing version 10.2.0 to 11.0.0
@@ -15,6 +15,10 @@ /** @type {import('./types.js').AbilitiesArray} */ | ||
import * as Subscription from './subscription.js'; | ||
import * as Filecoin from './filecoin.js'; | ||
import * as Filecoin from './filecoin/index.js'; | ||
import * as Storefront from './filecoin/storefront.js'; | ||
import * as Aggregator from './filecoin/aggregator.js'; | ||
import * as Dealer from './filecoin/dealer.js'; | ||
import * as DealTracker from './filecoin/deal-tracker.js'; | ||
import * as Admin from './admin.js'; | ||
import * as UCAN from './ucan.js'; | ||
export { Access, Provider, Space, Top, Store, Upload, Consumer, Customer, Console, Utils, RateLimit, Subscription, Filecoin, Admin, UCAN }; | ||
export { Access, Provider, Space, Top, Store, Upload, Consumer, Customer, Console, Utils, RateLimit, Subscription, Filecoin, Storefront, Aggregator, Dealer, DealTracker, Admin, UCAN }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -6,3 +6,3 @@ import type { TupleToUnion } from 'type-fest'; | ||
import { CAR } from '@ucanto/transport'; | ||
import type { PieceLink } from '@web3-storage/data-segment'; | ||
import { Phantom, PieceLink, ProofData, uint64 } from '@web3-storage/data-segment'; | ||
import { space, info } from './space.js'; | ||
@@ -18,3 +18,6 @@ import * as provider from './provider.js'; | ||
import * as RateLimitCaps from './rate-limit.js'; | ||
import * as FilecoinCaps from './filecoin.js'; | ||
import * as StorefrontCaps from './filecoin/storefront.js'; | ||
import * as AggregatorCaps from './filecoin/aggregator.js'; | ||
import * as DealTrackerCaps from './filecoin/deal-tracker.js'; | ||
import * as DealerCaps from './filecoin/dealer.js'; | ||
import * as AdminCaps from './admin.js'; | ||
@@ -130,35 +133,123 @@ import * as UCANCaps from './ucan.js'; | ||
export type SpaceInfo = InferInvokedCapability<typeof info>; | ||
export type FILECOIN_PROCESSING_STATUS = 'pending' | 'done'; | ||
export interface FilecoinAddSuccess { | ||
export interface DealMetadata { | ||
dataType: uint64; | ||
dataSource: SingletonMarketSource; | ||
} | ||
/** @see https://github.com/filecoin-project/go-data-segment/blob/e3257b64fa2c84e0df95df35de409cfed7a38438/datasegment/verifier.go#L8-L14 */ | ||
export interface DataAggregationProof { | ||
/** | ||
* Proof the piece is included in the aggregate. | ||
*/ | ||
inclusion: InclusionProof; | ||
/** | ||
* Filecoin deal metadata. | ||
*/ | ||
aux: DealMetadata; | ||
} | ||
/** @see https://github.com/filecoin-project/go-data-segment/blob/e3257b64fa2c84e0df95df35de409cfed7a38438/datasegment/inclusion.go#L30-L39 */ | ||
export interface InclusionProof { | ||
/** | ||
* Proof of inclusion of the client's data segment in the data aggregator's | ||
* Merkle tree (includes position information). i.e. a proof that the root | ||
* node of the subtree containing all the nodes (leafs) of a data segment is | ||
* contained in CommDA. | ||
*/ | ||
subtree: ProofData; | ||
/** | ||
* Proof that an entry for the user's data is contained in the index of the | ||
* aggregator's deal. i.e. a proof that the data segment index constructed | ||
* from the root of the user's data segment subtree is contained in the index | ||
* of the deal tree. | ||
*/ | ||
index: ProofData; | ||
} | ||
export interface SingletonMarketSource { | ||
dealID: uint64; | ||
} | ||
export interface FilecoinOfferSuccess { | ||
/** | ||
* Commitment proof for piece. | ||
*/ | ||
piece: PieceLink; | ||
} | ||
export interface FilecoinAddFailure extends Ucanto.Failure { | ||
name: string; | ||
export type FilecoinOfferFailure = ContentNotFound | Ucanto.Failure; | ||
export interface ContentNotFound extends Ucanto.Failure { | ||
name: 'ContentNotFound'; | ||
content: Link; | ||
} | ||
export interface AggregateAddSuccess { | ||
export interface FilecoinSubmitSuccess { | ||
/** | ||
* Commitment proof for piece. | ||
*/ | ||
piece: PieceLink; | ||
aggregate?: PieceLink; | ||
} | ||
export interface AggregateAddFailure extends Ucanto.Failure { | ||
name: string; | ||
export type FilecoinSubmitFailure = InvalidPieceCID | Ucanto.Failure; | ||
export interface FilecoinAcceptSuccess extends DataAggregationProof { | ||
aggregate: PieceLink; | ||
piece: PieceLink; | ||
} | ||
export interface DealAddSuccess { | ||
aggregate?: PieceLink; | ||
export type FilecoinAcceptFailure = InvalidContentPiece | ProofNotFound | Ucanto.Failure; | ||
export interface InvalidContentPiece extends Ucanto.Failure { | ||
name: 'InvalidContentPiece'; | ||
content: PieceLink; | ||
} | ||
export type DealAddFailure = DealAddParseFailure | DealAddFailureWithBadPiece; | ||
export interface DealAddParseFailure extends Ucanto.Failure { | ||
name: string; | ||
export interface ProofNotFound extends Ucanto.Failure { | ||
name: 'ProofNotFound'; | ||
} | ||
export interface DealAddFailureWithBadPiece extends Ucanto.Failure { | ||
piece?: PieceLink; | ||
cause?: DealAddFailureCause[] | unknown; | ||
export interface PieceOfferSuccess { | ||
/** | ||
* Commitment proof for piece. | ||
*/ | ||
piece: PieceLink; | ||
} | ||
export interface DealAddFailureCause { | ||
export type PieceOfferFailure = Ucanto.Failure; | ||
export interface PieceAcceptSuccess { | ||
/** | ||
* Commitment proof for piece. | ||
*/ | ||
piece: PieceLink; | ||
reason: string; | ||
/** | ||
* Commitment proof for aggregate. | ||
*/ | ||
aggregate: PieceLink; | ||
/** | ||
* Proof the piece is included in the aggregate. | ||
*/ | ||
inclusion: InclusionProof; | ||
} | ||
export interface ChainTrackerInfoSuccess { | ||
export type PieceAcceptFailure = Ucanto.Failure; | ||
export interface AggregateOfferSuccess { | ||
/** | ||
* Commitment proof for aggregate. | ||
*/ | ||
aggregate: PieceLink; | ||
} | ||
export interface ChainTrackerInfoFailure extends Ucanto.Failure { | ||
export type AggregateOfferFailure = Ucanto.Failure; | ||
export interface AggregateAcceptSuccess extends DealMetadata { | ||
aggregate: PieceLink; | ||
} | ||
export type AggregateAcceptFailure = InvalidPiece | Ucanto.Failure; | ||
export interface InvalidPiece extends Ucanto.Failure { | ||
name: 'InvalidPiece'; | ||
/** | ||
* Commitment proof for aggregate. | ||
*/ | ||
aggregate: PieceLink; | ||
cause: InvalidPieceCID[]; | ||
} | ||
export interface InvalidPieceCID extends Ucanto.Failure { | ||
name: 'InvalidPieceCID'; | ||
piece: PieceLink; | ||
} | ||
export interface DealInfoSuccess { | ||
deals: Record<string & Phantom<uint64>, DealDetails>; | ||
} | ||
export interface DealDetails { | ||
provider: FilecoinAddress; | ||
} | ||
export type FilecoinAddress = string; | ||
export type DealInfoFailure = DealNotFound | Ucanto.Failure; | ||
export interface DealNotFound extends Ucanto.Failure { | ||
name: 'DealNotFound'; | ||
} | ||
export type Upload = InferInvokedCapability<typeof UploadCaps.upload>; | ||
@@ -286,9 +377,10 @@ export type UploadAdd = InferInvokedCapability<typeof UploadCaps.add>; | ||
export type AdminStoreInspectFailure = Ucanto.Failure; | ||
export type FilecoinQueue = InferInvokedCapability<typeof FilecoinCaps.filecoinQueue>; | ||
export type FilecoinAdd = InferInvokedCapability<typeof FilecoinCaps.filecoinAdd>; | ||
export type AggregateQueue = InferInvokedCapability<typeof FilecoinCaps.aggregateQueue>; | ||
export type AggregateAdd = InferInvokedCapability<typeof FilecoinCaps.aggregateAdd>; | ||
export type DealQueue = InferInvokedCapability<typeof FilecoinCaps.dealQueue>; | ||
export type DealAdd = InferInvokedCapability<typeof FilecoinCaps.dealAdd>; | ||
export type ChainTrackerInfo = InferInvokedCapability<typeof FilecoinCaps.chainTrackerInfo>; | ||
export type FilecoinOffer = InferInvokedCapability<typeof StorefrontCaps.filecoinOffer>; | ||
export type FilecoinSubmit = InferInvokedCapability<typeof StorefrontCaps.filecoinSubmit>; | ||
export type FilecoinAccept = InferInvokedCapability<typeof StorefrontCaps.filecoinAccept>; | ||
export type PieceOffer = InferInvokedCapability<typeof AggregatorCaps.pieceOffer>; | ||
export type PieceAccept = InferInvokedCapability<typeof AggregatorCaps.pieceAccept>; | ||
export type AggregateOffer = InferInvokedCapability<typeof DealerCaps.aggregateOffer>; | ||
export type AggregateAccept = InferInvokedCapability<typeof DealerCaps.aggregateAccept>; | ||
export type DealInfo = InferInvokedCapability<typeof DealTrackerCaps.dealInfo>; | ||
export type Top = InferInvokedCapability<typeof top>; | ||
@@ -321,9 +413,10 @@ export type Abilities = TupleToUnion<AbilitiesArray>; | ||
RateLimitList['can'], | ||
FilecoinQueue['can'], | ||
FilecoinAdd['can'], | ||
AggregateQueue['can'], | ||
AggregateAdd['can'], | ||
DealQueue['can'], | ||
DealAdd['can'], | ||
ChainTrackerInfo['can'], | ||
FilecoinOffer['can'], | ||
FilecoinSubmit['can'], | ||
FilecoinAccept['can'], | ||
PieceOffer['can'], | ||
PieceAccept['can'], | ||
AggregateOffer['can'], | ||
AggregateAccept['can'], | ||
DealInfo['can'], | ||
Admin['can'], | ||
@@ -330,0 +423,0 @@ AdminUploadInspect['can'], |
{ | ||
"name": "@web3-storage/capabilities", | ||
"version": "10.2.0", | ||
"version": "11.0.0", | ||
"description": "Capabilities provided by web3.storage", | ||
@@ -24,2 +24,22 @@ "homepage": "https://github.com/web3-storage/w3protocol/tree/main/packages/capabilities", | ||
}, | ||
"./filecoin": { | ||
"types": "./dist/src/filecoin/index.d.ts", | ||
"import": "./src/filecoin/index.js" | ||
}, | ||
"./filecoin/storefront": { | ||
"types": "./dist/src/filecoin/storefront.d.ts", | ||
"import": "./src/filecoin/storefront.js" | ||
}, | ||
"./filecoin/aggregator": { | ||
"types": "./dist/src/filecoin/aggregator.d.ts", | ||
"import": "./src/filecoin/aggregator.js" | ||
}, | ||
"./filecoin/deal-tracker": { | ||
"types": "./dist/src/filecoin/deal-tracker.d.ts", | ||
"import": "./src/filecoin/deal-tracker.js" | ||
}, | ||
"./filecoin/dealer": { | ||
"types": "./dist/src/filecoin/dealer.d.ts", | ||
"import": "./src/filecoin/dealer.js" | ||
}, | ||
"./types": "./dist/src/types.d.ts" | ||
@@ -26,0 +46,0 @@ }, |
@@ -33,2 +33,6 @@ # ⁂ `@web3-storage/capabilities` | ||
import * as Voucher from '@web3-storage/capabilities/voucher' | ||
import * as Filecoin from '@web3-storage/capabilities/filecoin' | ||
import * as Aggregator from '@web3-storage/capabilities/filecoin/aggregator' | ||
import * as DealTracker from '@web3-storage/capabilities/filecoin/deal-tracker' | ||
import * as Dealer from '@web3-storage/capabilities/filecoin/dealer' | ||
@@ -35,0 +39,0 @@ // This package has a "main" entrypoint but we recommend the usage of the specific imports above |
@@ -14,3 +14,7 @@ import * as Provider from './provider.js' | ||
import * as Subscription from './subscription.js' | ||
import * as Filecoin from './filecoin.js' | ||
import * as Filecoin from './filecoin/index.js' | ||
import * as Storefront from './filecoin/storefront.js' | ||
import * as Aggregator from './filecoin/aggregator.js' | ||
import * as Dealer from './filecoin/dealer.js' | ||
import * as DealTracker from './filecoin/deal-tracker.js' | ||
import * as UCAN from './ucan.js' | ||
@@ -32,2 +36,6 @@ | ||
Filecoin, | ||
Storefront, | ||
Aggregator, | ||
Dealer, | ||
DealTracker, | ||
Admin, | ||
@@ -63,9 +71,10 @@ UCAN, | ||
RateLimit.list.can, | ||
Filecoin.filecoinQueue.can, | ||
Filecoin.filecoinAdd.can, | ||
Filecoin.aggregateQueue.can, | ||
Filecoin.aggregateAdd.can, | ||
Filecoin.dealQueue.can, | ||
Filecoin.dealAdd.can, | ||
Filecoin.chainTrackerInfo.can, | ||
Storefront.filecoinOffer.can, | ||
Storefront.filecoinSubmit.can, | ||
Storefront.filecoinAccept.can, | ||
Aggregator.pieceOffer.can, | ||
Aggregator.pieceAccept.can, | ||
Dealer.aggregateOffer.can, | ||
Dealer.aggregateAccept.can, | ||
DealTracker.dealInfo.can, | ||
Admin.admin.can, | ||
@@ -72,0 +81,0 @@ Admin.upload.inspect.can, |
205
src/types.ts
@@ -14,3 +14,8 @@ import type { TupleToUnion } from 'type-fest' | ||
import { CAR } from '@ucanto/transport' | ||
import type { PieceLink } from '@web3-storage/data-segment' | ||
import { | ||
Phantom, | ||
PieceLink, | ||
ProofData, | ||
uint64, | ||
} from '@web3-storage/data-segment' | ||
import { space, info } from './space.js' | ||
@@ -26,3 +31,6 @@ import * as provider from './provider.js' | ||
import * as RateLimitCaps from './rate-limit.js' | ||
import * as FilecoinCaps from './filecoin.js' | ||
import * as StorefrontCaps from './filecoin/storefront.js' | ||
import * as AggregatorCaps from './filecoin/aggregator.js' | ||
import * as DealTrackerCaps from './filecoin/deal-tracker.js' | ||
import * as DealerCaps from './filecoin/dealer.js' | ||
import * as AdminCaps from './admin.js' | ||
@@ -178,47 +186,150 @@ import * as UCANCaps from './ucan.js' | ||
// filecoin | ||
export type FILECOIN_PROCESSING_STATUS = 'pending' | 'done' | ||
export interface FilecoinAddSuccess { | ||
export interface DealMetadata { | ||
dataType: uint64 | ||
dataSource: SingletonMarketSource | ||
} | ||
/** @see https://github.com/filecoin-project/go-data-segment/blob/e3257b64fa2c84e0df95df35de409cfed7a38438/datasegment/verifier.go#L8-L14 */ | ||
export interface DataAggregationProof { | ||
/** | ||
* Proof the piece is included in the aggregate. | ||
*/ | ||
inclusion: InclusionProof | ||
/** | ||
* Filecoin deal metadata. | ||
*/ | ||
aux: DealMetadata | ||
} | ||
/** @see https://github.com/filecoin-project/go-data-segment/blob/e3257b64fa2c84e0df95df35de409cfed7a38438/datasegment/inclusion.go#L30-L39 */ | ||
export interface InclusionProof { | ||
/** | ||
* Proof of inclusion of the client's data segment in the data aggregator's | ||
* Merkle tree (includes position information). i.e. a proof that the root | ||
* node of the subtree containing all the nodes (leafs) of a data segment is | ||
* contained in CommDA. | ||
*/ | ||
subtree: ProofData | ||
/** | ||
* Proof that an entry for the user's data is contained in the index of the | ||
* aggregator's deal. i.e. a proof that the data segment index constructed | ||
* from the root of the user's data segment subtree is contained in the index | ||
* of the deal tree. | ||
*/ | ||
index: ProofData | ||
} | ||
export interface SingletonMarketSource { | ||
dealID: uint64 | ||
} | ||
export interface FilecoinOfferSuccess { | ||
/** | ||
* Commitment proof for piece. | ||
*/ | ||
piece: PieceLink | ||
} | ||
export interface FilecoinAddFailure extends Ucanto.Failure { | ||
name: string | ||
export type FilecoinOfferFailure = ContentNotFound | Ucanto.Failure | ||
export interface ContentNotFound extends Ucanto.Failure { | ||
name: 'ContentNotFound' | ||
content: Link | ||
} | ||
export interface AggregateAddSuccess { | ||
export interface FilecoinSubmitSuccess { | ||
/** | ||
* Commitment proof for piece. | ||
*/ | ||
piece: PieceLink | ||
aggregate?: PieceLink | ||
} | ||
export interface AggregateAddFailure extends Ucanto.Failure { | ||
name: string | ||
export type FilecoinSubmitFailure = InvalidPieceCID | Ucanto.Failure | ||
export interface FilecoinAcceptSuccess extends DataAggregationProof { | ||
aggregate: PieceLink | ||
piece: PieceLink | ||
} | ||
export interface DealAddSuccess { | ||
aggregate?: PieceLink | ||
export type FilecoinAcceptFailure = | ||
| InvalidContentPiece | ||
| ProofNotFound | ||
| Ucanto.Failure | ||
export interface InvalidContentPiece extends Ucanto.Failure { | ||
name: 'InvalidContentPiece' | ||
content: PieceLink | ||
} | ||
export type DealAddFailure = DealAddParseFailure | DealAddFailureWithBadPiece | ||
export interface ProofNotFound extends Ucanto.Failure { | ||
name: 'ProofNotFound' | ||
} | ||
export interface DealAddParseFailure extends Ucanto.Failure { | ||
name: string | ||
// filecoin aggregator | ||
export interface PieceOfferSuccess { | ||
/** | ||
* Commitment proof for piece. | ||
*/ | ||
piece: PieceLink | ||
} | ||
export type PieceOfferFailure = Ucanto.Failure | ||
export interface DealAddFailureWithBadPiece extends Ucanto.Failure { | ||
piece?: PieceLink | ||
cause?: DealAddFailureCause[] | unknown | ||
export interface PieceAcceptSuccess { | ||
/** | ||
* Commitment proof for piece. | ||
*/ | ||
piece: PieceLink | ||
/** | ||
* Commitment proof for aggregate. | ||
*/ | ||
aggregate: PieceLink | ||
/** | ||
* Proof the piece is included in the aggregate. | ||
*/ | ||
inclusion: InclusionProof | ||
} | ||
export type PieceAcceptFailure = Ucanto.Failure | ||
export interface DealAddFailureCause { | ||
// filecoin dealer | ||
export interface AggregateOfferSuccess { | ||
/** | ||
* Commitment proof for aggregate. | ||
*/ | ||
aggregate: PieceLink | ||
} | ||
export type AggregateOfferFailure = Ucanto.Failure | ||
export interface AggregateAcceptSuccess extends DealMetadata { | ||
aggregate: PieceLink | ||
} | ||
export type AggregateAcceptFailure = InvalidPiece | Ucanto.Failure | ||
export interface InvalidPiece extends Ucanto.Failure { | ||
name: 'InvalidPiece' | ||
/** | ||
* Commitment proof for aggregate. | ||
*/ | ||
aggregate: PieceLink | ||
cause: InvalidPieceCID[] | ||
} | ||
export interface InvalidPieceCID extends Ucanto.Failure { | ||
name: 'InvalidPieceCID' | ||
piece: PieceLink | ||
reason: string | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface ChainTrackerInfoSuccess { | ||
// TODO | ||
// filecoin deal tracker | ||
export interface DealInfoSuccess { | ||
deals: Record<string & Phantom<uint64>, DealDetails> | ||
} | ||
export interface ChainTrackerInfoFailure extends Ucanto.Failure { | ||
// TODO | ||
export interface DealDetails { | ||
provider: FilecoinAddress | ||
// TODO: start/end epoch? etc. | ||
} | ||
export type FilecoinAddress = string | ||
export type DealInfoFailure = DealNotFound | Ucanto.Failure | ||
export interface DealNotFound extends Ucanto.Failure { | ||
name: 'DealNotFound' | ||
} | ||
// Upload | ||
@@ -387,19 +498,24 @@ export type Upload = InferInvokedCapability<typeof UploadCaps.upload> | ||
// Filecoin | ||
export type FilecoinQueue = InferInvokedCapability< | ||
typeof FilecoinCaps.filecoinQueue | ||
export type FilecoinOffer = InferInvokedCapability< | ||
typeof StorefrontCaps.filecoinOffer | ||
> | ||
export type FilecoinAdd = InferInvokedCapability< | ||
typeof FilecoinCaps.filecoinAdd | ||
export type FilecoinSubmit = InferInvokedCapability< | ||
typeof StorefrontCaps.filecoinSubmit | ||
> | ||
export type AggregateQueue = InferInvokedCapability< | ||
typeof FilecoinCaps.aggregateQueue | ||
export type FilecoinAccept = InferInvokedCapability< | ||
typeof StorefrontCaps.filecoinAccept | ||
> | ||
export type AggregateAdd = InferInvokedCapability< | ||
typeof FilecoinCaps.aggregateAdd | ||
export type PieceOffer = InferInvokedCapability< | ||
typeof AggregatorCaps.pieceOffer | ||
> | ||
export type DealQueue = InferInvokedCapability<typeof FilecoinCaps.dealQueue> | ||
export type DealAdd = InferInvokedCapability<typeof FilecoinCaps.dealAdd> | ||
export type ChainTrackerInfo = InferInvokedCapability< | ||
typeof FilecoinCaps.chainTrackerInfo | ||
export type PieceAccept = InferInvokedCapability< | ||
typeof AggregatorCaps.pieceAccept | ||
> | ||
export type AggregateOffer = InferInvokedCapability< | ||
typeof DealerCaps.aggregateOffer | ||
> | ||
export type AggregateAccept = InferInvokedCapability< | ||
typeof DealerCaps.aggregateAccept | ||
> | ||
export type DealInfo = InferInvokedCapability<typeof DealTrackerCaps.dealInfo> | ||
// Top | ||
@@ -435,9 +551,10 @@ export type Top = InferInvokedCapability<typeof top> | ||
RateLimitList['can'], | ||
FilecoinQueue['can'], | ||
FilecoinAdd['can'], | ||
AggregateQueue['can'], | ||
AggregateAdd['can'], | ||
DealQueue['can'], | ||
DealAdd['can'], | ||
ChainTrackerInfo['can'], | ||
FilecoinOffer['can'], | ||
FilecoinSubmit['can'], | ||
FilecoinAccept['can'], | ||
PieceOffer['can'], | ||
PieceAccept['can'], | ||
AggregateOffer['can'], | ||
AggregateAccept['can'], | ||
DealInfo['can'], | ||
Admin['can'], | ||
@@ -444,0 +561,0 @@ AdminUploadInspect['can'], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
134947
68
3108
165