@thisisagile/easy-express 8.17.4 → 8.18.0
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,15 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class NamespaceContext implements RequestContext {
|
|
3
|
-
|
|
4
|
-
get token(): unknown;
|
|
5
|
-
set token(token: unknown);
|
|
6
|
-
get identity(): Identity;
|
|
7
|
-
get jwt(): string;
|
|
8
|
-
set jwt(jwt: string);
|
|
9
|
-
get correlationId(): Uuid;
|
|
10
|
-
set correlationId(id: Uuid);
|
|
11
|
-
get lastError(): string | undefined;
|
|
12
|
-
set lastError(error: string | undefined);
|
|
1
|
+
import { BaseContext, RequestContext } from "@thisisagile/easy";
|
|
2
|
+
export declare class NamespaceContext extends BaseContext implements RequestContext {
|
|
3
|
+
protected readonly namespace: import("cls-hooked").Namespace;
|
|
13
4
|
get<T>(key: string): T;
|
|
14
5
|
set<T>(key: string, value: T): T;
|
|
15
6
|
readonly create: (f: () => void) => void;
|
|
@@ -2,38 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NamespaceContext = void 0;
|
|
4
4
|
const cls_hooked_1 = require("cls-hooked");
|
|
5
|
-
|
|
5
|
+
const easy_1 = require("@thisisagile/easy");
|
|
6
|
+
class NamespaceContext extends easy_1.BaseContext {
|
|
6
7
|
constructor() {
|
|
8
|
+
super(...arguments);
|
|
7
9
|
this.namespace = (0, cls_hooked_1.createNamespace)('context');
|
|
8
10
|
this.create = (f) => this.namespace.run(f);
|
|
9
11
|
}
|
|
10
|
-
get token() {
|
|
11
|
-
return this.namespace.get('token');
|
|
12
|
-
}
|
|
13
|
-
set token(token) {
|
|
14
|
-
this.namespace.set('token', token);
|
|
15
|
-
}
|
|
16
|
-
get identity() {
|
|
17
|
-
return this.token;
|
|
18
|
-
}
|
|
19
|
-
get jwt() {
|
|
20
|
-
return this.namespace.get('jwt');
|
|
21
|
-
}
|
|
22
|
-
set jwt(jwt) {
|
|
23
|
-
this.namespace.set('jwt', jwt);
|
|
24
|
-
}
|
|
25
|
-
get correlationId() {
|
|
26
|
-
return this.namespace.get('correlationId');
|
|
27
|
-
}
|
|
28
|
-
set correlationId(id) {
|
|
29
|
-
this.namespace.set('correlationId', id);
|
|
30
|
-
}
|
|
31
|
-
get lastError() {
|
|
32
|
-
return this.namespace.get('lastError');
|
|
33
|
-
}
|
|
34
|
-
set lastError(error) {
|
|
35
|
-
this.namespace.set('lastError', error);
|
|
36
|
-
}
|
|
37
12
|
get(key) {
|
|
38
13
|
return this.namespace.get(key);
|
|
39
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NamespaceContext.js","sourceRoot":"","sources":["../../src/types/NamespaceContext.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;
|
|
1
|
+
{"version":3,"file":"NamespaceContext.js","sourceRoot":"","sources":["../../src/types/NamespaceContext.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAC7C,4CAAgE;AAEhE,MAAa,gBAAiB,SAAQ,kBAAW;IAAjD;;QACqB,cAAS,GAAG,IAAA,4BAAe,EAAC,SAAS,CAAC,CAAC;QAU1C,WAAM,GAAG,CAAC,CAAa,EAAQ,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;IATQ,GAAG,CAAI,GAAW;QACvB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAM,CAAC;IACtC,CAAC;IAEM,GAAG,CAAI,GAAW,EAAE,KAAQ;QACjC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;CAGF;AAZD,4CAYC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy-express",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.18.0",
|
|
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.
|
|
34
|
+
"@thisisagile/easy-test": "8.18.0",
|
|
35
35
|
"@types/cls-hooked": "^4.3.3",
|
|
36
36
|
"@types/form-urlencoded": "^4.4.0",
|
|
37
37
|
"@types/jsonwebtoken": "^8.5.6",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@types/validator": "^13.7.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@thisisagile/easy": "8.
|
|
44
|
+
"@thisisagile/easy": "8.18.0",
|
|
45
45
|
"@types/express": "^4.17.13",
|
|
46
46
|
"cls-hooked": "^4.2.2",
|
|
47
47
|
"express": "^4.17.1",
|
|
@@ -1,44 +1,8 @@
|
|
|
1
1
|
import { createNamespace } from 'cls-hooked';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseContext, RequestContext } from "@thisisagile/easy";
|
|
3
3
|
|
|
4
|
-
export class NamespaceContext implements RequestContext {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
get token(): unknown {
|
|
8
|
-
return this.namespace.get('token');
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
set token(token: unknown) {
|
|
12
|
-
this.namespace.set('token', token);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
get identity(): Identity {
|
|
16
|
-
return this.token as Identity;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get jwt(): string {
|
|
20
|
-
return this.namespace.get('jwt');
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
set jwt(jwt: string) {
|
|
24
|
-
this.namespace.set('jwt', jwt);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
get correlationId(): Uuid {
|
|
28
|
-
return this.namespace.get('correlationId');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
set correlationId(id: Uuid) {
|
|
32
|
-
this.namespace.set('correlationId', id);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
get lastError(): string | undefined {
|
|
36
|
-
return this.namespace.get('lastError');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
set lastError(error: string | undefined) {
|
|
40
|
-
this.namespace.set('lastError', error);
|
|
41
|
-
}
|
|
4
|
+
export class NamespaceContext extends BaseContext implements RequestContext {
|
|
5
|
+
protected readonly namespace = createNamespace('context');
|
|
42
6
|
|
|
43
7
|
public get<T>(key: string): T {
|
|
44
8
|
return this.namespace.get(key) as T;
|