@lcap/nasl 0.3.10-beta → 0.3.10-beta.oom4
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/out/types/app/App.d.ts +5 -4
- package/out/types/app/App.js +30 -24
- package/out/types/app/App.js.map +1 -1
- package/out/types/index.d.ts +2 -4
- package/out/types/index.js +3 -6
- package/out/types/index.js.map +1 -1
- package/out/types/logic/Logic.d.ts +0 -12
- package/out/types/logic/Logic.js +0 -14
- package/out/types/logic/Logic.js.map +1 -1
- package/out/types/logic/LogicItem.d.ts +1 -20
- package/out/types/logic/LogicItem.js +0 -184
- package/out/types/logic/LogicItem.js.map +1 -1
- package/out/types/page/Element.js +1 -2
- package/out/types/page/Element.js.map +1 -1
- package/out/types/page/View.d.ts +2 -16
- package/out/types/page/View.js +4 -15
- package/out/types/page/View.js.map +1 -1
- package/package.json +1 -2
- package/src/types/app/App.ts +34 -27
- package/src/types/index.ts +2 -4
- package/src/types/logic/Logic.ts +0 -24
- package/src/types/logic/LogicItem.ts +5 -207
- package/src/types/logic/translator.js +86 -146
- package/src/types/page/Element.ts +1 -2
- package/src/types/page/View.ts +6 -27
- package/tsconfig.json +1 -1
- package/src/service/debugger/debugger.js +0 -90
- package/src/types/logic/BreakPoint.ts +0 -200
- package/src/types/logic/Debugger.ts +0 -1140
- package/src/types/logic/translator.d.ts +0 -16
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
const { io } = require('socket.io-client');
|
|
2
|
-
import { immutable, circular } from '../decorators';
|
|
3
|
-
import { Vertex, LogicItem, View, Logic, config } from '..';
|
|
4
|
-
import { breakpointService } from '../../service/debugger/debugger';
|
|
5
|
-
class BreakPoint extends Vertex {
|
|
6
|
-
// @immutable()
|
|
7
|
-
// public lineNumberEnd: number;
|
|
8
|
-
public appId: string;
|
|
9
|
-
public logicItemId: string;
|
|
10
|
-
public componentId: string;
|
|
11
|
-
public component: View;
|
|
12
|
-
public logic: Logic;
|
|
13
|
-
public remoteBreakpointId: string;
|
|
14
|
-
public isTemporary: boolean = false;
|
|
15
|
-
public target: string; // Frontend | Backend
|
|
16
|
-
public status: string; // enabled | disabled
|
|
17
|
-
public offset: number;
|
|
18
|
-
|
|
19
|
-
public lineNumberStart: number;
|
|
20
|
-
public classIdentify: string;
|
|
21
|
-
|
|
22
|
-
@circular()
|
|
23
|
-
public logicItem: LogicItem;
|
|
24
|
-
|
|
25
|
-
constructor(source?: Partial<BreakPoint>) {
|
|
26
|
-
super();
|
|
27
|
-
source && this.assign(source);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
attachSourceMap(): boolean {
|
|
31
|
-
const offset = this.offset;
|
|
32
|
-
if (this.target === 'Frontend') {
|
|
33
|
-
const sourceMap = this.component.sourceMap;
|
|
34
|
-
const map = sourceMap[this.logicItemId];
|
|
35
|
-
if (map) {
|
|
36
|
-
const node = map.node;
|
|
37
|
-
if (node.type === 'JSBlock' && offset !== 0) {
|
|
38
|
-
this.lineNumberStart = map.from + 1 + (offset || 0);
|
|
39
|
-
} else {
|
|
40
|
-
this.lineNumberStart = map.from + (offset || 0);
|
|
41
|
-
}
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (this.target === 'Backend') {
|
|
47
|
-
const sourceMap = this.logic.sourceMap;
|
|
48
|
-
const map = sourceMap[this.logicItemId];
|
|
49
|
-
if (map) {
|
|
50
|
-
this.lineNumberStart = map.lineFrom + (offset || 0);
|
|
51
|
-
this.classIdentify = map.classIdentify;
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async create({
|
|
59
|
-
appId,
|
|
60
|
-
logicItem,
|
|
61
|
-
offset,
|
|
62
|
-
}: {
|
|
63
|
-
appId: string,
|
|
64
|
-
logicItem: LogicItem,
|
|
65
|
-
offset?: number,
|
|
66
|
-
}) {
|
|
67
|
-
const vertexId = logicItem.id;
|
|
68
|
-
let logicId: string;
|
|
69
|
-
const target = logicItem.logic && logicItem.logic.view ? 'Frontend' : 'Backend';
|
|
70
|
-
if (target === 'Backend') {
|
|
71
|
-
logicId = logicItem.logic && logicItem.logic.id;
|
|
72
|
-
}
|
|
73
|
-
if (target === 'Frontend') {
|
|
74
|
-
logicId = logicItem.logic && logicItem.logic.view.id;
|
|
75
|
-
}
|
|
76
|
-
await breakpointService.setBreakPoint({
|
|
77
|
-
body: {
|
|
78
|
-
appId,
|
|
79
|
-
vertexId,
|
|
80
|
-
logicId,
|
|
81
|
-
offset,
|
|
82
|
-
status: 'Enabled',
|
|
83
|
-
target,
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
this.assign({
|
|
87
|
-
appId,
|
|
88
|
-
logicItem,
|
|
89
|
-
logicItemId: logicItem.id,
|
|
90
|
-
target,
|
|
91
|
-
componentId: logicItem.logic && logicItem.logic.view && logicItem.logic.view.id,
|
|
92
|
-
component: logicItem.logic && logicItem.logic.view,
|
|
93
|
-
logic: logicItem.logic,
|
|
94
|
-
status: 'Enabled',
|
|
95
|
-
offset,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
await app.debuggerClient.removeRemoteBreakPoint(bp);
|
|
100
|
-
await bp.remove();
|
|
101
|
-
|
|
102
|
-
*/
|
|
103
|
-
async remove() {
|
|
104
|
-
await breakpointService.removeBreakPoint({
|
|
105
|
-
query: {
|
|
106
|
-
appId: this.appId,
|
|
107
|
-
vertexId: this.logicItemId,
|
|
108
|
-
offset: this.offset,
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
this.removeOnLogicItem();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
removeOnLogicItem() {
|
|
115
|
-
const index = this.logicItem.breakPoints.findIndex((p) => p === this);
|
|
116
|
-
~index && this.logicItem.breakPoints.splice(index, 1);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
async enable() {
|
|
120
|
-
await breakpointService.updateBreakPointState({
|
|
121
|
-
query: {
|
|
122
|
-
appId: this.appId,
|
|
123
|
-
vertexId: this.logicItemId,
|
|
124
|
-
offset: this.offset,
|
|
125
|
-
status: 'Enabled',
|
|
126
|
-
},
|
|
127
|
-
});
|
|
128
|
-
this.status = 'Enabled';
|
|
129
|
-
const app = config.defaultApp;
|
|
130
|
-
if (app.debuggerClient.isConnected) {
|
|
131
|
-
this.attachSourceMap();
|
|
132
|
-
app.debuggerClient.setRemoteBreakPointRoundTrip(this);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
async disable() {
|
|
136
|
-
await breakpointService.updateBreakPointState({
|
|
137
|
-
query: {
|
|
138
|
-
appId: this.appId,
|
|
139
|
-
vertexId: this.logicItemId,
|
|
140
|
-
offset: this.offset,
|
|
141
|
-
status: 'Disabled',
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
this.status = 'Disabled';
|
|
145
|
-
const app = config.defaultApp;
|
|
146
|
-
if (app.debuggerClient.isConnected) {
|
|
147
|
-
app.debuggerClient.removeRemoteBreakPointRoundTrip(this);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
static async from(bp: BreakpointMeta) :Promise<BreakPoint> {
|
|
152
|
-
const id = bp.vertexId;
|
|
153
|
-
let logicItem = Vertex.getVertexByRef(id) as LogicItem;
|
|
154
|
-
if (!logicItem) {
|
|
155
|
-
const logic = Vertex.getVertexByRef(bp.logicId) as Logic;
|
|
156
|
-
await logic.load();
|
|
157
|
-
logicItem = Vertex.getVertexByRef(id) as LogicItem;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const breakpoint = new BreakPoint({
|
|
161
|
-
appId: bp.appId,
|
|
162
|
-
logicItem,
|
|
163
|
-
logicItemId: id,
|
|
164
|
-
target: bp.target,
|
|
165
|
-
componentId: logicItem.logic && logicItem.logic.view && logicItem.logic.view.id,
|
|
166
|
-
component: logicItem.logic && logicItem.logic.view,
|
|
167
|
-
logic: logicItem.logic,
|
|
168
|
-
status: bp.status,
|
|
169
|
-
offset: bp.offset,
|
|
170
|
-
});
|
|
171
|
-
logicItem.addBreakPointInstance(breakpoint);
|
|
172
|
-
return breakpoint;
|
|
173
|
-
}
|
|
174
|
-
// get logicItem() {
|
|
175
|
-
// if (this._logicItem) {
|
|
176
|
-
// return this._logicItem;
|
|
177
|
-
// }
|
|
178
|
-
// this._logicItem = Vertex.getVertexByRef(this.logicId);
|
|
179
|
-
// return this._logicItem;
|
|
180
|
-
// }
|
|
181
|
-
|
|
182
|
-
// setRemoteBreakPoint(socket: io) {
|
|
183
|
-
// debugger
|
|
184
|
-
// socket.emit('setbreakpoint', {
|
|
185
|
-
// componentId: this.componentId,
|
|
186
|
-
// line: this.lineNumberStart,
|
|
187
|
-
// id: this.id,
|
|
188
|
-
// });
|
|
189
|
-
// }
|
|
190
|
-
}
|
|
191
|
-
export interface BreakpointMeta {
|
|
192
|
-
appId: string,
|
|
193
|
-
vertexId: string,
|
|
194
|
-
logicId: string,
|
|
195
|
-
offset: number,
|
|
196
|
-
status: string,
|
|
197
|
-
target: string,
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export default BreakPoint;
|