Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@web3-storage/capabilities

Package Overview
Dependencies
Maintainers
5
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3-storage/capabilities - npm Package Compare versions

Comparing version 8.0.0 to 9.0.0

dist/src/rate-limit.d.ts

10

dist/src/consumer.d.ts

@@ -18,2 +18,12 @@ export const ProviderDID: import("@ucanto/core/schema.js").Schema<`did:web:${string}` & `did:${string}` & import("@ucanto/interface").Phantom<{

}>>>;
/**
* Capability can be invoked by a provider to get information about a consumer.
*/
export const get: import("@ucanto/interface").TheCapabilityParser<import("@ucanto/interface").CapabilityMatch<"consumer/get", `did:web:${string}` & `did:${string}` & import("@ucanto/interface").Phantom<{
protocol: "did:";
}>, import("@ucanto/core/schema/type.js").InferStruct<{
consumer: import("@ucanto/core/schema.js").Schema<`did:key:${string}` & `did:${string}` & import("@ucanto/interface").Phantom<{
protocol: "did:";
}>, any>;
}>>>;
//# sourceMappingURL=consumer.d.ts.map

4

dist/src/index.d.ts

@@ -14,4 +14,6 @@ /** @type {import('./types.js').AbilitiesArray} */

import * as Utils from "./utils.js";
import * as RateLimit from "./rate-limit.js";
import * as Subscription from "./subscription.js";
import * as Filecoin from "./filecoin.js";
export { Access, Provider, Space, Top, Store, Upload, Voucher, Consumer, Customer, Console, Utils, Filecoin };
export { Access, Provider, Space, Top, Store, Upload, Voucher, Consumer, Customer, Console, Utils, RateLimit, Subscription, Filecoin };
//# sourceMappingURL=index.d.ts.map
import type { TupleToUnion } from 'type-fest';
import * as Ucanto from '@ucanto/interface';
import type { Schema } from '@ucanto/core';
import { InferInvokedCapability, Unit, DID } from '@ucanto/interface';
import { InferInvokedCapability, Unit, DID, DIDKey } from '@ucanto/interface';
import type { PieceLink } from '@web3-storage/data-segment';

@@ -13,4 +13,9 @@ import { space, info, recover, recoverValidation } from './space.js';

import * as AccessCaps from './access.js';
import * as CustomerCaps from './customer.js';
import * as ConsumerCaps from './consumer.js';
import * as SubscriptionCaps from './subscription.js';
import * as RateLimitCaps from './rate-limit.js';
import * as FilecoinCaps from './filecoin.js';
export type { Unit };
export type AccountDID = DID<'mailto'>;
/**

@@ -23,2 +28,6 @@ * failure due to a resource not having enough storage capacity.

}
export interface UnknownProvider extends Ucanto.Failure {
name: 'UnknownProvider';
did: DID;
}
export type PieceLinkSchema = Schema.Schema<PieceLink>;

@@ -57,2 +66,53 @@ export type Access = InferInvokedCapability<typeof AccessCaps.access>;

}
export type CustomerGet = InferInvokedCapability<typeof CustomerCaps.get>;
export interface CustomerGetSuccess {
did: AccountDID;
}
export interface CustomerNotFound extends Ucanto.Failure {
name: 'CustomerNotFound';
}
export type CustomerGetFailure = CustomerNotFound | Ucanto.Failure;
export type ConsumerHas = InferInvokedCapability<typeof ConsumerCaps.has>;
export type ConsumerHasSuccess = boolean;
export type ConsumerHasFailure = Ucanto.Failure;
export type ConsumerGet = InferInvokedCapability<typeof ConsumerCaps.get>;
export interface ConsumerGetSuccess {
did: DIDKey;
allocated: number;
total: number;
subscription: string;
}
export interface ConsumerNotFound extends Ucanto.Failure {
name: 'ConsumerNotFound';
}
export type ConsumerGetFailure = ConsumerNotFound | Ucanto.Failure;
export type SubscriptionGet = InferInvokedCapability<typeof SubscriptionCaps.get>;
export interface SubscriptionGetSuccess {
customer: AccountDID;
consumer: DIDKey;
}
export interface SubscriptionNotFound extends Ucanto.Failure {
name: 'SubscriptionNotFound';
}
export type SubscriptionGetFailure = SubscriptionNotFound | UnknownProvider | Ucanto.Failure;
export type RateLimitAdd = InferInvokedCapability<typeof RateLimitCaps.add>;
export interface RateLimitAddSuccess {
id: string;
}
export type RateLimitAddFailure = Ucanto.Failure;
export type RateLimitRemove = InferInvokedCapability<typeof RateLimitCaps.remove>;
export type RateLimitRemoveSuccess = Unit;
export interface RateLimitsNotFound extends Ucanto.Failure {
name: 'RateLimitsNotFound';
}
export type RateLimitRemoveFailure = RateLimitsNotFound | Ucanto.Failure;
export type RateLimitList = InferInvokedCapability<typeof RateLimitCaps.list>;
export interface RateLimitSubject {
id: string;
rate: number;
}
export interface RateLimitListSuccess {
limits: RateLimitSubject[];
}
export type RateLimitListFailure = Ucanto.Failure;
export type Space = InferInvokedCapability<typeof space>;

@@ -131,2 +191,9 @@ export type SpaceInfo = InferInvokedCapability<typeof info>;

AccessSession['can'],
CustomerGet['can'],
ConsumerHas['can'],
ConsumerGet['can'],
SubscriptionGet['can'],
RateLimitAdd['can'],
RateLimitRemove['can'],
RateLimitList['can'],
FilecoinAdd['can'],

@@ -133,0 +200,0 @@ AggregateAdd['can'],

{
"name": "@web3-storage/capabilities",
"version": "8.0.0",
"version": "9.0.0",
"description": "Capabilities provided by web3.storage",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/web3-storage/w3protocol/tree/main/packages/capabilities",

@@ -27,1 +27,19 @@ import { capability, DID, struct, ok } from '@ucanto/validator'

})
/**
* Capability can be invoked by a provider to get information about a consumer.
*/
export const get = capability({
can: 'consumer/get',
with: ProviderDID,
nb: struct({
consumer: SpaceDID,
}),
derives: (child, parent) => {
return (
and(equalWith(child, parent)) ||
and(equal(child.nb.consumer, parent.nb.consumer, 'consumer')) ||
ok({})
)
},
})

