New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@storacha/capabilities

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storacha/capabilities - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

22

dist/src/space.d.ts

@@ -58,3 +58,25 @@ export { top } from "./top.js";

}>>>;
/**
* The capability grants permission for all content serve operations that fall under the "space/content/serve" namespace.
* It can be derived from any of the `space/*` capability that has matching `with`.
*/
export const contentServe: import("@ucanto/interface").TheCapabilityParser<import("@ucanto/interface").CapabilityMatch<"space/content/serve/*", `did:key:${string}` & `did:${string}` & import("@ipld/dag-ucan").Phantom<{
protocol: "did:";
}>, any>>;
/**
* Capability can be invoked by an agent to record egress data for a given resource.
* It can be derived from any of the `space/content/serve/*` capability that has matching `with`.
*/
export const egressRecord: import("@ucanto/interface").TheCapabilityParser<import("@ucanto/interface").CapabilityMatch<"space/content/serve/egress/record", `did:key:${string}` & `did:${string}` & import("@ipld/dag-ucan").Phantom<{
protocol: "did:";
}>, Store.Schema.InferStruct<{
resource: Store.Schema.Schema<import("@ipld/dag-ucan").IPLDLink<unknown, number, number, 0 | 1>, any>;
bytes: Store.Schema.NumberSchema<number & import("@ipld/dag-ucan").Phantom<{
typeof: "integer";
}>, unknown>;
servedAt: Store.Schema.NumberSchema<number & import("@ipld/dag-ucan").Phantom<{
typeof: "integer";
}>, unknown>;
}>>>;
import * as Store from './store.js';
//# sourceMappingURL=space.d.ts.map

16

dist/src/types.d.ts

@@ -7,3 +7,3 @@ import type { TupleToUnion } from 'type-fest';

import { Phantom, PieceLink, ProofData, uint64 } from '@web3-storage/data-segment';
import { space, info } from './space.js';
import * as SpaceCaps from './space.js';
import * as provider from './provider.js';

@@ -98,4 +98,10 @@ import { top } from './top.js';

export type UsageReportFailure = Ucanto.Failure;
export type EgressRecord = InferInvokedCapability<typeof UsageCaps.record>;
export type EgressRecordSuccess = Unit;
export type EgressRecord = InferInvokedCapability<typeof SpaceCaps.egressRecord>;
export type EgressRecordSuccess = {
space: SpaceDID;
resource: UnknownLink;
bytes: number;
servedAt: ISO8601Date;
cause: UnknownLink;
};
export type EgressRecordFailure = ConsumerNotFound | Ucanto.Failure;

@@ -216,4 +222,4 @@ export interface UsageData {

export type RateLimitListFailure = Ucanto.Failure;
export type Space = InferInvokedCapability<typeof space>;
export type SpaceInfo = InferInvokedCapability<typeof info>;
export type Space = InferInvokedCapability<typeof SpaceCaps.space>;
export type SpaceInfo = InferInvokedCapability<typeof SpaceCaps.info>;
export interface DealMetadata {

@@ -220,0 +226,0 @@ dataType: uint64;

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

}>>>;
/**
* 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("@ipld/dag-ucan").Phantom<{
protocol: "did:";
}>, Schema.InferStruct<{
resource: Schema.Schema<import("@ipld/dag-ucan").IPLDLink<unknown, number, number, 0 | 1>, any>;
bytes: Schema.NumberSchema<number & import("@ipld/dag-ucan").Phantom<{
typeof: "integer";
}>, unknown>;
servedAt: Schema.NumberSchema<number & import("@ipld/dag-ucan").Phantom<{
typeof: "integer";
}>, unknown>;
}>>>;
import { Schema } from '@ucanto/validator';
//# sourceMappingURL=usage.d.ts.map
{
"name": "@storacha/capabilities",
"version": "1.1.1",
"version": "1.1.2",
"description": "UCAN Capabilities provided by storacha.network",

@@ -5,0 +5,0 @@ "homepage": "https://storacha.network",

@@ -66,1 +66,30 @@ /**

})
/**
* The capability grants permission for all content serve operations that fall under the "space/content/serve" namespace.
* It can be derived from any of the `space/*` capability that has matching `with`.
*/
export const contentServe = capability({
can: 'space/content/serve/*',
with: SpaceDID,
derives: equalWith,
})
/**
* Capability can be invoked by an agent to record egress data for a given resource.
* It can be derived from any of the `space/content/serve/*` capability that has matching `with`.
*/
export const egressRecord = capability({
can: 'space/content/serve/egress/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 milliseconds after Unix epoch. */
servedAt: Schema.integer().greaterThan(-1),
}),
derives: equalWith,
})

@@ -21,3 +21,3 @@ import type { TupleToUnion } from 'type-fest'

} from '@web3-storage/data-segment'
import { space, info } from './space.js'
import * as SpaceCaps from './space.js'
import * as provider from './provider.js'

@@ -136,4 +136,10 @@ import { top } from './top.js'

export type EgressRecord = InferInvokedCapability<typeof UsageCaps.record>
export type EgressRecordSuccess = Unit
export type EgressRecord = InferInvokedCapability<typeof SpaceCaps.egressRecord>
export type EgressRecordSuccess = {
space: SpaceDID
resource: UnknownLink
bytes: number
servedAt: ISO8601Date
cause: UnknownLink
}
export type EgressRecordFailure = ConsumerNotFound | Ucanto.Failure

@@ -282,4 +288,4 @@

// Space
export type Space = InferInvokedCapability<typeof space>
export type SpaceInfo = InferInvokedCapability<typeof info>
export type Space = InferInvokedCapability<typeof SpaceCaps.space>
export type SpaceInfo = InferInvokedCapability<typeof SpaceCaps.info>

@@ -286,0 +292,0 @@ // filecoin

@@ -43,18 +43,1 @@ 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