@my-devkit/core 1.0.86 → 1.0.87

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/dist/index.d.ts CHANGED
@@ -1,20 +1,21 @@
1
1
  import * as validators from './validators';
2
- export * from './decorators';
3
- export * from './document';
4
2
  export * from './command';
5
- export * from './event';
6
3
  export * from './date-helper';
4
+ export * from './decorators';
5
+ export * from './document';
7
6
  export * from './enum-helper';
8
7
  export * from './errors';
8
+ export * from './event';
9
9
  export * from './guid';
10
10
  export * from './logger';
11
- export * from './model';
12
11
  export * from './maintenance-model';
12
+ export * from './model';
13
+ export * from './promise-helper';
13
14
  export * from './release-model';
14
- export * from './serialize';
15
15
  export * from './retry';
16
+ export * from './sanity-check-warm-up-dto';
17
+ export * from './serialize';
16
18
  export * from './sleep';
19
+ export { ValidationError } from './validators/validation-error';
17
20
  export * from './vendors';
18
- export * from './promise-helper';
19
21
  export declare const Validators: typeof validators;
20
- export { ValidationError } from './validators/validation-error';
package/dist/index.js CHANGED
@@ -14,26 +14,27 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.ValidationError = exports.Validators = void 0;
17
+ exports.Validators = exports.ValidationError = void 0;
18
18
  var validators = require("./validators");
19
- __exportStar(require("./decorators"), exports);
20
- __exportStar(require("./document"), exports);
21
19
  __exportStar(require("./command"), exports);
22
- __exportStar(require("./event"), exports);
23
20
  __exportStar(require("./date-helper"), exports);
21
+ __exportStar(require("./decorators"), exports);
22
+ __exportStar(require("./document"), exports);
24
23
  __exportStar(require("./enum-helper"), exports);
25
24
  __exportStar(require("./errors"), exports);
25
+ __exportStar(require("./event"), exports);
26
26
  __exportStar(require("./guid"), exports);
27
27
  __exportStar(require("./logger"), exports);
28
- __exportStar(require("./model"), exports);
29
28
  __exportStar(require("./maintenance-model"), exports);
29
+ __exportStar(require("./model"), exports);
30
+ __exportStar(require("./promise-helper"), exports);
30
31
  __exportStar(require("./release-model"), exports);
31
- __exportStar(require("./serialize"), exports);
32
32
  __exportStar(require("./retry"), exports);
33
+ __exportStar(require("./sanity-check-warm-up-dto"), exports);
34
+ __exportStar(require("./serialize"), exports);
33
35
  __exportStar(require("./sleep"), exports);
34
- __exportStar(require("./vendors"), exports);
35
- __exportStar(require("./promise-helper"), exports);
36
- exports.Validators = validators;
37
36
  var validation_error_1 = require("./validators/validation-error");
38
37
  Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.ValidationError; } });
