grpc-js-reflection-client 1.3.7 → 1.4.0-alpha-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +4 -0
- package/dist/examples/getProtoObj.js +28 -0
- package/dist/examples/getProtoObj.js.map +1 -0
- package/dist/examples/listServices.d.ts +1 -0
- package/dist/examples/listServices.js +14 -0
- package/dist/examples/listServices.js.map +1 -0
- package/dist/examples/otherMethods.d.ts +1 -0
- package/dist/examples/otherMethods.js +21 -0
- package/dist/examples/otherMethods.js.map +1 -0
- package/dist/src/Descriptor.d.ts +19 -0
- package/dist/src/Descriptor.js +38 -0
- package/dist/src/Descriptor.js.map +1 -0
- package/dist/src/Exceptions/ReflectionException.js.map +1 -0
- package/dist/src/Exceptions/ReflectionRequestException.js.map +1 -0
- package/dist/src/Exceptions/index.js.map +1 -0
- package/dist/src/GrpcReflection.js.map +1 -0
- package/dist/src/Helpers/index.js.map +1 -0
- package/dist/src/Helpers/packageObjectHelper.js.map +1 -0
- package/dist/src/Helpers/serviceHelper.js.map +1 -0
- package/dist/src/Helpers/serviceHelper.spec.d.ts +1 -0
- package/dist/src/Helpers/serviceHelper.spec.js.map +1 -0
- package/dist/src/Proto/v1.js.map +1 -0
- package/dist/src/Proto/v1alpha.js.map +1 -0
- package/dist/src/Types/ListMethodsType.js.map +1 -0
- package/dist/src/Types/getAllExtensionNumbersOfTypeType.js.map +1 -0
- package/dist/src/Types/index.js.map +1 -0
- package/dist/src/index.js.map +1 -0
- package/dist/tests/e2e/addressbook.test.d.ts +1 -0
- package/dist/tests/e2e/addressbook.test.js +37 -0
- package/dist/tests/e2e/addressbook.test.js.map +1 -0
- package/dist/tests/e2e/grpc-node-grpc-reflection-server/server.d.ts +1 -0
- package/dist/tests/e2e/grpc-node-grpc-reflection-server/server.js +29 -0
- package/dist/tests/e2e/grpc-node-grpc-reflection-server/server.js.map +1 -0
- package/dist/tests/e2e/grpc-node-server-reflection/server.d.ts +1 -0
- package/dist/tests/e2e/grpc-node-server-reflection/server.js +29 -0
- package/dist/tests/e2e/grpc-node-server-reflection/server.js.map +1 -0
- package/dist/tests/e2e/grpc-reflection-server.test.d.ts +1 -0
- package/dist/tests/e2e/grpc-reflection-server.test.js +36 -0
- package/dist/tests/e2e/grpc-reflection-server.test.js.map +1 -0
- package/dist/tests/e2e/helloWorld.test.d.ts +1 -0
- package/dist/tests/e2e/helloWorld.test.js +76 -0
- package/dist/tests/e2e/helloWorld.test.js.map +1 -0
- package/dist/tests/e2e/helpers.test.d.ts +1 -0
- package/dist/tests/e2e/helpers.test.js +52 -0
- package/dist/tests/e2e/helpers.test.js.map +1 -0
- package/dist/tests/e2e/listMethods.test.d.ts +1 -0
- package/dist/tests/e2e/listMethods.test.js +24 -0
- package/dist/tests/e2e/listMethods.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/examples/helpers.js +1 -1
- package/examples/otherMethods.ts +1 -1
- package/package.json +10 -10
- package/dist/Descriptor.d.ts +0 -13
- package/dist/Descriptor.js +0 -28
- package/dist/Descriptor.js.map +0 -1
- package/dist/Exceptions/ReflectionException.js.map +0 -1
- package/dist/Exceptions/ReflectionRequestException.js.map +0 -1
- package/dist/Exceptions/index.js.map +0 -1
- package/dist/GrpcReflection.js.map +0 -1
- package/dist/Helpers/index.js.map +0 -1
- package/dist/Helpers/packageObjectHelper.js.map +0 -1
- package/dist/Helpers/serviceHelper.js.map +0 -1
- package/dist/Helpers/serviceHelper.spec.js.map +0 -1
- package/dist/Proto/v1.js.map +0 -1
- package/dist/Proto/v1alpha.js.map +0 -1
- package/dist/Types/ListMethodsType.js.map +0 -1
- package/dist/Types/getAllExtensionNumbersOfTypeType.js.map +0 -1
- package/dist/Types/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- /package/dist/{Helpers/serviceHelper.spec.d.ts → examples/getProtoObj.d.ts} +0 -0
- /package/dist/{Exceptions → src/Exceptions}/ReflectionException.d.ts +0 -0
- /package/dist/{Exceptions → src/Exceptions}/ReflectionException.js +0 -0
- /package/dist/{Exceptions → src/Exceptions}/ReflectionRequestException.d.ts +0 -0
- /package/dist/{Exceptions → src/Exceptions}/ReflectionRequestException.js +0 -0
- /package/dist/{Exceptions → src/Exceptions}/index.d.ts +0 -0
- /package/dist/{Exceptions → src/Exceptions}/index.js +0 -0
- /package/dist/{GrpcReflection.d.ts → src/GrpcReflection.d.ts} +0 -0
- /package/dist/{GrpcReflection.js → src/GrpcReflection.js} +0 -0
- /package/dist/{Helpers → src/Helpers}/index.d.ts +0 -0
- /package/dist/{Helpers → src/Helpers}/index.js +0 -0
- /package/dist/{Helpers → src/Helpers}/packageObjectHelper.d.ts +0 -0
- /package/dist/{Helpers → src/Helpers}/packageObjectHelper.js +0 -0
- /package/dist/{Helpers → src/Helpers}/serviceHelper.d.ts +0 -0
- /package/dist/{Helpers → src/Helpers}/serviceHelper.js +0 -0
- /package/dist/{Helpers → src/Helpers}/serviceHelper.spec.js +0 -0
- /package/dist/{Proto → src/Proto}/v1.d.ts +0 -0
- /package/dist/{Proto → src/Proto}/v1.js +0 -0
- /package/dist/{Proto → src/Proto}/v1alpha.d.ts +0 -0
- /package/dist/{Proto → src/Proto}/v1alpha.js +0 -0
- /package/dist/{Types → src/Types}/ListMethodsType.d.ts +0 -0
- /package/dist/{Types → src/Types}/ListMethodsType.js +0 -0
- /package/dist/{Types → src/Types}/getAllExtensionNumbersOfTypeType.d.ts +0 -0
- /package/dist/{Types → src/Types}/getAllExtensionNumbersOfTypeType.js +0 -0
- /package/dist/{Types → src/Types}/index.d.ts +0 -0
- /package/dist/{Types → src/Types}/index.js +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const src_1 = require("../../src");
|
|
4
|
+
const grpc = require("@grpc/grpc-js");
|
|
5
|
+
describe("Test of helloworld.proto", () => {
|
|
6
|
+
let client;
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
client = new src_1.GrpcReflection("localhost:50051", grpc.ChannelCredentials.createInsecure());
|
|
9
|
+
});
|
|
10
|
+
it("List Service for wildcard", async () => {
|
|
11
|
+
const services = await client.listServices();
|
|
12
|
+
expect(services).toEqual(['grpc.examples.echo.Echo', 'grpc.reflection.v1alpha.ServerReflection', 'helloworld.Greeter']);
|
|
13
|
+
});
|
|
14
|
+
it("List Service for hello world", async () => {
|
|
15
|
+
const services = await client.listServices('helloworld.Greeter');
|
|
16
|
+
expect(services).toEqual(['grpc.examples.echo.Echo', 'grpc.reflection.v1alpha.ServerReflection', 'helloworld.Greeter']);
|
|
17
|
+
});
|
|
18
|
+
it("Get list Of extensions", async () => {
|
|
19
|
+
const extensions = await client.getAllExtensionNumbersOfType("helloworld.HelloRequest");
|
|
20
|
+
expect(extensions).toEqual({
|
|
21
|
+
"base_type_name": "helloworld.HelloRequest",
|
|
22
|
+
"extension_number": [],
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
it("Get proto file by name", (done) => {
|
|
26
|
+
(async () => {
|
|
27
|
+
const descriptor = await client.getDescriptorByFileName('examples/helloworld/helloworld/helloworld.proto');
|
|
28
|
+
const packageObject = descriptor.getPackageObject({
|
|
29
|
+
keepCase: true,
|
|
30
|
+
enums: String,
|
|
31
|
+
longs: String
|
|
32
|
+
});
|
|
33
|
+
const proto = new packageObject.helloworld.Greeter("localhost:50051", grpc.ChannelCredentials.createInsecure());
|
|
34
|
+
proto.SayHello({
|
|
35
|
+
name: "abc"
|
|
36
|
+
}, (err, data) => {
|
|
37
|
+
expect(data.message).toContain("abc");
|
|
38
|
+
done();
|
|
39
|
+
});
|
|
40
|
+
})();
|
|
41
|
+
});
|
|
42
|
+
it("Get proto file by name not exists - catch exception", async () => {
|
|
43
|
+
await expect(client.getDescriptorByFileName('not-exists.proto'))
|
|
44
|
+
.rejects
|
|
45
|
+
.toThrow(src_1.ReflectionRequestException);
|
|
46
|
+
});
|
|
47
|
+
it("Get proto file by symbol not exists - catch exception", async () => {
|
|
48
|
+
await expect(client.getDescriptorBySymbol('not-exists'))
|
|
49
|
+
.rejects
|
|
50
|
+
.toThrow(src_1.ReflectionRequestException);
|
|
51
|
+
});
|
|
52
|
+
it("Wrong host. Throw error on UNAVAILABLE: No connection established\n - catch exception", async () => {
|
|
53
|
+
const client2 = new src_1.GrpcReflection("localhost:50053", grpc.ChannelCredentials.createInsecure());
|
|
54
|
+
await expect(client.getDescriptorBySymbol('not-exists'))
|
|
55
|
+
.rejects
|
|
56
|
+
.toThrow(src_1.ReflectionRequestException);
|
|
57
|
+
});
|
|
58
|
+
it("Get proto file by symbol", (done) => {
|
|
59
|
+
(async () => {
|
|
60
|
+
const descriptor = await client.getDescriptorBySymbol('helloworld.Greeter');
|
|
61
|
+
const packageObject = descriptor.getPackageObject({
|
|
62
|
+
keepCase: true,
|
|
63
|
+
enums: String,
|
|
64
|
+
longs: String
|
|
65
|
+
});
|
|
66
|
+
const proto = new packageObject.helloworld.Greeter("localhost:50051", grpc.ChannelCredentials.createInsecure());
|
|
67
|
+
proto.SayHello({
|
|
68
|
+
name: "abc"
|
|
69
|
+
}, (err, data) => {
|
|
70
|
+
expect(data.message).toContain("abc");
|
|
71
|
+
done();
|
|
72
|
+
});
|
|
73
|
+
})();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=helloWorld.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helloWorld.test.js","sourceRoot":"","sources":["../../../tests/e2e/helloWorld.test.ts"],"names":[],"mappings":";;AAAA,mCAAqE;AACrE,sCAAsC;AAGtC,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACtC,IAAI,MAAM,CAAC;IAEX,UAAU,CAAC,GAAE,EAAE;QACX,MAAM,GAAG,IAAI,oBAAc,CAAC,iBAAiB,EAAE,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AU,CAAC,gBAAgB,CAAC;gBAC9C,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,MAAM;gBACb,KAAK,EAAE,MAAM;aAChB,CAAC,CAAC;YAEH,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,UAAU,CAAC,OAAO,CAC9C,iBAAiB,EACjB,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAC3C,CAAC;YAEF,KAAK,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,KAAK;aACd,EAAC,CAAC,GAAG,EAAC,IAAI,EAAC,EAAE;gBACV,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACtC,IAAI,EAAE,CAAC;YACX,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,EAAE,CAAC;IACT,CAAC,CAAC,CAAC;AAIP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const src_1 = require("../../src");
|
|
4
|
+
const grpc = require("@grpc/grpc-js");
|
|
5
|
+
describe("Test Helpers", () => {
|
|
6
|
+
it('Should create packageobject addressbook by filename', async () => {
|
|
7
|
+
const packageObject = await (0, src_1.packageObjectHelper)({
|
|
8
|
+
host: "localhost:50053",
|
|
9
|
+
credentials: grpc.ChannelCredentials.createInsecure(),
|
|
10
|
+
proto_filename: 'addressbook.proto',
|
|
11
|
+
protoLoaderOptions: {
|
|
12
|
+
keepCase: true
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
expect(packageObject).toBeDefined();
|
|
16
|
+
});
|
|
17
|
+
it('Should create packageobject addressbook by symbol', async () => {
|
|
18
|
+
const packageObject = await (0, src_1.packageObjectHelper)({
|
|
19
|
+
host: "localhost:50053",
|
|
20
|
+
credentials: grpc.ChannelCredentials.createInsecure(),
|
|
21
|
+
proto_symbol: 'addressbook.AddressesService',
|
|
22
|
+
protoLoaderOptions: {
|
|
23
|
+
keepCase: true
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
expect(packageObject).toBeDefined();
|
|
27
|
+
});
|
|
28
|
+
it('Should create Service by proto file name', (done) => {
|
|
29
|
+
const packageObject = (0, src_1.serviceHelper)({
|
|
30
|
+
host: "localhost:50053",
|
|
31
|
+
servicePath: "addressbook.AddressesService",
|
|
32
|
+
credentials: grpc.ChannelCredentials.createInsecure(),
|
|
33
|
+
proto_filename: 'addressbook.proto',
|
|
34
|
+
protoLoaderOptions: {
|
|
35
|
+
keepCase: true
|
|
36
|
+
}
|
|
37
|
+
}).then(proto => {
|
|
38
|
+
expect(packageObject).toBeDefined();
|
|
39
|
+
proto.Add({
|
|
40
|
+
name: "abc",
|
|
41
|
+
email: "test@example.com"
|
|
42
|
+
}, (err, response) => {
|
|
43
|
+
if (err)
|
|
44
|
+
return done(err);
|
|
45
|
+
expect(response.id).toContain("123");
|
|
46
|
+
expect(response.success).toBe(true);
|
|
47
|
+
done();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=helpers.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.test.js","sourceRoot":"","sources":["../../../tests/e2e/helpers.test.ts"],"names":[],"mappings":";;AAAA,mCAA6D;AAC7D,sCAAsC;AAgBtC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAE1B,EAAE,CAAC,qDAAqD,EAAE,KAAK,IAAG,EAAE;QAChE,MAAM,aAAa,GAAG,MAAM,IAAA,yBAAmB,EAAC;YAC5C,IAAI,EAAE,iBAAiB;YACvB,WAAW,EAAE,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE;YACrD,cAAc,EAAE,mBAAmB;YACnC,kBAAkB,EAAE;gBAChB,QAAQ,EAAE,IAAI;aACjB;SACJ,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ACX,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const src_1 = require("../../src");
|
|
4
|
+
const grpc = require("@grpc/grpc-js");
|
|
5
|
+
describe("Test list methods of helloworld.proto", () => {
|
|
6
|
+
let client;
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
client = new src_1.GrpcReflection("localhost:50051", grpc.ChannelCredentials.createInsecure());
|
|
9
|
+
});
|
|
10
|
+
it("List methods for services", (done) => {
|
|
11
|
+
const methods = client.listMethods('helloworld.Greeter')
|
|
12
|
+
.then((methods) => {
|
|
13
|
+
const methodsNames = methods.map((method) => method.name);
|
|
14
|
+
expect(methodsNames).toEqual([
|
|
15
|
+
"SayHello"
|
|
16
|
+
]);
|
|
17
|
+
done();
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
it("Should throw exception on not found service", async () => {
|
|
21
|
+
await expect(client.listMethods('not-found.Greeter')).rejects.toThrow(src_1.ReflectionRequestException);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=listMethods.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listMethods.test.js","sourceRoot":"","sources":["../../../tests/e2e/listMethods.test.ts"],"names":[],"mappings":";;AAAA,mCAAqE;AACrE,sCAAsC;AAEtC,QAAQ,CAAC,uCAAuC,EAAE,GAAG,EAAE;IACnD,IAAI,MAAM,CAAC;IAEX,UAAU,CAAC,GAAE,EAAE;QACX,MAAM,GAAG,IAAI,oBAAc,CAAC,iBAAiB,EAAE,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2BAA2B,EAAE,CAAC,IAAI,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,oBAAoB,CAAC;aACnD,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;YACd,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC1D,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CACxB;gBACI,UAAU;aACb,CACJ,CAAC;YACF,IAAI,EAAE,CAAC;QACX,CAAC,CAAC,CAAC;IAEX,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,KAAK,IAAG,EAAE;QACxD,MAAM,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,gCAA0B,CAAC,CAAC;IACtG,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"}
|