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

@web3-storage/aggregate-client

Package Overview
Dependencies
Maintainers
5
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3-storage/aggregate-client - npm Package Compare versions

Comparing version 0.0.0 to 1.0.0

9

dist/src/aggregate.d.ts

@@ -5,6 +5,7 @@ /**

* @param {import('./types').InvocationConfig} conf - Configuration
* @param {import('./types').Offer[]} offers
* @param {import('./types').Piece} piece
* @param {import('./types').Piece[]} offer
* @param {import('./types').RequestOptions} [options]
*/
export function aggregateOffer({ issuer, with: resource, proofs, audience }: import('./types').InvocationConfig, offers: import('./types').Offer[], options?: import("./types").RequestOptions | undefined): Promise<import("@ucanto/interface").Receipt<import("@web3-storage/capabilities/types").AggregateOfferSuccess, import("@ucanto/interface").HandlerNotFound | import("@ucanto/interface").HandlerExecutionError | import("@ucanto/interface").InvalidAudience | import("@ucanto/interface").Unauthorized | import("@web3-storage/capabilities/types").AggregateOfferFailure, import("@ucanto/interface").Invocation<import("@ucanto/interface").Capability<import("@ucanto/interface").Ability, `${string}:${string}`, unknown>>, import("@ucanto/interface").SigAlg>>;
export function aggregateOffer({ issuer, with: resource, proofs, audience }: import('./types').InvocationConfig, piece: import('./types').Piece, offer: import('./types').Piece[], options?: import("./types").RequestOptions | undefined): Promise<import("@ucanto/interface").Receipt<import("@web3-storage/capabilities/dist/src/types.js").AggregateOfferSuccess, import("@ucanto/interface").HandlerNotFound | import("@ucanto/interface").HandlerExecutionError | import("@ucanto/interface").InvalidAudience | import("@ucanto/interface").Unauthorized | import("@web3-storage/capabilities/dist/src/types.js").AggregateOfferFailure, import("@ucanto/interface").Invocation<import("@ucanto/interface").Capability<import("@ucanto/interface").Ability, `${string}:${string}`, unknown>>, import("@ucanto/interface").SigAlg>>;
/**

@@ -14,8 +15,8 @@ * Get details of an aggregate.

* @param {import('./types').InvocationConfig} conf - Configuration
* @param {import('@ucanto/interface').Link<unknown, number, number, 0 | 1>} commitmentProof
* @param {import('@ucanto/interface').UnknownLink} subject
* @param {import('./types').RequestOptions} [options]
*/
export function aggregateGet({ issuer, with: resource, proofs, audience }: import('./types').InvocationConfig, commitmentProof: import('@ucanto/interface').Link<unknown, number, number, 0 | 1>, options?: import("./types").RequestOptions | undefined): Promise<import("@ucanto/interface").Receipt<import("@web3-storage/capabilities/types").AggregateGetSuccess, import("@ucanto/interface").HandlerNotFound | import("@ucanto/interface").HandlerExecutionError | import("@ucanto/interface").InvalidAudience | import("@ucanto/interface").Unauthorized | import("@web3-storage/capabilities/types").AggregateGetFailure, import("@ucanto/interface").Invocation<import("@ucanto/interface").Capability<import("@ucanto/interface").Ability, `${string}:${string}`, unknown>>, import("@ucanto/interface").SigAlg>>;
export function aggregateGet({ issuer, with: resource, proofs, audience }: import('./types').InvocationConfig, subject: import('@ucanto/interface').UnknownLink, options?: import("./types").RequestOptions | undefined): Promise<import("@ucanto/interface").Receipt<import("@web3-storage/capabilities/dist/src/types.js").AggregateGetSuccess, import("@ucanto/interface").HandlerNotFound | import("@ucanto/interface").HandlerExecutionError | import("@ucanto/interface").InvalidAudience | import("@ucanto/interface").Unauthorized | import("@web3-storage/capabilities/dist/src/types.js").AggregateGetFailure, import("@ucanto/interface").Invocation<import("@ucanto/interface").Capability<import("@ucanto/interface").Ability, `${string}:${string}`, unknown>>, import("@ucanto/interface").SigAlg>>;
export const MIN_SIZE: number;
export const MAX_SIZE: number;
//# sourceMappingURL=aggregate.d.ts.map
import { Link } from 'multiformats/link';
import type { CommP } from '@web3-storage/data-segment';
import { CAR } from '@ucanto/transport';

@@ -32,8 +33,2 @@ import { ConnectionView, ServiceMethod, Signer, Proof, DID, Principal, ToString } from '@ucanto/interface';

}
export interface Offer {
link: CARLink;
size: number;
commitmentProof: string;
src: OfferSrc[];
}
export interface RequestOptions extends Connectable {

@@ -49,2 +44,15 @@ }

