Skip to content

Commit

Permalink
release 2.1.0 (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart authored Jul 2, 2021
1 parent 30c753f commit 9d53eda
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 15 deletions.
57 changes: 47 additions & 10 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export interface ServersChanged {
readonly deleted: string[];
}
export interface Sub<T> extends AsyncIterable<T> {
closed: Promise<void>;
unsubscribe(max?: number): void;
drain(): Promise<void>;
isDraining(): boolean;
Expand Down Expand Up @@ -272,6 +273,7 @@ export declare function JSONCodec<T = unknown>(): Codec<T>;
export interface JetStreamOptions {
apiPrefix?: string;
timeout?: number;
domain?: string;
}
export interface JetStreamManager {
consumers: ConsumerAPI;
Expand Down Expand Up @@ -299,6 +301,7 @@ export interface JetStreamPublishOptions {
lastMsgID: string;
streamName: string;
lastSequence: number;
lastSubjectSequence: number;
}>;
}
export interface ConsumerInfoable {
Expand Down Expand Up @@ -364,6 +367,8 @@ export interface ConsumerOptsBuilder {
maxMessages(max: number): void;
queue(n: string): void;
callback(fn: JsMsgCallback): void;
idleHeartbeat(millis: number): void;
flowControl(): void;
}
export interface Lister<T> {
next(): Promise<T[]>;
Expand All @@ -381,11 +386,11 @@ export interface StreamAPI {
info(stream: string, opts?: StreamInfoRequestOptions): Promise<StreamInfo>;
add(cfg: Partial<StreamConfig>): Promise<StreamInfo>;
update(cfg: StreamConfig): Promise<StreamInfo>;
purge(stream: string): Promise<PurgeResponse>;
purge(stream: string, opts?: PurgeOpts): Promise<PurgeResponse>;
delete(stream: string): Promise<boolean>;
list(): Lister<StreamInfo>;
deleteMessage(stream: string, seq: number): Promise<boolean>;
getMessage(stream: string, seq: number): Promise<StoredMsg>;
deleteMessage(stream: string, seq: number, erase?: boolean): Promise<boolean>;
getMessage(stream: string, query: MsgRequest): Promise<StoredMsg>;
find(subject: string): Promise<string>;
}
export interface JsMsg {
Expand Down Expand Up @@ -478,16 +483,17 @@ export interface StreamConfig {
"num_replicas": number;
"no_ack"?: boolean;
"template_owner"?: string;
"duplicate_window"?: number;
"duplicate_window"?: Nanos;
placement?: Placement;
mirror?: StreamSource;
sources?: StreamSource[];
"max_msgs_per_subject"?: number;
}
export interface StreamSource {
name: string;
"opt_start_seq": number;
"opt_start_time": string;
"filter_subject": string;
"opt_start_seq"?: number;
"opt_start_time"?: string;
"filter_subject"?: string;
}
export interface Placement {
cluster: string;
Expand Down Expand Up @@ -557,6 +563,18 @@ export interface StreamSourceInfo {
active: Nanos;
error?: ApiError;
}
export declare type PurgeOpts = PurgeBySeq | PurgeTrimOpts | PurgeBySubject;
export declare type PurgeBySeq = {
filter?: string;
seq: number;
};
export declare type PurgeTrimOpts = {
filter?: string;
keep: number;
};
export declare type PurgeBySubject = {
filter: string;
};
export interface PurgeResponse extends Success {
purged: number;
}
Expand Down Expand Up @@ -600,10 +618,14 @@ export interface Success {
success: boolean;
}
export declare type SuccessResponse = ApiResponse & Success;
export interface MsgRequest {
export interface LastForMsgRequest {
"last_by_subj": string;
}
export interface SeqMsgRequest {
seq: number;
}
export interface MsgDeleteRequest extends MsgRequest {
export declare type MsgRequest = SeqMsgRequest | LastForMsgRequest | number;
export interface MsgDeleteRequest extends SeqMsgRequest {
"no_erase"?: boolean;
}
export interface JetStreamAccountStats {
Expand All @@ -613,6 +635,7 @@ export interface JetStreamAccountStats {
consumers: number;
api: JetStreamApiStats;
limits: AccountLimits;
domain?: string;
}
export interface JetStreamApiStats {
total: number;
Expand All @@ -634,14 +657,16 @@ export interface ConsumerConfig {
"opt_start_seq"?: number;
"opt_start_time"?: string;
"ack_policy": AckPolicy;
"ack_wait"?: number;
"ack_wait"?: Nanos;
"max_deliver"?: number;
"filter_subject"?: string;
"replay_policy": ReplayPolicy;
"rate_limit_bps"?: number;
"sample_freq"?: string;
"max_waiting"?: number;
"max_ack_pending"?: number;
"idle_heartbeat"?: Nanos;
"flow_control"?: boolean;
}
export interface Consumer {
"stream_name": string;
Expand All @@ -659,6 +684,12 @@ export interface NextRequest {
"no_wait": boolean;
}

export declare enum JsHeaders {
StreamSourceHdr = "Nats-Stream-Source",
LastConsumerSeqHdr = "Nats-Last-Consumer",
LastStreamSeqHdr = "Nats-Last-Stream"
}

export declare type MsgAdapter<T> = (
err: NatsError | null,
msg: Msg,
Expand All @@ -678,3 +709,9 @@ export interface TypedSubscriptionOptions<T> extends SubOpts<T> {
}

export declare type DispatchedFn<T> = (data: T | null) => void;

export declare function defaultConsumer(name: string, opts?: Partial<ConsumerConfig>): ConsumerConfig;
export declare function nanos(millis: number): Nanos;
export declare function millis(ns: Nanos): number;
export declare function isFlowControlMsg(msg: Msg): boolean;
export declare function isHeartbeatMsg(msg: Msg): boolean;
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nats",
"version": "2.0.8",
"version": "2.1.0",
"description": "Node.js client for NATS, a lightweight, high-performance cloud native messaging system",
"keywords": [
"nats",
Expand Down Expand Up @@ -41,7 +41,7 @@
"build": "tsc",
"cjs": "deno run --allow-all bin/cjs-fix-imports.ts -o nats-base-client/ ./.deps/nats.deno/nats-base-client/",
"clean": "shx rm -Rf ./lib/* ./nats-base-client ./.deps",
"clone-nbc": "shx mkdir -p ./.deps && cd ./.deps && git clone --branch v1.0.8 https://github.com/nats-io/nats.deno.git",
"clone-nbc": "shx mkdir -p ./.deps && cd ./.deps && git clone --branch v1.1.0 https://github.com/nats-io/nats.deno.git",
"fmt": "deno fmt ./src/ ./examples/ ./test/",
"prepack": "npm run clone-nbc && npm run cjs && npm run check-package && npm run build",
"ava": "nyc ava --verbose -T 60000",
Expand Down
2 changes: 1 addition & 1 deletion src/node_transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { connect as tlsConnect, TlsOptions, TLSSocket } from "tls";
const { resolve } = require("path");
const { readFile, existsSync } = require("fs");

const VERSION = "2.0.8";
const VERSION = "2.1.0";
const LANG = "nats.js";

export class NodeTransport implements Transport {
Expand Down

0 comments on commit 9d53eda

Please sign in to comment.