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

xible-registry-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xible-registry-wrapper - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

17

NodePack.js

@@ -68,4 +68,12 @@ module.exports = function(XIBLE_REGISTRY_WRAPPER) {

let req = new OoHttpRequest('GET', `${XIBLE_REGISTRY_WRAPPER.url}/nodepacks/${encodeURI(nodePackName)}`);
return req.toObject(NodePack);
return req.toObject(NodePack)
.catch((err) => {
if (err.statusCode === 404) {
return Promise.resolve(null);
} else {
return Promise.reject(err);
}
});
}

@@ -84,2 +92,9 @@

static publish(obj, userToken) {
let req = new OoHttpRequest('POST', `${XIBLE_REGISTRY_WRAPPER.url}/nodepacks?token=${encodeURIComponent(userToken)}`);
return req.toJson(obj);
}
}

@@ -86,0 +101,0 @@

6

package.json
{
"name": "xible-registry-wrapper",
"version": "0.0.1",
"version": "0.1.0",
"description": "nodejs wrapper for a xible registry",

@@ -8,6 +8,6 @@ "license": "MIT",

"type": "git",
"url": "https://github.com/spectrumbroad/xibleRegistryWrapper"
"url": "https://github.com/spectrumbroad/xible-registry-wrapper"
},
"bugs": {
"url": "https://github.com/spectrumbroad/xibleRegistryWrapper/issues"
"url": "https://github.com/spectrumbroad/xible-registry-wrapper/issues"
},

@@ -14,0 +14,0 @@ "keywords": [

@@ -15,7 +15,7 @@ module.exports = function(XIBLE_REGISTRY_WRAPPER) {

/**
* adds a user to the registry. rejects if the user already exists
* @param {User} user the user to add
* @returns {Promise} a promise that resolves with a token
*/
/**
* adds a user to the registry. rejects if the user already exists
* @param {User} user the user to add
* @returns {Promise} a promise that resolves with a token
*/
static add(user) {

@@ -28,32 +28,39 @@

/**
* resolves a user for a token, or null if the token can't be matched
* @param {String} token the authentication token belonging to the user
* @returns {Promise} a promise that resolves with the found user or null
*/
/**
* resolves a user for a token, or null if the token can't be matched
* @param {String} token the authentication token belonging to the user
* @returns {Promise} a promise that resolves with the found user or null
*/
static getByToken(token) {
let req = new OoHttpRequest('GET', `${XIBLE_REGISTRY_WRAPPER.url}/users?token=${encodeURIComponent(token)}`);
return req.toObject(User);
return req.toObject(User)
.catch((err) => {
if (err.statusCode === 404) {
return Promise.resolve(null);
} else {
return Promise.reject(err);
}
});
}
/**
* resolves with a token. requires "user.password" to be set
* @returns {Promise} a promise that resolves with the token
*/
getToken() {
/**
* resolves with a token. requires "user.password" to be set
* @returns {Promise} a promise that resolves with the token
*/
getToken() {
if(!this.password) {
return Promise.reject(`No "password" set.`);
}
if (!this.password) {
return Promise.reject(`No "password" set.`);
}
if(!this.name) {
return Promise.reject(`No "name" set.`);
}
if (!this.name) {
return Promise.reject(`No "name" set.`);
}
let req = new OoHttpRequest('POST', `${XIBLE_REGISTRY_WRAPPER.url}/users/${encodeURIComponent(this.name)}/token`);
let req = new OoHttpRequest('POST', `${XIBLE_REGISTRY_WRAPPER.url}/users/${encodeURIComponent(this.name)}/token`);
return req.toJson(this);
}
}

@@ -60,0 +67,0 @@ }

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