@thisisagile/easy 8.11.0 → 8.12.0

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.
@@ -0,0 +1,8 @@
1
+ import { Enum } from '../../types';
2
+ export declare class UnitOfWeight extends Enum {
3
+ readonly gMultiplier: number;
4
+ static readonly MG: UnitOfWeight;
5
+ static readonly G: UnitOfWeight;
6
+ static readonly KG: UnitOfWeight;
7
+ constructor(name: string, id: string, gMultiplier: number);
8
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnitOfWeight = void 0;
4
+ const types_1 = require("../../types");
5
+ class UnitOfWeight extends types_1.Enum {
6
+ constructor(name, id, gMultiplier) {
7
+ super(name, id);
8
+ this.gMultiplier = gMultiplier;
9
+ }
10
+ }
11
+ exports.UnitOfWeight = UnitOfWeight;
12
+ UnitOfWeight.MG = new UnitOfWeight('MilliGram', 'mg', 0.001);
13
+ UnitOfWeight.G = new UnitOfWeight('Gram', 'g', 1);
14
+ UnitOfWeight.KG = new UnitOfWeight('Kilogram', 'kg', 1000);
15
+ //# sourceMappingURL=UnitOfWeight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnitOfWeight.js","sourceRoot":"","sources":["../../../src/domain/enums/UnitOfWeight.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AAEnC,MAAa,YAAa,SAAQ,YAAI;IAKpC,YAAY,IAAY,EAAE,EAAU,EAAW,WAAmB;QAChE,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAD6B,gBAAW,GAAX,WAAW,CAAQ;IAElE,CAAC;;AAPH,oCAQC;AAPiB,eAAE,GAAG,IAAI,YAAY,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAChD,cAAC,GAAG,IAAI,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AACrC,eAAE,GAAG,IAAI,YAAY,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC"}
@@ -3,3 +3,4 @@ export * from './Currency';
3
3
  export * from './Environment';
4
4
  export * from './Locale';
5
5
  export * from './UnitOfMeasurement';
6
+ export * from './UnitOfWeight';
@@ -15,4 +15,5 @@ __exportStar(require("./Currency"), exports);
15
15
  __exportStar(require("./Environment"), exports);
16
16
  __exportStar(require("./Locale"), exports);
17
17
  __exportStar(require("./UnitOfMeasurement"), exports);
18
+ __exportStar(require("./UnitOfWeight"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,gDAA8B;AAC9B,2CAAyB;AACzB,sDAAoC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,gDAA8B;AAC9B,2CAAyB;AACzB,sDAAoC;AACpC,iDAA+B"}
@@ -0,0 +1,6 @@
1
+ import { UnitOfWeight } from '../enums';
2
+ import { Struct } from '../Struct';
3
+ export declare class Weight extends Struct {
4
+ readonly value: number;
5
+ readonly UOW: UnitOfWeight;
6
+ }
@@ -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.Weight = void 0;
13
+ const enums_1 = require("../enums");
14
+ const validation_1 = require("../../validation");
15
+ const Struct_1 = require("../Struct");
16
+ class Weight extends Struct_1.Struct {
17
+ constructor() {
18
+ super(...arguments);
19
+ this.value = this.state.value;
20
+ this.UOW = enums_1.UnitOfWeight.byId(this.state.UOW, enums_1.UnitOfWeight.G);
21
+ }
22
+ }
23
+ __decorate([
24
+ (0, validation_1.required)(),
25
+ __metadata("design:type", Number)
26
+ ], Weight.prototype, "value", void 0);
27
+ exports.Weight = Weight;
28
+ //# sourceMappingURL=Weight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Weight.js","sourceRoot":"","sources":["../../../src/domain/structs/Weight.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAAwC;AACxC,iDAA4C;AAC5C,sCAAmC;AAEnC,MAAa,MAAO,SAAQ,eAAM;IAAlC;;QACuB,UAAK,GAAW,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAC7C,QAAG,GAAiB,oBAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,oBAAY,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC;CAAA;AAFa;IAAX,IAAA,qBAAQ,GAAE;;qCAA2C;AADxD,wBAGC"}
@@ -1,3 +1,4 @@
1
1
  export * from './Address';
2
2
  export * from './Dimension';
3
3
  export * from './Money';
4
+ export * from './Weight';
@@ -13,4 +13,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./Address"), exports);
14
14
  __exportStar(require("./Dimension"), exports);
15
15
  __exportStar(require("./Money"), exports);
16
+ __exportStar(require("./Weight"), exports);
16
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/structs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,8CAA4B;AAC5B,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/structs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,8CAA4B;AAC5B,0CAAwB;AACxB,2CAAyB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisisagile/easy",
3
- "version": "8.11.0",
3
+ "version": "8.12.0",
4
4
  "description": "Straightforward library for building domain-driven microservice architectures",
5
5
  "author": "Sander Hoogendoorn",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "access": "public"
32
32
  },
33
33
  "devDependencies": {
34
- "@thisisagile/easy-test": "8.11.0",
34
+ "@thisisagile/easy-test": "8.12.0",
35
35
  "@types/form-urlencoded": "^4.4.0",
36
36
  "@types/jsonwebtoken": "^8.5.6",
37
37
  "@types/validator": "^13.7.0"
@@ -0,0 +1,11 @@
1
+ import { Enum } from '../../types';
2
+
3
+ export class UnitOfWeight extends Enum {
4
+ static readonly MG = new UnitOfWeight('MilliGram', 'mg', 0.001);
5
+ static readonly G = new UnitOfWeight('Gram', 'g', 1);
6
+ static readonly KG = new UnitOfWeight('Kilogram', 'kg', 1000);
7
+
8
+ constructor(name: string, id: string, readonly gMultiplier: number) {
9
+ super(name, id);
10
+ }
11
+ }
@@ -3,3 +3,4 @@ export * from './Currency';
3
3
  export * from './Environment';
4
4
  export * from './Locale';
5
5
  export * from './UnitOfMeasurement';
6
+ export * from './UnitOfWeight';
@@ -0,0 +1,8 @@
1
+ import { UnitOfWeight } from '../enums';
2
+ import { required } from '../../validation';
3
+ import { Struct } from '../Struct';
4
+
5
+ export class Weight extends Struct {
6
+ @required() readonly value: number = this.state.value;
7
+ readonly UOW: UnitOfWeight = UnitOfWeight.byId(this.state.UOW, UnitOfWeight.G);
8
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './Address';
2
2
  export * from './Dimension';
3
3
  export * from './Money';
4
+ export * from './Weight';