@thisisagile/easy 8.6.0 → 8.6.1
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.
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Struct } from '../Struct';
|
|
2
|
+
import { Country } from '../enums';
|
|
2
3
|
export declare class Address extends Struct {
|
|
3
4
|
readonly street: string;
|
|
4
5
|
readonly houseNumber: string;
|
|
5
6
|
readonly extension: string;
|
|
6
7
|
readonly postalCode: string;
|
|
7
8
|
readonly city: string;
|
|
8
|
-
readonly country:
|
|
9
|
+
readonly country: Country;
|
|
9
10
|
toString(): string;
|
|
10
11
|
}
|
|
11
12
|
export declare const isAddress: (a?: unknown) => a is Address;
|
|
@@ -13,6 +13,7 @@ exports.isAddress = exports.Address = void 0;
|
|
|
13
13
|
const types_1 = require("../../types");
|
|
14
14
|
const Struct_1 = require("../Struct");
|
|
15
15
|
const validation_1 = require("../../validation");
|
|
16
|
+
const enums_1 = require("../enums");
|
|
16
17
|
class Address extends Struct_1.Struct {
|
|
17
18
|
constructor() {
|
|
18
19
|
super(...arguments);
|
|
@@ -21,7 +22,7 @@ class Address extends Struct_1.Struct {
|
|
|
21
22
|
this.extension = this.state.extension;
|
|
22
23
|
this.postalCode = this.state.postalCode;
|
|
23
24
|
this.city = this.state.city;
|
|
24
|
-
this.country = this.state.country;
|
|
25
|
+
this.country = enums_1.Country.byId(this.state.country);
|
|
25
26
|
}
|
|
26
27
|
toString() {
|
|
27
28
|
return (0, types_1.text)(this.street, '')
|
|
@@ -29,7 +30,7 @@ class Address extends Struct_1.Struct {
|
|
|
29
30
|
.add(this.extension, ' ')
|
|
30
31
|
.add(this.postalCode, ', ')
|
|
31
32
|
.add(this.city, ' ')
|
|
32
|
-
.add(this.country, ' ')
|
|
33
|
+
.add(this.country?.name, ' ')
|
|
33
34
|
.toString();
|
|
34
35
|
}
|
|
35
36
|
}
|
|
@@ -51,7 +52,7 @@ __decorate([
|
|
|
51
52
|
], Address.prototype, "city", void 0);
|
|
52
53
|
__decorate([
|
|
53
54
|
(0, validation_1.required)(),
|
|
54
|
-
__metadata("design:type",
|
|
55
|
+
__metadata("design:type", enums_1.Country)
|
|
55
56
|
], Address.prototype, "country", void 0);
|
|
56
57
|
exports.Address = Address;
|
|
57
58
|
const isAddress = (a) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Address.js","sourceRoot":"","sources":["../../../src/domain/structs/Address.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAA4C;AAC5C,sCAAmC;AACnC,iDAA4C;
|
|
1
|
+
{"version":3,"file":"Address.js","sourceRoot":"","sources":["../../../src/domain/structs/Address.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAA4C;AAC5C,sCAAmC;AACnC,iDAA4C;AAC5C,oCAAmC;AAEnC,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,GAAY,eAAO,CAAC,IAAI,CAAU,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAWpF,CAAC;IATC,QAAQ;QACN,OAAO,IAAA,YAAI,EAAC,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,IAAI,EAAE,GAAG,CAAC;aAC5B,QAAQ,EAAE,CAAC;IAChB,CAAC;CACF;AAhBa;IAAX,IAAA,qBAAQ,GAAE;;uCAA6C;AAC5C;IAAX,IAAA,qBAAQ,GAAE;;4CAAuD;AAEtD;IAAX,IAAA,qBAAQ,GAAE;;2CAAqD;AACpD;IAAX,IAAA,qBAAQ,GAAE;;qCAAyC;AACxC;IAAX,IAAA,qBAAQ,GAAE;8BAAmB,eAAO;wCAA6C;AANpF,0BAiBC;AAEM,MAAM,SAAS,GAAG,CAAC,CAAW,EAAgB,EAAE;IACrD,OAAO,CAAC,IAAA,eAAO,EAAC,CAAC,CAAC,IAAI,CAAC,YAAY,OAAO,CAAC;AAC7C,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy",
|
|
3
|
-
"version": "8.6.
|
|
3
|
+
"version": "8.6.1",
|
|
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.6.
|
|
34
|
+
"@thisisagile/easy-test": "8.6.1",
|
|
35
35
|
"@types/form-urlencoded": "^4.4.0",
|
|
36
36
|
"@types/jsonwebtoken": "^8.5.6",
|
|
37
37
|
"@types/validator": "^13.7.0"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isEmpty, text } from '../../types';
|
|
2
2
|
import { Struct } from '../Struct';
|
|
3
3
|
import { required } from '../../validation';
|
|
4
|
+
import { Country } from '../enums';
|
|
4
5
|
|
|
5
6
|
export class Address extends Struct {
|
|
6
7
|
@required() readonly street: string = this.state.street;
|
|
@@ -8,7 +9,7 @@ export class Address extends Struct {
|
|
|
8
9
|
readonly extension: string = this.state.extension;
|
|
9
10
|
@required() readonly postalCode: string = this.state.postalCode;
|
|
10
11
|
@required() readonly city: string = this.state.city;
|
|
11
|
-
@required() readonly country:
|
|
12
|
+
@required() readonly country: Country = Country.byId<Country>(this.state.country);
|
|
12
13
|
|
|
13
14
|
toString(): string {
|
|
14
15
|
return text(this.street, '')
|
|
@@ -16,7 +17,7 @@ export class Address extends Struct {
|
|
|
16
17
|
.add(this.extension, ' ')
|
|
17
18
|
.add(this.postalCode, ', ')
|
|
18
19
|
.add(this.city, ' ')
|
|
19
|
-
.add(this.country, ' ')
|
|
20
|
+
.add(this.country?.name, ' ')
|
|
20
21
|
.toString();
|
|
21
22
|
}
|
|
22
23
|
}
|