@rsdk/builtin-contract 6.0.0-next.4 → 6.0.0-next.40
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/buf.work.yaml +4 -1
- package/dist/google/protobuf/struct.d.ts +4 -4
- package/dist/google/protobuf/struct.js +9 -5
- package/dist/google/protobuf/struct.js.map +1 -1
- package/dist/grpc/error/v1/error.d.ts +1 -1
- package/dist/grpc/error/v1/error.js +2 -0
- package/dist/grpc/error/v1/error.js.map +1 -1
- package/dist/grpc/health/v1/health.d.ts +11 -12
- package/dist/grpc/health/v1/health.js +2 -0
- package/dist/grpc/health/v1/health.js.map +1 -1
- package/dist/grpc/metrics/v1/metrics.d.ts +7 -8
- package/dist/grpc/metrics/v1/metrics.js +2 -0
- package/dist/grpc/metrics/v1/metrics.js.map +1 -1
- package/dist/grpc/reflection/v1/reflection.d.ts +13 -14
- package/dist/grpc/reflection/v1/reflection.js +4 -21
- package/dist/grpc/reflection/v1/reflection.js.map +1 -1
- package/dist/grpc/reflection/v1alpha/reflection.d.ts +13 -14
- package/dist/grpc/reflection/v1alpha/reflection.js +4 -21
- package/dist/grpc/reflection/v1alpha/reflection.js.map +1 -1
- package/dist/grpc.error.v1.d.ts +23 -5
- package/dist/grpc.error.v1.js +2 -2
- package/dist/grpc.health.v1.d.ts +48 -103
- package/dist/grpc.health.v1.js +49 -20
- package/dist/grpc.health.v1.js.map +1 -1
- package/dist/grpc.metrics.v1.d.ts +45 -56
- package/dist/grpc.metrics.v1.js +44 -16
- package/dist/grpc.metrics.v1.js.map +1 -1
- package/dist/grpc.reflection.v1.d.ts +53 -228
- package/dist/grpc.reflection.v1.js +52 -24
- package/dist/grpc.reflection.v1.js.map +1 -1
- package/dist/grpc.reflection.v1alpha.d.ts +55 -230
- package/dist/grpc.reflection.v1alpha.js +53 -25
- package/dist/grpc.reflection.v1alpha.js.map +1 -1
- package/dist/index.google.js +2 -1
- package/dist/index.google.js.map +1 -1
- package/dist/index.google.protobuf.js +2 -1
- package/dist/index.google.protobuf.js.map +1 -1
- package/dist/index.grpc.error.js +2 -1
- package/dist/index.grpc.error.js.map +1 -1
- package/dist/index.grpc.health.js +2 -1
- package/dist/index.grpc.health.js.map +1 -1
- package/dist/index.grpc.js +2 -1
- package/dist/index.grpc.js.map +1 -1
- package/dist/index.grpc.metrics.js +2 -1
- package/dist/index.grpc.metrics.js.map +1 -1
- package/dist/index.grpc.reflection.js +2 -1
- package/dist/index.grpc.reflection.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/eslint.config.cjs +3 -0
- package/package.json +7 -5
- package/ppm.json +1 -1
- package/ppm.lock +5 -0
package/dist/grpc.health.v1.d.ts
CHANGED
|
@@ -3,111 +3,38 @@ import type { ChannelImplementation } from '@grpc/grpc-js/build/src/channel';
|
|
|
3
3
|
import type { CallOptions, DefaultCallOptions } from 'nice-grpc';
|
|
4
4
|
import type { NormalizedServiceDefinition } from 'nice-grpc/lib/service-definitions';
|
|
5
5
|
import type { Observable } from 'rxjs';
|
|
6
|
-
import { HealthDefinition } from './grpc/health/v1/health';
|
|
7
|
-
import { HealthCheckResponseServingStatus } from './grpc/health/v1/health';
|
|
6
|
+
import { HealthService as Health, HealthDefinition } from './grpc/health/v1/health';
|
|
8
7
|
import { HealthCheckRequest } from './grpc/health/v1/health';
|
|
9
8
|
import { HealthCheckResponse } from './grpc/health/v1/health';
|
|
10
|
-
|
|
9
|
+
import { HealthCheckResponseServingStatus } from './grpc/health/v1/health';
|
|
10
|
+
import { descriptor } from './descriptor';
|
|
11
|
+
type PackageMeta = {
|
|
11
12
|
name: string;
|
|
12
13
|
definitions: {
|
|
13
14
|
'grpc-js': {
|
|
14
|
-
Health:
|
|
15
|
-
readonly check: {
|
|
16
|
-
readonly path: "/grpc.health.v1.Health/Check";
|
|
17
|
-
readonly requestStream: false;
|
|
18
|
-
readonly responseStream: false;
|
|
19
|
-
readonly requestSerialize: (value: HealthCheckRequest) => Buffer<Uint8Array<ArrayBufferLike>>;
|
|
20
|
-
readonly requestDeserialize: (value: Buffer) => HealthCheckRequest;
|
|
21
|
-
readonly responseSerialize: (value: HealthCheckResponse) => Buffer<Uint8Array<ArrayBufferLike>>;
|
|
22
|
-
readonly responseDeserialize: (value: Buffer) => HealthCheckResponse;
|
|
23
|
-
};
|
|
24
|
-
readonly watch: {
|
|
25
|
-
readonly path: "/grpc.health.v1.Health/Watch";
|
|
26
|
-
readonly requestStream: false;
|
|
27
|
-
readonly responseStream: true;
|
|
28
|
-
readonly requestSerialize: (value: HealthCheckRequest) => Buffer<Uint8Array<ArrayBufferLike>>;
|
|
29
|
-
readonly requestDeserialize: (value: Buffer) => HealthCheckRequest;
|
|
30
|
-
readonly responseSerialize: (value: HealthCheckResponse) => Buffer<Uint8Array<ArrayBufferLike>>;
|
|
31
|
-
readonly responseDeserialize: (value: Buffer) => HealthCheckResponse;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
15
|
+
Health: typeof Health;
|
|
34
16
|
};
|
|
35
|
-
generic: {
|
|
36
|
-
HealthDefinition:
|
|
37
|
-
readonly name: "Health";
|
|
38
|
-
readonly fullName: "grpc.health.v1.Health";
|
|
39
|
-
readonly methods: {
|
|
40
|
-
readonly check: {
|
|
41
|
-
readonly name: "Check";
|
|
42
|
-
readonly requestType: {
|
|
43
|
-
$type: "grpc.health.v1.HealthCheckRequest";
|
|
44
|
-
encode(message: HealthCheckRequest, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
|
45
|
-
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): HealthCheckRequest;
|
|
46
|
-
fromJSON(object: any): HealthCheckRequest;
|
|
47
|
-
toJSON(message: HealthCheckRequest): unknown;
|
|
48
|
-
create(base?: {
|
|
49
|
-
readonly service?: string | undefined;
|
|
50
|
-
}): HealthCheckRequest;
|
|
51
|
-
fromPartial(object: {
|
|
52
|
-
readonly service?: string | undefined;
|
|
53
|
-
}): HealthCheckRequest;
|
|
54
|
-
};
|
|
55
|
-
readonly requestStream: false;
|
|
56
|
-
readonly responseType: {
|
|
57
|
-
$type: "grpc.health.v1.HealthCheckResponse";
|
|
58
|
-
encode(message: HealthCheckResponse, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
|
59
|
-
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): HealthCheckResponse;
|
|
60
|
-
fromJSON(object: any): HealthCheckResponse;
|
|
61
|
-
toJSON(message: HealthCheckResponse): unknown;
|
|
62
|
-
create(base?: {
|
|
63
|
-
readonly status?: HealthCheckResponseServingStatus | undefined;
|
|
64
|
-
}): HealthCheckResponse;
|
|
65
|
-
fromPartial(object: {
|
|
66
|
-
readonly status?: HealthCheckResponseServingStatus | undefined;
|
|
67
|
-
}): HealthCheckResponse;
|
|
68
|
-
};
|
|
69
|
-
readonly responseStream: false;
|
|
70
|
-
readonly options: {};
|
|
71
|
-
};
|
|
72
|
-
readonly watch: {
|
|
73
|
-
readonly name: "Watch";
|
|
74
|
-
readonly requestType: {
|
|
75
|
-
$type: "grpc.health.v1.HealthCheckRequest";
|
|
76
|
-
encode(message: HealthCheckRequest, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
|
77
|
-
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): HealthCheckRequest;
|
|
78
|
-
fromJSON(object: any): HealthCheckRequest;
|
|
79
|
-
toJSON(message: HealthCheckRequest): unknown;
|
|
80
|
-
create(base?: {
|
|
81
|
-
readonly service?: string | undefined;
|
|
82
|
-
}): HealthCheckRequest;
|
|
83
|
-
fromPartial(object: {
|
|
84
|
-
readonly service?: string | undefined;
|
|
85
|
-
}): HealthCheckRequest;
|
|
86
|
-
};
|
|
87
|
-
readonly requestStream: false;
|
|
88
|
-
readonly responseType: {
|
|
89
|
-
$type: "grpc.health.v1.HealthCheckResponse";
|
|
90
|
-
encode(message: HealthCheckResponse, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
|
91
|
-
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): HealthCheckResponse;
|
|
92
|
-
fromJSON(object: any): HealthCheckResponse;
|
|
93
|
-
toJSON(message: HealthCheckResponse): unknown;
|
|
94
|
-
create(base?: {
|
|
95
|
-
readonly status?: HealthCheckResponseServingStatus | undefined;
|
|
96
|
-
}): HealthCheckResponse;
|
|
97
|
-
fromPartial(object: {
|
|
98
|
-
readonly status?: HealthCheckResponseServingStatus | undefined;
|
|
99
|
-
}): HealthCheckResponse;
|
|
100
|
-
};
|
|
101
|
-
readonly responseStream: true;
|
|
102
|
-
readonly options: {};
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
};
|
|
17
|
+
'generic': {
|
|
18
|
+
HealthDefinition: typeof HealthDefinition;
|
|
106
19
|
};
|
|
107
20
|
};
|
|
108
|
-
descriptor:
|
|
21
|
+
descriptor: typeof descriptor;
|
|
109
22
|
};
|
|
110
|
-
|
|
23
|
+
declare const pkg: PackageMeta;
|
|
24
|
+
export default pkg;
|
|
25
|
+
export interface IHealthController {
|
|
26
|
+
check(request: HealthCheckRequest, metadata?: Metadata): HealthCheckResponse | Promise<HealthCheckResponse> | Observable<HealthCheckResponse>;
|
|
27
|
+
watch(request: HealthCheckRequest, metadata?: Metadata): Observable<HealthCheckResponse>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Decorates HealthNatsController methods with
|
|
31
|
+
* @ConsumeRequest() decorator (which is @MessagePattern under the hood).
|
|
32
|
+
* Hence, you don't need any individual method decorating any more.
|
|
33
|
+
*/
|
|
34
|
+
export declare function HealthNatsMethods(): any;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated use IHealthController instead
|
|
37
|
+
*/
|
|
111
38
|
export interface HealthGrpcController {
|
|
112
39
|
check(request: HealthCheckRequest, metadata?: Metadata): HealthCheckResponse | Promise<HealthCheckResponse> | Observable<HealthCheckResponse>;
|
|
113
40
|
watch(request: HealthCheckRequest, metadata?: Metadata): Observable<HealthCheckResponse>;
|
|
@@ -115,7 +42,7 @@ export interface HealthGrpcController {
|
|
|
115
42
|
/**
|
|
116
43
|
* Decorates HealthGrpcController methods with
|
|
117
44
|
* @GrpcStreamMethod() and @GrpcMethod() decorators (which are @MessagePattern
|
|
118
|
-
* under the hood).
|
|
45
|
+
* under the hood). Hence, you don't need any individual method decorating
|
|
119
46
|
* any more.
|
|
120
47
|
*/
|
|
121
48
|
export declare function HealthGrpcMethods(): any;
|
|
@@ -130,16 +57,34 @@ export interface HealthClient<CallOptionsExt = {}> {
|
|
|
130
57
|
* @see https://github.com/deeplay-io/nice-grpc/tree/master/packages/nice-grpc#client
|
|
131
58
|
*/
|
|
132
59
|
export declare function createHealthClient<CallOptionsExt = {}>(channel: ChannelImplementation, defaultCallOptions?: DefaultCallOptions<NormalizedServiceDefinition<HealthDefinition>>): HealthClient<CallOptionsExt>;
|
|
133
|
-
export { HealthCheckResponseServingStatus };
|
|
134
60
|
export { HealthCheckRequest };
|
|
135
61
|
export { HealthCheckResponse };
|
|
62
|
+
export { HealthCheckResponseServingStatus };
|
|
136
63
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
137
|
-
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
138
|
-
$case: string;
|
|
64
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
65
|
+
readonly $case: string;
|
|
66
|
+
value: unknown;
|
|
139
67
|
} ? {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
$case: T["$case"];
|
|
68
|
+
readonly $case: T["$case"];
|
|
69
|
+
value?: DeepPartial<T["value"]>;
|
|
143
70
|
} : T extends {} ? {
|
|
144
71
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
145
72
|
} : Partial<T>;
|
|
73
|
+
export type DeepNonNullable<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepNonNullable<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepNonNullable<U>> : T extends {
|
|
74
|
+
readonly $case: string;
|
|
75
|
+
value: unknown;
|
|
76
|
+
} ? {
|
|
77
|
+
readonly $case: T["$case"];
|
|
78
|
+
value: DeepNonNullable<T["value"]>;
|
|
79
|
+
} : T extends {} ? {
|
|
80
|
+
[K in keyof T]: DeepNonNullable<NonNullable<T[K]>>;
|
|
81
|
+
} : NonNullable<T>;
|
|
82
|
+
export type DeepNonUndefined<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepNonUndefined<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepNonUndefined<U>> : T extends {
|
|
83
|
+
readonly $case: string;
|
|
84
|
+
value: unknown;
|
|
85
|
+
} ? {
|
|
86
|
+
readonly $case: T["$case"];
|
|
87
|
+
value: DeepNonUndefined<T["value"]>;
|
|
88
|
+
} : T extends {} ? {
|
|
89
|
+
[K in keyof T]: DeepNonUndefined<Exclude<T[K], undefined>>;
|
|
90
|
+
} : Exclude<T, undefined>;
|
package/dist/grpc.health.v1.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.HealthCheckResponseServingStatus = exports.HealthCheckResponse = exports.HealthCheckRequest = void 0;
|
|
4
|
+
exports.HealthNatsMethods = HealthNatsMethods;
|
|
4
5
|
exports.HealthGrpcMethods = HealthGrpcMethods;
|
|
5
6
|
exports.createHealthClient = createHealthClient;
|
|
6
7
|
// *Service is definition from grpc-js (used for Nest.js gRPC transport)
|
|
7
8
|
// *Definition is generic definition (used for NiceGrpc clients)
|
|
8
9
|
const health_1 = require("./grpc/health/v1/health");
|
|
9
10
|
const health_2 = require("./grpc/health/v1/health");
|
|
10
|
-
Object.defineProperty(exports, "
|
|
11
|
+
Object.defineProperty(exports, "HealthCheckRequest", { enumerable: true, get: function () { return health_2.HealthCheckRequest; } });
|
|
11
12
|
const health_3 = require("./grpc/health/v1/health");
|
|
12
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "HealthCheckResponse", { enumerable: true, get: function () { return health_3.HealthCheckResponse; } });
|
|
13
14
|
const health_4 = require("./grpc/health/v1/health");
|
|
14
|
-
Object.defineProperty(exports, "
|
|
15
|
+
Object.defineProperty(exports, "HealthCheckResponseServingStatus", { enumerable: true, get: function () { return health_4.HealthCheckResponseServingStatus; } });
|
|
15
16
|
const descriptor_1 = require("./descriptor");
|
|
16
|
-
|
|
17
|
-
// TODO type it with Package interface from @platform/grpc when it is deployed
|
|
18
|
-
exports.default = {
|
|
17
|
+
const pkg = {
|
|
19
18
|
name: 'grpc.health.v1',
|
|
20
19
|
definitions: {
|
|
21
20
|
'grpc-js': { Health: health_1.HealthService },
|
|
@@ -23,29 +22,59 @@ exports.default = {
|
|
|
23
22
|
},
|
|
24
23
|
descriptor: descriptor_1.descriptor,
|
|
25
24
|
};
|
|
25
|
+
exports.default = pkg;
|
|
26
26
|
// Just helper function to ease decorators generation
|
|
27
27
|
function apply(decorator, constructor, method, serviceName) {
|
|
28
28
|
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
29
|
-
|
|
29
|
+
if (descriptor) {
|
|
30
|
+
decorator(serviceName, method)(constructor.prototype[method], method, descriptor);
|
|
31
|
+
/**
|
|
32
|
+
* NOTE: In @nestjs/microservices starting from version 10.4.9,
|
|
33
|
+
* the @GrpcStreamMethod decorator replaces the function in the descriptor
|
|
34
|
+
* (see: https://github.com/nestjs/nest/blob/v10.4.9/packages/microservices/decorators/message-pattern.decorator.ts#L151).
|
|
35
|
+
*
|
|
36
|
+
* This fix explicitly redefines the method with the modified descriptor
|
|
37
|
+
* to ensure the new wrapper function is preserved
|
|
38
|
+
* and the request does not hang.
|
|
39
|
+
*/
|
|
40
|
+
Object.defineProperty(constructor.prototype, method, descriptor);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function applyRequest(decorator, constructor, method, request, response) {
|
|
44
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
45
|
+
decorator(request, response)(constructor.prototype[method], method, descriptor);
|
|
46
|
+
}
|
|
47
|
+
function requireProjectDependency(requireId) {
|
|
48
|
+
try {
|
|
49
|
+
// if install from npm registry
|
|
50
|
+
return require(requireId);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// if install as local package over `file:../`
|
|
54
|
+
// https://classic.yarnpkg.com/lang/en/docs/pnp/troubleshooting/#toc-is-trying-to-require-without-it-being-listed-in-its-dependencies
|
|
55
|
+
return require(require.resolve(requireId, { paths: [process.cwd()] }));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Decorates HealthNatsController methods with
|
|
60
|
+
* @ConsumeRequest() decorator (which is @MessagePattern under the hood).
|
|
61
|
+
* Hence, you don't need any individual method decorating any more.
|
|
62
|
+
*/
|
|
63
|
+
function HealthNatsMethods() {
|
|
64
|
+
const { Controller, applyDecorators } = requireProjectDependency('@nestjs/common');
|
|
65
|
+
const { ConsumeRequest } = requireProjectDependency('@rsdk/nats.transport');
|
|
66
|
+
return applyDecorators(Controller(), function (constructor) {
|
|
67
|
+
applyRequest(ConsumeRequest, constructor, 'check', health_2.HealthCheckRequest, health_3.HealthCheckResponse);
|
|
68
|
+
applyRequest(ConsumeRequest, constructor, 'watch', health_2.HealthCheckRequest, health_3.HealthCheckResponse);
|
|
69
|
+
});
|
|
30
70
|
}
|
|
31
71
|
/**
|
|
32
72
|
* Decorates HealthGrpcController methods with
|
|
33
73
|
* @GrpcStreamMethod() and @GrpcMethod() decorators (which are @MessagePattern
|
|
34
|
-
* under the hood).
|
|
74
|
+
* under the hood). Hence, you don't need any individual method decorating
|
|
35
75
|
* any more.
|
|
36
76
|
*/
|
|
37
77
|
function HealthGrpcMethods() {
|
|
38
|
-
const requireProjectDependency = (requireId) => {
|
|
39
|
-
try {
|
|
40
|
-
// if install from npm registry
|
|
41
|
-
return require(requireId);
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
// if install as local package over `file:../`
|
|
45
|
-
// https://classic.yarnpkg.com/lang/en/docs/pnp/troubleshooting/#toc-is-trying-to-require-without-it-being-listed-in-its-dependencies
|
|
46
|
-
return require(require.resolve(requireId, { paths: [process.cwd()] }));
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
78
|
const { Controller, applyDecorators } = requireProjectDependency('@nestjs/common');
|
|
50
79
|
const { GrpcMethod, GrpcStreamMethod } = requireProjectDependency('@nestjs/microservices');
|
|
51
80
|
return applyDecorators(Controller(), function (constructor) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc.health.v1.js","sourceRoot":"","sources":["../.generated/grpc.health.v1.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"grpc.health.v1.js","sourceRoot":"","sources":["../.generated/grpc.health.v1.ts"],"names":[],"mappings":";;;AA2GE,8CAUC;AAcD,8CAUC;AAaD,gDAGC;AA5ID,wEAAwE;AACxE,gEAAgE;AAC9D,oDAAoF;AACpF,oDAA6D;AA0IpD,mGA1IA,2BAAkB,OA0IA;AAzI3B,oDAA8D;AA0IrD,oGA1IA,4BAAmB,OA0IA;AAzI5B,oDAA2E;AA0IlE,iHA1IA,yCAAgC,OA0IA;AAzI3C,6CAA0C;AAgB1C,MAAM,GAAG,GAAgB;IACvB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE;QACX,SAAS,EAAE,EAAE,MAAM,EAAN,sBAAM,EAAE;QACrB,SAAS,EAAE,EAAE,gBAAgB,EAAhB,yBAAgB,EAAE;KAChC;IACD,UAAU,EAAE,uBAAU;CACvB,CAAC;AACF,kBAAe,GAAG,CAAC;AACnB,qDAAqD;AACrD,SAAS,KAAK,C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,CAAC,CAAC;IAC5E,OAAO,eAAe,CACpB,UAAU,EAAE,EACZ,UAAU,WAAqB;QAC3B,YAAY,CAAC,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,2BAAkB,EAAE,4BAAmB,CAAC,CAAC;QAC5F,YAAY,CAAC,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,2BAAkB,EAAE,4BAAmB,CAAC,CAAC;IAChG,CAAC,CACF,CAAC;AACJ,CAAC;AAQD;;;;;EAKE;AACF,SAAgB,iBAAiB;IAC/B,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;IACnF,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;IAC3F,OAAO,eAAe,CACpB,UAAU,EAAE,EACZ,UAAU,WAAqB;QAC3B,KAAK,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAClD,KAAK,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC,CACF,CAAC;AACJ,CAAC;AAOD;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAsB,OAA8B,EAAE,kBAAsF;IAC5K,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9C,OAAO,YAAY,CAAC,yBAAgB,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -3,72 +3,43 @@ import type { ChannelImplementation } from '@grpc/grpc-js/build/src/channel';
|
|
|
3
3
|
import type { CallOptions, DefaultCallOptions } from 'nice-grpc';
|
|
4
4
|
import type { NormalizedServiceDefinition } from 'nice-grpc/lib/service-definitions';
|
|
5
5
|
import type { Observable } from 'rxjs';
|
|
6
|
-
import { MetricsDefinition } from './grpc/metrics/v1/metrics';
|
|
6
|
+
import { MetricsService as Metrics, MetricsDefinition } from './grpc/metrics/v1/metrics';
|
|
7
7
|
import { GetRequest } from './grpc/metrics/v1/metrics';
|
|
8
8
|
import { GetResponse } from './grpc/metrics/v1/metrics';
|
|
9
|
-
|
|
9
|
+
import { descriptor } from './descriptor';
|
|
10
|
+
type PackageMeta = {
|
|
10
11
|
name: string;
|
|
11
12
|
definitions: {
|
|
12
13
|
'grpc-js': {
|
|
13
|
-
Metrics:
|
|
14
|
-
readonly get: {
|
|
15
|
-
readonly path: "/grpc.metrics.v1.Metrics/Get";
|
|
16
|
-
readonly requestStream: false;
|
|
17
|
-
readonly responseStream: false;
|
|
18
|
-
readonly requestSerialize: (value: GetRequest) => Buffer<Uint8Array<ArrayBufferLike>>;
|
|
19
|
-
readonly requestDeserialize: (value: Buffer) => GetRequest;
|
|
20
|
-
readonly responseSerialize: (value: GetResponse) => Buffer<Uint8Array<ArrayBufferLike>>;
|
|
21
|
-
readonly responseDeserialize: (value: Buffer) => GetResponse;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
14
|
+
Metrics: typeof Metrics;
|
|
24
15
|
};
|
|
25
|
-
generic: {
|
|
26
|
-
MetricsDefinition:
|
|
27
|
-
readonly name: "Metrics";
|
|
28
|
-
readonly fullName: "grpc.metrics.v1.Metrics";
|
|
29
|
-
readonly methods: {
|
|
30
|
-
readonly get: {
|
|
31
|
-
readonly name: "Get";
|
|
32
|
-
readonly requestType: {
|
|
33
|
-
$type: "grpc.metrics.v1.GetRequest";
|
|
34
|
-
encode(_: GetRequest, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
|
35
|
-
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): GetRequest;
|
|
36
|
-
fromJSON(_: any): GetRequest;
|
|
37
|
-
toJSON(_: GetRequest): unknown;
|
|
38
|
-
create(base?: {}): GetRequest;
|
|
39
|
-
fromPartial(_: {}): GetRequest;
|
|
40
|
-
};
|
|
41
|
-
readonly requestStream: false;
|
|
42
|
-
readonly responseType: {
|
|
43
|
-
$type: "grpc.metrics.v1.GetResponse";
|
|
44
|
-
encode(message: GetResponse, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
|
45
|
-
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): GetResponse;
|
|
46
|
-
fromJSON(object: any): GetResponse;
|
|
47
|
-
toJSON(message: GetResponse): unknown;
|
|
48
|
-
create(base?: {
|
|
49
|
-
readonly metrics?: string | undefined;
|
|
50
|
-
}): GetResponse;
|
|
51
|
-
fromPartial(object: {
|
|
52
|
-
readonly metrics?: string | undefined;
|
|
53
|
-
}): GetResponse;
|
|
54
|
-
};
|
|
55
|
-
readonly responseStream: false;
|
|
56
|
-
readonly options: {};
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
};
|
|
16
|
+
'generic': {
|
|
17
|
+
MetricsDefinition: typeof MetricsDefinition;
|
|
60
18
|
};
|
|
61
19
|
};
|
|
62
|
-
descriptor:
|
|
20
|
+
descriptor: typeof descriptor;
|
|
63
21
|
};
|
|
64
|
-
|
|
22
|
+
declare const pkg: PackageMeta;
|
|
23
|
+
export default pkg;
|
|
24
|
+
export interface IMetricsController {
|
|
25
|
+
get(request: GetRequest, metadata?: Metadata): GetResponse | Promise<GetResponse> | Observable<GetResponse>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Decorates MetricsNatsController methods with
|
|
29
|
+
* @ConsumeRequest() decorator (which is @MessagePattern under the hood).
|
|
30
|
+
* Hence, you don't need any individual method decorating any more.
|
|
31
|
+
*/
|
|
32
|
+
export declare function MetricsNatsMethods(): any;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated use IMetricsController instead
|
|
35
|
+
*/
|
|
65
36
|
export interface MetricsGrpcController {
|
|
66
37
|
get(request: GetRequest, metadata?: Metadata): GetResponse | Promise<GetResponse> | Observable<GetResponse>;
|
|
67
38
|
}
|
|
68
39
|
/**
|
|
69
40
|
* Decorates MetricsGrpcController methods with
|
|
70
41
|
* @GrpcStreamMethod() and @GrpcMethod() decorators (which are @MessagePattern
|
|
71
|
-
* under the hood).
|
|
42
|
+
* under the hood). Hence, you don't need any individual method decorating
|
|
72
43
|
* any more.
|
|
73
44
|
*/
|
|
74
45
|
export declare function MetricsGrpcMethods(): any;
|
|
@@ -85,12 +56,30 @@ export declare function createMetricsClient<CallOptionsExt = {}>(channel: Channe
|
|
|
85
56
|
export { GetRequest };
|
|
86
57
|
export { GetResponse };
|
|
87
58
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
88
|
-
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
89
|
-
$case: string;
|
|
59
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
60
|
+
readonly $case: string;
|
|
61
|
+
value: unknown;
|
|
90
62
|
} ? {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
$case: T["$case"];
|
|
63
|
+
readonly $case: T["$case"];
|
|
64
|
+
value?: DeepPartial<T["value"]>;
|
|
94
65
|
} : T extends {} ? {
|
|
95
66
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
96
67
|
} : Partial<T>;
|
|
68
|
+
export type DeepNonNullable<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepNonNullable<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepNonNullable<U>> : T extends {
|
|
69
|
+
readonly $case: string;
|
|
70
|
+
value: unknown;
|
|
71
|
+
} ? {
|
|
72
|
+
readonly $case: T["$case"];
|
|
73
|
+
value: DeepNonNullable<T["value"]>;
|
|
74
|
+
} : T extends {} ? {
|
|
75
|
+
[K in keyof T]: DeepNonNullable<NonNullable<T[K]>>;
|
|
76
|
+
} : NonNullable<T>;
|
|
77
|
+
export type DeepNonUndefined<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepNonUndefined<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepNonUndefined<U>> : T extends {
|
|
78
|
+
readonly $case: string;
|
|
79
|
+
value: unknown;
|
|
80
|
+
} ? {
|
|
81
|
+
readonly $case: T["$case"];
|
|
82
|
+
value: DeepNonUndefined<T["value"]>;
|
|
83
|
+
} : T extends {} ? {
|
|
84
|
+
[K in keyof T]: DeepNonUndefined<Exclude<T[K], undefined>>;
|
|
85
|
+
} : Exclude<T, undefined>;
|
package/dist/grpc.metrics.v1.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetResponse = exports.GetRequest = void 0;
|
|
4
|
+
exports.MetricsNatsMethods = MetricsNatsMethods;
|
|
4
5
|
exports.MetricsGrpcMethods = MetricsGrpcMethods;
|
|
5
6
|
exports.createMetricsClient = createMetricsClient;
|
|
6
7
|
// *Service is definition from grpc-js (used for Nest.js gRPC transport)
|
|
@@ -11,9 +12,7 @@ Object.defineProperty(exports, "GetRequest", { enumerable: true, get: function (
|
|
|
11
12
|
const metrics_3 = require("./grpc/metrics/v1/metrics");
|
|
12
13
|
Object.defineProperty(exports, "GetResponse", { enumerable: true, get: function () { return metrics_3.GetResponse; } });
|
|
13
14
|
const descriptor_1 = require("./descriptor");
|
|
14
|
-
|
|
15
|
-
// TODO type it with Package interface from @platform/grpc when it is deployed
|
|
16
|
-
exports.default = {
|
|
15
|
+
const pkg = {
|
|
17
16
|
name: 'grpc.metrics.v1',
|
|
18
17
|
definitions: {
|
|
19
18
|
'grpc-js': { Metrics: metrics_1.MetricsService },
|
|
@@ -21,29 +20,58 @@ exports.default = {
|
|
|
21
20
|
},
|
|
22
21
|
descriptor: descriptor_1.descriptor,
|
|
23
22
|
};
|
|
23
|
+
exports.default = pkg;
|
|
24
24
|
// Just helper function to ease decorators generation
|
|
25
25
|
function apply(decorator, constructor, method, serviceName) {
|
|
26
26
|
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
27
|
-
|
|
27
|
+
if (descriptor) {
|
|
28
|
+
decorator(serviceName, method)(constructor.prototype[method], method, descriptor);
|
|
29
|
+
/**
|
|
30
|
+
* NOTE: In @nestjs/microservices starting from version 10.4.9,
|
|
31
|
+
* the @GrpcStreamMethod decorator replaces the function in the descriptor
|
|
32
|
+
* (see: https://github.com/nestjs/nest/blob/v10.4.9/packages/microservices/decorators/message-pattern.decorator.ts#L151).
|
|
33
|
+
*
|
|
34
|
+
* This fix explicitly redefines the method with the modified descriptor
|
|
35
|
+
* to ensure the new wrapper function is preserved
|
|
36
|
+
* and the request does not hang.
|
|
37
|
+
*/
|
|
38
|
+
Object.defineProperty(constructor.prototype, method, descriptor);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function applyRequest(decorator, constructor, method, request, response) {
|
|
42
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
43
|
+
decorator(request, response)(constructor.prototype[method], method, descriptor);
|
|
44
|
+
}
|
|
45
|
+
function requireProjectDependency(requireId) {
|
|
46
|
+
try {
|
|
47
|
+
// if install from npm registry
|
|
48
|
+
return require(requireId);
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// if install as local package over `file:../`
|
|
52
|
+
// https://classic.yarnpkg.com/lang/en/docs/pnp/troubleshooting/#toc-is-trying-to-require-without-it-being-listed-in-its-dependencies
|
|
53
|
+
return require(require.resolve(requireId, { paths: [process.cwd()] }));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Decorates MetricsNatsController methods with
|
|
58
|
+
* @ConsumeRequest() decorator (which is @MessagePattern under the hood).
|
|
59
|
+
* Hence, you don't need any individual method decorating any more.
|
|
60
|
+
*/
|
|
61
|
+
function MetricsNatsMethods() {
|
|
62
|
+
const { Controller, applyDecorators } = requireProjectDependency('@nestjs/common');
|
|
63
|
+
const { ConsumeRequest } = requireProjectDependency('@rsdk/nats.transport');
|
|
64
|
+
return applyDecorators(Controller(), function (constructor) {
|
|
65
|
+
applyRequest(ConsumeRequest, constructor, 'get', metrics_2.GetRequest, metrics_3.GetResponse);
|
|
66
|
+
});
|
|
28
67
|
}
|
|
29
68
|
/**
|
|
30
69
|
* Decorates MetricsGrpcController methods with
|
|
31
70
|
* @GrpcStreamMethod() and @GrpcMethod() decorators (which are @MessagePattern
|
|
32
|
-
* under the hood).
|
|
71
|
+
* under the hood). Hence, you don't need any individual method decorating
|
|
33
72
|
* any more.
|
|
34
73
|
*/
|
|
35
74
|
function MetricsGrpcMethods() {
|
|
36
|
-
const requireProjectDependency = (requireId) => {
|
|
37
|
-
try {
|
|
38
|
-
// if install from npm registry
|
|
39
|
-
return require(requireId);
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
// if install as local package over `file:../`
|
|
43
|
-
// https://classic.yarnpkg.com/lang/en/docs/pnp/troubleshooting/#toc-is-trying-to-require-without-it-being-listed-in-its-dependencies
|
|
44
|
-
return require(require.resolve(requireId, { paths: [process.cwd()] }));
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
75
|
const { Controller, applyDecorators } = requireProjectDependency('@nestjs/common');
|
|
48
76
|
const { GrpcMethod, GrpcStreamMethod } = requireProjectDependency('@nestjs/microservices');
|
|
49
77
|
return applyDecorators(Controller(), function (constructor) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc.metrics.v1.js","sourceRoot":"","sources":["../.generated/grpc.metrics.v1.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"grpc.metrics.v1.js","sourceRoot":"","sources":["../.generated/grpc.metrics.v1.ts"],"names":[],"mappings":";;;AAyGE,gDASC;AAaD,gDASC;AAYD,kDAGC;AAtID,wEAAwE;AACxE,gEAAgE;AAC9D,uDAAyF;AACzF,uDAAuD;AAoI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