laradumps-js 0.1.4 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/README.md +99 -0
- package/dist/index.js +3190 -556
- package/dist/index.js.map +1 -1
- package/dist/laradumps.min.js +1 -1
- package/dist/src/Benchmark.test.js +78 -0
- package/dist/src/Benchmark.test.js.map +1 -0
- package/dist/src/Colors.test.js +25 -0
- package/dist/src/Colors.test.js.map +1 -0
- package/dist/src/Json.js +19 -1
- package/dist/src/Json.js.map +1 -1
- package/dist/src/Json.test.js +34 -0
- package/dist/src/Json.test.js.map +1 -0
- package/dist/src/Label.test.js +13 -0
- package/dist/src/Label.test.js.map +1 -0
- package/dist/src/LaraDumps.js +6 -7
- package/dist/src/LaraDumps.js.map +1 -1
- package/dist/src/LaraDumps.test.js +44 -0
- package/dist/src/LaraDumps.test.js.map +1 -0
- package/dist/src/Screen.test.js +20 -0
- package/dist/src/Screen.test.js.map +1 -0
- package/dist/src/Table.test.js +34 -0
- package/dist/src/Table.test.js.map +1 -0
- package/dist/src/TimeTrack.test.js +30 -0
- package/dist/src/TimeTrack.test.js.map +1 -0
- package/dist/src/Validate.test.js +35 -0
- package/dist/src/Validate.test.js.map +1 -0
- package/index.js +2 -2
- package/package.json +18 -5
- package/src/Json.ts +22 -2
- package/src/LaraDumps.ts +10 -11
- package/types.d.ts +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LaraDumps.js","sourceRoot":"","sources":["../../src/LaraDumps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,0DAAoC;AACpC,oDAA8B;AAC9B,gDAA0B;AAC1B,kDAA4B;AAC5B,oDAA8B;AAC9B,kDAA4B;AAC5B,0DAAoC;AACpC,wDAAkC;AAGlC,IAAM,SAAS,sFACX,UAAU,EAAE,IAAI,EAChB,SAAS,EAAE,IAAI,
|
1
|
+
{"version":3,"file":"LaraDumps.js","sourceRoot":"","sources":["../../src/LaraDumps.ts"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AI,OAAA,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAzB,CAAyB,CAAC,CAAC;YAClE,UAAU,GAAG,MAAA,UAAU,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAC/C,CAAC;aAAM,IAAG,OAAO,EAAE,CAAC;YAChB,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACvC,UAAU,GAAG,MAAA,UAAU,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAC/C,CAAC;QAED,IAAM,KAAK,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAE/D,IAAI,KAAK,EAAE,CAAC;YACF,IAAA,KAAA,OAA0B,KAAK,IAAA,EAA9B,CAAC,QAAA,EAAE,IAAI,QAAA,EAAE,IAAI,QAAA,EAAE,MAAM,QAAS,CAAC;YAEtC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;YAClB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;YAClB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QAC1B,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC,GACJ,CAAC;AAEF,kBAAe,SAAS,CAAC"}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
var LaraDumps = require("./LaraDumps").default;
|
2
|
+
describe('LaraDumps', function () {
|
3
|
+
it('should be able to send clear', function () {
|
4
|
+
LaraDumps.send = jest.fn();
|
5
|
+
LaraDumps.clear();
|
6
|
+
expect(LaraDumps.send).toHaveBeenCalledWith("clear", {
|
7
|
+
"clear": {}
|
8
|
+
});
|
9
|
+
});
|
10
|
+
it('should be able to send die', function () {
|
11
|
+
LaraDumps.send = jest.fn();
|
12
|
+
expect(LaraDumps.die).toThrow("Exception to stop the execution!");
|
13
|
+
});
|
14
|
+
it('should be able to send label', function () {
|
15
|
+
LaraDumps.send = jest.fn();
|
16
|
+
LaraDumps.label("test");
|
17
|
+
expect(LaraDumps.send).toHaveBeenCalledWith("label", {
|
18
|
+
"label": {
|
19
|
+
"label": "test"
|
20
|
+
}
|
21
|
+
});
|
22
|
+
});
|
23
|
+
it('should be able to send dump', function () {
|
24
|
+
LaraDumps.send = jest.fn();
|
25
|
+
LaraDumps.dump("test");
|
26
|
+
expect(LaraDumps.send).toHaveBeenCalledWith("dump", {
|
27
|
+
"dump": {
|
28
|
+
"dump": "test",
|
29
|
+
"original_content": "test",
|
30
|
+
"variable_type": "string"
|
31
|
+
}
|
32
|
+
});
|
33
|
+
});
|
34
|
+
it('should be able to send generateIds', function () {
|
35
|
+
LaraDumps.send = jest.fn();
|
36
|
+
LaraDumps.makeUUID = jest.fn().mockReturnValue("test");
|
37
|
+
expect(LaraDumps.instanceId).toBeNull();
|
38
|
+
expect(LaraDumps.requestId).toBeNull();
|
39
|
+
LaraDumps.generateIds();
|
40
|
+
expect(LaraDumps.instanceId).toBe("test");
|
41
|
+
expect(LaraDumps.requestId).toBe("test");
|
42
|
+
});
|
43
|
+
});
|
44
|
+
//# sourceMappingURL=LaraDumps.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"LaraDumps.test.js","sourceRoot":"","sources":["../../src/LaraDumps.test.ts"],"names":[],"mappings":"AAAO,IAAS,SAAS,GAAI,OAAO,CAAC,aAAa,CAAC,QAA1B,CAA2B;AAEpD,QAAQ,CAAC,WAAW,EAAE;IAClB,EAAE,CAAC,8BAA8B,EAAE;QAC/B,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC3B,SAAS,CAAC,KAAK,EAAE,CAAC;QAElB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,OAAO,EAAE;YACjD,OAAO,EAAE,EAAE;SACd,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4BAA4B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C,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
var _Screen = require("./Screen").default;
|
2
|
+
describe('Screen', function () {
|
3
|
+
it.each([
|
4
|
+
{ method: 's' },
|
5
|
+
{ method: 'w', screenRaisenIn: 3 },
|
6
|
+
{ method: 'toScreenWindow', newWindow: true },
|
7
|
+
])('should be able to send screen when calling with %s', function (_a) {
|
8
|
+
var method = _a.method, _b = _a.screenRaisenIn, screenRaisenIn = _b === void 0 ? 0 : _b, _c = _a.newWindow, newWindow = _c === void 0 ? false : _c;
|
9
|
+
_Screen.send = jest.fn();
|
10
|
+
_Screen[method]('new screen', screenRaisenIn);
|
11
|
+
expect(_Screen.send).toHaveBeenCalledWith("screen", {
|
12
|
+
"screen": {
|
13
|
+
"screen_name": "new screen",
|
14
|
+
"raisen_in": screenRaisenIn,
|
15
|
+
"new_window": newWindow
|
16
|
+
}
|
17
|
+
});
|
18
|
+
});
|
19
|
+
});
|
20
|
+
//# sourceMappingURL=Screen.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Screen.test.js","sourceRoot":"","sources":["../../src/Screen.test.ts"],"names":[],"mappings":"AAAO,IAAS,OAAO,GAAI,OAAO,CAAC,UAAU,CAAC,QAAvB,CAAwB;AAE/C,QAAQ,CAAC,QAAQ,EAAE;IACf,EAAE,CAAC,IAAI,CAAC;QACJ,EAAC,MAAM,EAAE,GAAG,EAAC;QACb,EAAC,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,CAAC,EAAC;QAChC,EAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAC;KAC9C,CAAC,CAAC,oDAAoD,EAAE,UAAC,EAA2C;YAA1C,MAAM,YAAA,EAAE,sBAAgB,EAAhB,cAAc,mBAAC,CAAC,KAAA,EAAE,iBAAe,EAAf,SAAS,mBAAC,KAAK,KAAA;QAChG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACzB,OAAO,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QAE9C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE;YAChD,QAAQ,EAAE;gBACN,aAAa,EAAE,YAAY;gBAC3B,WAAW,EAAE,cAAc;gBAC3B,YAAY,EAAE,SAAS;aAC1B;SACJ,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
var Table = require("./Table").default;
|
2
|
+
describe.only('Table', function () {
|
3
|
+
var users = [
|
4
|
+
{ "name": "hecktor" },
|
5
|
+
{ "name": "luan" },
|
6
|
+
];
|
7
|
+
it('should be able to send table', function () {
|
8
|
+
Table.label = jest.fn();
|
9
|
+
Table.send = jest.fn().mockReturnValue({ label: Table.label });
|
10
|
+
Table.table(users, "test");
|
11
|
+
expect(Table.send).toHaveBeenCalledWith("table", {
|
12
|
+
"table": {
|
13
|
+
fields: ["name"],
|
14
|
+
header: ["name"],
|
15
|
+
values: users,
|
16
|
+
label: "test"
|
17
|
+
}
|
18
|
+
});
|
19
|
+
expect(Table.label).toHaveBeenCalledWith("test");
|
20
|
+
});
|
21
|
+
it('should be able to send table v2', function () {
|
22
|
+
Table.label = jest.fn();
|
23
|
+
Table.send = jest.fn().mockReturnValue({ label: Table.label });
|
24
|
+
Table.tableV2(users, "test");
|
25
|
+
expect(Table.send).toHaveBeenCalledWith("table_v2", {
|
26
|
+
"table_v2": {
|
27
|
+
label: "test",
|
28
|
+
values: users
|
29
|
+
}
|
30
|
+
});
|
31
|
+
expect(Table.label).toHaveBeenCalledWith("test");
|
32
|
+
});
|
33
|
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,EAAE,MAAM,CAAC,CAAC;QAE7B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,UAAU,EAAE;YAChD,UAAU,EAAE;gBACR,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,KAAK;aAChB;SACJ,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
var TimeTrack = require("./TimeTrack").default;
|
2
|
+
describe('TimeTrack', function () {
|
3
|
+
TimeTrack.makeUUID = jest.fn().mockReturnValue("test");
|
4
|
+
it('should be able to send time track', function () {
|
5
|
+
TimeTrack.label = jest.fn();
|
6
|
+
TimeTrack.send = jest.fn().mockReturnValue({ label: TimeTrack.label });
|
7
|
+
TimeTrack.time('test');
|
8
|
+
expect(TimeTrack.send).toHaveBeenCalledWith("time_track", {
|
9
|
+
"time_track": {
|
10
|
+
tracker_id: expect.any(String),
|
11
|
+
time: expect.any(Number),
|
12
|
+
label: "test"
|
13
|
+
}
|
14
|
+
});
|
15
|
+
expect(TimeTrack.label).toHaveBeenCalledWith("test");
|
16
|
+
});
|
17
|
+
it('should be able to send time stop track', function () {
|
18
|
+
TimeTrack.send = jest.fn();
|
19
|
+
TimeTrack.stopTime('test');
|
20
|
+
expect(TimeTrack.send).toHaveBeenCalledWith("time_track", {
|
21
|
+
"time_track": {
|
22
|
+
time: expect.any(Number),
|
23
|
+
label: "test",
|
24
|
+
end_time: expect.any(Number),
|
25
|
+
tracker_id: expect.any(String)
|
26
|
+
}
|
27
|
+
});
|
28
|
+
});
|
29
|
+
});
|
30
|
+
//# sourceMappingURL=TimeTrack.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TimeTrack.test.js","sourceRoot":"","sources":["../../src/TimeTrack.test.ts"],"names":[],"mappings":"AA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M,CAAC;aACjC;SACJ,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAA"}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
var _Validate = require("./Validate").default;
|
2
|
+
describe('Validate', function () {
|
3
|
+
it('should be able to send json validate', function () {
|
4
|
+
_Validate.send = jest.fn();
|
5
|
+
_Validate.isJson();
|
6
|
+
expect(_Validate.send).toHaveBeenCalledWith("json_validate", {
|
7
|
+
"json_validate": {}
|
8
|
+
});
|
9
|
+
});
|
10
|
+
it('should be able to send validate', function () {
|
11
|
+
_Validate.send = jest.fn();
|
12
|
+
_Validate.validate('contains', 'test');
|
13
|
+
expect(_Validate.send).toHaveBeenCalledWith("validate", {
|
14
|
+
"validate": {
|
15
|
+
type: "contains",
|
16
|
+
content: "test",
|
17
|
+
is_case_sensitive: false,
|
18
|
+
is_whole_word: false
|
19
|
+
}
|
20
|
+
});
|
21
|
+
});
|
22
|
+
it('should be able to send contains', function () {
|
23
|
+
_Validate.send = jest.fn();
|
24
|
+
_Validate.contains('test');
|
25
|
+
expect(_Validate.send).toHaveBeenCalledWith("validate", {
|
26
|
+
"validate": {
|
27
|
+
type: "contains",
|
28
|
+
content: "test",
|
29
|
+
is_case_sensitive: false,
|
30
|
+
is_whole_word: false
|
31
|
+
}
|
32
|
+
});
|
33
|
+
});
|
34
|
+
});
|
35
|
+
//# sourceMappingURL=Validate.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Validate.test.js","sourceRoot":"","sources":["../../src/Validate.test.ts"],"names":[],"mappings":"AAAO,IAAS,SAAS,GAAI,OAAO,CAAC,YAAY,CAAC,QAAzB,CAA0B;AAEnD,QAAQ,CAAC,UAAU,EAAE;IACjB,EAAE,CAAC,sCAAsC,EAAE;QACvC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC3B,SAAS,CAAC,MAAM,EAAE,CAAC;QAEnB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,eAAe,EAAE;YACzD,eAAe,EAAE,EAAE;SACtB,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE;QAClC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC3B,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAEvC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,UAAU,EAAE;YACpD,UAAU,EAAE;gBACR,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,MAAM;gBACf,iBAAiB,EAAE,KAAK;gBACxB,aAAa,EAAE,KAAK;aACvB;SACJ,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE;QAClC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC3B,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE3B,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,UAAU,EAAE;YACpD,UAAU,EAAE;gBACR,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,MAAM;gBACf,iBAAiB,EAAE,KAAK;gBACxB,aAAa,EAAE,KAAK;aACvB;SACJ,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/index.js
CHANGED
@@ -21,8 +21,8 @@ export function configure({
|
|
21
21
|
}) {
|
22
22
|
let server = `http://${host}:${port}`;
|
23
23
|
|
24
|
-
CONFIG_LARADUMPS.host = server;
|
25
|
-
CONFIG_LARADUMPS.autoInvokeApp = autoInvoke;
|
24
|
+
globalThis.CONFIG_LARADUMPS.host = server;
|
25
|
+
globalThis.CONFIG_LARADUMPS.autoInvokeApp = autoInvoke;
|
26
26
|
}
|
27
27
|
|
28
28
|
globalThis.ds = ds;
|
package/package.json
CHANGED
@@ -1,19 +1,32 @@
|
|
1
1
|
{
|
2
2
|
"name": "laradumps-js",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.7",
|
4
4
|
"main": "index.js",
|
5
5
|
"types": "index.d.ts",
|
6
6
|
"repository": {
|
7
7
|
"type": "git",
|
8
8
|
"url": "git+ssh://git@github.com/laradumps/laradumps-js.git"
|
9
9
|
},
|
10
|
-
"author": "Hecktor viegas <
|
10
|
+
"author": "Hecktor viegas <hecktorvn@hotmail.com>",
|
11
|
+
"contributors": [
|
12
|
+
{
|
13
|
+
"name": "Hecktor viegas",
|
14
|
+
"email": "hecktorvn@hotmail.com",
|
15
|
+
"url": "https://github.com/hecktorv"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"name": "Luan Freitas",
|
19
|
+
"email": "luanfreitas10@protonmail.com",
|
20
|
+
"url": "https://github.com/luanfreitasdev"
|
21
|
+
}
|
22
|
+
],
|
11
23
|
"license": "MIT",
|
12
24
|
"private": false,
|
13
25
|
"dependencies": {
|
14
26
|
"axios": "^1.7.7",
|
15
27
|
"ts-loader": "^9.5.1",
|
16
|
-
"typescript": "^5.
|
28
|
+
"typescript": "^5.6.3",
|
29
|
+
"util": "^0.12.5"
|
17
30
|
},
|
18
31
|
"scripts": {
|
19
32
|
"minify": "uglifyjs dist/index.js -c -m -o dist/laradumps.min.js",
|
@@ -25,8 +38,8 @@
|
|
25
38
|
"jest": "^29.7.0",
|
26
39
|
"ts-jest": "^29.2.5",
|
27
40
|
"ts-node": "^10.9.2",
|
28
|
-
"uglify-js": "^3.19.
|
29
|
-
"webpack": "^5.
|
41
|
+
"uglify-js": "^3.19.3",
|
42
|
+
"webpack": "^5.96.1",
|
30
43
|
"webpack-cli": "^5.1.4"
|
31
44
|
}
|
32
45
|
}
|
package/src/Json.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { inspect } from "util";
|
1
2
|
import { _Json, _LaraDumps } from "../types";
|
2
3
|
|
3
4
|
export default {
|
@@ -13,11 +14,30 @@ export default {
|
|
13
14
|
this.sendJson(json);
|
14
15
|
}
|
15
16
|
} catch (error) {
|
16
|
-
|
17
|
+
this.dump(this.inspect(json));
|
17
18
|
return this;
|
18
19
|
}
|
19
20
|
},
|
20
21
|
|
22
|
+
inspect(json: any): _LaraDumps {
|
23
|
+
return this.convertJSONStringToJSON(inspect(json));
|
24
|
+
},
|
25
|
+
|
26
|
+
convertJSONStringToJSON(object: string): object | string {
|
27
|
+
let formatted = object
|
28
|
+
.replace(/([{,]\s*)(\w+)\s*:/g, '$1"$2":')
|
29
|
+
.replace(/:\s*'([^']*)'/g, ': "$1"')
|
30
|
+
.replace(/undefined/g, 'null')
|
31
|
+
.replace(/\[Object\]/g, '{}')
|
32
|
+
.replace(/(\r\n|\n|\r)/gm, "");
|
33
|
+
|
34
|
+
try {
|
35
|
+
return JSON.parse(formatted);
|
36
|
+
} catch (error) {
|
37
|
+
return object;
|
38
|
+
}
|
39
|
+
},
|
40
|
+
|
21
41
|
isValidJson(json: any): boolean {
|
22
42
|
try {
|
23
43
|
JSON.parse(json);
|
@@ -40,4 +60,4 @@ export default {
|
|
40
60
|
}
|
41
61
|
});
|
42
62
|
},
|
43
|
-
} as _Json;
|
63
|
+
} as _Json;
|
package/src/LaraDumps.ts
CHANGED
@@ -9,14 +9,16 @@ import TimeTrack from './TimeTrack';
|
|
9
9
|
import Validate from './Validate';
|
10
10
|
import { _LaraDumps } from '../types';
|
11
11
|
|
12
|
+
const defaultHost = 'http://127.0.0.1:9191';
|
13
|
+
|
12
14
|
const LaraDumps: _LaraDumps = {
|
13
15
|
instanceId: null,
|
14
16
|
requestId: null,
|
15
|
-
|
16
|
-
server: `http://127.0.0.1:9191/api/dumps`,
|
17
|
+
server: null,
|
17
18
|
params: [],
|
18
19
|
|
19
20
|
generateIds(): _LaraDumps {
|
21
|
+
this.server = `${globalThis.CONFIG_LARADUMPS?.host ?? defaultHost}/api/dumps`;
|
20
22
|
this.instanceId = this.makeUUID();
|
21
23
|
this.requestId = this.makeUUID();
|
22
24
|
|
@@ -65,13 +67,10 @@ const LaraDumps: _LaraDumps = {
|
|
65
67
|
|
66
68
|
const isValidJson = type === 'string' && this.isValidJson(param);
|
67
69
|
|
68
|
-
if(
|
70
|
+
if(type === "object" || isValidJson) {
|
69
71
|
this.json(param);
|
70
72
|
return;
|
71
|
-
}
|
72
|
-
console.info("Laradumps: Using JSON object as parameter. Please use `ds.json` if you want to send a JSON object.");
|
73
|
-
return;
|
74
|
-
}
|
73
|
+
}
|
75
74
|
|
76
75
|
return this.send("dump", {
|
77
76
|
"dump": {
|
@@ -103,7 +102,7 @@ const LaraDumps: _LaraDumps = {
|
|
103
102
|
"type": type,
|
104
103
|
...data
|
105
104
|
}).catch((error) => {
|
106
|
-
console.error("
|
105
|
+
console.error("Error:", error);
|
107
106
|
});
|
108
107
|
|
109
108
|
return this;
|
@@ -117,7 +116,7 @@ const LaraDumps: _LaraDumps = {
|
|
117
116
|
let callerLine: string = stackLines[4];
|
118
117
|
|
119
118
|
const hasAtDs = stackLines.findIndex(line => line.includes('at ds'));
|
120
|
-
|
119
|
+
|
121
120
|
if(stack.includes('[Alpine]')) {
|
122
121
|
stackLines = stackLines.filter(line => line.includes('[Alpine]'));
|
123
122
|
callerLine = stackLines[0]?.split('),')[0];
|
@@ -127,7 +126,7 @@ const LaraDumps: _LaraDumps = {
|
|
127
126
|
}
|
128
127
|
|
129
128
|
const match = callerLine?.match(/(https?:\/\/.*):(\d+):(\d+)/);
|
130
|
-
|
129
|
+
|
131
130
|
if (match) {
|
132
131
|
const [_, file, line, column] = match;
|
133
132
|
|
@@ -140,4 +139,4 @@ const LaraDumps: _LaraDumps = {
|
|
140
139
|
}
|
141
140
|
};
|
142
141
|
|
143
|
-
export default LaraDumps;
|
142
|
+
export default LaraDumps;
|
package/types.d.ts
CHANGED