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

rx-jupyter

Package Overview
Dependencies
Maintainers
4
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rx-jupyter - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

41

lib/kernels.js

@@ -6,2 +6,5 @@ "use strict";

});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.list = list;

@@ -22,2 +25,6 @@ exports.get = get;

var _Subject = require("rxjs/Subject");
var _Subscriber = require("rxjs/Subscriber");
var _base = require("./base");

@@ -129,3 +136,35 @@

function connect(serverConfig, kernelID, sessionID) {
return (0, _webSocket.webSocket)(formWebSocketURL(serverConfig, kernelID, sessionID));
var wsSubject = (0, _webSocket.webSocket)(formWebSocketURL(serverConfig, kernelID, sessionID));
// Create a subject that does some of the handling inline for the session
// and ensuring it's serialized
return _Subject.Subject.create(_Subscriber.Subscriber.create({
next: function next(message) {
if (typeof message === "string") {
// Assume serialized
wsSubject.next(message);
} else if ((typeof message === "undefined" ? "undefined" : _typeof(message)) === "object") {
var sessionizedMessage = Object.assign({}, message, {
header: Object.assign({}, {
session: sessionID
}, message.header)
});
wsSubject.next(JSON.stringify(sessionizedMessage));
} else {
console.error("Message must be a string or object, app sent", message);
}
},
error: function error(e) {
return wsSubject.error(e);
},
complete: function complete() {
return wsSubject.complete();
}
}), // Subscriber
// Subject.create takes a subscriber and an observable. We're only overriding
// the subscriber here so we pass the subject on as an observable as the
// second argument to Subject.create (since it's _also_ an observable)
// $FlowFixMe: update the flow definition to allow this
wsSubject);
}

2

package.json
{
"name": "rx-jupyter",
"version": "2.1.1",
"version": "2.2.0",
"description": "RxJS 5 bindings for the Jupyter Notebook API",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -7,2 +7,5 @@ // @flow

import { Subject } from "rxjs/Subject";
import { Subscriber } from "rxjs/Subscriber";
import { createAJAXSettings } from "./base";

@@ -131,4 +134,43 @@

sessionID: ?string
): Observable<*> {
return webSocket(formWebSocketURL(serverConfig, kernelID, sessionID));
): * {
const wsSubject = webSocket(
formWebSocketURL(serverConfig, kernelID, sessionID)
);
// Create a subject that does some of the handling inline for the session
// and ensuring it's serialized
return Subject.create(
Subscriber.create({
next: message => {
if (typeof message === "string") {
// Assume serialized
wsSubject.next(message);
} else if (typeof message === "object") {
const sessionizedMessage = Object.assign({}, message, {
header: Object.assign(
{},
{
session: sessionID
},
message.header
)
});
wsSubject.next(JSON.stringify(sessionizedMessage));
} else {
console.error(
"Message must be a string or object, app sent",
message
);
}
},
error: e => wsSubject.error(e),
complete: () => wsSubject.complete()
}), // Subscriber
// Subject.create takes a subscriber and an observable. We're only overriding
// the subscriber here so we pass the subject on as an observable as the
// second argument to Subject.create (since it's _also_ an observable)
// $FlowFixMe: update the flow definition to allow this
wsSubject
);
}

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