Socket
Socket
Sign inDemoInstall

@jupyterlab/services

Package Overview
Dependencies
Maintainers
3
Versions
387
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.25.0 to 0.26.0

40

lib/contents/index.d.ts
import { JSONObject } from 'phosphor/lib/algorithm/json';
import { IDisposable } from 'phosphor/lib/core/disposable';
import { ISignal } from 'phosphor/lib/core/signaling';
import { IAjaxSettings } from '../utils';

@@ -121,6 +123,27 @@ /**

/**
* The change args for a file change.
*/
interface IChangedArgs {
/**
* The type of change.
*/
type: 'new' | 'delete' | 'rename' | 'save';
/**
* The new contents.
*/
oldValue: IModel | null;
/**
* The old contents.
*/
newValue: IModel | null;
}
/**
* The interface for a contents manager.
*/
interface IManager {
interface IManager extends IDisposable {
/**
* A signal emitted when a file operation takes place.
*/
fileChanged: ISignal<IManager, IChangedArgs>;
/**
* Get a file or directory.

@@ -248,2 +271,14 @@ *

/**
* A signal emitted when a file operation takes place.
*/
fileChanged: ISignal<this, Contents.IChangedArgs>;
/**
* Test whether the manager has been disposed.
*/
readonly isDisposed: boolean;
/**
* Dispose of the resources held by the manager.
*/
dispose(): void;
/**
* Get a copy of the default ajax settings for the contents manager.

@@ -320,3 +355,3 @@ */

*
* @param options - Optional overrrides to the model.
* @param options - Optional overrides to the model.
*

@@ -403,2 +438,3 @@ * @returns A promise which resolves with the file content model when the

private _baseUrl;
private _isDisposed;
private _ajaxSettings;

@@ -405,0 +441,0 @@ }

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

var posix = require('path-posix');
var signaling_1 = require('phosphor/lib/core/signaling');
var utils = require('../utils');

@@ -30,2 +31,3 @@ var validate = require('./validate');

this._baseUrl = '';
this._isDisposed = false;
this._ajaxSettings = null;

@@ -36,2 +38,22 @@ this._baseUrl = options.baseUrl || utils.getBaseUrl();

}
Object.defineProperty(ContentsManager.prototype, "isDisposed", {
/**
* Test whether the manager has been disposed.
*/
get: function () {
return this._isDisposed;
},
enumerable: true,
configurable: true
});
/**
* Dispose of the resources held by the manager.
*/
ContentsManager.prototype.dispose = function () {
if (this.isDisposed) {
return;
}
this._isDisposed = true;
signaling_1.clearSignalData(this);
};
Object.defineProperty(ContentsManager.prototype, "ajaxSettings", {

@@ -117,2 +139,3 @@ /**

ContentsManager.prototype.newUntitled = function (options) {
var _this = this;
if (options === void 0) { options = {}; }

@@ -134,4 +157,5 @@ var ajaxSettings = this.ajaxSettings;

}
var data = success.data;
try {
validate.validateContentsModel(success.data);
validate.validateContentsModel(data);
}

@@ -141,3 +165,8 @@ catch (err) {

}
return success.data;
_this.fileChanged.emit({
type: 'new',
oldValue: null,
newValue: data
});
return data;
});

@@ -156,2 +185,3 @@ };

ContentsManager.prototype.delete = function (path) {
var _this = this;
var ajaxSettings = this.ajaxSettings;

@@ -165,2 +195,7 @@ ajaxSettings.method = 'DELETE';

}
_this.fileChanged.emit({
type: 'delete',
oldValue: { path: path },
newValue: null
});
}, function (error) {

@@ -193,2 +228,3 @@ // Translate certain errors to more specific ones.

ContentsManager.prototype.rename = function (path, newPath) {
var _this = this;
var ajaxSettings = this.ajaxSettings;

@@ -204,4 +240,5 @@ ajaxSettings.method = 'PATCH';

}
var data = success.data;
try {
validate.validateContentsModel(success.data);
validate.validateContentsModel(data);
}

@@ -211,3 +248,8 @@ catch (err) {

}
return success.data;
_this.fileChanged.emit({
type: 'rename',
oldValue: { path: path },
newValue: data
});
return data;
});

@@ -220,3 +262,3 @@ };

*
* @param options - Optional overrrides to the model.
* @param options - Optional overrides to the model.
*

@@ -232,2 +274,3 @@ * @returns A promise which resolves with the file content model when the

ContentsManager.prototype.save = function (path, options) {
var _this = this;
if (options === void 0) { options = {}; }

@@ -246,4 +289,5 @@ var ajaxSettings = this.ajaxSettings;

}
var data = success.data;
try {
validate.validateContentsModel(success.data);
validate.validateContentsModel(data);
}

@@ -253,3 +297,8 @@ catch (err) {

}
return success.data;
_this.fileChanged.emit({
type: 'save',
oldValue: null,
newValue: data
});
return data;
});

@@ -273,2 +322,3 @@ };

ContentsManager.prototype.copy = function (fromFile, toDir) {
var _this = this;
var ajaxSettings = this.ajaxSettings;

@@ -284,4 +334,5 @@ ajaxSettings.method = 'POST';

}
var data = success.data;
try {
validate.validateContentsModel(success.data);
validate.validateContentsModel(data);
}

@@ -291,3 +342,8 @@ catch (err) {

}
return success.data;
_this.fileChanged.emit({
type: 'new',
oldValue: null,
newValue: data
});
return data;
});

@@ -419,2 +475,4 @@ };

exports.ContentsManager = ContentsManager;
// Define the signals for the `ContentsManager` class.
signaling_1.defineSignal(ContentsManager.prototype, 'fileChanged');
/**

@@ -421,0 +479,0 @@ * A namespace for ContentsManager statics.

2

package.json
{
"name": "@jupyterlab/services",
"version": "0.25.0",
"version": "0.26.0",
"description": "Client APIs for the Jupyter services REST APIs",

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

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