@thisisagile/easy 7.38.2 → 7.40.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.
- package/dist/domain/values/DateTime.d.ts +2 -1
- package/dist/domain/values/DateTime.js +5 -2
- package/dist/domain/values/DateTime.js.map +1 -1
- package/dist/types/Gateway.d.ts +9 -9
- package/dist/types/Gateway.js +36 -0
- package/dist/types/Gateway.js.map +1 -1
- package/package.json +2 -2
- package/src/domain/values/DateTime.ts +6 -2
- package/src/types/Gateway.ts +32 -9
|
@@ -2,13 +2,14 @@ import { Value } from '../../types';
|
|
|
2
2
|
import { Moment } from 'moment';
|
|
3
3
|
export declare type DateTimeUnit = 'years' | 'quarters' | 'months' | 'weeks' | 'days' | 'hours' | 'minutes' | 'seconds' | 'milliseconds';
|
|
4
4
|
export declare class DateTime extends Value<string | undefined> {
|
|
5
|
-
constructor(value?: string | number | Date);
|
|
5
|
+
constructor(value?: string | number | Date, format?: string);
|
|
6
6
|
static get now(): DateTime;
|
|
7
7
|
get isValid(): boolean;
|
|
8
8
|
get fromNow(): string;
|
|
9
9
|
protected get utc(): Moment;
|
|
10
10
|
isAfter(dt: DateTime): boolean;
|
|
11
11
|
isBefore(dt: DateTime): boolean;
|
|
12
|
+
equals(dt: DateTime): boolean;
|
|
12
13
|
add: (n: number, unit?: DateTimeUnit) => DateTime;
|
|
13
14
|
subtract: (n: number, unit?: DateTimeUnit) => DateTime;
|
|
14
15
|
diff: (other: DateTime, unit?: DateTimeUnit) => number;
|
|
@@ -7,8 +7,8 @@ exports.DateTime = void 0;
|
|
|
7
7
|
const types_1 = require("../../types");
|
|
8
8
|
const moment_1 = __importDefault(require("moment"));
|
|
9
9
|
class DateTime extends types_1.Value {
|
|
10
|
-
constructor(value) {
|
|
11
|
-
super((0, types_1.tryTo)(value).is.defined().map(v => moment_1.default.utc(v, true).toISOString()).orElse());
|
|
10
|
+
constructor(value, format) {
|
|
11
|
+
super((0, types_1.tryTo)(value).is.defined().map(v => moment_1.default.utc(v, format, true).toISOString()).orElse());
|
|
12
12
|
this.add = (n, unit = 'days') => new DateTime(this.utc.add(n, unit).toISOString());
|
|
13
13
|
this.subtract = (n, unit = 'days') => new DateTime(this.utc.subtract(n, unit).toISOString());
|
|
14
14
|
this.diff = (other, unit = 'days') => this.utc.diff(other.utc, unit);
|
|
@@ -31,6 +31,9 @@ class DateTime extends types_1.Value {
|
|
|
31
31
|
isBefore(dt) {
|
|
32
32
|
return this.utc.isBefore(moment_1.default.utc(dt.value));
|
|
33
33
|
}
|
|
34
|
+
equals(dt) {
|
|
35
|
+
return this.utc.isSame(moment_1.default.utc(dt.value));
|
|
36
|
+
}
|
|
34
37
|
toString() {
|
|
35
38
|
return this.value ?? '';
|
|
36
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTime.js","sourceRoot":"","sources":["../../../src/domain/values/DateTime.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAsD;AACtD,oDAAwC;AAaxC,MAAa,QAAS,SAAQ,aAAyB;IACrD,YAAY,KAA8B;
|
|
1
|
+
{"version":3,"file":"DateTime.js","sourceRoot":"","sources":["../../../src/domain/values/DateTime.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAsD;AACtD,oDAAwC;AAaxC,MAAa,QAAS,SAAQ,aAAyB;IACrD,YAAY,KAA8B,EAAE,MAAe;QACzD,KAAK,CAAC,IAAA,aAAK,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,gBAAM,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QA+BhG,QAAG,GAAG,CAAC,CAAS,EAAE,OAAqB,MAAM,EAAY,EAAE,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EA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CAAC,gBAAM,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;IAQD,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAC1B,CAAC;IAED,QAAQ,CAAC,UAA6B,OAAO,EAAE,UAAsC,EAAE;QACrF,OAAO,IAAI,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;IACnE,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACtD,CAAC;CACF;AAlDD,4BAkDC"}
|
package/dist/types/Gateway.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { List } from './List';
|
|
2
2
|
import { Json, JsonValue } from './Json';
|
|
3
3
|
import { Id } from './Id';
|
|
4
|
-
export
|
|
5
|
-
all
|
|
6
|
-
byId
|
|
7
|
-
by
|
|
8
|
-
search
|
|
9
|
-
exists
|
|
10
|
-
add
|
|
11
|
-
update
|
|
12
|
-
remove
|
|
4
|
+
export declare abstract class Gateway {
|
|
5
|
+
all(): Promise<List<Json>>;
|
|
6
|
+
byId(id: Id): Promise<Json | undefined>;
|
|
7
|
+
by(key: string, value: JsonValue): Promise<List<Json>>;
|
|
8
|
+
search(q: JsonValue): Promise<List<Json>>;
|
|
9
|
+
exists(id: Id): Promise<boolean>;
|
|
10
|
+
add(item: Json): Promise<Json>;
|
|
11
|
+
update(item: Json): Promise<Json>;
|
|
12
|
+
remove(id: Id): Promise<boolean>;
|
|
13
13
|
}
|
package/dist/types/Gateway.js
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Gateway = void 0;
|
|
4
|
+
const Exception_1 = require("./Exception");
|
|
5
|
+
class Gateway {
|
|
6
|
+
all() {
|
|
7
|
+
throw Exception_1.Exception.IsNotImplemented;
|
|
8
|
+
}
|
|
9
|
+
byId(id) {
|
|
10
|
+
throw Exception_1.Exception.IsNotImplemented;
|
|
11
|
+
}
|
|
12
|
+
;
|
|
13
|
+
by(key, value) {
|
|
14
|
+
throw Exception_1.Exception.IsNotImplemented;
|
|
15
|
+
}
|
|
16
|
+
;
|
|
17
|
+
search(q) {
|
|
18
|
+
throw Exception_1.Exception.IsNotImplemented;
|
|
19
|
+
}
|
|
20
|
+
;
|
|
21
|
+
exists(id) {
|
|
22
|
+
throw Exception_1.Exception.IsNotImplemented;
|
|
23
|
+
}
|
|
24
|
+
;
|
|
25
|
+
add(item) {
|
|
26
|
+
throw Exception_1.Exception.IsNotImplemented;
|
|
27
|
+
}
|
|
28
|
+
;
|
|
29
|
+
update(item) {
|
|
30
|
+
throw Exception_1.Exception.IsNotImplemented;
|
|
31
|
+
}
|
|
32
|
+
;
|
|
33
|
+
remove(id) {
|
|
34
|
+
throw Exception_1.Exception.IsNotImplemented;
|
|
35
|
+
}
|
|
36
|
+
;
|
|
37
|
+
}
|
|
38
|
+
exports.Gateway = Gateway;
|
|
3
39
|
//# sourceMappingURL=Gateway.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Gateway.js","sourceRoot":"","sources":["../../src/types/Gateway.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Gateway.js","sourceRoot":"","sources":["../../src/types/Gateway.ts"],"names":[],"mappings":";;;AAGA,2CAAwC;AAExC,MAAsB,OAAO;IAC3B,GAAG;QACD,MAAM,qBAAS,CAAC,gBAAgB,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,EAAM;QACT,MAAM,qBAAS,CAAC,gBAAgB,CAAC;IACnC,CAAC;IAAA,CAAC;IAEF,EAAE,CAAC,GAAW,EAAE,KAAgB;QAC9B,MAAM,qBAAS,CAAC,gBAAgB,CAAC;IACnC,CAAC;IAAA,CAAC;IAEF,MAAM,CAAC,CAAY;QACjB,MAAM,qBAAS,CAAC,gBAAgB,CAAC;IACnC,CAAC;IAAA,CAAC;IAEF,MAAM,CAAC,EAAM;QACX,MAAM,qBAAS,CAAC,gBAAgB,CAAC;IACnC,CAAC;IAAA,CAAC;IAEF,GAAG,CAAC,IAAU;QACZ,MAAM,qBAAS,CAAC,gBAAgB,CAAC;IACnC,CAAC;IAAA,CAAC;IAEF,MAAM,CAAC,IAAU;QACf,MAAM,qBAAS,CAAC,gBAAgB,CAAC;IACnC,CAAC;IAAA,CAAC;IAEF,MAAM,CAAC,EAAM;QACX,MAAM,qBAAS,CAAC,gBAAgB,CAAC;IACnC,CAAC;IAAA,CAAC;CACH;AAhCD,0BAgCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.40.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.
|
|
34
|
+
"@thisisagile/easy-test": "7.40.3",
|
|
35
35
|
"@types/form-urlencoded": "^4.4.0",
|
|
36
36
|
"@types/jsonwebtoken": "^8.5.5",
|
|
37
37
|
"@types/validator": "^13.6.6"
|
|
@@ -13,8 +13,8 @@ export type DateTimeUnit =
|
|
|
13
13
|
| 'milliseconds';
|
|
14
14
|
|
|
15
15
|
export class DateTime extends Value<string | undefined> {
|
|
16
|
-
constructor(value?: string | number | Date) {
|
|
17
|
-
super(tryTo(value).is.defined().map(v => moment.utc(v, true).toISOString()).orElse());
|
|
16
|
+
constructor(value?: string | number | Date, format?: string) {
|
|
17
|
+
super(tryTo(value).is.defined().map(v => moment.utc(v, format, true).toISOString()).orElse());
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
static get now(): DateTime {
|
|
@@ -41,6 +41,10 @@ export class DateTime extends Value<string | undefined> {
|
|
|
41
41
|
return this.utc.isBefore(moment.utc(dt.value));
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
equals(dt: DateTime): boolean {
|
|
45
|
+
return this.utc.isSame(moment.utc(dt.value));
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
add = (n: number, unit: DateTimeUnit = 'days'): DateTime => new DateTime(this.utc.add(n, unit).toISOString());
|
|
45
49
|
|
|
46
50
|
subtract = (n: number, unit: DateTimeUnit = 'days'): DateTime => new DateTime(this.utc.subtract(n, unit).toISOString());
|
package/src/types/Gateway.ts
CHANGED
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
import { List } from './List';
|
|
2
2
|
import { Json, JsonValue } from './Json';
|
|
3
3
|
import { Id } from './Id';
|
|
4
|
+
import { Exception } from './Exception';
|
|
4
5
|
|
|
5
|
-
export
|
|
6
|
-
all
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
search: (q: JsonValue) => Promise<List<Json>>;
|
|
10
|
-
exists: (id: Id) => Promise<boolean>;
|
|
6
|
+
export abstract class Gateway {
|
|
7
|
+
all(): Promise<List<Json>> {
|
|
8
|
+
throw Exception.IsNotImplemented;
|
|
9
|
+
}
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
byId(id: Id): Promise<Json | undefined> {
|
|
12
|
+
throw Exception.IsNotImplemented;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
by(key: string, value: JsonValue): Promise<List<Json>> {
|
|
16
|
+
throw Exception.IsNotImplemented;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
search(q: JsonValue): Promise<List<Json>> {
|
|
20
|
+
throw Exception.IsNotImplemented;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
exists(id: Id): Promise<boolean> {
|
|
24
|
+
throw Exception.IsNotImplemented;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
add(item: Json): Promise<Json> {
|
|
28
|
+
throw Exception.IsNotImplemented;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
update(item: Json): Promise<Json> {
|
|
32
|
+
throw Exception.IsNotImplemented;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
remove(id: Id): Promise<boolean> {
|
|
36
|
+
throw Exception.IsNotImplemented;
|
|
37
|
+
};
|
|
15
38
|
}
|