@coana-tech/cli 14.12.43 → 14.12.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli.mjs CHANGED
@@ -47599,8 +47599,340 @@ var require_es_set_tostringtag = __commonJS({
47599
47599
  }
47600
47600
  });
47601
47601
 
47602
- // ../../node_modules/.pnpm/form-data@4.0.2/node_modules/form-data/lib/populate.js
47602
+ // ../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/populate.js
47603
47603
  var require_populate = __commonJS({
47604
+ "../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/populate.js"(exports2, module2) {
47605
+ "use strict";
47606
+ module2.exports = function(dst, src) {
47607
+ Object.keys(src).forEach(function(prop2) {
47608
+ dst[prop2] = dst[prop2] || src[prop2];
47609
+ });
47610
+ return dst;
47611
+ };
47612
+ }
47613
+ });
47614
+
47615
+ // ../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/form_data.js
47616
+ var require_form_data = __commonJS({
47617
+ "../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/form_data.js"(exports2, module2) {
47618
+ "use strict";
47619
+ var CombinedStream = require_combined_stream();
47620
+ var util5 = __require("util");
47621
+ var path2 = __require("path");
47622
+ var http2 = __require("http");
47623
+ var https2 = __require("https");
47624
+ var parseUrl = __require("url").parse;
47625
+ var fs = __require("fs");
47626
+ var Stream2 = __require("stream").Stream;
47627
+ var crypto7 = __require("crypto");
47628
+ var mime = require_mime_types();
47629
+ var asynckit = require_asynckit();
47630
+ var setToStringTag = require_es_set_tostringtag();
47631
+ var hasOwn2 = require_hasown();
47632
+ var populate = require_populate();
47633
+ function FormData4(options) {
47634
+ if (!(this instanceof FormData4)) {
47635
+ return new FormData4(options);
47636
+ }
47637
+ this._overheadLength = 0;
47638
+ this._valueLength = 0;
47639
+ this._valuesToMeasure = [];
47640
+ CombinedStream.call(this);
47641
+ options = options || {};
47642
+ for (var option in options) {
47643
+ this[option] = options[option];
47644
+ }
47645
+ }
47646
+ util5.inherits(FormData4, CombinedStream);
47647
+ FormData4.LINE_BREAK = "\r\n";
47648
+ FormData4.DEFAULT_CONTENT_TYPE = "application/octet-stream";
47649
+ FormData4.prototype.append = function(field, value, options) {
47650
+ options = options || {};
47651
+ if (typeof options === "string") {
47652
+ options = { filename: options };
47653
+ }
47654
+ var append4 = CombinedStream.prototype.append.bind(this);
47655
+ if (typeof value === "number" || value == null) {
47656
+ value = String(value);
47657
+ }
47658
+ if (Array.isArray(value)) {
47659
+ this._error(new Error("Arrays are not supported."));
47660
+ return;
47661
+ }
47662
+ var header = this._multiPartHeader(field, value, options);
47663
+ var footer = this._multiPartFooter();
47664
+ append4(header);
47665
+ append4(value);
47666
+ append4(footer);
47667
+ this._trackLength(header, value, options);
47668
+ };
47669
+ FormData4.prototype._trackLength = function(header, value, options) {
47670
+ var valueLength = 0;
47671
+ if (options.knownLength != null) {
47672
+ valueLength += Number(options.knownLength);
47673
+ } else if (Buffer.isBuffer(value)) {
47674
+ valueLength = value.length;
47675
+ } else if (typeof value === "string") {
47676
+ valueLength = Buffer.byteLength(value);
47677
+ }
47678
+ this._valueLength += valueLength;
47679
+ this._overheadLength += Buffer.byteLength(header) + FormData4.LINE_BREAK.length;
47680
+ if (!value || !value.path && !(value.readable && hasOwn2(value, "httpVersion")) && !(value instanceof Stream2)) {
47681
+ return;
47682
+ }
47683
+ if (!options.knownLength) {
47684
+ this._valuesToMeasure.push(value);
47685
+ }
47686
+ };
47687
+ FormData4.prototype._lengthRetriever = function(value, callback) {
47688
+ if (hasOwn2(value, "fd")) {
47689
+ if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
47690
+ callback(null, value.end + 1 - (value.start ? value.start : 0));
47691
+ } else {
47692
+ fs.stat(value.path, function(err, stat4) {
47693
+ if (err) {
47694
+ callback(err);
47695
+ return;
47696
+ }
47697
+ var fileSize = stat4.size - (value.start ? value.start : 0);
47698
+ callback(null, fileSize);
47699
+ });
47700
+ }
47701
+ } else if (hasOwn2(value, "httpVersion")) {
47702
+ callback(null, Number(value.headers["content-length"]));
47703
+ } else if (hasOwn2(value, "httpModule")) {
47704
+ value.on("response", function(response) {
47705
+ value.pause();
47706
+ callback(null, Number(response.headers["content-length"]));
47707
+ });
47708
+ value.resume();
47709
+ } else {
47710
+ callback("Unknown stream");
47711
+ }
47712
+ };
47713
+ FormData4.prototype._multiPartHeader = function(field, value, options) {
47714
+ if (typeof options.header === "string") {
47715
+ return options.header;
47716
+ }
47717
+ var contentDisposition = this._getContentDisposition(value, options);
47718
+ var contentType = this._getContentType(value, options);
47719
+ var contents2 = "";
47720
+ var headers = {
47721
+ // add custom disposition as third element or keep it two elements if not
47722
+ "Content-Disposition": ["form-data", 'name="' + field + '"'].concat(contentDisposition || []),
47723
+ // if no content type. allow it to be empty array
47724
+ "Content-Type": [].concat(contentType || [])
47725
+ };
47726
+ if (typeof options.header === "object") {
47727
+ populate(headers, options.header);
47728
+ }
47729
+ var header;
47730
+ for (var prop2 in headers) {
47731
+ if (hasOwn2(headers, prop2)) {
47732
+ header = headers[prop2];
47733
+ if (header == null) {
47734
+ continue;
47735
+ }
47736
+ if (!Array.isArray(header)) {
47737
+ header = [header];
47738
+ }
47739
+ if (header.length) {
47740
+ contents2 += prop2 + ": " + header.join("; ") + FormData4.LINE_BREAK;
47741
+ }
47742
+ }
47743
+ }
47744
+ return "--" + this.getBoundary() + FormData4.LINE_BREAK + contents2 + FormData4.LINE_BREAK;
47745
+ };
47746
+ FormData4.prototype._getContentDisposition = function(value, options) {
47747
+ var filename;
47748
+ if (typeof options.filepath === "string") {
47749
+ filename = path2.normalize(options.filepath).replace(/\\/g, "/");
47750
+ } else if (options.filename || value && (value.name || value.path)) {
47751
+ filename = path2.basename(options.filename || value && (value.name || value.path));
47752
+ } else if (value && value.readable && hasOwn2(value, "httpVersion")) {
47753
+ filename = path2.basename(value.client._httpMessage.path || "");
47754
+ }
47755
+ if (filename) {
47756
+ return 'filename="' + filename + '"';
47757
+ }
47758
+ };
47759
+ FormData4.prototype._getContentType = function(value, options) {
47760
+ var contentType = options.contentType;
47761
+ if (!contentType && value && value.name) {
47762
+ contentType = mime.lookup(value.name);
47763
+ }
47764
+ if (!contentType && value && value.path) {
47765
+ contentType = mime.lookup(value.path);
47766
+ }
47767
+ if (!contentType && value && value.readable && hasOwn2(value, "httpVersion")) {
47768
+ contentType = value.headers["content-type"];
47769
+ }
47770
+ if (!contentType && (options.filepath || options.filename)) {
47771
+ contentType = mime.lookup(options.filepath || options.filename);
47772
+ }
47773
+ if (!contentType && value && typeof value === "object") {
47774
+ contentType = FormData4.DEFAULT_CONTENT_TYPE;
47775
+ }
47776
+ return contentType;
47777
+ };
47778
+ FormData4.prototype._multiPartFooter = function() {
47779
+ return function(next2) {
47780
+ var footer = FormData4.LINE_BREAK;
47781
+ var lastPart = this._streams.length === 0;
47782
+ if (lastPart) {
47783
+ footer += this._lastBoundary();
47784
+ }
47785
+ next2(footer);
47786
+ }.bind(this);
47787
+ };
47788
+ FormData4.prototype._lastBoundary = function() {
47789
+ return "--" + this.getBoundary() + "--" + FormData4.LINE_BREAK;
47790
+ };
47791
+ FormData4.prototype.getHeaders = function(userHeaders) {
47792
+ var header;
47793
+ var formHeaders = {
47794
+ "content-type": "multipart/form-data; boundary=" + this.getBoundary()
47795
+ };
47796
+ for (header in userHeaders) {
47797
+ if (hasOwn2(userHeaders, header)) {
47798
+ formHeaders[header.toLowerCase()] = userHeaders[header];
47799
+ }
47800
+ }
47801
+ return formHeaders;
47802
+ };
47803
+ FormData4.prototype.setBoundary = function(boundary) {
47804
+ if (typeof boundary !== "string") {
47805
+ throw new TypeError("FormData boundary must be a string");
47806
+ }
47807
+ this._boundary = boundary;
47808
+ };
47809
+ FormData4.prototype.getBoundary = function() {
47810
+ if (!this._boundary) {
47811
+ this._generateBoundary();
47812
+ }
47813
+ return this._boundary;
47814
+ };
47815
+ FormData4.prototype.getBuffer = function() {
47816
+ var dataBuffer = new Buffer.alloc(0);
47817
+ var boundary = this.getBoundary();
47818
+ for (var i7 = 0, len = this._streams.length; i7 < len; i7++) {
47819
+ if (typeof this._streams[i7] !== "function") {
47820
+ if (Buffer.isBuffer(this._streams[i7])) {
47821
+ dataBuffer = Buffer.concat([dataBuffer, this._streams[i7]]);
47822
+ } else {
47823
+ dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i7])]);
47824
+ }
47825
+ if (typeof this._streams[i7] !== "string" || this._streams[i7].substring(2, boundary.length + 2) !== boundary) {
47826
+ dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData4.LINE_BREAK)]);
47827
+ }
47828
+ }
47829
+ }
47830
+ return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
47831
+ };
47832
+ FormData4.prototype._generateBoundary = function() {
47833
+ this._boundary = "--------------------------" + crypto7.randomBytes(12).toString("hex");
47834
+ };
47835
+ FormData4.prototype.getLengthSync = function() {
47836
+ var knownLength = this._overheadLength + this._valueLength;
47837
+ if (this._streams.length) {
47838
+ knownLength += this._lastBoundary().length;
47839
+ }
47840
+ if (!this.hasKnownLength()) {
47841
+ this._error(new Error("Cannot calculate proper length in synchronous way."));
47842
+ }
47843
+ return knownLength;
47844
+ };
47845
+ FormData4.prototype.hasKnownLength = function() {
47846
+ var hasKnownLength = true;
47847
+ if (this._valuesToMeasure.length) {
47848
+ hasKnownLength = false;
47849
+ }
47850
+ return hasKnownLength;
47851
+ };
47852
+ FormData4.prototype.getLength = function(cb) {
47853
+ var knownLength = this._overheadLength + this._valueLength;
47854
+ if (this._streams.length) {
47855
+ knownLength += this._lastBoundary().length;
47856
+ }
47857
+ if (!this._valuesToMeasure.length) {
47858
+ process.nextTick(cb.bind(this, null, knownLength));
47859
+ return;
47860
+ }
47861
+ asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
47862
+ if (err) {
47863
+ cb(err);
47864
+ return;
47865
+ }
47866
+ values.forEach(function(length) {
47867
+ knownLength += length;
47868
+ });
47869
+ cb(null, knownLength);
47870
+ });
47871
+ };
47872
+ FormData4.prototype.submit = function(params, cb) {
47873
+ var request;
47874
+ var options;
47875
+ var defaults3 = { method: "post" };
47876
+ if (typeof params === "string") {
47877
+ params = parseUrl(params);
47878
+ options = populate({
47879
+ port: params.port,
47880
+ path: params.pathname,
47881
+ host: params.hostname,
47882
+ protocol: params.protocol
47883
+ }, defaults3);
47884
+ } else {
47885
+ options = populate(params, defaults3);
47886
+ if (!options.port) {
47887
+ options.port = options.protocol === "https:" ? 443 : 80;
47888
+ }
47889
+ }
47890
+ options.headers = this.getHeaders(params.headers);
47891
+ if (options.protocol === "https:") {
47892
+ request = https2.request(options);
47893
+ } else {
47894
+ request = http2.request(options);
47895
+ }
47896
+ this.getLength(function(err, length) {
47897
+ if (err && err !== "Unknown stream") {
47898
+ this._error(err);
47899
+ return;
47900
+ }
47901
+ if (length) {
47902
+ request.setHeader("Content-Length", length);
47903
+ }
47904
+ this.pipe(request);
47905
+ if (cb) {
47906
+ var onResponse;
47907
+ var callback = function(error, responce) {
47908
+ request.removeListener("error", callback);
47909
+ request.removeListener("response", onResponse);
47910
+ return cb.call(this, error, responce);
47911
+ };
47912
+ onResponse = callback.bind(this, null);
47913
+ request.on("error", callback);
47914
+ request.on("response", onResponse);
47915
+ }
47916
+ }.bind(this));
47917
+ return request;
47918
+ };
47919
+ FormData4.prototype._error = function(err) {
47920
+ if (!this.error) {
47921
+ this.error = err;
47922
+ this.pause();
47923
+ this.emit("error", err);
47924
+ }
47925
+ };
47926
+ FormData4.prototype.toString = function() {
47927
+ return "[object FormData]";
47928
+ };
47929
+ setToStringTag(FormData4, "FormData");
47930
+ module2.exports = FormData4;
47931
+ }
47932
+ });
47933
+
47934
+ // ../../node_modules/.pnpm/form-data@4.0.2/node_modules/form-data/lib/populate.js
47935
+ var require_populate2 = __commonJS({
47604
47936
  "../../node_modules/.pnpm/form-data@4.0.2/node_modules/form-data/lib/populate.js"(exports2, module2) {
47605
47937
  module2.exports = function(dst, src) {
47606
47938
  Object.keys(src).forEach(function(prop2) {
@@ -47612,7 +47944,7 @@ var require_populate = __commonJS({
47612
47944
  });
47613
47945
 
47614
47946
  // ../../node_modules/.pnpm/form-data@4.0.2/node_modules/form-data/lib/form_data.js
47615
- var require_form_data = __commonJS({
47947
+ var require_form_data2 = __commonJS({
47616
47948
  "../../node_modules/.pnpm/form-data@4.0.2/node_modules/form-data/lib/form_data.js"(exports2, module2) {
47617
47949
  var CombinedStream = require_combined_stream();
47618
47950
  var util5 = __require("util");
@@ -47625,7 +47957,7 @@ var require_form_data = __commonJS({
47625
47957
  var mime = require_mime_types();
47626
47958
  var asynckit = require_asynckit();
47627
47959
  var setToStringTag = require_es_set_tostringtag();
47628
- var populate = require_populate();
47960
+ var populate = require_populate2();
47629
47961
  module2.exports = FormData4;
47630
47962
  util5.inherits(FormData4, CombinedStream);
47631
47963
  function FormData4(options) {
@@ -49261,338 +49593,6 @@ var require_follow_redirects = __commonJS({
49261
49593
  }
49262
49594
  });
49263
49595
 
49264
- // ../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/populate.js
49265
- var require_populate2 = __commonJS({
49266
- "../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/populate.js"(exports2, module2) {
49267
- "use strict";
49268
- module2.exports = function(dst, src) {
49269
- Object.keys(src).forEach(function(prop2) {
49270
- dst[prop2] = dst[prop2] || src[prop2];
49271
- });
49272
- return dst;
49273
- };
49274
- }
49275
- });
49276
-
49277
- // ../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/form_data.js
49278
- var require_form_data2 = __commonJS({
49279
- "../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/form_data.js"(exports2, module2) {
49280
- "use strict";
49281
- var CombinedStream = require_combined_stream();
49282
- var util5 = __require("util");
49283
- var path2 = __require("path");
49284
- var http2 = __require("http");
49285
- var https2 = __require("https");
49286
- var parseUrl = __require("url").parse;
49287
- var fs = __require("fs");
49288
- var Stream2 = __require("stream").Stream;
49289
- var crypto7 = __require("crypto");
49290
- var mime = require_mime_types();
49291
- var asynckit = require_asynckit();
49292
- var setToStringTag = require_es_set_tostringtag();
49293
- var hasOwn2 = require_hasown();
49294
- var populate = require_populate2();
49295
- function FormData4(options) {
49296
- if (!(this instanceof FormData4)) {
49297
- return new FormData4(options);
49298
- }
49299
- this._overheadLength = 0;
49300
- this._valueLength = 0;
49301
- this._valuesToMeasure = [];
49302
- CombinedStream.call(this);
49303
- options = options || {};
49304
- for (var option in options) {
49305
- this[option] = options[option];
49306
- }
49307
- }
49308
- util5.inherits(FormData4, CombinedStream);
49309
- FormData4.LINE_BREAK = "\r\n";
49310
- FormData4.DEFAULT_CONTENT_TYPE = "application/octet-stream";
49311
- FormData4.prototype.append = function(field, value, options) {
49312
- options = options || {};
49313
- if (typeof options === "string") {
49314
- options = { filename: options };
49315
- }
49316
- var append4 = CombinedStream.prototype.append.bind(this);
49317
- if (typeof value === "number" || value == null) {
49318
- value = String(value);
49319
- }
49320
- if (Array.isArray(value)) {
49321
- this._error(new Error("Arrays are not supported."));
49322
- return;
49323
- }
49324
- var header = this._multiPartHeader(field, value, options);
49325
- var footer = this._multiPartFooter();
49326
- append4(header);
49327
- append4(value);
49328
- append4(footer);
49329
- this._trackLength(header, value, options);
49330
- };
49331
- FormData4.prototype._trackLength = function(header, value, options) {
49332
- var valueLength = 0;
49333
- if (options.knownLength != null) {
49334
- valueLength += Number(options.knownLength);
49335
- } else if (Buffer.isBuffer(value)) {
49336
- valueLength = value.length;
49337
- } else if (typeof value === "string") {
49338
- valueLength = Buffer.byteLength(value);
49339
- }
49340
- this._valueLength += valueLength;
49341
- this._overheadLength += Buffer.byteLength(header) + FormData4.LINE_BREAK.length;
49342
- if (!value || !value.path && !(value.readable && hasOwn2(value, "httpVersion")) && !(value instanceof Stream2)) {
49343
- return;
49344
- }
49345
- if (!options.knownLength) {
49346
- this._valuesToMeasure.push(value);
49347
- }
49348
- };
49349
- FormData4.prototype._lengthRetriever = function(value, callback) {
49350
- if (hasOwn2(value, "fd")) {
49351
- if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
49352
- callback(null, value.end + 1 - (value.start ? value.start : 0));
49353
- } else {
49354
- fs.stat(value.path, function(err, stat4) {
49355
- if (err) {
49356
- callback(err);
49357
- return;
49358
- }
49359
- var fileSize = stat4.size - (value.start ? value.start : 0);
49360
- callback(null, fileSize);
49361
- });
49362
- }
49363
- } else if (hasOwn2(value, "httpVersion")) {
49364
- callback(null, Number(value.headers["content-length"]));
49365
- } else if (hasOwn2(value, "httpModule")) {
49366
- value.on("response", function(response) {
49367
- value.pause();
49368
- callback(null, Number(response.headers["content-length"]));
49369
- });
49370
- value.resume();
49371
- } else {
49372
- callback("Unknown stream");
49373
- }
49374
- };
49375
- FormData4.prototype._multiPartHeader = function(field, value, options) {
49376
- if (typeof options.header === "string") {
49377
- return options.header;
49378
- }
49379
- var contentDisposition = this._getContentDisposition(value, options);
49380
- var contentType = this._getContentType(value, options);
49381
- var contents2 = "";
49382
- var headers = {
49383
- // add custom disposition as third element or keep it two elements if not
49384
- "Content-Disposition": ["form-data", 'name="' + field + '"'].concat(contentDisposition || []),
49385
- // if no content type. allow it to be empty array
49386
- "Content-Type": [].concat(contentType || [])
49387
- };
49388
- if (typeof options.header === "object") {
49389
- populate(headers, options.header);
49390
- }
49391
- var header;
49392
- for (var prop2 in headers) {
49393
- if (hasOwn2(headers, prop2)) {
49394
- header = headers[prop2];
49395
- if (header == null) {
49396
- continue;
49397
- }
49398
- if (!Array.isArray(header)) {
49399
- header = [header];
49400
- }
49401
- if (header.length) {
49402
- contents2 += prop2 + ": " + header.join("; ") + FormData4.LINE_BREAK;
49403
- }
49404
- }
49405
- }
49406
- return "--" + this.getBoundary() + FormData4.LINE_BREAK + contents2 + FormData4.LINE_BREAK;
49407
- };
49408
- FormData4.prototype._getContentDisposition = function(value, options) {
49409
- var filename;
49410
- if (typeof options.filepath === "string") {
49411
- filename = path2.normalize(options.filepath).replace(/\\/g, "/");
49412
- } else if (options.filename || value && (value.name || value.path)) {
49413
- filename = path2.basename(options.filename || value && (value.name || value.path));
49414
- } else if (value && value.readable && hasOwn2(value, "httpVersion")) {
49415
- filename = path2.basename(value.client._httpMessage.path || "");
49416
- }
49417
- if (filename) {
49418
- return 'filename="' + filename + '"';
49419
- }
49420
- };
49421
- FormData4.prototype._getContentType = function(value, options) {
49422
- var contentType = options.contentType;
49423
- if (!contentType && value && value.name) {
49424
- contentType = mime.lookup(value.name);
49425
- }
49426
- if (!contentType && value && value.path) {
49427
- contentType = mime.lookup(value.path);
49428
- }
49429
- if (!contentType && value && value.readable && hasOwn2(value, "httpVersion")) {
49430
- contentType = value.headers["content-type"];
49431
- }
49432
- if (!contentType && (options.filepath || options.filename)) {
49433
- contentType = mime.lookup(options.filepath || options.filename);
49434
- }
49435
- if (!contentType && value && typeof value === "object") {
49436
- contentType = FormData4.DEFAULT_CONTENT_TYPE;
49437
- }
49438
- return contentType;
49439
- };
49440
- FormData4.prototype._multiPartFooter = function() {
49441
- return function(next2) {
49442
- var footer = FormData4.LINE_BREAK;
49443
- var lastPart = this._streams.length === 0;
49444
- if (lastPart) {
49445
- footer += this._lastBoundary();
49446
- }
49447
- next2(footer);
49448
- }.bind(this);
49449
- };
49450
- FormData4.prototype._lastBoundary = function() {
49451
- return "--" + this.getBoundary() + "--" + FormData4.LINE_BREAK;
49452
- };
49453
- FormData4.prototype.getHeaders = function(userHeaders) {
49454
- var header;
49455
- var formHeaders = {
49456
- "content-type": "multipart/form-data; boundary=" + this.getBoundary()
49457
- };
49458
- for (header in userHeaders) {
49459
- if (hasOwn2(userHeaders, header)) {
49460
- formHeaders[header.toLowerCase()] = userHeaders[header];
49461
- }
49462
- }
49463
- return formHeaders;
49464
- };
49465
- FormData4.prototype.setBoundary = function(boundary) {
49466
- if (typeof boundary !== "string") {
49467
- throw new TypeError("FormData boundary must be a string");
49468
- }
49469
- this._boundary = boundary;
49470
- };
49471
- FormData4.prototype.getBoundary = function() {
49472
- if (!this._boundary) {
49473
- this._generateBoundary();
49474
- }
49475
- return this._boundary;
49476
- };
49477
- FormData4.prototype.getBuffer = function() {
49478
- var dataBuffer = new Buffer.alloc(0);
49479
- var boundary = this.getBoundary();
49480
- for (var i7 = 0, len = this._streams.length; i7 < len; i7++) {
49481
- if (typeof this._streams[i7] !== "function") {
49482
- if (Buffer.isBuffer(this._streams[i7])) {
49483
- dataBuffer = Buffer.concat([dataBuffer, this._streams[i7]]);
49484
- } else {
49485
- dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i7])]);
49486
- }
49487
- if (typeof this._streams[i7] !== "string" || this._streams[i7].substring(2, boundary.length + 2) !== boundary) {
49488
- dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData4.LINE_BREAK)]);
49489
- }
49490
- }
49491
- }
49492
- return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
49493
- };
49494
- FormData4.prototype._generateBoundary = function() {
49495
- this._boundary = "--------------------------" + crypto7.randomBytes(12).toString("hex");
49496
- };
49497
- FormData4.prototype.getLengthSync = function() {
49498
- var knownLength = this._overheadLength + this._valueLength;
49499
- if (this._streams.length) {
49500
- knownLength += this._lastBoundary().length;
49501
- }
49502
- if (!this.hasKnownLength()) {
49503
- this._error(new Error("Cannot calculate proper length in synchronous way."));
49504
- }
49505
- return knownLength;
49506
- };
49507
- FormData4.prototype.hasKnownLength = function() {
49508
- var hasKnownLength = true;
49509
- if (this._valuesToMeasure.length) {
49510
- hasKnownLength = false;
49511
- }
49512
- return hasKnownLength;
49513
- };
49514
- FormData4.prototype.getLength = function(cb) {
49515
- var knownLength = this._overheadLength + this._valueLength;
49516
- if (this._streams.length) {
49517
- knownLength += this._lastBoundary().length;
49518
- }
49519
- if (!this._valuesToMeasure.length) {
49520
- process.nextTick(cb.bind(this, null, knownLength));
49521
- return;
49522
- }
49523
- asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
49524
- if (err) {
49525
- cb(err);
49526
- return;
49527
- }
49528
- values.forEach(function(length) {
49529
- knownLength += length;
49530
- });
49531
- cb(null, knownLength);
49532
- });
49533
- };
49534
- FormData4.prototype.submit = function(params, cb) {
49535
- var request;
49536
- var options;
49537
- var defaults3 = { method: "post" };
49538
- if (typeof params === "string") {
49539
- params = parseUrl(params);
49540
- options = populate({
49541
- port: params.port,
49542
- path: params.pathname,
49543
- host: params.hostname,
49544
- protocol: params.protocol
49545
- }, defaults3);
49546
- } else {
49547
- options = populate(params, defaults3);
49548
- if (!options.port) {
49549
- options.port = options.protocol === "https:" ? 443 : 80;
49550
- }
49551
- }
49552
- options.headers = this.getHeaders(params.headers);
49553
- if (options.protocol === "https:") {
49554
- request = https2.request(options);
49555
- } else {
49556
- request = http2.request(options);
49557
- }
49558
- this.getLength(function(err, length) {
49559
- if (err && err !== "Unknown stream") {
49560
- this._error(err);
49561
- return;
49562
- }
49563
- if (length) {
49564
- request.setHeader("Content-Length", length);
49565
- }
49566
- this.pipe(request);
49567
- if (cb) {
49568
- var onResponse;
49569
- var callback = function(error, responce) {
49570
- request.removeListener("error", callback);
49571
- request.removeListener("response", onResponse);
49572
- return cb.call(this, error, responce);
49573
- };
49574
- onResponse = callback.bind(this, null);
49575
- request.on("error", callback);
49576
- request.on("response", onResponse);
49577
- }
49578
- }.bind(this));
49579
- return request;
49580
- };
49581
- FormData4.prototype._error = function(err) {
49582
- if (!this.error) {
49583
- this.error = err;
49584
- this.pause();
49585
- this.emit("error", err);
49586
- }
49587
- };
49588
- FormData4.prototype.toString = function() {
49589
- return "[object FormData]";
49590
- };
49591
- setToStringTag(FormData4, "FormData");
49592
- module2.exports = FormData4;
49593
- }
49594
- });
49595
-
49596
49596
  // ../../node_modules/.pnpm/is-retry-allowed@2.2.0/node_modules/is-retry-allowed/index.js
49597
49597
  var require_is_retry_allowed = __commonJS({
49598
49598
  "../../node_modules/.pnpm/is-retry-allowed@2.2.0/node_modules/is-retry-allowed/index.js"(exports2, module2) {
@@ -53555,7 +53555,7 @@ var require_cjs2 = __commonJS({
53555
53555
  var require_lib12 = __commonJS({
53556
53556
  "../../node_modules/.pnpm/write-file-atomic@5.0.1/node_modules/write-file-atomic/lib/index.js"(exports2, module2) {
53557
53557
  "use strict";
53558
- module2.exports = writeFile12;
53558
+ module2.exports = writeFile13;
53559
53559
  module2.exports.sync = writeFileSync4;
53560
53560
  module2.exports._getTmpname = getTmpname;
53561
53561
  module2.exports._cleanupOnExit = cleanupOnExit;
@@ -53680,7 +53680,7 @@ var require_lib12 = __commonJS({
53680
53680
  }
53681
53681
  }
53682
53682
  }
53683
- async function writeFile12(filename, data2, options, callback) {
53683
+ async function writeFile13(filename, data2, options, callback) {
53684
53684
  if (options instanceof Function) {
53685
53685
  callback = options;
53686
53686
  options = {};
@@ -85010,7 +85010,7 @@ var require_lockfile = __commonJS({
85010
85010
  if (eol !== "\n") {
85011
85011
  data2 = data2.replace(/\n/g, eol);
85012
85012
  }
85013
- yield writeFile12(path2, data2);
85013
+ yield writeFile13(path2, data2);
85014
85014
  });
85015
85015
  return function writeFilePreservingEol2(_x30, _x31) {
85016
85016
  return _ref31.apply(this, arguments);
@@ -85022,7 +85022,7 @@ var require_lockfile = __commonJS({
85022
85022
  const file = (_path || _load_path()).default.join(dir, filename);
85023
85023
  const fileLink = (_path || _load_path()).default.join(dir, filename + "-link");
85024
85024
  try {
85025
- yield writeFile12(file, "test");
85025
+ yield writeFile13(file, "test");
85026
85026
  yield link(file, fileLink);
85027
85027
  } catch (err) {
85028
85028
  return false;
@@ -85172,7 +85172,7 @@ var require_lockfile = __commonJS({
85172
85172
  const lockQueue = exports3.lockQueue = new (_blockingQueue || _load_blockingQueue()).default("fs lock");
85173
85173
  const readFileBuffer = exports3.readFileBuffer = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.readFile);
85174
85174
  const open = exports3.open = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.open);
85175
- const writeFile12 = exports3.writeFile = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.writeFile);
85175
+ const writeFile13 = exports3.writeFile = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.writeFile);
85176
85176
  const readlink2 = exports3.readlink = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.readlink);
85177
85177
  const realpath2 = exports3.realpath = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.realpath);
85178
85178
  const readdir7 = exports3.readdir = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.readdir);
@@ -113128,7 +113128,7 @@ var require_summary = __commonJS({
113128
113128
  exports2.summary = exports2.markdownSummary = exports2.SUMMARY_DOCS_URL = exports2.SUMMARY_ENV_VAR = void 0;
113129
113129
  var os_1 = __require("os");
113130
113130
  var fs_1 = __require("fs");
113131
- var { access: access5, appendFile, writeFile: writeFile12 } = fs_1.promises;
113131
+ var { access: access5, appendFile, writeFile: writeFile13 } = fs_1.promises;
113132
113132
  exports2.SUMMARY_ENV_VAR = "GITHUB_STEP_SUMMARY";
113133
113133
  exports2.SUMMARY_DOCS_URL = "https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";
113134
113134
  var Summary = class {
@@ -113186,7 +113186,7 @@ var require_summary = __commonJS({
113186
113186
  return __awaiter(this, void 0, void 0, function* () {
113187
113187
  const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);
113188
113188
  const filePath = yield this.filePath();
113189
- const writeFunc = overwrite ? writeFile12 : appendFile;
113189
+ const writeFunc = overwrite ? writeFile13 : appendFile;
113190
113190
  yield writeFunc(filePath, this._buffer, { encoding: "utf8" });
113191
113191
  return this.emptyBuffer();
113192
113192
  });
@@ -184569,7 +184569,7 @@ var require_p_retry = __commonJS({
184569
184569
  var require_axios = __commonJS({
184570
184570
  "../../node_modules/.pnpm/axios@1.9.0/node_modules/axios/dist/node/axios.cjs"(exports2, module2) {
184571
184571
  "use strict";
184572
- var FormData$1 = require_form_data2();
184572
+ var FormData$1 = require_form_data();
184573
184573
  var crypto7 = __require("crypto");
184574
184574
  var url2 = __require("url");
184575
184575
  var proxyFromEnv2 = require_proxy_from_env();
@@ -190191,7 +190191,7 @@ var {
190191
190191
  } = import_index.default;
190192
190192
 
190193
190193
  // dist/index.js
190194
- import { mkdir as mkdir3, readFile as readFile29, writeFile as writeFile11 } from "fs/promises";
190194
+ import { mkdir as mkdir3, readFile as readFile29, writeFile as writeFile12 } from "fs/promises";
190195
190195
  import { dirname as dirname14, join as join28, resolve as resolve35 } from "path";
190196
190196
 
190197
190197
  // ../utils/src/tmp-file.ts
@@ -195318,6 +195318,20 @@ function resolveConflicts2(ecosystem, patches, ctxt) {
195318
195318
  return resolvedPatches;
195319
195319
  }
195320
195320
 
195321
+ // ../utils/src/dashboard-api/socket-api.ts
195322
+ var import_form_data2 = __toESM(require_form_data(), 1);
195323
+ import { readFile as readFile8 } from "node:fs/promises";
195324
+ import { join as join5, relative as relative3, resolve as resolve8 } from "node:path";
195325
+
195326
+ // ../web-compat-utils/src/ghsa.ts
195327
+ function extractGHSAIdFromUrl(url2) {
195328
+ const match2 = url2.match(/(GHSA-[a-z0-9-]+)/);
195329
+ if (match2) {
195330
+ return match2[1];
195331
+ }
195332
+ return void 0;
195333
+ }
195334
+
195321
195335
  // ../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/bind.js
195322
195336
  function bind(fn2, thisArg) {
195323
195337
  return function wrap2() {
@@ -195763,7 +195777,7 @@ AxiosError.from = (error, code, config3, request, response, customProps) => {
195763
195777
  var AxiosError_default = AxiosError;
195764
195778
 
195765
195779
  // ../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/platform/node/classes/FormData.js
195766
- var import_form_data = __toESM(require_form_data(), 1);
195780
+ var import_form_data = __toESM(require_form_data2(), 1);
195767
195781
  var FormData_default = import_form_data.default;
195768
195782
 
195769
195783
  // ../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/toFormData.js
@@ -198616,20 +198630,6 @@ var {
198616
198630
  mergeConfig: mergeConfig2
198617
198631
  } = axios_default;
198618
198632
 
198619
- // ../utils/src/dashboard-api/socket-api.ts
198620
- var import_form_data2 = __toESM(require_form_data2(), 1);
198621
- import { readFile as readFile8 } from "node:fs/promises";
198622
- import { join as join5, relative as relative3, resolve as resolve8 } from "node:path";
198623
-
198624
- // ../web-compat-utils/src/ghsa.ts
198625
- function extractGHSAIdFromUrl(url2) {
198626
- const match2 = url2.match(/(GHSA-[a-z0-9-]+)/);
198627
- if (match2) {
198628
- return match2[1];
198629
- }
198630
- return void 0;
198631
- }
198632
-
198633
198633
  // ../../node_modules/.pnpm/axios-retry@4.1.0_axios@1.8.2/node_modules/axios-retry/dist/esm/index.js
198634
198634
  var import_is_retry_allowed = __toESM(require_is_retry_allowed(), 1);
198635
198635
  var namespace = "axios-retry";
@@ -198822,7 +198822,7 @@ function prettyPrintAxiosError(error) {
198822
198822
  printableHeaders = Object.fromEntries(
198823
198823
  Object.entries(headers).map(([key, value]) => {
198824
198824
  try {
198825
- if (key === "api-key" || key === "apiKey") {
198825
+ if (key === "api-key" || key === "apiKey" || key === "Authorization") {
198826
198826
  return [key, "REDACTED"];
198827
198827
  }
198828
198828
  if (Array.isArray(value)) {
@@ -198907,7 +198907,7 @@ async function createSocketTier1Scan(cliOptions, coanaCliVersion) {
198907
198907
  };
198908
198908
  return (await axios2.put(url2, data2, { headers: getAuthHeaders() })).data;
198909
198909
  } catch (error) {
198910
- handleError(error, "Error creating tier 1 scan", false);
198910
+ handleError(error, "Error creating tier 1 scan", true);
198911
198911
  throw new Error("we should never reach this point");
198912
198912
  }
198913
198913
  }
@@ -199048,7 +199048,7 @@ async function getLatestBucketsSocket(subprojectPath, workspacePath) {
199048
199048
  }
199049
199049
  logger.debug(
199050
199050
  "Unable to retrieve cached analysis configuration. Will continue with default configuration.",
199051
- error?.message
199051
+ error.message
199052
199052
  );
199053
199053
  return void 0;
199054
199054
  }
@@ -199064,7 +199064,7 @@ async function useSocketComputeFixEndpoint(autofixRunId, artifacts, vulnerableAr
199064
199064
  };
199065
199065
  return (await axios2.post(url2, data2, { headers: getAuthHeaders() })).data;
199066
199066
  } catch (error) {
199067
- logger.error("Request to compute fixes failed:", error);
199067
+ handleError(error, "Request to compute fixes failed", false);
199068
199068
  return {
199069
199069
  type: "error",
199070
199070
  message: "Error during computation"
@@ -199078,8 +199078,8 @@ async function augmentArtifactsWithVulnerabilities(components) {
199078
199078
  const augmentedArtifacts = (await axios2.post(url2, data2, { headers: getAuthHeaders() })).data;
199079
199079
  return parseSocketResponse(augmentedArtifacts);
199080
199080
  } catch (e) {
199081
- logger.error("Failed to scan for vulnerabilities in socket mode", e);
199082
- throw e;
199081
+ handleError(e, "Failed to scan for vulnerabilities in socket mode", true);
199082
+ throw new Error("we should never reach this point");
199083
199083
  }
199084
199084
  }
199085
199085
  async function fetchManifestFilesFromManifestsTarHash(manifestsTarHash) {
@@ -199087,10 +199087,8 @@ async function fetchManifestFilesFromManifestsTarHash(manifestsTarHash) {
199087
199087
  const url2 = getSocketApiUrl(`orgs/${process.env.SOCKET_ORG_SLUG}/manifest-files?tarHash=${manifestsTarHash}`);
199088
199088
  return (await axios2.get(url2, { headers: getAuthHeaders() })).data;
199089
199089
  } catch (e) {
199090
- if (e instanceof AxiosError2) {
199091
- prettyPrintAxiosError(e);
199092
- }
199093
- throw new Error("Failed to fetch artifacts from Socket API using manifests tar hash");
199090
+ handleError(e, "Failed to fetch artifacts from Socket API using manifests tar hash", true);
199091
+ throw new Error("we should never reach this point");
199094
199092
  }
199095
199093
  }
199096
199094
  async function fetchArtifactsFromManifestsTarHash(manifestsTarHash) {
@@ -199099,10 +199097,8 @@ async function fetchArtifactsFromManifestsTarHash(manifestsTarHash) {
199099
199097
  const responseData = (await axios2.post(url2, {}, { headers: getAuthHeaders() })).data;
199100
199098
  return parseComputeArtifactsResponse(responseData);
199101
199099
  } catch (e) {
199102
- if (e instanceof AxiosError2) {
199103
- prettyPrintAxiosError(e);
199104
- }
199105
- throw new Error("Failed to fetch artifacts from Socket API using manifests tar hash");
199100
+ handleError(e, "Failed to fetch artifacts from Socket API using manifests tar hash", true);
199101
+ throw new Error("we should never reach this point");
199106
199102
  }
199107
199103
  }
199108
199104
  async function computeSocketFactArtifacts(rootDir, manifestFiles) {
@@ -206926,8 +206922,10 @@ var getNpmBin = once(async () => {
206926
206922
  });
206927
206923
  async function actuallyRunInstall(specificPackagesArgs = [], dir) {
206928
206924
  const installationCommand = cmdt2`${await getNpmBin()} install -f --ignore-scripts --no-fund --no-audit --no-progress ${specificPackagesArgs}`;
206929
- logger.info(`running installation command: ${installationCommand}`);
206930
- return execAndLogOnFailure2(installationCommand, dir);
206925
+ logger.info(`Running installation command: "${installationCommand}" in ${dir}`);
206926
+ const result = execAndLogOnFailure2(installationCommand, dir);
206927
+ logger.info(`Installation completed.`);
206928
+ return result;
206931
206929
  }
206932
206930
  async function getWorkspacePathsFromPackageJSON(projectFolder, useDotWhenNoWorkspaces = false) {
206933
206931
  const rootPackageJson = getPackageJsonObject(projectFolder);
@@ -207072,8 +207070,10 @@ var PnpmFixingManager = class extends NpmEcosystemFixingManager {
207072
207070
  }
207073
207071
  async actuallyRunInstall(specificPackagesCmd = [], workspacePath = ".") {
207074
207072
  const installationCommand = cmdt`pnpm install --ignore-scripts${await this.getPnpmMajorVersion() >= 9 && specificPackagesCmd.length === 0 ? "--no-frozen-lockfile" : ""} --config.confirmModulesPurge=false ${specificPackagesCmd}`;
207075
- logger.info(`running installation command: ${installationCommand}`);
207076
- await exec(installationCommand, resolve17(this.rootDir, this.subprojectPath, workspacePath));
207073
+ const installDir = resolve17(this.rootDir, this.subprojectPath, workspacePath);
207074
+ logger.info(`Running installation command: "${installationCommand}" in ${installDir}`);
207075
+ await exec(installationCommand, installDir);
207076
+ logger.info(`Installation completed.`);
207077
207077
  }
207078
207078
  async getLockFileYaml() {
207079
207079
  const lockFile = await (0, import_lockfile_file2.readWantedLockfile)(resolve17(this.rootDir, this.subprojectPath), { ignoreIncompatible: true });
@@ -207367,8 +207367,8 @@ var YarnFixingManager = class extends NpmEcosystemFixingManager {
207367
207367
  env.YARN_NODE_LINKER = "node-modules";
207368
207368
  }
207369
207369
  const installationCommand = cmdt`${cmdWithoutSpecificPackages} ${specificPackagesArgs}`;
207370
- logger.info(`Running installation command: ${installationCommand}`);
207371
207370
  const installDir = resolve19(this.rootDir, this.subprojectPath, workspacePath ?? ".");
207371
+ logger.info(`Running installation command: "${installationCommand}" in ${installDir}`);
207372
207372
  const installResult = await this.runYarnCommand(installationCommand, installDir, { env });
207373
207373
  if (installResult.error) {
207374
207374
  logger.info(`Failed to install packages: ${installResult.error.message}`);
@@ -207481,7 +207481,7 @@ var YarnFixingManager = class extends NpmEcosystemFixingManager {
207481
207481
  import { dirname as dirname8, join as join9, relative as relative7 } from "path";
207482
207482
  import { existsSync as existsSync11 } from "fs";
207483
207483
  import { readFile as readFile16, writeFile as writeFile6 } from "fs/promises";
207484
- function applyUpgradesToPackageJson(packageJsonContent, upgrades, rangeStyle) {
207484
+ function applyUpgradesToPackageJson(filePath, packageJsonContent, upgrades, rangeStyle) {
207485
207485
  let modifiedContent = packageJsonContent;
207486
207486
  for (const upgrade of sortUpgradesByOffset(upgrades)) {
207487
207487
  if (upgrade.manifestRef?.start !== void 0 && upgrade.manifestRef?.end !== void 0) {
@@ -207503,6 +207503,9 @@ function applyUpgradesToPackageJson(packageJsonContent, upgrades, rangeStyle) {
207503
207503
  const specifier = specifierMatch ? specifierMatch[1] : "";
207504
207504
  newVersionString = `"${specifier}${upgrade.upgradeVersion}"`;
207505
207505
  }
207506
+ logger.info(
207507
+ `Upgrading ${upgrade.packageName} from ${originalVersionString} to ${newVersionString} in ${filePath}`
207508
+ );
207506
207509
  modifiedContent = modifiedContent.substring(0, start) + newVersionString + modifiedContent.substring(end2);
207507
207510
  continue;
207508
207511
  }
@@ -207533,6 +207536,7 @@ function applyUpgradesToPackageJson(packageJsonContent, upgrades, rangeStyle) {
207533
207536
  const specifier = specifierMatch ? specifierMatch[1] : "";
207534
207537
  versionString = specifier + upgrade.upgradeVersion;
207535
207538
  }
207539
+ logger.info(`Upgrading ${upgrade.packageName} from ${currentVersion} to ${versionString} in ${filePath}`);
207536
207540
  return `${prefix}${versionString}"`;
207537
207541
  });
207538
207542
  }
@@ -207634,7 +207638,12 @@ var NpmSocketUpgradeManager = class {
207634
207638
  };
207635
207639
  }
207636
207640
  );
207637
- const modifiedContent = applyUpgradesToPackageJson(packageJsonContent, upgradesWithPackageNames, rangeStyle);
207641
+ const modifiedContent = applyUpgradesToPackageJson(
207642
+ packageJsonPath,
207643
+ packageJsonContent,
207644
+ upgradesWithPackageNames,
207645
+ rangeStyle
207646
+ );
207638
207647
  await writeFile6(packageJsonPath, modifiedContent, "utf-8");
207639
207648
  }
207640
207649
  await fixingManager.finalizeFixes();
@@ -212763,7 +212772,7 @@ function computeVulnChainDetails(artifacts, vulnerableArtifactId) {
212763
212772
 
212764
212773
  // dist/cli-upgrade-purl.js
212765
212774
  var ECOSYSTEMS_WITH_SOCKET_UPGRADES = ["NPM", "MAVEN", "NUGET", "GO", "RUST"];
212766
- async function upgradePurl(rootDir, upgrades, options, logFile, cliFixRunId) {
212775
+ async function upgradePurl(rootDir, upgrades, options, logFile, cliFixRunId, prefetchedArtifacts) {
212767
212776
  if (options.rangeStyle && options.rangeStyle !== "pin") {
212768
212777
  throw new Error('Range style must be "pin"');
212769
212778
  }
@@ -212798,7 +212807,7 @@ ${upgrades.map(({ purl, upgradeVersion }) => ` ${prettyPrintPurlUpgrade(purl, up
212798
212807
  const purlToUpgradeVersion = new Map(supportedUpgrades.map((upgrade) => [upgrade.purl, upgrade.upgradeVersion]));
212799
212808
  const [manifestFiles, artifacts] = await Promise.all([
212800
212809
  fetchManifestFilesFromManifestsTarHash(options.manifestsTarHash),
212801
- (await fetchArtifactsFromSocket(rootDir, options.manifestsTarHash, "upgrade-purls")).artifacts
212810
+ prefetchedArtifacts ?? (await fetchArtifactsFromSocket(rootDir, options.manifestsTarHash, "upgrade-purls")).artifacts
212802
212811
  ]);
212803
212812
  const ecosystemToSocketArtifactUpgrades = /* @__PURE__ */ new Map();
212804
212813
  artifacts.forEach((artifact, idx) => {
@@ -212950,7 +212959,7 @@ ${vulnerabilityFixes.map((fix) => ` ${fix.dependencyName} from ${fix.currentVers
212950
212959
  // dist/cli-compute-fixes-and-upgrade-purls.js
212951
212960
  async function computeFixesAndUpgradePurls(path2, options, logFile) {
212952
212961
  const autofixRunId = options.manifestsTarHash && await getSocketAPI().registerAutofixOrUpgradePurlRun(options.manifestsTarHash, options, "autofix");
212953
- const { artifacts, ghsaToVulnerableArtifactIds } = await computeInputForComputingFixes(path2, options);
212962
+ const { artifacts, ghsaToVulnerableArtifactIds, socketFactArtifacts } = await computeInputForComputingFixes(path2, options);
212954
212963
  if (Object.keys(ghsaToVulnerableArtifactIds).length === 0) {
212955
212964
  logger.info("No vulnerabilities to compute fixes for");
212956
212965
  return { type: "no-vulnerabilities-found" };
@@ -213017,7 +213026,7 @@ async function computeFixesAndUpgradePurls(path2, options, logFile) {
213017
213026
  concurrency: "1",
213018
213027
  globPattern: options.globPattern,
213019
213028
  rangeStyle: options.rangeStyle
213020
- }, void 0, autofixRunId) ?? "fixed-all";
213029
+ }, void 0, autofixRunId, socketFactArtifacts) ?? "fixed-all";
213021
213030
  if (autofixRunId) {
213022
213031
  await getSocketAPI().finalizeAutofixRun(autofixRunId, ghsasFailedToFix.length === 0 && applyFixesStatus === "fixed-all" ? "fixed-all" : ghsasFailedToFix.length === Object.keys(ghsaToVulnerableArtifactIdsToApply).length || applyFixesStatus === "fixed-none" ? "fixed-none" : "fixed-some");
213023
213032
  }
@@ -213034,30 +213043,29 @@ async function computeFixesAndUpgradePurls(path2, options, logFile) {
213034
213043
  }
213035
213044
  }
213036
213045
  async function computeInputForComputingFixes(path2, options) {
213037
- if (options.manifestsTarHash) {
213038
- const { artifacts } = await fetchArtifactsFromSocket(path2, options.manifestsTarHash, "autofix");
213039
- const ghsaToVulnerableArtifactIds = {};
213040
- for (const [index2, artifact] of artifacts.entries()) {
213041
- if (!artifact.vulnerabilities)
213042
- continue;
213043
- for (const vulnerability of artifact.vulnerabilities) {
213044
- if (!(ghsaToVulnerableArtifactIds[vulnerability.ghsaId] ??= []).includes(index2)) {
213045
- ghsaToVulnerableArtifactIds[vulnerability.ghsaId].push(index2);
213046
- }
213046
+ if (!options.manifestsTarHash)
213047
+ throw new Error("Manifests tar hash is required for computing fixes");
213048
+ const { artifacts } = await fetchArtifactsFromSocket(path2, options.manifestsTarHash, "autofix");
213049
+ const ghsaToVulnerableArtifactIds = {};
213050
+ for (const [index2, artifact] of artifacts.entries()) {
213051
+ if (!artifact.vulnerabilities)
213052
+ continue;
213053
+ for (const vulnerability of artifact.vulnerabilities) {
213054
+ if (!(ghsaToVulnerableArtifactIds[vulnerability.ghsaId] ??= []).includes(index2)) {
213055
+ ghsaToVulnerableArtifactIds[vulnerability.ghsaId].push(index2);
213047
213056
  }
213048
213057
  }
213049
- const sbomTaskArtifacts = artifacts.map((artifact) => ({
213050
- type: artifact.type,
213051
- name: artifact.name ?? "",
213052
- version: artifact.version ?? "",
213053
- namespace: artifact.namespace ?? void 0,
213054
- adj: artifact.dependencies?.map((dep) => artifacts.findIndex((a4) => a4.id === dep)) ?? [],
213055
- direct: artifact.direct,
213056
- topLevelAncestors: artifact.toplevelAncestors?.map((ancestor) => artifacts.findIndex((a4) => a4.id === ancestor)) ?? []
213057
- }));
213058
- return { artifacts: sbomTaskArtifacts, ghsaToVulnerableArtifactIds };
213059
213058
  }
213060
- throw new Error("Fixes are only supported when using --manifests-tar-hash");
213059
+ const sbomTaskArtifacts = artifacts.map((artifact) => ({
213060
+ type: artifact.type,
213061
+ name: artifact.name ?? "",
213062
+ version: artifact.version ?? "",
213063
+ namespace: artifact.namespace ?? void 0,
213064
+ adj: artifact.dependencies?.map((dep) => artifacts.findIndex((a4) => a4.id === dep)) ?? [],
213065
+ direct: artifact.direct,
213066
+ topLevelAncestors: artifact.toplevelAncestors?.map((ancestor) => artifacts.findIndex((a4) => a4.id === ancestor)) ?? []
213067
+ }));
213068
+ return { artifacts: sbomTaskArtifacts, ghsaToVulnerableArtifactIds, socketFactArtifacts: artifacts };
213061
213069
  }
213062
213070
  async function computeDirectDependencyUpgrades(artifacts, fixesFound) {
213063
213071
  const purlToArtifact = Object.fromEntries(artifacts.map((a4) => [simplePurl(a4.type, a4.namespace ?? null, a4.name ?? "", a4.version ?? null), a4]));
@@ -213097,7 +213105,7 @@ async function computeDirectDependencyUpgrades(artifacts, fixesFound) {
213097
213105
 
213098
213106
  // dist/cli-core.js
213099
213107
  import { writeFileSync as writeFileSync3 } from "fs";
213100
- import { mkdir as mkdir2, writeFile as writeFile10 } from "fs/promises";
213108
+ import { mkdir as mkdir2, writeFile as writeFile11 } from "fs/promises";
213101
213109
 
213102
213110
  // ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/index.mjs
213103
213111
  var FORCE_COLOR;
@@ -227335,8 +227343,14 @@ var { root: root2 } = static_exports;
227335
227343
 
227336
227344
  // ../utils/src/maven-utils.ts
227337
227345
  var import_lodash14 = __toESM(require_lodash(), 1);
227338
- import { existsSync as existsSync21, readdirSync as readdirSync4, statSync as statSync3 } from "fs";
227346
+ import { existsSync as existsSync22, readdirSync as readdirSync4, statSync as statSync3 } from "fs";
227339
227347
  import { join as join26 } from "path";
227348
+
227349
+ // ../utils/src/download-utils.ts
227350
+ import { existsSync as existsSync21 } from "fs";
227351
+ import { writeFile as writeFile10 } from "fs/promises";
227352
+
227353
+ // ../utils/src/maven-utils.ts
227340
227354
  var { memoize: memoize3 } = import_lodash14.default;
227341
227355
  var memoizedParseShellArgs = memoize3(parseShellArgs);
227342
227356
  var MAVEN_PUBLIC_REPOSITORIES = [
@@ -228701,7 +228715,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
228701
228715
  }
228702
228716
 
228703
228717
  // dist/version.js
228704
- var version2 = "14.12.43";
228718
+ var version2 = "14.12.45";
228705
228719
 
228706
228720
  // dist/cli-core.js
228707
228721
  var { mapValues, omit, partition, pick } = import_lodash15.default;
@@ -228905,7 +228919,7 @@ var CliCore = class {
228905
228919
  }
228906
228920
  const socketReport = toSocketFactsSocketDependencyTree(artifacts, vulnsWithResults, this.reportId);
228907
228921
  const outputFile = resolve34(this.options.socketMode);
228908
- await writeFile10(outputFile, JSON.stringify(socketReport, null, 2));
228922
+ await writeFile11(outputFile, JSON.stringify(socketReport, null, 2));
228909
228923
  logger.info(kleur_default.green(`Socket report written to: ${outputFile}`));
228910
228924
  }
228911
228925
  async shareErrorLogWithBackend(e, shouldLogSharing) {
@@ -228923,7 +228937,7 @@ var CliCore = class {
228923
228937
  }
228924
228938
  const socketReport = toSocketFacts(report, this.reportDependencyTrees, subPjToWsPathToDirectDependencies);
228925
228939
  const outputFile = resolve34(this.options.socketMode);
228926
- await writeFile10(outputFile, JSON.stringify(socketReport, null, 2));
228940
+ await writeFile11(outputFile, JSON.stringify(socketReport, null, 2));
228927
228941
  logger.info(kleur_default.green(`Socket report written to: ${outputFile}`));
228928
228942
  return;
228929
228943
  }
@@ -229452,6 +229466,7 @@ computeFixesAndUpgradePurlsCmd.name("compute-fixes-and-upgrade-purls").argument(
229452
229466
  await withTmpDirectory("compute-fixes-and-upgrade-purls", async (tmpDir) => {
229453
229467
  const logFile = join28(tmpDir, "compute-fixes-and-upgrade-purls.log");
229454
229468
  logger.initWinstonLogger(options.debug, logFile);
229469
+ await initializeComputeFixesAndUpgradePurls(path2, options);
229455
229470
  const optionsToUse = {
229456
229471
  ...y8(options, ["minimumReleaseAge"]),
229457
229472
  minimumReleaseAgeInMinutes: options.minimumReleaseAge ? parseMinimumReleaseAgeToMinutes(options.minimumReleaseAge) : void 0
@@ -229460,11 +229475,27 @@ computeFixesAndUpgradePurlsCmd.name("compute-fixes-and-upgrade-purls").argument(
229460
229475
  if (options.outputFile) {
229461
229476
  const outputFile = resolve35(options.outputFile);
229462
229477
  await mkdir3(dirname14(outputFile), { recursive: true });
229463
- await writeFile11(outputFile, JSON.stringify(output, null, 2));
229478
+ await writeFile12(outputFile, JSON.stringify(output, null, 2));
229464
229479
  logger.info(`Result written to: ${outputFile}`);
229465
229480
  }
229466
229481
  });
229467
229482
  }).configureHelp({ sortOptions: true });
229483
+ async function initializeComputeFixesAndUpgradePurls(path2, options) {
229484
+ logger.info(`Coana CLI version ${version2} compute fixes and upgrade purls initiated on ${path2}`);
229485
+ logger.debug("running in debug mode");
229486
+ logger.debug("using options", JSON.stringify(a3(Object.fromEntries(Object.entries(options).filter(([_, value]) => value)), [
229487
+ "debug",
229488
+ "silent",
229489
+ "applyFixesTo",
229490
+ "dryRun",
229491
+ "globPattern",
229492
+ "manifestsTarHash",
229493
+ "rangeStyle",
229494
+ "disableMajorUpdates",
229495
+ "outputFile",
229496
+ "minimumReleaseAge"
229497
+ ]), null, 2));
229498
+ }
229468
229499
  var compareReportsCommand = new Command();
229469
229500
  compareReportsCommand.name("compare-reports").argument("<baselineReportPath>", "Path to the baseline report").argument("<newReportPath>", "Path to the new report").option("--api-key <key>", "Set the Coana dashboard API key.").option("-d, --debug", "Enable debug logging", false).option("--no-pr-comment", "Disable pull request comments (only relevant when run from a PR)", true).option("--no-block", "Do not fail with a non-zero exit code when new reachable vulnerabilities are detected", true).option("--ignore-undeterminable-reachability", "Ignore vulnerabilities with undeterminable reachability", false).action(async (baselineReportPath, newReportPath, options) => {
229470
229501
  async function readReport(reportPath) {