roku-debug 0.20.6 → 0.20.7

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 (211) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/CompileErrorProcessor.d.ts +7 -2
  3. package/dist/CompileErrorProcessor.js +64 -69
  4. package/dist/CompileErrorProcessor.js.map +1 -1
  5. package/dist/DeviceInfo.d.ts +1 -0
  6. package/dist/adapters/DebugProtocolAdapter.d.ts +64 -17
  7. package/dist/adapters/DebugProtocolAdapter.js +264 -157
  8. package/dist/adapters/DebugProtocolAdapter.js.map +1 -1
  9. package/dist/adapters/TelnetAdapter.d.ts +8 -3
  10. package/dist/adapters/TelnetAdapter.js +14 -6
  11. package/dist/adapters/TelnetAdapter.js.map +1 -1
  12. package/dist/debugProtocol/Constants.d.ts +171 -81
  13. package/dist/debugProtocol/Constants.js +206 -126
  14. package/dist/debugProtocol/Constants.js.map +1 -1
  15. package/dist/debugProtocol/DebugProtocolClientReplaySession.d.ts +46 -0
  16. package/dist/debugProtocol/DebugProtocolClientReplaySession.js +278 -0
  17. package/dist/debugProtocol/DebugProtocolClientReplaySession.js.map +1 -0
  18. package/dist/debugProtocol/PluginInterface.d.ts +38 -0
  19. package/dist/debugProtocol/PluginInterface.js +86 -0
  20. package/dist/debugProtocol/PluginInterface.js.map +1 -0
  21. package/dist/debugProtocol/ProtocolUtil.d.ts +56 -0
  22. package/dist/debugProtocol/ProtocolUtil.js +164 -0
  23. package/dist/debugProtocol/ProtocolUtil.js.map +1 -0
  24. package/dist/debugProtocol/client/DebugProtocolClient.d.ts +310 -0
  25. package/dist/debugProtocol/client/DebugProtocolClient.js +1079 -0
  26. package/dist/debugProtocol/client/DebugProtocolClient.js.map +1 -0
  27. package/dist/debugProtocol/client/DebugProtocolClientPlugin.d.ts +44 -0
  28. package/dist/debugProtocol/client/DebugProtocolClientPlugin.js +3 -0
  29. package/dist/debugProtocol/client/DebugProtocolClientPlugin.js.map +1 -0
  30. package/dist/debugProtocol/events/ProtocolEvent.d.ts +66 -0
  31. package/dist/debugProtocol/events/ProtocolEvent.js +3 -0
  32. package/dist/debugProtocol/events/ProtocolEvent.js.map +1 -0
  33. package/dist/debugProtocol/events/requests/AddBreakpointsRequest.d.ts +30 -0
  34. package/dist/debugProtocol/events/requests/AddBreakpointsRequest.js +63 -0
  35. package/dist/debugProtocol/events/requests/AddBreakpointsRequest.js.map +1 -0
  36. package/dist/debugProtocol/events/requests/AddConditionalBreakpointsRequest.d.ts +48 -0
  37. package/dist/debugProtocol/events/requests/AddConditionalBreakpointsRequest.js +69 -0
  38. package/dist/debugProtocol/events/requests/AddConditionalBreakpointsRequest.js.map +1 -0
  39. package/dist/debugProtocol/events/requests/ContinueRequest.d.ts +20 -0
  40. package/dist/debugProtocol/events/requests/ContinueRequest.js +40 -0
  41. package/dist/debugProtocol/events/requests/ContinueRequest.js.map +1 -0
  42. package/dist/debugProtocol/events/requests/ExecuteRequest.d.ts +26 -0
  43. package/dist/debugProtocol/events/requests/ExecuteRequest.js +49 -0
  44. package/dist/debugProtocol/events/requests/ExecuteRequest.js.map +1 -0
  45. package/dist/debugProtocol/events/requests/ExitChannelRequest.d.ts +20 -0
  46. package/dist/debugProtocol/events/requests/ExitChannelRequest.js +40 -0
  47. package/dist/debugProtocol/events/requests/ExitChannelRequest.js.map +1 -0
  48. package/dist/debugProtocol/events/requests/HandshakeRequest.d.ts +26 -0
  49. package/dist/debugProtocol/events/requests/HandshakeRequest.js +47 -0
  50. package/dist/debugProtocol/events/requests/HandshakeRequest.js.map +1 -0
  51. package/dist/debugProtocol/events/requests/ListBreakpointsRequest.d.ts +20 -0
  52. package/dist/debugProtocol/events/requests/ListBreakpointsRequest.js +40 -0
  53. package/dist/debugProtocol/events/requests/ListBreakpointsRequest.js.map +1 -0
  54. package/dist/debugProtocol/events/requests/RemoveBreakpointsRequest.d.ts +29 -0
  55. package/dist/debugProtocol/events/requests/RemoveBreakpointsRequest.js +60 -0
  56. package/dist/debugProtocol/events/requests/RemoveBreakpointsRequest.js.map +1 -0
  57. package/dist/debugProtocol/events/requests/StackTraceRequest.d.ts +22 -0
  58. package/dist/debugProtocol/events/requests/StackTraceRequest.js +43 -0
  59. package/dist/debugProtocol/events/requests/StackTraceRequest.js.map +1 -0
  60. package/dist/debugProtocol/events/requests/StepRequest.d.ts +25 -0
  61. package/dist/debugProtocol/events/requests/StepRequest.js +46 -0
  62. package/dist/debugProtocol/events/requests/StepRequest.js.map +1 -0
  63. package/dist/debugProtocol/events/requests/StopRequest.d.ts +20 -0
  64. package/dist/debugProtocol/events/requests/StopRequest.js +39 -0
  65. package/dist/debugProtocol/events/requests/StopRequest.js.map +1 -0
  66. package/dist/debugProtocol/events/requests/ThreadsRequest.d.ts +20 -0
  67. package/dist/debugProtocol/events/requests/ThreadsRequest.js +40 -0
  68. package/dist/debugProtocol/events/requests/ThreadsRequest.js.map +1 -0
  69. package/dist/debugProtocol/events/requests/VariablesRequest.d.ts +59 -0
  70. package/dist/debugProtocol/events/requests/VariablesRequest.js +123 -0
  71. package/dist/debugProtocol/events/requests/VariablesRequest.js.map +1 -0
  72. package/dist/debugProtocol/events/responses/AddBreakpointsResponse.js.map +1 -0
  73. package/dist/debugProtocol/events/responses/AddConditionalBreakpointsResponse.d.ts +3 -0
  74. package/dist/debugProtocol/events/responses/AddConditionalBreakpointsResponse.js +9 -0
  75. package/dist/debugProtocol/events/responses/AddConditionalBreakpointsResponse.js.map +1 -0
  76. package/dist/debugProtocol/events/responses/ExecuteV3Response.d.ts +42 -0
  77. package/dist/debugProtocol/events/responses/ExecuteV3Response.js +94 -0
  78. package/dist/debugProtocol/events/responses/ExecuteV3Response.js.map +1 -0
  79. package/dist/debugProtocol/events/responses/GenericResponse.d.ts +17 -0
  80. package/dist/debugProtocol/events/responses/GenericResponse.js +40 -0
  81. package/dist/debugProtocol/events/responses/GenericResponse.js.map +1 -0
  82. package/dist/debugProtocol/events/responses/GenericV3Response.d.ts +15 -0
  83. package/dist/debugProtocol/events/responses/GenericV3Response.js +38 -0
  84. package/dist/debugProtocol/events/responses/GenericV3Response.js.map +1 -0
  85. package/dist/debugProtocol/events/responses/HandshakeResponse.d.ts +28 -0
  86. package/dist/debugProtocol/events/responses/HandshakeResponse.js +69 -0
  87. package/dist/debugProtocol/events/responses/HandshakeResponse.js.map +1 -0
  88. package/dist/debugProtocol/events/responses/HandshakeV3Response.d.ts +42 -0
  89. package/dist/debugProtocol/events/responses/HandshakeV3Response.js +98 -0
  90. package/dist/debugProtocol/events/responses/HandshakeV3Response.js.map +1 -0
  91. package/dist/debugProtocol/events/responses/ListBreakpointsResponse.d.ts +35 -0
  92. package/dist/debugProtocol/events/responses/ListBreakpointsResponse.js +68 -0
  93. package/dist/debugProtocol/events/responses/ListBreakpointsResponse.js.map +1 -0
  94. package/dist/debugProtocol/events/responses/RemoveBreakpointsResponse.js.map +1 -0
  95. package/dist/debugProtocol/events/responses/StackTraceResponse.d.ts +24 -0
  96. package/dist/debugProtocol/events/responses/StackTraceResponse.js +72 -0
  97. package/dist/debugProtocol/events/responses/StackTraceResponse.js.map +1 -0
  98. package/dist/debugProtocol/events/responses/StackTraceV3Response.d.ts +37 -0
  99. package/dist/debugProtocol/events/responses/StackTraceV3Response.js +67 -0
  100. package/dist/debugProtocol/events/responses/StackTraceV3Response.js.map +1 -0
  101. package/dist/debugProtocol/events/responses/ThreadsResponse.d.ts +54 -0
  102. package/dist/debugProtocol/events/responses/ThreadsResponse.js +80 -0
  103. package/dist/debugProtocol/events/responses/ThreadsResponse.js.map +1 -0
  104. package/dist/debugProtocol/events/responses/VariablesResponse.d.ts +117 -0
  105. package/dist/debugProtocol/events/responses/VariablesResponse.js +335 -0
  106. package/dist/debugProtocol/events/responses/VariablesResponse.js.map +1 -0
  107. package/dist/debugProtocol/events/updates/AllThreadsStoppedUpdate.d.ts +35 -0
  108. package/dist/debugProtocol/events/updates/AllThreadsStoppedUpdate.js +58 -0
  109. package/dist/debugProtocol/events/updates/AllThreadsStoppedUpdate.js.map +1 -0
  110. package/dist/debugProtocol/events/updates/BreakpointErrorUpdate.d.ts +42 -0
  111. package/dist/debugProtocol/events/updates/BreakpointErrorUpdate.js +97 -0
  112. package/dist/debugProtocol/events/updates/BreakpointErrorUpdate.js.map +1 -0
  113. package/dist/debugProtocol/events/updates/BreakpointVerifiedUpdate.d.ts +41 -0
  114. package/dist/debugProtocol/events/updates/BreakpointVerifiedUpdate.js +74 -0
  115. package/dist/debugProtocol/events/updates/BreakpointVerifiedUpdate.js.map +1 -0
  116. package/dist/debugProtocol/events/updates/CompileErrorUpdate.d.ts +60 -0
  117. package/dist/debugProtocol/events/updates/CompileErrorUpdate.js +89 -0
  118. package/dist/debugProtocol/events/updates/CompileErrorUpdate.js.map +1 -0
  119. package/dist/debugProtocol/events/updates/IOPortOpenedUpdate.d.ts +23 -0
  120. package/dist/debugProtocol/events/updates/IOPortOpenedUpdate.js +49 -0
  121. package/dist/debugProtocol/events/updates/IOPortOpenedUpdate.js.map +1 -0
  122. package/dist/debugProtocol/events/updates/ThreadAttachedUpdate.d.ts +26 -0
  123. package/dist/debugProtocol/events/updates/ThreadAttachedUpdate.js +50 -0
  124. package/dist/debugProtocol/events/updates/ThreadAttachedUpdate.js.map +1 -0
  125. package/dist/debugProtocol/server/DebugProtocolServer.d.ts +110 -0
  126. package/dist/debugProtocol/server/DebugProtocolServer.js +306 -0
  127. package/dist/debugProtocol/server/DebugProtocolServer.js.map +1 -0
  128. package/dist/debugProtocol/server/DebugProtocolServerPlugin.d.ts +41 -0
  129. package/dist/debugProtocol/server/DebugProtocolServerPlugin.js +3 -0
  130. package/dist/debugProtocol/server/DebugProtocolServerPlugin.js.map +1 -0
  131. package/dist/debugSession/BrightScriptDebugSession.d.ts +9 -1
  132. package/dist/debugSession/BrightScriptDebugSession.js +178 -89
  133. package/dist/debugSession/BrightScriptDebugSession.js.map +1 -1
  134. package/dist/index.d.ts +2 -3
  135. package/dist/index.js +2 -3
  136. package/dist/index.js.map +1 -1
  137. package/dist/logging.d.ts +1 -0
  138. package/dist/logging.js +4 -2
  139. package/dist/logging.js.map +1 -1
  140. package/dist/managers/ActionQueue.d.ts +7 -1
  141. package/dist/managers/ActionQueue.js +27 -5
  142. package/dist/managers/ActionQueue.js.map +1 -1
  143. package/dist/managers/BreakpointManager.d.ts +82 -27
  144. package/dist/managers/BreakpointManager.js +168 -63
  145. package/dist/managers/BreakpointManager.js.map +1 -1
  146. package/dist/managers/ProjectManager.d.ts +3 -0
  147. package/dist/managers/ProjectManager.js +42 -36
  148. package/dist/managers/ProjectManager.js.map +1 -1
  149. package/dist/util.d.ts +8 -6
  150. package/dist/util.js +36 -19
  151. package/dist/util.js.map +1 -1
  152. package/package.json +14 -5
  153. package/roku-debug-0.20.7.tgz +0 -0
  154. package/dist/debugProtocol/Debugger.d.ts +0 -161
  155. package/dist/debugProtocol/Debugger.js +0 -635
  156. package/dist/debugProtocol/Debugger.js.map +0 -1
  157. package/dist/debugProtocol/responses/AddBreakpointsResponse.js.map +0 -1
  158. package/dist/debugProtocol/responses/BreakpointErrorUpdateResponse.d.ts +0 -32
  159. package/dist/debugProtocol/responses/BreakpointErrorUpdateResponse.js +0 -67
  160. package/dist/debugProtocol/responses/BreakpointErrorUpdateResponse.js.map +0 -1
  161. package/dist/debugProtocol/responses/BreakpointVerifiedUpdateResponse.d.ts +0 -32
  162. package/dist/debugProtocol/responses/BreakpointVerifiedUpdateResponse.js +0 -56
  163. package/dist/debugProtocol/responses/BreakpointVerifiedUpdateResponse.js.map +0 -1
  164. package/dist/debugProtocol/responses/ConnectIOPortResponse.d.ts +0 -10
  165. package/dist/debugProtocol/responses/ConnectIOPortResponse.js +0 -39
  166. package/dist/debugProtocol/responses/ConnectIOPortResponse.js.map +0 -1
  167. package/dist/debugProtocol/responses/ExecuteResponseV3.d.ts +0 -23
  168. package/dist/debugProtocol/responses/ExecuteResponseV3.js +0 -54
  169. package/dist/debugProtocol/responses/ExecuteResponseV3.js.map +0 -1
  170. package/dist/debugProtocol/responses/HandshakeResponse.d.ts +0 -12
  171. package/dist/debugProtocol/responses/HandshakeResponse.js +0 -39
  172. package/dist/debugProtocol/responses/HandshakeResponse.js.map +0 -1
  173. package/dist/debugProtocol/responses/HandshakeResponseV3.d.ts +0 -14
  174. package/dist/debugProtocol/responses/HandshakeResponseV3.js +0 -47
  175. package/dist/debugProtocol/responses/HandshakeResponseV3.js.map +0 -1
  176. package/dist/debugProtocol/responses/ListBreakpointsResponse.d.ts +0 -25
  177. package/dist/debugProtocol/responses/ListBreakpointsResponse.js +0 -65
  178. package/dist/debugProtocol/responses/ListBreakpointsResponse.js.map +0 -1
  179. package/dist/debugProtocol/responses/ProtocolEvent.d.ts +0 -11
  180. package/dist/debugProtocol/responses/ProtocolEvent.js +0 -38
  181. package/dist/debugProtocol/responses/ProtocolEvent.js.map +0 -1
  182. package/dist/debugProtocol/responses/ProtocolEventV3.d.ts +0 -11
  183. package/dist/debugProtocol/responses/ProtocolEventV3.js +0 -42
  184. package/dist/debugProtocol/responses/ProtocolEventV3.js.map +0 -1
  185. package/dist/debugProtocol/responses/RemoveBreakpointsResponse.js.map +0 -1
  186. package/dist/debugProtocol/responses/StackTraceResponse.d.ts +0 -18
  187. package/dist/debugProtocol/responses/StackTraceResponse.js +0 -58
  188. package/dist/debugProtocol/responses/StackTraceResponse.js.map +0 -1
  189. package/dist/debugProtocol/responses/StackTraceResponseV3.d.ts +0 -18
  190. package/dist/debugProtocol/responses/StackTraceResponseV3.js +0 -58
  191. package/dist/debugProtocol/responses/StackTraceResponseV3.js.map +0 -1
  192. package/dist/debugProtocol/responses/ThreadsResponse.d.ts +0 -22
  193. package/dist/debugProtocol/responses/ThreadsResponse.js +0 -63
  194. package/dist/debugProtocol/responses/ThreadsResponse.js.map +0 -1
  195. package/dist/debugProtocol/responses/UndefinedResponse.d.ts +0 -10
  196. package/dist/debugProtocol/responses/UndefinedResponse.js +0 -39
  197. package/dist/debugProtocol/responses/UndefinedResponse.js.map +0 -1
  198. package/dist/debugProtocol/responses/UpdateThreadsResponse.d.ts +0 -25
  199. package/dist/debugProtocol/responses/UpdateThreadsResponse.js +0 -91
  200. package/dist/debugProtocol/responses/UpdateThreadsResponse.js.map +0 -1
  201. package/dist/debugProtocol/responses/VariableResponse.d.ts +0 -27
  202. package/dist/debugProtocol/responses/VariableResponse.js +0 -141
  203. package/dist/debugProtocol/responses/VariableResponse.js.map +0 -1
  204. package/dist/debugProtocol/responses/index.d.ts +0 -11
  205. package/dist/debugProtocol/responses/index.js +0 -24
  206. package/dist/debugProtocol/responses/index.js.map +0 -1
  207. package/roku-debug-0.20.6.tgz +0 -0
  208. /package/dist/debugProtocol/{responses → events/responses}/AddBreakpointsResponse.d.ts +0 -0
  209. /package/dist/debugProtocol/{responses → events/responses}/AddBreakpointsResponse.js +0 -0
  210. /package/dist/debugProtocol/{responses → events/responses}/RemoveBreakpointsResponse.d.ts +0 -0
  211. /package/dist/debugProtocol/{responses → events/responses}/RemoveBreakpointsResponse.js +0 -0
