Socket
Socket
Sign inDemoInstall

oriskami

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oriskami - npm Package Compare versions

Comparing version 1.21.0 to 1.22.0

4

lib/index.js

@@ -12,2 +12,3 @@ /* Oriskami API client factory

, isVNodeGT8 = vNodeMajor >= 8
, isVNodeGT5 = vNodeMajor >= 5

@@ -17,3 +18,3 @@ // MITIGATE SSL HANDSHAKE FAILURE __________________

tls.DEFAULT_ECDH_CURVE = isVNodeGT8 ? "auto" : "prime256v1"
// JSON WEB TOKEN INCOMPATIBLE FOR NODE <= 3
resources = resources || [

@@ -58,2 +59,3 @@ {"name": "Router" , "path": "router"}

var oriskami = new Oriskami(token, version, resources)
oriskami.set("unsigned", !isVNodeGT5)
for(var i = 0; i<resources.length; i++) {

@@ -60,0 +62,0 @@ oriskami.extend(resources[i].name, resources[i].path)

@@ -58,4 +58,4 @@ var Resource = require("../Resource")

*/
Oriskami.prototype.extend = function(resourceName, resourcePath){
this[resourceName] = new Resource(this, resourceName, resourcePath)
Oriskami.prototype.extend = function(resourceName, resourcePath, resourceOptions){
this[resourceName] = new Resource(this, resourceName, resourcePath, resourceOptions)
}

@@ -109,3 +109,3 @@

req.on("error", function(err){ next(err) })
req.on("error", next)
req.end()

@@ -112,0 +112,0 @@ }

@@ -31,8 +31,6 @@ var encode = encodeURIComponent

, next = isFunction(arguments[1]) ? arguments[1] : function(){}
this.request.call(this, {
"method" : "POST"
, "data" : data
, "path" : this.path
}, next)
, isUnsigned = this.oriskami.get("unsigned")
, path0 = this.path
+ (isUnsigned ? "?unsigned=true" : "")
this.request.call(this, {"method": "POST", "data": data, "path": path0}, next)
}

@@ -47,20 +45,9 @@

var nArgs = arguments.length
, path
if(nArgs === 1){
var id = ""
, next = arguments[0]
} else if(nArgs === 2){
var id = arguments[0]
, next = arguments[1]
} else if(nArgs === 3){
id = arguments[0]
json = arguments[1]
next = arguments[2]
path = toPath(json)
}
this.request.call(this, {
"method" : "GET"
, "path" : this.path + "/" + encode(id) + (path ? path : "")
}, next)
, next = arguments[nArgs - 1]
, isUnsigned = this.oriskami.get("unsigned")
, path0 = this.path
+ (nArgs > 1 ? "/" + encode(arguments[0]) : "" )
+ (nArgs > 2 ? toPath(arguments[1]) : "?")
+ (isUnsigned ? "&unsigned=true" : "" )
this.request.call(this, {"method": "GET", "path": path0}, next)
}

@@ -77,11 +64,9 @@

, idLast = nArgs - 1
, id = nArgs === 3 ? arguments[0] : ""
, data = nArgs === 3 ? arguments[1] : arguments[0]
, next = isFunction(arguments[idLast]) ? arguments[idLast] : function(){}
this.request.call(this, {
"method" : "POST"
, "data" : data
, "path" : this.path + "/" + id
}, next)
, isUnsigned = this.oriskami.get("unsigned")
, path0 = this.path
+ (nArgs === 3 ? "/" + encode(arguments[0]) : "")
+ (isUnsigned ? "?unsigned=true" : "")
this.request.call(this, {"method": "POST", "data": data, "path": path0}, next)
}

@@ -96,20 +81,9 @@

var nArgs = arguments.length
, path
if(nArgs === 1){
id = ""
next = arguments[0]
} else if(nArgs === 2){
id = arguments[0]
next = arguments[1]
} else if(nArgs === 3){
id = arguments[0]
json = arguments[1]
next = arguments[2]
path = toPath(json)
}
this.request.call(this, {
"method" : "DELETE"
, "path" : this.path + "/" + encode(id) + (path ? path : "")
}, next)
, next = arguments[nArgs - 1]
, isUnsigned = this.oriskami.get("unsigned")
, path0 = this.path
+ (nArgs > 1 ? "/" + encode(arguments[0]) : "")
+ (nArgs ==3 ? toPath(arguments[1]) : "?")
+ (isUnsigned ? "&unsigned=true" : "" )
this.request.call(this, {"method": "DELETE", "path": path0}, next)
}

