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

@jupyterlab/coreutils

Package Overview
Dependencies
Maintainers
6
Versions
355
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jupyterlab/coreutils - npm Package Compare versions

Comparing version 0.8.1 to 0.9.0

4

lib/activitymonitor.js

@@ -16,4 +16,2 @@ "use strict";

this._timeout = -1;
this._sender = null;
this._args = null;
this._isDisposed = false;

@@ -83,4 +81,2 @@ this._activityStopped = new signaling_1.Signal(this);

});
_this._sender = null;
_this._args = null;
}, this._timeout);

@@ -87,0 +83,0 @@ };

6

lib/markdowncodeblocks.js

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

var lastIndex = line.lastIndexOf(MarkdownCodeBlocks.CODE_BLOCK_MARKER);
var isSingleLine = firstIndex != lastIndex;
var isSingleLine = firstIndex !== lastIndex;
if (isSingleLine) {

@@ -82,3 +82,3 @@ currentBlock.code = line.substring(firstIndex + MarkdownCodeBlocks.CODE_BLOCK_MARKER.length, lastIndex);

}
else {
else if (currentBlock) {
if (lineContainsMarker) {

@@ -92,3 +92,3 @@ // End of block, finish it up.

// Append the current line.
currentBlock.code += line + "\n";
currentBlock.code += line + '\n';
}

@@ -95,0 +95,0 @@ }

@@ -36,5 +36,5 @@ import { IDisposable } from '@phosphor/disposable';

/**
* Get the current value.
* Get the current value, or `undefined` if it has not been set.
*/
get(): JSONValue;
get(): JSONValue | undefined;
/**

@@ -75,3 +75,3 @@ * Set the value.

*/
readonly shortName?: string;
readonly shortName: string;
}

@@ -129,3 +129,3 @@ /**

*/
get(path: string): IObservable;
get(path: string): IObservable | undefined;
/**

@@ -180,8 +180,8 @@ * Whether the `IModelDB` has an object at this path.

/**
* Get a value at a path. That value must already have
* been created using `createValue`.
* Get a value at a path, or `undefined if it has not been set
* That value must already have been created using `createValue`.
*
* @param path: the path for the value.
*/
getValue(path: string): JSONValue;
getValue(path: string): JSONValue | undefined;
/**

@@ -233,3 +233,3 @@ * Set a value at a path. That value must already have

/**
* Get the current value.
* Get the current value, or `undefined` if it has not been set.
*/

@@ -260,7 +260,7 @@ get(): JSONValue;

*/
oldValue: JSONValue;
oldValue: JSONValue | undefined;
/**
* The new value.
*/
newValue: JSONValue;
newValue: JSONValue | undefined;
}

@@ -308,3 +308,3 @@ }

*/
get(path: string): IObservable;
get(path: string): IObservable | undefined;
/**

@@ -359,8 +359,8 @@ * Whether the `IModelDB` has an object at this path.

/**
* Get a value at a path. That value must already have
* been created using `createValue`.
* Get a value at a path, or `undefined if it has not been set
* That value must already have been created using `createValue`.
*
* @param path: the path for the value.
*/
getValue(path: string): JSONValue;
getValue(path: string): JSONValue | undefined;
/**

@@ -405,2 +405,3 @@ * Set a value at a path. That value must already have

private _toDispose;
private _isDisposed;
private _disposables;

@@ -407,0 +408,0 @@ }

@@ -21,2 +21,3 @@ "use strict";

function ObservableValue(initialValue) {
if (initialValue === void 0) { initialValue = null; }
this._value = null;

@@ -58,3 +59,3 @@ this._changed = new signaling_1.Signal(this);

/**
* Get the current value.
* Get the current value, or `undefined` if it has not been set.
*/

