@alienplatform/sdk 1.14.1 → 2.0.0

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 (160) hide show
  1. package/dist/dist.js +371 -275
  2. package/dist/index.d.ts +22 -28
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +3 -14356
  5. package/dist/native.d.ts +26 -0
  6. package/dist/native.d.ts.map +1 -0
  7. package/dist/native.js +2 -0
  8. package/dist/worker-runtime/channel.d.ts +25 -0
  9. package/dist/worker-runtime/channel.d.ts.map +1 -0
  10. package/dist/worker-runtime/errors.d.ts +79 -0
  11. package/dist/worker-runtime/errors.d.ts.map +1 -0
  12. package/dist/worker-runtime/event-loop.d.ts +43 -0
  13. package/dist/worker-runtime/event-loop.d.ts.map +1 -0
  14. package/dist/{generated → worker-runtime/generated}/control.d.ts +15 -15
  15. package/dist/worker-runtime/generated/control.d.ts.map +1 -0
  16. package/dist/worker-runtime/generated/google/protobuf/duration.d.ts.map +1 -0
  17. package/dist/worker-runtime/generated/google/protobuf/timestamp.d.ts.map +1 -0
  18. package/dist/{generated → worker-runtime/generated}/wait_until.d.ts +29 -29
  19. package/dist/worker-runtime/generated/wait_until.d.ts.map +1 -0
  20. package/dist/worker-runtime/grpc-utils.d.ts +23 -0
  21. package/dist/worker-runtime/grpc-utils.d.ts.map +1 -0
  22. package/dist/worker-runtime/index.d.ts +33 -0
  23. package/dist/worker-runtime/index.d.ts.map +1 -0
  24. package/dist/{src.js → worker-runtime/index.js} +9370 -4035
  25. package/dist/worker-runtime/registry.d.ts +169 -0
  26. package/dist/worker-runtime/registry.d.ts.map +1 -0
  27. package/dist/worker-runtime/service-definitions.d.ts +12 -0
  28. package/dist/worker-runtime/service-definitions.d.ts.map +1 -0
  29. package/dist/worker-runtime/wait-until-manager.d.ts +34 -0
  30. package/dist/worker-runtime/wait-until-manager.d.ts.map +1 -0
  31. package/package.json +18 -38
  32. package/.turbo/turbo-build.log +0 -30
  33. package/AGENTS.md +0 -70
  34. package/dist/bearerTokenAuthenticationPolicy.js +0 -3028
  35. package/dist/bindings/artifact-registry.d.ts +0 -88
  36. package/dist/bindings/artifact-registry.d.ts.map +0 -1
  37. package/dist/bindings/build.d.ts +0 -67
  38. package/dist/bindings/build.d.ts.map +0 -1
  39. package/dist/bindings/index.d.ts +0 -13
  40. package/dist/bindings/index.d.ts.map +0 -1
  41. package/dist/bindings/kv.d.ts +0 -113
  42. package/dist/bindings/kv.d.ts.map +0 -1
  43. package/dist/bindings/postgres.d.ts +0 -90
  44. package/dist/bindings/postgres.d.ts.map +0 -1
  45. package/dist/bindings/postgres.test.d.ts +0 -2
  46. package/dist/bindings/postgres.test.d.ts.map +0 -1
  47. package/dist/bindings/queue.d.ts +0 -81
  48. package/dist/bindings/queue.d.ts.map +0 -1
  49. package/dist/bindings/service-account.d.ts +0 -46
  50. package/dist/bindings/service-account.d.ts.map +0 -1
  51. package/dist/bindings/storage.d.ts +0 -164
  52. package/dist/bindings/storage.d.ts.map +0 -1
  53. package/dist/bindings/vault.d.ts +0 -65
  54. package/dist/bindings/vault.d.ts.map +0 -1
  55. package/dist/bindings/worker.d.ts +0 -72
  56. package/dist/bindings/worker.d.ts.map +0 -1
  57. package/dist/channel.d.ts +0 -39
  58. package/dist/channel.d.ts.map +0 -1
  59. package/dist/checksum.js +0 -6176
  60. package/dist/commands/client.d.ts +0 -47
  61. package/dist/commands/client.d.ts.map +0 -1
  62. package/dist/commands/errors.d.ts +0 -198
  63. package/dist/commands/errors.d.ts.map +0 -1
  64. package/dist/commands/index.d.ts +0 -23
  65. package/dist/commands/index.d.ts.map +0 -1
  66. package/dist/commands/index.js +0 -387
  67. package/dist/commands/types.d.ts +0 -40
  68. package/dist/commands/types.d.ts.map +0 -1
  69. package/dist/commands.d.ts +0 -55
  70. package/dist/commands.d.ts.map +0 -1
  71. package/dist/context.d.ts +0 -182
  72. package/dist/context.d.ts.map +0 -1
  73. package/dist/dist-cjs.js +0 -15258
  74. package/dist/dist2.js +0 -1239
  75. package/dist/errors.d.ts +0 -359
  76. package/dist/errors.d.ts.map +0 -1
  77. package/dist/es5.js +0 -1720
  78. package/dist/esm.js +0 -18068
  79. package/dist/esm2.js +0 -3166
  80. package/dist/event-streams.js +0 -770
  81. package/dist/events.d.ts +0 -163
  82. package/dist/events.d.ts.map +0 -1
  83. package/dist/generated/artifact_registry.d.ts +0 -302
  84. package/dist/generated/artifact_registry.d.ts.map +0 -1
  85. package/dist/generated/build.d.ts +0 -184
  86. package/dist/generated/build.d.ts.map +0 -1
  87. package/dist/generated/container.d.ts +0 -101
  88. package/dist/generated/container.d.ts.map +0 -1
  89. package/dist/generated/control.d.ts.map +0 -1
  90. package/dist/generated/google/protobuf/duration.d.ts.map +0 -1
  91. package/dist/generated/google/protobuf/timestamp.d.ts.map +0 -1
  92. package/dist/generated/kv.d.ts +0 -182
  93. package/dist/generated/kv.d.ts.map +0 -1
  94. package/dist/generated/queue.d.ts +0 -127
  95. package/dist/generated/queue.d.ts.map +0 -1
  96. package/dist/generated/service_account.d.ts +0 -112
  97. package/dist/generated/service_account.d.ts.map +0 -1
  98. package/dist/generated/storage.d.ts +0 -784
  99. package/dist/generated/storage.d.ts.map +0 -1
  100. package/dist/generated/vault.d.ts +0 -107
  101. package/dist/generated/vault.d.ts.map +0 -1
  102. package/dist/generated/wait_until.d.ts.map +0 -1
  103. package/dist/generated/worker.d.ts +0 -107
  104. package/dist/generated/worker.d.ts.map +0 -1
  105. package/dist/global.d.ts +0 -208
  106. package/dist/global.d.ts.map +0 -1
  107. package/dist/grpc-utils.d.ts +0 -25
  108. package/dist/grpc-utils.d.ts.map +0 -1
  109. package/dist/jws.js +0 -611
  110. package/dist/open.js +0 -461
  111. package/dist/rolldown-runtime.js +0 -44
  112. package/dist/src2.js +0 -114032
  113. package/dist/types.d.ts +0 -337
  114. package/dist/types.d.ts.map +0 -1
  115. package/dist/wait-until.d.ts +0 -115
  116. package/dist/wait-until.d.ts.map +0 -1
  117. package/scripts/generate-proto.sh +0 -46
  118. package/src/bindings/AGENTS.md +0 -105
  119. package/src/bindings/artifact-registry.ts +0 -317
  120. package/src/bindings/build.ts +0 -195
  121. package/src/bindings/index.ts +0 -13
  122. package/src/bindings/kv.ts +0 -240
  123. package/src/bindings/postgres.test.ts +0 -17
  124. package/src/bindings/postgres.ts +0 -446
  125. package/src/bindings/queue.ts +0 -191
  126. package/src/bindings/service-account.ts +0 -113
  127. package/src/bindings/storage.ts +0 -536
  128. package/src/bindings/vault.ts +0 -133
  129. package/src/bindings/worker.ts +0 -164
  130. package/src/channel.ts +0 -102
  131. package/src/commands/client.ts +0 -446
  132. package/src/commands/errors.ts +0 -126
  133. package/src/commands/index.ts +0 -41
  134. package/src/commands/types.ts +0 -52
  135. package/src/commands.ts +0 -76
  136. package/src/context.ts +0 -368
  137. package/src/errors.ts +0 -280
  138. package/src/events.ts +0 -511
  139. package/src/generated/artifact_registry.ts +0 -2096
  140. package/src/generated/build.ts +0 -1311
  141. package/src/generated/container.ts +0 -503
  142. package/src/generated/control.ts +0 -2018
  143. package/src/generated/google/protobuf/duration.ts +0 -196
  144. package/src/generated/google/protobuf/timestamp.ts +0 -226
  145. package/src/generated/kv.ts +0 -1169
  146. package/src/generated/queue.ts +0 -753
  147. package/src/generated/service_account.ts +0 -814
  148. package/src/generated/storage.ts +0 -3820
  149. package/src/generated/vault.ts +0 -543
  150. package/src/generated/wait_until.ts +0 -829
  151. package/src/generated/worker.ts +0 -759
  152. package/src/global.ts +0 -287
  153. package/src/grpc-utils.ts +0 -159
  154. package/src/index.ts +0 -160
  155. package/src/types.ts +0 -397
  156. package/src/wait-until.ts +0 -273
  157. package/tsconfig.json +0 -8
  158. package/tsdown.config.ts +0 -17
  159. /package/dist/{generated → worker-runtime/generated}/google/protobuf/duration.d.ts +0 -0
  160. /package/dist/{generated → worker-runtime/generated}/google/protobuf/timestamp.d.ts +0 -0