export type OfferSrc = ToString<URL>;
/**
* [Piece CID](https://spec.filecoin.io/systems/filecoin_files/piece/) of some
* content.
*/
export type PieceCID = ReturnType<typeof CommP.toCID>;
/**
* [Piece](https://spec.filecoin.io/systems/filecoin_files/piece/) information
* for this CAR file.
*/
export interface Piece {
link: PieceCID;
size: number;
}
//# sourceMappingURL=types.d.ts.map
{
"name": "@web3-storage/aggregate-client",
"version": "0.0.0",
"version": "1.0.0",
"description": "The web3.storage aggregate client",

@@ -43,3 +43,3 @@ "homepage": "https://github.com/web3-storage/w3up/tree/main/packages/aggregate-client",

"@ucanto/transport": "^8.0.0",
"@web3-storage/capabilities": "^6.0.0"
"@web3-storage/capabilities": "^7.0.0"
},

@@ -52,2 +52,3 @@ "devDependencies": {

"@ucanto/server": "^8.0.1",
"@web3-storage/data-segment": "^1.0.1",
"assert": "^2.0.0",

@@ -54,0 +55,0 @@ "c8": "^7.13.0",

@@ -23,3 +23,4 @@ <h1 align="center">⁂<br/>web3.storage</h1>

conf: InvocationConfig,
offers: Offer[],
piece: Piece,
offer: Piece[],
): Promise<{ status: string }>

@@ -37,4 +38,4 @@ ```

conf: InvocationConfig,
commitmentProof: string, // TODO: ProofLink
): Promise<unkown> // TODO: type
subject: PieceCID,
): Promise<unkown>
```

@@ -48,3 +49,3 @@

### `Offer`
### `Piece`

@@ -54,8 +55,8 @@ An offered CAR to be part of an Aggregate.

```ts
export interface Offer {
link: CARLink
export interface Piece {
link: PieceCID
size: number
commitmentProof: string // TODO: ProofLink
src: OfferSrc[]
}
export type PieceCID = ReturnType<typeof CommP.toCID>
```

@@ -62,0 +63,0 @@

import * as AggregateCapabilities from '@web3-storage/capabilities/aggregate'
import { CBOR, parseLink } from '@ucanto/core'
import { CBOR } from '@ucanto/core'

@@ -13,3 +13,4 @@ import { servicePrincipal, connection } from './service.js'

* @param {import('./types').InvocationConfig} conf - Configuration
* @param {import('./types').Offer[]} offers
* @param {import('./types').Piece} piece
* @param {import('./types').Piece[]} offer
* @param {import('./types').RequestOptions} [options]

@@ -19,3 +20,4 @@ */

{ issuer, with: resource, proofs, audience },
offers,
piece,
offer,
options = {}

@@ -26,10 +28,3 @@ ) {

// TODO: Get commitmentProof
const commitmentProof = parseLink(
'baga6ea4seaqm2u43527zehkqqcpyyopgsw2c4mapyy2vbqzqouqtzhxtacueeki'
)
// Validate size for offer is valid
const size = offers.reduce((accum, offer) => accum + offer.size, 0)
const block = await CBOR.write(offers)
const block = await CBOR.write(offer)
const invocation = AggregateCapabilities.offer.invoke({

@@ -42,4 +37,3 @@ issuer,

offer: block.cid,
commitmentProof,
size,
piece,
},

@@ -57,3 +51,3 @@ proofs,

* @param {import('./types').InvocationConfig} conf - Configuration
* @param {import('@ucanto/interface').Link<unknown, number, number, 0 | 1>} commitmentProof
* @param {import('@ucanto/interface').UnknownLink} subject
* @param {import('./types').RequestOptions} [options]

@@ -63,3 +57,3 @@ */

{ issuer, with: resource, proofs, audience },
commitmentProof,
subject,
options = {}

@@ -77,3 +71,3 @@ ) {

nb: {
commitmentProof: commitmentProof,
subject,
},

@@ -80,0 +74,0 @@ proofs,

import { Link } from 'multiformats/link'
import type { CommP } from '@web3-storage/data-segment'
import { CAR } from '@ucanto/transport'

@@ -61,9 +62,2 @@ import {

export interface Offer {
link: CARLink
size: number
commitmentProof: string // TODO: ProofLink
src: OfferSrc[]
}
export interface RequestOptions extends Connectable {}

@@ -81,1 +75,16 @@

export type OfferSrc = ToString<URL>
/**
* [Piece CID](https://spec.filecoin.io/systems/filecoin_files/piece/) of some
* content.
*/
export type PieceCID = ReturnType<typeof CommP.toCID>
/**
* [Piece](https://spec.filecoin.io/systems/filecoin_files/piece/) information
* for this CAR file.
*/
export interface Piece {
link: PieceCID
size: number
}

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