@hodfords/nestjs-grpc-helper 10.0.1 → 10.0.3
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/decorators/extend-type.decorator.js +2 -1
- package/decorators/extend-type.decorator.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/type-helpers/intersection-type.helper.d.ts +8 -0
- package/type-helpers/intersection-type.helper.js +20 -0
- package/type-helpers/intersection-type.helper.js.map +1 -0
|
@@ -6,7 +6,8 @@ function ExtendType() {
|
|
|
6
6
|
return function ClassDecorator(constructor) {
|
|
7
7
|
let properties = property_storage_1.propertyStorage.get(Object.getPrototypeOf(constructor));
|
|
8
8
|
property_storage_1.propertyStorage.delete(Object.getPrototypeOf(constructor));
|
|
9
|
-
property_storage_1.propertyStorage.
|
|
9
|
+
let newProperties = property_storage_1.propertyStorage.get(constructor) || [];
|
|
10
|
+
property_storage_1.propertyStorage.set(constructor, [...properties, ...newProperties]);
|
|
10
11
|
if (property_storage_1.sdkDtos.has(Object.getPrototypeOf(constructor))) {
|
|
11
12
|
property_storage_1.sdkDtos.delete(Object.getPrototypeOf(constructor));
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extend-type.decorator.js","sourceRoot":"","sources":["../../../libs/decorators/extend-type.decorator.ts"],"names":[],"mappings":";;;AAAA,mEAAwE;AAExE,SAAgB,UAAU;IACtB,OAAO,SAAS,cAAc,CAAyC,WAAc;QACjF,IAAI,UAAU,GAAG,kCAAe,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;QACzE,kCAAe,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;QAC3D,kCAAe,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"extend-type.decorator.js","sourceRoot":"","sources":["../../../libs/decorators/extend-type.decorator.ts"],"names":[],"mappings":";;;AAAA,mEAAwE;AAExE,SAAgB,UAAU;IACtB,OAAO,SAAS,cAAc,CAAyC,WAAc;QACjF,IAAI,UAAU,GAAG,kCAAe,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;QACzE,kCAAe,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;QAC3D,IAAI,aAAa,GAAG,kCAAe,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC3D,kCAAe,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC;QAEpE,IAAI,0BAAO,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;YAClD,0BAAO,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;QACvD,CAAC;QACD,0BAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAEzB,OAAO,WAAW,CAAC;IACvB,CAAC,CAAC;AACN,CAAC;AAdD,gCAcC"}
|
package/index.d.ts
CHANGED
|
@@ -2,8 +2,10 @@ export * from './decorators/microservice.decorator';
|
|
|
2
2
|
export * from './decorators/property.decorator';
|
|
3
3
|
export * from './decorators/mock.decorator';
|
|
4
4
|
export * from './decorators/grpc-value.decorator';
|
|
5
|
+
export * from './decorators/extend-type.decorator';
|
|
5
6
|
export * from './helpers/generate.helper';
|
|
6
7
|
export * from './helpers/mock.helper';
|
|
8
|
+
export * from './type-helpers/pick-type.helper';
|
|
7
9
|
export * from './types/property-option.type';
|
|
8
10
|
export * from './sdk-stub/helpers/grpc.helper';
|
|
9
11
|
export * from './documents/microservice-document.module';
|
package/index.js
CHANGED
|
@@ -18,8 +18,10 @@ __exportStar(require("./decorators/microservice.decorator"), exports);
|
|
|
18
18
|
__exportStar(require("./decorators/property.decorator"), exports);
|
|
19
19
|
__exportStar(require("./decorators/mock.decorator"), exports);
|
|
20
20
|
__exportStar(require("./decorators/grpc-value.decorator"), exports);
|
|
21
|
+
__exportStar(require("./decorators/extend-type.decorator"), exports);
|
|
21
22
|
__exportStar(require("./helpers/generate.helper"), exports);
|
|
22
23
|
__exportStar(require("./helpers/mock.helper"), exports);
|
|
24
|
+
__exportStar(require("./type-helpers/pick-type.helper"), exports);
|
|
23
25
|
__exportStar(require("./types/property-option.type"), exports);
|
|
24
26
|
__exportStar(require("./sdk-stub/helpers/grpc.helper"), exports);
|
|
25
27
|
__exportStar(require("./documents/microservice-document.module"), exports);
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../libs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAAoD;AACpD,kEAAgD;AAChD,8DAA4C;AAC5C,oEAAkD;AAClD,4DAA0C;AAC1C,wDAAsC;AACtC,+DAA6C;AAC7C,iEAA+C;AAC/C,2EAAyD;AACzD,+DAA6C;AAC7C,4DAA0C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../libs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAAoD;AACpD,kEAAgD;AAChD,8DAA4C;AAC5C,oEAAkD;AAClD,qEAAmD;AACnD,4DAA0C;AAC1C,wDAAsC;AACtC,kEAAgD;AAChD,+DAA6C;AAC7C,iEAA+C;AAC/C,2EAAyD;AACzD,+DAA6C;AAC7C,4DAA0C"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Type } from '@nestjs/common';
|
|
2
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
3
|
+
type ClassRefsToConstructors<T extends Type[]> = {
|
|
4
|
+
[U in keyof T]: T[U] extends Type<infer V> ? V : never;
|
|
5
|
+
};
|
|
6
|
+
type Intersection<T extends Type[]> = Type<UnionToIntersection<ClassRefsToConstructors<T>[number]>>;
|
|
7
|
+
export declare function IntersectionResponseType<T extends Type[]>(...classRefs: T): Intersection<T>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IntersectionResponseType = void 0;
|
|
4
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
5
|
+
const property_storage_1 = require("../storages/property.storage");
|
|
6
|
+
const nestjs_grpc_helper_1 = require("..");
|
|
7
|
+
function IntersectionResponseType(...classRefs) {
|
|
8
|
+
const swaggerIntersectionType = (0, swagger_1.IntersectionType)(...classRefs);
|
|
9
|
+
class IntersectionTypeClass extends swaggerIntersectionType {
|
|
10
|
+
}
|
|
11
|
+
for (const classRef of classRefs) {
|
|
12
|
+
let properties = property_storage_1.propertyStorage.get(classRef);
|
|
13
|
+
for (const property of properties) {
|
|
14
|
+
(0, nestjs_grpc_helper_1.addPropertyToStorage)(IntersectionTypeClass, property.name, property.option);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return IntersectionTypeClass;
|
|
18
|
+
}
|
|
19
|
+
exports.IntersectionResponseType = IntersectionResponseType;
|
|
20
|
+
//# sourceMappingURL=intersection-type.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intersection-type.helper.js","sourceRoot":"","sources":["../../../libs/type-helpers/intersection-type.helper.ts"],"names":[],"mappings":";;;AACA,6CAAmD;AACnD,mEAA+D;AAC/D,2CAAoE;AAUpE,SAAgB,wBAAwB,CAAmB,GAAG,SAAY;IACtE,MAAM,uBAAuB,GAAQ,IAAA,0BAAgB,EAAC,GAAG,SAAS,CAAC,CAAC;IAEpE,MAAe,qBAAsB,SAAQ,uBAAuB;KAAG;IAEvE,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QAC/B,IAAI,UAAU,GAAG,kCAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC/C,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;YAChC,IAAA,yCAAoB,EAAC,qBAAqB,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QAChF,CAAC;IACL,CAAC;IACD,OAAO,qBAAwC,CAAC;AACpD,CAAC;AAZD,4DAYC"}
|