package/dist/dist2.js DELETED
@@ -1,1239 +0,0 @@
1
- import { i as __require, t as __commonJSMin } from "./rolldown-runtime.js";
2
- //#region ../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js
3
- var require_ms = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
- /**
5
- * Helpers.
6
- */
7
- var s = 1e3;
8
- var m = s * 60;
9
- var h = m * 60;
10
- var d = h * 24;
11
- var w = d * 7;
12
- var y = d * 365.25;
13
- /**
14
- * Parse or format the given `val`.
15
- *
16
- * Options:
17
- *
18
- * - `long` verbose formatting [false]
19
- *
20
- * @param {String|Number} val
21
- * @param {Object} [options]
22
- * @throws {Error} throw an error if val is not a non-empty string or a number
23
- * @return {String|Number}
24
- * @api public
25
- */
26
- module.exports = function(val, options) {
27
- options = options || {};
28
- var type = typeof val;
29
- if (type === "string" && val.length > 0) return parse(val);
30
- else if (type === "number" && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val);
31
- throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
32
- };
33
- /**
34
- * Parse the given `str` and return milliseconds.
35
- *
36
- * @param {String} str
37
- * @return {Number}
38
- * @api private
39
- */
40
- function parse(str) {
41
- str = String(str);
42
- if (str.length > 100) return;
43
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
44
- if (!match) return;
45
- var n = parseFloat(match[1]);
46
- switch ((match[2] || "ms").toLowerCase()) {
47
- case "years":
48
- case "year":
49
- case "yrs":
50
- case "yr":
51
- case "y": return n * y;
52
- case "weeks":
53
- case "week":
54
- case "w": return n * w;
55
- case "days":
56
- case "day":
57
- case "d": return n * d;
58
- case "hours":
59
- case "hour":
60
- case "hrs":
61
- case "hr":
62
- case "h": return n * h;
63
- case "minutes":
64
- case "minute":
65
- case "mins":
66
- case "min":
67
- case "m": return n * m;
68
- case "seconds":
69
- case "second":
70
- case "secs":
71
- case "sec":
72
- case "s": return n * s;
73
- case "milliseconds":
74
- case "millisecond":
75
- case "msecs":
76
- case "msec":
77
- case "ms": return n;
78
- default: return;
79
- }
80
- }
81
- /**
82
- * Short format for `ms`.
83
- *
84
- * @param {Number} ms
85
- * @return {String}
86
- * @api private
87
- */
88
- function fmtShort(ms) {
89
- var msAbs = Math.abs(ms);
90
- if (msAbs >= d) return Math.round(ms / d) + "d";
91
- if (msAbs >= h) return Math.round(ms / h) + "h";
92
- if (msAbs >= m) return Math.round(ms / m) + "m";
93
- if (msAbs >= s) return Math.round(ms / s) + "s";
94
- return ms + "ms";
95
- }
96
- /**
97
- * Long format for `ms`.
98
- *
99
- * @param {Number} ms
100
- * @return {String}
101
- * @api private
102
- */
103
- function fmtLong(ms) {
104
- var msAbs = Math.abs(ms);
105
- if (msAbs >= d) return plural(ms, msAbs, d, "day");
106
- if (msAbs >= h) return plural(ms, msAbs, h, "hour");
107
- if (msAbs >= m) return plural(ms, msAbs, m, "minute");
108
- if (msAbs >= s) return plural(ms, msAbs, s, "second");
109
- return ms + " ms";
110
- }
111
- /**
112
- * Pluralization helper.
113
- */
114
- function plural(ms, msAbs, n, name) {
115
- var isPlural = msAbs >= n * 1.5;
116
- return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
117
- }
118
- }));
119
- //#endregion
120
- //#region ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js
121
- var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
122
- /**
123
- * This is the common logic for both the Node.js and web browser
124
- * implementations of `debug()`.
125
- */
126
- function setup(env) {
127
- createDebug.debug = createDebug;
128
- createDebug.default = createDebug;
129
- createDebug.coerce = coerce;
130
- createDebug.disable = disable;
131
- createDebug.enable = enable;
132
- createDebug.enabled = enabled;
133
- createDebug.humanize = require_ms();
134
- createDebug.destroy = destroy;
135
- Object.keys(env).forEach((key) => {
136
- createDebug[key] = env[key];
137
- });
138
- /**
139
- * The currently active debug mode names, and names to skip.
140
- */
141
- createDebug.names = [];
142
- createDebug.skips = [];
143
- /**
144
- * Map of special "%n" handling functions, for the debug "format" argument.
145
- *
146
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
147
- */
148
- createDebug.formatters = {};
149
- /**
150
- * Selects a color for a debug namespace
151
- * @param {String} namespace The namespace string for the debug instance to be colored
152
- * @return {Number|String} An ANSI color code for the given namespace
153
- * @api private
154
- */
155
- function selectColor(namespace) {
156
- let hash = 0;
157
- for (let i = 0; i < namespace.length; i++) {
158
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
159
- hash |= 0;
160
- }
161
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
162
- }
163
- createDebug.selectColor = selectColor;
164
- /**
165
- * Create a debugger with the given `namespace`.
166
- *
167
- * @param {String} namespace
168
- * @return {Function}
169
- * @api public
170
- */
171
- function createDebug(namespace) {
172
- let prevTime;
173
- let enableOverride = null;
174
- let namespacesCache;
175
- let enabledCache;
176
- function debug(...args) {
177
- if (!debug.enabled) return;
178
- const self = debug;
179
- const curr = Number(/* @__PURE__ */ new Date());
180
- self.diff = curr - (prevTime || curr);
181
- self.prev = prevTime;
182
- self.curr = curr;
183
- prevTime = curr;
184
- args[0] = createDebug.coerce(args[0]);
185
- if (typeof args[0] !== "string") args.unshift("%O");
186
- let index = 0;
187
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
188
- if (match === "%%") return "%";
189
- index++;
190
- const formatter = createDebug.formatters[format];
191
- if (typeof formatter === "function") {
192
- const val = args[index];
193
- match = formatter.call(self, val);
194
- args.splice(index, 1);
195
- index--;
196
- }
197
- return match;
198
- });
199
- createDebug.formatArgs.call(self, args);
200
- (self.log || createDebug.log).apply(self, args);
201
- }
202
- debug.namespace = namespace;
203
- debug.useColors = createDebug.useColors();
204
- debug.color = createDebug.selectColor(namespace);
205
- debug.extend = extend;
206
- debug.destroy = createDebug.destroy;
207
- Object.defineProperty(debug, "enabled", {
208
- enumerable: true,
209
- configurable: false,
210
- get: () => {
211
- if (enableOverride !== null) return enableOverride;
212
- if (namespacesCache !== createDebug.namespaces) {
213
- namespacesCache = createDebug.namespaces;
214
- enabledCache = createDebug.enabled(namespace);
215
- }
216
- return enabledCache;
217
- },
218
- set: (v) => {
219
- enableOverride = v;
220
- }
221
- });
222
- if (typeof createDebug.init === "function") createDebug.init(debug);
223
- return debug;
224
- }
225
- function extend(namespace, delimiter) {
226
- const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
227
- newDebug.log = this.log;
228
- return newDebug;
229
- }
230
- /**
231
- * Enables a debug mode by namespaces. This can include modes
232
- * separated by a colon and wildcards.
233
- *
234
- * @param {String} namespaces
235
- * @api public
236
- */
237
- function enable(namespaces) {
238
- createDebug.save(namespaces);
239
- createDebug.namespaces = namespaces;
240
- createDebug.names = [];
241
- createDebug.skips = [];
242
- const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
243
- for (const ns of split) if (ns[0] === "-") createDebug.skips.push(ns.slice(1));
244
- else createDebug.names.push(ns);
245
- }
246
- /**
247
- * Checks if the given string matches a namespace template, honoring
248
- * asterisks as wildcards.
249
- *
250
- * @param {String} search
251
- * @param {String} template
252
- * @return {Boolean}
253
- */
254
- function matchesTemplate(search, template) {
255
- let searchIndex = 0;
256
- let templateIndex = 0;
257
- let starIndex = -1;
258
- let matchIndex = 0;
259
- while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
260
- starIndex = templateIndex;
261
- matchIndex = searchIndex;
262
- templateIndex++;
263
- } else {
264
- searchIndex++;
265
- templateIndex++;
266
- }
267
- else if (starIndex !== -1) {
268
- templateIndex = starIndex + 1;
269
- matchIndex++;
270
- searchIndex = matchIndex;
271
- } else return false;
272
- while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
273
- return templateIndex === template.length;
274
- }
275
- /**
276
- * Disable debug output.
277
- *
278
- * @return {String} namespaces
279
- * @api public
280
- */
281
- function disable() {
282
- const namespaces = [...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace)].join(",");
283
- createDebug.enable("");
284
- return namespaces;
285
- }
286
- /**
287
- * Returns true if the given mode name is enabled, false otherwise.
288
- *
289
- * @param {String} name
290
- * @return {Boolean}
291
- * @api public
292
- */
293
- function enabled(name) {
294
- for (const skip of createDebug.skips) if (matchesTemplate(name, skip)) return false;
295
- for (const ns of createDebug.names) if (matchesTemplate(name, ns)) return true;
296
- return false;
297
- }
298
- /**
299
- * Coerce `val`.
300
- *
301
- * @param {Mixed} val
302
- * @return {Mixed}
303
- * @api private
304
- */
305
- function coerce(val) {
306
- if (val instanceof Error) return val.stack || val.message;
307
- return val;
308
- }
309
- /**
310
- * XXX DO NOT USE. This is a temporary stub function.
311
- * XXX It WILL be removed in the next major release.
312
- */
313
- function destroy() {
314
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
315
- }
316
- createDebug.enable(createDebug.load());
317
- return createDebug;
318
- }
319
- module.exports = setup;
320
- }));
321
- //#endregion
322
- //#region ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js
323
- var require_browser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
324
- /**
325
- * This is the web browser implementation of `debug()`.
326
- */
327
- exports.formatArgs = formatArgs;
328
- exports.save = save;
329
- exports.load = load;
330
- exports.useColors = useColors;
331
- exports.storage = localstorage();
332
- exports.destroy = (() => {
333
- let warned = false;
334
- return () => {
335
- if (!warned) {
336
- warned = true;
337
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
338
- }
339
- };
340
- })();
341
- /**
342
- * Colors.
343
- */
344
- exports.colors = [
345
- "#0000CC",
346
- "#0000FF",
347
- "#0033CC",
348
- "#0033FF",
349
- "#0066CC",
350
- "#0066FF",
351
- "#0099CC",
352
- "#0099FF",
353
- "#00CC00",
354
- "#00CC33",
355
- "#00CC66",
356
- "#00CC99",
357
- "#00CCCC",
358
- "#00CCFF",
359
- "#3300CC",
360
- "#3300FF",
361
- "#3333CC",
362
- "#3333FF",
363
- "#3366CC",
364
- "#3366FF",
365
- "#3399CC",
366
- "#3399FF",
367
- "#33CC00",
368
- "#33CC33",
369
- "#33CC66",
370
- "#33CC99",
371
- "#33CCCC",
372
- "#33CCFF",
373
- "#6600CC",
374
- "#6600FF",
375
- "#6633CC",
376
- "#6633FF",
377
- "#66CC00",
378
- "#66CC33",
379
- "#9900CC",
380
- "#9900FF",
381
- "#9933CC",
382
- "#9933FF",
383
- "#99CC00",
384
- "#99CC33",
385
- "#CC0000",
386
- "#CC0033",
387
- "#CC0066",
388
- "#CC0099",
389
- "#CC00CC",
390
- "#CC00FF",
391
- "#CC3300",
392
- "#CC3333",
393
- "#CC3366",
394
- "#CC3399",
395
- "#CC33CC",
396
- "#CC33FF",
397
- "#CC6600",
398
- "#CC6633",
399
- "#CC9900",
400
- "#CC9933",
401
- "#CCCC00",
402
- "#CCCC33",
403
- "#FF0000",
404
- "#FF0033",
405
- "#FF0066",
406
- "#FF0099",
407
- "#FF00CC",
408
- "#FF00FF",
409
- "#FF3300",
410
- "#FF3333",
411
- "#FF3366",
412
- "#FF3399",
413
- "#FF33CC",
414
- "#FF33FF",
415
- "#FF6600",
416
- "#FF6633",
417
- "#FF9900",
418
- "#FF9933",
419
- "#FFCC00",
420
- "#FFCC33"
421
- ];
422
- /**
423
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
424
- * and the Firebug extension (any Firefox version) are known
425
- * to support "%c" CSS customizations.
426
- *
427
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
428
- */
429
- function useColors() {
430
- if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return true;
431
- if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
432
- let m;
433
- return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
434
- }
435
- /**
436
- * Colorize log arguments if enabled.
437
- *
438
- * @api public
439
- */
440
- function formatArgs(args) {
441
- args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
442
- if (!this.useColors) return;
443
- const c = "color: " + this.color;
444
- args.splice(1, 0, c, "color: inherit");
445
- let index = 0;
446
- let lastC = 0;
447
- args[0].replace(/%[a-zA-Z%]/g, (match) => {
448
- if (match === "%%") return;
449
- index++;
450
- if (match === "%c") lastC = index;
451
- });
452
- args.splice(lastC, 0, c);
453
- }
454
- /**
455
- * Invokes `console.debug()` when available.
456
- * No-op when `console.debug` is not a "function".
457
- * If `console.debug` is not available, falls back
458
- * to `console.log`.
459
- *
460
- * @api public
461
- */
462
- exports.log = console.debug || console.log || (() => {});
463
- /**
464
- * Save `namespaces`.
465
- *
466
- * @param {String} namespaces
467
- * @api private
468
- */
469
- function save(namespaces) {
470
- try {
471
- if (namespaces) exports.storage.setItem("debug", namespaces);
472
- else exports.storage.removeItem("debug");
473
- } catch (error) {}
474
- }
475
- /**
476
- * Load `namespaces`.
477
- *
478
- * @return {String} returns the previously persisted debug modes
479
- * @api private
480
- */
481
- function load() {
482
- let r;
483
- try {
484
- r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
485
- } catch (error) {}
486
- if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
487
- return r;
488
- }
489
- /**
490
- * Localstorage attempts to return the localstorage.
491
- *
492
- * This is necessary because safari throws
493
- * when a user disables cookies/localstorage
494
- * and you attempt to access it.
495
- *
496
- * @return {LocalStorage}
497
- * @api private
498
- */
499
- function localstorage() {
500
- try {
501
- return localStorage;
502
- } catch (error) {}
503
- }
504
- module.exports = require_common()(exports);
505
- const { formatters } = module.exports;
506
- /**
507
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
508
- */
509
- formatters.j = function(v) {
510
- try {
511
- return JSON.stringify(v);
512
- } catch (error) {
513
- return "[UnexpectedJSONParseError]: " + error.message;
514
- }
515
- };
516
- }));
517
- //#endregion
518
- //#region ../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js
519
- var require_has_flag = /* @__PURE__ */ __commonJSMin(((exports, module) => {
520
- module.exports = (flag, argv = process.argv) => {
521
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
522
- const position = argv.indexOf(prefix + flag);
523
- const terminatorPosition = argv.indexOf("--");
524
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
525
- };
526
- }));
527
- //#endregion
528
- //#region ../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js
529
- var require_supports_color = /* @__PURE__ */ __commonJSMin(((exports, module) => {
530
- const os = __require("os");
531
- const tty$1 = __require("tty");
532
- const hasFlag = require_has_flag();
533
- const { env } = process;
534
- let forceColor;
535
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) forceColor = 0;
536
- else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = 1;
537
- if ("FORCE_COLOR" in env) if (env.FORCE_COLOR === "true") forceColor = 1;
538
- else if (env.FORCE_COLOR === "false") forceColor = 0;
539
- else forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
540
- function translateLevel(level) {
541
- if (level === 0) return false;
542
- return {
543
- level,
544
- hasBasic: true,
545
- has256: level >= 2,
546
- has16m: level >= 3
547
- };
548
- }
549
- function supportsColor(haveStream, streamIsTTY) {
550
- if (forceColor === 0) return 0;
551
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
552
- if (hasFlag("color=256")) return 2;
553
- if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
554
- const min = forceColor || 0;
555
- if (env.TERM === "dumb") return min;
556
- if (process.platform === "win32") {
557
- const osRelease = os.release().split(".");
558
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
559
- return 1;
560
- }
561
- if ("CI" in env) {
562
- if ([
563
- "TRAVIS",
564
- "CIRCLECI",
565
- "APPVEYOR",
566
- "GITLAB_CI",
567
- "GITHUB_ACTIONS",
568
- "BUILDKITE"
569
- ].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
570
- return min;
571
- }
572
- if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
573
- if (env.COLORTERM === "truecolor") return 3;
574
- if ("TERM_PROGRAM" in env) {
575
- const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
576
- switch (env.TERM_PROGRAM) {
577
- case "iTerm.app": return version >= 3 ? 3 : 2;
578
- case "Apple_Terminal": return 2;
579
- }
580
- }
581
- if (/-256(color)?$/i.test(env.TERM)) return 2;
582
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
583
- if ("COLORTERM" in env) return 1;
584
- return min;
585
- }
586
- function getSupportLevel(stream) {
587
- return translateLevel(supportsColor(stream, stream && stream.isTTY));
588
- }
589
- module.exports = {
590
- supportsColor: getSupportLevel,
591
- stdout: translateLevel(supportsColor(true, tty$1.isatty(1))),
592
- stderr: translateLevel(supportsColor(true, tty$1.isatty(2)))
593
- };
594
- }));
595
- //#endregion
596
- //#region ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.js
597
- var require_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
598
- /**
599
- * Module dependencies.
600
- */
601
- const tty = __require("tty");
602
- const util = __require("util");
603
- /**
604
- * This is the Node.js implementation of `debug()`.
605
- */
606
- exports.init = init;
607
- exports.log = log;
608
- exports.formatArgs = formatArgs;
609
- exports.save = save;
610
- exports.load = load;
611
- exports.useColors = useColors;
612
- exports.destroy = util.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
613
- /**
614
- * Colors.
615
- */
616
- exports.colors = [
617
- 6,
618
- 2,
619
- 3,
620
- 4,
621
- 5,
622
- 1
623
- ];
624
- try {
625
- const supportsColor = require_supports_color();
626
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
627
- 20,
628
- 21,
629
- 26,
630
- 27,
631
- 32,
632
- 33,
633
- 38,
634
- 39,
635
- 40,
636
- 41,
637
- 42,
638
- 43,
639
- 44,
640
- 45,
641
- 56,
642
- 57,
643
- 62,
644
- 63,
645
- 68,
646
- 69,
647
- 74,
648
- 75,
649
- 76,
650
- 77,
651
- 78,
652
- 79,
653
- 80,
654
- 81,
655
- 92,
656
- 93,
657
- 98,
658
- 99,
659
- 112,
660
- 113,
661
- 128,
662
- 129,
663
- 134,
664
- 135,
665
- 148,
666
- 149,
667
- 160,
668
- 161,
669
- 162,
670
- 163,
671
- 164,
672
- 165,
673
- 166,
674
- 167,
675
- 168,
676
- 169,
677
- 170,
678
- 171,
679
- 172,
680
- 173,
681
- 178,
682
- 179,
683
- 184,
684
- 185,
685
- 196,
686
- 197,
687
- 198,
688
- 199,
689
- 200,
690
- 201,
691
- 202,
692
- 203,
693
- 204,
694
- 205,
695
- 206,
696
- 207,
697
- 208,
698
- 209,
699
- 214,
700
- 215,
701
- 220,
702
- 221
703
- ];
704
- } catch (error) {}
705
- /**
706
- * Build up the default `inspectOpts` object from the environment variables.
707
- *
708
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
709
- */
710
- exports.inspectOpts = Object.keys(process.env).filter((key) => {
711
- return /^debug_/i.test(key);
712
- }).reduce((obj, key) => {
713
- const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
714
- return k.toUpperCase();
715
- });
716
- let val = process.env[key];
717
- if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
718
- else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
719
- else if (val === "null") val = null;
720
- else val = Number(val);
721
- obj[prop] = val;
722
- return obj;
723
- }, {});
724
- /**
725
- * Is stdout a TTY? Colored output is enabled when `true`.
726
- */
727
- function useColors() {
728
- return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
729
- }
730
- /**
731
- * Adds ANSI color escape codes if enabled.
732
- *
733
- * @api public
734
- */
735
- function formatArgs(args) {
736
- const { namespace: name, useColors } = this;
737
- if (useColors) {
738
- const c = this.color;
739
- const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
740
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
741
- args[0] = prefix + args[0].split("\n").join("\n" + prefix);
742
- args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
743
- } else args[0] = getDate() + name + " " + args[0];
744
- }
745
- function getDate() {
746
- if (exports.inspectOpts.hideDate) return "";
747
- return (/* @__PURE__ */ new Date()).toISOString() + " ";
748
- }
749
- /**
750
- * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
751
- */
752
- function log(...args) {
753
- return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
754
- }
755
- /**
756
- * Save `namespaces`.
757
- *
758
- * @param {String} namespaces
759
- * @api private
760
- */
761
- function save(namespaces) {
762
- if (namespaces) process.env.DEBUG = namespaces;
763
- else delete process.env.DEBUG;
764
- }
765
- /**
766
- * Load `namespaces`.
767
- *
768
- * @return {String} returns the previously persisted debug modes
769
- * @api private
770
- */
771
- function load() {
772
- return process.env.DEBUG;
773
- }
774
- /**
775
- * Init logic for `debug` instances.
776
- *
777
- * Create a new `inspectOpts` object in case `useColors` is set
778
- * differently for a particular `debug` instance.
779
- */
780
- function init(debug) {
781
- debug.inspectOpts = {};
782
- const keys = Object.keys(exports.inspectOpts);
783
- for (let i = 0; i < keys.length; i++) debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
784
- }
785
- module.exports = require_common()(exports);
786
- const { formatters } = module.exports;
787
- /**
788
- * Map %o to `util.inspect()`, all on a single line.
789
- */
790
- formatters.o = function(v) {
791
- this.inspectOpts.colors = this.useColors;
792
- return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
793
- };
794
- /**
795
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
796
- */
797
- formatters.O = function(v) {
798
- this.inspectOpts.colors = this.useColors;
799
- return util.inspect(v, this.inspectOpts);
800
- };
801
- }));
802
- //#endregion
803
- //#region ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js
804
- var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
805
- /**
806
- * Detect Electron renderer / nwjs process, which is node, but we should
807
- * treat as a browser.
808
- */
809
- if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) module.exports = require_browser();
810
- else module.exports = require_node();
811
- }));
812
- //#endregion
813
- //#region ../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js
814
- var require_helpers = /* @__PURE__ */ __commonJSMin(((exports) => {
815
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
816
- if (k2 === void 0) k2 = k;
817
- var desc = Object.getOwnPropertyDescriptor(m, k);
818
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
819
- enumerable: true,
820
- get: function() {
821
- return m[k];
822
- }
823
- };
824
- Object.defineProperty(o, k2, desc);
825
- }) : (function(o, m, k, k2) {
826
- if (k2 === void 0) k2 = k;
827
- o[k2] = m[k];
828
- }));
829
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
830
- Object.defineProperty(o, "default", {
831
- enumerable: true,
832
- value: v
833
- });
834
- }) : function(o, v) {
835
- o["default"] = v;
836
- });
837
- var __importStar = exports && exports.__importStar || function(mod) {
838
- if (mod && mod.__esModule) return mod;
839
- var result = {};
840
- if (mod != null) {
841
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
842
- }
843
- __setModuleDefault(result, mod);
844
- return result;
845
- };
846
- Object.defineProperty(exports, "__esModule", { value: true });
847
- exports.req = exports.json = exports.toBuffer = void 0;
848
- const http$1 = __importStar(__require("http"));
849
- const https = __importStar(__require("https"));
850
- async function toBuffer(stream) {
851
- let length = 0;
852
- const chunks = [];
853
- for await (const chunk of stream) {
854
- length += chunk.length;
855
- chunks.push(chunk);
856
- }
857
- return Buffer.concat(chunks, length);
858
- }
859
- exports.toBuffer = toBuffer;
860
- async function json(stream) {
861
- const str = (await toBuffer(stream)).toString("utf8");
862
- try {
863
- return JSON.parse(str);
864
- } catch (_err) {
865
- const err = _err;
866
- err.message += ` (input: ${str})`;
867
- throw err;
868
- }
869
- }
870
- exports.json = json;
871
- function req(url, opts = {}) {
872
- const req = ((typeof url === "string" ? url : url.href).startsWith("https:") ? https : http$1).request(url, opts);
873
- const promise = new Promise((resolve, reject) => {
874
- req.once("response", resolve).once("error", reject).end();
875
- });
876
- req.then = promise.then.bind(promise);
877
- return req;
878
- }
879
- exports.req = req;
880
- }));
881
- //#endregion
882
- //#region ../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js
883
- var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
884
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
885
- if (k2 === void 0) k2 = k;
886
- var desc = Object.getOwnPropertyDescriptor(m, k);
887
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
888
- enumerable: true,
889
- get: function() {
890
- return m[k];
891
- }
892
- };
893
- Object.defineProperty(o, k2, desc);
894
- }) : (function(o, m, k, k2) {
895
- if (k2 === void 0) k2 = k;
896
- o[k2] = m[k];
897
- }));
898
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
899
- Object.defineProperty(o, "default", {
900
- enumerable: true,
901
- value: v
902
- });
903
- }) : function(o, v) {
904
- o["default"] = v;
905
- });
906
- var __importStar = exports && exports.__importStar || function(mod) {
907
- if (mod && mod.__esModule) return mod;
908
- var result = {};
909
- if (mod != null) {
910
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
911
- }
912
- __setModuleDefault(result, mod);
913
- return result;
914
- };
915
- var __exportStar = exports && exports.__exportStar || function(m, exports$1) {
916
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
917
- };
918
- Object.defineProperty(exports, "__esModule", { value: true });
919
- exports.Agent = void 0;
920
- const net$1 = __importStar(__require("net"));
921
- const http = __importStar(__require("http"));
922
- const https_1 = __require("https");
923
- __exportStar(require_helpers(), exports);
924
- const INTERNAL = Symbol("AgentBaseInternalState");
925
- var Agent = class extends http.Agent {
926
- constructor(opts) {
927
- super(opts);
928
- this[INTERNAL] = {};
929
- }
930
- /**
931
- * Determine whether this is an `http` or `https` request.
932
- */
933
- isSecureEndpoint(options) {
934
- if (options) {
935
- if (typeof options.secureEndpoint === "boolean") return options.secureEndpoint;
936
- if (typeof options.protocol === "string") return options.protocol === "https:";
937
- }
938
- const { stack } = /* @__PURE__ */ new Error();
939
- if (typeof stack !== "string") return false;
940
- return stack.split("\n").some((l) => l.indexOf("(https.js:") !== -1 || l.indexOf("node:https:") !== -1);
941
- }
942
- incrementSockets(name) {
943
- if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) return null;
944
- if (!this.sockets[name]) this.sockets[name] = [];
945
- const fakeSocket = new net$1.Socket({ writable: false });
946
- this.sockets[name].push(fakeSocket);
947
- this.totalSocketCount++;
948
- return fakeSocket;
949
- }
950
- decrementSockets(name, socket) {
951
- if (!this.sockets[name] || socket === null) return;
952
- const sockets = this.sockets[name];
953
- const index = sockets.indexOf(socket);
954
- if (index !== -1) {
955
- sockets.splice(index, 1);
956
- this.totalSocketCount--;
957
- if (sockets.length === 0) delete this.sockets[name];
958
- }
959
- }
960
- getName(options) {
961
- if (this.isSecureEndpoint(options)) return https_1.Agent.prototype.getName.call(this, options);
962
- return super.getName(options);
963
- }
964
- createSocket(req, options, cb) {
965
- const connectOpts = {
966
- ...options,
967
- secureEndpoint: this.isSecureEndpoint(options)
968
- };
969
- const name = this.getName(connectOpts);
970
- const fakeSocket = this.incrementSockets(name);
971
- Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
972
- this.decrementSockets(name, fakeSocket);
973
- if (socket instanceof http.Agent) try {
974
- return socket.addRequest(req, connectOpts);
975
- } catch (err) {
976
- return cb(err);
977
- }
978
- this[INTERNAL].currentSocket = socket;
979
- super.createSocket(req, options, cb);
980
- }, (err) => {
981
- this.decrementSockets(name, fakeSocket);
982
- cb(err);
983
- });
984
- }
985
- createConnection() {
986
- const socket = this[INTERNAL].currentSocket;
987
- this[INTERNAL].currentSocket = void 0;
988
- if (!socket) throw new Error("No socket was returned in the `connect()` function");
989
- return socket;
990
- }
991
- get defaultPort() {
992
- return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
993
- }
994
- set defaultPort(v) {
995
- if (this[INTERNAL]) this[INTERNAL].defaultPort = v;
996
- }
997
- get protocol() {
998
- return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
999
- }
1000
- set protocol(v) {
1001
- if (this[INTERNAL]) this[INTERNAL].protocol = v;
1002
- }
1003
- };
1004
- exports.Agent = Agent;
1005
- }));
1006
- //#endregion
1007
- //#region ../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/parse-proxy-response.js
1008
- var require_parse_proxy_response = /* @__PURE__ */ __commonJSMin(((exports) => {
1009
- var __importDefault = exports && exports.__importDefault || function(mod) {
1010
- return mod && mod.__esModule ? mod : { "default": mod };
1011
- };
1012
- Object.defineProperty(exports, "__esModule", { value: true });
1013
- exports.parseProxyResponse = void 0;
1014
- const debug = (0, __importDefault(require_src()).default)("https-proxy-agent:parse-proxy-response");
1015
- function parseProxyResponse(socket) {
1016
- return new Promise((resolve, reject) => {
1017
- let buffersLength = 0;
1018
- const buffers = [];
1019
- function read() {
1020
- const b = socket.read();
1021
- if (b) ondata(b);
1022
- else socket.once("readable", read);
1023
- }
1024
- function cleanup() {
1025
- socket.removeListener("end", onend);
1026
- socket.removeListener("error", onerror);
1027
- socket.removeListener("readable", read);
1028
- }
1029
- function onend() {
1030
- cleanup();
1031
- debug("onend");
1032
- reject(/* @__PURE__ */ new Error("Proxy connection ended before receiving CONNECT response"));
1033
- }
1034
- function onerror(err) {
1035
- cleanup();
1036
- debug("onerror %o", err);
1037
- reject(err);
1038
- }
1039
- function ondata(b) {
1040
- buffers.push(b);
1041
- buffersLength += b.length;
1042
- const buffered = Buffer.concat(buffers, buffersLength);
1043
- const endOfHeaders = buffered.indexOf("\r\n\r\n");
1044
- if (endOfHeaders === -1) {
1045
- debug("have not received end of HTTP headers yet...");
1046
- read();
1047
- return;
1048
- }
1049
- const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
1050
- const firstLine = headerParts.shift();
1051
- if (!firstLine) {
1052
- socket.destroy();
1053
- return reject(/* @__PURE__ */ new Error("No header received from proxy CONNECT response"));
1054
- }
1055
- const firstLineParts = firstLine.split(" ");
1056
- const statusCode = +firstLineParts[1];
1057
- const statusText = firstLineParts.slice(2).join(" ");
1058
- const headers = {};
1059
- for (const header of headerParts) {
1060
- if (!header) continue;
1061
- const firstColon = header.indexOf(":");
1062
- if (firstColon === -1) {
1063
- socket.destroy();
1064
- return reject(/* @__PURE__ */ new Error(`Invalid header from proxy CONNECT response: "${header}"`));
1065
- }
1066
- const key = header.slice(0, firstColon).toLowerCase();
1067
- const value = header.slice(firstColon + 1).trimStart();
1068
- const current = headers[key];
1069
- if (typeof current === "string") headers[key] = [current, value];
1070
- else if (Array.isArray(current)) current.push(value);
1071
- else headers[key] = value;
1072
- }
1073
- debug("got proxy server response: %o %o", firstLine, headers);
1074
- cleanup();
1075
- resolve({
1076
- connect: {
1077
- statusCode,
1078
- statusText,
1079
- headers
1080
- },
1081
- buffered
1082
- });
1083
- }
1084
- socket.on("error", onerror);
1085
- socket.on("end", onend);
1086
- read();
1087
- });
1088
- }
1089
- exports.parseProxyResponse = parseProxyResponse;
1090
- }));
1091
- //#endregion
1092
- //#region ../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js
1093
- var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
1094
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
1095
- if (k2 === void 0) k2 = k;
1096
- var desc = Object.getOwnPropertyDescriptor(m, k);
1097
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
1098
- enumerable: true,
1099
- get: function() {
1100
- return m[k];
1101
- }
1102
- };
1103
- Object.defineProperty(o, k2, desc);
1104
- }) : (function(o, m, k, k2) {
1105
- if (k2 === void 0) k2 = k;
1106
- o[k2] = m[k];
1107
- }));
1108
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
1109
- Object.defineProperty(o, "default", {
1110
- enumerable: true,
1111
- value: v
1112
- });
1113
- }) : function(o, v) {
1114
- o["default"] = v;
1115
- });
1116
- var __importStar = exports && exports.__importStar || function(mod) {
1117
- if (mod && mod.__esModule) return mod;
1118
- var result = {};
1119
- if (mod != null) {
1120
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1121
- }
1122
- __setModuleDefault(result, mod);
1123
- return result;
1124
- };
1125
- var __importDefault = exports && exports.__importDefault || function(mod) {
1126
- return mod && mod.__esModule ? mod : { "default": mod };
1127
- };
1128
- Object.defineProperty(exports, "__esModule", { value: true });
1129
- exports.HttpsProxyAgent = void 0;
1130
- const net = __importStar(__require("net"));
1131
- const tls = __importStar(__require("tls"));
1132
- const assert_1 = __importDefault(__require("assert"));
1133
- const debug_1 = __importDefault(require_src());
1134
- const agent_base_1 = require_dist$1();
1135
- const url_1 = __require("url");
1136
- const parse_proxy_response_1 = require_parse_proxy_response();
1137
- const debug = (0, debug_1.default)("https-proxy-agent");
1138
- const setServernameFromNonIpHost = (options) => {
1139
- if (options.servername === void 0 && options.host && !net.isIP(options.host)) return {
1140
- ...options,
1141
- servername: options.host
1142
- };
1143
- return options;
1144
- };
1145
- /**
1146
- * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
1147
- * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
1148
- *
1149
- * Outgoing HTTP requests are first tunneled through the proxy server using the
1150
- * `CONNECT` HTTP request method to establish a connection to the proxy server,
1151
- * and then the proxy server connects to the destination target and issues the
1152
- * HTTP request from the proxy server.
1153
- *
1154
- * `https:` requests have their socket connection upgraded to TLS once
1155
- * the connection to the proxy server has been established.
1156
- */
1157
- var HttpsProxyAgent = class extends agent_base_1.Agent {
1158
- constructor(proxy, opts) {
1159
- super(opts);
1160
- this.options = { path: void 0 };
1161
- this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
1162
- this.proxyHeaders = opts?.headers ?? {};
1163
- debug("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
1164
- const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
1165
- const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
1166
- this.connectOpts = {
1167
- ALPNProtocols: ["http/1.1"],
1168
- ...opts ? omit(opts, "headers") : null,
1169
- host,
1170
- port
1171
- };
1172
- }
1173
- /**
1174
- * Called when the node-core HTTP client library is creating a
1175
- * new HTTP request.
1176
- */
1177
- async connect(req, opts) {
1178
- const { proxy } = this;
1179
- if (!opts.host) throw new TypeError("No \"host\" provided");
1180
- let socket;
1181
- if (proxy.protocol === "https:") {
1182
- debug("Creating `tls.Socket`: %o", this.connectOpts);
1183
- socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
1184
- } else {
1185
- debug("Creating `net.Socket`: %o", this.connectOpts);
1186
- socket = net.connect(this.connectOpts);
1187
- }
1188
- const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
1189
- const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
1190
- let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r\n`;
1191
- if (proxy.username || proxy.password) {
1192
- const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
1193
- headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
1194
- }
1195
- headers.Host = `${host}:${opts.port}`;
1196
- if (!headers["Proxy-Connection"]) headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
1197
- for (const name of Object.keys(headers)) payload += `${name}: ${headers[name]}\r\n`;
1198
- const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
1199
- socket.write(`${payload}\r\n`);
1200
- const { connect, buffered } = await proxyResponsePromise;
1201
- req.emit("proxyConnect", connect);
1202
- this.emit("proxyConnect", connect, req);
1203
- if (connect.statusCode === 200) {
1204
- req.once("socket", resume);
1205
- if (opts.secureEndpoint) {
1206
- debug("Upgrading socket connection to TLS");
1207
- return tls.connect({
1208
- ...omit(setServernameFromNonIpHost(opts), "host", "path", "port"),
1209
- socket
1210
- });
1211
- }
1212
- return socket;
1213
- }
1214
- socket.destroy();
1215
- const fakeSocket = new net.Socket({ writable: false });
1216
- fakeSocket.readable = true;
1217
- req.once("socket", (s) => {
1218
- debug("Replaying proxy buffer for failed request");
1219
- (0, assert_1.default)(s.listenerCount("data") > 0);
1220
- s.push(buffered);
1221
- s.push(null);
1222
- });
1223
- return fakeSocket;
1224
- }
1225
- };
1226
- HttpsProxyAgent.protocols = ["http", "https"];
1227
- exports.HttpsProxyAgent = HttpsProxyAgent;
1228
- function resume(socket) {
1229
- socket.resume();
1230
- }
1231
- function omit(obj, ...keys) {
1232
- const ret = {};
1233
- let key;
1234
- for (key in obj) if (!keys.includes(key)) ret[key] = obj[key];
1235
- return ret;
1236
- }
1237
- }));
1238
- //#endregion
1239
- export { require_ms as i, require_dist$1 as n, require_src as r, require_dist as t };