@@ -128,4 +129,4 @@ ObservableValue.prototype.get = function () {

this.connected = Promise.resolve(void 0);
this._db = null;
this._toDispose = false;
this._isDisposed = false;
this._disposables = new disposable_1.DisposableSet();

@@ -158,3 +159,3 @@ this._basePath = options.basePath || '';

get: function () {
return this._db === null;
return this._isDisposed;
},

@@ -245,4 +246,4 @@ enumerable: true,

/**
* Get a value at a path. That value must already have
* been created using `createValue`.
* Get a value at a path, or `undefined if it has not been set
* That value must already have been created using `createValue`.
*

@@ -253,3 +254,3 @@ * @param path: the path for the value.

var val = this.get(path);
if (val.type !== 'Value') {
if (!val || val.type !== 'Value') {
throw Error('Can only call getValue for an ObservableValue');

@@ -269,3 +270,3 @@ }

var val = this.get(path);
if (val.type !== 'Value') {
if (!val || val.type !== 'Value') {
throw Error('Can only call setValue on an ObservableValue');

@@ -307,6 +308,5 @@ }

}
var db = this._db;
this._db = null;
this._isDisposed = true;
if (this._toDispose) {
db.dispose();
this._db.dispose();
}

@@ -313,0 +313,0 @@ this._disposables.dispose();

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

var value = this.get(key);
if (!value) {
continue;
}
if (coreutils_1.JSONExt.isPrimitive(value)) {

@@ -43,0 +46,0 @@ out[key] = value;

@@ -55,3 +55,3 @@ import { IIterator, IterableOrArrayLike } from '@phosphor/algorithm';

*/
get(index: number): T;
get(index: number): T | undefined;
/**

@@ -160,3 +160,3 @@ * Insert a value into the list at a specific index.

*/
remove(index: number): T;
remove(index: number): T | undefined;
/**

@@ -304,3 +304,3 @@ * Remove a range of items from the list.

*/
get(index: number): T;
get(index: number): T | undefined;
/**

@@ -389,3 +389,3 @@ * Set the value at the specified index.

*/
remove(index: number): T;
remove(index: number): T | undefined;
/**

@@ -392,0 +392,0 @@ * Remove all values from the list.

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

if (value === undefined) {
value = null;
throw new Error('Cannot set an undefined item');
}

@@ -233,2 +233,5 @@ // Bail if the value does not change.

var value = algorithm_1.ArrayExt.removeAt(this._array, index);
if (value === undefined) {
return;
}
this._changed.emit({

@@ -235,0 +238,0 @@ type: 'remove',

@@ -30,3 +30,3 @@ import { IDisposable } from '@phosphor/disposable';

*/
set(key: string, value: T): T;
set(key: string, value: T): T | undefined;
/**

@@ -39,3 +39,3 @@ * Get a value for a given key.

*/
get(key: string): T;
get(key: string): T | undefined;
/**

@@ -69,3 +69,3 @@ * Check whether the map has a key.

*/
delete(key: string): T;
delete(key: string): T | undefined;
/**

@@ -103,7 +103,7 @@ * Set the ObservableMap to an empty map.

*/
oldValue: T;
oldValue: T | undefined;
/**
* The new value of the change.
*/
newValue: T;
newValue: T | undefined;
}

@@ -150,3 +150,3 @@ }

*/
set(key: string, value: T): T;
set(key: string, value: T): T | undefined;
/**

@@ -159,3 +159,3 @@ * Get a value for a given key.

*/
get(key: string): T;
get(key: string): T | undefined;
/**

@@ -189,3 +189,3 @@ * Check whether the map has a key.

*/
delete(key: string): T;
delete(key: string): T | undefined;
/**

@@ -202,2 +202,3 @@ * Set the ObservableMap to an empty map.

private _changed;
private _isDisposed;
}

@@ -204,0 +205,0 @@ /**

@@ -17,2 +17,3 @@ "use strict";

this._changed = new signaling_1.Signal(this);
this._isDisposed = false;
this._itemCmp = options.itemCmp || Private.itemCmp;

@@ -50,3 +51,3 @@ if (options.values) {

get: function () {
return this._map === null;
return this._isDisposed;
},

@@ -89,3 +90,3 @@ enumerable: true,

if (oldVal !== undefined && itemCmp(oldVal, value)) {
return;
return oldVal;
}

@@ -178,8 +179,8 @@ this._map.set(key, value);

ObservableMap.prototype.dispose = function () {
if (this._map === null) {
if (this.isDisposed) {
return;
}
this._isDisposed = true;
signaling_1.Signal.clearData(this);
this._map.clear();
this._map = null;
};

@@ -186,0 +187,0 @@ return ObservableMap;

@@ -51,2 +51,6 @@ import { JSONObject, JSONValue, Token } from '@phosphor/coreutils';

/**
* The path in the data where the error occurred.
*/
dataPath: string;
/**
* The keyword whose validation failed.

@@ -302,14 +306,2 @@ */

/**
* Preload the schema for a plugin.
*
* @param plugin - The plugin ID.
*
* @param schema - The schema being added.
*
* #### Notes
* This method is deprecated and is only intented for use until there is a
* server-side API for storing setting data.
*/
preload(plugin: string, schema: ISettingRegistry.ISchema): void;
/**
* Reload a plugin's settings into the registry even if they already exist.

@@ -368,3 +360,2 @@ *

private _plugins;
private _preload;
private _validator;

@@ -475,10 +466,2 @@ }

/**
* A function that preloads a plugin's schema in the client-side cache.
*
* #### Notes
* This param is deprecated and is only intented for use until there is a
* server-side API for storing setting data.
*/
preload?: (plugin: string, schema: ISettingRegistry.ISchema) => void;
/**
* The validator used to enforce the settings JSON schema.

@@ -485,0 +468,0 @@ */

