@arkyn/server 3.0.1-beta.126 → 3.0.1-beta.128
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/bundle.js +382 -368
- package/dist/bundle.umd.cjs +8 -8
- package/dist/http/badResponses/_badResponse.d.ts +3 -0
- package/dist/http/badResponses/_badResponse.d.ts.map +1 -1
- package/dist/http/badResponses/_badResponse.js +13 -2
- package/dist/http/badResponses/conflict.d.ts.map +1 -1
- package/dist/http/badResponses/conflict.js +1 -0
- package/dist/http/badResponses/unauthorized.d.ts.map +1 -1
- package/dist/http/badResponses/unauthorized.js +1 -0
- package/dist/http/badResponses/unprocessableEntity.d.ts.map +1 -1
- package/dist/http/badResponses/unprocessableEntity.js +1 -0
- package/dist/http/successResponses/_successResponse.d.ts +3 -0
- package/dist/http/successResponses/_successResponse.d.ts.map +1 -1
- package/dist/http/successResponses/_successResponse.js +10 -1
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ declare class BadResponse {
|
|
|
3
3
|
private _name;
|
|
4
4
|
private _status;
|
|
5
5
|
private _statusText;
|
|
6
|
+
private _debugColor;
|
|
6
7
|
get cause(): any;
|
|
7
8
|
set cause(value: any);
|
|
8
9
|
get name(): string;
|
|
@@ -11,6 +12,8 @@ declare class BadResponse {
|
|
|
11
12
|
set status(value: number);
|
|
12
13
|
get statusText(): string;
|
|
13
14
|
set statusText(value: string);
|
|
15
|
+
get debugColor(): "green" | "yellow" | "cyan" | "red";
|
|
16
|
+
set debugColor(value: "green" | "yellow" | "cyan" | "red");
|
|
14
17
|
onDebug(): void;
|
|
15
18
|
makeBody(): {
|
|
16
19
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_badResponse.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/_badResponse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_badResponse.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/_badResponse.ts"],"names":[],"mappings":"AAKA,cAAM,WAAW;IACf,OAAO,CAAC,MAAM,CAAC,CAAM;IACrB,OAAO,CAAC,KAAK,CAAyB;IACtC,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,WAAW,CAA8C;IAEjE,IAAI,KAAK,IAAI,GAAG,CAEf;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,GAAG,EAEnB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAEvB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,EAE3B;IAED,IAAI,UAAU,IAAI,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAEpD;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,EAGxD;IAED,OAAO;IAeP,QAAQ;;;;;CAOT;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formatJsonString } from "@arkyn/shared";
|
|
1
2
|
import { DebugService } from "../../services/debugService";
|
|
2
3
|
import { flushDebugLogs } from "../../utilities/flushDebugLogs";
|
|
3
4
|
class BadResponse {
|
|
@@ -5,6 +6,7 @@ class BadResponse {
|
|
|
5
6
|
_name = "BadResponse";
|
|
6
7
|
_status = 500;
|
|
7
8
|
_statusText = "Unknown error";
|
|
9
|
+
_debugColor = "red";
|
|
8
10
|
get cause() {
|
|
9
11
|
return this._cause;
|
|
10
12
|
}
|
|
@@ -29,6 +31,14 @@ class BadResponse {
|
|
|
29
31
|
set statusText(value) {
|
|
30
32
|
this._statusText = value;
|
|
31
33
|
}
|
|
34
|
+
get debugColor() {
|
|
35
|
+
return this._debugColor;
|
|
36
|
+
}
|
|
37
|
+
set debugColor(value) {
|
|
38
|
+
if (!["green", "yellow", "cyan", "red"].includes(value))
|
|
39
|
+
return;
|
|
40
|
+
this._debugColor = value;
|
|
41
|
+
}
|
|
32
42
|
onDebug() {
|
|
33
43
|
const debugs = [];
|
|
34
44
|
const { callerInfo, functionName } = DebugService.getCaller();
|
|
@@ -36,8 +46,9 @@ class BadResponse {
|
|
|
36
46
|
debugs.push(`Caller Location: ${callerInfo}`);
|
|
37
47
|
if (this._statusText)
|
|
38
48
|
debugs.push(`Message: ${this._statusText}`);
|
|
39
|
-
if (this._cause)
|
|
40
|
-
debugs.push(`Cause: ${JSON.stringify(this._cause)}`);
|
|
49
|
+
if (this._cause) {
|
|
50
|
+
debugs.push(`Cause: ${formatJsonString(JSON.stringify(this._cause))}`);
|
|
51
|
+
}
|
|
41
52
|
flushDebugLogs({ scheme: "red", name: this._name, debugs });
|
|
42
53
|
}
|
|
43
54
|
makeBody() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conflict.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/conflict.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AAEH,cAAM,QAAS,SAAQ,WAAW;IAChC;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;
|
|
1
|
+
{"version":3,"file":"conflict.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/conflict.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AAEH,cAAM,QAAS,SAAQ,WAAW;IAChC;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAYxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unauthorized.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/unauthorized.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AAEH,cAAM,YAAa,SAAQ,WAAW;IACpC;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;
|
|
1
|
+
{"version":3,"file":"unauthorized.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/unauthorized.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AAEH,cAAM,YAAa,SAAQ,WAAW;IACpC;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAYxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unprocessableEntity.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/unprocessableEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AAEH,cAAM,mBAAoB,SAAQ,WAAW;IAC3C;;;;;;;;OAQG;gBAES,KAAK,EAAE;QACjB,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;
|
|
1
|
+
{"version":3,"file":"unprocessableEntity.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/unprocessableEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AAEH,cAAM,mBAAoB,SAAQ,WAAW;IAC3C;;;;;;;;OAQG;gBAES,KAAK,EAAE;QACjB,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;IAgBD;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -19,6 +19,7 @@ class UnprocessableEntity extends BadResponse {
|
|
|
19
19
|
this.name = "UnprocessableEntity";
|
|
20
20
|
this.status = 422;
|
|
21
21
|
this.statusText = props.message || "Unprocessable entity";
|
|
22
|
+
this.debugColor = "yellow";
|
|
22
23
|
this.cause = {
|
|
23
24
|
data: props.data,
|
|
24
25
|
fieldErrors: props.fieldErrors,
|
|
@@ -7,6 +7,7 @@ declare class SuccessResponse {
|
|
|
7
7
|
private _name;
|
|
8
8
|
private _status;
|
|
9
9
|
private _statusText;
|
|
10
|
+
private _debugColor;
|
|
10
11
|
get body(): any;
|
|
11
12
|
set body(value: any);
|
|
12
13
|
get name(): string;
|
|
@@ -15,6 +16,8 @@ declare class SuccessResponse {
|
|
|
15
16
|
set status(value: number);
|
|
16
17
|
get statusText(): string;
|
|
17
18
|
set statusText(value: string);
|
|
19
|
+
get debugColor(): "green" | "yellow" | "cyan" | "red";
|
|
20
|
+
set debugColor(value: "green" | "yellow" | "cyan" | "red");
|
|
18
21
|
/**
|
|
19
22
|
* Logs debug information for success responses including caller context and response details.
|
|
20
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_successResponse.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/_successResponse.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,cAAM,eAAe;IACnB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,WAAW,CAAgB;
|
|
1
|
+
{"version":3,"file":"_successResponse.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/_successResponse.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,cAAM,eAAe;IACnB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,WAAW,CAAgD;IAEnE,IAAI,IAAI,IAAI,GAAG,CAEd;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,GAAG,EAElB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAEvB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,EAE3B;IAED,IAAI,UAAU,IAAI,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAEpD;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,EAGxD;IAED;;;;;;;;;;OAUG;IACH,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI;IAazB,QAAQ,IAAI,GAAG;CAOhB;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -9,6 +9,7 @@ class SuccessResponse {
|
|
|
9
9
|
_name = "SuccessResponse";
|
|
10
10
|
_status = 200;
|
|
11
11
|
_statusText = "OK";
|
|
12
|
+
_debugColor = "green";
|
|
12
13
|
get body() {
|
|
13
14
|
return this._body;
|
|
14
15
|
}
|
|
@@ -33,6 +34,14 @@ class SuccessResponse {
|
|
|
33
34
|
set statusText(value) {
|
|
34
35
|
this._statusText = value;
|
|
35
36
|
}
|
|
37
|
+
get debugColor() {
|
|
38
|
+
return this._debugColor;
|
|
39
|
+
}
|
|
40
|
+
set debugColor(value) {
|
|
41
|
+
if (!["green", "yellow", "cyan", "red"].includes(value))
|
|
42
|
+
return;
|
|
43
|
+
this._debugColor = value;
|
|
44
|
+
}
|
|
36
45
|
/**
|
|
37
46
|
* Logs debug information for success responses including caller context and response details.
|
|
38
47
|
*
|
|
@@ -53,7 +62,7 @@ class SuccessResponse {
|
|
|
53
62
|
debugs.push(`Message: ${this.statusText}`);
|
|
54
63
|
if (body)
|
|
55
64
|
debugs.push(`Body: ${JSON.stringify(body)}`);
|
|
56
|
-
flushDebugLogs({ scheme:
|
|
65
|
+
flushDebugLogs({ scheme: this._debugColor, name: this.name, debugs });
|
|
57
66
|
}
|
|
58
67
|
makeBody() {
|
|
59
68
|
return {
|