bdy 1.12.8-beta → 1.12.8-dev-pipeline-run

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 (156) hide show
  1. package/distTs/package.json +1 -1
  2. package/package.json +1 -1
  3. package/distTs/bin/cli.js +0 -5
  4. package/distTs/src/agent/agent.js +0 -328
  5. package/distTs/src/agent/linux.js +0 -124
  6. package/distTs/src/agent/manager.js +0 -519
  7. package/distTs/src/agent/osx.js +0 -146
  8. package/distTs/src/agent/socket/client.js +0 -178
  9. package/distTs/src/agent/socket/tunnel.js +0 -237
  10. package/distTs/src/agent/socket.js +0 -242
  11. package/distTs/src/agent/system.js +0 -179
  12. package/distTs/src/agent/wait.js +0 -23
  13. package/distTs/src/agent/windows.js +0 -159
  14. package/distTs/src/agent.js +0 -302
  15. package/distTs/src/api/agent.js +0 -99
  16. package/distTs/src/api/buddy.js +0 -139
  17. package/distTs/src/api/socket.js +0 -159
  18. package/distTs/src/cfg.js +0 -234
  19. package/distTs/src/command/agent/disable.js +0 -27
  20. package/distTs/src/command/agent/enable.js +0 -27
  21. package/distTs/src/command/agent/install.js +0 -117
  22. package/distTs/src/command/agent/restart.js +0 -27
  23. package/distTs/src/command/agent/run.js +0 -19
  24. package/distTs/src/command/agent/start.js +0 -28
  25. package/distTs/src/command/agent/status.js +0 -34
  26. package/distTs/src/command/agent/stop.js +0 -28
  27. package/distTs/src/command/agent/target/disable.js +0 -27
  28. package/distTs/src/command/agent/target/enable.js +0 -27
  29. package/distTs/src/command/agent/target/status.js +0 -32
  30. package/distTs/src/command/agent/target.js +0 -15
  31. package/distTs/src/command/agent/tunnel/http.js +0 -43
  32. package/distTs/src/command/agent/tunnel/list.js +0 -27
  33. package/distTs/src/command/agent/tunnel/remove.js +0 -28
  34. package/distTs/src/command/agent/tunnel/start.js +0 -34
  35. package/distTs/src/command/agent/tunnel/status.js +0 -31
  36. package/distTs/src/command/agent/tunnel/tcp.js +0 -43
  37. package/distTs/src/command/agent/tunnel/tls.js +0 -43
  38. package/distTs/src/command/agent/tunnel.js +0 -23
  39. package/distTs/src/command/agent/uninstall.js +0 -44
  40. package/distTs/src/command/agent/update.js +0 -38
  41. package/distTs/src/command/agent/version.js +0 -21
  42. package/distTs/src/command/agent.js +0 -35
  43. package/distTs/src/command/config/add/http.js +0 -25
  44. package/distTs/src/command/config/add/tcp.js +0 -25
  45. package/distTs/src/command/config/add/tls.js +0 -25
  46. package/distTs/src/command/config/add.js +0 -15
  47. package/distTs/src/command/config/get/region.js +0 -15
  48. package/distTs/src/command/config/get/timeout.js +0 -15
  49. package/distTs/src/command/config/get/token.js +0 -15
  50. package/distTs/src/command/config/get/tunnel.js +0 -19
  51. package/distTs/src/command/config/get/tunnels.js +0 -15
  52. package/distTs/src/command/config/get/whitelist.js +0 -15
  53. package/distTs/src/command/config/get.js +0 -21
  54. package/distTs/src/command/config/remove/tunnel.js +0 -19
  55. package/distTs/src/command/config/remove.js +0 -11
  56. package/distTs/src/command/config/set/region.js +0 -17
  57. package/distTs/src/command/config/set/timeout.js +0 -17
  58. package/distTs/src/command/config/set/token.js +0 -16
  59. package/distTs/src/command/config/set/whitelist.js +0 -17
  60. package/distTs/src/command/config/set.js +0 -17
  61. package/distTs/src/command/config.js +0 -17
  62. package/distTs/src/command/http.js +0 -30
  63. package/distTs/src/command/pre.js +0 -49
  64. package/distTs/src/command/start.js +0 -28
  65. package/distTs/src/command/tcp.js +0 -30
  66. package/distTs/src/command/tls.js +0 -30
  67. package/distTs/src/command/tunnel/config.js +0 -17
  68. package/distTs/src/command/tunnel/http.js +0 -31
  69. package/distTs/src/command/tunnel/start.js +0 -28
  70. package/distTs/src/command/tunnel/tcp.js +0 -30
  71. package/distTs/src/command/tunnel/tls.js +0 -30
  72. package/distTs/src/command/tunnel.js +0 -19
  73. package/distTs/src/command/ut/upload.js +0 -108
  74. package/distTs/src/command/ut.js +0 -12
  75. package/distTs/src/command/version.js +0 -13
  76. package/distTs/src/command/vt/close.js +0 -27
  77. package/distTs/src/command/vt/compare/validation.js +0 -173
  78. package/distTs/src/command/vt/compare.js +0 -97
  79. package/distTs/src/command/vt/exec.js +0 -81
  80. package/distTs/src/command/vt/installBrowser.js +0 -20
  81. package/distTs/src/command/vt/scrap.js +0 -193
  82. package/distTs/src/command/vt/storybook.js +0 -92
  83. package/distTs/src/command/vt.js +0 -22
  84. package/distTs/src/format.js +0 -174
  85. package/distTs/src/index.js +0 -34
  86. package/distTs/src/input.js +0 -270
  87. package/distTs/src/logger.js +0 -95
  88. package/distTs/src/output/interactive/tunnel.js +0 -860
  89. package/distTs/src/output/noninteractive/agent/tunnels.js +0 -43
  90. package/distTs/src/output/noninteractive/config/tunnel.js +0 -65
  91. package/distTs/src/output/noninteractive/config/tunnels.js +0 -18
  92. package/distTs/src/output/noninteractive/tunnel.js +0 -59
  93. package/distTs/src/output.js +0 -143
  94. package/distTs/src/server/cert.js +0 -52
  95. package/distTs/src/server/http1.js +0 -75
  96. package/distTs/src/server/http2.js +0 -78
  97. package/distTs/src/server/sftp.js +0 -497
  98. package/distTs/src/server/ssh.js +0 -446
  99. package/distTs/src/server/tls.js +0 -41
  100. package/distTs/src/ssh/client.js +0 -197
  101. package/distTs/src/texts.js +0 -421
  102. package/distTs/src/tunnel/agent.js +0 -103
  103. package/distTs/src/tunnel/api/agent.js +0 -100
  104. package/distTs/src/tunnel/api/buddy.js +0 -141
  105. package/distTs/src/tunnel/cfg.js +0 -243
  106. package/distTs/src/tunnel/compression.js +0 -44
  107. package/distTs/src/tunnel/dns.js +0 -53
  108. package/distTs/src/tunnel/html/503.html +0 -338
  109. package/distTs/src/tunnel/html.js +0 -33
  110. package/distTs/src/tunnel/http/log.js +0 -218
  111. package/distTs/src/tunnel/http/serve.js +0 -133
  112. package/distTs/src/tunnel/http/stream.js +0 -34
  113. package/distTs/src/tunnel/http.js +0 -508
  114. package/distTs/src/tunnel/identification.js +0 -103
  115. package/distTs/src/tunnel/latency.js +0 -83
  116. package/distTs/src/tunnel/output/interactive/tunnel.js +0 -867
  117. package/distTs/src/tunnel/output/noninteractive/agent/tunnels.js +0 -45
  118. package/distTs/src/tunnel/output/noninteractive/config/tunnel.js +0 -67
  119. package/distTs/src/tunnel/output/noninteractive/config/tunnels.js +0 -20
  120. package/distTs/src/tunnel/output/noninteractive/tunnel.js +0 -61
  121. package/distTs/src/tunnel/server/cert.js +0 -54
  122. package/distTs/src/tunnel/server/http1.js +0 -80
  123. package/distTs/src/tunnel/server/http2.js +0 -84
  124. package/distTs/src/tunnel/server/sftp.js +0 -514
  125. package/distTs/src/tunnel/server/ssh.js +0 -464
  126. package/distTs/src/tunnel/server/tls.js +0 -47
  127. package/distTs/src/tunnel/ssh/client.js +0 -211
  128. package/distTs/src/tunnel/tcp.js +0 -113
  129. package/distTs/src/tunnel/tunnel.js +0 -1010
  130. package/distTs/src/tunnel.js +0 -656
  131. package/distTs/src/types/ciInfo.js +0 -10
  132. package/distTs/src/types/options.js +0 -2
  133. package/distTs/src/types/plugin.js +0 -2
  134. package/distTs/src/types/queue.js +0 -2
  135. package/distTs/src/types/requests.js +0 -2
  136. package/distTs/src/types/resources.js +0 -2
  137. package/distTs/src/types/schemas.js +0 -54
  138. package/distTs/src/types/scrape.js +0 -2
  139. package/distTs/src/types/snapshots.js +0 -2
  140. package/distTs/src/types/storybook.js +0 -2
  141. package/distTs/src/types/tunnel.js +0 -141
  142. package/distTs/src/unitTest/ci.js +0 -108
  143. package/distTs/src/unitTest/requests.js +0 -72
  144. package/distTs/src/utils.js +0 -378
  145. package/distTs/src/visualTest/browser.js +0 -39
  146. package/distTs/src/visualTest/ci.js +0 -241
  147. package/distTs/src/visualTest/context.js +0 -52
  148. package/distTs/src/visualTest/exec.js +0 -51
  149. package/distTs/src/visualTest/linkUtils.js +0 -21
  150. package/distTs/src/visualTest/queue.js +0 -43
  151. package/distTs/src/visualTest/requests.js +0 -365
  152. package/distTs/src/visualTest/resources.js +0 -259
  153. package/distTs/src/visualTest/server.js +0 -109
  154. package/distTs/src/visualTest/snapshots.js +0 -129
  155. package/distTs/src/visualTest/utils/parseDom.js +0 -238
  156. package/distTs/src/visualTest/validation.js +0 -18
