@web3-storage/capabilities
Advanced tools
Comparing version 9.5.0 to 10.0.0
import type { TupleToUnion } from 'type-fest'; | ||
import * as Ucanto from '@ucanto/interface'; | ||
import type { Schema } from '@ucanto/core'; | ||
import { InferInvokedCapability, Unit, DID, DIDKey } from '@ucanto/interface'; | ||
import { InferInvokedCapability, Unit, DID, DIDKey, ToString, Link, UnknownLink } from '@ucanto/interface'; | ||
import { CAR } from '@ucanto/transport'; | ||
import type { PieceLink } from '@web3-storage/data-segment'; | ||
@@ -20,2 +21,6 @@ import { space, info } from './space.js'; | ||
export type { Unit, PieceLink }; | ||
/** | ||
* An IPLD Link that has the CAR codec code. | ||
*/ | ||
export type CARLink = Link<unknown, typeof CAR.codec.code>; | ||
export type AccountDID = DID<'mailto'>; | ||
@@ -165,2 +170,53 @@ export type SpaceDID = DID<'key'>; | ||
export type StoreList = InferInvokedCapability<typeof list>; | ||
export type StoreAddSuccess = StoreAddSuccessDone | StoreAddSuccessUpload; | ||
export interface StoreAddSuccessDone { | ||
status: 'done'; | ||
with: DID; | ||
link: UnknownLink; | ||
url?: undefined; | ||
headers?: undefined; | ||
} | ||
export interface StoreAddSuccessUpload { | ||
status: 'upload'; | ||
with: DID; | ||
link: UnknownLink; | ||
url: ToString<URL>; | ||
headers: Record<string, string>; | ||
} | ||
export interface StoreRemoveSuccess { | ||
size: number; | ||
} | ||
export interface StoreItemNotFound extends Ucanto.Failure { | ||
name: 'StoreItemNotFound'; | ||
} | ||
export type StoreRemoveFailure = StoreItemNotFound | Ucanto.Failure; | ||
export interface StoreListSuccess extends ListResponse<StoreListItem> { | ||
} | ||
export interface ListResponse<R> { | ||
cursor?: string; | ||
before?: string; | ||
after?: string; | ||
size: number; | ||
results: R[]; | ||
} | ||
export interface StoreListItem { | ||
link: UnknownLink; | ||
size: number; | ||
origin?: UnknownLink; | ||
} | ||
export interface UploadAddSuccess { | ||
root: UnknownLink; | ||
shards?: CARLink[]; | ||
} | ||
export type UploadRemoveSuccess = UploadDidRemove | UploadDidNotRemove; | ||
export interface UploadDidRemove extends UploadAddSuccess { | ||
} | ||
export interface UploadDidNotRemove { | ||
root?: undefined; | ||
shards?: undefined; | ||
} | ||
export interface UploadListSuccess extends ListResponse<UploadListItem> { | ||
} | ||
export interface UploadListItem extends UploadAddSuccess { | ||
} | ||
export type UCANRevoke = InferInvokedCapability<typeof UCANCaps.revoke>; | ||
@@ -167,0 +223,0 @@ /** |
{ | ||
"name": "@web3-storage/capabilities", | ||
"version": "9.5.0", | ||
"version": "10.0.0", | ||
"description": "Capabilities provided by web3.storage", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/web3-storage/w3protocol/tree/main/packages/capabilities", |
import type { TupleToUnion } from 'type-fest' | ||
import * as Ucanto from '@ucanto/interface' | ||
import type { Schema } from '@ucanto/core' | ||
import { InferInvokedCapability, Unit, DID, DIDKey } from '@ucanto/interface' | ||
import { | ||
InferInvokedCapability, | ||
Unit, | ||
DID, | ||
DIDKey, | ||
ToString, | ||
Link, | ||
UnknownLink, | ||
} from '@ucanto/interface' | ||
import { CAR } from '@ucanto/transport' | ||
import type { PieceLink } from '@web3-storage/data-segment' | ||
@@ -22,2 +31,7 @@ import { space, info } from './space.js' | ||
/** | ||
* An IPLD Link that has the CAR codec code. | ||
*/ | ||
export type CARLink = Link<unknown, typeof CAR.codec.code> | ||
export type AccountDID = DID<'mailto'> | ||
@@ -213,2 +227,3 @@ export type SpaceDID = DID<'key'> | ||
export type UploadList = InferInvokedCapability<typeof UploadCaps.list> | ||
// Store | ||
@@ -219,2 +234,64 @@ export type Store = InferInvokedCapability<typeof store> | ||
export type StoreList = InferInvokedCapability<typeof list> | ||
export type StoreAddSuccess = StoreAddSuccessDone | StoreAddSuccessUpload | ||
export interface StoreAddSuccessDone { | ||
status: 'done' | ||
with: DID | ||
link: UnknownLink | ||
url?: undefined | ||
headers?: undefined | ||
} | ||
export interface StoreAddSuccessUpload { | ||
status: 'upload' | ||
with: DID | ||
link: UnknownLink | ||
url: ToString<URL> | ||
headers: Record<string, string> | ||
} | ||
export interface StoreRemoveSuccess { | ||
size: number | ||
} | ||
export interface StoreItemNotFound extends Ucanto.Failure { | ||
name: 'StoreItemNotFound' | ||
} | ||
export type StoreRemoveFailure = StoreItemNotFound | Ucanto.Failure | ||
export interface StoreListSuccess extends ListResponse<StoreListItem> {} | ||
export interface ListResponse<R> { | ||
cursor?: string | ||
before?: string | ||
after?: string | ||
size: number | ||
results: R[] | ||
} | ||
export interface StoreListItem { | ||
link: UnknownLink | ||
size: number | ||
origin?: UnknownLink | ||
} | ||
export interface UploadAddSuccess { | ||
root: UnknownLink | ||
shards?: CARLink[] | ||
} | ||
export type UploadRemoveSuccess = UploadDidRemove | UploadDidNotRemove | ||
export interface UploadDidRemove extends UploadAddSuccess {} | ||
export interface UploadDidNotRemove { | ||
root?: undefined | ||
shards?: undefined | ||
} | ||
export interface UploadListSuccess extends ListResponse<UploadListItem> {} | ||
export interface UploadListItem extends UploadAddSuccess {} | ||
// UCAN core events | ||
@@ -221,0 +298,0 @@ |
Sorry, the diff of this file is not supported yet
118128
2680