@cryptexlabs/codex-nodejs-common 0.10.25 → 0.10.26
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/lib/package.json +1 -1
- package/lib/src/context/context.d.ts +2 -2
- package/lib/src/context/context.js +3 -3
- package/lib/src/context/context.js.map +1 -1
- package/lib/src/message/message-meta.d.ts +4 -5
- package/lib/src/message/message-meta.js +1 -3
- package/lib/src/message/message-meta.js.map +1 -1
- package/lib/src/response/contextual-http.response.js +1 -1
- package/lib/src/response/contextual-http.response.js.map +1 -1
- package/lib/src/response/error-http.response.d.ts +1 -1
- package/lib/src/response/error-http.response.js +2 -2
- package/lib/src/response/error-http.response.js.map +1 -1
- package/lib/src/response/healthz-response.js +1 -1
- package/lib/src/response/healthz-response.js.map +1 -1
- package/lib/src/response/http-response-meta.d.ts +4 -3
- package/lib/src/response/http-response-meta.js +3 -1
- package/lib/src/response/http-response-meta.js.map +1 -1
- package/lib/src/response/http-response.d.ts +1 -1
- package/lib/src/response/http-response.js +2 -2
- package/lib/src/response/http-response.js.map +1 -1
- package/lib/src/response/rest.response.d.ts +4 -3
- package/lib/src/response/rest.response.js +3 -2
- package/lib/src/response/rest.response.js.map +1 -1
- package/package.json +1 -1
- package/src/context/context.ts +2 -3
- package/src/message/message-meta.ts +3 -7
- package/src/response/contextual-http.response.ts +2 -1
- package/src/response/error-http.response.ts +4 -2
- package/src/response/healthz-response.ts +1 -0
- package/src/response/http-response-meta.ts +5 -2
- package/src/response/http-response.ts +4 -2
- package/src/response/rest.response.ts +6 -3
package/lib/package.json
CHANGED
|
@@ -9,9 +9,9 @@ export declare class Context {
|
|
|
9
9
|
readonly locale: LocaleI18nInterface;
|
|
10
10
|
readonly messageContext: MessageContextInterface;
|
|
11
11
|
readonly i18n?: I18n;
|
|
12
|
-
|
|
12
|
+
readonly path?: string;
|
|
13
13
|
readonly logger: LoggerService;
|
|
14
14
|
started: Date;
|
|
15
|
-
constructor(correlationId: string, logger: LoggerService, config: DefaultConfig, client: ClientInterface, locale: LocaleI18nInterface, messageContext: MessageContextInterface, started?: Date, i18n?: I18n,
|
|
15
|
+
constructor(correlationId: string, logger: LoggerService, config: DefaultConfig, client: ClientInterface, locale: LocaleI18nInterface, messageContext: MessageContextInterface, started?: Date, i18n?: I18n, path?: string);
|
|
16
16
|
getMessageMeta(type: string): MessageMetaInterface;
|
|
17
17
|
}
|
|
@@ -4,19 +4,19 @@ exports.Context = void 0;
|
|
|
4
4
|
const logger_1 = require("../logger");
|
|
5
5
|
const message_1 = require("../message");
|
|
6
6
|
class Context {
|
|
7
|
-
constructor(correlationId, logger, config, client, locale, messageContext, started, i18n,
|
|
7
|
+
constructor(correlationId, logger, config, client, locale, messageContext, started, i18n, path) {
|
|
8
8
|
this.correlationId = correlationId;
|
|
9
9
|
this.config = config;
|
|
10
10
|
this.client = client;
|
|
11
11
|
this.locale = locale;
|
|
12
12
|
this.messageContext = messageContext;
|
|
13
13
|
this.i18n = i18n;
|
|
14
|
-
this.
|
|
14
|
+
this.path = path;
|
|
15
15
|
this.logger = new logger_1.ContextLogger(correlationId, config, client, logger);
|
|
16
16
|
this.started = started || new Date(Date.now());
|
|
17
17
|
}
|
|
18
18
|
getMessageMeta(type) {
|
|
19
|
-
return new message_1.MessageMeta(type, this.locale, this.config, this.correlationId, this.started
|
|
19
|
+
return new message_1.MessageMeta(type, this.locale, this.config, this.correlationId, this.started);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.Context = Context;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/context/context.ts"],"names":[],"mappings":";;;AAQA,sCAA0C;AAC1C,wCAAyC;AAGzC,MAAa,OAAO;IAIlB,YACS,aAAqB,EAC5B,MAAqB,EACd,MAAqB,EACrB,MAAuB,EACd,MAA2B,EAC3B,cAAuC,EACvD,OAAc,EACE,IAAW,
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/context/context.ts"],"names":[],"mappings":";;;AAQA,sCAA0C;AAC1C,wCAAyC;AAGzC,MAAa,OAAO;IAIlB,YACS,aAAqB,EAC5B,MAAqB,EACd,MAAqB,EACrB,MAAuB,EACd,MAA2B,EAC3B,cAAuC,EACvD,OAAc,EACE,IAAW,EACX,IAAa;QARtB,kBAAa,GAAb,aAAa,CAAQ;QAErB,WAAM,GAAN,MAAM,CAAe;QACrB,WAAM,GAAN,MAAM,CAAiB;QACd,WAAM,GAAN,MAAM,CAAqB;QAC3B,mBAAc,GAAd,cAAc,CAAyB;QAEvC,SAAI,GAAJ,IAAI,CAAO;QACX,SAAI,GAAJ,IAAI,CAAS;QAE7B,IAAI,CAAC,MAAM,GAAG,IAAI,sBAAa,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACvE,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,cAAc,CAAC,IAAY;QACzB,OAAO,IAAI,qBAAW,CACpB,IAAI,EACJ,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,OAAO,CACb,CAAC;IACJ,CAAC;CACF;AA5BD,0BA4BC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { ClientInterface, LocaleInterface, MessageContextInterface,
|
|
1
|
+
import { ClientInterface, LocaleInterface, MessageContextInterface, MessageMetaInterface, MetaTimeInterface } from "@cryptexlabs/codex-data-model";
|
|
2
2
|
import { DefaultConfig } from "../config";
|
|
3
3
|
import { JsonSerializableInterface } from "./json-serializable.interface";
|
|
4
|
-
export declare class MessageMeta implements MessageMetaInterface, JsonSerializableInterface<MessageMetaInterface
|
|
4
|
+
export declare class MessageMeta implements MessageMetaInterface, JsonSerializableInterface<MessageMetaInterface> {
|
|
5
5
|
readonly type: string;
|
|
6
6
|
readonly locale: LocaleInterface;
|
|
7
7
|
private readonly started?;
|
|
8
|
-
path?: string;
|
|
9
8
|
time: MetaTimeInterface;
|
|
10
9
|
context: MessageContextInterface;
|
|
11
10
|
interactionId: string | null;
|
|
@@ -13,6 +12,6 @@ export declare class MessageMeta implements MessageMetaInterface, JsonSerializab
|
|
|
13
12
|
private _correlationId;
|
|
14
13
|
get correlationId(): string;
|
|
15
14
|
client: ClientInterface;
|
|
16
|
-
constructor(type: string, locale: LocaleInterface, config: DefaultConfig, correlationId?: string, started?: Date
|
|
17
|
-
toJSON(): MessageMetaInterface
|
|
15
|
+
constructor(type: string, locale: LocaleInterface, config: DefaultConfig, correlationId?: string, started?: Date);
|
|
16
|
+
toJSON(): MessageMetaInterface;
|
|
18
17
|
}
|
|
@@ -11,11 +11,10 @@ class MessageMeta {
|
|
|
11
11
|
}
|
|
12
12
|
return this._correlationId;
|
|
13
13
|
}
|
|
14
|
-
constructor(type, locale, config, correlationId, started
|
|
14
|
+
constructor(type, locale, config, correlationId, started) {
|
|
15
15
|
this.type = type;
|
|
16
16
|
this.locale = locale;
|
|
17
17
|
this.started = started;
|
|
18
|
-
this.path = path;
|
|
19
18
|
const now = new Date(Date.now());
|
|
20
19
|
const start = started || now;
|
|
21
20
|
this.time = {
|
|
@@ -33,7 +32,6 @@ class MessageMeta {
|
|
|
33
32
|
}
|
|
34
33
|
toJSON() {
|
|
35
34
|
return {
|
|
36
|
-
path: this.path,
|
|
37
35
|
type: this.type,
|
|
38
36
|
schemaVersion: this.schemaVersion,
|
|
39
37
|
correlationId: this.correlationId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-meta.js","sourceRoot":"","sources":["../../../src/message/message-meta.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"message-meta.js","sourceRoot":"","sources":["../../../src/message/message-meta.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AACpC,oEAOuC;AACvC,sCAA0C;AAI1C,MAAa,WAAW;IAkBtB,IAAW,aAAa;QACtB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,IAAI,CAAC,cAAc,GAAG,IAAA,SAAM,GAAE,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAID,YACkB,IAAY,EACZ,MAAuB,EACvC,MAAqB,EACrB,aAAsB,EACL,OAAc;QAJf,SAAI,GAAJ,IAAI,CAAQ;QACZ,WAAM,GAAN,MAAM,CAAiB;QAGtB,YAAO,GAAP,OAAO,CAAO;QAE/B,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACjC,MAAM,KAAK,GAAG,OAAO,IAAI,GAAG,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG;YACV,OAAO,EAAE,GAAG,CAAC,WAAW,EAAE;YAC1B,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE;SAC7B,CAAC;QACF,IAAI,CAAC,OAAO,GAAG;YACb,QAAQ,EAAE,SAAS;YACnB,EAAE,EAAE,MAAM;SACX,CAAC;QACF,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,0BAAO,CAAC,OAAO,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,MAAM,GAAG,IAAI,sBAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;IACJ,CAAC;CACF;AA7DD,kCA6DC"}
|
|
@@ -5,7 +5,7 @@ const http_response_1 = require("./http-response");
|
|
|
5
5
|
const codex_data_model_1 = require("@cryptexlabs/codex-data-model");
|
|
6
6
|
class ContextualHttpResponse extends http_response_1.HttpResponse {
|
|
7
7
|
constructor(context, status, i18nInstance, phraseKey) {
|
|
8
|
-
super(status, context.config.getMetaType(codex_data_model_1.CodexMetaTypeEnum.NA_HTTP_SIMPLE), context.locale, context.config, context.correlationId, context.started);
|
|
8
|
+
super(status, context.config.getMetaType(codex_data_model_1.CodexMetaTypeEnum.NA_HTTP_SIMPLE), context.locale, context.config, context.correlationId, context.started, context.path);
|
|
9
9
|
this.meta.context = context.messageContext
|
|
10
10
|
? context.messageContext
|
|
11
11
|
: this.meta.context;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextual-http.response.js","sourceRoot":"","sources":["../../../src/response/contextual-http.response.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAG/C,oEAGuC;AAIvC,MAAa,sBACX,SAAQ,4BAAe;IAIvB,YACE,OAAgB,EAChB,MAAkB,EAClB,YAAkB,EAClB,SAAiB;QAEjB,KAAK,CACH,MAAM,EACN,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,oCAAiB,CAAC,cAAc,CAAC,EAC5D,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"contextual-http.response.js","sourceRoot":"","sources":["../../../src/response/contextual-http.response.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAG/C,oEAGuC;AAIvC,MAAa,sBACX,SAAQ,4BAAe;IAIvB,YACE,OAAgB,EAChB,MAAkB,EAClB,YAAkB,EAClB,SAAiB;QAEjB,KAAK,CACH,MAAM,EACN,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,oCAAiB,CAAC,cAAc,CAAC,EAC5D,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,IAAI,CACb,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,cAAc;YACxC,CAAC,CAAC,OAAO,CAAC,cAAc;YACxB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,EAAE,CAAC;YAC9B,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;SAC5B,CAAC,CAAC;IACL,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAhCD,wDAgCC"}
|
|
@@ -7,7 +7,7 @@ export declare class ErrorHttpResponse implements JsonSerializableInterface<Mess
|
|
|
7
7
|
private readonly errorMessage;
|
|
8
8
|
private readonly stack;
|
|
9
9
|
readonly meta: MessageMetaInterface;
|
|
10
|
-
constructor(status: HttpStatus, locale: LocaleInterface, errorMessage: ErrorMessageInterface, stack: string, config: DefaultConfig, correlationId?: string, started?: Date);
|
|
10
|
+
constructor(status: HttpStatus, locale: LocaleInterface, errorMessage: ErrorMessageInterface, stack: string, config: DefaultConfig, correlationId?: string, started?: Date, path?: string);
|
|
11
11
|
toJSON(): MessageInterface<ErrorMessageDataInterface>;
|
|
12
12
|
get data(): ErrorMessageDataInterface;
|
|
13
13
|
}
|
|
@@ -4,10 +4,10 @@ exports.ErrorHttpResponse = void 0;
|
|
|
4
4
|
const codex_data_model_1 = require("@cryptexlabs/codex-data-model");
|
|
5
5
|
const http_response_meta_1 = require("./http-response-meta");
|
|
6
6
|
class ErrorHttpResponse {
|
|
7
|
-
constructor(status, locale, errorMessage, stack, config, correlationId, started) {
|
|
7
|
+
constructor(status, locale, errorMessage, stack, config, correlationId, started, path) {
|
|
8
8
|
this.errorMessage = errorMessage;
|
|
9
9
|
this.stack = stack;
|
|
10
|
-
this.meta = new http_response_meta_1.HttpResponseMeta(status, config.getMetaType(codex_data_model_1.CodexMetaTypeEnum.NA_HTTP_ERROR), locale, config, correlationId, started);
|
|
10
|
+
this.meta = new http_response_meta_1.HttpResponseMeta(status, config.getMetaType(codex_data_model_1.CodexMetaTypeEnum.NA_HTTP_ERROR), locale, config, correlationId, started, path);
|
|
11
11
|
}
|
|
12
12
|
toJSON() {
|
|
13
13
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-http.response.js","sourceRoot":"","sources":["../../../src/response/error-http.response.ts"],"names":[],"mappings":";;;AACA,oEAMuC;AAIvC,6DAAwD;AAExD,MAAa,iBAAiB;IAK5B,YACE,MAAkB,EAClB,MAAuB,EACN,YAAmC,EACnC,KAAa,EAC9B,MAAqB,EACrB,aAAsB,EACtB,OAAc;
|
|
1
|
+
{"version":3,"file":"error-http.response.js","sourceRoot":"","sources":["../../../src/response/error-http.response.ts"],"names":[],"mappings":";;;AACA,oEAMuC;AAIvC,6DAAwD;AAExD,MAAa,iBAAiB;IAK5B,YACE,MAAkB,EAClB,MAAuB,EACN,YAAmC,EACnC,KAAa,EAC9B,MAAqB,EACrB,aAAsB,EACtB,OAAc,EACd,IAAa;QALI,iBAAY,GAAZ,YAAY,CAAuB;QACnC,UAAK,GAAL,KAAK,CAAQ;QAM9B,IAAI,CAAC,IAAI,GAAG,IAAI,qCAAgB,CAC9B,MAAM,EACN,MAAM,CAAC,WAAW,CAAC,oCAAiB,CAAC,aAAa,CAAC,EACnD,MAAM,EACN,MAAM,EACN,aAAa,EACb,OAAO,EACP,IAAI,CACL,CAAC;IACJ,CAAC;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;IAED,IAAW,IAAI;QACb,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,YAAY;YAE1B,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;SACjE,CAAC;IACJ,CAAC;CACF;AAxCD,8CAwCC"}
|
|
@@ -9,7 +9,7 @@ const http_response_meta_1 = require("./http-response-meta");
|
|
|
9
9
|
class HealthzResponse {
|
|
10
10
|
constructor(status, locale, config) {
|
|
11
11
|
this.locale = locale;
|
|
12
|
-
this.meta = new http_response_meta_1.HttpResponseMeta(status, config.getMetaType(codex_data_model_1.CodexMetaTypeEnum.NA_HTTP_HEALTHZ), locale, config, (0, uuid_1.v4)(), undefined);
|
|
12
|
+
this.meta = new http_response_meta_1.HttpResponseMeta(status, config.getMetaType(codex_data_model_1.CodexMetaTypeEnum.NA_HTTP_HEALTHZ), locale, config, (0, uuid_1.v4)(), undefined, undefined);
|
|
13
13
|
if (status >= 200 && status < 400) {
|
|
14
14
|
this._phraseKey = enum_1.LocalesEnum.I_AM_HEALTHY;
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"healthz-response.js","sourceRoot":"","sources":["../../../src/response/healthz-response.ts"],"names":[],"mappings":";;;AACA,oEAKuC;AACvC,+BAAoC;AACpC,gDAA8C;AAC9C,0CAA8C;AAG9C,6DAAwD;AAExD,MAAa,eAAe;IAK1B,YACE,MAAkB,EACV,MAA2B,EACnC,MAAqB;QADb,WAAM,GAAN,MAAM,CAAqB;QAGnC,IAAI,CAAC,IAAI,GAAG,IAAI,qCAAgB,CAC9B,MAAM,EACN,MAAM,CAAC,WAAW,CAAC,oCAAiB,CAAC,eAAe,CAAC,EACrD,MAAM,EACN,MAAM,EACN,IAAA,SAAM,GAAE,EACR,SAAS,CACV,CAAC;QAEF,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;YAClC,IAAI,CAAC,UAAU,GAAG,kBAAW,CAAC,YAAY,CAAC;QAC7C,CAAC;aAAM,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;YACzC,IAAI,CAAC,UAAU,GAAG,kBAAW,CAAC,eAAe,CAAC;QAChD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,UAAU,GAAG,kBAAW,CAAC,aAAa,CAAC;QAC9C,CAAC;IACH,CAAC;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;IAED,IAAW,IAAI;QACb,OAAO,kBAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"healthz-response.js","sourceRoot":"","sources":["../../../src/response/healthz-response.ts"],"names":[],"mappings":";;;AACA,oEAKuC;AACvC,+BAAoC;AACpC,gDAA8C;AAC9C,0CAA8C;AAG9C,6DAAwD;AAExD,MAAa,eAAe;IAK1B,YACE,MAAkB,EACV,MAA2B,EACnC,MAAqB;QADb,WAAM,GAAN,MAAM,CAAqB;QAGnC,IAAI,CAAC,IAAI,GAAG,IAAI,qCAAgB,CAC9B,MAAM,EACN,MAAM,CAAC,WAAW,CAAC,oCAAiB,CAAC,eAAe,CAAC,EACrD,MAAM,EACN,MAAM,EACN,IAAA,SAAM,GAAE,EACR,SAAS,EACT,SAAS,CACV,CAAC;QAEF,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;YAClC,IAAI,CAAC,UAAU,GAAG,kBAAW,CAAC,YAAY,CAAC;QAC7C,CAAC;aAAM,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;YACzC,IAAI,CAAC,UAAU,GAAG,kBAAW,CAAC,eAAe,CAAC;QAChD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,UAAU,GAAG,kBAAW,CAAC,aAAa,CAAC;QAC9C,CAAC;IACH,CAAC;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;IAED,IAAW,IAAI;QACb,OAAO,kBAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF;AAvCD,0CAuCC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { HttpStatus } from "@nestjs/common";
|
|
2
|
-
import { LocaleInterface,
|
|
2
|
+
import { LocaleInterface, MessageMetaHttpInterface } from "@cryptexlabs/codex-data-model";
|
|
3
3
|
import { DefaultConfig } from "../config";
|
|
4
4
|
import { MessageMeta } from "../message";
|
|
5
|
-
export declare class HttpResponseMeta extends MessageMeta implements
|
|
5
|
+
export declare class HttpResponseMeta extends MessageMeta implements MessageMetaHttpInterface {
|
|
6
6
|
readonly status: HttpStatus;
|
|
7
|
-
|
|
7
|
+
readonly path: string;
|
|
8
|
+
constructor(status: HttpStatus, type: string, locale: LocaleInterface, config: DefaultConfig, correlationId: string, started: Date, path: string);
|
|
8
9
|
toJSON(): any;
|
|
9
10
|
}
|
|
@@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HttpResponseMeta = void 0;
|
|
4
4
|
const message_1 = require("../message");
|
|
5
5
|
class HttpResponseMeta extends message_1.MessageMeta {
|
|
6
|
-
constructor(status, type, locale, config, correlationId, started) {
|
|
6
|
+
constructor(status, type, locale, config, correlationId, started, path) {
|
|
7
7
|
super(type, locale, config, correlationId, started);
|
|
8
8
|
this.status = status;
|
|
9
|
+
this.path = path;
|
|
9
10
|
}
|
|
10
11
|
toJSON() {
|
|
11
12
|
return {
|
|
13
|
+
path: this.path,
|
|
12
14
|
status: this.status,
|
|
13
15
|
type: this.type,
|
|
14
16
|
schemaVersion: this.schemaVersion,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-response-meta.js","sourceRoot":"","sources":["../../../src/response/http-response-meta.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"http-response-meta.js","sourceRoot":"","sources":["../../../src/response/http-response-meta.ts"],"names":[],"mappings":";;;AAOA,wCAAyC;AAEzC,MAAa,gBACX,SAAQ,qBAAW;IAEnB,YACkB,MAAkB,EAClC,IAAY,EACZ,MAAuB,EACvB,MAAqB,EACrB,aAAqB,EACrB,OAAa,EACG,IAAY;QAE5B,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;QARpC,WAAM,GAAN,MAAM,CAAY;QAMlB,SAAI,GAAJ,IAAI,CAAQ;IAG9B,CAAC;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;IACJ,CAAC;CACF;AA5BD,4CA4BC"}
|
|
@@ -8,6 +8,6 @@ export declare abstract class HttpResponse<T> implements JsonSerializableInterfa
|
|
|
8
8
|
private type;
|
|
9
9
|
meta: HttpResponseMeta;
|
|
10
10
|
abstract get data(): any;
|
|
11
|
-
protected constructor(status: HttpStatus, type: string, locale: LocaleInterface, config: DefaultConfig, correlationId?: string, started?: Date);
|
|
11
|
+
protected constructor(status: HttpStatus, type: string, locale: LocaleInterface, config: DefaultConfig, correlationId?: string, started?: Date, path?: string);
|
|
12
12
|
toJSON(): MessageInterface<T>;
|
|
13
13
|
}
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HttpResponse = void 0;
|
|
4
4
|
const http_response_meta_1 = require("./http-response-meta");
|
|
5
5
|
class HttpResponse {
|
|
6
|
-
constructor(status, type, locale, config, correlationId, started) {
|
|
6
|
+
constructor(status, type, locale, config, correlationId, started, path) {
|
|
7
7
|
this.status = status;
|
|
8
8
|
this.type = type;
|
|
9
|
-
this.meta = new http_response_meta_1.HttpResponseMeta(status, type, locale, config, correlationId, started);
|
|
9
|
+
this.meta = new http_response_meta_1.HttpResponseMeta(status, type, locale, config, correlationId, started, path);
|
|
10
10
|
}
|
|
11
11
|
toJSON() {
|
|
12
12
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-response.js","sourceRoot":"","sources":["../../../src/response/http-response.ts"],"names":[],"mappings":";;;AAOA,6DAAwD;AAExD,MAAsB,YAAY;IAQhC,YACU,MAAkB,EAClB,IAAY,EACpB,MAAuB,EACvB,MAAqB,EACrB,aAAsB,EACtB,OAAc;
|
|
1
|
+
{"version":3,"file":"http-response.js","sourceRoot":"","sources":["../../../src/response/http-response.ts"],"names":[],"mappings":";;;AAOA,6DAAwD;AAExD,MAAsB,YAAY;IAQhC,YACU,MAAkB,EAClB,IAAY,EACpB,MAAuB,EACvB,MAAqB,EACrB,aAAsB,EACtB,OAAc,EACd,IAAa;QANL,WAAM,GAAN,MAAM,CAAY;QAClB,SAAI,GAAJ,IAAI,CAAQ;QAOpB,IAAI,CAAC,IAAI,GAAG,IAAI,qCAAgB,CAC9B,MAAM,EACN,IAAI,EACJ,MAAM,EACN,MAAM,EACN,aAAa,EACb,OAAO,EACP,IAAI,CACL,CAAC;IACJ,CAAC;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF;AAlCD,oCAkCC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { HttpStatus } from "@nestjs/common";
|
|
2
|
-
import { MessageInterface,
|
|
2
|
+
import { MessageInterface, MessageMetaHttpInterface } from "@cryptexlabs/codex-data-model";
|
|
3
3
|
import { JsonSerializableInterface } from "../message";
|
|
4
4
|
import { Context } from "../context";
|
|
5
5
|
export declare class RestResponse<T> implements JsonSerializableInterface<MessageInterface<T>> {
|
|
6
6
|
readonly data: T;
|
|
7
|
-
readonly
|
|
8
|
-
|
|
7
|
+
readonly path?: string;
|
|
8
|
+
readonly meta: MessageMetaHttpInterface;
|
|
9
|
+
constructor(context: Context, status: HttpStatus, type: string, data: T, path?: string);
|
|
9
10
|
toJSON(): MessageInterface<T>;
|
|
10
11
|
}
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RestResponse = void 0;
|
|
4
4
|
const http_response_meta_1 = require("./http-response-meta");
|
|
5
5
|
class RestResponse {
|
|
6
|
-
constructor(context, status, type, data) {
|
|
6
|
+
constructor(context, status, type, data, path) {
|
|
7
7
|
this.data = data;
|
|
8
|
-
this.
|
|
8
|
+
this.path = path;
|
|
9
|
+
this.meta = new http_response_meta_1.HttpResponseMeta(status, type, context.locale, context.config, context.correlationId, context.started, context.path);
|
|
9
10
|
}
|
|
10
11
|
toJSON() {
|
|
11
12
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rest.response.js","sourceRoot":"","sources":["../../../src/response/rest.response.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"rest.response.js","sourceRoot":"","sources":["../../../src/response/rest.response.ts"],"names":[],"mappings":";;;AAQA,6DAAwD;AAExD,MAAa,YAAY;IAIvB,YACE,OAAgB,EAChB,MAAkB,EAClB,IAAY,EACI,IAAO,EACP,IAAa;QADb,SAAI,GAAJ,IAAI,CAAG;QACP,SAAI,GAAJ,IAAI,CAAS;QAE7B,IAAI,CAAC,IAAI,GAAG,IAAI,qCAAgB,CAC9B,MAAM,EACN,IAAI,EACJ,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,IAAI,CACW,CAAC;IAC5B,CAAC;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF;AA5BD,oCA4BC"}
|
package/package.json
CHANGED
package/src/context/context.ts
CHANGED
|
@@ -23,7 +23,7 @@ export class Context {
|
|
|
23
23
|
public readonly messageContext: MessageContextInterface,
|
|
24
24
|
started?: Date,
|
|
25
25
|
public readonly i18n?: I18n,
|
|
26
|
-
|
|
26
|
+
public readonly path?: string
|
|
27
27
|
) {
|
|
28
28
|
this.logger = new ContextLogger(correlationId, config, client, logger);
|
|
29
29
|
this.started = started || new Date(Date.now());
|
|
@@ -35,8 +35,7 @@ export class Context {
|
|
|
35
35
|
this.locale,
|
|
36
36
|
this.config,
|
|
37
37
|
this.correlationId,
|
|
38
|
-
this.started
|
|
39
|
-
this._path
|
|
38
|
+
this.started
|
|
40
39
|
);
|
|
41
40
|
}
|
|
42
41
|
}
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
ClientInterface,
|
|
4
4
|
LocaleInterface,
|
|
5
5
|
MessageContextInterface,
|
|
6
|
-
MessageMetaHttpInterface,
|
|
7
6
|
MessageMetaInterface,
|
|
8
7
|
MetaTimeInterface,
|
|
9
8
|
Version,
|
|
@@ -15,8 +14,7 @@ import { JsonSerializableInterface } from "./json-serializable.interface";
|
|
|
15
14
|
export class MessageMeta
|
|
16
15
|
implements
|
|
17
16
|
MessageMetaInterface,
|
|
18
|
-
JsonSerializableInterface<MessageMetaInterface
|
|
19
|
-
MessageMetaHttpInterface {
|
|
17
|
+
JsonSerializableInterface<MessageMetaInterface> {
|
|
20
18
|
//
|
|
21
19
|
time: MetaTimeInterface;
|
|
22
20
|
|
|
@@ -45,8 +43,7 @@ export class MessageMeta
|
|
|
45
43
|
public readonly locale: LocaleInterface,
|
|
46
44
|
config: DefaultConfig,
|
|
47
45
|
correlationId?: string,
|
|
48
|
-
private readonly started?: Date
|
|
49
|
-
public path?: string
|
|
46
|
+
private readonly started?: Date
|
|
50
47
|
) {
|
|
51
48
|
const now = new Date(Date.now());
|
|
52
49
|
const start = started || now;
|
|
@@ -64,9 +61,8 @@ export class MessageMeta
|
|
|
64
61
|
this.client = new ServiceClient(config);
|
|
65
62
|
}
|
|
66
63
|
|
|
67
|
-
public toJSON(): MessageMetaInterface
|
|
64
|
+
public toJSON(): MessageMetaInterface {
|
|
68
65
|
return {
|
|
69
|
-
path: this.path,
|
|
70
66
|
type: this.type,
|
|
71
67
|
schemaVersion: this.schemaVersion,
|
|
72
68
|
correlationId: this.correlationId,
|
|
@@ -23,7 +23,8 @@ export class ErrorHttpResponse
|
|
|
23
23
|
private readonly stack: string,
|
|
24
24
|
config: DefaultConfig,
|
|
25
25
|
correlationId?: string,
|
|
26
|
-
started?: Date
|
|
26
|
+
started?: Date,
|
|
27
|
+
path?: string
|
|
27
28
|
) {
|
|
28
29
|
this.meta = new HttpResponseMeta(
|
|
29
30
|
status,
|
|
@@ -31,7 +32,8 @@ export class ErrorHttpResponse
|
|
|
31
32
|
locale,
|
|
32
33
|
config,
|
|
33
34
|
correlationId,
|
|
34
|
-
started
|
|
35
|
+
started,
|
|
36
|
+
path
|
|
35
37
|
);
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HttpStatus } from "@nestjs/common";
|
|
2
2
|
import {
|
|
3
3
|
LocaleInterface,
|
|
4
|
+
MessageMetaHttpInterface,
|
|
4
5
|
MessageMetaInterface,
|
|
5
6
|
} from "@cryptexlabs/codex-data-model";
|
|
6
7
|
import { DefaultConfig } from "../config";
|
|
@@ -8,20 +9,22 @@ import { MessageMeta } from "../message";
|
|
|
8
9
|
|
|
9
10
|
export class HttpResponseMeta
|
|
10
11
|
extends MessageMeta
|
|
11
|
-
implements
|
|
12
|
+
implements MessageMetaHttpInterface {
|
|
12
13
|
constructor(
|
|
13
14
|
public readonly status: HttpStatus,
|
|
14
15
|
type: string,
|
|
15
16
|
locale: LocaleInterface,
|
|
16
17
|
config: DefaultConfig,
|
|
17
18
|
correlationId: string,
|
|
18
|
-
started: Date
|
|
19
|
+
started: Date,
|
|
20
|
+
public readonly path: string
|
|
19
21
|
) {
|
|
20
22
|
super(type, locale, config, correlationId, started);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
public toJSON(): any {
|
|
24
26
|
return {
|
|
27
|
+
path: this.path,
|
|
25
28
|
status: this.status,
|
|
26
29
|
type: this.type,
|
|
27
30
|
schemaVersion: this.schemaVersion,
|
|
@@ -21,7 +21,8 @@ export abstract class HttpResponse<T>
|
|
|
21
21
|
locale: LocaleInterface,
|
|
22
22
|
config: DefaultConfig,
|
|
23
23
|
correlationId?: string,
|
|
24
|
-
started?: Date
|
|
24
|
+
started?: Date,
|
|
25
|
+
path?: string
|
|
25
26
|
) {
|
|
26
27
|
this.meta = new HttpResponseMeta(
|
|
27
28
|
status,
|
|
@@ -29,7 +30,8 @@ export abstract class HttpResponse<T>
|
|
|
29
30
|
locale,
|
|
30
31
|
config,
|
|
31
32
|
correlationId,
|
|
32
|
-
started
|
|
33
|
+
started,
|
|
34
|
+
path
|
|
33
35
|
);
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HttpStatus } from "@nestjs/common";
|
|
2
2
|
import {
|
|
3
3
|
MessageInterface,
|
|
4
|
+
MessageMetaHttpInterface,
|
|
4
5
|
MessageMetaInterface,
|
|
5
6
|
} from "@cryptexlabs/codex-data-model";
|
|
6
7
|
import { JsonSerializableInterface } from "../message";
|
|
@@ -9,13 +10,14 @@ import { HttpResponseMeta } from "./http-response-meta";
|
|
|
9
10
|
|
|
10
11
|
export class RestResponse<T>
|
|
11
12
|
implements JsonSerializableInterface<MessageInterface<T>> {
|
|
12
|
-
public readonly meta:
|
|
13
|
+
public readonly meta: MessageMetaHttpInterface;
|
|
13
14
|
|
|
14
15
|
constructor(
|
|
15
16
|
context: Context,
|
|
16
17
|
status: HttpStatus,
|
|
17
18
|
type: string,
|
|
18
|
-
public readonly data: T
|
|
19
|
+
public readonly data: T,
|
|
20
|
+
public readonly path?: string
|
|
19
21
|
) {
|
|
20
22
|
this.meta = new HttpResponseMeta(
|
|
21
23
|
status,
|
|
@@ -23,7 +25,8 @@ export class RestResponse<T>
|
|
|
23
25
|
context.locale,
|
|
24
26
|
context.config,
|
|
25
27
|
context.correlationId,
|
|
26
|
-
context.started
|
|
28
|
+
context.started,
|
|
29
|
+
context.path
|
|
27
30
|
) as MessageMetaInterface;
|
|
28
31
|
}
|
|
29
32
|
|