@yildizpay/http-adapter 3.0.0 → 3.1.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.
- package/README.md +186 -9
- package/README.tr.md +221 -44
- package/dist/contracts/http-client.contract.d.ts +0 -9
- package/dist/contracts/http-client.contract.js +0 -17
- package/dist/contracts/http-client.contract.js.map +1 -1
- package/dist/contracts/http-interceptor.contract.d.ts +2 -1
- package/dist/core/default-http-client.js +7 -6
- package/dist/core/default-http-client.js.map +1 -1
- package/dist/core/error.converter.d.ts +5 -0
- package/dist/core/error.converter.js +31 -0
- package/dist/core/error.converter.js.map +1 -0
- package/dist/core/http.adapter.js +11 -4
- package/dist/core/http.adapter.js.map +1 -1
- package/dist/exceptions/base-adapter.exception.d.ts +7 -0
- package/dist/exceptions/base-adapter.exception.js +34 -0
- package/dist/exceptions/base-adapter.exception.js.map +1 -0
- package/dist/exceptions/circuit-breaker-open.exception.d.ts +2 -2
- package/dist/exceptions/circuit-breaker-open.exception.js +3 -3
- package/dist/exceptions/circuit-breaker-open.exception.js.map +1 -1
- package/dist/exceptions/exception.guards.d.ts +15 -0
- package/dist/exceptions/exception.guards.js +48 -0
- package/dist/exceptions/exception.guards.js.map +1 -0
- package/dist/exceptions/http-exception.factory.d.ts +5 -0
- package/dist/exceptions/http-exception.factory.js +59 -0
- package/dist/exceptions/http-exception.factory.js.map +1 -0
- package/dist/exceptions/http-status.exceptions.d.ts +134 -0
- package/dist/exceptions/http-status.exceptions.js +382 -0
- package/dist/exceptions/http-status.exceptions.js.map +1 -0
- package/dist/exceptions/network-exception.factory.d.ts +6 -0
- package/dist/exceptions/network-exception.factory.js +35 -0
- package/dist/exceptions/network-exception.factory.js.map +1 -0
- package/dist/exceptions/network.exceptions.d.ts +25 -0
- package/dist/exceptions/network.exceptions.js +69 -0
- package/dist/exceptions/network.exceptions.js.map +1 -0
- package/dist/exceptions/unknown.exception.d.ts +7 -0
- package/dist/exceptions/unknown.exception.js +20 -0
- package/dist/exceptions/unknown.exception.js.map +1 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/models/request-context.d.ts +5 -0
- package/dist/models/request-context.js +3 -0
- package/dist/models/request-context.js.map +1 -0
- package/dist/models/response.d.ts +8 -5
- package/dist/models/response.js +9 -5
- package/dist/models/response.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/exceptions/http.exception.d.ts +0 -5
- package/dist/exceptions/http.exception.js +0 -12
- package/dist/exceptions/http.exception.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-context.js","sourceRoot":"","sources":["../../src/models/request-context.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { RequestContext } from './request-context';
|
|
2
|
+
export declare class Response<T = unknown> {
|
|
2
3
|
readonly data: T;
|
|
3
4
|
readonly status: number;
|
|
4
5
|
readonly headers: Record<string, string> | null;
|
|
5
|
-
readonly
|
|
6
|
+
readonly requestContext?: RequestContext | undefined;
|
|
6
7
|
readonly timestamp: Date;
|
|
7
|
-
constructor(
|
|
8
|
-
|
|
8
|
+
private constructor();
|
|
9
|
+
get systemCorrelationId(): string;
|
|
10
|
+
static create<T = unknown>(data: T, status: number, headers: Record<string, string> | null, requestContext?: RequestContext): Response<T>;
|
|
9
11
|
toDebugObject(): {
|
|
10
|
-
|
|
12
|
+
request?: RequestContext | undefined;
|
|
11
13
|
status: number;
|
|
12
14
|
headers: Record<string, string> | null;
|
|
15
|
+
data: T;
|
|
13
16
|
};
|
|
14
17
|
}
|
package/dist/models/response.js
CHANGED
|
@@ -2,21 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Response = void 0;
|
|
4
4
|
class Response {
|
|
5
|
-
constructor(data, status, headers,
|
|
5
|
+
constructor(data, status, headers, requestContext) {
|
|
6
6
|
this.data = data;
|
|
7
7
|
this.status = status;
|
|
8
8
|
this.headers = headers;
|
|
9
|
-
this.
|
|
9
|
+
this.requestContext = requestContext;
|
|
10
10
|
this.timestamp = new Date();
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
return
|
|
12
|
+
get systemCorrelationId() {
|
|
13
|
+
return this.requestContext?.correlationId ?? '';
|
|
14
|
+
}
|
|
15
|
+
static create(data, status, headers, requestContext) {
|
|
16
|
+
return new Response(data, status, headers, requestContext);
|
|
14
17
|
}
|
|
15
18
|
toDebugObject() {
|
|
16
19
|
return {
|
|
17
|
-
data: this.data,
|
|
18
20
|
status: this.status,
|
|
19
21
|
headers: this.headers,
|
|
22
|
+
data: this.data,
|
|
23
|
+
...(this.requestContext && { request: this.requestContext }),
|
|
20
24
|
};
|
|
21
25
|
}
|
|
22
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/models/response.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/models/response.ts"],"names":[],"mappings":";;;AAWA,MAAa,QAAQ;IAcnB,YACkB,IAAO,EACP,MAAc,EACd,OAAsC,EACtC,cAA+B;QAH/B,SAAI,GAAJ,IAAI,CAAG;QACP,WAAM,GAAN,MAAM,CAAQ;QACd,YAAO,GAAP,OAAO,CAA+B;QACtC,mBAAc,GAAd,cAAc,CAAiB;QAE/C,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC9B,CAAC;IAMD,IAAW,mBAAmB;QAC5B,OAAO,IAAI,CAAC,cAAc,EAAE,aAAa,IAAI,EAAE,CAAC;IAClD,CAAC;IAYM,MAAM,CAAC,MAAM,CAClB,IAAO,EACP,MAAc,EACd,OAAsC,EACtC,cAA+B;QAE/B,OAAO,IAAI,QAAQ,CAAI,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IAChE,CAAC;IAMM,aAAa;QAClB,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG,CAAC,IAAI,CAAC,cAAc,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC;SAC7D,CAAC;IACJ,CAAC;CACF;AA9DD,4BA8DC"}
|