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

@jupyterlab/services

Package Overview
Dependencies
Maintainers
4
Versions
392
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jupyterlab/services - npm Package Compare versions

Comparing version 0.38.0 to 0.39.0

2

lib/config/index.d.ts

@@ -1,2 +0,2 @@

import { JSONObject, JSONValue } from 'phosphor/lib/algorithm/json';
import { JSONObject, JSONValue } from '@phosphor/coreutils';
import { IAjaxSettings } from '../utils';

@@ -3,0 +3,0 @@ /**

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var utils = require('../utils');
var utils = require("../utils");
/**

@@ -84,3 +84,3 @@ * The url for the config service.

if (success.xhr.status !== 200) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -112,3 +112,3 @@ _this._data = success.data;

if (success.xhr.status !== 200) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -115,0 +115,0 @@ _this._data = success.data;

@@ -1,4 +0,4 @@

import { JSONObject } from 'phosphor/lib/algorithm/json';
import { IDisposable } from 'phosphor/lib/core/disposable';
import { ISignal } from 'phosphor/lib/core/signaling';
import { JSONObject } from '@phosphor/coreutils';
import { IDisposable } from '@phosphor/disposable';
import { ISignal } from '@phosphor/signaling';
import { IAjaxSettings } from '../utils';

@@ -277,3 +277,3 @@ /**

*/
fileChanged: ISignal<this, Contents.IChangedArgs>;
readonly fileChanged: ISignal<this, Contents.IChangedArgs>;
/**

@@ -447,2 +447,3 @@ * Test whether the manager has been disposed.

private _ajaxSettings;
private _fileChanged;
}

@@ -449,0 +450,0 @@ /**

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var posix = require('path-posix');
var signaling_1 = require('phosphor/lib/core/signaling');
var utils = require('../utils');
var validate = require('./validate');
var posix = require("path-posix");
var signaling_1 = require("@phosphor/signaling");
var utils = require("../utils");
var validate = require("./validate");
/**

@@ -32,5 +32,16 @@ * The url for the contents service.

this._ajaxSettings = null;
this._fileChanged = new signaling_1.Signal(this);
this._baseUrl = options.baseUrl || utils.getBaseUrl();
this._ajaxSettings = utils.ajaxSettingsWithToken(options.ajaxSettings, options.token);
}
Object.defineProperty(ContentsManager.prototype, "fileChanged", {
/**
* A signal emitted when a file operation takes place.
*/
get: function () {
return this._fileChanged;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ContentsManager.prototype, "isDisposed", {

@@ -54,3 +65,3 @@ /**

this._isDisposed = true;
signaling_1.clearSignalData(this);
signaling_1.Signal.clearData(this);
};

@@ -111,3 +122,3 @@ Object.defineProperty(ContentsManager.prototype, "baseUrl", {

if (success.xhr.status !== 200) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -118,3 +129,3 @@ try {

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}

@@ -164,3 +175,3 @@ return success.data;

if (success.xhr.status !== 201) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -172,5 +183,5 @@ var data = success.data;

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}
_this.fileChanged.emit({
_this._fileChanged.emit({
type: 'new',

@@ -201,5 +212,5 @@ oldValue: null,

if (success.xhr.status !== 204) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}
_this.fileChanged.emit({
_this._fileChanged.emit({
type: 'delete',

@@ -245,3 +256,3 @@ oldValue: { path: path },

if (success.xhr.status !== 200) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -253,5 +264,5 @@ var data = success.data;

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}
_this.fileChanged.emit({
_this._fileChanged.emit({
type: 'rename',

@@ -292,3 +303,3 @@ oldValue: { path: path },

if (success.xhr.status !== 200 && success.xhr.status !== 201) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -300,5 +311,5 @@ var data = success.data;

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}
_this.fileChanged.emit({
_this._fileChanged.emit({
type: 'save',

@@ -336,3 +347,3 @@ oldValue: null,

if (success.xhr.status !== 201) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -344,5 +355,5 @@ var data = success.data;

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}
_this.fileChanged.emit({
_this._fileChanged.emit({
type: 'new',

@@ -373,3 +384,3 @@ oldValue: null,

if (success.xhr.status !== 201) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -380,3 +391,3 @@ try {

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}

@@ -405,6 +416,6 @@ return success.data;

if (success.xhr.status !== 200) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}
if (!Array.isArray(success.data)) {
return utils.makeAjaxError(success, 'Invalid Checkpoint list');
throw utils.makeAjaxError(success, 'Invalid Checkpoint list');
}

@@ -416,3 +427,3 @@ for (var i = 0; i < success.data.length; i++) {

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}

@@ -442,3 +453,3 @@ }

if (success.xhr.status !== 204) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -466,3 +477,3 @@ });

if (success.xhr.status !== 204) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -477,3 +488,3 @@ });

for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
args[_i] = arguments[_i];
}

@@ -486,8 +497,5 @@ var parts = args.map(function (path) { return utils.urlEncodeParts(path); });

exports.ContentsManager = ContentsManager;
// Define the signals for the `ContentsManager` class.
signaling_1.defineSignal(ContentsManager.prototype, 'fileChanged');
/**
* A namespace for ContentsManager statics.
*/
var ContentsManager;
(function (ContentsManager) {

@@ -563,1 +571,2 @@ /**

})(ContentsManager = exports.ContentsManager || (exports.ContentsManager = {}));
exports.ContentsManager = ContentsManager;

@@ -7,10 +7,10 @@ // Copyright (c) Jupyter Development Team.

}
__export(require('./config'));
__export(require('./contents'));
__export(require('./kernel'));
__export(require('./manager'));
__export(require('./nbformat'));
__export(require('./session'));
__export(require('./terminal'));
var utils = require('./utils');
__export(require("./config"));
__export(require("./contents"));
__export(require("./kernel"));
__export(require("./manager"));
__export(require("./nbformat"));
__export(require("./session"));
__export(require("./terminal"));
var utils = require("./utils");
exports.utils = utils;

@@ -1,3 +0,3 @@

import { JSONObject, JSONValue } from 'phosphor/lib/algorithm/json';
import { DisposableDelegate } from 'phosphor/lib/core/disposable';
import { JSONObject, JSONValue } from '@phosphor/coreutils';
import { DisposableDelegate } from '@phosphor/disposable';
import { Kernel } from './kernel';

@@ -4,0 +4,0 @@ import { KernelMessage } from './messages';

@@ -9,4 +9,4 @@ // Copyright (c) Jupyter Development Team.

};
var disposable_1 = require('phosphor/lib/core/disposable');
var messages_1 = require('./messages');
var disposable_1 = require("@phosphor/disposable");
var messages_1 = require("./messages");
/**

@@ -21,11 +21,12 @@ * Comm channel handler.

function CommHandler(target, id, kernel, disposeCb) {
_super.call(this, disposeCb);
this._target = '';
this._id = '';
this._kernel = null;
this._onClose = null;
this._onMsg = null;
this._id = id;
this._target = target;
this._kernel = kernel;
var _this = _super.call(this, disposeCb) || this;
_this._target = '';
_this._id = '';
_this._kernel = null;
_this._onClose = null;
_this._onMsg = null;
_this._id = id;
_this._target = target;
_this._kernel = kernel;
return _this;
}

@@ -32,0 +33,0 @@ Object.defineProperty(CommHandler.prototype, "commId", {

@@ -1,3 +0,3 @@

import { IDisposable } from 'phosphor/lib/core/disposable';
import { ISignal } from 'phosphor/lib/core/signaling';
import { IDisposable } from '@phosphor/disposable';
import { ISignal, Signal } from '@phosphor/signaling';
import { Kernel } from './kernel';

@@ -17,15 +17,15 @@ import { KernelMessage } from './messages';

*/
terminated: ISignal<Kernel.IKernel, void>;
readonly terminated: Signal<this, void>;
/**
* A signal emitted when the kernel status changes.
*/
statusChanged: ISignal<Kernel.IKernel, Kernel.Status>;
readonly statusChanged: ISignal<this, Kernel.Status>;
/**
* A signal emitted for iopub kernel messages.
*/
iopubMessage: ISignal<Kernel.IKernel, KernelMessage.IIOPubMessage>;
readonly iopubMessage: ISignal<this, KernelMessage.IIOPubMessage>;
/**
* A signal emitted for unhandled kernel message.
*/
unhandledMessage: ISignal<Kernel.IKernel, KernelMessage.IMessage>;
readonly unhandledMessage: ISignal<this, KernelMessage.IMessage>;
/**

@@ -358,2 +358,5 @@ * The id of the server-side kernel.

private _specPromise;
private _statusChanged;
private _iopubMessage;
private _unhandledMessage;
}

@@ -360,0 +363,0 @@ /**

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var iteration_1 = require('phosphor/lib/algorithm/iteration');
var searching_1 = require('phosphor/lib/algorithm/searching');
var vector_1 = require('phosphor/lib/collections/vector');
var disposable_1 = require('phosphor/lib/core/disposable');
var signaling_1 = require('phosphor/lib/core/signaling');
var comm_1 = require('./comm');
var messages_1 = require('./messages');
var future_1 = require('./future');
var serialize = require('./serialize');
var validate = require('./validate');
var utils = require('../utils');
var algorithm_1 = require("@phosphor/algorithm");
var disposable_1 = require("@phosphor/disposable");
var signaling_1 = require("@phosphor/signaling");
var comm_1 = require("./comm");
var messages_1 = require("./messages");
var future_1 = require("./future");
var serialize = require("./serialize");
var validate = require("./validate");
var utils = require("../utils");
/**

@@ -52,2 +50,5 @@ * The url for the kernel service.

this._specPromise = null;
this._statusChanged = new signaling_1.Signal(this);
this._iopubMessage = new signaling_1.Signal(this);
this._unhandledMessage = new signaling_1.Signal(this);
this._name = options.name;

@@ -65,4 +66,35 @@ this._id = id;

this._createSocket();
Private.runningKernels.pushBack(this);
this.terminated = new signaling_1.Signal(this);
Private.runningKernels.push(this);
}
Object.defineProperty(DefaultKernel.prototype, "statusChanged", {
/**
* A signal emitted when the kernel status changes.
*/
get: function () {
return this._statusChanged;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DefaultKernel.prototype, "iopubMessage", {
/**
* A signal emitted for iopub kernel messages.
*/
get: function () {
return this._iopubMessage;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DefaultKernel.prototype, "unhandledMessage", {
/**
* A signal emitted for unhandled kernel message.
*/
get: function () {
return this._unhandledMessage;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DefaultKernel.prototype, "id", {

@@ -252,4 +284,4 @@ /**

this._targetRegistry = null;
Private.runningKernels.remove(this);
signaling_1.clearSignalData(this);
algorithm_1.ArrayExt.removeFirstOf(Private.runningKernels, this);
signaling_1.Signal.clearData(this);
};

@@ -684,3 +716,3 @@ /**

if (msg.channel !== 'iopub' && owned) {
this.unhandledMessage.emit(msg);
this._unhandledMessage.emit(msg);
}

@@ -703,4 +735,6 @@ }

break;
default:
break;
}
this.iopubMessage.emit(msg);
this._iopubMessage.emit(msg);
}

@@ -753,3 +787,3 @@ };

Private.logKernelStatus(this);
this.statusChanged.emit(status);
this._statusChanged.emit(status);
if (status === 'dead') {

@@ -890,11 +924,5 @@ this.dispose();

exports.DefaultKernel = DefaultKernel;
// Define the signals for the `DefaultKernel` class.
signaling_1.defineSignal(DefaultKernel.prototype, 'terminated');
signaling_1.defineSignal(DefaultKernel.prototype, 'statusChanged');
signaling_1.defineSignal(DefaultKernel.prototype, 'iopubMessage');
signaling_1.defineSignal(DefaultKernel.prototype, 'unhandledMessage');
/**
* The namespace for `DefaultKernel` statics.
*/
var DefaultKernel;
(function (DefaultKernel) {

@@ -986,2 +1014,3 @@ /**

})(DefaultKernel = exports.DefaultKernel || (exports.DefaultKernel = {}));
exports.DefaultKernel = DefaultKernel;
/**

@@ -995,3 +1024,3 @@ * A private namespace for the Kernel.

*/
Private.runningKernels = new vector_1.Vector();
Private.runningKernels = [];
/**

@@ -1005,3 +1034,3 @@ * A module private store of kernel specs by base url.

function findById(id, options) {
var kernel = searching_1.find(Private.runningKernels, function (value) {
var kernel = algorithm_1.find(Private.runningKernels, function (value) {
return (value.id === id);

@@ -1043,3 +1072,3 @@ });

if (success.xhr.status !== 200) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -1050,3 +1079,3 @@ try {

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}

@@ -1076,6 +1105,6 @@ });

if (success.xhr.status !== 200) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}
if (!Array.isArray(success.data)) {
return utils.makeAjaxError(success, 'Invalid kernel list');
throw utils.makeAjaxError(success, 'Invalid kernel list');
}

@@ -1087,3 +1116,3 @@ for (var i = 0; i < success.data.length; i++) {

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}

@@ -1099,4 +1128,4 @@ }

function updateRunningKernels(kernels) {
iteration_1.each(Private.runningKernels, function (kernel) {
var updated = searching_1.find(kernels, function (model) {
algorithm_1.each(Private.runningKernels, function (kernel) {
var updated = algorithm_1.find(kernels, function (model) {
if (kernel.id === model.id) {

@@ -1130,3 +1159,3 @@ return true;

if (success.xhr.status !== 201) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -1156,3 +1185,3 @@ validate.validateModel(success.data);

function connectTo(id, options) {
var kernel = searching_1.find(Private.runningKernels, function (value) {
var kernel = algorithm_1.find(Private.runningKernels, function (value) {
return value.id === id;

@@ -1196,3 +1225,3 @@ });

if (success.xhr.status !== 200) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -1203,3 +1232,3 @@ try {

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}

@@ -1223,3 +1252,3 @@ }, onKernelError);

if (success.xhr.status !== 204) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -1240,3 +1269,3 @@ }, onKernelError);

if (success.xhr.status !== 204) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -1260,3 +1289,3 @@ killKernels(id);

function killKernels(id) {
iteration_1.each(iteration_1.toArray(Private.runningKernels), function (kernel) {
algorithm_1.each(algorithm_1.toArray(Private.runningKernels), function (kernel) {
if (kernel.id === id) {

@@ -1281,3 +1310,3 @@ kernel.terminated.emit(void 0);

if (success.xhr.status !== 200) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -1289,3 +1318,3 @@ var data = success.data;

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}

@@ -1292,0 +1321,0 @@ return data;

@@ -1,2 +0,2 @@

import { DisposableDelegate } from 'phosphor/lib/core/disposable';
import { DisposableDelegate } from '@phosphor/disposable';
import { Kernel } from './kernel';

@@ -3,0 +3,0 @@ import { KernelMessage } from './messages';

@@ -9,4 +9,4 @@ // Copyright (c) Jupyter Development Team.

};
var disposable_1 = require('phosphor/lib/core/disposable');
var messages_1 = require('./messages');
var disposable_1 = require("@phosphor/disposable");
var messages_1 = require("./messages");
/**

@@ -21,16 +21,17 @@ * Implementation of a kernel future.

function KernelFutureHandler(cb, msg, expectShell, disposeOnDone) {
_super.call(this, cb);
this._msg = null;
this._status = 0;
this._stdin = null;
this._iopub = null;
this._reply = null;
this._done = null;
this._hooks = new Private.HookList();
this._disposeOnDone = true;
this._msg = msg;
var _this = _super.call(this, cb) || this;
_this._msg = null;
_this._status = 0;
_this._stdin = null;
_this._iopub = null;
_this._reply = null;
_this._done = null;
_this._hooks = new Private.HookList();
_this._disposeOnDone = true;
_this._msg = msg;
if (!expectShell) {
this._setFlag(Private.KernelFutureFlag.GotReply);
_this._setFlag(Private.KernelFutureFlag.GotReply);
}
this._disposeOnDone = disposeOnDone;
_this._disposeOnDone = disposeOnDone;
return _this;
}

@@ -359,2 +360,3 @@ Object.defineProperty(KernelFutureHandler.prototype, "msg", {

*/
var KernelFutureFlag;
(function (KernelFutureFlag) {

@@ -365,4 +367,3 @@ KernelFutureFlag[KernelFutureFlag["GotReply"] = 1] = "GotReply";

KernelFutureFlag[KernelFutureFlag["DisposeOnDone"] = 8] = "DisposeOnDone";
})(Private.KernelFutureFlag || (Private.KernelFutureFlag = {}));
var KernelFutureFlag = Private.KernelFutureFlag;
})(KernelFutureFlag = Private.KernelFutureFlag || (Private.KernelFutureFlag = {}));
})(Private || (Private = {}));

@@ -7,4 +7,4 @@ // Copyright (c) Jupyter Development Team.

}
__export(require('./kernel'));
__export(require('./manager'));
__export(require('./messages'));
__export(require("./kernel"));
__export(require("./manager"));
__export(require("./messages"));

@@ -1,5 +0,5 @@

import { IIterator } from 'phosphor/lib/algorithm/iteration';
import { JSONObject, JSONValue } from 'phosphor/lib/algorithm/json';
import { IDisposable } from 'phosphor/lib/core/disposable';
import { ISignal } from 'phosphor/lib/core/signaling';
import { IIterator } from '@phosphor/algorithm';
import { JSONObject, JSONValue } from '@phosphor/coreutils';
import { IDisposable } from '@phosphor/disposable';
import { ISignal } from '@phosphor/signaling';
import { IAjaxSettings } from '../utils';

@@ -25,15 +25,15 @@ import { KernelMessage } from './messages';

*/
terminated: ISignal<IKernel, void>;
terminated: ISignal<this, void>;
/**
* A signal emitted when the kernel status changes.
*/
statusChanged: ISignal<IKernel, Kernel.Status>;
statusChanged: ISignal<this, Kernel.Status>;
/**
* A signal emitted for iopub kernel messages.
*/
iopubMessage: ISignal<IKernel, KernelMessage.IIOPubMessage>;
iopubMessage: ISignal<this, KernelMessage.IIOPubMessage>;
/**
* A signal emitted for unhandled kernel message.
*/
unhandledMessage: ISignal<IKernel, KernelMessage.IMessage>;
unhandledMessage: ISignal<this, KernelMessage.IMessage>;
/**

@@ -40,0 +40,0 @@ * The id of the server-side kernel.

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var default_1 = require('./default');
var default_1 = require("./default");
/**

@@ -6,0 +6,0 @@ * A namespace for kernel types, interfaces, and type checker functions.

@@ -1,3 +0,3 @@

import { IIterator } from 'phosphor/lib/algorithm/iteration';
import { ISignal } from 'phosphor/lib/core/signaling';
import { IIterator } from '@phosphor/algorithm';
import { ISignal } from '@phosphor/signaling';
import { IAjaxSettings } from '../utils';

@@ -18,7 +18,7 @@ import { Kernel } from './kernel';

*/
specsChanged: ISignal<this, Kernel.ISpecModels>;
readonly specsChanged: ISignal<this, Kernel.ISpecModels>;
/**
* A signal emitted when the running kernels change.
*/
runningChanged: ISignal<this, Kernel.IModel[]>;
readonly runningChanged: ISignal<this, Kernel.IModel[]>;
/**

@@ -144,2 +144,4 @@ * Test whether the terminal manager is disposed.

private _isReady;
private _specsChanged;
private _runningChanged;
}
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var iteration_1 = require('phosphor/lib/algorithm/iteration');
var json_1 = require('phosphor/lib/algorithm/json');
var searching_1 = require('phosphor/lib/algorithm/searching');
var signaling_1 = require('phosphor/lib/core/signaling');
var utils = require('../utils');
var kernel_1 = require('./kernel');
var algorithm_1 = require("@phosphor/algorithm");
var coreutils_1 = require("@phosphor/coreutils");
var signaling_1 = require("@phosphor/signaling");
var utils = require("../utils");
var kernel_1 = require("./kernel");
/**

@@ -20,4 +19,4 @@ * An implementation of a kernel manager.

function KernelManager(options) {
if (options === void 0) { options = {}; }
var _this = this;
if (options === void 0) { options = {}; }
this._baseUrl = '';

@@ -33,2 +32,4 @@ this._wsUrl = '';

this._isReady = false;
this._specsChanged = new signaling_1.Signal(this);
this._runningChanged = new signaling_1.Signal(this);
this._baseUrl = options.baseUrl || utils.getBaseUrl();

@@ -50,2 +51,22 @@ this._wsUrl = options.wsUrl || utils.getWsUrl(this._baseUrl);

}
Object.defineProperty(KernelManager.prototype, "specsChanged", {
/**
* A signal emitted when the specs change.
*/
get: function () {
return this._specsChanged;
},
enumerable: true,
configurable: true
});
Object.defineProperty(KernelManager.prototype, "runningChanged", {
/**
* A signal emitted when the running kernels change.
*/
get: function () {
return this._runningChanged;
},
enumerable: true,
configurable: true
});
Object.defineProperty(KernelManager.prototype, "isDisposed", {

@@ -71,3 +92,3 @@ /**

clearInterval(this._specsTimer);
signaling_1.clearSignalData(this);
signaling_1.Signal.clearData(this);
this._specs = null;

@@ -148,3 +169,3 @@ this._running = [];

KernelManager.prototype.running = function () {
return iteration_1.iter(this._running);
return algorithm_1.iter(this._running);
};

@@ -226,6 +247,6 @@ /**

KernelManager.prototype._onTerminated = function (id) {
var index = searching_1.findIndex(this._running, function (value) { return value.id === id; });
var index = algorithm_1.ArrayExt.findFirstIndex(this._running, function (value) { return value.id === id; });
if (index !== -1) {
this._running.splice(index, 1);
this.runningChanged.emit(this._running.slice());
this._runningChanged.emit(this._running.slice());
}

@@ -239,6 +260,6 @@ };

var id = kernel.id;
var index = searching_1.findIndex(this._running, function (value) { return value.id === id; });
var index = algorithm_1.ArrayExt.findFirstIndex(this._running, function (value) { return value.id === id; });
if (index === -1) {
this._running.push(kernel.model);
this.runningChanged.emit(this._running.slice());
this._runningChanged.emit(this._running.slice());
}

@@ -260,5 +281,5 @@ kernel.terminated.connect(function () {

return kernel_1.Kernel.getSpecs(options).then(function (specs) {
if (!json_1.deepEqual(specs, _this._specs)) {
if (!coreutils_1.JSONExt.deepEqual(specs, _this._specs)) {
_this._specs = specs;
_this.specsChanged.emit(specs);
_this._specsChanged.emit(specs);
}

@@ -274,5 +295,5 @@ });

_this._isReady = true;
if (!json_1.deepEqual(running, _this._running)) {
if (!coreutils_1.JSONExt.deepEqual(running, _this._running)) {
_this._running = running.slice();
_this.runningChanged.emit(running);
_this._runningChanged.emit(running);
}

@@ -295,4 +316,1 @@ });

exports.KernelManager = KernelManager;
// Define the signal for the `KernelManager` class.
signaling_1.defineSignal(KernelManager.prototype, 'specsChanged');
signaling_1.defineSignal(KernelManager.prototype, 'runningChanged');

@@ -1,2 +0,2 @@

import { JSONObject, JSONValue } from 'phosphor/lib/algorithm/json';
import { JSONObject, JSONValue } from '@phosphor/coreutils';
import { nbformat } from '../nbformat';

@@ -3,0 +3,0 @@ import { Kernel } from './kernel';

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var utils = require('../utils');
var utils = require("../utils");
/**

@@ -6,0 +6,0 @@ * A namespace for kernel messages.

@@ -1,4 +0,4 @@

import { JSONObject } from 'phosphor/lib/algorithm/json';
import { IDisposable } from 'phosphor/lib/core/disposable';
import { ISignal } from 'phosphor/lib/core/signaling';
import { JSONObject } from '@phosphor/coreutils';
import { IDisposable } from '@phosphor/disposable';
import { ISignal } from '@phosphor/signaling';
import { Contents, ContentsManager } from './contents';

@@ -20,3 +20,3 @@ import { Kernel } from './kernel';

*/
specsChanged: ISignal<this, Kernel.ISpecModels>;
readonly specsChanged: ISignal<this, Kernel.ISpecModels>;
/**

@@ -63,2 +63,3 @@ * Test whether the terminal manager is disposed.

private _readyPromise;
private _specsChanged;
}

@@ -65,0 +66,0 @@ /**

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var signaling_1 = require('phosphor/lib/core/signaling');
var contents_1 = require('./contents');
var session_1 = require('./session');
var terminal_1 = require('./terminal');
var utils_1 = require('./utils');
var signaling_1 = require("@phosphor/signaling");
var contents_1 = require("./contents");
var session_1 = require("./session");
var terminal_1 = require("./terminal");
var utils_1 = require("./utils");
/**

@@ -22,2 +22,3 @@ * A Jupyter services manager.

this._isDisposed = false;
this._specsChanged = new signaling_1.Signal(this);
options = options || {};

@@ -31,3 +32,3 @@ options.wsUrl = options.wsUrl || utils_1.getWsUrl();

this._sessionManager.specsChanged.connect(function (sender, specs) {
_this.specsChanged.emit(specs);
_this._specsChanged.emit(specs);
});

@@ -40,2 +41,12 @@ this._readyPromise = this._sessionManager.ready.then(function () {

}
Object.defineProperty(ServiceManager.prototype, "specsChanged", {
/**
* A signal emitted when the kernel specs change.
*/
get: function () {
return this._specsChanged;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceManager.prototype, "isDisposed", {

@@ -59,3 +70,3 @@ /**

this._isDisposed = true;
signaling_1.clearSignalData(this);
signaling_1.Signal.clearData(this);
this._sessionManager.dispose();

@@ -138,3 +149,1 @@ this._contentsManager.dispose();

exports.ServiceManager = ServiceManager;
// Define the signals for the `ServiceManager` class.
signaling_1.defineSignal(ServiceManager.prototype, 'specsChanged');

@@ -1,2 +0,2 @@

import { JSONObject } from 'phosphor/lib/algorithm/json';
import { JSONObject } from '@phosphor/coreutils';
/**

@@ -9,7 +9,7 @@ * A namespace for nbformat interfaces.

*/
const MAJOR_VERSION: number;
const MAJOR_VERSION = 4;
/**
* The minor version of the notebook format.
*/
const MINOR_VERSION: number;
const MINOR_VERSION = 1;
/**

@@ -16,0 +16,0 @@ * The kernelspec metadata.

@@ -7,3 +7,3 @@ // Copyright (c) Jupyter Development Team.

// https://github.com/jupyter/nbformat/blob/master/nbformat/v4/nbformat.v4.schema.json
var json_1 = require('phosphor/lib/algorithm/json');
var coreutils_1 = require("@phosphor/coreutils");
/**

@@ -61,5 +61,5 @@ * A namespace for nbformat interfaces.

// It is a JSON type, make sure it is a valid JSON object.
return json_1.isObject(value);
return coreutils_1.JSONExt.isObject(value);
}
nbformat.validateMimeValue = validateMimeValue;
})(nbformat = exports.nbformat || (exports.nbformat = {}));

@@ -1,2 +0,2 @@

import { ISignal } from 'phosphor/lib/core/signaling';
import { ISignal, Signal } from '@phosphor/signaling';
import { Kernel, KernelMessage } from '../kernel';

@@ -18,23 +18,23 @@ import { IAjaxSettings } from '../utils';

*/
terminated: ISignal<Session.ISession, void>;
readonly terminated: Signal<this, void>;
/**
* A signal emitted when the kernel changes.
*/
kernelChanged: ISignal<Session.ISession, Kernel.IKernel>;
readonly kernelChanged: ISignal<this, Kernel.IKernel>;
/**
* A signal emitted when the kernel status changes.
*/
statusChanged: ISignal<Session.ISession, Kernel.Status>;
readonly statusChanged: ISignal<this, Kernel.Status>;
/**
* A signal emitted for a kernel messages.
*/
iopubMessage: ISignal<Session.ISession, KernelMessage.IMessage>;
readonly iopubMessage: ISignal<this, KernelMessage.IMessage>;
/**
* A signal emitted for an unhandled kernel message.
*/
unhandledMessage: ISignal<Session.ISession, KernelMessage.IMessage>;
readonly unhandledMessage: ISignal<this, KernelMessage.IMessage>;
/**
* A signal emitted when the session path changes.
*/
pathChanged: ISignal<Session.ISession, string>;
readonly pathChanged: ISignal<this, string>;
/**

@@ -158,2 +158,7 @@ * Get the session id.

private _updating;
private _kernelChanged;
private _statusChanged;
private _iopubMessage;
private _unhandledMessage;
private _pathChanged;
}

@@ -160,0 +165,0 @@ /**

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var iteration_1 = require('phosphor/lib/algorithm/iteration');
var searching_1 = require('phosphor/lib/algorithm/searching');
var vector_1 = require('phosphor/lib/collections/vector');
var signaling_1 = require('phosphor/lib/core/signaling');
var kernel_1 = require('../kernel');
var utils = require('../utils');
var validate = require('./validate');
var algorithm_1 = require("@phosphor/algorithm");
var signaling_1 = require("@phosphor/signaling");
var kernel_1 = require("../kernel");
var utils = require("../utils");
var validate = require("./validate");
/**

@@ -34,2 +32,7 @@ * The url for the session service.

this._updating = false;
this._kernelChanged = new signaling_1.Signal(this);
this._statusChanged = new signaling_1.Signal(this);
this._iopubMessage = new signaling_1.Signal(this);
this._unhandledMessage = new signaling_1.Signal(this);
this._pathChanged = new signaling_1.Signal(this);
this._id = id;

@@ -41,6 +44,57 @@ this._path = options.path;

this._token = options.token || utils.getConfigOption('token');
Private.runningSessions.pushBack(this);
Private.runningSessions.push(this);
this.setupKernel(kernel);
this._options = utils.copy(options);
this.terminated = new signaling_1.Signal(this);
}
Object.defineProperty(DefaultSession.prototype, "kernelChanged", {
/**
* A signal emitted when the kernel changes.
*/
get: function () {
return this._kernelChanged;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DefaultSession.prototype, "statusChanged", {
/**
* A signal emitted when the kernel status changes.
*/
get: function () {
return this._statusChanged;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DefaultSession.prototype, "iopubMessage", {
/**
* A signal emitted for a kernel messages.
*/
get: function () {
return this._iopubMessage;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DefaultSession.prototype, "unhandledMessage", {
/**
* A signal emitted for an unhandled kernel message.
*/
get: function () {
return this._unhandledMessage;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DefaultSession.prototype, "pathChanged", {
/**
* A signal emitted when the session path changes.
*/
get: function () {
return this._pathChanged;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DefaultSession.prototype, "id", {

@@ -174,5 +228,5 @@ /**

_this.setupKernel(kernel);
_this.kernelChanged.emit(kernel);
_this._kernelChanged.emit(kernel);
if (oldPath !== newPath) {
_this.pathChanged.emit(newPath);
_this._pathChanged.emit(newPath);
}

@@ -182,3 +236,3 @@ });

else if (oldPath !== newPath) {
this.pathChanged.emit(newPath);
this._pathChanged.emit(newPath);
}

@@ -198,5 +252,5 @@ return Promise.resolve(void 0);

}
Private.runningSessions.remove(this);
algorithm_1.ArrayExt.removeFirstOf(Private.runningSessions, this);
this._kernel = null;
signaling_1.clearSignalData(this);
signaling_1.Signal.clearData(this);
};

@@ -269,3 +323,3 @@ /**

DefaultSession.prototype.onKernelStatus = function (sender, state) {
this.statusChanged.emit(state);
this._statusChanged.emit(state);
};

@@ -276,3 +330,3 @@ /**

DefaultSession.prototype.onIOPubMessage = function (sender, msg) {
this.iopubMessage.emit(msg);
this._iopubMessage.emit(msg);
};

@@ -283,3 +337,3 @@ /**

DefaultSession.prototype.onUnhandledMessage = function (sender, msg) {
this.unhandledMessage.emit(msg);
this._unhandledMessage.emit(msg);
};

@@ -313,3 +367,3 @@ /**

if (success.xhr.status !== 200) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -321,3 +375,3 @@ var value = success.data;

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}

@@ -333,13 +387,5 @@ return Private.updateFromServer(value);

exports.DefaultSession = DefaultSession;
// Define the signals for the `DefaultSession` class.
signaling_1.defineSignal(DefaultSession.prototype, 'terminated');
signaling_1.defineSignal(DefaultSession.prototype, 'kernelChanged');
signaling_1.defineSignal(DefaultSession.prototype, 'statusChanged');
signaling_1.defineSignal(DefaultSession.prototype, 'iopubMessage');
signaling_1.defineSignal(DefaultSession.prototype, 'unhandledMessage');
signaling_1.defineSignal(DefaultSession.prototype, 'pathChanged');
/**
* The namespace for `DefaultSession` statics.
*/
var DefaultSession;
(function (DefaultSession) {

@@ -390,2 +436,3 @@ /**

})(DefaultSession = exports.DefaultSession || (exports.DefaultSession = {}));
exports.DefaultSession = DefaultSession;
/**

@@ -399,3 +446,3 @@ * A namespace for session private data.

*/
Private.runningSessions = new vector_1.Vector();
Private.runningSessions = [];
/**

@@ -414,7 +461,7 @@ * List the running sessions.

if (success.xhr.status !== 200) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}
var data = success.data;
if (!Array.isArray(success.data)) {
return utils.makeAjaxError(success, 'Invalid Session list');
throw utils.makeAjaxError(success, 'Invalid Session list');
}

@@ -426,3 +473,3 @@ for (var i = 0; i < data.length; i++) {

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}

@@ -451,3 +498,3 @@ }

if (options === void 0) { options = {}; }
var session = searching_1.find(Private.runningSessions, function (value) { return value.id === id; });
var session = algorithm_1.find(Private.runningSessions, function (value) { return value.id === id; });
if (session) {

@@ -467,3 +514,3 @@ return Promise.resolve(session.model);

if (options === void 0) { options = {}; }
var session = searching_1.find(Private.runningSessions, function (value) { return value.path === path; });
var session = algorithm_1.find(Private.runningSessions, function (value) { return value.path === path; });
if (session) {

@@ -473,3 +520,3 @@ return Promise.resolve(session.model);

return listRunning(options).then(function (models) {
var model = searching_1.find(models, function (value) {
var model = algorithm_1.find(models, function (value) {
return value.notebook.path === path;

@@ -490,3 +537,3 @@ });

if (options === void 0) { options = {}; }
var session = searching_1.find(Private.runningSessions, function (value) { return value.id === id; });
var session = algorithm_1.find(Private.runningSessions, function (value) { return value.id === id; });
if (session) {

@@ -532,3 +579,3 @@ return Promise.resolve(session.clone());

if (success.xhr.status !== 201) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -539,3 +586,3 @@ try {

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}

@@ -591,3 +638,3 @@ var data = success.data;

if (success.xhr.status !== 200) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -599,3 +646,3 @@ var data = success.data;

catch (err) {
return utils.makeAjaxError(success, err.message);
throw utils.makeAjaxError(success, err.message);
}

@@ -611,4 +658,4 @@ return updateFromServer(data);

var promises = [];
iteration_1.each(Private.runningSessions, function (session) {
var updated = searching_1.find(sessions, function (sId) {
algorithm_1.each(Private.runningSessions, function (session) {
var updated = algorithm_1.find(sessions, function (sId) {
if (session.id === sId.id) {

@@ -632,3 +679,3 @@ promises.push(session.update(sId));

var promises = [];
iteration_1.each(Private.runningSessions, function (session) {
algorithm_1.each(Private.runningSessions, function (session) {
if (session.id === model.id) {

@@ -652,3 +699,3 @@ promises.push(session.update(model));

if (success.xhr.status !== 204) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -674,3 +721,3 @@ killSessions(id);

function killSessions(id) {
iteration_1.each(iteration_1.toArray(Private.runningSessions), function (session) {
algorithm_1.each(algorithm_1.toArray(Private.runningSessions), function (session) {
if (session.id === id) {

@@ -677,0 +724,0 @@ session.terminated.emit(void 0);

@@ -7,3 +7,3 @@ // Copyright (c) Jupyter Development Team.

}
__export(require('./manager'));
__export(require('./session'));
__export(require("./manager"));
__export(require("./session"));

@@ -1,3 +0,3 @@

import { IIterator } from 'phosphor/lib/algorithm/iteration';
import { ISignal } from 'phosphor/lib/core/signaling';
import { IIterator } from '@phosphor/algorithm';
import { ISignal } from '@phosphor/signaling';
import { Kernel } from '../kernel';

@@ -19,7 +19,7 @@ import { IAjaxSettings } from '../utils';

*/
specsChanged: ISignal<SessionManager, Kernel.ISpecModels>;
readonly specsChanged: ISignal<this, Kernel.ISpecModels>;
/**
* A signal emitted when the running sessions change.
*/
runningChanged: ISignal<SessionManager, Session.IModel[]>;
readonly runningChanged: ISignal<this, Session.IModel[]>;
/**

@@ -139,2 +139,4 @@ * Test whether the terminal manager is disposed.

private _readyPromise;
private _specsChanged;
private _runningChanged;
}
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var iteration_1 = require('phosphor/lib/algorithm/iteration');
var json_1 = require('phosphor/lib/algorithm/json');
var searching_1 = require('phosphor/lib/algorithm/searching');
var signaling_1 = require('phosphor/lib/core/signaling');
var kernel_1 = require('../kernel');
var utils = require('../utils');
var session_1 = require('./session');
var algorithm_1 = require("@phosphor/algorithm");
var coreutils_1 = require("@phosphor/coreutils");
var signaling_1 = require("@phosphor/signaling");
var kernel_1 = require("../kernel");
var utils = require("../utils");
var session_1 = require("./session");
/**

@@ -21,4 +20,4 @@ * An implementation of a session manager.

function SessionManager(options) {
if (options === void 0) { options = {}; }
var _this = this;
if (options === void 0) { options = {}; }
this._baseUrl = '';

@@ -32,2 +31,4 @@ this._wsUrl = '';

this._specsTimer = -1;
this._specsChanged = new signaling_1.Signal(this);
this._runningChanged = new signaling_1.Signal(this);
this._baseUrl = options.baseUrl || utils.getBaseUrl();

@@ -48,2 +49,22 @@ this._wsUrl = options.wsUrl || utils.getWsUrl(this._baseUrl);

}
Object.defineProperty(SessionManager.prototype, "specsChanged", {
/**
* A signal emitted when the kernel specs change.
*/
get: function () {
return this._specsChanged;
},
enumerable: true,
configurable: true
});
Object.defineProperty(SessionManager.prototype, "runningChanged", {
/**
* A signal emitted when the running sessions change.
*/
get: function () {
return this._runningChanged;
},
enumerable: true,
configurable: true
});
Object.defineProperty(SessionManager.prototype, "isDisposed", {

@@ -69,3 +90,3 @@ /**

clearInterval(this._specsTimer);
signaling_1.clearSignalData(this);
signaling_1.Signal.clearData(this);
this._running = [];

@@ -145,3 +166,3 @@ };

SessionManager.prototype.running = function () {
return iteration_1.iter(this._running);
return algorithm_1.iter(this._running);
};

@@ -230,6 +251,6 @@ /**

SessionManager.prototype._onTerminated = function (id) {
var index = searching_1.findIndex(this._running, function (value) { return value.id === id; });
var index = algorithm_1.ArrayExt.findFirstIndex(this._running, function (value) { return value.id === id; });
if (index !== -1) {
this._running.splice(index, 1);
this.runningChanged.emit(this._running.slice());
this._runningChanged.emit(this._running.slice());
}

@@ -243,6 +264,6 @@ };

var id = session.id;
var index = searching_1.findIndex(this._running, function (value) { return value.id === id; });
var index = algorithm_1.ArrayExt.findFirstIndex(this._running, function (value) { return value.id === id; });
if (index === -1) {
this._running.push(session.model);
this.runningChanged.emit(this._running.slice());
this._runningChanged.emit(this._running.slice());
}

@@ -263,6 +284,6 @@ session.terminated.connect(function () {

SessionManager.prototype._onChanged = function (model) {
var index = searching_1.findIndex(this._running, function (value) { return value.id === model.id; });
var index = algorithm_1.ArrayExt.findFirstIndex(this._running, function (value) { return value.id === model.id; });
if (index !== -1) {
this._running[index] = model;
this.runningChanged.emit(this._running.slice());
this._runningChanged.emit(this._running.slice());
}

@@ -280,5 +301,5 @@ };

return kernel_1.Kernel.getSpecs(options).then(function (specs) {
if (!json_1.deepEqual(specs, _this._specs)) {
if (!coreutils_1.JSONExt.deepEqual(specs, _this._specs)) {
_this._specs = specs;
_this.specsChanged.emit(specs);
_this._specsChanged.emit(specs);
}

@@ -293,5 +314,5 @@ });

return session_1.Session.listRunning(this._getOptions({})).then(function (running) {
if (!json_1.deepEqual(running, _this._running)) {
if (!coreutils_1.JSONExt.deepEqual(running, _this._running)) {
_this._running = running.slice();
_this.runningChanged.emit(running);
_this._runningChanged.emit(running);
}

@@ -303,4 +324,1 @@ });

exports.SessionManager = SessionManager;
// Define the signals for the `SessionManager` class.
signaling_1.defineSignal(SessionManager.prototype, 'specsChanged');
signaling_1.defineSignal(SessionManager.prototype, 'runningChanged');

@@ -1,5 +0,5 @@

import { IIterator } from 'phosphor/lib/algorithm/iteration';
import { JSONObject } from 'phosphor/lib/algorithm/json';
import { IDisposable } from 'phosphor/lib/core/disposable';
import { ISignal } from 'phosphor/lib/core/signaling';
import { IIterator } from '@phosphor/algorithm';
import { JSONObject } from '@phosphor/coreutils';
import { IDisposable } from '@phosphor/disposable';
import { ISignal } from '@phosphor/signaling';
import { Kernel, KernelMessage } from '../kernel';

@@ -6,0 +6,0 @@ import { IAjaxSettings } from '../utils';

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var default_1 = require('./default');
var default_1 = require("./default");
/**

@@ -6,0 +6,0 @@ * A namespace for session interfaces and factory functions.

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var validate_1 = require('../kernel/validate');
var validate_1 = require("../kernel/validate");
/**

@@ -6,0 +6,0 @@ * Validate a property as being on an object, and optionally

@@ -1,2 +0,2 @@

import { ISignal } from 'phosphor/lib/core/signaling';
import { ISignal, Signal } from '@phosphor/signaling';
import { IAjaxSettings } from '../utils';

@@ -15,7 +15,7 @@ import { TerminalSession } from './terminal';

*/
terminated: ISignal<this, void>;
readonly terminated: Signal<this, void>;
/**
* A signal emitted when a message is received from the server.
*/
messageReceived: ISignal<this, TerminalSession.IMessage>;
readonly messageReceived: ISignal<this, TerminalSession.IMessage>;
/**

@@ -84,2 +84,3 @@ * Get the name of the terminal session.

private _isReady;
private _messageReceived;
}

@@ -110,3 +111,3 @@ /**

*/
function listRunning(options?: TerminalSession.IOptions): Promise<TerminalSession.ISession[]>;
function listRunning(options?: TerminalSession.IOptions): Promise<TerminalSession.IModel[]>;
/**

@@ -113,0 +114,0 @@ * Shut down a terminal session by name.

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var iteration_1 = require('phosphor/lib/algorithm/iteration');
var signaling_1 = require('phosphor/lib/core/signaling');
var utils = require('../utils');
var terminal_1 = require('./terminal');
var algorithm_1 = require("@phosphor/algorithm");
var signaling_1 = require("@phosphor/signaling");
var utils = require("../utils");
var terminal_1 = require("./terminal");
/**

@@ -26,2 +26,3 @@ * The url for the terminal service.

this._isReady = false;
this._messageReceived = new signaling_1.Signal(this);
this._name = name;

@@ -33,3 +34,14 @@ this._baseUrl = options.baseUrl || utils.getBaseUrl();

this._readyPromise = this._initializeSocket();
this.terminated = new signaling_1.Signal(this);
}
Object.defineProperty(DefaultTerminalSession.prototype, "messageReceived", {
/**
* A signal emitted when a message is received from the server.
*/
get: function () {
return this._messageReceived;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DefaultTerminalSession.prototype, "name", {

@@ -125,3 +137,3 @@ /**

this._readyPromise = null;
signaling_1.clearSignalData(this);
signaling_1.Signal.clearData(this);
};

@@ -182,3 +194,3 @@ /**

var data = JSON.parse(event.data);
_this.messageReceived.emit({
_this._messageReceived.emit({
type: data[0],

@@ -204,3 +216,2 @@ content: data.slice(1)

*/
var DefaultTerminalSession;
(function (DefaultTerminalSession) {

@@ -225,3 +236,3 @@ /**

if (!terminal_1.TerminalSession.isAvailable()) {
return Private.unavailable();
throw Private.unavailableMsg;
}

@@ -235,3 +246,3 @@ var baseUrl = options.baseUrl || utils.getBaseUrl();

if (success.xhr.status !== 200) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -267,3 +278,3 @@ var name = success.data.name;

if (!terminal_1.TerminalSession.isAvailable()) {
return Private.unavailable();
return Promise.reject(Private.unavailableMsg);
}

@@ -289,3 +300,3 @@ var baseUrl = options.baseUrl || utils.getBaseUrl();

if (!terminal_1.TerminalSession.isAvailable()) {
return Private.unavailable();
return Promise.reject(Private.unavailableMsg);
}

@@ -298,13 +309,13 @@ var url = Private.getBaseUrl(options.baseUrl);

if (success.xhr.status !== 200) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}
var data = success.data;
if (!Array.isArray(data)) {
return utils.makeAjaxError(success, 'Invalid terminal data');
throw utils.makeAjaxError(success, 'Invalid terminal data');
}
// Update the local data store.
var urls = iteration_1.toArray(iteration_1.map(data, function (item) {
var urls = algorithm_1.toArray(algorithm_1.map(data, function (item) {
return utils.urlPathJoin(url, item.name);
}));
iteration_1.each(Object.keys(Private.running), function (runningUrl) {
algorithm_1.each(Object.keys(Private.running), function (runningUrl) {
if (urls.indexOf(runningUrl) === -1) {

@@ -332,3 +343,3 @@ var session = Private.running[runningUrl];

if (!terminal_1.TerminalSession.isAvailable()) {
return Private.unavailable();
return Promise.reject(Private.unavailableMsg);
}

@@ -340,3 +351,3 @@ var url = Private.getTermUrl(options.baseUrl, name);

if (success.xhr.status !== 204) {
return utils.makeAjaxError(success);
throw utils.makeAjaxError(success);
}

@@ -356,5 +367,3 @@ Private.killTerminal(url);

})(DefaultTerminalSession = exports.DefaultTerminalSession || (exports.DefaultTerminalSession = {}));
// Define the signals for the `DefaultTerminalSession` class.
signaling_1.defineSignal(DefaultTerminalSession.prototype, 'terminated');
signaling_1.defineSignal(DefaultTerminalSession.prototype, 'messageReceived');
exports.DefaultTerminalSession = DefaultTerminalSession;
/**

@@ -372,6 +381,3 @@ * A namespace for private data.

*/
function unavailable() {
return Promise.reject('Terminals Unavailable');
}
Private.unavailable = unavailable;
Private.unavailableMsg = 'Terminals Unavailable';
/**

@@ -378,0 +384,0 @@ * Get the url for a terminal.

@@ -7,3 +7,3 @@ // Copyright (c) Jupyter Development Team.

}
__export(require('./manager'));
__export(require('./terminal'));
__export(require("./manager"));
__export(require("./terminal"));

@@ -1,3 +0,3 @@

import { IIterator } from 'phosphor/lib/algorithm/iteration';
import { ISignal } from 'phosphor/lib/core/signaling';
import { IIterator } from '@phosphor/algorithm';
import { ISignal } from '@phosphor/signaling';
import { IAjaxSettings } from '../utils';

@@ -17,3 +17,3 @@ import * as utils from '../utils';

*/
runningChanged: ISignal<this, TerminalSession.IModel[]>;
readonly runningChanged: ISignal<this, TerminalSession.IModel[]>;
/**

@@ -113,2 +113,3 @@ * Test whether the terminal manager is disposed.

private _readyPromise;
private _runningChanged;
}

@@ -115,0 +116,0 @@ /**

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var iteration_1 = require('phosphor/lib/algorithm/iteration');
var json_1 = require('phosphor/lib/algorithm/json');
var searching_1 = require('phosphor/lib/algorithm/searching');
var signaling_1 = require('phosphor/lib/core/signaling');
var utils = require('../utils');
var terminal_1 = require('./terminal');
var algorithm_1 = require("@phosphor/algorithm");
var coreutils_1 = require("@phosphor/coreutils");
var signaling_1 = require("@phosphor/signaling");
var utils = require("../utils");
var terminal_1 = require("./terminal");
/**

@@ -18,4 +17,4 @@ * A terminal session manager.

function TerminalManager(options) {
if (options === void 0) { options = {}; }
var _this = this;
if (options === void 0) { options = {}; }
this._baseUrl = '';

@@ -28,2 +27,3 @@ this._wsUrl = '';

this._refreshTimer = -1;
this._runningChanged = new signaling_1.Signal(this);
this._baseUrl = options.baseUrl || utils.getBaseUrl();

@@ -42,2 +42,12 @@ this._wsUrl = options.wsUrl || utils.getWsUrl(this._baseUrl);

}
Object.defineProperty(TerminalManager.prototype, "runningChanged", {
/**
* A signal emitted when the running terminals change.
*/
get: function () {
return this._runningChanged;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TerminalManager.prototype, "isDisposed", {

@@ -108,3 +118,3 @@ /**

clearInterval(this._refreshTimer);
signaling_1.clearSignalData(this);
signaling_1.Signal.clearData(this);
this._running = [];

@@ -134,3 +144,3 @@ };

TerminalManager.prototype.running = function () {
return iteration_1.iter(this._running);
return algorithm_1.iter(this._running);
};

@@ -204,6 +214,6 @@ /**

TerminalManager.prototype._onTerminated = function (name) {
var index = searching_1.findIndex(this._running, function (value) { return value.name === name; });
var index = algorithm_1.ArrayExt.findFirstIndex(this._running, function (value) { return value.name === name; });
if (index !== -1) {
this._running.splice(index, 1);
this.runningChanged.emit(this._running.slice());
this._runningChanged.emit(this._running.slice());
}

@@ -217,6 +227,6 @@ };

var name = session.name;
var index = searching_1.findIndex(this._running, function (value) { return value.name === name; });
var index = algorithm_1.ArrayExt.findFirstIndex(this._running, function (value) { return value.name === name; });
if (index === -1) {
this._running.push(session.model);
this.runningChanged.emit(this._running.slice());
this._runningChanged.emit(this._running.slice());
}

@@ -234,5 +244,5 @@ session.terminated.connect(function () {

_this._isReady = true;
if (!json_1.deepEqual(running, _this._running)) {
if (!coreutils_1.JSONExt.deepEqual(running, _this._running)) {
_this._running = running.slice();
_this.runningChanged.emit(running);
_this._runningChanged.emit(running);
}

@@ -254,3 +264,1 @@ });

exports.TerminalManager = TerminalManager;
// Define the signals for the `TerminalManager` class.
signaling_1.defineSignal(TerminalManager.prototype, 'runningChanged');

@@ -1,5 +0,5 @@

import { IIterator } from 'phosphor/lib/algorithm/iteration';
import { JSONPrimitive, JSONObject } from 'phosphor/lib/algorithm/json';
import { IDisposable } from 'phosphor/lib/core/disposable';
import { ISignal } from 'phosphor/lib/core/signaling';
import { IIterator } from '@phosphor/algorithm';
import { JSONPrimitive, JSONObject } from '@phosphor/coreutils';
import { IDisposable } from '@phosphor/disposable';
import { ISignal } from '@phosphor/signaling';
import { IAjaxSettings } from '../utils';

@@ -6,0 +6,0 @@ import * as utils from '../utils';

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var default_1 = require('./default');
var default_1 = require("./default");
/**

@@ -6,0 +6,0 @@ * The namespace for ISession statics.

@@ -1,2 +0,2 @@

import { JSONObject } from 'phosphor/lib/algorithm/json';
import { JSONObject } from '@phosphor/coreutils';
/**

@@ -194,3 +194,3 @@ * Copy the contents of one object to another, recursively.

*/
export declare function makeAjaxError(success: IAjaxSuccess, throwError?: string): Promise<any>;
export declare function makeAjaxError(success: IAjaxSuccess, throwError?: string): IAjaxError;
/**

@@ -197,0 +197,0 @@ * Try to load an object from a module or a registry.

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
'use strict';
var minimist = require('minimist');
var url = require('url');
var urljoin = require('url-join');
var minimist = require("minimist");
var url = require("url");
var urljoin = require("url-join");
/**

@@ -83,3 +83,3 @@ * Copy the contents of one object to another, recursively.

for (var _i = 0; _i < arguments.length; _i++) {
parts[_i - 0] = arguments[_i];
parts[_i] = arguments[_i];
}

@@ -209,3 +209,3 @@ return urljoin.apply(void 0, parts);

throwError = throwError || "Invalid Status: " + xhr.status;
return Promise.reject({ xhr: xhr, ajaxSettings: ajaxSettings, event: event, throwError: throwError });
return { xhr: xhr, ajaxSettings: ajaxSettings, event: event, throwError: throwError };
}

@@ -212,0 +212,0 @@ exports.makeAjaxError = makeAjaxError;

{
"name": "@jupyterlab/services",
"version": "0.38.0",
"version": "0.39.0",
"description": "Client APIs for the Jupyter services REST APIs",

@@ -8,6 +8,10 @@ "main": "lib/index.js",

"dependencies": {
"@types/minimist": "^1.1.29",
"@phosphor/algorithm": "^0.1.0",
"@phosphor/coreutils": "^0.1.1",
"@phosphor/disposable": "^0.1.0",
"@phosphor/signaling": "^0.1.1",
"@types/minimist": "^1.2.0",
"@types/text-encoding": "0.0.30",
"minimist": "^1.2.0",
"path-posix": "^1.0.0",
"phosphor": "^0.7.0",
"url": "^0.11.0",

@@ -18,6 +22,4 @@ "url-join": "^1.1.0"

"@types/expect.js": "^0.3.29",
"@types/mocha": "^2.2.32",
"@types/requirejs": "^2.1.28",
"@types/text-encoding": "0.0.30",
"@types/ws": "0.0.33",
"@types/mocha": "^2.2.39",
"@types/ws": "0.0.38",
"expect.js": "^0.3.1",

@@ -29,3 +31,3 @@ "istanbul": "^0.3.18",

"typedoc": "^0.5.0",
"typescript": "~2.0.7",
"typescript": "~2.1.6",
"webpack": "^1.13.1",

@@ -43,3 +45,3 @@ "ws": "^1.0.1",

"build:examples": "npm run example:browser && npm run example:node",
"docs": "typedoc --mode file --module commonjs --excludeNotExported --target es5 --moduleResolution node --out docs/ src",
"docs": "typedoc --options typedoc.json src",
"prepublish": "npm run build && webpack",

@@ -46,0 +48,0 @@ "test:coverage": "istanbul cover --dir test/coverage _mocha -- --retries 3 test/build/**/*.spec.js --foo bar --terminalsAvailable True",

Sorry, the diff of this file is too big to display

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