@@ -1,270 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const output_1 = __importDefault(require("./output"));
30
- const netmask_1 = __importDefault(require("netmask"));
31
- const punycode_1 = __importDefault(require("punycode/"));
32
- const fs_1 = __importStar(require("fs"));
33
- const tls_1 = __importDefault(require("tls"));
34
- const crypto_1 = __importDefault(require("crypto"));
35
- const utils_1 = require("./utils");
36
- const texts_1 = require("./texts");
37
- const tunnel_1 = require("./types/tunnel");
38
- class Input {
39
- static timeout(timeout) {
40
- const t = parseInt(timeout, 10);
41
- if (isNaN(t) || t <= 0 || t > 999) {
42
- output_1.default.exitError((0, texts_1.ERR_TIMEOUT_IS_NOT_VALID)(timeout));
43
- }
44
- return t;
45
- }
46
- static serve(serve) {
47
- if (!serve)
48
- return serve;
49
- try {
50
- const info = (0, fs_1.statSync)(serve);
51
- if (!info.isDirectory()) {
52
- output_1.default.exitError((0, texts_1.ERR_PATH_IS_NOT_DIRECTORY)(serve));
53
- }
54
- }
55
- catch {
56
- output_1.default.exitError((0, texts_1.ERR_DIRECTORY_DOES_NOT_EXISTS)(serve));
57
- }
58
- return serve;
59
- }
60
- static circuitBreaker(threshold) {
61
- if (threshold === undefined)
62
- return null;
63
- const n = parseFloat(threshold);
64
- if (isNaN(n) || n < 0 || n > 1) {
65
- output_1.default.exitError((0, texts_1.ERR_CB_THRESHOLD_IS_NOT_VALID)(n));
66
- }
67
- return n;
68
- }
69
- static headers(headers) {
70
- const r = [];
71
- (headers || []).forEach((h) => {
72
- if (!h)
73
- return;
74
- const s = h.split(':');
75
- if (s.length !== 2)
76
- return;
77
- r.push({
78
- name: s[0],
79
- value: s[1],
80
- });
81
- });
82
- return r;
83
- }
84
- static auth(auth) {
85
- const s = auth.split(':');
86
- if (s.length !== 2) {
87
- output_1.default.exitError((0, texts_1.ERR_BA_IS_NOT_VALID)(auth));
88
- }
89
- if (!s[0]) {
90
- output_1.default.exitError(texts_1.ERR_BA_LOGIN_NOT_PROVIDED);
91
- }
92
- if (!s[1]) {
93
- output_1.default.exitError(texts_1.ERR_BA_PASSWORD_NOT_PROVIDED);
94
- }
95
- return {
96
- login: s[0],
97
- password: s[1],
98
- };
99
- }
100
- static useragents(useragents) {
101
- if (!useragents || !useragents.length)
102
- return [];
103
- useragents.forEach((ua) => {
104
- if ((0, utils_1.isStringRegExp)(ua)) {
105
- try {
106
- new RegExp(ua);
107
- }
108
- catch {
109
- output_1.default.exitError((0, texts_1.ERR_USER_AGENT_IS_NOT_VALID)(ua));
110
- }
111
- }
112
- });
113
- return useragents;
114
- }
115
- static whitelist(whitelist) {
116
- if (!whitelist || !whitelist.length)
117
- return [];
118
- for (let i = 0; i < whitelist.length; i += 1) {
119
- const wh = whitelist[i];
120
- if (wh === '*')
121
- return ['*'];
122
- try {
123
- new netmask_1.default.Netmask(wh);
124
- }
125
- catch {
126
- output_1.default.exitError((0, texts_1.ERR_WHITELIST_IS_NOT_VALID)(wh));
127
- }
128
- }
129
- return whitelist;
130
- }
131
- static region(region) {
132
- if (!region)
133
- output_1.default.exitError((0, texts_1.ERR_REGION_IS_NOT_VALID)(''));
134
- region = region.toUpperCase();
135
- const vals = Object.values(tunnel_1.TUNNEL_REGION);
136
- if (!vals.includes(region)) {
137
- output_1.default.exitError((0, texts_1.ERR_REGION_IS_NOT_VALID)(region));
138
- }
139
- return region;
140
- }
141
- static terminate(terminate) {
142
- if (!terminate)
143
- return tunnel_1.TUNNEL_TERMINATE_AT.REGION;
144
- terminate = terminate.toUpperCase();
145
- const vals = Object.values(tunnel_1.TUNNEL_TERMINATE_AT);
146
- if (!vals.includes(terminate)) {
147
- output_1.default.exitError((0, texts_1.ERR_TERMINATE_IS_NOT_VALID)(terminate));
148
- }
149
- return terminate;
150
- }
151
- static target(target, type) {
152
- if (!target)
153
- return '80';
154
- if (target.length > 200) {
155
- output_1.default.exitError((0, texts_1.ERR_TARGET_IS_NOT_VALID)(target));
156
- }
157
- target = target.toLowerCase();
158
- // 80
159
- // localhost
160
- // localhost:80
161
- // http://localhost:80
162
- // http://localhost
163
- // http://user:pass@localhost
164
- // http://user:pass@localhost:80
165
- let port;
166
- const types = [tunnel_1.TUNNEL_TYPE.TCP, tunnel_1.TUNNEL_TYPE.TLS];
167
- if (types.includes(type)) {
168
- const m = target.match(utils_1.TARGET_TCP_TLS_REGEX);
169
- if (!m) {
170
- output_1.default.exitError((0, texts_1.ERR_TARGET_IS_NOT_VALID)(target));
171
- }
172
- port = m[3];
173
- }
174
- else {
175
- let m = target.match(utils_1.TARGET_ONLY_PORT_REGEX);
176
- if (m) {
177
- port = m[0];
178
- }
179
- else {
180
- m = target.match(utils_1.TARGET_HTTP_REGEX);
181
- if (!m) {
182
- output_1.default.exitError((0, texts_1.ERR_TARGET_IS_NOT_VALID)(target));
183
- }
184
- else {
185
- let proto;
186
- if (m[2])
187
- proto = m[2];
188
- else
189
- proto = 'http';
190
- if (m[6])
191
- port = m[6];
192
- else if (proto === 'https')
193
- port = '443';
194
- else
195
- port = '80';
196
- }
197
- }
198
- }
199
- Input.port(port);
200
- return punycode_1.default.toUnicode(target);
201
- }
202
- static port(port) {
203
- const p = parseInt(port, 10);
204
- if (isNaN(p) || p <= 0 || p > 65535)
205
- output_1.default.exitError((0, texts_1.ERR_PORT_IS_NOT_VALID)(port));
206
- return p;
207
- }
208
- static type(type) {
209
- if (!type)
210
- return tunnel_1.TUNNEL_TYPE.TCP;
211
- type = type.toUpperCase();
212
- const vals = [tunnel_1.TUNNEL_TYPE.HTTP, tunnel_1.TUNNEL_TYPE.TLS, tunnel_1.TUNNEL_TYPE.TCP];
213
- if (!vals.includes(type)) {
214
- output_1.default.exitError((0, texts_1.ERR_TYPE_IS_NOT_VALID)(type));
215
- }
216
- return type;
217
- }
218
- static name(name) {
219
- if (name.includes('*')) {
220
- output_1.default.exitError(texts_1.ERR_NAME_WITHOUT_ASTERISK);
221
- }
222
- return name;
223
- }
224
- static ca(caPath) {
225
- let cert;
226
- try {
227
- cert = fs_1.default.readFileSync(caPath, 'utf8');
228
- }
229
- catch {
230
- output_1.default.exitError((0, texts_1.ERR_CA_PATH_IS_NOT_VALID)(caPath));
231
- }
232
- try {
233
- new crypto_1.default.X509Certificate(cert);
234
- }
235
- catch {
236
- output_1.default.exitError((0, texts_1.ERR_WRONG_CA)(caPath));
237
- }
238
- return cert;
239
- }
240
- static keyCert(keyPath, certPath) {
241
- let key;
242
- let cert;
243
- try {
244
- key = fs_1.default.readFileSync(keyPath, 'utf8');
245
- }
246
- catch {
247
- output_1.default.exitError((0, texts_1.ERR_KEY_PATH_IS_NOT_VALID)(keyPath));
248
- }
249
- try {
250
- cert = fs_1.default.readFileSync(certPath, 'utf8');
251
- }
252
- catch {
253
- output_1.default.exitError((0, texts_1.ERR_CERT_PATH_IS_NOT_VALID)(certPath));
254
- }
255
- try {
256
- tls_1.default.createSecureContext({
257
- cert,
258
- key,
259
- });
260
- }
261
- catch {
262
- output_1.default.exitError(texts_1.ERR_WRONG_KEY_CERT);
263
- }
264
- return {
265
- cert,
266
- key,
267
- };
268
- }
269
- }
270
- exports.default = Input;
@@ -1,95 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const pino_1 = __importDefault(require("pino"));
7
- const path_1 = require("path");
8
- const fs_1 = __importDefault(require("fs"));
9
- const utils_1 = require("./utils");
10
- class Logger {
11
- rootPath;
12
- logPath = null;
13
- log1Path = null;
14
- logStream = null;
15
- p = null;
16
- ts = null;
17
- constructor() {
18
- this.rootPath = (0, utils_1.getHomeDirectory)();
19
- }
20
- checkLogSize() {
21
- if (!this.logPath || !this.log1Path)
22
- return;
23
- try {
24
- const s = fs_1.default.statSync(this.logPath);
25
- if (s.size > 5242880) {
26
- fs_1.default.copyFileSync(this.logPath, this.log1Path);
27
- fs_1.default.truncateSync(this.logPath);
28
- }
29
- }
30
- catch {
31
- // do nothing
32
- }
33
- }
34
- getPino() {
35
- if (!this.p) {
36
- this.logPath = (0, path_1.resolve)(this.rootPath, 'cli.log');
37
- this.log1Path = (0, path_1.resolve)(this.rootPath, 'cli.1.log');
38
- this.logStream = fs_1.default.openSync(this.logPath, 'w');
39
- try {
40
- fs_1.default.chmodSync(this.logPath, 0o666);
41
- }
42
- catch {
43
- // do nothing
44
- }
45
- this.p = (0, pino_1.default)({
46
- level: process.env.DEBUG === '1' ? 'debug' : 'info',
47
- timestamp: () => `, "time": "${new Date().toISOString()}"`,
48
- formatters: {
49
- bindings: () => ({}),
50
- level: (label) => ({
51
- level: label.toUpperCase(),
52
- }),
53
- },
54
- }, pino_1.default.destination(this.logStream));
55
- this.checkLogSize();
56
- this.ts = setInterval(() => {
57
- this.checkLogSize();
58
- }, 30000);
59
- }
60
- return this.p;
61
- }
62
- error(obj, ...args) {
63
- this.getPino().error(obj, ...args);
64
- }
65
- info(obj, ...args) {
66
- this.getPino().info(obj, ...args);
67
- }
68
- debug(obj, ...args) {
69
- this.getPino().debug(obj, ...args);
70
- }
71
- fatal(obj, ...args) {
72
- this.getPino().fatal(obj, ...args);
73
- }
74
- stack() {
75
- this.getPino().info(new Error().stack);
76
- }
77
- changeRootPath(path) {
78
- if (this.ts) {
79
- clearInterval(this.ts);
80
- this.ts = null;
81
- }
82
- if (this.logStream) {
83
- try {
84
- fs_1.default.closeSync(this.logStream);
85
- }
86
- catch {
87
- // do nothing
88
- }
89
- this.logStream = null;
90
- }
91
- this.p = null;
92
- this.rootPath = path;
93
- }
94
- }
95
- exports.default = new Logger();