Skip to content

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
bojand committed May 30, 2021
1 parent 44e71de commit 3dbce27
Show file tree
Hide file tree
Showing 13 changed files with 2,796 additions and 4,740 deletions.
2 changes: 1 addition & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const grpc = require('grpc')
const grpc = require('@grpc/grpc-js')
const _ = require('lodash')
const async = require('async')
const create = require('grpc-create-metadata')
Expand Down
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const grpc = require('grpc')
const grpc = require('@grpc/grpc-js')
const _ = require('lodash')
const gi = require('grpc-inspect')
const create = require('grpc-create-metadata')
Expand Down Expand Up @@ -68,7 +68,7 @@ function caller (host, proto, name, credentials, options, defaults) {
const loaded = grpc.loadPackageDefinition(packageDefinition)
const descriptor = gi(loaded)
if (!descriptor) {
throw new Error(`Error parsing protocol buffer`)
throw new Error('Error parsing protocol buffer')
}

Ctor = descriptor.client(name)
Expand Down
7,156 changes: 2,605 additions & 4,551 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,23 @@
"client"
],
"dependencies": {
"@grpc/proto-loader": "^0.5.0",
"@grpc/proto-loader": "^0.6.0",
"async": "^3.1.0",
"call-me-maybe": "^1.0.1",
"grpc-create-metadata": "^3.0.0",
"grpc-create-metadata": "^4.0.0",
"grpc-inspect": "^0.6.0",
"lodash": "^4.17.14",
"promisify-call": "^2.0.0"
},
"peerDependencies": {
"grpc": "^1.13.0"
"@grpc/grpc-js": "^1.2.5"
},
"devDependencies": {
"ava": "^2.2.0",
"ava": "^3.15.0",
"google-protobuf": "^3.8.0",
"greenkeeper-lockfile": "^1.15.0",
"grpc": "^1.22.2",
"jsdoc-to-markdown": "^5.0.0",
"standard": "^13.0.0"
"@grpc/grpc-js": "^1.2.5",
"jsdoc-to-markdown": "^7.0.0",
"standard": "^16.0.0"
},
"directories": {
"test": "test"
Expand All @@ -55,6 +54,6 @@
]
},
"engines": {
"node": ">=6.9.0"
"node": ">=14.0.0"
}
}
28 changes: 16 additions & 12 deletions test/basics.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import test from 'ava'
import path from 'path'
import async from 'async'
const grpc = require('grpc')
const test = require('ava')
const path = require('path')
const async = require('async')
const grpc = require('@grpc/grpc-js')
const protoLoader = require('@grpc/proto-loader')

const caller = require('../')
Expand Down Expand Up @@ -31,26 +31,30 @@ test.before('should dynamically create service', t => {

const server = new grpc.Server()
server.addService(helloproto.Greeter.service, { sayHello: sayHello })
server.bind(DYNAMIC_HOST, grpc.ServerCredentials.createInsecure())
server.start()
apps.push(server)
server.bindAsync(DYNAMIC_HOST, grpc.ServerCredentials.createInsecure(), err => {
t.falsy(err)
server.start()
apps.push(server)
})
})

test.before('should statically create service', t => {
const messages = require('./static/helloworld_pb')
const services = require('./static/helloworld_grpc_pb')

function sayHello (call, callback) {
var reply = new messages.HelloReply()
const reply = new messages.HelloReply()
reply.setMessage('Hello ' + call.request.getName())
callback(null, reply)
}

var server = new grpc.Server()
const server = new grpc.Server()
server.addService(services.GreeterService, { sayHello: sayHello })
server.bind(STATIC_HOST, grpc.ServerCredentials.createInsecure())
server.start()
apps.push(server)
server.bindAsync(STATIC_HOST, grpc.ServerCredentials.createInsecure(), err => {
t.falsy(err)
server.start()
apps.push(server)
})
})

