limitd-client
Advanced tools
Comparing version 1.13.1 to 2.0.0
@@ -188,3 +188,3 @@ const url = require('url'); | ||
this.stream.write(request.encodeDelimited().toBuffer()); | ||
this.stream.write(RequestMessage.encodeDelimited(request).finish()); | ||
@@ -231,3 +231,3 @@ const start = Date.now(); | ||
var request = new RequestMessage({ | ||
var request = RequestMessage.create({ | ||
'id': randomstring.generate(7), | ||
@@ -237,10 +237,6 @@ 'type': type, | ||
'method': RequestMessage.Method[method], | ||
'all': count === 'all' || null, | ||
'count': count !== 'all' ? count : null | ||
}); | ||
if (count === 'all') { | ||
request.set('all', true); | ||
} else { | ||
request.set('count', count); | ||
} | ||
return this._request(request, type, done); | ||
@@ -273,3 +269,3 @@ }; | ||
var request = new RequestMessage({ | ||
var request = RequestMessage.create({ | ||
'id': randomstring.generate(7), | ||
@@ -279,10 +275,6 @@ 'type': type, | ||
'method': RequestMessage.Method.PUT, | ||
'all': count === 'all' ? true : null, | ||
'count': count !== 'all' ? count : null | ||
}); | ||
if (count === 'all') { | ||
request.set('all', true); | ||
} else { | ||
request.set('count', count); | ||
} | ||
return this._request(request, type, done); | ||
@@ -292,3 +284,3 @@ }; | ||
LimitdClient.prototype.status = function (type, key, done) { | ||
var request = new RequestMessage({ | ||
var request = RequestMessage.create({ | ||
'id': randomstring.generate(7), | ||
@@ -295,0 +287,0 @@ 'type': type, |
@@ -1,7 +0,8 @@ | ||
var ProtoBuf = require('protobufjs'); | ||
require('protobufjs/src/parse').defaults.keepCase = true; | ||
var path = require('path'); | ||
const ProtoBuf = require('protobufjs'); | ||
const path = require('path'); | ||
const protoPath = path.join(__dirname, '/../protocol/Index.proto'); | ||
const builder = ProtoBuf.loadSync(protoPath); | ||
var builder = ProtoBuf.loadProtoFile(path.join(__dirname, '/../protocol/Index.proto')); | ||
module.exports = builder.build('limitd'); | ||
module.exports = builder.lookup('limitd'); |
{ | ||
"name": "limitd-client", | ||
"version": "1.13.1", | ||
"version": "2.0.0", | ||
"description": "limitd client for node.js", | ||
@@ -15,3 +15,3 @@ "main": "index.js", | ||
"lodash": "~3.7.0", | ||
"protobufjs": "auth0/protobuf.js#4.0.0-auth0", | ||
"protobufjs": "^6.6.5", | ||
"randomstring": "~1.0.5", | ||
@@ -18,0 +18,0 @@ "reconnect-net": "0.0.0", |
@@ -75,7 +75,3 @@ var LimitdClient = require('../'); | ||
server.once('request', function (request, reply) { | ||
var response = new Response({ | ||
request_id: request.id, | ||
}); | ||
var takeResponse = new TakeResponse({ | ||
var takeResponse = TakeResponse.create({ | ||
conformant: true, | ||
@@ -87,4 +83,8 @@ remaining: 10, | ||
response.set('.limitd.TakeResponse.response', takeResponse); | ||
var response = Response.create({ | ||
request_id: request.id, | ||
'.limitd.TakeResponse.response': takeResponse | ||
}); | ||
reply(response); | ||
@@ -107,12 +107,11 @@ }); | ||
server.once('request', function (request, reply) { | ||
var response = new Response({ | ||
request_id: request.id | ||
var errorResponse = ErrorResponse.create({ | ||
type: ErrorResponse.Type.UNKNOWN_BUCKET_TYPE | ||
}); | ||
var errorResponse = new ErrorResponse({ | ||
type: ErrorResponse.Type.UNKNOWN_BUCKET_TYPE | ||
var response = Response.create({ | ||
request_id: request.id, | ||
'.limitd.ErrorResponse.response': errorResponse | ||
}); | ||
response.set('.limitd.ErrorResponse.response', errorResponse); | ||
reply(response); | ||
@@ -119,0 +118,0 @@ }); |
@@ -50,3 +50,3 @@ const net = require('net'); | ||
})) | ||
.pipe(stream_map(response => response.encodeDelimited().toBuffer())) | ||
.pipe(stream_map(response => protocol.Response.encodeDelimited(response).finish())) | ||
.pipe(socket); | ||
@@ -53,0 +53,0 @@ }); |
@@ -10,7 +10,3 @@ var LimitdClient = require('../'); | ||
function mock_response (request, reply) { | ||
var response = new Response({ | ||
request_id: request.id | ||
}); | ||
var takeResponse = new TakeResponse({ | ||
var takeResponse = TakeResponse.create({ | ||
conformant: true, | ||
@@ -22,3 +18,6 @@ remaining: 10, | ||
response.set('.limitd.TakeResponse.response', takeResponse); | ||
var response = Response.create({ | ||
request_id: request.id, | ||
'.limitd.TakeResponse.response': takeResponse | ||
}); | ||
@@ -55,2 +54,2 @@ reply(response); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
31067
0
1
630
1
+ Added@protobufjs/aspromise@1.1.2(transitive)
+ Added@protobufjs/base64@1.1.2(transitive)
+ Added@protobufjs/codegen@2.0.4(transitive)
+ Added@protobufjs/eventemitter@1.1.0(transitive)
+ Added@protobufjs/fetch@1.1.0(transitive)
+ Added@protobufjs/float@1.0.2(transitive)
+ Added@protobufjs/inquire@1.1.0(transitive)
+ Added@protobufjs/path@1.1.2(transitive)
+ Added@protobufjs/pool@1.1.0(transitive)
+ Added@protobufjs/utf8@1.1.0(transitive)
+ Added@types/long@4.0.2(transitive)
+ Added@types/node@22.9.3(transitive)
+ Addedlong@4.0.0(transitive)
+ Addedprotobufjs@6.11.4(transitive)
+ Addedundici-types@6.19.8(transitive)
Updatedprotobufjs@^6.6.5