diff --git a/core/deno.json b/core/deno.json index f42a1065..5c8c013e 100644 --- a/core/deno.json +++ b/core/deno.json @@ -1,6 +1,6 @@ { "name": "@nats-io/nats-core", - "version": "3.0.0-26", + "version": "3.0.0-27", "exports": { ".": "./src/mod.ts", "./internal": "./src/internal_mod.ts" @@ -38,4 +38,4 @@ "@nats-io/nkeys": "jsr:@nats-io/nkeys@1.2.0-4", "@nats-io/nuid": "jsr:@nats-io/nuid@2.0.1-2" } -} \ No newline at end of file +} diff --git a/core/package.json b/core/package.json index cebe18fc..fe74756b 100644 --- a/core/package.json +++ b/core/package.json @@ -1,6 +1,6 @@ { "name": "@nats-io/nats-core", - "version": "3.0.0-26", + "version": "3.0.0-27", "files": [ "lib/", "LICENSE", @@ -41,4 +41,4 @@ "typedoc": "^0.26.5", "typescript": "^5.5.4" } -} \ No newline at end of file +} diff --git a/core/src/internal_mod.ts b/core/src/internal_mod.ts index 4d396a9f..64827aec 100644 --- a/core/src/internal_mod.ts +++ b/core/src/internal_mod.ts @@ -24,7 +24,6 @@ export type { Transport, TransportFactory } from "./transport.ts"; export { Connect, INFO, ProtocolHandler } from "./protocol.ts"; export type { Backoff, - Cancelable, Deferred, Delay, ErrorResult, diff --git a/core/src/mod.ts b/core/src/mod.ts index 16b71a9f..9be580dd 100644 --- a/core/src/mod.ts +++ b/core/src/mod.ts @@ -54,7 +54,6 @@ export type { Authenticator, Backoff, BenchOpts, - Cancelable, Codec, ConnectionOptions, Deferred, diff --git a/core/src/util.ts b/core/src/util.ts index a512731c..37f66153 100644 --- a/core/src/util.ts +++ b/core/src/util.ts @@ -61,11 +61,7 @@ export function render(frame: Uint8Array): string { .replace(/\r/g, cr); } -export interface Cancelable { - cancel: () => void; -} - -export interface Timeout extends Promise, Cancelable { +export interface Timeout extends Promise { cancel: () => void; } @@ -94,7 +90,7 @@ export function timeout(ms: number, asyncTraces = true): Timeout { return Object.assign(p, methods) as Timeout; } -export interface Delay extends Promise, Cancelable { +export interface Delay extends Promise { cancel: () => void; } @@ -107,6 +103,7 @@ export function delay(ms = 0): Delay { const cancel = (): void => { if (timer) { clearTimeout(timer); + resolve(); } }; methods = { cancel }; diff --git a/core/src/version.ts b/core/src/version.ts index 14b3fbc8..e9228cee 100644 --- a/core/src/version.ts +++ b/core/src/version.ts @@ -1,2 +1,2 @@ // This file is generated - do not edit -export const version = "3.0.0-26"; +export const version = "3.0.0-27"; diff --git a/deno.json b/deno.json index 603562d4..26ed8f67 100644 --- a/deno.json +++ b/deno.json @@ -6,7 +6,7 @@ "test_helpers": "./test_helpers/mod.ts" }, "tasks": { - "clean": "rm -Rf ./coverage core/lib jetstream/lib services/lib kv/lib obj/lib transport-node/lib transport-ws/lib", + "clean": "rm -Rf ./coverage core/lib core/build jetstream/lib jetstream/build services/lib services/build kv/lib kv/build obj/lib obj/build transport-node/lib transport-ws/lib", "test": "deno task clean && deno task lint && deno task test-all", "test-all": "deno task test-core && deno task test-jetstream && deno task test-kv && deno task test-obj && deno task test-services && deno task test-unsafe", "test-unsafe": "deno test -A --parallel --reload --quiet --unsafely-ignore-certificate-errors --coverage=coverage core/unsafe_tests", diff --git a/jetstream/deno.json b/jetstream/deno.json index 1ab270f8..011c5e9e 100644 --- a/jetstream/deno.json +++ b/jetstream/deno.json @@ -30,9 +30,9 @@ ] }, "tasks": { - "test": "deno test -A --parallel --reload --quiet tests/ --import-map=import_map.json" + "test": "deno test -A --parallel --reload --trace-leaks --quiet tests/ --import-map=import_map.json" }, "imports": { - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-26" + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-27" } -} \ No newline at end of file +} diff --git a/jetstream/examples/util.ts b/jetstream/examples/util.ts index 67b29c8d..a3296971 100644 --- a/jetstream/examples/util.ts +++ b/jetstream/examples/util.ts @@ -14,8 +14,8 @@ */ import { createConsumer, fill, initStream } from "../tests/jstest_util.ts"; -import type { NatsConnection } from "jsr:@nats-io/nats-core@3.0.0-17"; -import { nuid } from "jsr:@nats-io/nats-core@3.0.0-17"; +import type { NatsConnection } from "jsr:@nats-io/nats-core@3.0.0-27"; +import { nuid } from "jsr:@nats-io/nats-core@3.0.0-27"; export async function setupStreamAndConsumer( nc: NatsConnection, diff --git a/jetstream/import_map.json b/jetstream/import_map.json index c82c03d7..cb20e61a 100644 --- a/jetstream/import_map.json +++ b/jetstream/import_map.json @@ -2,9 +2,9 @@ "imports": { "@nats-io/nkeys": "jsr:@nats-io/nkeys@1.2.0-4", "@nats-io/nuid": "jsr:@nats-io/nuid@2.0.1-2", - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-26", - "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-26/internal", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-27", + "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-27/internal", "test_helpers": "../test_helpers/mod.ts", "@std/io": "jsr:@std/io@0.224.0" } -} \ No newline at end of file +} diff --git a/jetstream/package.json b/jetstream/package.json index c2c2e408..026bb4f0 100644 --- a/jetstream/package.json +++ b/jetstream/package.json @@ -32,7 +32,7 @@ }, "description": "jetstream library - this library implements all the base functionality for NATS JetStream for javascript clients", "dependencies": { - "@nats-io/nats-core": "~3.0.0-26" + "@nats-io/nats-core": "~3.0.0-27" }, "devDependencies": { "@types/node": "^22.0.0", @@ -40,4 +40,4 @@ "typedoc": "^0.26.5", "typescript": "^5.5.4" } -} \ No newline at end of file +} diff --git a/jetstream/src/pushconsumer.ts b/jetstream/src/pushconsumer.ts index 87ad2028..510d984f 100644 --- a/jetstream/src/pushconsumer.ts +++ b/jetstream/src/pushconsumer.ts @@ -27,6 +27,7 @@ import { } from "@nats-io/nats-core/internal"; import type { CallbackFn, + Delay, QueuedIterator, Status, Subscription, @@ -49,6 +50,7 @@ export class PushConsumerMessagesImpl extends QueuedIteratorImpl serial: number; createFails!: number; statusIterator!: QueuedIteratorImpl; + cancelables: Delay[]; constructor( c: PushConsumerImpl, @@ -59,6 +61,7 @@ export class PushConsumerMessagesImpl extends QueuedIteratorImpl this.consumer = c; this.monitor = null; this.listeners = []; + this.cancelables = []; this.abortOnMissingResource = userOptions.abort_on_missing_resource === true; this.callback = userOptions.callback || null; @@ -119,12 +122,20 @@ export class PushConsumerMessagesImpl extends QueuedIteratorImpl this.stop(err); } const bo = backoff(); - delay(bo.backoff(this.createFails)) - .then(() => { - if (!this.done) { - this.reset(); - } + const c = delay(bo.backoff(this.createFails)); + c.then(() => { + const idx = this.cancelables.indexOf(c); + if (idx !== -1) { + this.cancelables = this.cancelables.splice(idx, idx); + } + if (!this.done) { + this.reset(); + } + }) + .catch((_) => { + // canceled }); + this.cancelables.push(c); }); } @@ -161,6 +172,11 @@ export class PushConsumerMessagesImpl extends QueuedIteratorImpl this.statusIterator?.stop(); this.monitor?.cancel(); this.monitor = null; + // if we have delays, stop them + this.cancelables.forEach((c) => { + c.cancel(); + }); + this.cancelables = []; this._push(() => { super.stop(err); this.listeners.forEach((n) => { diff --git a/jetstream/tests/pushconsumers_ordered_test.ts b/jetstream/tests/pushconsumers_ordered_test.ts index f93ff6c0..7998ea76 100644 --- a/jetstream/tests/pushconsumers_ordered_test.ts +++ b/jetstream/tests/pushconsumers_ordered_test.ts @@ -24,7 +24,6 @@ import { jetstreamServerConf, notCompatible, } from "test_helpers"; -import { deferred } from "@nats-io/nats-core"; import type { PushConsumerImpl, PushConsumerMessagesImpl, @@ -74,7 +73,6 @@ Deno.test("ordered push consumers - consume reset", async () => { assertExists(oc); const seen: number[] = new Array(3).fill(0); - const done = deferred(); const iter = await oc.consume({ callback: (m: JsMsg) => { @@ -87,11 +85,10 @@ Deno.test("ordered push consumers - consume reset", async () => { } if (m.info.pending === 0) { iter.stop(); - done.resolve(); } }, }) as PushConsumerMessagesImpl; - await done; + await iter.closed(); assertEquals(seen, [2, 2, 1]); assertEquals(oc.serial, 3); @@ -151,6 +148,7 @@ Deno.test("ordered push consumers - filters consume", async () => { } } + await iter.closed(); assertEquals(iter.getProcessed(), 1); await cleanup(ns, nc); diff --git a/kv/deno.json b/kv/deno.json index 7567f2ea..5cb41445 100644 --- a/kv/deno.json +++ b/kv/deno.json @@ -33,7 +33,7 @@ "test": "deno test -A --parallel --reload --quiet tests/ --import-map=import_map.json" }, "imports": { - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-26", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-27", "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-10" } -} \ No newline at end of file +} diff --git a/kv/import_map.json b/kv/import_map.json index 7debe135..c8c7b251 100644 --- a/kv/import_map.json +++ b/kv/import_map.json @@ -1,7 +1,7 @@ { "imports": { - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-26", - "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-26/internal", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-27", + "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-27/internal", "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-10", "@nats-io/jetstream/internal": "jsr:@nats-io/jetstream@~3.0.0-10/internal", "test_helpers": "../test_helpers/mod.ts", @@ -9,4 +9,4 @@ "@nats-io/nuid": "jsr:@nats-io/nuid@2.0.1-2", "@std/io": "jsr:@std/io@0.224.0" } -} \ No newline at end of file +} diff --git a/kv/package.json b/kv/package.json index 181ffe7d..b5a1d40e 100644 --- a/kv/package.json +++ b/kv/package.json @@ -33,7 +33,7 @@ "description": "kv library - this library implements all the base functionality for NATS KV javascript clients", "dependencies": { "@nats-io/jetstream": "~3.0.0-10", - "@nats-io/nats-core": "~3.0.0-26" + "@nats-io/nats-core": "~3.0.0-27" }, "devDependencies": { "@types/node": "^22.0.0", @@ -41,4 +41,4 @@ "typedoc": "^0.26.5", "typescript": "^5.5.4" } -} \ No newline at end of file +} diff --git a/obj/deno.json b/obj/deno.json index 3f2bb15f..908c0aed 100644 --- a/obj/deno.json +++ b/obj/deno.json @@ -33,7 +33,7 @@ "test": "deno test -A --parallel --reload --quiet tests/ --import-map=import_map.json" }, "imports": { - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-26", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-27", "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-10" } -} \ No newline at end of file +} diff --git a/obj/import_map.json b/obj/import_map.json index 7debe135..c8c7b251 100644 --- a/obj/import_map.json +++ b/obj/import_map.json @@ -1,7 +1,7 @@ { "imports": { - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-26", - "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-26/internal", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-27", + "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-27/internal", "@nats-io/jetstream": "jsr:@nats-io/jetstream@~3.0.0-10", "@nats-io/jetstream/internal": "jsr:@nats-io/jetstream@~3.0.0-10/internal", "test_helpers": "../test_helpers/mod.ts", @@ -9,4 +9,4 @@ "@nats-io/nuid": "jsr:@nats-io/nuid@2.0.1-2", "@std/io": "jsr:@std/io@0.224.0" } -} \ No newline at end of file +} diff --git a/obj/package.json b/obj/package.json index e3290c55..b071bc92 100644 --- a/obj/package.json +++ b/obj/package.json @@ -33,7 +33,7 @@ "description": "obj library - this library implements all the base functionality for NATS objectstore for javascript clients", "dependencies": { "@nats-io/jetstream": "~3.0.0-10", - "@nats-io/nats-core": "~3.0.0-26" + "@nats-io/nats-core": "~3.0.0-27" }, "devDependencies": { "@types/node": "^22.0.0", @@ -41,4 +41,4 @@ "typedoc": "^0.26.5", "typescript": "^5.5.4" } -} \ No newline at end of file +} diff --git a/services/deno.json b/services/deno.json index eed9f40c..f457b9a6 100644 --- a/services/deno.json +++ b/services/deno.json @@ -33,6 +33,6 @@ "test": "deno test -A --parallel --reload --quiet tests/ --import-map=import_map.json" }, "imports": { - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-26" + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-27" } -} \ No newline at end of file +} diff --git a/services/import_map.json b/services/import_map.json index 2131e0b2..68cf0688 100644 --- a/services/import_map.json +++ b/services/import_map.json @@ -1,10 +1,10 @@ { "imports": { - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-26", - "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-26/internal", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-27", + "@nats-io/nats-core/internal": "jsr:@nats-io/nats-core@~3.0.0-27/internal", "test_helpers": "../test_helpers/mod.ts", "@nats-io/nkeys": "jsr:@nats-io/nkeys@1.2.0-4", "@nats-io/nuid": "jsr:@nats-io/nuid@2.0.1-2", "@std/io": "jsr:@std/io@0.224.0" } -} \ No newline at end of file +} diff --git a/services/package.json b/services/package.json index c9fc7f1e..953bacd5 100644 --- a/services/package.json +++ b/services/package.json @@ -32,7 +32,7 @@ }, "description": "services library - this library implements all the base functionality for NATS services for javascript clients", "dependencies": { - "@nats-io/nats-core": "~3.0.0-26" + "@nats-io/nats-core": "~3.0.0-27" }, "devDependencies": { "@types/node": "^22.0.0", @@ -40,4 +40,4 @@ "typedoc": "^0.26.5", "typescript": "^5.5.4" } -} \ No newline at end of file +} diff --git a/transport-deno/deno.json b/transport-deno/deno.json index 0faadc72..51b27e73 100644 --- a/transport-deno/deno.json +++ b/transport-deno/deno.json @@ -20,8 +20,8 @@ }, "imports": { "@std/io": "jsr:@std/io@0.224.0", - "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-26", + "@nats-io/nats-core": "jsr:@nats-io/nats-core@~3.0.0-27", "@nats-io/nkeys": "jsr:@nats-io/nkeys@1.2.0-4", "@nats-io/nuid": "jsr:@nats-io/nuid@2.0.1-2" } -} \ No newline at end of file +} diff --git a/transport-node/examples/bench.js b/transport-node/examples/bench.js index 24a5ffc2..8794f2c8 100755 --- a/transport-node/examples/bench.js +++ b/transport-node/examples/bench.js @@ -3,6 +3,7 @@ const parse = require("minimist"); const { Nuid, connect } = require("../index"); const { Bench, Metric } = require("../lib/nats-base-client/bench"); +const { process } = require("node:process"); const defaults = { s: "127.0.0.1:4222", diff --git a/transport-node/examples/nats-events.js b/transport-node/examples/nats-events.js index 58b5d267..2a17d1cc 100755 --- a/transport-node/examples/nats-events.js +++ b/transport-node/examples/nats-events.js @@ -1,5 +1,6 @@ #!/usr/bin/env node +const { process } = require("node:process"); const parse = require("minimist"); const { connect } = require("../index"); diff --git a/transport-node/examples/nats-pub.js b/transport-node/examples/nats-pub.js index cacebe24..3ea22378 100755 --- a/transport-node/examples/nats-pub.js +++ b/transport-node/examples/nats-pub.js @@ -5,7 +5,8 @@ const { connect, StringCodec, headers, credsAuthenticator } = require( "../index", ); const { delay } = require("./util"); -const fs = require("fs"); +const fs = require("node:fs"); +const { process } = require("node:process"); const argv = parse( process.argv.slice(2), diff --git a/transport-node/examples/nats-rep.js b/transport-node/examples/nats-rep.js index 63b5a794..292957b5 100755 --- a/transport-node/examples/nats-rep.js +++ b/transport-node/examples/nats-rep.js @@ -4,7 +4,8 @@ const parse = require("minimist"); const { connect, StringCodec, headers, credsAuthenticator } = require( "../index", ); -const fs = require("fs"); +const fs = require("node:fs"); +const { process } = require("node:process"); const argv = parse( process.argv.slice(2), diff --git a/transport-node/examples/nats-req.js b/transport-node/examples/nats-req.js index b0fe0f58..df314a70 100755 --- a/transport-node/examples/nats-req.js +++ b/transport-node/examples/nats-req.js @@ -5,7 +5,8 @@ const { connect, StringCodec, headers, credsAuthenticator } = require( "../index", ); const { delay } = require("./util"); -const fs = require("fs"); +const fs = require("node:fs"); +const { process } = require("node:process"); const argv = parse( process.argv.slice(2), diff --git a/transport-node/examples/nats-sub.js b/transport-node/examples/nats-sub.js index a43132ff..07fdd191 100755 --- a/transport-node/examples/nats-sub.js +++ b/transport-node/examples/nats-sub.js @@ -2,7 +2,8 @@ const parse = require("minimist"); const { connect, StringCodec, credsAuthenticator } = require("../index"); -const fs = require("fs"); +const fs = require("node:fs"); +const { process } = require("node:process"); const argv = parse( process.argv.slice(2), diff --git a/transport-node/package-lock.json b/transport-node/package-lock.json index 236568e6..131c9313 100644 --- a/transport-node/package-lock.json +++ b/transport-node/package-lock.json @@ -1,12 +1,12 @@ { "name": "@nats-io/transport-node", - "version": "3.0.0-11", + "version": "3.0.0-12", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@nats-io/transport-node", - "version": "3.0.0-11", + "version": "3.0.0-12", "license": "Apache-2.0", "dependencies": { "@nats-io/nats-core": "~3.0.0-20", diff --git a/transport-node/package.json b/transport-node/package.json index 00ce1dc9..e3d694cc 100644 --- a/transport-node/package.json +++ b/transport-node/package.json @@ -1,6 +1,6 @@ { "name": "@nats-io/transport-node", - "version": "3.0.0-11", + "version": "3.0.0-12", "description": "Node.js client for NATS, a lightweight, high-performance cloud native messaging system", "keywords": [ "nats", @@ -54,7 +54,7 @@ "node": ">= 18.0.0" }, "dependencies": { - "@nats-io/nats-core": "~3.0.0-26", + "@nats-io/nats-core": "~3.0.0-27", "@nats-io/nkeys": "^1.2.0-4", "@nats-io/nuid": "^2.0.1-2" }, @@ -68,4 +68,4 @@ "@nats-io/kv": "^3.0.0-2", "@nats-io/obj": "^3.0.0-1" } -} \ No newline at end of file +} diff --git a/transport-node/src/node_transport.ts b/transport-node/src/node_transport.ts index c9904d44..55ce9565 100644 --- a/transport-node/src/node_transport.ts +++ b/transport-node/src/node_transport.ts @@ -28,12 +28,13 @@ import { } from "./nats-base-client"; import type { ConnectionOptions } from "./nats-base-client"; -import { createConnection, Socket } from "net"; -import { connect as tlsConnect, TlsOptions, TLSSocket } from "tls"; -const { resolve } = require("path"); -const { readFile, existsSync } = require("fs"); -const dns = require("dns"); -const { version } = require("./version"); +import { createConnection, Socket } from "node:net"; +import { connect as tlsConnect, TlsOptions, TLSSocket } from "node:tls"; +import { resolve } from "node:path"; +import { existsSync, readFile } from "node:fs"; +import dns from "node:dns"; +import { Buffer } from "node:buffer"; +import { version } from "./version"; export const VERSION = version; const LANG = "nats.js"; diff --git a/transport-node/src/version.ts b/transport-node/src/version.ts index 1bf965b2..5110165c 100644 --- a/transport-node/src/version.ts +++ b/transport-node/src/version.ts @@ -1,2 +1,2 @@ // This file is generated - do not edit -export const version = "3.0.0-11"; +export const version = "3.0.0-12"; diff --git a/transport-node/tests/helpers/launcher.js b/transport-node/tests/helpers/launcher.js index d6622679..0f5a52bc 100644 --- a/transport-node/tests/helpers/launcher.js +++ b/transport-node/tests/helpers/launcher.js @@ -12,8 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -const path = require("path"); -const http = require("http"); +const path = require("node:path"); +const http = require("node:http"); +const process = require("node:process"); +const { spawn } = require("node:child_process"); +const fs = require("node:fs"); +const os = require("node:os"); const { check } = require("./delay"); const { deferred, @@ -22,10 +26,6 @@ const { nuid, } = require("@nats-io/nats-core/internal"); -const { spawn } = require("child_process"); - -const fs = require("fs"); -const os = require("os"); const { Lock } = require("./lock"); const ServerSignals = new Map(); diff --git a/transport-node/tests/noiptls_test.js b/transport-node/tests/noiptls_test.js index 0c2ad752..db446aa0 100644 --- a/transport-node/tests/noiptls_test.js +++ b/transport-node/tests/noiptls_test.js @@ -20,7 +20,8 @@ const { "../index", ); -const { resolve, join } = require("path"); +const process = require("node:process"); +const { resolve, join } = require("node:path"); const { Lock } = require("./helpers/lock"); const { NatsServer } = require("./helpers/launcher"); diff --git a/transport-node/tests/tls_test.js b/transport-node/tests/tls_test.js index 2bbf4361..5b0e0c5c 100644 --- a/transport-node/tests/tls_test.js +++ b/transport-node/tests/tls_test.js @@ -20,8 +20,9 @@ const { } = require( "../index", ); -const { resolve, join } = require("path"); -const { readFileSync } = require("fs"); +const process = require("node:process"); +const { resolve, join } = require("node:path"); +const { readFileSync } = require("node:fs"); const { Lock } = require("./helpers/lock"); const { NatsServer } = require("./helpers/launcher"); const { buildAuthenticator, extend, Connect } = require(