38
+ __exportStar(require("./vendors"), exports);
39
+ exports.Validators = validators;
39
40
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yCAA2C;AAE3C,+CAA6B;AAC7B,6CAA2B;AAC3B,4CAA0B;AAC1B,0CAAwB;AACxB,gDAA8B;AAC9B,gDAA8B;AAC9B,2CAAyB;AACzB,yCAAuB;AACvB,2CAAyB;AACzB,0CAAwB;AACxB,sDAAoC;AACpC,kDAAgC;AAChC,8CAA4B;AAC5B,0CAAwB;AACxB,0CAAwB;AACxB,4CAA0B;AAC1B,mDAAiC;AAEpB,QAAA,UAAU,GAAG,UAAU,CAAC;AACrC,kEAAgE;AAAvD,mHAAA,eAAe,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yCAA2C;AAE3C,4CAA0B;AAC1B,gDAA8B;AAC9B,+CAA6B;AAC7B,6CAA2B;AAC3B,gDAA8B;AAC9B,2CAAyB;AACzB,0CAAwB;AACxB,yCAAuB;AACvB,2CAAyB;AACzB,sDAAoC;AACpC,0CAAwB;AACxB,mDAAiC;AACjC,kDAAgC;AAChC,0CAAwB;AACxB,6DAA2C;AAC3C,8CAA4B;AAC5B,0CAAwB;AACxB,kEAAgE;AAAvD,mHAAA,eAAe,OAAA;AACxB,4CAA0B;AAEb,QAAA,UAAU,GAAG,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare class SanityCheckWarmUpDto {
2
+ status: boolean;
3
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SanityCheckWarmUpDto = void 0;
13
+ var serialize_1 = require("./serialize");
14
+ var SanityCheckWarmUpDto = /** @class */ (function () {
15
+ function SanityCheckWarmUpDto() {
16
+ this.status = null;
17
+ }
18
+ __decorate([
19
+ (0, serialize_1.autoserializeAs)(Boolean),
20
+ __metadata("design:type", Boolean)
21
+ ], SanityCheckWarmUpDto.prototype, "status", void 0);
22
+ SanityCheckWarmUpDto = __decorate([
23
+ serialize_1.serializable
24
+ ], SanityCheckWarmUpDto);
25
+ return SanityCheckWarmUpDto;
26
+ }());
27
+ exports.SanityCheckWarmUpDto = SanityCheckWarmUpDto;
28
+ //# sourceMappingURL=sanity-check-warm-up-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanity-check-warm-up-dto.js","sourceRoot":"","sources":["../src/sanity-check-warm-up-dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA4D;AAG5D;IAAA;QACqC,WAAM,GAAY,IAAI,CAAC;IAC5D,CAAC;IADG;QAAC,IAAA,2BAAe,EAAC,OAAO,CAAC;;wDAA+B;IAD/C,oBAAoB;QADhC,wBAAY;OACA,oBAAoB,CAEhC;IAAD,2BAAC;CAAA,AAFD,IAEC;AAFY,oDAAoB"}
@@ -2,6 +2,8 @@ export * from './camel-case';
2
2
  export * from './equals-to';
3
3
  export * from './greater-or-equal-than';
4
4
  export * from './greater-than-date';
5
+ export * from './is-empty-if';
6
+ export * from './is-not-empty-if';
5
7
  export * from './is-not-in-relative-to';
6
8
  export * from './is-optional-if';
7
9
  export * from './pascal-case';
@@ -18,6 +18,8 @@ __exportStar(require("./camel-case"), exports);
18
18
  __exportStar(require("./equals-to"), exports);
19
19
  __exportStar(require("./greater-or-equal-than"), exports);
20
20
  __exportStar(require("./greater-than-date"), exports);
21
+ __exportStar(require("./is-empty-if"), exports);
22
+ __exportStar(require("./is-not-empty-if"), exports);
21
23
  __exportStar(require("./is-not-in-relative-to"), exports);
22
24
  __exportStar(require("./is-optional-if"), exports);
23
25
  __exportStar(require("./pascal-case"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/validators/custom-validators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,8CAA4B;AAC5B,0DAAwC;AACxC,sDAAoC;AACpC,0DAAwC;AACxC,mDAAiC;AACjC,gDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/validators/custom-validators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,8CAA4B;AAC5B,0DAAwC;AACxC,sDAAoC;AACpC,gDAA8B;AAC9B,oDAAkC;AAClC,0DAAwC;AACxC,mDAAiC;AACjC,gDAA8B"}
@@ -0,0 +1,2 @@
1
+ import { ValidationOptions } from 'class-validator';
2
+ export declare function IsEmptyIf<T>(condition: (object: T) => boolean, validationOptions?: ValidationOptions): (object: Record<string, any>, propertyName: string) => void;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IsEmptyIf = void 0;
4
+ // eslint-disable-next-line no-restricted-imports
5
+ var class_validator_1 = require("class-validator");
6
+ var lodash_1 = require("lodash");
7
+ function IsEmptyIf(condition, validationOptions) {
8
+ return function (object, propertyName) {
9
+ (0, class_validator_1.registerDecorator)({
10
+ name: 'isEmpty',
11
+ target: object.constructor,
12
+ propertyName: propertyName,
13
+ constraints: [condition],
14
+ options: validationOptions,
15
+ validator: {
16
+ validate: function (value, args) {
17
+ var relatedCondition = args.constraints[0];
18
+ var cond = relatedCondition(args.object);
19
+ if (cond && Array.isArray(value) && validationOptions && validationOptions.each) {
20
+ return value.every(function (v) { return (0, lodash_1.isNil)(v); });
21
+ }
22
+ else if (cond) {
23
+ return (0, lodash_1.isNil)(value);
24
+ }
25
+ return true;
26
+ }
27
+ }
28
+ });
29
+ };
30
+ }
31
+ exports.IsEmptyIf = IsEmptyIf;
32
+ //# sourceMappingURL=is-empty-if.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-empty-if.js","sourceRoot":"","sources":["../../../src/validators/custom-validators/is-empty-if.ts"],"names":[],"mappings":";;;AAAA,iDAAiD;AACjD,mDAA4F;AAC5F,iCAA+B;AAE/B,SAAgB,SAAS,CAAI,SAAiC,EAAE,iBAAqC;IACjG,OAAO,UAAU,MAA2B,EAAE,YAAoB;QAC9D,IAAA,mCAAiB,EAAC;YACd,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,WAAW,EAAE,CAAC,SAAS,CAAC;YACxB,OAAO,EAAE,iBAAiB;YAC1B,SAAS,EAAE;gBACP,QAAQ,YAAC,KAAU,EAAE,IAAyB;oBACnC,IAAA,gBAAgB,GAAI,IAAI,CAAC,WAAW,GAApB,CAAqB;oBAC5C,IAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBAE3C,IAAI,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,IAAI,EAAE;wBAC7E,OAAO,KAAK,CAAC,KAAK,CAAC,UAAA,CAAC,IAAI,OAAA,IAAA,cAAK,EAAC,CAAC,CAAC,EAAR,CAAQ,CAAC,CAAC;qBACrC;yBAAM,IAAI,IAAI,EAAE;wBACb,OAAO,IAAA,cAAK,EAAC,KAAK,CAAC,CAAC;qBACvB;oBAED,OAAO,IAAI,CAAC;gBAChB,CAAC;aACJ;SACJ,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AAxBD,8BAwBC"}
@@ -0,0 +1,2 @@
1
+ import { ValidationOptions } from 'class-validator';
2
+ export declare function IsNotEmptyIf<T>(condition: (object: T) => boolean, validationOptions?: ValidationOptions): (object: Record<string, any>, propertyName: string) => void;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IsNotEmptyIf = void 0;
4
+ var class_validator_1 = require("class-validator");
5
+ var lodash_1 = require("lodash");
6
+ function IsNotEmptyIf(condition, validationOptions) {
7
+ return function (object, propertyName) {
8
+ (0, class_validator_1.registerDecorator)({
9
+ name: 'isNotEmpty',
10
+ target: object.constructor,
11
+ propertyName: propertyName,
12
+ constraints: [condition],
13
+ options: validationOptions,
14
+ validator: {
15
+ validate: function (value, args) {
16
+ var relatedCondition = args.constraints[0];
17
+ var cond = relatedCondition(args.object);
18
+ return cond ? !(0, lodash_1.isNil)(value) : true;
19
+ }
20
+ }
21
+ });
22
+ };
23
+ }
24
+ exports.IsNotEmptyIf = IsNotEmptyIf;
25
+ //# sourceMappingURL=is-not-empty-if.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-not-empty-if.js","sourceRoot":"","sources":["../../../src/validators/custom-validators/is-not-empty-if.ts"],"names":[],"mappings":";;;AAAA,mDAA4F;AAC5F,iCAA+B;AAE/B,SAAgB,YAAY,CAAI,SAAiC,EAAE,iBAAqC;IACpG,OAAO,UAAU,MAA2B,EAAE,YAAoB;QAC9D,IAAA,mCAAiB,EAAC;YACd,IAAI,EAAE,YAAY;YAClB,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,WAAW,EAAE,CAAC,SAAS,CAAC;YACxB,OAAO,EAAE,iBAAiB;YAC1B,SAAS,EAAE;gBACP,QAAQ,YAAC,KAAU,EAAE,IAAyB;oBACnC,IAAA,gBAAgB,GAAI,IAAI,CAAC,WAAW,GAApB,CAAqB;oBAC5C,IAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBAC3C,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;gBACvC,CAAC;aACJ;SACJ,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AAjBD,oCAiBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@my-devkit/core",
3
- "version": "1.0.86",
3
+ "version": "1.0.87",
4
4
  "description": "My Devkit: common tools",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,22 +1,23 @@
1
1
  import * as validators from './validators';
2
2
 
3
- export * from './decorators';
4
- export * from './document';
5
3
  export * from './command';
6
- export * from './event';
7
4
  export * from './date-helper';
5
+ export * from './decorators';
6
+ export * from './document';
8
7
  export * from './enum-helper';
9
8
  export * from './errors';
9
+ export * from './event';
10
10
  export * from './guid';
11
11
  export * from './logger';
12
- export * from './model';
13
12
  export * from './maintenance-model';
13
+ export * from './model';
14
+ export * from './promise-helper';
14
15
  export * from './release-model';
15
- export * from './serialize';
16
16
  export * from './retry';
17
+ export * from './sanity-check-warm-up-dto';
18
+ export * from './serialize';
17
19
  export * from './sleep';
20
+ export { ValidationError } from './validators/validation-error';
18
21
  export * from './vendors';
19
- export * from './promise-helper';
20
22
 
21
23
  export const Validators = validators;
22
- export { ValidationError } from './validators/validation-error';
@@ -0,0 +1,6 @@
1
+ import { autoserializeAs, serializable } from './serialize';
2
+
3
+ @serializable
4
+ export class SanityCheckWarmUpDto {
5
+ @autoserializeAs(Boolean) public status: boolean = null;
6
+ }
@@ -2,6 +2,8 @@ export * from './camel-case';
2
2
  export * from './equals-to';
3
3
  export * from './greater-or-equal-than';
4
4
  export * from './greater-than-date';
5
+ export * from './is-empty-if';
6
+ export * from './is-not-empty-if';
5
7
  export * from './is-not-in-relative-to';
6
8
  export * from './is-optional-if';
7
9
  export * from './pascal-case';
@@ -0,0 +1,29 @@
1
+ // eslint-disable-next-line no-restricted-imports
2
+ import { registerDecorator, ValidationArguments, ValidationOptions } from 'class-validator';
3
+ import { isNil } from 'lodash';
4
+
5
+ export function IsEmptyIf<T>(condition: (object: T) => boolean, validationOptions?: ValidationOptions) {
6
+ return function (object: Record<string, any>, propertyName: string): void {
7
+ registerDecorator({
8
+ name: 'isEmpty',
9
+ target: object.constructor,
10
+ propertyName: propertyName,
11
+ constraints: [condition],
12
+ options: validationOptions,
13
+ validator: {
14
+ validate(value: any, args: ValidationArguments) {
15
+ const [relatedCondition] = args.constraints;
16
+ const cond = relatedCondition(args.object);
17
+
18
+ if (cond && Array.isArray(value) && validationOptions && validationOptions.each) {
19
+ return value.every(v => isNil(v));
20
+ } else if (cond) {
21
+ return isNil(value);
22
+ }
23
+
24
+ return true;
25
+ }
26
+ }
27
+ });
28
+ };
29
+ }
@@ -0,0 +1,21 @@
1
+ import { registerDecorator, ValidationArguments, ValidationOptions } from 'class-validator';
2
+ import { isNil } from 'lodash';
3
+
4
+ export function IsNotEmptyIf<T>(condition: (object: T) => boolean, validationOptions?: ValidationOptions) {
5
+ return function (object: Record<string, any>, propertyName: string): void {
6
+ registerDecorator({
7
+ name: 'isNotEmpty',
8
+ target: object.constructor,
9
+ propertyName: propertyName,
10
+ constraints: [condition],
11
+ options: validationOptions,
12
+ validator: {
13
+ validate(value: any, args: ValidationArguments) {
14
+ const [relatedCondition] = args.constraints;
15
+ const cond = relatedCondition(args.object);
16
+ return cond ? !isNil(value) : true;
17
+ }
18
+ }
19
+ });
20
+ };
21
+ }