@@ -12,2 +12,4 @@ import * as Provider from './provider.js'

import * as Console from './console.js'
import * as RateLimit from './rate-limit.js'
import * as Subscription from './subscription.js'
import * as Filecoin from './filecoin.js'

@@ -27,2 +29,4 @@

Utils,
RateLimit,
Subscription,
Filecoin,

@@ -52,2 +56,9 @@ }

Access.session.can,
Customer.get.can,
Consumer.has.can,
Consumer.get.can,
Subscription.get.can,
RateLimit.add.can,
RateLimit.remove.can,
RateLimit.list.can,
Filecoin.filecoinAdd.can,

@@ -54,0 +65,0 @@ Filecoin.aggregateAdd.can,

import type { TupleToUnion } from 'type-fest'
import * as Ucanto from '@ucanto/interface'
import type { Schema } from '@ucanto/core'
import { InferInvokedCapability, Unit, DID } from '@ucanto/interface'
import { InferInvokedCapability, Unit, DID, DIDKey } from '@ucanto/interface'
import type { PieceLink } from '@web3-storage/data-segment'

@@ -13,5 +13,12 @@ import { space, info, recover, recoverValidation } from './space.js'

import * as AccessCaps from './access.js'
import * as CustomerCaps from './customer.js'
import * as ConsumerCaps from './consumer.js'
import * as SubscriptionCaps from './subscription.js'
import * as RateLimitCaps from './rate-limit.js'
import * as FilecoinCaps from './filecoin.js'
export type { Unit }
export type AccountDID = DID<'mailto'>
/**

@@ -25,2 +32,7 @@ * failure due to a resource not having enough storage capacity.

export interface UnknownProvider extends Ucanto.Failure {
name: 'UnknownProvider'
did: DID
}
export type PieceLinkSchema = Schema.Schema<PieceLink>

@@ -72,2 +84,71 @@

// Customer
export type CustomerGet = InferInvokedCapability<typeof CustomerCaps.get>
export interface CustomerGetSuccess {
did: AccountDID
}
export interface CustomerNotFound extends Ucanto.Failure {
name: 'CustomerNotFound'
}
export type CustomerGetFailure = CustomerNotFound | Ucanto.Failure
// Consumer
export type ConsumerHas = InferInvokedCapability<typeof ConsumerCaps.has>
export type ConsumerHasSuccess = boolean
export type ConsumerHasFailure = Ucanto.Failure
export type ConsumerGet = InferInvokedCapability<typeof ConsumerCaps.get>
export interface ConsumerGetSuccess {
did: DIDKey
allocated: number
total: number
subscription: string
}
export interface ConsumerNotFound extends Ucanto.Failure {
name: 'ConsumerNotFound'
}
export type ConsumerGetFailure = ConsumerNotFound | Ucanto.Failure
// Subscription
export type SubscriptionGet = InferInvokedCapability<
typeof SubscriptionCaps.get
>
export interface SubscriptionGetSuccess {
customer: AccountDID
consumer: DIDKey
}
export interface SubscriptionNotFound extends Ucanto.Failure {
name: 'SubscriptionNotFound'
}
export type SubscriptionGetFailure =
| SubscriptionNotFound
| UnknownProvider
| Ucanto.Failure
// Rate Limit
export type RateLimitAdd = InferInvokedCapability<typeof RateLimitCaps.add>
export interface RateLimitAddSuccess {
id: string
}
export type RateLimitAddFailure = Ucanto.Failure
export type RateLimitRemove = InferInvokedCapability<
typeof RateLimitCaps.remove
>
export type RateLimitRemoveSuccess = Unit
export interface RateLimitsNotFound extends Ucanto.Failure {
name: 'RateLimitsNotFound'
}
export type RateLimitRemoveFailure = RateLimitsNotFound | Ucanto.Failure
export type RateLimitList = InferInvokedCapability<typeof RateLimitCaps.list>
export interface RateLimitSubject {
id: string
rate: number
}
export interface RateLimitListSuccess {
limits: RateLimitSubject[]
}
export type RateLimitListFailure = Ucanto.Failure
// Space

@@ -176,2 +257,9 @@ export type Space = InferInvokedCapability<typeof space>

AccessSession['can'],
CustomerGet['can'],
ConsumerHas['can'],
ConsumerGet['can'],
SubscriptionGet['can'],
RateLimitAdd['can'],
RateLimitRemove['can'],
RateLimitList['can'],
FilecoinAdd['can'],

@@ -178,0 +266,0 @@ AggregateAdd['can'],

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc