@wisemen/address 0.1.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.
- package/.env.test +1 -0
- package/README.md +83 -0
- package/dist/address-column.d.ts +2 -0
- package/dist/address-column.js +27 -0
- package/dist/address-column.js.map +1 -0
- package/dist/address-command.builder.d.ts +14 -0
- package/dist/address-command.builder.js +39 -0
- package/dist/address-command.builder.js.map +1 -0
- package/dist/address-command.d.ts +14 -0
- package/dist/address-command.js +104 -0
- package/dist/address-command.js.map +1 -0
- package/dist/address-response.d.ts +14 -0
- package/dist/address-response.js +72 -0
- package/dist/address-response.js.map +1 -0
- package/dist/address.builder.d.ts +16 -0
- package/dist/address.builder.js +47 -0
- package/dist/address.builder.js.map +1 -0
- package/dist/address.d.ts +12 -0
- package/dist/address.js +12 -0
- package/dist/address.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/is-address.validator.d.ts +11 -0
- package/dist/is-address.validator.js +52 -0
- package/dist/is-address.validator.js.map +1 -0
- package/dist/tests/address-column.integration.test.d.ts +1 -0
- package/dist/tests/address-column.integration.test.js +109 -0
- package/dist/tests/address-column.integration.test.js.map +1 -0
- package/dist/tests/is-address.validator.unit.test.d.ts +1 -0
- package/dist/tests/is-address.validator.unit.test.js +129 -0
- package/dist/tests/is-address.validator.unit.test.js.map +1 -0
- package/dist/tests/sql/address-test.entity.d.ts +5 -0
- package/dist/tests/sql/address-test.entity.js +28 -0
- package/dist/tests/sql/address-test.entity.js.map +1 -0
- package/dist/tests/sql/datasource.d.ts +2 -0
- package/dist/tests/sql/datasource.js +15 -0
- package/dist/tests/sql/datasource.js.map +1 -0
- package/eslint.config.js +17 -0
- package/lib/address-column.ts +31 -0
- package/lib/address-command.builder.ts +56 -0
- package/lib/address-command.ts +78 -0
- package/lib/address-response.ts +46 -0
- package/lib/address.builder.ts +68 -0
- package/lib/address.ts +13 -0
- package/lib/index.ts +7 -0
- package/lib/is-address.validator.ts +82 -0
- package/lib/tests/address-column.integration.test.ts +163 -0
- package/lib/tests/is-address.validator.unit.test.ts +144 -0
- package/lib/tests/sql/address-test.entity.ts +12 -0
- package/lib/tests/sql/datasource.ts +15 -0
- package/package.json +44 -0
- package/tsconfig.json +40 -0
package/.env.test
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
DATABASE_URI='postgresql://postgres:password@localhost:5432/test_db'
|
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# @wisemen/address
|
|
2
|
+
|
|
3
|
+
TypeScript address model with NestJS integration, TypeORM column support, and validation.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @wisemen/address
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Basic Address Model
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { Address } from '@wisemen/address'
|
|
17
|
+
|
|
18
|
+
const address = new Address()
|
|
19
|
+
address.placeName = 'Home'
|
|
20
|
+
address.streetName = 'Main Street'
|
|
21
|
+
address.streetNumber = '123'
|
|
22
|
+
address.city = 'New York'
|
|
23
|
+
address.postalCode = '10001'
|
|
24
|
+
address.country = 'USA'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### TypeORM Column
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { Entity, PrimaryGeneratedColumn } from 'typeorm'
|
|
31
|
+
import { AddressColumn } from '@wisemen/address'
|
|
32
|
+
|
|
33
|
+
@Entity()
|
|
34
|
+
class User {
|
|
35
|
+
@PrimaryGeneratedColumn('uuid')
|
|
36
|
+
id: string
|
|
37
|
+
|
|
38
|
+
@AddressColumn({ nullable: true })
|
|
39
|
+
address: Address | null
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### NestJS DTO Validation
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { AddressCommand } from '@wisemen/address'
|
|
47
|
+
|
|
48
|
+
class CreateUserDto {
|
|
49
|
+
@ValidateNested()
|
|
50
|
+
@Type(() => AddressCommand)
|
|
51
|
+
address: AddressCommand
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### NestJS Response
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { AddressResponse } from '@wisemen/address'
|
|
59
|
+
|
|
60
|
+
@Get()
|
|
61
|
+
async getUser(): Promise<UserResponse> {
|
|
62
|
+
const user = await this.userService.findOne()
|
|
63
|
+
return {
|
|
64
|
+
id: user.id,
|
|
65
|
+
address: user.address ? new AddressResponse(user.address) : null
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Custom Validator
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import { IsAddress } from '@wisemen/address'
|
|
74
|
+
|
|
75
|
+
class LocationDto {
|
|
76
|
+
@IsAddress()
|
|
77
|
+
address: Address
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
GPL
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { plainToInstance } from 'class-transformer';
|
|
2
|
+
import { Column } from 'typeorm';
|
|
3
|
+
import { Coordinates } from '@wisemen/coordinates';
|
|
4
|
+
import { Address } from './address.js';
|
|
5
|
+
export function AddressColumn(options) {
|
|
6
|
+
return Column({
|
|
7
|
+
...options,
|
|
8
|
+
type: 'jsonb',
|
|
9
|
+
transformer: {
|
|
10
|
+
from(address) {
|
|
11
|
+
if (address === null) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const addressInstance = plainToInstance(Address, address);
|
|
15
|
+
const coordinates = address.coordinates;
|
|
16
|
+
if (coordinates) {
|
|
17
|
+
addressInstance.coordinates = new Coordinates(coordinates.latitude, coordinates.longitude);
|
|
18
|
+
}
|
|
19
|
+
return addressInstance;
|
|
20
|
+
},
|
|
21
|
+
to(address) {
|
|
22
|
+
return address;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=address-column.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-column.js","sourceRoot":"","sources":["../lib/address-column.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAiB,MAAM,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,UAAU,aAAa,CAAE,OAAqD;IAClF,OAAO,MAAM,CAAC;QACZ,GAAG,OAAO;QACV,IAAI,EAAE,OAAO;QACb,WAAW,EAAE;YACX,IAAI,CAAE,OAAuB;gBAC3B,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;oBACrB,OAAO,IAAI,CAAA;gBACb,CAAC;gBAED,MAAM,eAAe,GAAG,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;gBACzD,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAA;gBAEvC,IAAI,WAAW,EAAE,CAAC;oBAChB,eAAe,CAAC,WAAW,GAAG,IAAI,WAAW,CAAC,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;gBAC5F,CAAC;gBAED,OAAO,eAAe,CAAA;YACxB,CAAC;YAED,EAAE,CAAE,OAAmC;gBACrC,OAAO,OAAO,CAAA;YAChB,CAAC;SACF;KACF,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CoordinatesCommand } from '@wisemen/coordinates';
|
|
2
|
+
import { AddressCommand } from './address-command.js';
|
|
3
|
+
export declare class AddressCommandBuilder {
|
|
4
|
+
private command;
|
|
5
|
+
constructor();
|
|
6
|
+
withCountry(country: string): this;
|
|
7
|
+
withCity(city: string): this;
|
|
8
|
+
withPostalCode(postalCode: string): this;
|
|
9
|
+
withStreetName(streetName: string): this;
|
|
10
|
+
withStreetNumber(streetNumber: string): this;
|
|
11
|
+
withUnit(unit: string): this;
|
|
12
|
+
withCoordinates(coordinates: CoordinatesCommand): this;
|
|
13
|
+
build(): AddressCommand;
|
|
14
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AddressCommand } from './address-command.js';
|
|
2
|
+
export class AddressCommandBuilder {
|
|
3
|
+
command;
|
|
4
|
+
constructor() {
|
|
5
|
+
this.command = new AddressCommand();
|
|
6
|
+
}
|
|
7
|
+
withCountry(country) {
|
|
8
|
+
this.command.country = country;
|
|
9
|
+
return this;
|
|
10
|
+
}
|
|
11
|
+
withCity(city) {
|
|
12
|
+
this.command.city = city;
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
withPostalCode(postalCode) {
|
|
16
|
+
this.command.postalCode = postalCode;
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
withStreetName(streetName) {
|
|
20
|
+
this.command.streetName = streetName;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
withStreetNumber(streetNumber) {
|
|
24
|
+
this.command.streetNumber = streetNumber;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
withUnit(unit) {
|
|
28
|
+
this.command.unit = unit;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
withCoordinates(coordinates) {
|
|
32
|
+
this.command.coordinates = coordinates;
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
build() {
|
|
36
|
+
return this.command;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=address-command.builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-command.builder.js","sourceRoot":"","sources":["../lib/address-command.builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,MAAM,OAAO,qBAAqB;IACxB,OAAO,CAAgB;IAE/B;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,cAAc,EAAE,CAAA;IACrC,CAAC;IAED,WAAW,CAAE,OAAe;QAC1B,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAA;QAE9B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,QAAQ,CAAE,IAAY;QACpB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAA;QAExB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,cAAc,CAAE,UAAkB;QAChC,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,UAAU,CAAA;QAEpC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,cAAc,CAAE,UAAkB;QAChC,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,UAAU,CAAA;QAEpC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,gBAAgB,CAAE,YAAoB;QACpC,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,YAAY,CAAA;QAExC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,QAAQ,CAAE,IAAY;QACpB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAA;QAExB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,eAAe,CAAE,WAA+B;QAC9C,IAAI,CAAC,OAAO,CAAC,WAAW,GAAG,WAAW,CAAA;QAEtC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CoordinatesCommand } from '@wisemen/coordinates';
|
|
2
|
+
import { Address } from './address.js';
|
|
3
|
+
export declare class AddressCommand {
|
|
4
|
+
placeName: string | null;
|
|
5
|
+
placeId: string | null;
|
|
6
|
+
country: string | null;
|
|
7
|
+
city: string | null;
|
|
8
|
+
postalCode: string | null;
|
|
9
|
+
streetName: string | null;
|
|
10
|
+
streetNumber: string | null;
|
|
11
|
+
unit: string | null;
|
|
12
|
+
coordinates: CoordinatesCommand | null;
|
|
13
|
+
parse(): Address;
|
|
14
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { IsNotEmpty, IsObject, IsString, ValidateNested } from 'class-validator';
|
|
11
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
12
|
+
import { Type } from 'class-transformer';
|
|
13
|
+
import { IsNullable } from '@wisemen/validators';
|
|
14
|
+
import { CoordinatesCommand } from '@wisemen/coordinates';
|
|
15
|
+
import { AddressBuilder } from './address.builder.js';
|
|
16
|
+
export class AddressCommand {
|
|
17
|
+
placeName;
|
|
18
|
+
placeId;
|
|
19
|
+
country;
|
|
20
|
+
city;
|
|
21
|
+
postalCode;
|
|
22
|
+
streetName;
|
|
23
|
+
streetNumber;
|
|
24
|
+
unit;
|
|
25
|
+
coordinates;
|
|
26
|
+
parse() {
|
|
27
|
+
return new AddressBuilder()
|
|
28
|
+
.withPlaceId(this.placeId)
|
|
29
|
+
.withPlaceName(this.placeName)
|
|
30
|
+
.withCountry(this.country)
|
|
31
|
+
.withCity(this.city)
|
|
32
|
+
.withPostalCode(this.postalCode)
|
|
33
|
+
.withStreetName(this.streetName)
|
|
34
|
+
.withStreetNumber(this.streetNumber)
|
|
35
|
+
.withUnit(this.unit)
|
|
36
|
+
.withCoordinates(this.coordinates ? this.coordinates.toCoordinates() : null)
|
|
37
|
+
.build();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
__decorate([
|
|
41
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
42
|
+
IsNullable(),
|
|
43
|
+
IsString(),
|
|
44
|
+
IsNotEmpty(),
|
|
45
|
+
__metadata("design:type", Object)
|
|
46
|
+
], AddressCommand.prototype, "placeName", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
49
|
+
IsNullable(),
|
|
50
|
+
IsString(),
|
|
51
|
+
IsNotEmpty(),
|
|
52
|
+
__metadata("design:type", Object)
|
|
53
|
+
], AddressCommand.prototype, "placeId", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
56
|
+
IsNullable(),
|
|
57
|
+
IsString(),
|
|
58
|
+
IsNotEmpty(),
|
|
59
|
+
__metadata("design:type", Object)
|
|
60
|
+
], AddressCommand.prototype, "country", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
63
|
+
IsNullable(),
|
|
64
|
+
IsString(),
|
|
65
|
+
IsNotEmpty(),
|
|
66
|
+
__metadata("design:type", Object)
|
|
67
|
+
], AddressCommand.prototype, "city", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
70
|
+
IsNullable(),
|
|
71
|
+
IsString(),
|
|
72
|
+
IsNotEmpty(),
|
|
73
|
+
__metadata("design:type", Object)
|
|
74
|
+
], AddressCommand.prototype, "postalCode", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
77
|
+
IsNullable(),
|
|
78
|
+
IsString(),
|
|
79
|
+
IsNotEmpty(),
|
|
80
|
+
__metadata("design:type", Object)
|
|
81
|
+
], AddressCommand.prototype, "streetName", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
84
|
+
IsNullable(),
|
|
85
|
+
IsString(),
|
|
86
|
+
IsNotEmpty(),
|
|
87
|
+
__metadata("design:type", Object)
|
|
88
|
+
], AddressCommand.prototype, "streetNumber", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
91
|
+
IsNullable(),
|
|
92
|
+
IsString(),
|
|
93
|
+
IsNotEmpty(),
|
|
94
|
+
__metadata("design:type", Object)
|
|
95
|
+
], AddressCommand.prototype, "unit", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
ApiProperty({ type: CoordinatesCommand, nullable: true }),
|
|
98
|
+
IsNullable(),
|
|
99
|
+
IsObject(),
|
|
100
|
+
Type(() => CoordinatesCommand),
|
|
101
|
+
ValidateNested(),
|
|
102
|
+
__metadata("design:type", Object)
|
|
103
|
+
], AddressCommand.prototype, "coordinates", void 0);
|
|
104
|
+
//# sourceMappingURL=address-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-command.js","sourceRoot":"","sources":["../lib/address-command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,MA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QAAQ,EAAE;IACV,UAAU,EAAE;;+CACS;AAMtB;IAJC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC/C,UAAU,EAAE;IACZ,QAAQ,EAAE;IACV,UAAU,EAAE;;4CACM;AAMnB;IAJC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC/C,UAAU,EAAE;IACZ,QAAQ,EAAE;IACV,UAAU,EAAE;;kDACY;AAMzB;IAJC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC/C,UAAU,EAAE;IACZ,QAAQ,EAAE;IACV,UAAU,EAAE;;kDACY;AAMzB;IAJC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC/C,UAAU,EAAE;IACZ,QAAQ,EAAE;IACV,UAAU,EAAE;;oDACc;AAM3B;IAJC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC/C,UAAU,EAAE;IACZ,QAAQ,EAAE;IACV,UAAU,EAAE;;4CACM;AAOnB;IALC,WAAW,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACzD,UAAU,EAAE;IACZ,QAAQ,EAAE;IACV,IAAI,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC;IAC9B,cAAc,EAAE;;mDACqB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CoordinatesResponse } from '@wisemen/coordinates';
|
|
2
|
+
import { Address } from './address.js';
|
|
3
|
+
export declare class AddressResponse {
|
|
4
|
+
placeName: string | null;
|
|
5
|
+
placeId: string | null;
|
|
6
|
+
country: string | null;
|
|
7
|
+
city: string | null;
|
|
8
|
+
postalCode: string | null;
|
|
9
|
+
streetName: string | null;
|
|
10
|
+
streetNumber: string | null;
|
|
11
|
+
unit: string | null;
|
|
12
|
+
coordinates: CoordinatesResponse | null;
|
|
13
|
+
constructor(address: Address);
|
|
14
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
11
|
+
import { CoordinatesResponse } from '@wisemen/coordinates';
|
|
12
|
+
export class AddressResponse {
|
|
13
|
+
placeName;
|
|
14
|
+
placeId;
|
|
15
|
+
country;
|
|
16
|
+
city;
|
|
17
|
+
postalCode;
|
|
18
|
+
streetName;
|
|
19
|
+
streetNumber;
|
|
20
|
+
unit;
|
|
21
|
+
coordinates;
|
|
22
|
+
constructor(address) {
|
|
23
|
+
this.placeName = address.placeName ?? null;
|
|
24
|
+
this.placeId = address.placeId ?? null;
|
|
25
|
+
this.country = address.country ?? null;
|
|
26
|
+
this.city = address.city ?? null;
|
|
27
|
+
this.postalCode = address.postalCode ?? null;
|
|
28
|
+
this.streetName = address.streetName ?? null;
|
|
29
|
+
this.streetNumber = address.streetNumber ?? null;
|
|
30
|
+
this.unit = address.unit ?? null;
|
|
31
|
+
this.coordinates = address.coordinates != null
|
|
32
|
+
? new CoordinatesResponse(address.coordinates)
|
|
33
|
+
: null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
__decorate([
|
|
37
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
38
|
+
__metadata("design:type", Object)
|
|
39
|
+
], AddressResponse.prototype, "placeName", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
42
|
+
__metadata("design:type", Object)
|
|
43
|
+
], AddressResponse.prototype, "placeId", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
46
|
+
__metadata("design:type", Object)
|
|
47
|
+
], AddressResponse.prototype, "country", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], AddressResponse.prototype, "city", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
54
|
+
__metadata("design:type", Object)
|
|
55
|
+
], AddressResponse.prototype, "postalCode", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
58
|
+
__metadata("design:type", Object)
|
|
59
|
+
], AddressResponse.prototype, "streetName", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
62
|
+
__metadata("design:type", Object)
|
|
63
|
+
], AddressResponse.prototype, "streetNumber", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
ApiProperty({ type: 'string', nullable: true }),
|
|
66
|
+
__metadata("design:type", Object)
|
|
67
|
+
], AddressResponse.prototype, "unit", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
ApiProperty({ type: CoordinatesResponse, nullable: true }),
|
|
70
|
+
__metadata("design:type", Object)
|
|
71
|
+
], AddressResponse.prototype, "coordinates", void 0);
|
|
72
|
+
//# sourceMappingURL=address-response.js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ACxB;AAGxB;IADC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDAC1B;AAGtB;IADC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDAC1B;AAGtB;IADC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CAC7B;AAGnB;IADC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACvB;AAGzB;IADC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACvB;AAGzB;IADC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACrB;AAG3B;IADC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CAC7B;AAGnB;IADC,WAAW,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACpB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Coordinates } from '@wisemen/coordinates';
|
|
2
|
+
import { Address } from './address.js';
|
|
3
|
+
export declare class AddressBuilder {
|
|
4
|
+
private readonly address;
|
|
5
|
+
constructor();
|
|
6
|
+
withPlaceName(name?: string | null): this;
|
|
7
|
+
withPlaceId(id?: string | null): this;
|
|
8
|
+
withCountry(country?: string | null): this;
|
|
9
|
+
withCity(city?: string | null): this;
|
|
10
|
+
withPostalCode(zipCode?: string | null): this;
|
|
11
|
+
withStreetName(streetName?: string | null): this;
|
|
12
|
+
withStreetNumber(streetNumber?: string | null): this;
|
|
13
|
+
withUnit(unit?: string | null): this;
|
|
14
|
+
withCoordinates(coordinates?: Coordinates | null): this;
|
|
15
|
+
build(): Address;
|
|
16
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Address } from './address.js';
|
|
2
|
+
export class AddressBuilder {
|
|
3
|
+
address;
|
|
4
|
+
constructor() {
|
|
5
|
+
this.address = new Address();
|
|
6
|
+
}
|
|
7
|
+
withPlaceName(name) {
|
|
8
|
+
this.address.placeName = name ?? undefined;
|
|
9
|
+
return this;
|
|
10
|
+
}
|
|
11
|
+
withPlaceId(id) {
|
|
12
|
+
this.address.placeId = id ?? undefined;
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
withCountry(country) {
|
|
16
|
+
this.address.country = country ?? undefined;
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
withCity(city) {
|
|
20
|
+
this.address.city = city ?? undefined;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
withPostalCode(zipCode) {
|
|
24
|
+
this.address.postalCode = zipCode ?? undefined;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
withStreetName(streetName) {
|
|
28
|
+
this.address.streetName = streetName ?? undefined;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
withStreetNumber(streetNumber) {
|
|
32
|
+
this.address.streetNumber = streetNumber ?? undefined;
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
withUnit(unit) {
|
|
36
|
+
this.address.unit = unit ?? undefined;
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
withCoordinates(coordinates) {
|
|
40
|
+
this.address.coordinates = coordinates ?? undefined;
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
build() {
|
|
44
|
+
return this.address;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=address.builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.builder.js","sourceRoot":"","sources":["../lib/address.builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,O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W,IAAI,SAAS,CAAA;QAEnD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Coordinates } from '@wisemen/coordinates';
|
|
2
|
+
export declare class Address {
|
|
3
|
+
placeName?: string | null;
|
|
4
|
+
placeId?: string | null;
|
|
5
|
+
country?: string | null;
|
|
6
|
+
city?: string | null;
|
|
7
|
+
postalCode?: string | null;
|
|
8
|
+
streetName?: string | null;
|
|
9
|
+
streetNumber?: string | null;
|
|
10
|
+
unit?: string | null;
|
|
11
|
+
coordinates?: Coordinates | null;
|
|
12
|
+
}
|
package/dist/address.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.js","sourceRoot":"","sources":["../lib/address.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,OAAO;IAClB,SAAS,CAAgB;IACzB,OAAO,CAAgB;IACvB,OAAO,CAAgB;IACvB,IAAI,CAAgB;IACpB,UAAU,CAAgB;IAC1B,UAAU,CAAgB;IAC1B,YAAY,CAAgB;IAC5B,IAAI,CAAgB;IACpB,WAAW,CAAqB;CACjC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Address } from './address.js';
|
|
2
|
+
export { AddressBuilder } from './address.builder.js';
|
|
3
|
+
export { AddressCommand } from './address-command.js';
|
|
4
|
+
export { AddressCommandBuilder } from './address-command.builder.js';
|
|
5
|
+
export { AddressResponse } from './address-response.js';
|
|
6
|
+
export { AddressColumn } from './address-column.js';
|
|
7
|
+
export { IsAddress, type IsAddressValidationOptions } from './is-address.validator.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Address } from './address.js';
|
|
2
|
+
export { AddressBuilder } from './address.builder.js';
|
|
3
|
+
export { AddressCommand } from './address-command.js';
|
|
4
|
+
export { AddressCommandBuilder } from './address-command.builder.js';
|
|
5
|
+
export { AddressResponse } from './address-response.js';
|
|
6
|
+
export { AddressColumn } from './address-column.js';
|
|
7
|
+
export { IsAddress } from './is-address.validator.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAmC,MAAM,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ValidationOptions } from 'class-validator';
|
|
2
|
+
export interface IsAddressValidationOptions extends ValidationOptions {
|
|
3
|
+
countryRequired?: boolean;
|
|
4
|
+
cityRequired?: boolean;
|
|
5
|
+
postalCodeRequired?: boolean;
|
|
6
|
+
streetNameRequired?: boolean;
|
|
7
|
+
streetNumberRequired?: boolean;
|
|
8
|
+
unitRequired?: boolean;
|
|
9
|
+
coordinatesRequired?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function IsAddress(validationOptions?: IsAddressValidationOptions): PropertyDecorator;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Validate, ValidatorConstraint, IsObject, ValidateNested } from 'class-validator';
|
|
8
|
+
import { applyDecorators } from '@nestjs/common';
|
|
9
|
+
import { Type } from 'class-transformer';
|
|
10
|
+
import { AddressCommand } from './address-command.js';
|
|
11
|
+
export function IsAddress(validationOptions) {
|
|
12
|
+
return applyDecorators(ValidateNested(validationOptions), Type(() => AddressCommand), IsObject(validationOptions), Validate(IsAddressValidator, [{
|
|
13
|
+
countryRequired: validationOptions?.countryRequired ?? false,
|
|
14
|
+
cityRequired: validationOptions?.cityRequired ?? false,
|
|
15
|
+
postalCodeRequired: validationOptions?.postalCodeRequired ?? false,
|
|
16
|
+
streetNameRequired: validationOptions?.streetNameRequired ?? false,
|
|
17
|
+
streetNumberRequired: validationOptions?.streetNumberRequired ?? false,
|
|
18
|
+
unitRequired: validationOptions?.unitRequired ?? false,
|
|
19
|
+
coordinatesRequired: validationOptions?.coordinatesRequired ?? false
|
|
20
|
+
}], validationOptions));
|
|
21
|
+
}
|
|
22
|
+
let IsAddressValidator = class IsAddressValidator {
|
|
23
|
+
validate(address, args) {
|
|
24
|
+
if (!(address instanceof AddressCommand)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const constraints = args.constraints[0];
|
|
28
|
+
return this.isAddressValid(address, constraints);
|
|
29
|
+
}
|
|
30
|
+
isAddressValid(address, constraints) {
|
|
31
|
+
return (!constraints.countryRequired || address.country != null)
|
|
32
|
+
&& (!constraints.cityRequired || address.city != null)
|
|
33
|
+
&& (!constraints.postalCodeRequired || address.postalCode != null)
|
|
34
|
+
&& (!constraints.streetNameRequired || address.streetName != null)
|
|
35
|
+
&& (!constraints.streetNumberRequired || address.streetNumber != null)
|
|
36
|
+
&& (!constraints.unitRequired || address.unit != null);
|
|
37
|
+
}
|
|
38
|
+
defaultMessage(args) {
|
|
39
|
+
const constraints = args.constraints[0];
|
|
40
|
+
const requiredProperties = [];
|
|
41
|
+
for (const key of Object.keys(constraints)) {
|
|
42
|
+
if (constraints[key] === true) {
|
|
43
|
+
requiredProperties.push(key);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return `${args.property}: missing ${requiredProperties.join(', ')}`;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
IsAddressValidator = __decorate([
|
|
50
|
+
ValidatorConstraint({ name: 'isAddress', async: false })
|
|
51
|
+
], IsAddressValidator);
|
|
52
|
+
//# sourceMappingURL=is-address.validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-address.validator.js","sourceRoot":"","sources":["../lib/is-address.validator.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAwE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC/J,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAYrD,MAAM,UAAU,SAAS,CACvB,iBAA8C;IAE9C,OAAO,eAAe,CACpB,cAAc,CAAC,iBAAiB,CAAC,EACjC,IAAI,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,EAC1B,QAAQ,CAAC,iBAAiB,CAAC,EAC3B,QAAQ,CACN,kBAAkB,EAClB,CAAC;YACC,eAAe,EAAE,iBAAiB,EAAE,eAAe,IAAI,KAAK;YAC5D,YAAY,EAAE,iBAAiB,EAAE,YAAY,IAAI,KAAK;YACtD,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,IAAI,KAAK;YAClE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,IAAI,KAAK;YAClE,oBAAoB,EAAE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