@@ -124,10 +98,8 @@

var nArgs = arguments.length
, parameters = nArgs === 1 ? {} : arguments[0]
, next = nArgs === 1 ? arguments[0] : arguments[1]
this.request.call(this, {
"method" : "GET"
, "data" : parameters
, "path" : this.path
}, next)
, next = arguments[nArgs - 1]
, parameters = nArgs === 1 ? {} : arguments[0]
, isUnsigned = this.oriskami.get("unsigned")
, path0 = this.path
+ (isUnsigned ? "?unsigned=true" : "" )
this.request.call(this, {"method": "GET", "data": parameters, "path": path0}, next)
}

@@ -144,8 +116,5 @@

, next = isFunction(args[0]) ? args[0] : isFunction(args[1]) ? args[1] : function(){}
this.request.call(this, {
"method" : "GET"
, "data" : parameters
, "path" : this.path + "/summary"
}, next)
, path0 = this.path
+ "/summary"
this.request.call(this, {"method": "GET", "data": parameters, "path": path0}, next)
}

@@ -152,0 +121,0 @@

@@ -11,2 +11,3 @@ /*

, timeout = oriskami.get("timeout")
, isUnsigned= oriskami.get("force_unsigned")
, protocol = require("https")

@@ -13,0 +14,0 @@ , self = this

@@ -6,14 +6,21 @@ /*

*/
module.exports = function(req, next) {
var self = this
, Error = require("../../Error")
module.exports = function(req, next) {
var jwt = require("jsonwebtoken")
, https = require("https")
, self = this
, publicKey = this.oriskami._api.public_key
, Error = require("../../Error")
return function(res) {
var body = ""
var body = ""
res.setEncoding("utf8")
res.on("data", function(chunk) { body += chunk })
res.on("end" , function() {
var err, json = {"success": "false", "data": null, "err": "err_internal"}, code = parseInt(res.statusCode)
res.on("data" , function(chunk) { body += chunk })
res.on("end" , function() {
var err
, json = {"success": "false", "data": null, "err": "err_internal"}
, code = parseInt(res.statusCode)
, callback= function(err, json) { json.status_code = code; next(err, json) }
if(code === 500) err = new Error.OriskamiInternalServerError(json)

@@ -35,4 +42,17 @@ else if(code === 502) err = new Error.OriskamiBadGatewayError(json)

json.status_code = code
next(err, json)
if(json.token && publicKey){
jwt.verify(json.token, publicKey, callback)
} else if(json.token && !publicKey){
var req = https.get("https://api.oriskami.com/public-key", function(res){
var pkey = ""
res.setEncoding("utf8")
res.on("data", function(chunk){ pkey += chunk })
res.on("end" , function(){
self.oriskami._api.public_key = pkey
jwt.verify(json.token, pkey, callback)
})
}).on("error", callback).end()
} else {
callback(err, json)
}
})

@@ -39,0 +59,0 @@

{
"name": "oriskami",
"version": "1.21.0",
"version": "1.22.0",
"description": "API wrapper to Oriskami",

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

@@ -159,2 +159,3 @@ # Oriskami node.js bindings

| 3. Change timeout | `oriskami.set("timeout", 20000) // in ms` |
| 4. To disable signing of JSON payloads on `nodejs` >= v5 | `oriskami.set("unsigned", true)` |

@@ -161,0 +162,0 @@ Filters available for most resources (`list`).

@@ -37,3 +37,3 @@ var _ = require("lodash")

}], L.logError(done))
}).timeout(20000)
}).timeout(60000)

@@ -59,3 +59,3 @@ it("Should retrieve (restore) a flow backup", function(done){

], L.logError(done))
}).timeout(20000)
}).timeout(60000)

@@ -62,0 +62,0 @@ it("Should list", function(done){ oriskami[resourceName].list(L.logError(done))})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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