@arkyn/server 2.2.1 → 2.2.3
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/config/apiInstance.d.ts +2 -2
- package/dist/config/apiInstance.d.ts.map +1 -1
- package/dist/services/getCaller.d.ts.map +1 -1
- package/dist/services/getCaller.js +20 -26
- package/dist/services/httpDebug.d.ts.map +1 -1
- package/dist/services/httpDebug.js +1 -1
- package/package.json +1 -1
- package/src/config/apiInstance.ts +2 -2
- package/src/services/getCaller.ts +24 -34
- package/src/services/httpDebug.ts +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
type ApiInstanceContructorProps = {
|
|
2
2
|
baseUrl: string;
|
|
3
3
|
baseHeaders?: HeadersInit;
|
|
4
4
|
baseToken?: string | null;
|
|
@@ -26,7 +26,7 @@ declare class ApiInstance {
|
|
|
26
26
|
* @param props.baseHeaders - Optional base headers to include in all requests.
|
|
27
27
|
* @param props.baseToken - Optional base token for authorization.
|
|
28
28
|
*/
|
|
29
|
-
constructor(props:
|
|
29
|
+
constructor(props: ApiInstanceContructorProps);
|
|
30
30
|
/**
|
|
31
31
|
* Generates the full URL by appending the route to the base URL.
|
|
32
32
|
* @param route - The route to append to the base URL.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiInstance.d.ts","sourceRoot":"","sources":["../../src/config/apiInstance.ts"],"names":[],"mappings":"AAMA,KAAK,
|
|
1
|
+
{"version":3,"file":"apiInstance.d.ts","sourceRoot":"","sources":["../../src/config/apiInstance.ts"],"names":[],"mappings":"AAMA,KAAK,0BAA0B,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,KAAK,8BAA8B,GAAG;IACpC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AAEH,cAAM,WAAW;IACf,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAC,CAAc;IAClC,OAAO,CAAC,SAAS,CAAC,CAAS;IAE3B;;;;;;OAMG;gBAES,KAAK,EAAE,0BAA0B;IAM7C;;;;OAIG;IAEH,OAAO,CAAC,WAAW;IAInB;;;;;OAKG;IAEH,OAAO,CAAC,eAAe;IAcvB;;;;;OAKG;IAEG,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,8BAA8B;IAM9D;;;;;OAKG;IAEG,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,2BAA2B;IAO5D;;;;;OAKG;IAEG,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,2BAA2B;IAO3D;;;;;OAKG;IAEG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,2BAA2B;IAO7D;;;;;OAKG;IAEG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,2BAA2B;CAM/D;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCaller.d.ts","sourceRoot":"","sources":["../../src/services/getCaller.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,iBAAS,SAAS;;;
|
|
1
|
+
{"version":3,"file":"getCaller.d.ts","sourceRoot":"","sources":["../../src/services/getCaller.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,iBAAS,SAAS;;;EA+BjB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -12,34 +12,28 @@ import path from "path";
|
|
|
12
12
|
*/
|
|
13
13
|
function getCaller() {
|
|
14
14
|
const projectRoot = process.cwd();
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
: "Unknown function";
|
|
35
|
-
let fullPath = match[2] || match[1];
|
|
36
|
-
if (fullPath.startsWith(projectRoot)) {
|
|
37
|
-
fullPath = path.relative(projectRoot, fullPath);
|
|
38
|
-
}
|
|
39
|
-
callerInfo = fullPath;
|
|
40
|
-
break;
|
|
15
|
+
const err = new Error();
|
|
16
|
+
const stack = err.stack || "";
|
|
17
|
+
const stackLines = stack.split("\n").map((line) => line.trim());
|
|
18
|
+
const callerLine = stackLines[4] || "";
|
|
19
|
+
let functionName = "unknown";
|
|
20
|
+
let callerInfo = "unknown location";
|
|
21
|
+
const functionMatch = callerLine.match(/at\s+([^\s]+)\s+\((.*)\)/);
|
|
22
|
+
if (functionMatch) {
|
|
23
|
+
functionName = functionMatch[1];
|
|
24
|
+
callerInfo = functionMatch[2];
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const locationMatch = callerLine.match(/at\s+(.*)/);
|
|
28
|
+
if (locationMatch) {
|
|
29
|
+
callerInfo = locationMatch[1];
|
|
30
|
+
const pathParts = callerInfo.split("/");
|
|
31
|
+
const lastPart = pathParts[pathParts.length - 1] || "";
|
|
32
|
+
const fileParts = lastPart.split(":");
|
|
33
|
+
functionName = fileParts[0] || "unknown";
|
|
41
34
|
}
|
|
42
35
|
}
|
|
36
|
+
callerInfo = path.relative(projectRoot, callerInfo);
|
|
43
37
|
return { functionName, callerInfo };
|
|
44
38
|
}
|
|
45
39
|
export { getCaller };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpDebug.d.ts","sourceRoot":"","sources":["../../src/services/httpDebug.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,iBAAS,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"httpDebug.d.ts","sourceRoot":"","sources":["../../src/services/httpDebug.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,iBAAS,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,GAAG,QA0BtD;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -47,10 +47,10 @@ function httpDebug(name, body, cause) {
|
|
|
47
47
|
if (cause) {
|
|
48
48
|
consoleData += `${debugName} Cause: ${JSON.stringify(cause, null, 2)}\n`;
|
|
49
49
|
}
|
|
50
|
-
console.log(consoleData);
|
|
51
50
|
const arkynKeys = InboxFlowInstance.getInboxConfig();
|
|
52
51
|
if (arkynKeys)
|
|
53
52
|
console.log(arkynKeys);
|
|
53
|
+
console.log(consoleData);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
export { httpDebug };
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { patchRequest } from "../api/patchRequest";
|
|
|
4
4
|
import { postRequest } from "../api/postRequest";
|
|
5
5
|
import { putRequest } from "../api/putRequest";
|
|
6
6
|
|
|
7
|
-
type
|
|
7
|
+
type ApiInstanceContructorProps = {
|
|
8
8
|
baseUrl: string;
|
|
9
9
|
baseHeaders?: HeadersInit;
|
|
10
10
|
baseToken?: string | null;
|
|
@@ -38,7 +38,7 @@ class ApiInstance {
|
|
|
38
38
|
* @param props.baseToken - Optional base token for authorization.
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
|
-
constructor(props:
|
|
41
|
+
constructor(props: ApiInstanceContructorProps) {
|
|
42
42
|
this.baseUrl = props.baseUrl;
|
|
43
43
|
this.baseHeaders = props.baseHeaders || undefined;
|
|
44
44
|
this.baseToken = props.baseToken || undefined;
|
|
@@ -15,43 +15,33 @@ import path from "path";
|
|
|
15
15
|
function getCaller() {
|
|
16
16
|
const projectRoot = process.cwd();
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
functionName =
|
|
42
|
-
rawFuncName && !rawFuncName.includes("/")
|
|
43
|
-
? rawFuncName
|
|
44
|
-
: "Unknown function";
|
|
45
|
-
|
|
46
|
-
let fullPath = match[2] || match[1];
|
|
47
|
-
if (fullPath.startsWith(projectRoot)) {
|
|
48
|
-
fullPath = path.relative(projectRoot, fullPath);
|
|
49
|
-
}
|
|
50
|
-
callerInfo = fullPath;
|
|
51
|
-
break;
|
|
18
|
+
const err = new Error();
|
|
19
|
+
const stack = err.stack || "";
|
|
20
|
+
|
|
21
|
+
const stackLines = stack.split("\n").map((line) => line.trim());
|
|
22
|
+
|
|
23
|
+
const callerLine = stackLines[4] || "";
|
|
24
|
+
|
|
25
|
+
let functionName = "unknown";
|
|
26
|
+
let callerInfo = "unknown location";
|
|
27
|
+
|
|
28
|
+
const functionMatch = callerLine.match(/at\s+([^\s]+)\s+\((.*)\)/);
|
|
29
|
+
if (functionMatch) {
|
|
30
|
+
functionName = functionMatch[1];
|
|
31
|
+
callerInfo = functionMatch[2];
|
|
32
|
+
} else {
|
|
33
|
+
const locationMatch = callerLine.match(/at\s+(.*)/);
|
|
34
|
+
if (locationMatch) {
|
|
35
|
+
callerInfo = locationMatch[1];
|
|
36
|
+
const pathParts = callerInfo.split("/");
|
|
37
|
+
const lastPart = pathParts[pathParts.length - 1] || "";
|
|
38
|
+
const fileParts = lastPart.split(":");
|
|
39
|
+
functionName = fileParts[0] || "unknown";
|
|
52
40
|
}
|
|
53
41
|
}
|
|
54
42
|
|
|
43
|
+
callerInfo = path.relative(projectRoot, callerInfo);
|
|
44
|
+
|
|
55
45
|
return { functionName, callerInfo };
|
|
56
46
|
}
|
|
57
47
|
|
|
@@ -55,9 +55,10 @@ function httpDebug(name: string, body: any, cause?: any) {
|
|
|
55
55
|
consoleData += `${debugName} Cause: ${JSON.stringify(cause, null, 2)}\n`;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
console.log(consoleData);
|
|
59
58
|
const arkynKeys = InboxFlowInstance.getInboxConfig();
|
|
60
59
|
if (arkynKeys) console.log(arkynKeys);
|
|
60
|
+
|
|
61
|
+
console.log(consoleData);
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
|