test.cb('call dynamic service using callback', t => {
Expand Down
24 changes: 13 additions & 11 deletions test/defaults.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import test from 'ava'
import path from 'path'
import async from 'async'
import grpc from 'grpc'
const grpc = require('@grpc/grpc-js')

import caller from '../'
const caller = require('../')
const test = require('ava')
const path = require('path')
const async = require('async')

const PROTO_PATH = path.resolve(__dirname, './protos/helloworld.proto')

Expand All @@ -24,8 +24,8 @@ test.before('start test servic', t => {
const services = require('./static/helloworld_grpc_pb')

function sayHello (call, callback) {
var reply = new messages.HelloReply()
var responceMessage = ''
const reply = new messages.HelloReply()
let responceMessage = ''

if (call.metadata.get('foo').length > 0) { responceMessage = `${call.metadata.get('foo')} -> ${responceMessage}` }

Expand All @@ -37,11 +37,13 @@ test.before('start test servic', t => {
callback(null, reply)
}

var server = new grpc.Server()
const server = new grpc.Server()
server.addService(services.GreeterService, { sayHello: sayHello })
server.bind(TEST_HOST, grpc.ServerCredentials.createInsecure())
server.start()
apps.push(server)
server.bindAsync(TEST_HOST, grpc.ServerCredentials.createInsecure(), err => {
t.falsy(err)
server.start()
apps.push(server)
})
})

test.cb('should pass default metadata', t => {
Expand Down
18 changes: 10 additions & 8 deletions test/duplex.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import _ from 'lodash'
import test from 'ava'
import path from 'path'
import async from 'async'
import grpc from 'grpc'
const _ = require('lodash')
const test = require('ava')
const path = require('path')
const async = require('async')
const grpc = require('@grpc/grpc-js')

const protoLoader = require('@grpc/proto-loader')

Expand Down Expand Up @@ -72,9 +72,11 @@ test.before('should dynamically create service', t => {

const server = new grpc.Server()
server.addService(argProto.ArgService.service, { processStuff })
server.bind(DYNAMIC_HOST, grpc.ServerCredentials.createInsecure())
server.start()
apps.push(server)
server.bindAsync(DYNAMIC_HOST, grpc.ServerCredentials.createInsecure(), err => {
t.falsy(err)
server.start()
apps.push(server)
})
})

test.cb('Duplex: call service using just an argument', t => {
Expand Down
26 changes: 14 additions & 12 deletions test/reqres.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import _ from 'lodash'
import test from 'ava'
import path from 'path'
import async from 'async'
import grpc from 'grpc'
const _ = require('lodash')
const test = require('ava')
const path = require('path')
const async = require('async')
const grpc = require('@grpc/grpc-js')

const protoLoader = require('@grpc/proto-loader')

Expand Down Expand Up @@ -51,9 +51,11 @@ test.before('should dynamically create service', t => {

const server = new grpc.Server()
server.addService(argProto.ArgService.service, { doSomething })
server.bind(DYNAMIC_HOST, grpc.ServerCredentials.createInsecure())
server.start()
apps.push(server)
server.bindAsync(DYNAMIC_HOST, grpc.ServerCredentials.createInsecure(), err => {
t.falsy(err)
server.start()
apps.push(server)
})
})

test.cb('call service using callback and just an argument', t => {
Expand Down Expand Up @@ -295,7 +297,7 @@ test('Request API: with metadata option', async t => {
t.truthy(res.metadata)
const md1 = res.metadata.getMap()
const expectedMd = { headermd: 'headerValue' }
t.deepEqual(md1, expectedMd)
t.is(md1.headermd, expectedMd.headermd)

t.falsy(res.status)
const { response } = res
Expand Down Expand Up @@ -325,7 +327,7 @@ test('Request API: with status option', async t => {
t.truthy(res.status.metadata)
const md1 = res.status.metadata.getMap()
const expectedMd = { trailermd: 'trailerValue' }
t.deepEqual(md1, expectedMd)
t.is(md1.headermd, expectedMd.headermd)

const { response } = res
t.truthy(response)
Expand All @@ -351,7 +353,7 @@ test('Request API: with metadata and status option', async t => {
t.truthy(res.metadata)
const md1 = res.metadata.getMap()
const expectedMd = { headermd: 'headerValue' }
t.deepEqual(md1, expectedMd)
t.is(md1.headermd, expectedMd.headermd)

t.truthy(res.status)
t.is(res.status.code, 0)
Expand Down Expand Up @@ -385,7 +387,7 @@ test.cb('Request API: with metadata and status option with callback', t => {
t.truthy(res.metadata)
const md1 = res.metadata.getMap()
const expectedMd = { headermd: 'headerValue' }
t.deepEqual(md1, expectedMd)
t.is(md1.headermd, expectedMd.headermd)

t.truthy(res.status)
t.is(res.status.code, 0)
Expand Down
28 changes: 15 additions & 13 deletions test/reqstream.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import _ from 'lodash'
import test from 'ava'
import path from 'path'
import async from 'async'
import grpc from 'grpc'
const _ = require('lodash')
const test = require('ava')
const path = require('path')
const async = require('async')
const grpc = require('@grpc/grpc-js')

const protoLoader = require('@grpc/proto-loader')

Expand Down Expand Up @@ -76,9 +76,11 @@ test.before('should dynamically create service', t => {

const server = new grpc.Server()
server.addService(argProto.ArgService.service, { writeStuff })
server.bind(DYNAMIC_HOST, grpc.ServerCredentials.createInsecure())
server.start()
apps.push(server)
server.bindAsync(DYNAMIC_HOST, grpc.ServerCredentials.createInsecure(), err => {
t.falsy(err)
server.start()
apps.push(server)
})
})

test.cb('Reqres: call service using just an argument', t => {
Expand Down Expand Up @@ -421,7 +423,7 @@ test('Request API: async call with metadata options', async t => {
t.truthy(res.metadata)
const md1 = res.metadata.getMap()
const expectedMd = { headermd: 'headerValue' }
t.deepEqual(md1, expectedMd)
t.is(md1.headermd, expectedMd.headermd)

t.falsy(res.status)

Expand Down Expand Up @@ -453,7 +455,7 @@ test.cb('Request API: callback call with metadata options', t => {
t.truthy(res.metadata)
const md1 = res.metadata.getMap()
const expectedMd = { headermd: 'headerValue' }
t.deepEqual(md1, expectedMd)
t.is(md1.headermd, expectedMd.headermd)

t.falsy(res.status)

Expand Down Expand Up @@ -504,7 +506,7 @@ test('Request API: async call with status options', async t => {
t.truthy(res.metadata)
const md1 = res.metadata.getMap()
const expectedMd = { headermd: 'headerValue' }
t.deepEqual(md1, expectedMd)
t.is(md1.headermd, expectedMd.headermd)

t.truthy(res.status)
t.is(res.status.code, 0)
Expand Down Expand Up @@ -543,7 +545,7 @@ test.cb('Request API: callback call with status options', t => {
t.truthy(res.metadata)
const md1 = res.metadata.getMap()
const expectedMd = { headermd: 'headerValue' }
t.deepEqual(md1, expectedMd)
t.is(md1.headermd, expectedMd.headermd)

t.truthy(res.status)
t.is(res.status.code, 0)
Expand Down Expand Up @@ -603,7 +605,7 @@ test('Request API: async call with metadata and status options', async t => {
t.truthy(res.status.metadata)
const md1 = res.status.metadata.getMap()
const expectedMd = { trailermd: 'trailerValue' }
t.deepEqual(md1, expectedMd)
t.is(md1.headermd, expectedMd.headermd)

const { response } = res

Expand Down
18 changes: 10 additions & 8 deletions test/resstream.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import _ from 'lodash'
import test from 'ava'
import path from 'path'
import async from 'async'
import grpc from 'grpc'
const _ = require('lodash')
const test = require('ava')
const path = require('path')
const async = require('async')
const grpc = require('@grpc/grpc-js')

const protoLoader = require('@grpc/proto-loader')

Expand Down Expand Up @@ -66,9 +66,11 @@ test.before('should dynamically create service', t => {

const server = new grpc.Server()
server.addService(argProto.ArgService.service, { listStuff })
server.bind(DYNAMIC_HOST, grpc.ServerCredentials.createInsecure())
server.start()
apps.push(server)
server.bindAsync(DYNAMIC_HOST, grpc.ServerCredentials.createInsecure(), err => {
t.falsy(err)
server.start()
apps.push(server)
})
})

test.cb('res stream call service using just an argument', t => {
Expand Down
20 changes: 11 additions & 9 deletions test/retry.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import _ from 'lodash'
import test from 'ava'
import path from 'path'
import async from 'async'
import grpc from 'grpc'
const _ = require('lodash')
const test = require('ava')
const path = require('path')
const async = require('async')
const grpc = require('@grpc/grpc-js')

const protoLoader = require('@grpc/proto-loader')

Expand Down Expand Up @@ -58,9 +58,11 @@ test.before('should dynamically create service', t => {

const server = new grpc.Server()
server.addService(argProto.ArgService.service, { doSomething })
server.bind(DYNAMIC_HOST, grpc.ServerCredentials.createInsecure())
server.start()
apps.push(server)
server.bindAsync(DYNAMIC_HOST, grpc.ServerCredentials.createInsecure(), err => {
t.falsy(err)
server.start()
apps.push(server)
})
})

test.serial.cb('Retry: call service using retry option and callback', t => {
Expand Down Expand Up @@ -162,7 +164,7 @@ test.serial('Request API with retry: call service using async with metadata and
t.truthy(res.metadata)
const md1 = res.metadata.getMap()
const expectedMd = { headermd: 'headerValue' }
t.deepEqual(md1, expectedMd)
t.is(md1.headermd, expectedMd.headermd)

t.truthy(res.status)
t.is(res.status.code, 0)
Expand Down
Loading

0 comments on commit 3dbce27

Please sign in to comment.