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

@web3-storage/capabilities

Package Overview
Dependencies
Maintainers
0
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 17.3.0 to 17.4.0

2

dist/src/top.d.ts

@@ -7,3 +7,3 @@ /**

*/
export const top: import("@ucanto/interface").TheCapabilityParser<import("@ucanto/interface").CapabilityMatch<"*", import("@ucanto/interface").URI<"did:">, any>>;
export const top: import("@ucanto/interface").TheCapabilityParser<import("@ucanto/interface").CapabilityMatch<"*", import("@ucanto/interface").URI, any>>;
//# sourceMappingURL=top.d.ts.map

@@ -96,2 +96,5 @@ import type { TupleToUnion } from 'type-fest';

export type UsageReportFailure = Ucanto.Failure;
export type EgressRecord = InferInvokedCapability<typeof UsageCaps.record>;
export type EgressRecordSuccess = Unit;
export type EgressRecordFailure = ConsumerNotFound | Ucanto.Failure;
export interface UsageData {

@@ -126,2 +129,16 @@ /** Provider the report concerns, e.g. `did:web:web3.storage` */

}
export interface EgressData {
/** The space which contains the resource that was served. */
space: SpaceDID;
/** The customer that is being billed for the egress traffic. */
customer: AccountDID;
/** CID of the resource that was served it's the CID of some gateway accessible content. It is not the CID of a blob/shard.*/
resource: UnknownLink;
/** Amount of bytes served. */
bytes: number;
/** ISO datetime that the bytes were served at. */
servedAt: ISO8601Date;
/** Identifier of the invocation that caused the egress traffic. */
cause: UnknownLink;
}
export type ProviderAdd = InferInvokedCapability<typeof provider.add>;

@@ -153,2 +170,3 @@ export interface ProviderAddSuccess {

subscription: string;
customer: AccountDID;
}

@@ -155,0 +173,0 @@ export interface ConsumerNotFound extends Ucanto.Failure {

@@ -25,3 +25,17 @@ /**

}>>>;
/**
* Capability can be invoked by an agent to record usage data for a given resource.
*/
export const record: import("@ucanto/interface").TheCapabilityParser<import("@ucanto/interface").CapabilityMatch<"usage/record", `did:key:${string}` & `did:${string}` & import("@ucanto/interface").Phantom<{
protocol: "did:";
}>, Schema.InferStruct<{
resource: Schema.Schema<import("@ucanto/interface").Link<unknown, number, number, 0 | 1>, any>;
bytes: Schema.NumberSchema<number & import("@ucanto/interface").Phantom<{
typeof: "integer";
}>, unknown>;
servedAt: Schema.NumberSchema<number & import("@ucanto/interface").Phantom<{
typeof: "integer";
}>, unknown>;
}>>>;
import { Schema } from '@ucanto/validator';
//# sourceMappingURL=usage.d.ts.map
{
"name": "@web3-storage/capabilities",
"version": "17.3.0",
"version": "17.4.0",
"description": "UCAN Capabilities provided by web3.storage",

@@ -5,0 +5,0 @@ "homepage": "https://web3.storage",

@@ -12,3 +12,3 @@ /**

import { capability, URI } from '@ucanto/validator'
import { capability, Schema } from '@ucanto/validator'
import { equalWith } from './utils.js'

@@ -24,4 +24,4 @@

can: '*',
with: URI.match({ protocol: 'did:' }),
with: Schema.or(Schema.did(), Schema.literal('ucan:*')),
derives: equalWith,
})

@@ -134,2 +134,6 @@ import type { TupleToUnion } from 'type-fest'

export type EgressRecord = InferInvokedCapability<typeof UsageCaps.record>
export type EgressRecordSuccess = Unit
export type EgressRecordFailure = ConsumerNotFound | Ucanto.Failure
export interface UsageData {

@@ -165,2 +169,17 @@ /** Provider the report concerns, e.g. `did:web:web3.storage` */

export interface EgressData {
/** The space which contains the resource that was served. */
space: SpaceDID
/** The customer that is being billed for the egress traffic. */
customer: AccountDID
/** CID of the resource that was served it's the CID of some gateway accessible content. It is not the CID of a blob/shard.*/
resource: UnknownLink
/** Amount of bytes served. */
bytes: number
/** ISO datetime that the bytes were served at. */
servedAt: ISO8601Date
/** Identifier of the invocation that caused the egress traffic. */
cause: UnknownLink
}
// Provider

@@ -198,2 +217,3 @@ export type ProviderAdd = InferInvokedCapability<typeof provider.add>

subscription: string
customer: AccountDID
}

@@ -200,0 +220,0 @@ export interface ConsumerNotFound extends Ucanto.Failure {

@@ -43,1 +43,18 @@ import { capability, ok, Schema } from '@ucanto/validator'

})
/**
* Capability can be invoked by an agent to record usage data for a given resource.
*/
export const record = capability({
can: 'usage/record',
with: SpaceDID,
nb: Schema.struct({
/** CID of the resource that was served. */
resource: Schema.link(),
/** Amount of bytes served. */
bytes: Schema.integer().greaterThan(0),
/** Timestamp of the event in seconds after Unix epoch. */
servedAt: Schema.integer().greaterThan(-1),
}),
derives: equalWith,
})

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