@thisisagile/easy 7.10.10 → 7.11.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.
@@ -0,0 +1,11 @@
1
+ import { Struct } from '../Struct';
2
+ export declare class Address extends Struct {
3
+ readonly street: string;
4
+ readonly houseNumber: string;
5
+ readonly extension: string;
6
+ readonly postalCode: string;
7
+ readonly city: string;
8
+ readonly country: string;
9
+ toString(): string;
10
+ }
11
+ export declare const isAddress: (a?: unknown) => a is Address;
@@ -0,0 +1,61 @@
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.isAddress = exports.Address = void 0;
13
+ const types_1 = require("../../types");
14
+ const Struct_1 = require("../Struct");
15
+ const validation_1 = require("../../validation");
16
+ class Address extends Struct_1.Struct {
17
+ constructor() {
18
+ super(...arguments);
19
+ this.street = this.state.street;
20
+ this.houseNumber = this.state.houseNumber;
21
+ this.extension = this.state.extension;
22
+ this.postalCode = this.state.postalCode;
23
+ this.city = this.state.city;
24
+ this.country = this.state.country;
25
+ }
26
+ toString() {
27
+ return types_1.text(this.street, '')
28
+ .add(this.houseNumber, ' ')
29
+ .add(this.extension, ' ')
30
+ .add(this.postalCode, ', ')
31
+ .add(this.city, ' ')
32
+ .add(this.country, ' ')
33
+ .toString();
34
+ }
35
+ }
36
+ __decorate([
37
+ validation_1.required(),
38
+ __metadata("design:type", String)
39
+ ], Address.prototype, "street", void 0);
40
+ __decorate([
41
+ validation_1.required(),
42
+ __metadata("design:type", String)
43
+ ], Address.prototype, "houseNumber", void 0);
44
+ __decorate([
45
+ validation_1.required(),
46
+ __metadata("design:type", String)
47
+ ], Address.prototype, "postalCode", void 0);
48
+ __decorate([
49
+ validation_1.required(),
50
+ __metadata("design:type", String)
51
+ ], Address.prototype, "city", void 0);
52
+ __decorate([
53
+ validation_1.required(),
54
+ __metadata("design:type", String)
55
+ ], Address.prototype, "country", void 0);
56
+ exports.Address = Address;
57
+ const isAddress = (a) => {
58
+ return !types_1.isEmpty(a) && a instanceof Address;
59
+ };
60
+ exports.isAddress = isAddress;
61
+ //# sourceMappingURL=Address.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Address.js","sourceRoot":"","sources":["../../../src/domain/structs/Address.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAA4C;AAC5C,sCAAmC;AACnC,iDAA4C;AAE5C,MAAa,OAAQ,SAAQ,eAAM;IAAnC;;QACuB,WAAM,GAAW,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QACnC,gBAAW,GAAW,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QACzD,cAAS,GAAW,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QAC7B,eAAU,GAAW,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;QAC3C,SAAI,GAAW,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QAC/B,YAAO,GAAW,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAW5D,CAAC;IATC,QAAQ;QACN,OAAO,YAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;aACzB,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC;aAC1B,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC;aACxB,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC;aAC1B,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC;aACnB,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC;aACtB,QAAQ,EAAE,CAAC;IAChB,CAAC;CACF;AAhBa;IAAX,qBAAQ,EAAE;;uCAA6C;AAC5C;IAAX,qBAAQ,EAAE;;4CAAuD;AAEtD;IAAX,qBAAQ,EAAE;;2CAAqD;AACpD;IAAX,qBAAQ,EAAE;;qCAAyC;AACxC;IAAX,qBAAQ,EAAE;;wCAA+C;AAN5D,0BAiBC;AAEM,MAAM,SAAS,GAAG,CAAC,CAAW,EAAgB,EAAE;IACrD,OAAO,CAAC,eAAO,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,OAAO,CAAC;AAC7C,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB"}
@@ -1 +1,2 @@
1
+ export * from './Address';
1
2
  export * from './Money';
@@ -10,5 +10,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./Address"), exports);
13
14
  __exportStar(require("./Money"), exports);
14
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/structs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/structs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,0CAAwB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisisagile/easy",
3
- "version": "7.10.10",
3
+ "version": "7.11.3",
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": "7.10.10",
34
+ "@thisisagile/easy-test": "7.11.3",
35
35
  "@types/form-urlencoded": "^4.4.0",
36
36
  "@types/jsonwebtoken": "^8.5.5",
37
37
  "@types/validator": "^13.6.3"
@@ -0,0 +1,26 @@
1
+ import { isEmpty, text } from '../../types';
2
+ import { Struct } from '../Struct';
3
+ import { required } from '../../validation';
4
+
5
+ export class Address extends Struct {
6
+ @required() readonly street: string = this.state.street;
7
+ @required() readonly houseNumber: string = this.state.houseNumber;
8
+ readonly extension: string = this.state.extension;
9
+ @required() readonly postalCode: string = this.state.postalCode;
10
+ @required() readonly city: string = this.state.city;
11
+ @required() readonly country: string = this.state.country;
12
+
13
+ toString(): string {
14
+ return text(this.street, '')
15
+ .add(this.houseNumber, ' ')
16
+ .add(this.extension, ' ')
17
+ .add(this.postalCode, ', ')
18
+ .add(this.city, ' ')
19
+ .add(this.country, ' ')
20
+ .toString();
21
+ }
22
+ }
23
+
24
+ export const isAddress = (a?: unknown): a is Address => {
25
+ return !isEmpty(a) && a instanceof Address;
26
+ };
@@ -1 +1,2 @@
1
+ export * from './Address';
1
2
  export * from './Money';