@thisisagile/easy-express 7.8.17 → 7.10.2
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/README.md
CHANGED
|
@@ -227,7 +227,7 @@ Because data in existing databases rarely supplies the format you need in your s
|
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
The `Map
|
|
230
|
+
The `Map` and `Table` classes have a property called `db` that represents the database to connect to. This is usually an instance of the `Database` enumeration, which in its turn defines the database (and its provider) to connect to, as in the example below.
|
|
231
231
|
|
|
232
232
|
export class MyDatabase extends Database {
|
|
233
233
|
static readonly Erp = new Database('openerp', PostgreSqlProvider);
|
|
@@ -10,9 +10,7 @@ export declare class NamespaceContext implements RequestContext {
|
|
|
10
10
|
set correlationId(id: Uuid);
|
|
11
11
|
get lastError(): string | undefined;
|
|
12
12
|
set lastError(error: string | undefined);
|
|
13
|
-
get
|
|
14
|
-
set tenant(tenant: string | undefined);
|
|
15
|
-
get(key: string): any;
|
|
13
|
+
get<T>(key: string): T;
|
|
16
14
|
set<T>(key: string, value: T): T;
|
|
17
15
|
readonly create: (f: () => void) => void;
|
|
18
16
|
}
|
|
@@ -34,12 +34,6 @@ class NamespaceContext {
|
|
|
34
34
|
set lastError(error) {
|
|
35
35
|
this.namespace.set('lastError', error);
|
|
36
36
|
}
|
|
37
|
-
get tenant() {
|
|
38
|
-
return this.namespace.get('tenant');
|
|
39
|
-
}
|
|
40
|
-
set tenant(tenant) {
|
|
41
|
-
this.namespace.set('tenant', tenant);
|
|
42
|
-
}
|
|
43
37
|
get(key) {
|
|
44
38
|
return this.namespace.get(key);
|
|
45
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NamespaceContext.js","sourceRoot":"","sources":["../../src/types/NamespaceContext.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAG7C,
|
|
1
|
+
{"version":3,"file":"NamespaceContext.js","sourceRoot":"","sources":["../../src/types/Namesp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tC,CAAC;IAEM,GAAG,CAAI,GAAW,EAAE,KAAQ;QACjC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;CAGF;AAhDD,4CAgDC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy-express",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.10.2",
|
|
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.10.2",
|
|
35
35
|
"@types/cls-hooked": "^4.3.3",
|
|
36
36
|
"@types/form-urlencoded": "^4.4.0",
|
|
37
37
|
"@types/jsonwebtoken": "^8.5.5",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@types/validator": "^13.6.3"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@thisisagile/easy": "7.
|
|
44
|
+
"@thisisagile/easy": "7.10.2",
|
|
45
45
|
"@types/express": "^4.17.13",
|
|
46
46
|
"cls-hooked": "^4.2.2",
|
|
47
47
|
"express": "^4.17.1",
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { createNamespace } from 'cls-hooked';
|
|
2
2
|
import { Identity, RequestContext, Uuid } from '@thisisagile/easy';
|
|
3
3
|
|
|
4
|
-
export class
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
NamespaceContext implements RequestContext {
|
|
4
|
+
export class NamespaceContext implements RequestContext {
|
|
8
5
|
private readonly namespace = createNamespace('context');
|
|
9
6
|
|
|
10
7
|
get token(): unknown {
|
|
@@ -43,16 +40,8 @@ NamespaceContext implements RequestContext {
|
|
|
43
40
|
this.namespace.set('lastError', error);
|
|
44
41
|
}
|
|
45
42
|
|
|
46
|
-
get
|
|
47
|
-
return this.namespace.get(
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
set tenant(tenant: string | undefined) {
|
|
51
|
-
this.namespace.set('tenant', tenant);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public get(key: string): any {
|
|
55
|
-
return this.namespace.get(key);
|
|
43
|
+
public get<T>(key: string): T {
|
|
44
|
+
return this.namespace.get(key) as T;
|
|
56
45
|
}
|
|
57
46
|
|
|
58
47
|
public set<T>(key: string, value: T): T {
|