@web3-storage/capabilities
Advanced tools
Comparing version 5.0.1 to 6.0.0
@@ -14,3 +14,5 @@ /** @type {import('./types.js').AbilitiesArray} */ | ||
import * as Utils from "./utils.js"; | ||
export { Access, Provider, Space, Top, Store, Upload, Voucher, Consumer, Customer, Console, Utils }; | ||
import * as Aggregate from "./aggregate.js"; | ||
import * as Offer from "./offer.js"; | ||
export { Access, Provider, Space, Top, Store, Upload, Voucher, Consumer, Customer, Console, Utils, Aggregate, Offer }; | ||
//# sourceMappingURL=index.d.ts.map |
import type { TupleToUnion } from 'type-fest'; | ||
import * as Ucanto from '@ucanto/interface'; | ||
import { InferInvokedCapability, Unit } from '@ucanto/interface'; | ||
import { InferInvokedCapability, Unit, DID } from '@ucanto/interface'; | ||
import { space, info, recover, recoverValidation } from './space.js'; | ||
@@ -11,2 +11,4 @@ import * as provider from './provider.js'; | ||
import * as AccessCaps from './access.js'; | ||
import * as AggregateCaps from './aggregate.js'; | ||
import * as OfferCaps from './offer.js'; | ||
export type { Unit }; | ||
@@ -27,3 +29,3 @@ /** | ||
} | ||
export interface AccessClaimFailure { | ||
export interface AccessClaimFailure extends Ucanto.Failure { | ||
name: 'AccessClaimFailure'; | ||
@@ -49,2 +51,3 @@ message: string; | ||
export type ProviderAddFailure = InvalidProvider | Ucanto.Failure; | ||
export type ProviderDID = DID<'web'>; | ||
export interface InvalidProvider extends Ucanto.Failure { | ||
@@ -57,2 +60,20 @@ name: 'InvalidProvider'; | ||
export type SpaceRecover = InferInvokedCapability<typeof recover>; | ||
export interface AggregateGetSuccess { | ||
deals: unknown[]; | ||
} | ||
export interface AggregateGetFailure extends Ucanto.Failure { | ||
name: 'AggregateNotFound'; | ||
} | ||
export interface AggregateOfferSuccess { | ||
status: string; | ||
} | ||
export interface AggregateOfferFailure extends Ucanto.Failure { | ||
name: 'AggregateOfferInvalidSize' | 'AggregateOfferBlockNotFound' | 'AggregateOfferInvalidUrl'; | ||
} | ||
export interface OfferArrangeSuccess { | ||
status: string; | ||
} | ||
export interface OfferArrangeFailure extends Ucanto.Failure { | ||
name: 'OfferArrangeNotFound'; | ||
} | ||
export type VoucherRedeem = InferInvokedCapability<typeof redeem>; | ||
@@ -68,2 +89,5 @@ export type VoucherClaim = InferInvokedCapability<typeof claim>; | ||
export type StoreList = InferInvokedCapability<typeof list>; | ||
export type AggregateOffer = InferInvokedCapability<typeof AggregateCaps.offer>; | ||
export type AggregateGet = InferInvokedCapability<typeof AggregateCaps.get>; | ||
export type OfferArrange = InferInvokedCapability<typeof OfferCaps.arrange>; | ||
export type Top = InferInvokedCapability<typeof top>; | ||
@@ -90,4 +114,7 @@ export type Abilities = TupleToUnion<AbilitiesArray>; | ||
AccessAuthorize['can'], | ||
AccessSession['can'] | ||
AccessSession['can'], | ||
AggregateOffer['can'], | ||
AggregateGet['can'], | ||
OfferArrange['can'] | ||
]; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -51,2 +51,3 @@ /** | ||
}>>(claimed: T, delegated: T): Types.Result<{}, Types.Failure>; | ||
export function checkLink(claimed: Types.UnknownLink, imposed: Types.UnknownLink | undefined, at: string): Types.Result<{}, Types.Failure>; | ||
export function and<T>(result: Types.Result<T, Types.Failure>): { | ||
@@ -53,0 +54,0 @@ error: Types.Failure; |
{ | ||
"name": "@web3-storage/capabilities", | ||
"version": "5.0.1", | ||
"version": "6.0.0", | ||
"description": "Capabilities provided by web3.storage", | ||
@@ -43,2 +43,8 @@ "homepage": "https://github.com/web3-storage/w3protocol/tree/main/packages/capabilities", | ||
], | ||
"aggregate": [ | ||
"dist/src/aggregate" | ||
], | ||
"offer": [ | ||
"dist/src/offer" | ||
], | ||
"utils": [ | ||
@@ -84,2 +90,3 @@ "dist/src/utils" | ||
"rules": { | ||
"unicorn/expiring-todo-comments": "off", | ||
"unicorn/prefer-number-properties": "off", | ||
@@ -86,0 +93,0 @@ "unicorn/prefer-export-from": "off", |
@@ -12,2 +12,4 @@ import * as Provider from './provider.js' | ||
import * as Console from './console.js' | ||
import * as Offer from './offer.js' | ||
import * as Aggregate from './aggregate.js' | ||
@@ -26,2 +28,4 @@ export { | ||
Utils, | ||
Aggregate, | ||
Offer, | ||
} | ||
@@ -50,2 +54,5 @@ | ||
Access.session.can, | ||
Aggregate.offer.can, | ||
Aggregate.get.can, | ||
Offer.arrange.can, | ||
] |
@@ -6,3 +6,3 @@ /** | ||
* ```js | ||
* import * as Account from '@web3-storage/capabilities/store' | ||
* import * as Store from '@web3-storage/capabilities/store' | ||
* ``` | ||
@@ -9,0 +9,0 @@ * |
import type { TupleToUnion } from 'type-fest' | ||
import * as Ucanto from '@ucanto/interface' | ||
import { InferInvokedCapability, Unit } from '@ucanto/interface' | ||
import { InferInvokedCapability, Unit, DID } from '@ucanto/interface' | ||
import { space, info, recover, recoverValidation } from './space.js' | ||
@@ -11,2 +11,4 @@ import * as provider from './provider.js' | ||
import * as AccessCaps from './access.js' | ||
import * as AggregateCaps from './aggregate.js' | ||
import * as OfferCaps from './offer.js' | ||
@@ -34,3 +36,3 @@ export type { Unit } | ||
} | ||
export interface AccessClaimFailure { | ||
export interface AccessClaimFailure extends Ucanto.Failure { | ||
name: 'AccessClaimFailure' | ||
@@ -61,2 +63,3 @@ message: string | ||
export type ProviderAddFailure = InvalidProvider | Ucanto.Failure | ||
export type ProviderDID = DID<'web'> | ||
@@ -75,2 +78,27 @@ export interface InvalidProvider extends Ucanto.Failure { | ||
// Aggregate | ||
export interface AggregateGetSuccess { | ||
deals: unknown[] | ||
} | ||
export interface AggregateGetFailure extends Ucanto.Failure { | ||
name: 'AggregateNotFound' | ||
} | ||
export interface AggregateOfferSuccess { | ||
status: string | ||
} | ||
export interface AggregateOfferFailure extends Ucanto.Failure { | ||
name: | ||
| 'AggregateOfferInvalidSize' | ||
| 'AggregateOfferBlockNotFound' | ||
| 'AggregateOfferInvalidUrl' | ||
} | ||
export interface OfferArrangeSuccess { | ||
status: string | ||
} | ||
export interface OfferArrangeFailure extends Ucanto.Failure { | ||
name: 'OfferArrangeNotFound' | ||
} | ||
// Voucher Protocol | ||
@@ -89,2 +117,8 @@ export type VoucherRedeem = InferInvokedCapability<typeof redeem> | ||
export type StoreList = InferInvokedCapability<typeof list> | ||
// Aggregate | ||
export type AggregateOffer = InferInvokedCapability<typeof AggregateCaps.offer> | ||
export type AggregateGet = InferInvokedCapability<typeof AggregateCaps.get> | ||
// Offer | ||
export type OfferArrange = InferInvokedCapability<typeof OfferCaps.arrange> | ||
// Top | ||
@@ -114,3 +148,6 @@ export type Top = InferInvokedCapability<typeof top> | ||
AccessAuthorize['can'], | ||
AccessSession['can'] | ||
AccessSession['can'], | ||
AggregateOffer['can'], | ||
AggregateGet['can'], | ||
OfferArrange['can'] | ||
] |
@@ -83,2 +83,18 @@ import { fail, ok } from '@ucanto/validator' | ||
/** | ||
* Checks that `claimed` {@link Types.Link} meets an `imposed` constraint. | ||
* | ||
* @param {Types.UnknownLink} claimed | ||
* @param {Types.UnknownLink|undefined} imposed | ||
* @param {string} at | ||
* @returns {Types.Result<{}, Types.Failure>} | ||
*/ | ||
export const checkLink = (claimed, imposed, at) => { | ||
return equal( | ||
String(claimed), | ||
imposed === undefined ? undefined : String(imposed), | ||
at | ||
) | ||
} | ||
/** | ||
* @template T | ||
@@ -85,0 +101,0 @@ * @param {Types.Result<T , Types.Failure>} result |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
86593
47
1903