@hazeljs/grpc 0.2.0-alpha.1
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/LICENSE +192 -0
- package/README.md +161 -0
- package/dist/decorators/grpc-method.decorator.d.ts +32 -0
- package/dist/decorators/grpc-method.decorator.d.ts.map +1 -0
- package/dist/decorators/grpc-method.decorator.js +47 -0
- package/dist/decorators/grpc-method.decorator.test.d.ts +2 -0
- package/dist/decorators/grpc-method.decorator.test.d.ts.map +1 -0
- package/dist/decorators/grpc-method.decorator.test.js +130 -0
- package/dist/grpc.client.d.ts +50 -0
- package/dist/grpc.client.d.ts.map +1 -0
- package/dist/grpc.client.js +188 -0
- package/dist/grpc.client.module.d.ts +65 -0
- package/dist/grpc.client.module.d.ts.map +1 -0
- package/dist/grpc.client.module.js +104 -0
- package/dist/grpc.client.module.test.d.ts +2 -0
- package/dist/grpc.client.module.test.d.ts.map +1 -0
- package/dist/grpc.client.module.test.js +86 -0
- package/dist/grpc.client.test.d.ts +2 -0
- package/dist/grpc.client.test.d.ts.map +1 -0
- package/dist/grpc.client.test.js +216 -0
- package/dist/grpc.client.types.d.ts +66 -0
- package/dist/grpc.client.types.d.ts.map +1 -0
- package/dist/grpc.client.types.js +2 -0
- package/dist/grpc.module.d.ts +73 -0
- package/dist/grpc.module.d.ts.map +1 -0
- package/dist/grpc.module.js +134 -0
- package/dist/grpc.module.test.d.ts +2 -0
- package/dist/grpc.module.test.d.ts.map +1 -0
- package/dist/grpc.module.test.js +208 -0
- package/dist/grpc.server.d.ts +37 -0
- package/dist/grpc.server.d.ts.map +1 -0
- package/dist/grpc.server.js +208 -0
- package/dist/grpc.server.test.d.ts +2 -0
- package/dist/grpc.server.test.d.ts.map +1 -0
- package/dist/grpc.server.test.js +441 -0
- package/dist/grpc.types.d.ts +61 -0
- package/dist/grpc.types.d.ts.map +1 -0
- package/dist/grpc.types.js +2 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/package.json +57 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for @grpc/proto-loader
|
|
3
|
+
* @see https://www.npmjs.com/package/@grpc/proto-loader
|
|
4
|
+
*/
|
|
5
|
+
export interface ProtoLoaderOptions {
|
|
6
|
+
keepCase?: boolean;
|
|
7
|
+
longs?: string | number;
|
|
8
|
+
enums?: string;
|
|
9
|
+
bytes?: string | string[];
|
|
10
|
+
defaults?: boolean;
|
|
11
|
+
arrays?: boolean;
|
|
12
|
+
objects?: boolean;
|
|
13
|
+
oneofs?: boolean;
|
|
14
|
+
json?: boolean;
|
|
15
|
+
includeDirs?: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* gRPC module configuration options
|
|
19
|
+
*/
|
|
20
|
+
export interface GrpcModuleOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Path to .proto file(s). Can be a single path or array of paths.
|
|
23
|
+
*/
|
|
24
|
+
protoPath: string | string[];
|
|
25
|
+
/**
|
|
26
|
+
* Package name as defined in the .proto file (e.g. 'hero', 'math')
|
|
27
|
+
*/
|
|
28
|
+
package: string;
|
|
29
|
+
/**
|
|
30
|
+
* Address to bind the gRPC server (e.g. '0.0.0.0:50051')
|
|
31
|
+
* @default '0.0.0.0:50051'
|
|
32
|
+
*/
|
|
33
|
+
url?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Options passed to @grpc/proto-loader
|
|
36
|
+
*/
|
|
37
|
+
loader?: ProtoLoaderOptions;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Extended options for GrpcModule.forRoot
|
|
41
|
+
*/
|
|
42
|
+
export interface GrpcModuleConfig extends GrpcModuleOptions {
|
|
43
|
+
/**
|
|
44
|
+
* Whether this is a global module
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
isGlobal?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Metadata for @GrpcMethod decorator
|
|
51
|
+
*/
|
|
52
|
+
export interface GrpcMethodMetadata {
|
|
53
|
+
service: string;
|
|
54
|
+
method: string;
|
|
55
|
+
methodName: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Loaded package definition from proto files (from loadPackageDefinition)
|
|
59
|
+
*/
|
|
60
|
+
export type GrpcPackageDefinition = Record<string, unknown>;
|
|
61
|
+
//# sourceMappingURL=grpc.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grpc.types.d.ts","sourceRoot":"","sources":["../src/grpc.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE7B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hazeljs/grpc - gRPC module for HazelJS
|
|
3
|
+
*
|
|
4
|
+
* RPC server and client support with decorator-based handlers.
|
|
5
|
+
* Built on @grpc/grpc-js and @grpc/proto-loader.
|
|
6
|
+
*/
|
|
7
|
+
export { GrpcModule } from './grpc.module';
|
|
8
|
+
export { GrpcServer } from './grpc.server';
|
|
9
|
+
export { GrpcClientModule } from './grpc.client.module';
|
|
10
|
+
export { GrpcClientService } from './grpc.client';
|
|
11
|
+
export { GrpcMethod, getGrpcMethodMetadata } from './decorators/grpc-method.decorator';
|
|
12
|
+
export type { GrpcModuleOptions, GrpcModuleConfig, GrpcMethodMetadata, ProtoLoaderOptions, GrpcPackageDefinition, } from './grpc.types';
|
|
13
|
+
export type { GrpcClientOptions, GrpcClientModuleConfig, GrpcClientDiscoveryConfig, GrpcDiscoveryClientLike, GrpcServiceInstanceLike, } from './grpc.client.types';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AACvF,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @hazeljs/grpc - gRPC module for HazelJS
|
|
4
|
+
*
|
|
5
|
+
* RPC server and client support with decorator-based handlers.
|
|
6
|
+
* Built on @grpc/grpc-js and @grpc/proto-loader.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.getGrpcMethodMetadata = exports.GrpcMethod = exports.GrpcClientService = exports.GrpcClientModule = exports.GrpcServer = exports.GrpcModule = void 0;
|
|
10
|
+
var grpc_module_1 = require("./grpc.module");
|
|
11
|
+
Object.defineProperty(exports, "GrpcModule", { enumerable: true, get: function () { return grpc_module_1.GrpcModule; } });
|
|
12
|
+
var grpc_server_1 = require("./grpc.server");
|
|
13
|
+
Object.defineProperty(exports, "GrpcServer", { enumerable: true, get: function () { return grpc_server_1.GrpcServer; } });
|
|
14
|
+
var grpc_client_module_1 = require("./grpc.client.module");
|
|
15
|
+
Object.defineProperty(exports, "GrpcClientModule", { enumerable: true, get: function () { return grpc_client_module_1.GrpcClientModule; } });
|
|
16
|
+
var grpc_client_1 = require("./grpc.client");
|
|
17
|
+
Object.defineProperty(exports, "GrpcClientService", { enumerable: true, get: function () { return grpc_client_1.GrpcClientService; } });
|
|
18
|
+
var grpc_method_decorator_1 = require("./decorators/grpc-method.decorator");
|
|
19
|
+
Object.defineProperty(exports, "GrpcMethod", { enumerable: true, get: function () { return grpc_method_decorator_1.GrpcMethod; } });
|
|
20
|
+
Object.defineProperty(exports, "getGrpcMethodMetadata", { enumerable: true, get: function () { return grpc_method_decorator_1.getGrpcMethodMetadata; } });
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hazeljs/grpc",
|
|
3
|
+
"version": "0.2.0-alpha.1",
|
|
4
|
+
"description": "gRPC module for HazelJS framework - RPC server and client support with decorators",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"test": "jest --coverage --passWithNoTests",
|
|
13
|
+
"lint": "eslint \"src/**/*.ts\"",
|
|
14
|
+
"lint:fix": "eslint \"src/**/*.ts\" --fix",
|
|
15
|
+
"clean": "rm -rf dist"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@grpc/grpc-js": "^1.13.0",
|
|
19
|
+
"@grpc/proto-loader": "^0.7.13"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/jest": "^29.5.14",
|
|
23
|
+
"@types/node": "^20.17.50",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^8.18.2",
|
|
25
|
+
"@typescript-eslint/parser": "^8.18.2",
|
|
26
|
+
"eslint": "^8.56.0",
|
|
27
|
+
"jest": "^29.7.0",
|
|
28
|
+
"ts-jest": "^29.1.2",
|
|
29
|
+
"typescript": "^5.3.3"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@hazeljs/core": ">=0.2.0-beta.0"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/hazel-js/hazeljs.git",
|
|
40
|
+
"directory": "packages/grpc"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"hazeljs",
|
|
44
|
+
"grpc",
|
|
45
|
+
"rpc",
|
|
46
|
+
"microservices",
|
|
47
|
+
"protobuf",
|
|
48
|
+
"decorators"
|
|
49
|
+
],
|
|
50
|
+
"author": "Muhammad Arslan <muhammad.arslan@hazeljs.com>",
|
|
51
|
+
"license": "Apache-2.0",
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "https://github.com/hazeljs/hazel-js/issues"
|
|
54
|
+
},
|
|
55
|
+
"homepage": "https://hazeljs.com",
|
|
56
|
+
"gitHead": "cbc5ee2c12ced28fd0576faf13c5f078c1e8421e"
|
|
57
|
+
}
|