@arkyn/server 3.0.1-beta.7 → 3.0.1-beta.71

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.
Files changed (125) hide show
  1. package/README.md +368 -65
  2. package/dist/api/arkynLogRequest.d.ts +1 -1
  3. package/dist/api/arkynLogRequest.d.ts.map +1 -1
  4. package/dist/api/arkynLogRequest.js +14 -13
  5. package/dist/api/makeRequest.d.ts +1 -1
  6. package/dist/api/makeRequest.d.ts.map +1 -1
  7. package/dist/api/makeRequest.js +9 -8
  8. package/dist/bundle.js +1216 -0
  9. package/dist/bundle.umd.cjs +10 -0
  10. package/dist/http/badResponses/_badResponse.d.ts +11 -0
  11. package/dist/http/badResponses/_badResponse.d.ts.map +1 -0
  12. package/dist/http/badResponses/_badResponse.js +20 -0
  13. package/dist/http/badResponses/badGateway.d.ts +2 -1
  14. package/dist/http/badResponses/badGateway.d.ts.map +1 -1
  15. package/dist/http/badResponses/badGateway.js +9 -3
  16. package/dist/http/badResponses/badRequest.d.ts +2 -1
  17. package/dist/http/badResponses/badRequest.d.ts.map +1 -1
  18. package/dist/http/badResponses/badRequest.js +9 -3
  19. package/dist/http/badResponses/conflict.d.ts +2 -1
  20. package/dist/http/badResponses/conflict.d.ts.map +1 -1
  21. package/dist/http/badResponses/conflict.js +9 -3
  22. package/dist/http/badResponses/forbidden.d.ts +2 -1
  23. package/dist/http/badResponses/forbidden.d.ts.map +1 -1
  24. package/dist/http/badResponses/forbidden.js +9 -3
  25. package/dist/http/badResponses/notFound.d.ts +2 -1
  26. package/dist/http/badResponses/notFound.d.ts.map +1 -1
  27. package/dist/http/badResponses/notFound.js +9 -3
  28. package/dist/http/badResponses/notImplemented.d.ts +2 -1
  29. package/dist/http/badResponses/notImplemented.d.ts.map +1 -1
  30. package/dist/http/badResponses/notImplemented.js +9 -3
  31. package/dist/http/badResponses/serverError.d.ts +2 -1
  32. package/dist/http/badResponses/serverError.d.ts.map +1 -1
  33. package/dist/http/badResponses/serverError.js +9 -3
  34. package/dist/http/badResponses/unauthorized.d.ts +2 -1
  35. package/dist/http/badResponses/unauthorized.d.ts.map +1 -1
  36. package/dist/http/badResponses/unauthorized.js +9 -3
  37. package/dist/http/badResponses/unprocessableEntity.d.ts +3 -2
  38. package/dist/http/badResponses/unprocessableEntity.d.ts.map +1 -1
  39. package/dist/http/badResponses/unprocessableEntity.js +9 -4
  40. package/dist/http/successResponses/_successResponse.d.ts +22 -0
  41. package/dist/http/successResponses/_successResponse.d.ts.map +1 -0
  42. package/dist/http/successResponses/_successResponse.js +37 -0
  43. package/dist/http/successResponses/created.d.ts +2 -1
  44. package/dist/http/successResponses/created.d.ts.map +1 -1
  45. package/dist/http/successResponses/created.js +4 -1
  46. package/dist/http/successResponses/found.d.ts +2 -1
  47. package/dist/http/successResponses/found.d.ts.map +1 -1
  48. package/dist/http/successResponses/found.js +4 -1
  49. package/dist/http/successResponses/noContent.d.ts +2 -1
  50. package/dist/http/successResponses/noContent.d.ts.map +1 -1
  51. package/dist/http/successResponses/noContent.js +4 -1
  52. package/dist/http/successResponses/success.d.ts +2 -1
  53. package/dist/http/successResponses/success.d.ts.map +1 -1
  54. package/dist/http/successResponses/success.js +4 -1
  55. package/dist/http/successResponses/updated.d.ts +2 -1
  56. package/dist/http/successResponses/updated.d.ts.map +1 -1
  57. package/dist/http/successResponses/updated.js +4 -1
  58. package/dist/index.d.ts +4 -3
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +4 -4
  61. package/dist/{config/apiInstance.d.ts → services/apiService.d.ts} +25 -21
  62. package/dist/services/apiService.d.ts.map +1 -0
  63. package/dist/{config/apiInstance.js → services/apiService.js} +45 -23
  64. package/dist/{config/arkynLogInstance.d.ts → services/arkynLogService.d.ts} +5 -5
  65. package/dist/services/arkynLogService.d.ts.map +1 -0
  66. package/dist/{config/arkynLogInstance.js → services/arkynLogService.js} +4 -5
  67. package/dist/services/debugService.d.ts +54 -0
  68. package/dist/services/debugService.d.ts.map +1 -0
  69. package/dist/services/debugService.js +57 -0
  70. package/dist/services/flushDebugLogs.d.ts +8 -0
  71. package/dist/services/flushDebugLogs.d.ts.map +1 -0
  72. package/dist/services/flushDebugLogs.js +20 -0
  73. package/dist/services/formParse.d.ts +3 -3
  74. package/dist/services/formParse.d.ts.map +1 -1
  75. package/dist/services/formParse.js +7 -5
  76. package/dist/services/getCaller.d.ts.map +1 -1
  77. package/dist/services/getCaller.js +9 -14
  78. package/dist/services/measureRouteExecution.d.ts +3 -0
  79. package/dist/services/measureRouteExecution.d.ts.map +1 -0
  80. package/dist/services/measureRouteExecution.js +24 -0
  81. package/dist/services/schemaValidator.d.ts +3 -3
  82. package/dist/services/schemaValidator.d.ts.map +1 -1
  83. package/dist/services/schemaValidator.js +2 -4
  84. package/package.json +33 -18
  85. package/dist/config/apiInstance.d.ts.map +0 -1
  86. package/dist/config/arkynLogInstance.d.ts.map +0 -1
  87. package/dist/services/httpDebug.d.ts +0 -35
  88. package/dist/services/httpDebug.d.ts.map +0 -1
  89. package/dist/services/httpDebug.js +0 -52
  90. package/src/api/arkynLogRequest.ts +0 -118
  91. package/src/api/deleteRequest.ts +0 -22
  92. package/src/api/getRequest.ts +0 -20
  93. package/src/api/makeRequest.ts +0 -122
  94. package/src/api/patchRequest.ts +0 -22
  95. package/src/api/postRequest.ts +0 -22
  96. package/src/api/putRequest.ts +0 -22
  97. package/src/config/apiInstance.ts +0 -148
  98. package/src/config/arkynLogInstance.ts +0 -75
  99. package/src/http/badResponses/badGateway.ts +0 -63
  100. package/src/http/badResponses/badRequest.ts +0 -63
  101. package/src/http/badResponses/conflict.ts +0 -63
  102. package/src/http/badResponses/forbidden.ts +0 -63
  103. package/src/http/badResponses/notFound.ts +0 -63
  104. package/src/http/badResponses/notImplemented.ts +0 -63
  105. package/src/http/badResponses/serverError.ts +0 -63
  106. package/src/http/badResponses/unauthorized.ts +0 -63
  107. package/src/http/badResponses/unprocessableEntity.ts +0 -79
  108. package/src/http/successResponses/created.ts +0 -64
  109. package/src/http/successResponses/found.ts +0 -67
  110. package/src/http/successResponses/noContent.ts +0 -42
  111. package/src/http/successResponses/success.ts +0 -64
  112. package/src/http/successResponses/updated.ts +0 -64
  113. package/src/index.ts +0 -31
  114. package/src/mapper/arkynLogRequestMapper.ts +0 -73
  115. package/src/services/decodeErrorMessageFromRequest.ts +0 -36
  116. package/src/services/decodeRequestBody.ts +0 -43
  117. package/src/services/errorHandler.ts +0 -99
  118. package/src/services/formParse.ts +0 -83
  119. package/src/services/getCaller.ts +0 -82
  120. package/src/services/getScopedParams.ts +0 -43
  121. package/src/services/httpDebug.ts +0 -61
  122. package/src/services/schemaValidator.ts +0 -66
  123. package/src/types/ApiResponseDTO.ts +0 -19
  124. package/tsconfig.json +0 -21
  125. package/vitest.config.ts +0 -5
