@ndn/endpoint
Advanced tools
Comparing version 0.0.20200606 to 0.0.20200909
import { Forwarder } from "@ndn/fw"; | ||
import { Data, Interest } from "@ndn/packet"; | ||
import { Data, FwHint, Interest, NameLike, Verifier } from "@ndn/packet"; | ||
import PCancelable from "p-cancelable"; | ||
import { RetxPolicy } from "./retx"; | ||
declare type ModifyInterestFunc = (interest: Interest) => void; | ||
interface ModifyInterestFields { | ||
canBePrefix?: boolean; | ||
mustBeFresh?: boolean; | ||
fwHint?: FwHint; | ||
lifetime?: number; | ||
hopLimit?: number; | ||
} | ||
declare type ModifyInterest = ModifyInterestFunc | ModifyInterestFields; | ||
export interface Options { | ||
/** Description for debugging purpose. */ | ||
describe?: string; | ||
/** | ||
* Modify Interest according to specified options. | ||
* Default is no modification. | ||
*/ | ||
modifyInterest?: ModifyInterest; | ||
/** | ||
* Retransmission policy. | ||
* Default is disabling retransmission. | ||
*/ | ||
retx?: RetxPolicy; | ||
describe?: string; | ||
/** | ||
* Data verifier. | ||
* Default is no verification. | ||
*/ | ||
verifier?: Verifier; | ||
} | ||
@@ -24,3 +48,4 @@ /** | ||
/** Consume a single piece of Data. */ | ||
consume(interest: Interest, opts?: Options): Context; | ||
consume(interestInput: Interest | NameLike, opts?: Options): Context; | ||
} | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import { Data, Interest } from "@ndn/packet"; | ||
import { Data, Interest, Signer } from "@ndn/packet"; | ||
/** Outgoing Data buffer for producer. */ | ||
@@ -22,7 +22,16 @@ export interface DataBuffer { | ||
readonly store: DataStore; | ||
constructor(store: DataStore, { ttl, dataSigner, }?: DataStoreBuffer.Options); | ||
private readonly ttl; | ||
constructor(store: DataStore, ttl?: number); | ||
private readonly dataSigner?; | ||
find(interest: Interest): Promise<Data | undefined>; | ||
insert(...pkts: Data[]): Promise<void>; | ||
} | ||
export declare namespace DataStoreBuffer { | ||
interface Options { | ||
/** Data expiration time. Default is 60000ms. 0 means infinity. */ | ||
ttl?: number; | ||
/** If specified, automatically sign Data packets unless already signed. */ | ||
dataSigner?: Signer; | ||
} | ||
} | ||
export {}; |
export type { RetxOptions, RetxPolicy } from "./retx"; | ||
export type { Context as ConsumerContext, Options as ConsumerOptions } from "./consumer"; | ||
export type { DataBuffer } from "./data-buffer"; | ||
export { DataStoreBuffer } from "./data-buffer"; | ||
export { DataBuffer, DataStoreBuffer } from "./data-buffer"; | ||
export type { Handler as ProducerHandler, Options as ProducerOptions, Producer } from "./producer"; | ||
export * from "./endpoint"; |
import { Forwarder, FwFace } from "@ndn/fw"; | ||
import { Data, Interest, Name, NameLike } from "@ndn/packet"; | ||
import { DataBuffer } from "./data-buffer"; | ||
import { Data, Interest, Name, NameLike, Signer } from "@ndn/packet"; | ||
import type { DataBuffer } from "./data-buffer"; | ||
/** | ||
@@ -9,18 +9,33 @@ * Producer handler function. | ||
* | ||
* If Options.dataBuffer is provided, the handler can have access to the DataBuffer via | ||
* producer.dataBuffer . The handler can return a Data to respond to the Interest, which is also | ||
* inserted to the DataBuffer unless Options.autoBuffer is set to false. If the handler returns | ||
* 'false', the Interest is used to query the DataBuffer, and any matching Data may be sent. | ||
* If Options.dataBuffer is provided, the handler can access the DataBuffer via producer.dataBuffer . | ||
* The handler can return a Data to respond to the Interest, which is also inserted to the DataBuffer | ||
* unless Options.autoBuffer is set to false. If the handler returns 'false', the Interest is used | ||
* to query the DataBuffer, and any matching Data may be sent. | ||
*/ | ||
export declare type Handler = (interest: Interest, producer: Producer) => Promise<Data | false>; | ||
export interface Options { | ||
/** What name to be readvertised (ignored if prefix is unspecified). */ | ||
/** Description for debugging purpose. */ | ||
describe?: string; | ||
/** | ||
* What name to be readvertised. | ||
* Ignored if prefix is undefined. | ||
*/ | ||
announcement?: EndpointProducer.RouteAnnouncement; | ||
/** How many Interests to process in parallel. */ | ||
/** | ||
* How many Interests to process in parallel. | ||
* Default is 1. | ||
*/ | ||
concurrency?: number; | ||
/** Description for debugging purpose. */ | ||
describe?: string; | ||
/** | ||
* If specified, automatically sign Data packets unless already signed. | ||
* This does not apply to Data packets manually inserted to the dataBuffer. | ||
*/ | ||
dataSigner?: Signer; | ||
/** Outgoing Data buffer. */ | ||
dataBuffer?: DataBuffer; | ||
/** Whether to add handler return value to buffer. Default is true. */ | ||
/** | ||
* Whether to add handler return value to buffer. | ||
* Default is true. | ||
* Ignored when dataBuffer is not specified. | ||
*/ | ||
autoBuffer?: boolean; | ||
@@ -50,1 +65,2 @@ } | ||
} | ||
export declare function signUnsignedData(data: Data, dataSigner: Signer | undefined): Promise<void>; |
{ | ||
"name": "@ndn/endpoint", | ||
"version": "0.0.20200606", | ||
"version": "0.0.20200909", | ||
"description": "NDNts: Client Endpoint", | ||
@@ -15,3 +15,4 @@ "keywords": [ | ||
"type": "module", | ||
"main": "lib/mod.js", | ||
"main": "lib/mod_node.js", | ||
"module": "lib/mod_browser.js", | ||
"sideEffects": false, | ||
@@ -25,5 +26,5 @@ "homepage": "https://yoursunny.com/p/NDNts/", | ||
"dependencies": { | ||
"@ndn/fw": "0.0.20200606", | ||
"@ndn/packet": "0.0.20200606", | ||
"@ndn/tlv": "0.0.20200606", | ||
"@ndn/fw": "0.0.20200909", | ||
"@ndn/packet": "0.0.20200909", | ||
"@ndn/tlv": "0.0.20200909", | ||
"applymixins": "^1.1.0", | ||
@@ -33,5 +34,6 @@ "it-pushable": "^1.4.0", | ||
"p-cancelable": "^2.0.0", | ||
"streaming-iterables": "^4.1.2", | ||
"tslib": "*" | ||
} | ||
"streaming-iterables": "^5.0.2", | ||
"tslib": "^2.0.1" | ||
}, | ||
"types": "lib/mod.d.ts" | ||
} |
@@ -9,3 +9,3 @@ # @ndn/endpoint | ||
* [ ] Outgoing packets are signed and incoming packets are verified, if trust schema is provided. | ||
* [X] Outgoing packets are signed and incoming packets are verified, if trust schema is provided. | ||
* [X] Outgoing Interests are retransmitted periodically, if retransmission policy is specified. | ||
@@ -12,0 +12,0 @@ * [X] Outgoing Data buffer, if enabled, allows the producer to reply to one Interest with multiple Data (e.g. segments), or push generated Data without receiving an Interest. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
28772
20
719
1
1
+ Added@ndn/fw@0.0.20200909(transitive)
+ Added@ndn/packet@0.0.20200909(transitive)
+ Added@ndn/tlv@0.0.20200909(transitive)
+ Addedmnemonist@0.38.5(transitive)
+ Addedobliterator@2.0.5(transitive)
+ Addedstreaming-iterables@5.0.4(transitive)
- Removed@ndn/fw@0.0.20200606(transitive)
- Removed@ndn/packet@0.0.20200606(transitive)
- Removed@ndn/tlv@0.0.20200606(transitive)
- Removedmnemonist@0.36.1(transitive)
- Removedobliterator@1.6.1(transitive)
- Removedstreaming-iterables@4.1.2(transitive)
Updated@ndn/fw@0.0.20200909
Updated@ndn/packet@0.0.20200909
Updated@ndn/tlv@0.0.20200909
Updatedstreaming-iterables@^5.0.2
Updatedtslib@^2.0.1