@@ -117,6 +117,4 @@ "use strict";

this._plugins = Object.create(null);
this._validator = null;
this._connector = options.connector;
this._validator = options.validator || new DefaultSchemaValidator();
this._preload = options.preload || (function () { });
}

@@ -187,16 +185,2 @@ Object.defineProperty(SettingRegistry.prototype, "pluginChanged", {

/**
* Preload the schema for a plugin.
*
* @param plugin - The plugin ID.
*
* @param schema - The schema being added.
*
* #### Notes
* This method is deprecated and is only intented for use until there is a
* server-side API for storing setting data.
*/
SettingRegistry.prototype.preload = function (plugin, schema) {
this._preload(plugin, schema);
};
/**
* Reload a plugin's settings into the registry even if they already exist.

@@ -215,7 +199,18 @@ *

return connector.fetch(plugin).then(function (data) {
if (!data) {
var message = "Setting data for " + plugin + " does not exist.";
throw [{ keyword: '', message: message, schemaPath: '' }];
// Validate the response from the connector; populate `composite` field.
try {
_this._validate(data);
}
_this._validate(data);
catch (errors) {
var output_1 = ["Validating " + plugin + " failed:"];
errors.forEach(function (error, index) {
var dataPath = error.dataPath, schemaPath = error.schemaPath, keyword = error.keyword, message = error.message;
output_1.push(index + " - schema @ " + schemaPath + ", data @ " + dataPath);
output_1.push("\t" + keyword + " " + message);
});
console.error(output_1.join('\n'));
throw new Error("Failed validating " + plugin);
}
// Emit that a plugin has changed.
_this._pluginChanged.emit(plugin);
return new Settings({

@@ -405,5 +400,2 @@ plugin: copy(plugins[plugin]),

this._isDisposed = true;
this._composite = null;
this._schema = null;
this._user = null;
signaling_1.Signal.clearData(this);

@@ -410,0 +402,0 @@ };

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

import { JSONObject, Token } from '@phosphor/coreutils';
import { ReadonlyJSONObject, Token } from '@phosphor/coreutils';
import { IDataConnector } from '.';

@@ -18,3 +18,3 @@ /**

*/
value: JSONObject;
value: ReadonlyJSONObject;
}

@@ -24,3 +24,3 @@ /**

*/
export interface IStateDB extends IDataConnector<JSONObject> {
export interface IStateDB extends IDataConnector<ReadonlyJSONObject> {
/**

@@ -101,3 +101,3 @@ * The maximum allowed length of the data after it has been serialized.

*/
fetch(id: string): Promise<JSONObject | null>;
fetch(id: string): Promise<ReadonlyJSONObject | undefined>;
/**

@@ -144,3 +144,3 @@ * Retrieve all the saved bundles for a namespace.

*/
save(id: string, value: JSONObject): Promise<void>;
save(id: string, value: ReadonlyJSONObject): Promise<void>;
}

@@ -147,0 +147,0 @@ /**

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

var key = window.localStorage.key(--i);
if (key.indexOf(prefix) === 0) {
if (key && key.indexOf(prefix) === 0) {
window.localStorage.removeItem(key);

@@ -61,4 +61,8 @@ }

var key = this.namespace + ":" + id;
var value = window.localStorage.getItem(key);
if (!value) {
return Promise.resolve(undefined);
}
try {
return Promise.resolve(JSON.parse(window.localStorage.getItem(key)));
return Promise.resolve(JSON.parse(value));
}

@@ -92,7 +96,8 @@ catch (error) {

var key = window.localStorage.key(--i);
if (key.indexOf(prefix) === 0) {
if (key && key.indexOf(prefix) === 0) {
var value = window.localStorage.getItem(key);
try {
items.push({
id: key.replace(regex, ''),
value: JSON.parse(window.localStorage.getItem(key))
value: value ? JSON.parse(value) : undefined
});

@@ -99,0 +104,0 @@ }

@@ -70,6 +70,2 @@ import { JSONValue } from '@phosphor/coreutils';

/**
* Dispose of the resources held by the model.
*/
dispose(): void;
/**
* Begin a compound operation.

@@ -76,0 +72,0 @@ *

@@ -32,3 +32,2 @@ "use strict";

_this._stack = [];
_this._serializer = null;
_this._serializer = serializer;

@@ -59,10 +58,2 @@ _this.changed.connect(_this._onListChanged, _this);

/**
* Dispose of the resources held by the model.
*/
ObservableUndoableList.prototype.dispose = function () {
this._serializer = null;
this._stack = null;
_super.prototype.dispose.call(this);
};
/**
* Begin a compound operation.

@@ -69,0 +60,0 @@ *

{
"name": "@jupyterlab/coreutils",
"version": "0.8.1",
"version": "0.9.0",
"description": "JupyterLab - Core Utilities",

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

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