@@ -0,0 +1,117 @@
1
+ /// <reference types="node" />
2
+ import type { ProtocolResponse, ProtocolResponseData, ProtocolResponseErrorData } from '../ProtocolEvent';
3
+ export declare class VariablesResponse implements ProtocolResponse {
4
+ static fromJson(data: {
5
+ requestId: number;
6
+ variables: Variable[];
7
+ errorData?: ProtocolResponseErrorData;
8
+ }): VariablesResponse;
9
+ static fromBuffer(buffer: Buffer): VariablesResponse;
10
+ private readVariable;
11
+ private readVariableValue;
12
+ private flattenVariables;
13
+ toBuffer(): Buffer;
14
+ private writeVariable;
15
+ private writeVariableValue;
16
+ success: boolean;
17
+ readOffset: number;
18
+ data: VariablesResponseData;
19
+ }
20
+ export interface VariablesResponseData extends ProtocolResponseData {
21
+ variables: Variable[];
22
+ }
23
+ export declare enum VariableFlags {
24
+ /**
25
+ * value is a child of the requested variable
26
+ * e.g., an element of an array or field of an AA
27
+ */
28
+ isChildKey = 1,
29
+ /**
30
+ * value is constant
31
+ */
32
+ isConst = 2,
33
+ /**
34
+ * The referenced value is a container (e.g., a list or array)
35
+ */
36
+ isContainer = 4,
37
+ /**
38
+ * The name is included in this VariableInfo
39
+ */
40
+ isNameHere = 8,
41
+ /**
42
+ * value is reference-counted.
43
+ */
44
+ isRefCounted = 16,
45
+ /**
46
+ * value is included in this VariableInfo
47
+ */
48
+ isValueHere = 32,
49
+ /**
50
+ * Value is container, key lookup is case sensitive
51
+ * @since protocol 3.1.0
52
+ */
53
+ isKeysCaseSensitive = 64
54
+ }
55
+ /**
56
+ * Every type of variable supported by the protocol
57
+ */
58
+ export declare enum VariableType {
59
+ AssociativeArray = "AssociativeArray",
60
+ Array = "Array",
61
+ Boolean = "Boolean",
62
+ Double = "Double",
63
+ Float = "Float",
64
+ Function = "Function",
65
+ Integer = "Integer",
66
+ Interface = "Interface",
67
+ Invalid = "Invalid",
68
+ List = "List",
69
+ LongInteger = "LongInteger",
70
+ Object = "Object",
71
+ String = "String",
72
+ Subroutine = "Subroutine",
73
+ SubtypedObject = "SubtypedObject",
74
+ Uninitialized = "Uninitialized",
75
+ Unknown = "Unknown"
76
+ }
77
+ export interface Variable {
78
+ /**
79
+ * 0 means this var isn't refCounted, and thus `refCount` will be omitted from reading and writing to buffer
80
+ */
81
+ refCount: number;
82
+ /**
83
+ * I think this means "is this mutatable". Like an object would be isConst=false, but "some string" can only be replaced by a totally new string? But don't quote me on this
84
+ */
85
+ isConst: boolean;
86
+ /**
87
+ * A type-dependent value based on the `variableType` field. It is not present for all types
88
+ */
89
+ value: string | number | bigint | boolean | null;
90
+ /**
91
+ * The type of variable or value.
92
+ */
93
+ type: VariableType;
94
+ /**
95
+ * The variable name. `undefined` means there was no variable name available
96
+ */
97
+ name?: string;
98
+ /**
99
+ * If this variable is a container, what variable type are its keys? (integer for array, string for AA, etc...).
100
+ * TODO can we get roku to narrow this a bit?
101
+ */
102
+ keyType?: VariableType;
103
+ /**
104
+ * Is this variable a container var (i.e. an array or object with children)
105
+ */
106
+ isContainer: boolean;
107
+ /**
108
+ * If the variable is a container, it will have child elements. this is the number of those children. If `.children` is set, this field will be set to undefined
109
+ * (meaning it will be ignored during serialization)
110
+ */
111
+ childCount?: number;
112
+ /**
113
+ * The full list of children for this variable. The entire Variable response may not be more than 2 total levels deep.
114
+ * (i.e. `parent` -> `children[]`). Children may not have additional children, those would need to be resolve using subsequent `variables` requests.
115
+ */
116
+ children?: Variable[];
117
+ }
@@ -0,0 +1,335 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VariableType = exports.VariableFlags = exports.VariablesResponse = void 0;
4
+ /* eslint-disable no-bitwise */
5
+ const smart_buffer_1 = require("smart-buffer");
6
+ const util_1 = require("../../../util");
7
+ const Constants_1 = require("../../Constants");
8
+ const ProtocolUtil_1 = require("../../ProtocolUtil");
9
+ class VariablesResponse {
10
+ constructor() {
11
+ this.success = false;
12
+ this.readOffset = 0;
13
+ this.data = {
14
+ packetLength: undefined,
15
+ errorCode: Constants_1.ErrorCode.OK
16
+ };
17
+ }
18
+ static fromJson(data) {
19
+ var _a;
20
+ var _b;
21
+ const response = new VariablesResponse();
22
+ ProtocolUtil_1.protocolUtil.loadJson(response, data);
23
+ (_a = (_b = response.data).variables) !== null && _a !== void 0 ? _a : (_b.variables = []);
24
+ //validate that any object marked as `isContainer` either has an array of children or has an element count
25
+ for (const variable of response.flattenVariables(response.data.variables)) {
26
+ const hasChildrenArray = Array.isArray(variable.children);
27
+ if (variable.childCount > 0 || hasChildrenArray) {
28
+ variable.isContainer = true;
29
+ }
30
+ if (hasChildrenArray) {
31
+ delete variable.childCount;
32
+ }
33
+ if (util_1.util.isNullish(variable.isContainer)) {
34
+ variable.isContainer = [VariableType.AssociativeArray, VariableType.Array, VariableType.List, VariableType.Object, VariableType.SubtypedObject].includes(variable.type);
35
+ }
36
+ if (variable.isContainer && util_1.util.isNullish(variable.childCount) && !hasChildrenArray) {
37
+ throw new Error('Container variable must have one of these properties defined: childCount, children');
38
+ }
39
+ }
40
+ return response;
41
+ }
42
+ static fromBuffer(buffer) {
43
+ const response = new VariablesResponse();
44
+ ProtocolUtil_1.protocolUtil.bufferLoaderHelper(response, buffer, 12, (smartBuffer) => {
45
+ ProtocolUtil_1.protocolUtil.loadCommonResponseFields(response, smartBuffer);
46
+ const numVariables = smartBuffer.readUInt32LE(); // num_variables
47
+ const variables = [];
48
+ let latestContainer;
49
+ let variableCount = 0;
50
+ // build the list of BreakpointInfo
51
+ for (let i = 0; i < numVariables; i++) {
52
+ const variable = response.readVariable(smartBuffer);
53
+ variableCount++;
54
+ if (variable.isChildKey === false) {
55
+ latestContainer = variable;
56
+ delete variable.childCount;
57
+ latestContainer.children = [];
58
+ variables.push(variable);
59
+ }
60
+ else if (latestContainer) {
61
+ latestContainer.children.push(variable);
62
+ }
63
+ else {
64
+ variables.push(variable);
65
+ }
66
+ delete variable.isChildKey;
67
+ }
68
+ response.data.variables = variables;
69
+ return variableCount === numVariables;
70
+ });
71
+ return response;
72
+ }
73
+ readVariable(smartBuffer) {
74
+ if (smartBuffer.length < 13) {
75
+ throw new Error('Not enough bytes to create a variable');
76
+ }
77
+ const variable = {};
78
+ const flags = smartBuffer.readUInt8();
79
+ // Determine the different variable properties
80
+ variable.isChildKey = (flags & VariableFlags.isChildKey) > 0;
81
+ variable.isConst = (flags & VariableFlags.isConst) > 0;
82
+ variable.isContainer = (flags & VariableFlags.isContainer) > 0;
83
+ const isNameHere = (flags & VariableFlags.isNameHere) > 0;
84
+ const isRefCounted = (flags & VariableFlags.isRefCounted) > 0;
85
+ const isValueHere = (flags & VariableFlags.isValueHere) > 0;
86
+ const variableTypeCode = smartBuffer.readUInt8();
87
+ variable.type = VariableTypeCode[variableTypeCode]; // variable_type
88
+ if (isNameHere) {
89
+ // we have a name. Pull it out of the buffer.
90
+ variable.name = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); //name
91
+ }
92
+ if (isRefCounted) {
93
+ // This variables reference counts are tracked and we can pull it from the buffer.
94
+ variable.refCount = smartBuffer.readUInt32LE();
95
+ }
96
+ else {
97
+ variable.refCount = 0;
98
+ }
99
+ if (variable.isContainer) {
100
+ // It is a form of container object.
101
+ // Are the key strings or integers for example
102
+ variable.keyType = VariableTypeCode[smartBuffer.readUInt8()];
103
+ // Equivalent to length on arrays
104
+ variable.childCount = smartBuffer.readUInt32LE();
105
+ }
106
+ if (isValueHere) {
107
+ // Pull out the variable data based on the type if that type returns a value
108
+ variable.value = this.readVariableValue(variable.type, smartBuffer);
109
+ }
110
+ return variable;
111
+ }
112
+ readVariableValue(variableType, smartBuffer) {
113
+ switch (variableType) {
114
+ case VariableType.Interface:
115
+ case VariableType.Object:
116
+ case VariableType.String:
117
+ case VariableType.Subroutine:
118
+ case VariableType.Function:
119
+ return ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer);
120
+ case VariableType.SubtypedObject:
121
+ let names = [];
122
+ for (let i = 0; i < 2; i++) {
123
+ names.push(ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer));
124
+ }
125
+ return names.join('; ');
126
+ case VariableType.Boolean:
127
+ return smartBuffer.readUInt8() > 0;
128
+ case VariableType.Integer:
129
+ return smartBuffer.readInt32LE();
130
+ case VariableType.LongInteger:
131
+ return smartBuffer.readBigInt64LE();
132
+ case VariableType.Float:
133
+ return smartBuffer.readFloatLE();
134
+ case VariableType.Double:
135
+ return smartBuffer.readDoubleLE();
136
+ case VariableType.Uninitialized:
137
+ case VariableType.Unknown:
138
+ case VariableType.Invalid:
139
+ case VariableType.AssociativeArray:
140
+ case VariableType.Array:
141
+ case VariableType.List:
142
+ return null;
143
+ default:
144
+ throw new Error('Unable to determine the variable value');
145
+ }
146
+ }
147
+ flattenVariables(variables) {
148
+ var _a;
149
+ //flatten the variables
150
+ const result = [];
151
+ for (let rootVariable of variables !== null && variables !== void 0 ? variables : []) {
152
+ result.push(rootVariable);
153
+ //add all child variables to the array
154
+ for (const child of (_a = rootVariable.children) !== null && _a !== void 0 ? _a : []) {
155
+ result.push(child);
156
+ }
157
+ }
158
+ //catch duplicates and circular references
159
+ for (let i = 0; i < result.length; i++) {
160
+ const idx = result.indexOf(result[i], i + 1);
161
+ if (idx > -1) {
162
+ throw new Error(`The variable at index ${idx} already exists at index ${i}. You have a circular reference in your variables that needs to be resolved`);
163
+ }
164
+ }
165
+ return result;
166
+ }
167
+ toBuffer() {
168
+ const smartBuffer = new smart_buffer_1.SmartBuffer();
169
+ const variables = this.flattenVariables(this.data.variables);
170
+ smartBuffer.writeUInt32LE(variables.length); // num_variables
171
+ for (const variable of variables) {
172
+ this.writeVariable(variable, smartBuffer);
173
+ }
174
+ ProtocolUtil_1.protocolUtil.insertCommonResponseFields(this, smartBuffer);
175
+ return smartBuffer.toBuffer();
176
+ }
177
+ writeVariable(variable, smartBuffer) {
178
+ var _a, _b;
179
+ let flags = 0;
180
+ //variables that have children are NOT child keys themselves
181
+ flags |= Array.isArray(variable.children) ? 0 : VariableFlags.isChildKey;
182
+ flags |= variable.isConst ? VariableFlags.isConst : 0;
183
+ flags |= variable.isContainer ? VariableFlags.isContainer : 0;
184
+ const isNameHere = !util_1.util.isNullish(variable.name);
185
+ flags |= isNameHere ? VariableFlags.isNameHere : 0;
186
+ const isRefCounted = variable.refCount > 0;
187
+ flags |= isRefCounted ? VariableFlags.isRefCounted : 0;
188
+ const isValueHere = !util_1.util.isNullish(variable.value);
189
+ flags |= isValueHere ? VariableFlags.isValueHere : 0;
190
+ smartBuffer.writeUInt8(flags); //flags
191
+ smartBuffer.writeUInt8(VariableTypeCode[variable.type]); // variable_type
192
+ if (isNameHere) {
193
+ smartBuffer.writeStringNT(variable.name); //name
194
+ }
195
+ if (isRefCounted) {
196
+ smartBuffer.writeUInt32LE(variable.refCount); //ref_count
197
+ }
198
+ if (variable.isContainer) {
199
+ smartBuffer.writeUInt8(VariableTypeCode[variable.keyType]); // key_type
200
+ // Equivalent to .length on arrays
201
+ smartBuffer.writeUInt32LE((_b = (_a = variable.children) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : variable.childCount); // element_count
202
+ }
203
+ if (isValueHere) {
204
+ // write the variable data based on the type
205
+ this.writeVariableValue(variable.type, variable.value, smartBuffer);
206
+ }
207
+ return variable;
208
+ }
209
+ writeVariableValue(variableType, value, smartBuffer) {
210
+ var _a;
211
+ switch (variableType) {
212
+ case VariableType.Interface:
213
+ case VariableType.Object:
214
+ case VariableType.String:
215
+ case VariableType.Subroutine:
216
+ case VariableType.Function:
217
+ smartBuffer.writeStringNT(value);
218
+ break;
219
+ case VariableType.SubtypedObject:
220
+ const names = ((_a = value) !== null && _a !== void 0 ? _a : '').split('; ');
221
+ if (names.length !== 2) {
222
+ throw new Error('Expected two names for subtyped object');
223
+ }
224
+ for (const name of names) {
225
+ smartBuffer.writeStringNT(name);
226
+ }
227
+ break;
228
+ case VariableType.Boolean:
229
+ smartBuffer.writeUInt8(value === true ? 1 : 0);
230
+ break;
231
+ case VariableType.Integer:
232
+ smartBuffer.writeInt32LE(value);
233
+ break;
234
+ case VariableType.LongInteger:
235
+ smartBuffer.writeBigInt64LE(typeof value === 'bigint' ? value : BigInt(value));
236
+ break;
237
+ case VariableType.Float:
238
+ smartBuffer.writeFloatLE(value);
239
+ break;
240
+ case VariableType.Double:
241
+ smartBuffer.writeDoubleLE(value);
242
+ break;
243
+ case VariableType.Uninitialized:
244
+ case VariableType.Unknown:
245
+ case VariableType.Invalid:
246
+ case VariableType.AssociativeArray:
247
+ case VariableType.Array:
248
+ case VariableType.List:
249
+ break;
250
+ default:
251
+ throw new Error('Unable to determine the variable value');
252
+ }
253
+ }
254
+ }
255
+ exports.VariablesResponse = VariablesResponse;
256
+ var VariableFlags;
257
+ (function (VariableFlags) {
258
+ /**
259
+ * value is a child of the requested variable
260
+ * e.g., an element of an array or field of an AA
261
+ */
262
+ VariableFlags[VariableFlags["isChildKey"] = 1] = "isChildKey";
263
+ /**
264
+ * value is constant
265
+ */
266
+ VariableFlags[VariableFlags["isConst"] = 2] = "isConst";
267
+ /**
268
+ * The referenced value is a container (e.g., a list or array)
269
+ */
270
+ VariableFlags[VariableFlags["isContainer"] = 4] = "isContainer";
271
+ /**
272
+ * The name is included in this VariableInfo
273
+ */
274
+ VariableFlags[VariableFlags["isNameHere"] = 8] = "isNameHere";
275
+ /**
276
+ * value is reference-counted.
277
+ */
278
+ VariableFlags[VariableFlags["isRefCounted"] = 16] = "isRefCounted";
279
+ /**
280
+ * value is included in this VariableInfo
281
+ */
282
+ VariableFlags[VariableFlags["isValueHere"] = 32] = "isValueHere";
283
+ /**
284
+ * Value is container, key lookup is case sensitive
285
+ * @since protocol 3.1.0
286
+ */
287
+ VariableFlags[VariableFlags["isKeysCaseSensitive"] = 64] = "isKeysCaseSensitive";
288
+ })(VariableFlags = exports.VariableFlags || (exports.VariableFlags = {}));
289
+ /**
290
+ * Every type of variable supported by the protocol
291
+ */
292
+ var VariableType;
293
+ (function (VariableType) {
294
+ VariableType["AssociativeArray"] = "AssociativeArray";
295
+ VariableType["Array"] = "Array";
296
+ VariableType["Boolean"] = "Boolean";
297
+ VariableType["Double"] = "Double";
298
+ VariableType["Float"] = "Float";
299
+ VariableType["Function"] = "Function";
300
+ VariableType["Integer"] = "Integer";
301
+ VariableType["Interface"] = "Interface";
302
+ VariableType["Invalid"] = "Invalid";
303
+ VariableType["List"] = "List";
304
+ VariableType["LongInteger"] = "LongInteger";
305
+ VariableType["Object"] = "Object";
306
+ VariableType["String"] = "String";
307
+ VariableType["Subroutine"] = "Subroutine";
308
+ VariableType["SubtypedObject"] = "SubtypedObject";
309
+ VariableType["Uninitialized"] = "Uninitialized";
310
+ VariableType["Unknown"] = "Unknown";
311
+ })(VariableType = exports.VariableType || (exports.VariableType = {}));
312
+ /**
313
+ * An enum used to convert VariableType strings to their protocol integer value
314
+ */
315
+ var VariableTypeCode;
316
+ (function (VariableTypeCode) {
317
+ VariableTypeCode[VariableTypeCode["AssociativeArray"] = 1] = "AssociativeArray";
318
+ VariableTypeCode[VariableTypeCode["Array"] = 2] = "Array";
319
+ VariableTypeCode[VariableTypeCode["Boolean"] = 3] = "Boolean";
320
+ VariableTypeCode[VariableTypeCode["Double"] = 4] = "Double";
321
+ VariableTypeCode[VariableTypeCode["Float"] = 5] = "Float";
322
+ VariableTypeCode[VariableTypeCode["Function"] = 6] = "Function";
323
+ VariableTypeCode[VariableTypeCode["Integer"] = 7] = "Integer";
324
+ VariableTypeCode[VariableTypeCode["Interface"] = 8] = "Interface";
325
+ VariableTypeCode[VariableTypeCode["Invalid"] = 9] = "Invalid";
326
+ VariableTypeCode[VariableTypeCode["List"] = 10] = "List";
327
+ VariableTypeCode[VariableTypeCode["LongInteger"] = 11] = "LongInteger";
328
+ VariableTypeCode[VariableTypeCode["Object"] = 12] = "Object";
329
+ VariableTypeCode[VariableTypeCode["String"] = 13] = "String";
330
+ VariableTypeCode[VariableTypeCode["Subroutine"] = 14] = "Subroutine";
331
+ VariableTypeCode[VariableTypeCode["SubtypedObject"] = 15] = "SubtypedObject";
332
+ VariableTypeCode[VariableTypeCode["Uninitialized"] = 16] = "Uninitialized";
333
+ VariableTypeCode[VariableTypeCode["Unknown"] = 17] = "Unknown";
334
+ })(VariableTypeCode || (VariableTypeCode = {}));
335
+ //# sourceMappingURL=VariablesResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VariablesResponse.js","sourceRoot":"","sources":["../../../../src/debugProtocol/events/responses/VariablesResponse.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,+CAA2C;AAC3C,wCAAqC;AACrC,+CAA4C;AAC5C,qDAAkD;AAGlD,MAAa,iBAAiB;IAA9B;QAwQW,YAAO,GAAG,KAAK,CAAC;QAEhB,eAAU,GAAG,CAAC,CAAC;QAEf,SAAI,GAAG;YACV,YAAY,EAAE,SAAmB;YACjC,SAAS,EAAE,qBAAS,CAAC,EAAE;SACD,CAAC;IAC/B,CAAC;IA9QU,MAAM,CAAC,QAAQ,CAAC,IAItB;;;QACG,MAAM,QAAQ,GAAG,IAAI,iBAAiB,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AAA;IACf;;OAEG;IACH,6DAAc,CAAA;IACd;;OAEG;IACH,kEAAiB,CAAA;IACjB;;OAEG;IACH,gEAAgB,CAAA;IAChB;;;OAGG;IACH,gFAAwB,CAAA;AAC5B,CAAC,EA/BW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QA+BxB;AAED;;GAEG;AACH,IAAY,YAkBX;AAlBD,WAAY,YAAY;IACpB,qDAAqC,CAAA;IACrC,+BAAe,CAAA;IACf,mCAAmB,CAAA;IACnB,iCAAiB,CAAA;IACjB,+BAAe,CAAA;IACf,qCAAqB,CAAA;IACrB,mCAAmB,CAAA;IACnB,uCAAuB,CAAA;IACvB,mCAAmB,CAAA;IACnB,6BAAa,CAAA;IACb,2CAA2B,CAAA;IAC3B,iCAAiB,CAAA;IACjB,iCAAiB,CAAA;IACjB,yCAAyB,CAAA;IACzB,iDAAiC,CAAA;IACjC,+CAA+B,CAAA;IAC/B,mCAAmB,CAAA;AACvB,CAAC,EAlBW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAkBvB;AAED;;GAEG;AACH,IAAK,gBAkBJ;AAlBD,WAAK,gBAAgB;IACjB,+EAAoB,CAAA;IACpB,yDAAS,CAAA;IACT,6DAAW,CAAA;IACX,2DAAU,CAAA;IACV,yDAAS,CAAA;IACT,+DAAY,CAAA;IACZ,6DAAW,CAAA;IACX,iEAAa,CAAA;IACb,6DAAW,CAAA;IACX,wDAAS,CAAA;IACT,sEAAgB,CAAA;IAChB,4DAAW,CAAA;IACX,4DAAW,CAAA;IACX,oEAAe,CAAA;IACf,4EAAmB,CAAA;IACnB,0EAAkB,CAAA;IAClB,8DAAY,CAAA;AAChB,CAAC,EAlBI,gBAAgB,KAAhB,gBAAgB,QAkBpB"}
@@ -0,0 +1,35 @@
1
+ /// <reference types="node" />
2
+ import type { StopReason } from '../../Constants';
3
+ import { ErrorCode, UpdateType } from '../../Constants';
4
+ import type { ProtocolUpdate } from '../ProtocolEvent';
5
+ /**
6
+ * All threads are stopped and an ALL_THREADS_STOPPED message is sent to the debugging client.
7
+ *
8
+ * The data field includes information on why the threads were stopped.
9
+ */
10
+ export declare class AllThreadsStoppedUpdate implements ProtocolUpdate {
11
+ static fromJson(data: {
12
+ threadIndex: number;
13
+ stopReason: StopReason;
14
+ stopReasonDetail: string;
15
+ }): AllThreadsStoppedUpdate;
16
+ static fromBuffer(buffer: Buffer): AllThreadsStoppedUpdate;
17
+ toBuffer(): Buffer;
18
+ success: boolean;
19
+ /**
20
+ * How many bytes were read by the `fromBuffer` method. Only populated when constructed by `fromBuffer`
21
+ */
22
+ readOffset: number;
23
+ data: {
24
+ /**
25
+ * The index of the primary thread that triggered the stop
26
+ */
27
+ threadIndex: number;
28
+ stopReason: StopReason;
29
+ stopReasonDetail: string;
30
+ packetLength: number;
31
+ requestId: number;
32
+ errorCode: ErrorCode;
33
+ updateType: UpdateType;
34
+ };
35
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AllThreadsStoppedUpdate = void 0;
4
+ const smart_buffer_1 = require("smart-buffer");
5
+ const Constants_1 = require("../../Constants");
6
+ const ProtocolUtil_1 = require("../../ProtocolUtil");
7
+ /**
8
+ * All threads are stopped and an ALL_THREADS_STOPPED message is sent to the debugging client.
9
+ *
10
+ * The data field includes information on why the threads were stopped.
11
+ */
12
+ class AllThreadsStoppedUpdate {
13
+ constructor() {
14
+ this.success = false;
15
+ /**
16
+ * How many bytes were read by the `fromBuffer` method. Only populated when constructed by `fromBuffer`
17
+ */
18
+ this.readOffset = undefined;
19
+ this.data = {
20
+ /**
21
+ * The index of the primary thread that triggered the stop
22
+ */
23
+ threadIndex: undefined,
24
+ stopReason: undefined,
25
+ stopReasonDetail: undefined,
26
+ //common props
27
+ packetLength: undefined,
28
+ requestId: 0,
29
+ errorCode: Constants_1.ErrorCode.OK,
30
+ updateType: Constants_1.UpdateType.AllThreadsStopped
31
+ };
32
+ }
33
+ static fromJson(data) {
34
+ const update = new AllThreadsStoppedUpdate();
35
+ ProtocolUtil_1.protocolUtil.loadJson(update, data);
36
+ return update;
37
+ }
38
+ static fromBuffer(buffer) {
39
+ const update = new AllThreadsStoppedUpdate();
40
+ ProtocolUtil_1.protocolUtil.bufferLoaderHelper(update, buffer, 16, (smartBuffer) => {
41
+ ProtocolUtil_1.protocolUtil.loadCommonUpdateFields(update, smartBuffer, update.data.updateType);
42
+ update.data.threadIndex = smartBuffer.readInt32LE();
43
+ update.data.stopReason = Constants_1.StopReasonCode[smartBuffer.readUInt8()];
44
+ update.data.stopReasonDetail = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer);
45
+ });
46
+ return update;
47
+ }
48
+ toBuffer() {
49
+ let smartBuffer = new smart_buffer_1.SmartBuffer();
50
+ smartBuffer.writeInt32LE(this.data.threadIndex); // primary_thread_index
51
+ smartBuffer.writeUInt8(Constants_1.StopReasonCode[this.data.stopReason]); // stop_reason
52
+ smartBuffer.writeStringNT(this.data.stopReasonDetail); //stop_reason_detail
53
+ ProtocolUtil_1.protocolUtil.insertCommonUpdateFields(this, smartBuffer);
54
+ return smartBuffer.toBuffer();
55
+ }
56
+ }
57
+ exports.AllThreadsStoppedUpdate = AllThreadsStoppedUpdate;
58
+ //# sourceMappingURL=AllThreadsStoppedUpdate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AllThreadsStoppedUpdate.js","sourceRoot":"","sources":["../../../../src/debugProtocol/events/updates/AllThreadsStoppedUpdate.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,+CAAwE;AACxE,qDAAkD;AAGlD;;;;GAIG;AACH,MAAa,uBAAuB;IAApC;QAmCW,YAAO,GAAG,KAAK,CAAC;QACvB;;WAEG;QACI,eAAU,GAAW,SAAS,CAAC;QAE/B,SAAI,GAAG;YACV;;eAEG;YACH,WAAW,EAAE,SAAmB;YAChC,UAAU,EAAE,SAAuB;YACnC,gBAAgB,EAAE,SAAmB;YAErC,cAAc;YACd,YAAY,EAA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,CAAC,CAAC,CAAC,oBAAoB;QAE3E,2BAAY,CAAC,wBAAwB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACzD,OAAO,WAAW,CAAC,QAAQ,EAAE,CAAC;IAClC,CAAC;CAsBJ;AAvDD,0DAuDC"}
@@ -0,0 +1,42 @@
1
+ /// <reference types="node" />
2
+ import { ErrorCode, UpdateType } from '../../Constants';
3
+ /**
4
+ * Data sent as the data segment of message type: BREAKPOINT_ERROR
5
+ ```
6
+ struct BreakpointErrorUpdateData {
7
+ uint32 flags; // Always 0, reserved for future use
8
+ uint32 breakpoint_id;
9
+ uint32 num_compile_errors;
10
+ utf8z[num_compile_errors] compile_errors;
11
+ uint32 num_runtime_errors;
12
+ utf8z[num_runtime_errors] runtime_errors;
13
+ uint32 num_other_errors; // E.g., permissions errors
14
+ utf8z[num_other_errors] other_errors;
15
+ }
16
+ ```
17
+ */
18
+ export declare class BreakpointErrorUpdate {
19
+ static fromJson(data: {
20
+ breakpointId: number;
21
+ compileErrors: string[];
22
+ runtimeErrors: string[];
23
+ otherErrors: string[];
24
+ }): BreakpointErrorUpdate;
25
+ static fromBuffer(buffer: Buffer): BreakpointErrorUpdate;
26
+ toBuffer(): Buffer;
27
+ success: boolean;
28
+ /**
29
+ * How many bytes were read by the `fromBuffer` method. Only populated when constructed by `fromBuffer`
30
+ */
31
+ readOffset: number;
32
+ data: {
33
+ breakpointId: number;
34
+ compileErrors: string[];
35
+ runtimeErrors: string[];
36
+ otherErrors: string[];
37
+ packetLength: number;
38
+ requestId: number;
39
+ errorCode: ErrorCode;
40
+ updateType: UpdateType;
41
+ };
42
+ }