@hodfords/nestjs-grpc-helper 10.0.4 → 10.0.5
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 +12 -5
- package/decorators/extend-type.decorator.js.map +1 -1
- package/helpers/property.helper.js +6 -1
- package/helpers/property.helper.js.map +1 -1
- package/package.json +1 -1
- package/type-helpers/pick-type.helper.js +1 -1
- package/type-helpers/pick-type.helper.js.map +1 -1
|
@@ -2,16 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ExtendType = void 0;
|
|
4
4
|
const property_storage_1 = require("../storages/property.storage");
|
|
5
|
+
const extendClassNames = ['IntersectionTypeClass', 'PickTypeClass', 'OmitTypeClass', 'PartialTypeClass'];
|
|
5
6
|
function ExtendType() {
|
|
6
7
|
return function ClassDecorator(constructor) {
|
|
7
|
-
|
|
8
|
-
property_storage_1.propertyStorage.
|
|
8
|
+
const parentClass = Object.getPrototypeOf(constructor);
|
|
9
|
+
let properties = property_storage_1.propertyStorage.get(parentClass) || [];
|
|
9
10
|
let newProperties = property_storage_1.propertyStorage.get(constructor) || [];
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
for (const property of properties) {
|
|
12
|
+
if (!newProperties.some((newProperty) => newProperty.name === property.name)) {
|
|
13
|
+
newProperties.push(property);
|
|
14
|
+
}
|
|
13
15
|
}
|
|
16
|
+
property_storage_1.propertyStorage.set(constructor, newProperties);
|
|
14
17
|
property_storage_1.sdkDtos.add(constructor);
|
|
18
|
+
if (extendClassNames.includes(parentClass.name)) {
|
|
19
|
+
property_storage_1.propertyStorage.delete(parentClass);
|
|
20
|
+
property_storage_1.sdkDtos.delete(parentClass);
|
|
21
|
+
}
|
|
15
22
|
return constructor;
|
|
16
23
|
};
|
|
17
24
|
}
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"extend-type.decorator.js","sourceRoot":"","sources":["../../../libs/decorators/extend-type.decorator.ts"],"names":[],"mappings":";;;AAAA,mEAAwE;AAExE,MAAM,gBAAgB,GAAG,CAAC,uBAAuB,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,CAAC,CAAC;AAEzG,SAAgB,UAAU;IACtB,OAAO,SAAS,cAAc,CAAyC,WAAc;QACjF,MAAM,WAAW,GAAG,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACvD,IAAI,UAAU,GAAG,kCAAe,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QACxD,IAAI,aAAa,GAAG,kCAAe,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC3D,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;YAChC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3E,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjC,CAAC;QACL,CAAC;QACD,kCAAe,CAAC,GAAG,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;QAChD,0BAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzB,IAAI,gBAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9C,kCAAe,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;YACpC,0BAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,WAAW,CAAC;IACvB,CAAC,CAAC;AACN,CAAC;AAnBD,gCAmBC"}
|
|
@@ -60,7 +60,12 @@ function getPropertiesOfClass(constructor, properties = []) {
|
|
|
60
60
|
if (!property_storage_1.propertyStorage.get(constructor)) {
|
|
61
61
|
return properties;
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
let parentProperties = property_storage_1.propertyStorage.get(constructor) || [];
|
|
64
|
+
for (const property of parentProperties) {
|
|
65
|
+
if (!properties.some((newProperty) => newProperty.name === property.name)) {
|
|
66
|
+
properties.push(property);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
64
69
|
const parentClass = Object.getPrototypeOf(constructor);
|
|
65
70
|
if (parentClass.name) {
|
|
66
71
|
return getPropertiesOfClass(parentClass, properties);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property.helper.js","sourceRoot":"","sources":["../../../libs/helpers/property.helper.ts"],"names":[],"mappings":";;;AAAA,oEAA+D;AAC/D,mEAAwE;AAExE,mCAAsC;AAEtC,SAAgB,qBAAqB;IACjC,OAAO,kCAAe,CAAC,IAAI,EAAE,CAAC;AAClC,CAAC;AAFD,sDAEC;AAED,SAAgB,oBAAoB,CAAC,WAAqB,EAAE,YAAoB,EAAE,MAA0B;IACxG,IAAI,kCAAe,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,kCAAe,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACpD,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;QACtE,IAAI,QAAQ,EAAE,CAAC;YACX,QAAQ,CAAC,MAAM,GAAG,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;QACxD,CAAC;aAAM,CAAC;YACJ,UAAU,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,YAAY;gBAClB,MAAM;aACT,CAAC,CAAC;QACP,CAAC;IACL,CAAC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IAAI,CAAC,0BAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,0BAAO,CAAC,CAAC;IACjC,MAAM,SAAS,GAAe,EAAE,CAAC;IAEjC,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QAClB,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;QAC1B,MAAM,UAAU,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;QAC7C,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;YAClC,IAAI,IAAA,yBAAU,EAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1B,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;gBAC9E,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;oBAC5B,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;oBACxB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;gBAC7B,CAAC;YACL,CAAC;QACL,CAAC;QACD,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,SAAS,CAAC,OAAO,EAAE,CAAC;AAC/B,CAAC;AArBD,sDAqBC"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ function PickResponseType(classRef, keys) {
|
|
|
8
8
|
const swaggerPickTypes = (0, swagger_1.PickType)(classRef, keys);
|
|
9
9
|
class PickTypeClass extends swaggerPickTypes {
|
|
10
10
|
}
|
|
11
|
-
let properties = property_storage_1.propertyStorage.get(classRef);
|
|
11
|
+
let properties = property_storage_1.propertyStorage.get(classRef) || [];
|
|
12
12
|
for (const property of properties) {
|
|
13
13
|
if (keys.includes(property.name)) {
|
|
14
14
|
(0, property_helper_1.addPropertyToStorage)(PickTypeClass, property.name, property.option);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick-type.helper.js","sourceRoot":"","sources":["../../../libs/type-helpers/pick-type.helper.ts"],"names":[],"mappings":";;;AACA,6CAA2C;AAC3C,gEAAkE;AAClE,mEAA+D;AAE/D,SAAgB,gBAAgB,CAC5B,QAAiB,EACjB,IAAS;IAET,MAAM,gBAAgB,GAAQ,IAAA,kBAAQ,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAEvD,MAAe,aAAc,SAAQ,gBAAgB;KAAG;IAExD,IAAI,UAAU,GAAG,kCAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"pick-type.helper.js","sourceRoot":"","sources":["../../../libs/type-helpers/pick-type.helper.ts"],"names":[],"mappings":";;;AACA,6CAA2C;AAC3C,gEAAkE;AAClE,mEAA+D;AAE/D,SAAgB,gBAAgB,CAC5B,QAAiB,EACjB,IAAS;IAET,MAAM,gBAAgB,GAAQ,IAAA,kBAAQ,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAEvD,MAAe,aAAc,SAAQ,gBAAgB;KAAG;IAExD,IAAI,UAAU,GAAG,kCAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACrD,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QAChC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAS,CAAC,EAAE,CAAC;YACpC,IAAA,sCAAoB,EAAC,aAAa,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QACxE,CAAC;IACL,CAAC;IAED,OAAO,aAAqD,CAAC;AACjE,CAAC;AAhBD,4CAgBC"}
|