@socketsecurity/sdk 1.9.2 → 1.10.1

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.
@@ -31,12 +31,14 @@ class SocketSdk {
31
31
  #apiToken;
32
32
  #baseUrl;
33
33
  #reqOptions;
34
+ #retries;
35
+ #retryDelay;
34
36
  /**
35
37
  * Initialize Socket SDK with API token and configuration options.
36
- * Sets up authentication, base URL, and HTTP client options.
38
+ * Sets up authentication, base URL, HTTP client options, and retry behavior.
37
39
  */
38
40
  constructor(apiToken, options) {
39
- const { agent: agentOrObj, baseUrl = 'https://api.socket.dev/v0/', timeout, userAgent, } = { __proto__: null, ...options };
41
+ const { agent: agentOrObj, baseUrl = 'https://api.socket.dev/v0/', retries = 3, retryDelay = 1000, timeout, userAgent, } = { __proto__: null, ...options };
40
42
  const agentKeys = agentOrObj ? Object.keys(agentOrObj) : [];
41
43
  const agentAsGotOptions = agentOrObj;
42
44
  const agent = (agentKeys.length && agentKeys.every(k => constants_1.httpAgentNames.has(k))
@@ -47,6 +49,8 @@ class SocketSdk {
47
49
  : agentOrObj);
48
50
  this.#apiToken = apiToken;
49
51
  this.#baseUrl = (0, utils_1.normalizeBaseUrl)(baseUrl);
52
+ this.#retries = retries;
53
+ this.#retryDelay = retryDelay;
50
54
  this.#reqOptions = {
51
55
  ...(agent ? { agent } : {}),
52
56
  headers: {
@@ -57,6 +61,33 @@ class SocketSdk {
57
61
  ...(timeout ? { timeout } : {}),
58
62
  };
59
63
  }
64
+ /**
65
+ * Execute an HTTP request with retry logic.
66
+ * Internal method for wrapping HTTP operations with exponential backoff.
67
+ */
68
+ async #executeWithRetry(operation) {
69
+ const result = await (0, promises_1.pRetry)(operation, {
70
+ baseDelayMs: this.#retryDelay,
71
+ onRetry(_attempt, error) {
72
+ /* c8 ignore next 3 - Early return for non-ResponseError types in retry logic */
73
+ if (!(error instanceof http_client_1.ResponseError)) {
74
+ return;
75
+ }
76
+ const { statusCode } = error.response;
77
+ // Don't retry authentication/authorization errors - they won't succeed.
78
+ if (statusCode === 401 || statusCode === 403) {
79
+ throw error;
80
+ }
81
+ },
82
+ onRetryRethrow: true,
83
+ retries: this.#retries,
84
+ });
85
+ /* c8 ignore next 3 - Defensive check for undefined result from pRetry abort */
86
+ if (result === undefined) {
87
+ throw new Error('Request aborted');
88
+ }
89
+ return result;
90
+ }
60
91
  /**
61
92
  * Create async generator for streaming batch package URL processing.
62
93
  * Internal method for handling chunked PURL responses with error handling.
@@ -64,30 +95,21 @@ class SocketSdk {
64
95
  async *#createBatchPurlGenerator(componentsObj, queryParams) {
65
96
  let res;
66
97
  try {
67
- res = await (0, promises_1.pRetry)(() => this.#createBatchPurlRequest(componentsObj, queryParams), {
68
- retries: 4,
69
- onRetryRethrow: true,
70
- onRetry(_attempt, error) {
71
- /* c8 ignore next 3 - Early return for non-ResponseError types in retry logic, difficult to test without complex network error simulation. */
72
- if (!(error instanceof http_client_1.ResponseError)) {
73
- return;
74
- }
75
- const { statusCode } = error.response;
76
- // Don't retry authentication/authorization errors - they won't succeed.
77
- if (statusCode === 401 || statusCode === 403) {
78
- throw error;
79
- }
80
- },
81
- });
98
+ res = await this.#executeWithRetry(() => this.#createBatchPurlRequest(componentsObj, queryParams));
82
99
  }
83
100
  catch (e) {
84
101
  yield await this.#handleApiError(e);
85
102
  return;
86
103
  }
104
+ // Validate response before processing.
105
+ /* c8 ignore next 3 - Defensive check, response should always be defined after successful request */
106
+ if (!res) {
107
+ throw new Error('Failed to get response from batch PURL request');
108
+ }
87
109
  // Parse the newline delimited JSON response.
88
110
  const rli = node_readline_1.default.createInterface({
89
111
  input: res,
90
- crlfDelay: Infinity,
112
+ crlfDelay: Number.POSITIVE_INFINITY,
91
113
  signal: abort_signal_1.default,
92
114
  });