@@ -1,3 +1,4 @@
1
+ import { SuccessResponse } from "./_successResponse";
1
2
  /**
2
3
  * Represents a successful HTTP response with a status code of 201 (Created).
3
4
  * This class is used to standardize the structure of a "Created" response,
@@ -5,7 +6,7 @@
5
6
  *
6
7
  * @template T - The type of the response body.
7
8
  */
8
- declare class Created<T> {
9
+ declare class Created<T> extends SuccessResponse {
9
10
  body: T;
10
11
  headers: ResponseInit["headers"];
11
12
  status: number;
@@ -1 +1 @@
1
- {"version":3,"file":"created.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/created.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAM,OAAO,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,YAAY;IAOxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CASnB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"created.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/created.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;GAMG;AAEH,cAAM,OAAO,CAAC,CAAC,CAAE,SAAQ,eAAe;IACtC,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,YAAY;IAWxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CASnB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { SuccessResponse } from "./_successResponse";
1
2
  /**
2
3
  * Represents a successful HTTP response with a status code of 201 (Created).
3
4
  * This class is used to standardize the structure of a "Created" response,
@@ -5,7 +6,7 @@
5
6
  *
6
7
  * @template T - The type of the response body.
7
8
  */
8
- class Created {
9
+ class Created extends SuccessResponse {
9
10
  body;
10
11
  headers;
11
12
  status;
@@ -17,10 +18,12 @@ class Created {
17
18
  * @param init - Optional initialization object for customizing headers, status, and status text.
18
19
  */
19
20
  constructor(body, init) {
21
+ super();
20
22
  this.body = body;
21
23
  this.headers = init?.headers || {};
22
24
  this.status = init?.status || 201;
23
25
  this.statusText = init?.statusText || "Resource created successfully";
26
+ this.onDebug("Created", body);
24
27
  }
25
28
  /**
26
29
  * Converts the `Created` instance into a `Response` object with a JSON body.
@@ -1,3 +1,4 @@
1
+ import { SuccessResponse } from "./_successResponse";
1
2
  /**
2
3
  * Represents an HTTP 302 Found response.
3
4
  * This class is used to create a standardized HTTP response with a status of 302 (Found),
@@ -5,7 +6,7 @@
5
6
  *
6
7
  * @template T - The type of the response body.
7
8
  */
8
- declare class Found<T> {
9
+ declare class Found<T> extends SuccessResponse {
9
10
  body: T;
10
11
  headers: ResponseInit["headers"];
11
12
  status: number;
@@ -1 +1 @@
1
- {"version":3,"file":"found.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/found.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAM,KAAK,CAAC,CAAC;IACX,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;;;OAQG;gBAES,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,YAAY;IAOxC;;;;;OAKG;IAEH,UAAU;IAUV;;;;;OAKG;IAEH,MAAM;CASP;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"found.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/found.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;GAMG;AAEH,cAAM,KAAK,CAAC,CAAC,CAAE,SAAQ,eAAe;IACpC,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;;;OAQG;gBAES,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,YAAY;IAWxC;;;;;OAKG;IAEH,UAAU;IAUV;;;;;OAKG;IAEH,MAAM;CASP;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { SuccessResponse } from "./_successResponse";
1
2
  /**
2
3
  * Represents an HTTP 302 Found response.
3
4
  * This class is used to create a standardized HTTP response with a status of 302 (Found),
@@ -5,7 +6,7 @@
5
6
  *
6
7
  * @template T - The type of the response body.
7
8
  */
8
- class Found {
9
+ class Found extends SuccessResponse {
9
10
  body;
10
11
  headers;
11
12
  status;
@@ -20,10 +21,12 @@ class Found {
20
21
  * - `statusText`: HTTP status text (default is "Found").
21
22
  */
22
23
  constructor(body, init) {
24
+ super();
23
25
  this.body = body;
24
26
  this.headers = init?.headers || {};
25
27
  this.status = init?.status || 302;
26
28
  this.statusText = init?.statusText || "Found";
29
+ this.onDebug("Found", body);
27
30
  }
28
31
  /**
29
32
  * Converts the `Found` instance into a `Response` object.
@@ -1,9 +1,10 @@
1
+ import { SuccessResponse } from "./_successResponse";
1
2
  /**
2
3
  * Represents a successful HTTP response with a status code of 204 (No Content).
3
4
  * This class is used to standardize the structure of a "No Content" response,
4
5
  * including headers, status, and status text.
5
6
  */
6
- declare class NoContent {
7
+ declare class NoContent extends SuccessResponse {
7
8
  headers: ResponseInit["headers"];
8
9
  status: number;
9
10
  statusText: string;
@@ -1 +1 @@
1
- {"version":3,"file":"noContent.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/noContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAM,SAAS;IACb,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;gBAES,IAAI,CAAC,EAAE,YAAY;IAM/B;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;CASvB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"noContent.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/noContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;GAIG;AAEH,cAAM,SAAU,SAAQ,eAAe;IACrC,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;gBAES,IAAI,CAAC,EAAE,YAAY;IAU/B;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;CASvB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,9 +1,10 @@
1
+ import { SuccessResponse } from "./_successResponse";
1
2
  /**
2
3
  * Represents a successful HTTP response with a status code of 204 (No Content).
3
4
  * This class is used to standardize the structure of a "No Content" response,
4
5
  * including headers, status, and status text.
5
6
  */
6
- class NoContent {
7
+ class NoContent extends SuccessResponse {
7
8
  headers;
8
9
  status;
9
10
  statusText;
@@ -13,9 +14,11 @@ class NoContent {
13
14
  * @param init - Optional initialization object for customizing headers, status, and status text.
14
15
  */
15
16
  constructor(init) {
17
+ super();
16
18
  this.headers = init?.headers || {};
17
19
  this.status = init?.status || 204;
18
20
  this.statusText = init?.statusText ?? "No content";
21
+ this.onDebug("No content", null);
19
22
  }
20
23
  /**
21
24
  * Converts the `NoContent` instance into a `Response` object.
@@ -1,3 +1,4 @@
1
+ import { SuccessResponse } from "./_successResponse";
1
2
  /**
2
3
  * Represents a successful HTTP response with a status code of 200 (OK).
3
4
  * This class is used to standardize the structure of a "Success" response,
@@ -5,7 +6,7 @@
5
6
  *
6
7
  * @template T - The type of the response body.
7
8
  */
8
- declare class Success<T> {
9
+ declare class Success<T> extends SuccessResponse {
9
10
  body: T;
10
11
  headers: ResponseInit["headers"];
11
12
  status: number;
@@ -1 +1 @@
1
- {"version":3,"file":"success.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/success.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAM,OAAO,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,YAAY;IAOxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CASnB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"success.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/success.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;GAMG;AAEH,cAAM,OAAO,CAAC,CAAC,CAAE,SAAQ,eAAe;IACtC,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,YAAY;IAWxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CASnB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { SuccessResponse } from "./_successResponse";
1
2
  /**
2
3
  * Represents a successful HTTP response with a status code of 200 (OK).
3
4
  * This class is used to standardize the structure of a "Success" response,
@@ -5,7 +6,7 @@
5
6
  *
6
7
  * @template T - The type of the response body.
7
8
  */
8
- class Success {
9
+ class Success extends SuccessResponse {
9
10
  body;
10
11
  headers;
11
12
  status;
@@ -17,10 +18,12 @@ class Success {
17
18
  * @param init - Optional initialization object for customizing headers, status, and status text.
18
19
  */
19
20
  constructor(body, init) {
21
+ super();
20
22
  this.body = body;
21
23
  this.headers = init?.headers || {};
22
24
  this.status = init?.status || 200;
23
25
  this.statusText = init?.statusText ?? "OK";
26
+ this.onDebug("Success", body);
24
27
  }
25
28
  /**
26
29
  * Converts the `Success` instance into a `Response` object with a JSON body.
@@ -1,3 +1,4 @@
1
+ import { SuccessResponse } from "./_successResponse";
1
2
  /**
2
3
  * Represents a successful HTTP response with a status code of 200 (OK) or other custom status codes.
3
4
  * This class is used to standardize the structure of an "Updated" response,
@@ -5,7 +6,7 @@
5
6
  *
6
7
  * @template T - The type of the response body.
7
8
  */
8
- declare class Updated<T> {
9
+ declare class Updated<T> extends SuccessResponse {
9
10
  body: T;
10
11
  headers: ResponseInit["headers"];
11
12
  status: number;
@@ -1 +1 @@
1
- {"version":3,"file":"updated.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/updated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAM,OAAO,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,YAAY;IAOxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CASnB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"updated.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/updated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;GAMG;AAEH,cAAM,OAAO,CAAC,CAAC,CAAE,SAAQ,eAAe;IACtC,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,YAAY;IAWxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CASnB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { SuccessResponse } from "./_successResponse";
1
2
  /**
2
3
  * Represents a successful HTTP response with a status code of 200 (OK) or other custom status codes.
3
4
  * This class is used to standardize the structure of an "Updated" response,
@@ -5,7 +6,7 @@
5
6
  *
6
7
  * @template T - The type of the response body.
7
8
  */
8
- class Updated {
9
+ class Updated extends SuccessResponse {
9
10
  body;
10
11
  headers;
11
12
  status;
@@ -17,10 +18,12 @@ class Updated {
17
18
  * @param init - Optional initialization object for customizing headers, status, and status text.
18
19
  */
19
20
  constructor(body, init) {
21
+ super();
20
22
  this.body = body;
21
23
  this.headers = init?.headers || {};
22
24
  this.status = init?.status || 200;
23
25
  this.statusText = init?.statusText || "Resource updated successfully";
26
+ this.onDebug("Updated", body);
24
27
  }
25
28
  /**
26
29
  * Converts the `Updated` instance into a `Response` object with a JSON body.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- export { ApiInstance } from "./config/apiInstance";
2
- export { ArkynLogInstance } from "./config/arkynLogInstance";
3
1
  export { BadGateway } from "./http/badResponses/badGateway";
4
2
  export { BadRequest } from "./http/badResponses/badRequest";
5
3
  export { Conflict } from "./http/badResponses/conflict";
@@ -14,12 +12,15 @@ export { Found } from "./http/successResponses/found";
14
12
  export { NoContent } from "./http/successResponses/noContent";
15
13
  export { Success } from "./http/successResponses/success";
16
14
  export { Updated } from "./http/successResponses/updated";
15
+ export { ApiService } from "./services/apiService";
16
+ export { ArkynLogService } from "./services/arkynLogService";
17
+ export { DebugService } from "./services/debugService";
17
18
  export { decodeErrorMessageFromRequest } from "./services/decodeErrorMessageFromRequest";
18
19
  export { decodeRequestBody } from "./services/decodeRequestBody";
19
20
  export { errorHandler } from "./services/errorHandler";
21
+ export { flushDebugLogs } from "./services/flushDebugLogs";
20
22
  export { formParse } from "./services/formParse";
21
23
  export { getCaller } from "./services/getCaller";
22
24
  export { getScopedParams } from "./services/getScopedParams";
23
- export { httpDebug } from "./services/httpDebug";
24
25
  export { SchemaValidator } from "./services/schemaValidator";
25
26
  //# sour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AAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,3 @@
1
- // config
2
- export { ApiInstance } from "./config/apiInstance";
3
- export { ArkynLogInstance } from "./config/arkynLogInstance";
4
1
  // http bad responses
5
2
  export { BadGateway } from "./http/badResponses/badGateway";
6
3
  export { BadRequest } from "./http/badResponses/badRequest";
@@ -18,11 +15,14 @@ export { NoContent } from "./http/successResponses/noContent";
18
15
  export { Success } from "./http/successResponses/success";
19
16
  export { Updated } from "./http/successResponses/updated";
20
17
  // services
18
+ export { ApiService } from "./services/apiService";
19
+ export { ArkynLogService } from "./services/arkynLogService";
20
+ export { DebugService } from "./services/debugService";
21
21
  export { decodeErrorMessageFromRequest } from "./services/decodeErrorMessageFromRequest";
22
22
  export { decodeRequestBody } from "./services/decodeRequestBody";
23
23
  export { errorHandler } from "./services/errorHandler";
24
+ export { flushDebugLogs } from "./services/flushDebugLogs";
24
25
  export { formParse } from "./services/formParse";
25
26
  export { getCaller } from "./services/getCaller";
26
27
  export { getScopedParams } from "./services/getScopedParams";
27
- export { httpDebug } from "./services/httpDebug";
28
28
  export { SchemaValidator } from "./services/schemaValidator";
@@ -1,7 +1,8 @@
1
- type ApiInstanceContructorProps = {
1
+ type ApiServiceConstructorProps = {
2
2
  baseUrl: string;
3
3
  baseHeaders?: HeadersInit;
4
4
  baseToken?: string | null;
5
+ enableDebug?: boolean;
5
6
  };
6
7
  type ApiRequestDataWithoutBodyProps = {
7
8
  headers?: HeadersInit;
@@ -15,23 +16,26 @@ type ApiRequestDataWithBodyProps = {
15
16
  /**
16
17
  * Class representing an API instance to handle HTTP requests with base configurations.
17
18
  */
18
- declare class ApiInstance {
19
+ declare class ApiService {
19
20
  private baseUrl;
20
21
  private baseHeaders?;
21
22
  private baseToken?;
23
+ private enableDebug?;
22
24
  /**
23
- * Creates an instance of ApiInstance.
25
+ * Creates an instance of ApiService.
24
26
  * @param props - The configuration properties for the API instance.
25
27
  * @param props.baseUrl - The base URL for the API.
26
28
  * @param props.baseHeaders - Optional base headers to include in all requests.
27
29
  * @param props.baseToken - Optional base token for authorization.
30
+ * @param props.enableDebug - Optional flag to enable debug logging for requests.
28
31
  */
29
- constructor(props: ApiInstanceContructorProps);
32
+ constructor(props: ApiServiceConstructorProps);
30
33
  /**
31
34
  * Generates the full URL by appending the route to the base URL.
32
35
  * @param route - The route to append to the base URL.
33
36
  * @returns The full URL as a string.
34
37
  */
38
+ private onDebug;
35
39
  private generateURL;
36
40
  /**
37
41
  * Generates the headers for a request by merging base headers, provided headers, and tokens.
@@ -41,40 +45,40 @@ declare class ApiInstance {
41
45
  */
42
46
  private generateHeaders;
43
47
  /**
44
- * Sends a GET request to the specified route.
45
- * @param route - The API route to send the GET request to.
48
+ * Sends a get request to the specified endpoint.
49
+ * @param endpoint - The API endpoint to send the get request to.
46
50
  * @param data - The request data, including optional headers and token.
47
51
  * @returns The API response data.
48
52
  */
49
- GET(route: string, data?: ApiRequestDataWithoutBodyProps): Promise<import("../types/ApiResponseDTO").ApiResponseDTO<any>>;
53
+ get(endpoint: string, data?: ApiRequestDataWithoutBodyProps): Promise<import("../types/ApiResponseDTO").ApiResponseDTO<any>>;
50
54
  /**
51
- * Sends a POST request to the specified route.
52
- * @param route - The API route to send the POST request to.
55
+ * Sends a post request to the specified endpoint.
56
+ * @param endpoint - The API endpoint to send the post request to.
53
57
  * @param data - The request data, including body, optional headers, and token.
54
58
  * @returns The API response data.
55
59
  */
56
- POST(route: string, data?: ApiRequestDataWithBodyProps): Promise<import("../types/ApiResponseDTO").ApiResponseDTO<any>>;
60
+ post(endpoint: string, data?: ApiRequestDataWithBodyProps): Promise<import("../types/ApiResponseDTO").ApiResponseDTO<any>>;
57
61
  /**
58
- * Sends a PUT request to the specified route.
59
- * @param route - The API route to send the PUT request to.
62
+ * Sends a put request to the specified endpoint.
63
+ * @param endpoint - The API endpoint to send the put request to.
60
64
  * @param data - The request data, including body, optional headers, and token.
61
65
  * @returns The API response data.
62
66
  */
63
- PUT(route: string, data?: ApiRequestDataWithBodyProps): Promise<import("../types/ApiResponseDTO").ApiResponseDTO<any>>;
67
+ put(endpoint: string, data?: ApiRequestDataWithBodyProps): Promise<import("../types/ApiResponseDTO").ApiResponseDTO<any>>;
64
68
  /**
65
- * Sends a PATCH request to the specified route.
66
- * @param route - The API route to send the PATCH request to.
69
+ * Sends a patch request to the specified endpoint.
70
+ * @param endpoint - The API endpoint to send the patch request to.
67
71
  * @param data - The request data, including body, optional headers, and token.
68
72
  * @returns The API response data.
69
73
  */
70
- PATCH(route: string, data?: ApiRequestDataWithBodyProps): Promise<import("../types/ApiResponseDTO").ApiResponseDTO<any>>;
74
+ patch(endpoint: string, data?: ApiRequestDataWithBodyProps): Promise<import("../types/ApiResponseDTO").ApiResponseDTO<any>>;
71
75
  /**
72
- * Sends a DELETE request to the specified route.
73
- * @param route - The API route to send the DELETE request to.
76
+ * Sends a delete request to the specified endpoint.
77
+ * @param endpoint - The API endpoint to send the delete request to.
74
78
  * @param data - The request data, including body, optional headers, and token.
75
79
  * @returns The API response data.
76
80
  */
77
- DELETE(route: string, data?: ApiRequestDataWithBodyProps): Promise<import("../types/ApiResponseDTO").ApiResponseDTO<any>>;
81
+ delete(endpoint: string, data?: ApiRequestDataWithBodyProps): Promise<import("../types/ApiResponseDTO").ApiResponseDTO<any>>;
78
82
  }
79
- export { ApiInstance };
80
- //# sourceMappingURL=apiInstance.d.ts.map
83
+ export { ApiService };
84
+ //# sourceMappingURL=apiService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiService.d.ts","sourceRoot":"","sources":["../../src/services/apiService.ts"],"names":[],"mappings":"AAOA,KAAK,0BAA0B,G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@ -3,30 +3,47 @@ import { getRequest } from "../api/getRequest";
3
3
  import { patchRequest } from "../api/patchRequest";
4
4
  import { postRequest } from "../api/postRequest";
5
5
  import { putRequest } from "../api/putRequest";
6
+ import { flushDebugLogs } from "./flushDebugLogs";
6
7
  /**
7
8
  * Class representing an API instance to handle HTTP requests with base configurations.
8
9
  */
9
- class ApiInstance {
10
+ class ApiService {
10
11
  baseUrl;
11
12
  baseHeaders;
12
13
  baseToken;
14
+ enableDebug;
13
15
  /**
14
- * Creates an instance of ApiInstance.
16
+ * Creates an instance of ApiService.
15
17
  * @param props - The configuration properties for the API instance.
16
18
  * @param props.baseUrl - The base URL for the API.
17
19
  * @param props.baseHeaders - Optional base headers to include in all requests.
18
20
  * @param props.baseToken - Optional base token for authorization.
21
+ * @param props.enableDebug - Optional flag to enable debug logging for requests.
19
22
  */
20
23
  constructor(props) {
21
24
  this.baseUrl = props.baseUrl;
22
25
  this.baseHeaders = props.baseHeaders || undefined;
23
26
  this.baseToken = props.baseToken || undefined;
27
+ this.enableDebug = props.enableDebug || false;
24
28
  }
25
29
  /**
26
30
  * Generates the full URL by appending the route to the base URL.
27
31
  * @param route - The route to append to the base URL.
28
32
  * @returns The full URL as a string.
29
33
  */
34
+ onDebug(endpoint, method, data) {
35
+ if (this.enableDebug) {
36
+ const debugs = [];
37
+ debugs.push(`Base URL: ${this.baseUrl}`);
38
+ debugs.push(`Endpoint: ${endpoint}`);
39
+ debugs.push(`Method: ${method}`);
40
+ if (data[0])
41
+ debugs.push(`Headers: ${JSON.stringify(data[0])}`);
42
+ if (data[1])
43
+ debugs.push(`Body: ${JSON.stringify(data[1])}`);
44
+ flushDebugLogs({ debugs, name: "ARKYN-API-DEBUG", scheme: "yellow" });
45
+ }
46
+ }
30
47
  generateURL(route) {
31
48
  return this.baseUrl + route;
32
49
  }
@@ -49,63 +66,68 @@ class ApiInstance {
49
66
  return headers;
50
67
  }
51
68
  /**
52
- * Sends a GET request to the specified route.
53
- * @param route - The API route to send the GET request to.
69
+ * Sends a get request to the specified endpoint.
70
+ * @param endpoint - The API endpoint to send the get request to.
54
71
  * @param data - The request data, including optional headers and token.
55
72
  * @returns The API response data.
56
73
  */
57
- async GET(route, data) {
58
- const url = this.generateURL(route);
74
+ async get(endpoint, data) {
75
+ const url = this.generateURL(endpoint);
59
76
  const headers = this.generateHeaders(data?.headers || {}, data?.token);
77
+ this.onDebug(endpoint, "get", [headers]);
60
78
  return await getRequest(url, headers);
61
79
  }
62
80
  /**
63
- * Sends a POST request to the specified route.
64
- * @param route - The API route to send the POST request to.
81
+ * Sends a post request to the specified endpoint.
82
+ * @param endpoint - The API endpoint to send the post request to.
65
83
  * @param data - The request data, including body, optional headers, and token.
66
84
  * @returns The API response data.
67
85
  */
68
- async POST(route, data) {
69
- const url = this.generateURL(route);
86
+ async post(endpoint, data) {
87
+ const url = this.generateURL(endpoint);
70
88
  const headers = this.generateHeaders(data?.headers || {}, data?.token);
71
89
  const body = data?.body;
90
+ this.onDebug(endpoint, "post", [headers, body]);
72
91
  return await postRequest(url, headers, body);
73
92
  }
74
93
  /**
75
- * Sends a PUT request to the specified route.
76
- * @param route - The API route to send the PUT request to.
94
+ * Sends a put request to the specified endpoint.
95
+ * @param endpoint - The API endpoint to send the put request to.
77
96
  * @param data - The request data, including body, optional headers, and token.
78
97
  * @returns The API response data.
79
98
  */
80
- async PUT(route, data) {
81
- const url = this.generateURL(route);
99
+ async put(endpoint, data) {
100
+ const url = this.generateURL(endpoint);
82
101
  const headers = this.generateHeaders(data?.headers || {}, data?.token);
83
102
  const body = data?.body;
103
+ this.onDebug(endpoint, "put", [headers, body]);
84
104
  return await putRequest(url, headers, body);
85
105
  }
86
106
  /**
87
- * Sends a PATCH request to the specified route.
88
- * @param route - The API route to send the PATCH request to.
107
+ * Sends a patch request to the specified endpoint.
108
+ * @param endpoint - The API endpoint to send the patch request to.
89
109
  * @param data - The request data, including body, optional headers, and token.
90
110
  * @returns The API response data.
91
111
  */
92
- async PATCH(route, data) {
93
- const url = this.generateURL(route);
112
+ async patch(endpoint, data) {
113
+ const url = this.generateURL(endpoint);
94
114
  const headers = this.generateHeaders(data?.headers || {}, data?.token);
95
115
  const body = data?.body;
116
+ this.onDebug(endpoint, "patch", [headers, body]);
96
117
  return await patchRequest(url, headers, body);
97
118
  }
98
119
  /**
99
- * Sends a DELETE request to the specified route.
100
- * @param route - The API route to send the DELETE request to.
120
+ * Sends a delete request to the specified endpoint.
121
+ * @param endpoint - The API endpoint to send the delete request to.
101
122
  * @param data - The request data, including body, optional headers, and token.
102
123
  * @returns The API response data.
103
124
  */
104
- async DELETE(route, data) {
105
- const url = this.generateURL(route);
125
+ async delete(endpoint, data) {
126
+ const url = this.generateURL(endpoint);
106
127
  const headers = this.generateHeaders(data?.headers || {}, data?.token);
107
128
  const body = data?.body;
129
+ this.onDebug(endpoint, "delete", [headers, body]);
108
130
  return await deleteRequest(url, headers, body);
109
131
  }
110
132
  }
111
- export { ApiInstance };
133
+ export { ApiService };
@@ -9,11 +9,11 @@ type SetArkynConfigProps = {
9
9
  arkynLogBaseApiUrl?: string;
10
10
  };
11
11
  /**
12
- * The `ArkynLogInstance` class manages the configuration for the arkyn flow.
12
+ * The `ArkynLogService` class manages the configuration for the arkyn flow.
13
13
  * It allows you to set and retrieve the arkyn configuration, including the traffic source ID,
14
14
  * user token, and API URL.
15
15
  */
16
- declare class ArkynLogInstance {
16
+ declare class ArkynLogService {
17
17
  private static arkynConfig?;
18
18
  /**
19
19
  * Sets the configuration for the arkyn. This method initializes the arkyn configuration
@@ -28,7 +28,7 @@ declare class ArkynLogInstance {
28
28
  */
29
29
  static setArkynConfig(arkynConfig: SetArkynConfigProps): void;
30
30
  /**
31
- * Retrieves the current arkyn configuration for the ArkynLogInstance.
31
+ * Retrieves the current arkyn configuration for the ArkynLogService.
32
32
  *
33
33
  * @returns {ArkynConfigProps | undefined} The current arkyn configuration if set,
34
34
  * or `undefined` if no configuration has been initialized.
@@ -40,5 +40,5 @@ declare class ArkynLogInstance {
40
40
  */
41
41
  static resetArkynConfig(): void;
42
42
  }
43
- export { ArkynLogInstance };
44
- //# sourceMappingURL=arkynLogInstance.d.ts.map
43
+ export { ArkynLogService };
44
+ //# sourceMappingURL=arkynLogService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arkynLogService.d.ts","sourceRoot":"","sources":["../../src/services/arkynLogService.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AAEH,cAAM,eAAe;IACnB,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAmB;IAE9C;;;;;;;;;;OAUG;IAEH,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,mBAAmB;IAgBtD;;;;;OAKG;IACH,MAAM,CAAC,cAAc,IAAI,gBAAgB,GAAG,SAAS;IAIrD;;;OAGG;IAEH,MAAM,CAAC,gBAAgB;CAGxB;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -1,9 +1,9 @@
1
1
  /**
2
- * The `ArkynLogInstance` class manages the configuration for the arkyn flow.
2
+ * The `ArkynLogService` class manages the configuration for the arkyn flow.
3
3
  * It allows you to set and retrieve the arkyn configuration, including the traffic source ID,
4
4
  * user token, and API URL.
5
5
  */
6
- class ArkynLogInstance {
6
+ class ArkynLogService {
7
7
  static arkynConfig;
8
8
  /**
9
9
  * Sets the configuration for the arkyn. This method initializes the arkyn configuration
@@ -23,7 +23,6 @@ class ArkynLogInstance {
23
23
  let arkynLogBaseApiUrl = arkynConfig.arkynLogBaseApiUrl || defaultArkynURL;
24
24
  arkynLogBaseApiUrl =
25
25
  arkynLogBaseApiUrl + "/http-traffic-records/:trafficSourceId";
26
- arkynLogBaseApiUrl.replace(":trafficSourceId", arkynConfig.arkynTrafficSourceId);
27
26
  this.arkynConfig = {
28
27
  arkynTrafficSourceId: arkynConfig.arkynTrafficSourceId,
29
28
  arkynUserToken: arkynConfig.arkynUserToken,
@@ -31,7 +30,7 @@ class ArkynLogInstance {
31
30
  };
32
31
  }
33
32
  /**
34
- * Retrieves the current arkyn configuration for the ArkynLogInstance.
33
+ * Retrieves the current arkyn configuration for the ArkynLogService.
35
34
  *
36
35
  * @returns {ArkynConfigProps | undefined} The current arkyn configuration if set,
37
36
  * or `undefined` if no configuration has been initialized.
@@ -47,4 +46,4 @@ class ArkynLogInstance {
47
46
  this.arkynConfig = undefined;
48
47
  }
49
48
  }
50
- export { ArkynLogInstance };
49
+ export { ArkynLogService };