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

nighthouse

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nighthouse - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

out/browser/index.js

@@ -16,3 +16,3 @@ "use strict";

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.connect = void 0;

@@ -19,0 +19,0 @@ var common_1 = require("../common");

@@ -38,3 +38,3 @@ "use strict";

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrowserWebSocketTransport = void 0;

@@ -41,0 +41,0 @@ var common_1 = require("../common");

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessagePackCoder = void 0;

@@ -4,0 +4,0 @@ var msgpack = require("@msgpack/msgpack");

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LIGHTHOUSE_FRAME_BYTES = exports.LIGHTHOUSE_COLOR_CHANNELS = exports.LIGHTHOUSE_WINDOWS = exports.LIGHTHOUSE_COLS = exports.LIGHTHOUSE_ROWS = void 0;

@@ -4,0 +4,0 @@ exports.LIGHTHOUSE_ROWS = 14;

@@ -16,3 +16,3 @@ "use strict";

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./coder"), exports);

@@ -19,0 +19,0 @@ __exportStar(require("./constants"), exports);

@@ -23,7 +23,7 @@ import { Transport } from "./transport";

/** Streams the user's model (including e.g. key/controller events). */
streamModel(user?: string): Promise<AsyncIterable<ServerMessage<unknown>>>;
streamModel(user?: string): AsyncIterable<ServerMessage<unknown>>;
/** Performs a single request to the given path with the given payload. */
perform<T>(verb: SingleVerb, path: string[], payload: T): Promise<ServerMessage<unknown>>;
/** Performs a streaming request to the given path with the given payload. */
stream<T>(verb: StreamingVerb, path: string[], payload: T): Promise<AsyncIterable<ServerMessage<unknown>>>;
stream<T>(verb: StreamingVerb, path: string[], payload: T): AsyncIterable<ServerMessage<unknown>>;
/** Sends a request. */

@@ -30,0 +30,0 @@ private sendRequest;

@@ -38,3 +38,15 @@ "use strict";

};
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
};
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {

@@ -51,3 +63,14 @@ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");

};
exports.__esModule = true;
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Lighthouse = void 0;

@@ -118,5 +141,11 @@ var types_1 = require("./types");

if (user === void 0) { user = this.auth.USER; }
return __awaiter(this, void 0, void 0, function () {
return __asyncGenerator(this, arguments, function streamModel_1() {
return __generator(this, function (_a) {
return [2 /*return*/, this.stream('STREAM', ['user', user, 'model'], {})];
switch (_a.label) {
case 0: return [5 /*yield**/, __values(__asyncDelegator(__asyncValues(this.stream('STREAM', ['user', user, 'model'], {}))))];
case 1: return [4 /*yield*/, __await.apply(void 0, [_a.sent()])];
case 2:
_a.sent();
return [2 /*return*/];
}
});

@@ -142,10 +171,14 @@ });

Lighthouse.prototype.stream = function (verb, path, payload) {
return __awaiter(this, void 0, void 0, function () {
return __asyncGenerator(this, arguments, function stream_1() {
var requestId;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.sendRequest(verb, path, payload)];
case 0: return [4 /*yield*/, __await(this.sendRequest(verb, path, payload))];
case 1:
requestId = _a.sent();
return [2 /*return*/, this.receiveStreaming(requestId)];
return [5 /*yield**/, __values(__asyncDelegator(__asyncValues(this.receiveStreaming(requestId))))];
case 2: return [4 /*yield*/, __await.apply(void 0, [_a.sent()])];
case 3:
_a.sent();
return [2 /*return*/];
}

@@ -169,3 +202,3 @@ });

META: {},
PAYL: payload
PAYL: payload,
};

@@ -203,3 +236,3 @@ return [4 /*yield*/, this.send(message)];

_this.responseHandlers.set(id, function (message) {
_this.responseHandlers["delete"](id);
_this.responseHandlers.delete(id);
if (message.RNUM === 200) {

@@ -249,3 +282,3 @@ resolve(message);

this.logger.debug("Deleting stream handler for ".concat(id));
this.responseHandlers["delete"](id);
this.responseHandlers.delete(id);
return [7 /*endfinally*/];

@@ -252,0 +285,0 @@ case 7: return [2 /*return*/];

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = exports.LeveledLogHandler = exports.ConsoleLogHandler = exports.NoopLogHandler = exports.LogLevel = void 0;

@@ -11,3 +11,3 @@ /** A log message severity. */

LogLevel[LogLevel["Error"] = 3] = "Error";
})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
})(LogLevel || (exports.LogLevel = LogLevel = {}));
/** A simple logger that swallows the messages and does nothing. */

@@ -14,0 +14,0 @@ var NoopLogHandler = /** @class */ (function () {

"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isControllerEvent = exports.isKeyEvent = exports.isInputEvent = exports.isServerMessage = void 0;

@@ -4,0 +4,0 @@ /** A user-defined type guard for ServerMessage. */

@@ -16,3 +16,3 @@ "use strict";

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.connect = void 0;

@@ -19,0 +19,0 @@ var common_1 = require("../common");

@@ -38,3 +38,3 @@ "use strict";

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NodeWebSocketTransport = void 0;

@@ -41,0 +41,0 @@ var common_1 = require("../common");

{
"name": "nighthouse",
"version": "0.0.1",
"version": "0.0.2",
"description": "Lightweight Project Lighthouse client for JavaScript",

@@ -17,11 +17,11 @@ "workspaces": [

"dependencies": {
"@msgpack/msgpack": "^2.7.2"
"@msgpack/msgpack": "^3.0.0-beta2"
},
"devDependencies": {
"@types/node": "^18.11.18",
"typedoc": "^0.23.24",
"typescript": "^4.9.4"
"typedoc": "^0.24.8",
"typescript": "^5.1.6"
},
"peerDependencies": {
"ws": "^8.11.0"
"ws": "^8.13.0"
},

@@ -28,0 +28,0 @@ "peerDependenciesMeta": {

@@ -10,4 +10,4 @@ {

"outDir": "../../out/browser",
"lib": ["ES2015", "DOM"]
"lib": ["DOM", "ES2018"]
}
}

@@ -45,4 +45,4 @@ import { Transport } from "./transport";

/** Streams the user's model (including e.g. key/controller events). */
async streamModel(user: string = this.auth.USER): Promise<AsyncIterable<ServerMessage<unknown>>> {
return this.stream('STREAM', ['user', user, 'model'], {});
async *streamModel(user: string = this.auth.USER): AsyncIterable<ServerMessage<unknown>> {
yield* this.stream('STREAM', ['user', user, 'model'], {});
}

@@ -57,5 +57,5 @@

/** Performs a streaming request to the given path with the given payload. */
async stream<T>(verb: StreamingVerb, path: string[], payload: T): Promise<AsyncIterable<ServerMessage<unknown>>> {
async *stream<T>(verb: StreamingVerb, path: string[], payload: T): AsyncIterable<ServerMessage<unknown>> {
const requestId = await this.sendRequest(verb, path, payload);
return this.receiveStreaming(requestId);
yield* this.receiveStreaming(requestId);
}

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

@@ -7,4 +7,4 @@ {

"outDir": "../../out/common",
"lib": ["DOM", "ES2015"]
"lib": ["DOM", "ES2018"]
}
}

@@ -9,4 +9,5 @@ {

"rootDir": ".",
"outDir": "../../out/node"
"outDir": "../../out/node",
"lib": ["ES2018"]
}
}

@@ -6,4 +6,4 @@ {

"incremental": true,
"lib": ["ES2015"]
"lib": ["ES2018"]
}
}

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