@thisisagile/easy 13.4.11 → 13.4.12
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/services/MappedRouteGateway.js.map +1 -1
- package/dist/services/RouteGateway.js.map +1 -1
- package/dist/services/ViewRouteGateway.js.map +1 -1
- package/package.json +2 -2
- package/src/services/MappedRouteGateway.ts +23 -23
- package/src/services/RouteGateway.ts +45 -45
- package/src/services/ViewRouteGateway.ts +31 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappedRouteGateway.js","sourceRoot":"","sources":["../../src/services/MappedRouteGateway.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"MappedRouteGateway.js","sourceRoot":"","sources":["../../src/services/MappedRouteGateway.ts"],"names":[],"mappings":";;;AAAA,+BAA0B;AAE1B,oCAAgC;AAChC,iDAA4C;AAG5C,MAAa,kBAAmB,SAAQ,2BAAY;IAChD,YAAqB,KAAgB,EAAW,OAAkB,EAAW,MAAM,IAAI,cAAM,EAAE,EAAW,MAAW,IAAI,SAAG,EAAE;QAC1H,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QADV,UAAK,GAAL,KAAK,CAAW;QAAW,YAAO,GAAP,OAAO,CAAW;QAAW,QAAG,GAAH,GAAG,CAAe;QAAW,QAAG,GAAH,GAAG,CAAiB;IAE9H,CAAC;IAED,GAAG,CAAC,GAAQ,EAAE,OAAwB;QAClC,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,CAAC,GAAQ,EAAE,OAAwB;QACrC,OAAO,KAAK;aACP,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC;aACjB,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;aACtB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,GAAG,CAAC,IAAU;QACV,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,IAAU;QACb,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5C,CAAC;CACJ;AAvBD,gDAuBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteGateway.js","sourceRoot":"","sources":["../../src/services/RouteGateway.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"RouteGateway.js","sourceRoot":"","sources":["../../src/services/RouteGateway.ts"],"names":[],"mappings":";;;AAAA,+BAAwC;AAExC,kCAAmC;AACnC,6CAAwC;AAExC,MAAa,YAAa,SAAQ,uBAAU;IACxC,YAAqB,KAAgB,EAAW,OAAkB,EAAW,MAAW,IAAI,SAAG,EAAE;QAC7F,KAAK,CAAC,GAAG,CAAC,CAAC;QADM,UAAK,GAAL,KAAK,CAAW;QAAW,YAAO,GAAP,OAAO,CAAW;QAAW,QAAG,GAAH,GAAG,CAAiB;IAEjG,CAAC;IAED,GAAG,CAAC,OAAsB;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,CAAC,EAAM,EAAE,OAAsB;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC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CAAC;IAC/D,CAAC;IAED,MAAM,CAAC,EAAM,EAAE,OAAsB;QACjC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;CACJ;AA1CD,oCA0CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewRouteGateway.js","sourceRoot":"","sources":["../../src/services/ViewRouteGateway.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"ViewRouteGateway.js","sourceRoot":"","sources":["../../src/services/ViewRouteGateway.ts"],"names":[],"mappings":";;;AAAA,+BAA0B;AAE1B,oCAA8B;AAC9B,iDAA4C;AAG5C,MAAa,gBAAiB,SAAQ,2BAAY;IAC9C,YACa,KAAgB,EAChB,OAAkB,EAClB,QAAQ;QACb,EAAE,EAAE,IAAA,YAAI,EAAC,EAAE,CAAC,CAAC,UAAU;QACvB,GAAG,EAAE,IAAA,YAAI,EAAC,EAAE,CAAC,CAAC,UAAU;KAC3B,EACQ,MAAW,IAAI,SAAG,EAAE;QAE7B,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QARlB,UAAK,GAAL,KAAK,CAAW;QAChB,YAAO,GAAP,OAAO,CAAW;QAClB,UAAK,GAAL,KAAK,CAGb;QACQ,QAAG,GAAH,GAAG,CAAiB;IAGjC,CAAC;IAED,GAAG,CAAC,GAAQ,EAAE,OAAwB;QAClC,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,CAAC,GAAQ,EAAE,OAAwB;QACrC,OAAO,KAAK;aACP,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC;aACjB,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;aACtB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,GAAG,CAAC,IAAU;QACV,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,IAAU;QACb,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,CAAC;CACJ;AA/BD,4CA+BC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy",
|
|
3
|
-
"version": "13.4.
|
|
3
|
+
"version": "13.4.12",
|
|
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": "13.4.
|
|
34
|
+
"@thisisagile/easy-test": "13.4.12",
|
|
35
35
|
"@types/form-urlencoded": "^4.4.0",
|
|
36
36
|
"@types/jsonwebtoken": "^9.0.1",
|
|
37
37
|
"@types/luxon": "3.2.0",
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import {Api} from './Api';
|
|
2
|
+
import {Func, Json, List, Optional, Uri} from '../types';
|
|
3
|
+
import {Mapper} from '../utils';
|
|
4
|
+
import {RouteGateway} from './RouteGateway';
|
|
5
|
+
import {RequestOptions} from '../http';
|
|
6
6
|
|
|
7
7
|
export class MappedRouteGateway extends RouteGateway {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
constructor(readonly route: Func<Uri>, readonly routeId: Func<Uri>, readonly map = new Mapper(), readonly api: Api = new Api()) {
|
|
9
|
+
super(route, routeId, api);
|
|
10
|
+
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
get(uri: Uri, options?: RequestOptions): Promise<List<Json>> {
|
|
13
|
+
return super.get(uri, options).then(is => is.map(i => this.map.in(i)));
|
|
14
|
+
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
getOne(uri: Uri, options?: RequestOptions): Promise<Optional<Json>> {
|
|
17
|
+
return super
|
|
18
|
+
.get(uri, options)
|
|
19
|
+
.then(is => is.first())
|
|
20
|
+
.then(i => this.map.in(i));
|
|
21
|
+
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
add(item: Json): Promise<Json> {
|
|
24
|
+
return super.add(this.map.out(item));
|
|
25
|
+
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
update(item: Json): Promise<Json> {
|
|
28
|
+
return super.update(this.map.out(item));
|
|
29
|
+
}
|
|
30
30
|
}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import {Api, RouteOptions} from './Api';
|
|
2
|
+
import {Func, Id, Json, JsonValue, Optional, PageList, Uri} from '../types';
|
|
3
|
+
import {HttpStatus} from '../http';
|
|
4
|
+
import {ApiGateway} from './ApiGateway';
|
|
5
5
|
|
|
6
6
|
export class RouteGateway extends ApiGateway {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
7
|
+
constructor(readonly route: Func<Uri>, readonly routeId: Func<Uri>, readonly api: Api = new Api()) {
|
|
8
|
+
super(api);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
all(options?: RouteOptions): Promise<PageList<Json>> {
|
|
12
|
+
return this.get(this.route(), options);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
byId(id: Id, options?: RouteOptions): Promise<Optional<Json>> {
|
|
16
|
+
return this.getOne(this.routeId().id(id));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
search(q: JsonValue, options?: RouteOptions): Promise<PageList<Json>> {
|
|
20
|
+
return this.get(this.route().query(q), options);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exists(id: Id, options?: RouteOptions): Promise<boolean> {
|
|
24
|
+
return this.get(this.routeId().id(id))
|
|
25
|
+
.then(r => r.length === 1)
|
|
26
|
+
.catch(r => (HttpStatus.NotFound.equals(r.status) ? false : Promise.reject(r)));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
add(item: Json, options?: RouteOptions): Promise<Json> {
|
|
30
|
+
return this.post(this.route(), item, options);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
filter(options?: RouteOptions): Promise<PageList<Json>> {
|
|
34
|
+
return this.postSearch(this.route(), options);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
update(item: Json, options?: RouteOptions): Promise<Json> {
|
|
38
|
+
return this.patch(this.routeId().id(item.id), item, options);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
upsert(item: Json, options?: RouteOptions): Promise<Json> {
|
|
42
|
+
return this.put(this.routeId().id(item.id), item, options);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
remove(id: Id, options?: RouteOptions): Promise<boolean> {
|
|
46
|
+
return this.delete(this.routeId().id(id), options);
|
|
47
|
+
}
|
|
48
48
|
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import {Api} from './Api';
|
|
2
|
+
import {Func, Json, List, Optional, Uri} from '../types';
|
|
3
|
+
import {view} from '../utils';
|
|
4
|
+
import {RouteGateway} from './RouteGateway';
|
|
5
|
+
import {RequestOptions} from '../http';
|
|
6
6
|
|
|
7
7
|
export class ViewRouteGateway extends RouteGateway {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
constructor(
|
|
9
|
+
readonly route: Func<Uri>,
|
|
10
|
+
readonly routeId: Func<Uri>,
|
|
11
|
+
readonly views = {
|
|
12
|
+
in: view({}).fromSource,
|
|
13
|
+
out: view({}).fromSource,
|
|
14
|
+
},
|
|
15
|
+
readonly api: Api = new Api()
|
|
16
|
+
) {
|
|
17
|
+
super(route, routeId, api);
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
get(uri: Uri, options?: RequestOptions): Promise<List<Json>> {
|
|
21
|
+
return super.get(uri, options).then(is => is.map(i => this.views.in.from(i)));
|
|
22
|
+
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
getOne(uri: Uri, options?: RequestOptions): Promise<Optional<Json>> {
|
|
25
|
+
return super
|
|
26
|
+
.get(uri, options)
|
|
27
|
+
.then(is => is.first())
|
|
28
|
+
.then(i => this.views.in.from(i));
|
|
29
|
+
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
add(item: Json): Promise<Json> {
|
|
32
|
+
return super.add(this.views.out.from(item));
|
|
33
|
+
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
update(item: Json): Promise<Json> {
|
|
36
|
+
return super.update(this.views.out.from(item));
|
|
37
|
+
}
|
|
38
38
|
}
|