jupyter-js-services
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -1,2 +0,2 @@ | ||
import { IAjaxSettings } from './utils'; | ||
import { IAjaxSettings } from 'jupyter-js-utils'; | ||
/** | ||
@@ -3,0 +3,0 @@ * A Configurable data section. |
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
var utils = require('./utils'); | ||
var utils = require('jupyter-js-utils'); | ||
/** | ||
@@ -14,3 +14,3 @@ * The url for the config service. | ||
function getConfigSection(sectionName, baseUrl, ajaxSettings) { | ||
baseUrl = baseUrl || utils.DEFAULT_BASE_URL; | ||
baseUrl = baseUrl || utils.getBaseUrl(); | ||
var section = new ConfigSection(sectionName, baseUrl, ajaxSettings); | ||
@@ -31,3 +31,3 @@ return section.load(); | ||
this._ajaxSettings = '{}'; | ||
baseUrl = baseUrl || utils.DEFAULT_BASE_URL; | ||
baseUrl = baseUrl || utils.getBaseUrl(); | ||
if (ajaxSettings) | ||
@@ -34,0 +34,0 @@ this.ajaxSettings = ajaxSettings; |
@@ -1,2 +0,2 @@ | ||
import { IAjaxSettings } from './utils'; | ||
import { IAjaxSettings } from 'jupyter-js-utils'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Options for a contents object. |
@@ -1,2 +0,2 @@ | ||
var utils = require('./utils'); | ||
var utils = require('jupyter-js-utils'); | ||
var validate = require('./validate'); | ||
@@ -23,3 +23,3 @@ /** | ||
this._ajaxSettings = '{}'; | ||
baseUrl = baseUrl || utils.DEFAULT_BASE_URL; | ||
baseUrl = baseUrl || utils.getBaseUrl(); | ||
if (ajaxSettings) | ||
@@ -26,0 +26,0 @@ this.ajaxSettings = ajaxSettings; |
import { IDisposable } from 'phosphor-disposable'; | ||
import { ISignal } from 'phosphor-signaling'; | ||
import { IAjaxSettings } from './utils'; | ||
import { IAjaxSettings } from 'jupyter-js-utils'; | ||
/** | ||
@@ -316,3 +316,3 @@ * The options object used to initialize a kernel. | ||
*/ | ||
commOpened: ISignal<IKernel, ICommOpen>; | ||
commOpened: ISignal<IKernel, IKernelMessage>; | ||
/** | ||
@@ -534,5 +534,5 @@ * The id of the server-side kernel. | ||
/** | ||
* The unique id of the message. | ||
* The original outgoing message. | ||
*/ | ||
msgId: string; | ||
msg: IKernelMessage; | ||
/** | ||
@@ -626,3 +626,3 @@ * Test whether the future is done. | ||
*/ | ||
onClose: (data?: any) => void; | ||
onClose: (msg: IKernelMessage) => void; | ||
/** | ||
@@ -633,3 +633,3 @@ * Callback for a comm message received event. | ||
*/ | ||
onMsg: (data: any) => void; | ||
onMsg: (msg: IKernelMessage) => void; | ||
/** | ||
@@ -636,0 +636,0 @@ * Open a comm with optional data and metadata. |
@@ -7,2 +7,1 @@ export * from './config'; | ||
export * from './session'; | ||
export { IAjaxSettings } from './utils'; |
import { IDisposable } from 'phosphor-disposable'; | ||
import { ISignal } from 'phosphor-signaling'; | ||
import { IKernel, IKernelId, KernelStatus } from './ikernel'; | ||
import { IAjaxSettings } from './utils'; | ||
import { IAjaxSettings } from 'jupyter-js-utils'; | ||
/** | ||
@@ -6,0 +6,0 @@ * Notebook Identification specification. |
@@ -9,2 +9,3 @@ // Copyright (c) Jupyter Development Team. | ||
}; | ||
var utils = require('jupyter-js-utils'); | ||
var phosphor_disposable_1 = require('phosphor-disposable'); | ||
@@ -14,3 +15,2 @@ var phosphor_signaling_1 = require('phosphor-signaling'); | ||
var serialize = require('./serialize'); | ||
var utils = require('./utils'); | ||
var validate = require('./validate'); | ||
@@ -102,3 +102,3 @@ /** | ||
function getKernelSpecs(options) { | ||
var baseUrl = options.baseUrl || utils.DEFAULT_BASE_URL; | ||
var baseUrl = options.baseUrl || utils.getBaseUrl(); | ||
var url = utils.urlPathJoin(baseUrl, KERNELSPEC_SERVICE_URL); | ||
@@ -142,3 +142,3 @@ var ajaxSettings = utils.copy(options.ajaxSettings) || {}; | ||
function listRunningKernels(options) { | ||
var baseUrl = options.baseUrl || utils.DEFAULT_BASE_URL; | ||
var baseUrl = options.baseUrl || utils.getBaseUrl(); | ||
var url = utils.urlPathJoin(baseUrl, KERNEL_SERVICE_URL); | ||
@@ -174,3 +174,3 @@ var ajaxSettings = utils.copy(options.ajaxSettings) || {}; | ||
function startNewKernel(options) { | ||
var baseUrl = options.baseUrl || utils.DEFAULT_BASE_URL; | ||
var baseUrl = options.baseUrl || utils.getBaseUrl(); | ||
var url = utils.urlPathJoin(baseUrl, KERNEL_SERVICE_URL); | ||
@@ -215,3 +215,3 @@ var ajaxSettings = utils.copy(options.ajaxSettings) || {}; | ||
} | ||
options.baseUrl = options.baseUrl || utils.DEFAULT_BASE_URL; | ||
options.baseUrl = options.baseUrl || utils.getBaseUrl(); | ||
return listRunningKernels(options).then(function (kernelIds) { | ||
@@ -297,9 +297,4 @@ if (!kernelIds.some(function (k) { return k.id === id; })) { | ||
this._id = id; | ||
this._baseUrl = options.baseUrl || utils.DEFAULT_BASE_URL; | ||
if (options.wsUrl) { | ||
this._wsUrl = options.wsUrl; | ||
} | ||
else { | ||
this._wsUrl = 'ws' + this._baseUrl.slice(4); | ||
} | ||
this._baseUrl = options.baseUrl || utils.getBaseUrl(); | ||
this._wsUrl = options.wsUrl || utils.getWsUrl(this._baseUrl); | ||
this._clientId = options.clientId || utils.uuid(); | ||
@@ -317,3 +312,3 @@ this._username = options.username || ''; | ||
get: function () { | ||
return Kernel.statusChangedSignal.bind(this); | ||
return KernelPrivate.statusChangedSignal.bind(this); | ||
}, | ||
@@ -328,3 +323,3 @@ enumerable: true, | ||
get: function () { | ||
return Kernel.unhandledMessageSignal.bind(this); | ||
return KernelPrivate.unhandledMessageSignal.bind(this); | ||
}, | ||
@@ -339,3 +334,3 @@ enumerable: true, | ||
get: function () { | ||
return Kernel.commOpenedSignal.bind(this); | ||
return KernelPrivate.commOpenedSignal.bind(this); | ||
}, | ||
@@ -484,3 +479,3 @@ enumerable: true, | ||
_this._futures.delete(msg.header.msg_id); | ||
}, msg.header.msg_id, expectReply, disposeOnDone); | ||
}, msg, expectReply, disposeOnDone); | ||
this._futures.set(msg.header.msg_id, future); | ||
@@ -876,3 +871,3 @@ return future; | ||
if (!content.target_module) { | ||
this.commOpened.emit(msg.content); | ||
this.commOpened.emit(msg); | ||
return; | ||
@@ -891,3 +886,3 @@ } | ||
try { | ||
var response = target(comm, content.data); | ||
var response = target(comm, msg); | ||
} | ||
@@ -931,3 +926,3 @@ catch (e) { | ||
if (onClose) | ||
onClose(msg.content.data); | ||
onClose(msg); | ||
comm.dispose(); | ||
@@ -959,3 +954,3 @@ } | ||
if (onMsg) | ||
onMsg(msg.content.data); | ||
onMsg(msg); | ||
} | ||
@@ -968,3 +963,3 @@ } | ||
if (onMsg) | ||
onMsg(msg.content.data); | ||
onMsg(msg); | ||
} | ||
@@ -999,2 +994,9 @@ catch (e) { | ||
}; | ||
return Kernel; | ||
})(); | ||
/** | ||
* A private namespace for the Kernel. | ||
*/ | ||
var KernelPrivate; | ||
(function (KernelPrivate) { | ||
/** | ||
@@ -1005,3 +1007,3 @@ * A signal emitted when the kernel status changes. | ||
*/ | ||
Kernel.statusChangedSignal = new phosphor_signaling_1.Signal(); | ||
KernelPrivate.statusChangedSignal = new phosphor_signaling_1.Signal(); | ||
/** | ||
@@ -1012,3 +1014,3 @@ * A signal emitted for unhandled kernel message. | ||
*/ | ||
Kernel.unhandledMessageSignal = new phosphor_signaling_1.Signal(); | ||
KernelPrivate.unhandledMessageSignal = new phosphor_signaling_1.Signal(); | ||
/** | ||
@@ -1019,5 +1021,4 @@ * A signal emitted for unhandled comm open message. | ||
*/ | ||
Kernel.commOpenedSignal = new phosphor_signaling_1.Signal(); | ||
return Kernel; | ||
})(); | ||
KernelPrivate.commOpenedSignal = new phosphor_signaling_1.Signal(); | ||
})(KernelPrivate || (KernelPrivate = {})); | ||
/** | ||
@@ -1138,5 +1139,5 @@ * A module private store for running kernels. | ||
*/ | ||
function KernelFutureHandler(cb, msgId, expectShell, disposeOnDone) { | ||
function KernelFutureHandler(cb, msg, expectShell, disposeOnDone) { | ||
_super.call(this, cb); | ||
this._msgId = ''; | ||
this._msg = null; | ||
this._status = 0; | ||
@@ -1148,3 +1149,3 @@ this._stdin = null; | ||
this._disposeOnDone = true; | ||
this._msgId = msgId; | ||
this._msg = msg; | ||
if (!expectShell) { | ||
@@ -1155,8 +1156,8 @@ this._setFlag(KernelFutureFlag.GotReply); | ||
} | ||
Object.defineProperty(KernelFutureHandler.prototype, "msgId", { | ||
Object.defineProperty(KernelFutureHandler.prototype, "msg", { | ||
/** | ||
* Get the id of the message. | ||
* Get the original outgoing message. | ||
*/ | ||
get: function () { | ||
return this._msgId; | ||
return this._msg; | ||
}, | ||
@@ -1248,2 +1249,3 @@ enumerable: true, | ||
this._done = null; | ||
this._msg = null; | ||
_super.prototype.dispose.call(this); | ||
@@ -1496,8 +1498,2 @@ }; | ||
} | ||
var onClose = this._onClose; | ||
if (onClose) | ||
onClose(data); | ||
if (this._msgFunc === void 0) { | ||
return; | ||
} | ||
var content = { comm_id: this._id, data: data || {} }; | ||
@@ -1508,2 +1504,5 @@ var payload = { | ||
var future = this._msgFunc(payload); | ||
var onClose = this._onClose; | ||
if (onClose) | ||
onClose(future.msg); | ||
this.dispose(); | ||
@@ -1510,0 +1509,0 @@ return future; |
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
'use strict'; | ||
var utils = require('jupyter-js-utils'); | ||
var phosphor_signaling_1 = require('phosphor-signaling'); | ||
var ikernel_1 = require('./ikernel'); | ||
var kernel_1 = require('./kernel'); | ||
var utils = require('./utils'); | ||
var validate = require('./validate'); | ||
@@ -81,3 +81,3 @@ /** | ||
function listRunningSessions(options) { | ||
var baseUrl = options.baseUrl || utils.DEFAULT_BASE_URL; | ||
var baseUrl = options.baseUrl || utils.getBaseUrl(); | ||
var url = utils.urlPathJoin(options.baseUrl, SESSION_SERVICE_URL); | ||
@@ -115,3 +115,3 @@ var ajaxSettings = utils.copy(options.ajaxSettings) || {}; | ||
function startNewSession(options) { | ||
var baseUrl = options.baseUrl || utils.DEFAULT_BASE_URL; | ||
var baseUrl = options.baseUrl || utils.getBaseUrl(); | ||
var url = utils.urlPathJoin(baseUrl, SESSION_SERVICE_URL); | ||
@@ -177,3 +177,3 @@ var model = { | ||
function createSession(sessionId, options) { | ||
var baseUrl = options.baseUrl || utils.DEFAULT_BASE_URL; | ||
var baseUrl = options.baseUrl || utils.getBaseUrl(); | ||
options.notebookPath = sessionId.notebook.path; | ||
@@ -180,0 +180,0 @@ var kernelOptions = { |
{ | ||
"name": "jupyter-js-services", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Client APIs for the Jupyter services REST APIs", | ||
@@ -8,2 +8,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"jupyter-js-utils": "^0.2.5", | ||
"phosphor-disposable": "^1.0.5", | ||
@@ -10,0 +11,0 @@ "phosphor-signaling": "^1.2.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
161447
3
4619
+ Addedjupyter-js-utils@^0.2.5
+ Addedjupyter-js-utils@0.2.17(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedrequirejs@2.3.7(transitive)