93
115
  const isPublicToken = this.#apiToken === SOCKET_PUBLIC_API_TOKEN_1.default;
@@ -285,10 +307,15 @@ class SocketSdk {
285
307
  catch (e) {
286
308
  return await this.#handleApiError(e);
287
309
  }
310
+ // Validate response before processing.
311
+ /* c8 ignore next 3 - Defensive check, response should always be defined after successful request */
312
+ if (!res) {
313
+ throw new Error('Failed to get response from batch PURL request');
314
+ }
288
315
  // Parse the newline delimited JSON response.
289
316
  const rli = node_readline_1.default.createInterface({
290
317
  input: res,
291
- crlfDelay: Infinity,
318
+ crlfDelay: Number.POSITIVE_INFINITY,
292
319
  signal: abort_signal_1.default,
293
320
  });
294
321
  const isPublicToken = this.#apiToken === SOCKET_PUBLIC_API_TOKEN_1.default;
@@ -365,9 +392,13 @@ class SocketSdk {
365
392
  while (running.length > 0) {
366
393
  // eslint-disable-next-line no-await-in-loop
367
394
  const { generator, iteratorResult } = await Promise.race(running.map(entry => entry.promise));
368
- // Remove generator.
369
- /* c8 ignore next 3 - Concurrent generator cleanup edge case. */
370
- running.splice(running.findIndex(entry => entry.generator === generator), 1);
395
+ // Remove generator with safe index lookup.
396
+ const index = running.findIndex(entry => entry.generator === generator);
397
+ /* c8 ignore next 3 - Defensive check for concurrent generator cleanup edge case. */
398
+ if (index === -1) {
399
+ continue;
400
+ }
401
+ running.splice(index, 1);
371
402
  // Yield the value if one is given, even when done:true.
372
403
  if (iteratorResult.value) {
373
404
  yield iteratorResult.value;
@@ -394,11 +425,15 @@ class SocketSdk {
394
425
  *
395
426
  * @throws {Error} When server returns 5xx status codes
396
427
  */
397
- async createDependenciesSnapshot(filepaths, pathsRelativeTo = '.', queryParams) {
428
+ async createDependenciesSnapshot(filepaths, options) {
429
+ const { pathsRelativeTo = '.', queryParams } = {
430
+ __proto__: null,
431
+ ...options,
432
+ };
398
433
  const basePath = (0, utils_1.resolveBasePath)(pathsRelativeTo);
399
434
  const absFilepaths = (0, utils_1.resolveAbsPaths)(filepaths, basePath);
400
435
  try {
401
- const data = await (0, http_client_1.getResponseJson)(await (0, file_upload_1.createUploadRequest)(this.#baseUrl, `dependencies/upload?${(0, utils_1.queryToSearchParams)(queryParams)}`, (0, file_upload_1.createRequestBodyForFilepaths)(absFilepaths, basePath), this.#reqOptions));
436
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, file_upload_1.createUploadRequest)(this.#baseUrl, `dependencies/upload?${(0, utils_1.queryToSearchParams)(queryParams)}`, (0, file_upload_1.createRequestBodyForFilepaths)(absFilepaths, basePath), this.#reqOptions)));
402
437
  return this.#handleApiSuccess(data);
403
438
  }
404
439
  catch (e) {
@@ -413,7 +448,7 @@ class SocketSdk {
413
448
  */
414
449
  async createOrgDiffScanFromIds(orgSlug, queryParams) {
415
450
  try {
416
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/diff-scans?${(0, utils_1.queryToSearchParams)(queryParams)}`, {}, this.#reqOptions));
451
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/diff-scans?${(0, utils_1.queryToSearchParams)(queryParams)}`, {}, this.#reqOptions)));
417
452
  return this.#handleApiSuccess(data);
418
453
  }
419
454
  catch (e) {
@@ -426,11 +461,15 @@ class SocketSdk {
426
461
  *
427
462
  * @throws {Error} When server returns 5xx status codes
428
463
  */
429
- async createOrgFullScan(orgSlug, filepaths, pathsRelativeTo = '.', queryParams) {
464
+ async createOrgFullScan(orgSlug, filepaths, options) {
465
+ const { pathsRelativeTo = '.', queryParams } = {
466
+ __proto__: null,
467
+ ...options,
468
+ };
430
469
  const basePath = (0, utils_1.resolveBasePath)(pathsRelativeTo);
431
470
  const absFilepaths = (0, utils_1.resolveAbsPaths)(filepaths, basePath);
432
471
  try {
433
- const data = await (0, http_client_1.getResponseJson)(await (0, file_upload_1.createUploadRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/full-scans?${(0, utils_1.queryToSearchParams)(queryParams)}`, (0, file_upload_1.createRequestBodyForFilepaths)(absFilepaths, basePath), this.#reqOptions));
472
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, file_upload_1.createUploadRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/full-scans?${(0, utils_1.queryToSearchParams)(queryParams)}`, (0, file_upload_1.createRequestBodyForFilepaths)(absFilepaths, basePath), this.#reqOptions)));
434
473
  return this.#handleApiSuccess(data);
435
474
  }
436
475
  catch (e) {
@@ -445,7 +484,7 @@ class SocketSdk {
445
484
  */
446
485
  async createOrgRepo(orgSlug, queryParams) {
447
486
  try {
448
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos`, queryParams, this.#reqOptions));
487
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos`, queryParams, this.#reqOptions)));
449
488
  return this.#handleApiSuccess(data);
450
489
  }
451
490
  catch (e) {
@@ -460,7 +499,7 @@ class SocketSdk {
460
499
  */
461
500
  async createOrgRepoLabel(orgSlug, repoSlug, labelData) {
462
501
  try {
463
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos/${encodeURIComponent(repoSlug)}/labels`, labelData, this.#reqOptions));
502
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos/${encodeURIComponent(repoSlug)}/labels`, labelData, this.#reqOptions)));
464
503
  return this.#handleApiSuccess(data);
465
504
  }
466
505
  catch (e) {
@@ -473,11 +512,15 @@ class SocketSdk {
473
512
  *
474
513
  * @throws {Error} When server returns 5xx status codes
475
514
  */
476
- async createScanFromFilepaths(filepaths, pathsRelativeTo = '.', issueRules) {
515
+ async createScanFromFilepaths(filepaths, options) {
516
+ const { issueRules, pathsRelativeTo = '.' } = {
517
+ __proto__: null,
518
+ ...options,
519
+ };
477
520
  const basePath = (0, utils_1.resolveBasePath)(pathsRelativeTo);
478
521
  const absFilepaths = (0, utils_1.resolveAbsPaths)(filepaths, basePath);
479
522
  try {
480
- const data = await (0, http_client_1.getResponseJson)(await (0, file_upload_1.createUploadRequest)(this.#baseUrl, 'report/upload', [
523
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, file_upload_1.createUploadRequest)(this.#baseUrl, 'report/upload', [
481
524
  ...(0, file_upload_1.createRequestBodyForFilepaths)(absFilepaths, basePath),
482
525
  /* c8 ignore next 3 - Optional issueRules parameter edge case. */
483
526
  ...(issueRules
@@ -488,7 +531,7 @@ class SocketSdk {
488
531
  method: 'PUT',
489
532
  })
490
533
  /* c8 ignore next 3 - Success path return statement requires complex file upload mocking with authentication. */
491
- );
534
+ ));
492
535
  return this.#handleApiSuccess(data);
493
536
  }
494
537
  catch (e) {
@@ -503,7 +546,7 @@ class SocketSdk {
503
546
  */
504
547
  async deleteOrgDiffScan(orgSlug, diffScanId) {
505
548
  try {
506
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createDeleteRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/diff-scans/${encodeURIComponent(diffScanId)}`, this.#reqOptions));
549
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createDeleteRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/diff-scans/${encodeURIComponent(diffScanId)}`, this.#reqOptions)));
507
550
  return this.#handleApiSuccess(data);
508
551
  }
509
552
  catch (e) {
@@ -518,7 +561,7 @@ class SocketSdk {
518
561
  */
519
562
  async deleteOrgFullScan(orgSlug, fullScanId) {
520
563
  try {
521
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createDeleteRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/full-scans/${encodeURIComponent(fullScanId)}`, this.#reqOptions));
564
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createDeleteRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/full-scans/${encodeURIComponent(fullScanId)}`, this.#reqOptions)));
522
565
  return this.#handleApiSuccess(data);
523
566
  }
524
567
  catch (e) {
@@ -533,7 +576,7 @@ class SocketSdk {
533
576
  */
534
577
  async deleteOrgRepo(orgSlug, repoSlug) {
535
578
  try {
536
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createDeleteRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos/${encodeURIComponent(repoSlug)}`, this.#reqOptions));
579
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createDeleteRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos/${encodeURIComponent(repoSlug)}`, this.#reqOptions)));
537
580
  return this.#handleApiSuccess(data);
538
581
  }
539
582
  catch (e) {
@@ -548,7 +591,7 @@ class SocketSdk {
548
591
  */
549
592
  async deleteOrgRepoLabel(orgSlug, repoSlug, labelSlug) {
550
593
  try {
551
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createDeleteRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos/${encodeURIComponent(repoSlug)}/labels/${encodeURIComponent(labelSlug)}`, this.#reqOptions));
594
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createDeleteRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos/${encodeURIComponent(repoSlug)}/labels/${encodeURIComponent(labelSlug)}`, this.#reqOptions)));
552
595
  return this.#handleApiSuccess(data);
553
596
  }
554
597
  catch (e) {
@@ -563,7 +606,7 @@ class SocketSdk {
563
606
  */
564
607
  async deleteReport(reportId) {
565
608
  try {
566
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createDeleteRequest)(this.#baseUrl, `report/delete/${encodeURIComponent(reportId)}`, this.#reqOptions));
609
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createDeleteRequest)(this.#baseUrl, `report/delete/${encodeURIComponent(reportId)}`, this.#reqOptions)));
567
610
  return this.#handleApiSuccess(data);
568
611
  }
569
612
  catch (e) {
@@ -578,7 +621,7 @@ class SocketSdk {
578
621
  */
579
622
  async exportCDX(orgSlug, fullScanId) {
580
623
  try {
581
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/full-scans/${encodeURIComponent(fullScanId)}/sbom/export/cdx`, this.#reqOptions));
624
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/full-scans/${encodeURIComponent(fullScanId)}/sbom/export/cdx`, this.#reqOptions)));
582
625
  return this.#handleApiSuccess(data);
583
626
  }
584
627
  catch (e) {
@@ -593,7 +636,7 @@ class SocketSdk {
593
636
  */
594
637
  async exportSPDX(orgSlug, fullScanId) {
595
638
  try {
596
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/full-scans/${encodeURIComponent(fullScanId)}/sbom/export/spdx`, this.#reqOptions));
639
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/full-scans/${encodeURIComponent(fullScanId)}/sbom/export/spdx`, this.#reqOptions)));
597
640
  return this.#handleApiSuccess(data);
598
641
  }
599
642
  catch (e) {
@@ -670,7 +713,7 @@ class SocketSdk {
670
713
  */
671
714
  async getAPITokens(orgSlug) {
672
715
  try {
673
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/tokens`, this.#reqOptions));
716
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/tokens`, this.#reqOptions)));
674
717
  return this.#handleApiSuccess(data);
675
718
  }
676
719
  catch (e) {
@@ -685,7 +728,7 @@ class SocketSdk {
685
728
  */
686
729
  async getAuditLogEvents(orgSlug, queryParams) {
687
730
  try {
688
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/audit-log?${(0, utils_1.queryToSearchParams)(queryParams)}`, this.#reqOptions));
731
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/audit-log?${(0, utils_1.queryToSearchParams)(queryParams)}`, this.#reqOptions)));
689
732
  return this.#handleApiSuccess(data);
690
733
  }
691
734
  catch (e) {
@@ -700,7 +743,7 @@ class SocketSdk {
700
743
  */
701
744
  async getDiffScanById(orgSlug, diffScanId) {
702
745
  try {
703
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/diff-scans/${encodeURIComponent(diffScanId)}`, this.#reqOptions));
746
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/diff-scans/${encodeURIComponent(diffScanId)}`, this.#reqOptions)));
704
747
  return this.#handleApiSuccess(data);
705
748
  }
706
749
  catch (e) {
@@ -714,7 +757,7 @@ class SocketSdk {
714
757
  * Products that the organization has access to use.
715
758
  */
716
759
  async getEnabledEntitlements(orgSlug) {
717
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/entitlements`, this.#reqOptions));
760
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/entitlements`, this.#reqOptions)));
718
761
  // Extract enabled products from the response.
719
762
  const items = data?.items || [];
720
763
  return items
@@ -728,7 +771,7 @@ class SocketSdk {
728
771
  * an organization, returning the complete list with their status.
729
772
  */
730
773
  async getEntitlements(orgSlug) {
731
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/entitlements`, this.#reqOptions));
774
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/entitlements`, this.#reqOptions)));
732
775
  return data?.items || [];
733
776
  }
734
777
  /**
@@ -739,7 +782,7 @@ class SocketSdk {
739
782
  */
740
783
  async getIssuesByNpmPackage(pkgName, version) {
741
784
  try {
742
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `npm/${encodeURIComponent(pkgName)}/${encodeURIComponent(version)}/issues`, this.#reqOptions));
785
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `npm/${encodeURIComponent(pkgName)}/${encodeURIComponent(version)}/issues`, this.#reqOptions)));
743
786
  return this.#handleApiSuccess(data);
744
787
  }
745
788
  catch (e) {
@@ -754,7 +797,7 @@ class SocketSdk {
754
797
  */
755
798
  async getOrgAnalytics(time) {
756
799
  try {
757
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `analytics/org/${encodeURIComponent(time)}`, this.#reqOptions));
800
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `analytics/org/${encodeURIComponent(time)}`, this.#reqOptions)));
758
801
  return this.#handleApiSuccess(data);
759
802
  }
760
803
  catch (e) {
@@ -769,7 +812,7 @@ class SocketSdk {
769
812
  */
770
813
  async getOrganizations() {
771
814
  try {
772
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, 'organizations', this.#reqOptions));
815
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, 'organizations', this.#reqOptions)));
773
816
  return this.#handleApiSuccess(data);
774
817
  }
775
818
  catch (e) {
@@ -784,7 +827,7 @@ class SocketSdk {
784
827
  */
785
828
  async getOrgFullScanBuffered(orgSlug, fullScanId) {
786
829
  try {
787
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/full-scans/${encodeURIComponent(fullScanId)}`, this.#reqOptions));
830
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/full-scans/${encodeURIComponent(fullScanId)}`, this.#reqOptions)));
788
831
  return this.#handleApiSuccess(data);
789
832
  }
790
833
  catch (e) {
@@ -799,7 +842,7 @@ class SocketSdk {
799
842
  */
800
843
  async getOrgFullScanList(orgSlug, queryParams) {
801
844
  try {
802
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/full-scans?${(0, utils_1.queryToSearchParams)(queryParams)}`, this.#reqOptions));
845
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/full-scans?${(0, utils_1.queryToSearchParams)(queryParams)}`, this.#reqOptions)));
803
846
  return this.#handleApiSuccess(data);
804
847
  }
805
848
  catch (e) {
@@ -814,7 +857,7 @@ class SocketSdk {
814
857
  */
815
858
  async getOrgFullScanMetadata(orgSlug, fullScanId) {
816
859
  try {
817
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/full-scans/${encodeURIComponent(fullScanId)}/metadata`, this.#reqOptions));
860
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/full-scans/${encodeURIComponent(fullScanId)}/metadata`, this.#reqOptions)));
818
861
  return this.#handleApiSuccess(data);
819
862
  }
820
863
  catch (e) {
@@ -828,7 +871,7 @@ class SocketSdk {
828
871
  */
829
872
  async getOrgLicensePolicy(orgSlug) {
830
873
  try {
831
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/settings/license-policy`, this.#reqOptions));
874
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/settings/license-policy`, this.#reqOptions)));
832
875
  return this.#handleApiSuccess(data);
833
876
  }
834
877
  catch (e) {
@@ -845,7 +888,7 @@ class SocketSdk {
845
888
  const orgSlugParam = encodeURIComponent(orgSlug);
846
889
  const repoSlugParam = encodeURIComponent(repoSlug);
847
890
  try {
848
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${orgSlugParam}/repos/${repoSlugParam}`, this.#reqOptions));
891
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${orgSlugParam}/repos/${repoSlugParam}`, this.#reqOptions)));
849
892
  return this.#handleApiSuccess(data);
850
893
  }
851
894
  catch (e) {
@@ -860,7 +903,7 @@ class SocketSdk {
860
903
  */
861
904
  async getOrgRepoLabel(orgSlug, repoSlug, labelSlug) {
862
905
  try {
863
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos/${encodeURIComponent(repoSlug)}/labels/${encodeURIComponent(labelSlug)}`, this.#reqOptions));
906
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos/${encodeURIComponent(repoSlug)}/labels/${encodeURIComponent(labelSlug)}`, this.#reqOptions)));
864
907
  return this.#handleApiSuccess(data);
865
908
  }
866
909
  catch (e) {
@@ -875,7 +918,7 @@ class SocketSdk {
875
918
  */
876
919
  async getOrgRepoLabelList(orgSlug, repoSlug) {
877
920
  try {
878
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos/${encodeURIComponent(repoSlug)}/labels`, this.#reqOptions));
921
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos/${encodeURIComponent(repoSlug)}/labels`, this.#reqOptions)));
879
922
  return this.#handleApiSuccess(data);
880
923
  }
881
924
  catch (e) {
@@ -890,7 +933,7 @@ class SocketSdk {
890
933
  */
891
934
  async getOrgRepoList(orgSlug, queryParams) {
892
935
  try {
893
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos?${(0, utils_1.queryToSearchParams)(queryParams)}`, this.#reqOptions));
936
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos?${(0, utils_1.queryToSearchParams)(queryParams)}`, this.#reqOptions)));
894
937
  return this.#handleApiSuccess(data);
895
938
  }
896
939
  catch (e) {
@@ -904,7 +947,7 @@ class SocketSdk {
904
947
  */
905
948
  async getOrgSecurityPolicy(orgSlug) {
906
949
  try {
907
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/settings/security-policy`, this.#reqOptions));
950
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/settings/security-policy`, this.#reqOptions)));
908
951
  return this.#handleApiSuccess(data);
909
952
  }
910
953
  catch (e) {
@@ -919,7 +962,7 @@ class SocketSdk {
919
962
  */
920
963
  async getOrgTriage(orgSlug) {
921
964
  try {
922
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/triage`, this.#reqOptions));
965
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/triage`, this.#reqOptions)));
923
966
  return this.#handleApiSuccess(data);
924
967
  }
925
968
  catch (e) {
@@ -934,7 +977,7 @@ class SocketSdk {
934
977
  */
935
978
  async getQuota() {
936
979
  try {
937
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, 'quota', this.#reqOptions));
980
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, 'quota', this.#reqOptions)));
938
981
  return this.#handleApiSuccess(data);
939
982
  }
940
983
  catch (e) {
@@ -949,7 +992,7 @@ class SocketSdk {
949
992
  */
950
993
  async getRepoAnalytics(repo, time) {
951
994
  try {
952
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `analytics/repo/${encodeURIComponent(repo)}/${encodeURIComponent(time)}`, this.#reqOptions));
995
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `analytics/repo/${encodeURIComponent(repo)}/${encodeURIComponent(time)}`, this.#reqOptions)));
953
996
  return this.#handleApiSuccess(data);
954
997
  }
955
998
  catch (e) {
@@ -964,7 +1007,7 @@ class SocketSdk {
964
1007
  */
965
1008
  async getScan(id) {
966
1009
  try {
967
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `report/view/${encodeURIComponent(id)}`, this.#reqOptions));
1010
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `report/view/${encodeURIComponent(id)}`, this.#reqOptions)));
968
1011
  return this.#handleApiSuccess(data);
969
1012
  }
970
1013
  catch (e) {
@@ -979,7 +1022,7 @@ class SocketSdk {
979
1022
  */
980
1023
  async getScanList() {
981
1024
  try {
982
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, 'report/list', this.#reqOptions), 'GET');
1025
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, 'report/list', this.#reqOptions), 'GET'));
983
1026
  return this.#handleApiSuccess(data);
984
1027
  }
985
1028
  catch (e) {
@@ -994,7 +1037,7 @@ class SocketSdk {
994
1037
  */
995
1038
  async getScoreByNpmPackage(pkgName, version) {
996
1039
  try {
997
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `npm/${encodeURIComponent(pkgName)}/${encodeURIComponent(version)}/score`, this.#reqOptions));
1040
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `npm/${encodeURIComponent(pkgName)}/${encodeURIComponent(version)}/score`, this.#reqOptions)));
998
1041
  return this.#handleApiSuccess(data);
999
1042
  }
1000
1043
  catch (e) {
@@ -1009,7 +1052,7 @@ class SocketSdk {
1009
1052
  */
1010
1053
  async getSupportedScanFiles() {
1011
1054
  try {
1012
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, 'report/supported', this.#reqOptions));
1055
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, 'report/supported', this.#reqOptions)));
1013
1056
  return this.#handleApiSuccess(data);
1014
1057
  }
1015
1058
  catch (e) {
@@ -1024,7 +1067,7 @@ class SocketSdk {
1024
1067
  */
1025
1068
  async listOrgDiffScans(orgSlug) {
1026
1069
  try {
1027
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/diff-scans`, this.#reqOptions));
1070
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/diff-scans`, this.#reqOptions)));
1028
1071
  return this.#handleApiSuccess(data);
1029
1072
  }
1030
1073
  catch (e) {
@@ -1039,7 +1082,7 @@ class SocketSdk {
1039
1082
  */
1040
1083
  async postAPIToken(orgSlug, tokenData) {
1041
1084
  try {
1042
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/tokens`, tokenData, this.#reqOptions));
1085
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/tokens`, tokenData, this.#reqOptions)));
1043
1086
  return this.#handleApiSuccess(data);
1044
1087
  }
1045
1088
  catch (e) {
@@ -1054,7 +1097,7 @@ class SocketSdk {
1054
1097
  */
1055
1098
  async postAPITokensRevoke(orgSlug, tokenId) {
1056
1099
  try {
1057
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/tokens/${encodeURIComponent(tokenId)}/revoke`, {}, this.#reqOptions));
1100
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/tokens/${encodeURIComponent(tokenId)}/revoke`, {}, this.#reqOptions)));
1058
1101
  return this.#handleApiSuccess(data);
1059
1102
  }
1060
1103
  catch (e) {
@@ -1069,7 +1112,7 @@ class SocketSdk {
1069
1112
  */
1070
1113
  async postAPITokensRotate(orgSlug, tokenId) {
1071
1114
  try {
1072
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/tokens/${encodeURIComponent(tokenId)}/rotate`, {}, this.#reqOptions));
1115
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/tokens/${encodeURIComponent(tokenId)}/rotate`, {}, this.#reqOptions)));
1073
1116
  return this.#handleApiSuccess(data);
1074
1117
  }
1075
1118
  catch (e) {
@@ -1084,7 +1127,7 @@ class SocketSdk {
1084
1127
  */
1085
1128
  async postAPITokenUpdate(orgSlug, tokenId, updateData) {
1086
1129
  try {
1087
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/tokens/${encodeURIComponent(tokenId)}/update`, updateData, this.#reqOptions));
1130
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/tokens/${encodeURIComponent(tokenId)}/update`, updateData, this.#reqOptions)));
1088
1131
  return this.#handleApiSuccess(data);
1089
1132
  }
1090
1133
  catch (e) {
@@ -1099,7 +1142,7 @@ class SocketSdk {
1099
1142
  */
1100
1143
  async postSettings(selectors) {
1101
1144
  try {
1102
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, 'settings', { json: selectors }, this.#reqOptions));
1145
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, 'settings', { json: selectors }, this.#reqOptions)));
1103
1146
  return this.#handleApiSuccess(data);
1104
1147
  }
1105
1148
  catch (e) {
@@ -1114,7 +1157,7 @@ class SocketSdk {
1114
1157
  */
1115
1158
  async searchDependencies(queryParams) {
1116
1159
  try {
1117
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, 'dependencies/search', queryParams, this.#reqOptions));
1160
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, 'dependencies/search', queryParams, this.#reqOptions)));
1118
1161
  return this.#handleApiSuccess(data);
1119
1162
  }
1120
1163
  catch (e) {
@@ -1182,7 +1225,11 @@ class SocketSdk {
1182
1225
  *
1183
1226
  * @throws {Error} When server returns 5xx status codes
1184
1227
  */
1185
- async streamOrgFullScan(orgSlug, fullScanId, output) {
1228
+ async streamOrgFullScan(orgSlug, fullScanId, options) {
1229
+ const { output } = {
1230
+ __proto__: null,
1231
+ ...options,
1232
+ };
1186
1233
  try {
1187
1234
  const req = (0, http_client_1.getHttpModule)(this.#baseUrl)
1188
1235
  .request(`${this.#baseUrl}orgs/${encodeURIComponent(orgSlug)}/full-scans/${encodeURIComponent(fullScanId)}`, {
@@ -1196,12 +1243,23 @@ class SocketSdk {
1196
1243
  throw new http_client_1.ResponseError(res);
1197
1244
  }
1198
1245
  if (typeof output === 'string') {
1199
- // Stream to file
1200
- res.pipe((0, node_fs_1.createWriteStream)(output));
1246
+ // Stream to file with error handling.
1247
+ const writeStream = (0, node_fs_1.createWriteStream)(output);
1248
+ res.pipe(writeStream);
1249
+ /* c8 ignore next 4 - Write stream error handler, difficult to test reliably */
1250
+ writeStream.on('error', error => {
1251
+ throw new Error(`Failed to write to file: ${output}`, {
1252
+ cause: error,
1253
+ });
1254
+ });
1201
1255
  }
1202
1256
  else if (output === true) {
1203
- // Stream to stdout
1257
+ // Stream to stdout with error handling.
1204
1258
  res.pipe(process.stdout);
1259
+ /* c8 ignore next 3 - Stdout error handler, difficult to test reliably */
1260
+ process.stdout.on('error', error => {
1261
+ throw new Error('Failed to write to stdout', { cause: error });
1262
+ });
1205
1263
  }
1206
1264
  // If output is false or undefined, just return the response without streaming
1207
1265
  return this.#handleApiSuccess(res);
@@ -1219,7 +1277,7 @@ class SocketSdk {
1219
1277
  * Note: This method returns a ReadableStream for processing large datasets.
1220
1278
  */
1221
1279
  async streamPatchesFromScan(orgSlug, scanId) {
1222
- const response = await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/patches/scan/${encodeURIComponent(scanId)}`, this.#reqOptions);
1280
+ const response = await this.#executeWithRetry(async () => await (0, http_client_1.createGetRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/patches/scan/${encodeURIComponent(scanId)}`, this.#reqOptions));
1223
1281
  // Check for HTTP error status codes.
1224
1282
  if (!(0, http_client_1.isResponseOk)(response)) {
1225
1283
  throw new http_client_1.ResponseError(response, 'GET Request failed');
@@ -1240,8 +1298,8 @@ class SocketSdk {
1240
1298
  controller.enqueue(data);
1241
1299
  }
1242
1300
  catch (e) {
1243
- // Skip invalid JSON lines
1244
- continue;
1301
+ // Log parse errors for debugging invalid NDJSON lines.
1302
+ (0, debug_1.debugLog)('streamPatchesFromScan', `Failed to parse line: ${e}`);
1245
1303
  }
1246
1304
  }
1247
1305
  });
@@ -1263,7 +1321,7 @@ class SocketSdk {
1263
1321
  */
1264
1322
  async updateOrgAlertTriage(orgSlug, alertId, triageData) {
1265
1323
  try {
1266
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('PUT', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/triage/${encodeURIComponent(alertId)}`, triageData, this.#reqOptions));
1324
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('PUT', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/triage/${encodeURIComponent(alertId)}`, triageData, this.#reqOptions)));
1267
1325
  return this.#handleApiSuccess(data);
1268
1326
  }
1269
1327
  catch (e) {
@@ -1277,7 +1335,7 @@ class SocketSdk {
1277
1335
  */
1278
1336
  async updateOrgLicensePolicy(orgSlug, policyData, queryParams) {
1279
1337
  try {
1280
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/settings/license-policy?${(0, utils_1.queryToSearchParams)(queryParams)}`, policyData, this.#reqOptions));
1338
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/settings/license-policy?${(0, utils_1.queryToSearchParams)(queryParams)}`, policyData, this.#reqOptions)));
1281
1339
  return this.#handleApiSuccess(data);
1282
1340
  }
1283
1341
  catch (e) {
@@ -1292,7 +1350,7 @@ class SocketSdk {
1292
1350
  */
1293
1351
  async updateOrgRepo(orgSlug, repoSlug, queryParams) {
1294
1352
  try {
1295
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos/${encodeURIComponent(repoSlug)}`, queryParams, this.#reqOptions));
1353
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos/${encodeURIComponent(repoSlug)}`, queryParams, this.#reqOptions)));
1296
1354
  return this.#handleApiSuccess(data);
1297
1355
  }
1298
1356
  catch (e) {
@@ -1307,7 +1365,7 @@ class SocketSdk {
1307
1365
  */
1308
1366
  async updateOrgRepoLabel(orgSlug, repoSlug, labelSlug, labelData) {
1309
1367
  try {
1310
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('PUT', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos/${encodeURIComponent(repoSlug)}/labels/${encodeURIComponent(labelSlug)}`, labelData, this.#reqOptions));
1368
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('PUT', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/repos/${encodeURIComponent(repoSlug)}/labels/${encodeURIComponent(labelSlug)}`, labelData, this.#reqOptions)));
1311
1369
  return this.#handleApiSuccess(data);
1312
1370
  }
1313
1371
  catch (e) {
@@ -1321,7 +1379,7 @@ class SocketSdk {
1321
1379
  */
1322
1380
  async updateOrgSecurityPolicy(orgSlug, policyData) {
1323
1381
  try {
1324
- const data = await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/settings/security-policy`, policyData, this.#reqOptions));
1382
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, http_client_1.createRequestWithJson)('POST', this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/settings/security-policy`, policyData, this.#reqOptions)));
1325
1383
  return this.#handleApiSuccess(data);
1326
1384
  }
1327
1385
  catch (e) {
@@ -1334,11 +1392,15 @@ class SocketSdk {
1334
1392
  *
1335
1393
  * @throws {Error} When server returns 5xx status codes
1336
1394
  */
1337
- async uploadManifestFiles(orgSlug, filepaths, pathsRelativeTo = '.') {
1395
+ async uploadManifestFiles(orgSlug, filepaths, options) {
1396
+ const { pathsRelativeTo = '.' } = {
1397
+ __proto__: null,
1398
+ ...options,
1399
+ };
1338
1400
  const basePath = (0, utils_1.resolveBasePath)(pathsRelativeTo);
1339
1401
  const absFilepaths = (0, utils_1.resolveAbsPaths)(filepaths, basePath);
1340
1402
  try {
1341
- const data = await (0, http_client_1.getResponseJson)(await (0, file_upload_1.createUploadRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/upload-manifest-files`, (0, file_upload_1.createRequestBodyForFilepaths)(absFilepaths, basePath), this.#reqOptions));
1403
+ const data = await this.#executeWithRetry(async () => await (0, http_client_1.getResponseJson)(await (0, file_upload_1.createUploadRequest)(this.#baseUrl, `orgs/${encodeURIComponent(orgSlug)}/upload-manifest-files`, (0, file_upload_1.createRequestBodyForFilepaths)(absFilepaths, basePath), this.#reqOptions)));
1342
1404
  return this.#handleApiSuccess(data);
1343
1405
  }
1344
1406
  catch (e) {