@socketsecurity/sdk 1.10.0 → 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.
- package/CHANGELOG.md +5 -0
- package/dist/socket-sdk-class.js +50 -50
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
6
|
|
|
7
|
+
## [1.10.1](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.10.1) - 2025-10-04
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- Automatic retry with exponential backoff to all HTTP API calls for improved reliability on transient failures
|
|
11
|
+
|
|
7
12
|
## [1.10.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.10.0) - 2025-10-04
|
|
8
13
|
|
|
9
14
|
### Added
|
package/dist/socket-sdk-class.js
CHANGED
|
@@ -448,7 +448,7 @@ class SocketSdk {
|
|
|
448
448
|
*/
|
|
449
449
|
async createOrgDiffScanFromIds(orgSlug, queryParams) {
|
|
450
450
|
try {
|
|
451
|
-
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)));
|
|
452
452
|
return this.#handleApiSuccess(data);
|
|
453
453
|
}
|
|
454
454
|
catch (e) {
|
|
@@ -469,7 +469,7 @@ class SocketSdk {
|
|
|
469
469
|
const basePath = (0, utils_1.resolveBasePath)(pathsRelativeTo);
|
|
470
470
|
const absFilepaths = (0, utils_1.resolveAbsPaths)(filepaths, basePath);
|
|
471
471
|
try {
|
|
472
|
-
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)));
|
|
473
473
|
return this.#handleApiSuccess(data);
|
|
474
474
|
}
|
|
475
475
|
catch (e) {
|
|
@@ -484,7 +484,7 @@ class SocketSdk {
|
|
|
484
484
|
*/
|
|
485
485
|
async createOrgRepo(orgSlug, queryParams) {
|
|
486
486
|
try {
|
|
487
|
-
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)));
|
|
488
488
|
return this.#handleApiSuccess(data);
|
|
489
489
|
}
|
|
490
490
|
catch (e) {
|
|
@@ -499,7 +499,7 @@ class SocketSdk {
|
|
|
499
499
|
*/
|
|
500
500
|
async createOrgRepoLabel(orgSlug, repoSlug, labelData) {
|
|
501
501
|
try {
|
|
502
|
-
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)));
|
|
503
503
|
return this.#handleApiSuccess(data);
|
|
504
504
|
}
|
|
505
505
|
catch (e) {
|
|
@@ -520,7 +520,7 @@ class SocketSdk {
|
|
|
520
520
|
const basePath = (0, utils_1.resolveBasePath)(pathsRelativeTo);
|
|
521
521
|
const absFilepaths = (0, utils_1.resolveAbsPaths)(filepaths, basePath);
|
|
522
522
|
try {
|
|
523
|
-
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', [
|
|
524
524
|
...(0, file_upload_1.createRequestBodyForFilepaths)(absFilepaths, basePath),
|
|
525
525
|
/* c8 ignore next 3 - Optional issueRules parameter edge case. */
|
|
526
526
|
...(issueRules
|
|
@@ -531,7 +531,7 @@ class SocketSdk {
|
|
|
531
531
|
method: 'PUT',
|
|
532
532
|
})
|
|
533
533
|
/* c8 ignore next 3 - Success path return statement requires complex file upload mocking with authentication. */
|
|
534
|
-
);
|
|
534
|
+
));
|
|
535
535
|
return this.#handleApiSuccess(data);
|
|
536
536
|
}
|
|
537
537
|
catch (e) {
|
|
@@ -546,7 +546,7 @@ class SocketSdk {
|
|
|
546
546
|
*/
|
|
547
547
|
async deleteOrgDiffScan(orgSlug, diffScanId) {
|
|
548
548
|
try {
|
|
549
|
-
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)));
|
|
550
550
|
return this.#handleApiSuccess(data);
|
|
551
551
|
}
|
|
552
552
|
catch (e) {
|
|
@@ -561,7 +561,7 @@ class SocketSdk {
|
|
|
561
561
|
*/
|
|
562
562
|
async deleteOrgFullScan(orgSlug, fullScanId) {
|
|
563
563
|
try {
|
|
564
|
-
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)));
|
|
565
565
|
return this.#handleApiSuccess(data);
|
|
566
566
|
}
|
|
567
567
|
catch (e) {
|
|
@@ -576,7 +576,7 @@ class SocketSdk {
|
|
|
576
576
|
*/
|
|
577
577
|
async deleteOrgRepo(orgSlug, repoSlug) {
|
|
578
578
|
try {
|
|
579
|
-
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)));
|
|
580
580
|
return this.#handleApiSuccess(data);
|
|
581
581
|
}
|
|
582
582
|
catch (e) {
|
|
@@ -591,7 +591,7 @@ class SocketSdk {
|
|
|
591
591
|
*/
|
|
592
592
|
async deleteOrgRepoLabel(orgSlug, repoSlug, labelSlug) {
|
|
593
593
|
try {
|
|
594
|
-
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)));
|
|
595
595
|
return this.#handleApiSuccess(data);
|
|
596
596
|
}
|
|
597
597
|
catch (e) {
|
|
@@ -606,7 +606,7 @@ class SocketSdk {
|
|
|
606
606
|
*/
|
|
607
607
|
async deleteReport(reportId) {
|
|
608
608
|
try {
|
|
609
|
-
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)));
|
|
610
610
|
return this.#handleApiSuccess(data);
|
|
611
611
|
}
|
|
612
612
|
catch (e) {
|
|
@@ -621,7 +621,7 @@ class SocketSdk {
|
|
|
621
621
|
*/
|
|
622
622
|
async exportCDX(orgSlug, fullScanId) {
|
|
623
623
|
try {
|
|
624
|
-
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)));
|
|
625
625
|
return this.#handleApiSuccess(data);
|
|
626
626
|
}
|
|
627
627
|
catch (e) {
|
|
@@ -636,7 +636,7 @@ class SocketSdk {
|
|
|
636
636
|
*/
|
|
637
637
|
async exportSPDX(orgSlug, fullScanId) {
|
|
638
638
|
try {
|
|
639
|
-
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)));
|
|
640
640
|
return this.#handleApiSuccess(data);
|
|
641
641
|
}
|
|
642
642
|
catch (e) {
|
|
@@ -713,7 +713,7 @@ class SocketSdk {
|
|
|
713
713
|
*/
|
|
714
714
|
async getAPITokens(orgSlug) {
|
|
715
715
|
try {
|
|
716
|
-
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)));
|
|
717
717
|
return this.#handleApiSuccess(data);
|
|
718
718
|
}
|
|
719
719
|
catch (e) {
|
|
@@ -728,7 +728,7 @@ class SocketSdk {
|
|
|
728
728
|
*/
|
|
729
729
|
async getAuditLogEvents(orgSlug, queryParams) {
|
|
730
730
|
try {
|
|
731
|
-
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)));
|
|
732
732
|
return this.#handleApiSuccess(data);
|
|
733
733
|
}
|
|
734
734
|
catch (e) {
|
|
@@ -743,7 +743,7 @@ class SocketSdk {
|
|
|
743
743
|
*/
|
|
744
744
|
async getDiffScanById(orgSlug, diffScanId) {
|
|
745
745
|
try {
|
|
746
|
-
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)));
|
|
747
747
|
return this.#handleApiSuccess(data);
|
|
748
748
|
}
|
|
749
749
|
catch (e) {
|
|
@@ -757,7 +757,7 @@ class SocketSdk {
|
|
|
757
757
|
* Products that the organization has access to use.
|
|
758
758
|
*/
|
|
759
759
|
async getEnabledEntitlements(orgSlug) {
|
|
760
|
-
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)));
|
|
761
761
|
// Extract enabled products from the response.
|
|
762
762
|
const items = data?.items || [];
|
|
763
763
|
return items
|
|
@@ -771,7 +771,7 @@ class SocketSdk {
|
|
|
771
771
|
* an organization, returning the complete list with their status.
|
|
772
772
|
*/
|
|
773
773
|
async getEntitlements(orgSlug) {
|
|
774
|
-
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)));
|
|
775
775
|
return data?.items || [];
|
|
776
776
|
}
|
|
777
777
|
/**
|
|
@@ -782,7 +782,7 @@ class SocketSdk {
|
|
|
782
782
|
*/
|
|
783
783
|
async getIssuesByNpmPackage(pkgName, version) {
|
|
784
784
|
try {
|
|
785
|
-
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)));
|
|
786
786
|
return this.#handleApiSuccess(data);
|
|
787
787
|
}
|
|
788
788
|
catch (e) {
|
|
@@ -797,7 +797,7 @@ class SocketSdk {
|
|
|
797
797
|
*/
|
|
798
798
|
async getOrgAnalytics(time) {
|
|
799
799
|
try {
|
|
800
|
-
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)));
|
|
801
801
|
return this.#handleApiSuccess(data);
|
|
802
802
|
}
|
|
803
803
|
catch (e) {
|
|
@@ -827,7 +827,7 @@ class SocketSdk {
|
|
|
827
827
|
*/
|
|
828
828
|
async getOrgFullScanBuffered(orgSlug, fullScanId) {
|
|
829
829
|
try {
|
|
830
|
-
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)));
|
|
831
831
|
return this.#handleApiSuccess(data);
|
|
832
832
|
}
|
|
833
833
|
catch (e) {
|
|
@@ -842,7 +842,7 @@ class SocketSdk {
|
|
|
842
842
|
*/
|
|
843
843
|
async getOrgFullScanList(orgSlug, queryParams) {
|
|
844
844
|
try {
|
|
845
|
-
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)));
|
|
846
846
|
return this.#handleApiSuccess(data);
|
|
847
847
|
}
|
|
848
848
|
catch (e) {
|
|
@@ -857,7 +857,7 @@ class SocketSdk {
|
|
|
857
857
|
*/
|
|
858
858
|
async getOrgFullScanMetadata(orgSlug, fullScanId) {
|
|
859
859
|
try {
|
|
860
|
-
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)));
|
|
861
861
|
return this.#handleApiSuccess(data);
|
|
862
862
|
}
|
|
863
863
|
catch (e) {
|
|
@@ -871,7 +871,7 @@ class SocketSdk {
|
|
|
871
871
|
*/
|
|
872
872
|
async getOrgLicensePolicy(orgSlug) {
|
|
873
873
|
try {
|
|
874
|
-
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)));
|
|
875
875
|
return this.#handleApiSuccess(data);
|
|
876
876
|
}
|
|
877
877
|
catch (e) {
|
|
@@ -888,7 +888,7 @@ class SocketSdk {
|
|
|
888
888
|
const orgSlugParam = encodeURIComponent(orgSlug);
|
|
889
889
|
const repoSlugParam = encodeURIComponent(repoSlug);
|
|
890
890
|
try {
|
|
891
|
-
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)));
|
|
892
892
|
return this.#handleApiSuccess(data);
|
|
893
893
|
}
|
|
894
894
|
catch (e) {
|
|
@@ -903,7 +903,7 @@ class SocketSdk {
|
|
|
903
903
|
*/
|
|
904
904
|
async getOrgRepoLabel(orgSlug, repoSlug, labelSlug) {
|
|
905
905
|
try {
|
|
906
|
-
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)));
|
|
907
907
|
return this.#handleApiSuccess(data);
|
|
908
908
|
}
|
|
909
909
|
catch (e) {
|
|
@@ -918,7 +918,7 @@ class SocketSdk {
|
|
|
918
918
|
*/
|
|
919
919
|
async getOrgRepoLabelList(orgSlug, repoSlug) {
|
|
920
920
|
try {
|
|
921
|
-
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)));
|
|
922
922
|
return this.#handleApiSuccess(data);
|
|
923
923
|
}
|
|
924
924
|
catch (e) {
|
|
@@ -933,7 +933,7 @@ class SocketSdk {
|
|
|
933
933
|
*/
|
|
934
934
|
async getOrgRepoList(orgSlug, queryParams) {
|
|
935
935
|
try {
|
|
936
|
-
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)));
|
|
937
937
|
return this.#handleApiSuccess(data);
|
|
938
938
|
}
|
|
939
939
|
catch (e) {
|
|
@@ -947,7 +947,7 @@ class SocketSdk {
|
|
|
947
947
|
*/
|
|
948
948
|
async getOrgSecurityPolicy(orgSlug) {
|
|
949
949
|
try {
|
|
950
|
-
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)));
|
|
951
951
|
return this.#handleApiSuccess(data);
|
|
952
952
|
}
|
|
953
953
|
catch (e) {
|
|
@@ -962,7 +962,7 @@ class SocketSdk {
|
|
|
962
962
|
*/
|
|
963
963
|
async getOrgTriage(orgSlug) {
|
|
964
964
|
try {
|
|
965
|
-
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)));
|
|
966
966
|
return this.#handleApiSuccess(data);
|
|
967
967
|
}
|
|
968
968
|
catch (e) {
|
|
@@ -977,7 +977,7 @@ class SocketSdk {
|
|
|
977
977
|
*/
|
|
978
978
|
async getQuota() {
|
|
979
979
|
try {
|
|
980
|
-
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)));
|
|
981
981
|
return this.#handleApiSuccess(data);
|
|
982
982
|
}
|
|
983
983
|
catch (e) {
|
|
@@ -992,7 +992,7 @@ class SocketSdk {
|
|
|
992
992
|
*/
|
|
993
993
|
async getRepoAnalytics(repo, time) {
|
|
994
994
|
try {
|
|
995
|
-
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)));
|
|
996
996
|
return this.#handleApiSuccess(data);
|
|
997
997
|
}
|
|
998
998
|
catch (e) {
|
|
@@ -1007,7 +1007,7 @@ class SocketSdk {
|
|
|
1007
1007
|
*/
|
|
1008
1008
|
async getScan(id) {
|
|
1009
1009
|
try {
|
|
1010
|
-
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)));
|
|
1011
1011
|
return this.#handleApiSuccess(data);
|
|
1012
1012
|
}
|
|
1013
1013
|
catch (e) {
|
|
@@ -1022,7 +1022,7 @@ class SocketSdk {
|
|
|
1022
1022
|
*/
|
|
1023
1023
|
async getScanList() {
|
|
1024
1024
|
try {
|
|
1025
|
-
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'));
|
|
1026
1026
|
return this.#handleApiSuccess(data);
|
|
1027
1027
|
}
|
|
1028
1028
|
catch (e) {
|
|
@@ -1037,7 +1037,7 @@ class SocketSdk {
|
|
|
1037
1037
|
*/
|
|
1038
1038
|
async getScoreByNpmPackage(pkgName, version) {
|
|
1039
1039
|
try {
|
|
1040
|
-
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)));
|
|
1041
1041
|
return this.#handleApiSuccess(data);
|
|
1042
1042
|
}
|
|
1043
1043
|
catch (e) {
|
|
@@ -1052,7 +1052,7 @@ class SocketSdk {
|
|
|
1052
1052
|
*/
|
|
1053
1053
|
async getSupportedScanFiles() {
|
|
1054
1054
|
try {
|
|
1055
|
-
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)));
|
|
1056
1056
|
return this.#handleApiSuccess(data);
|
|
1057
1057
|
}
|
|
1058
1058
|
catch (e) {
|
|
@@ -1067,7 +1067,7 @@ class SocketSdk {
|
|
|
1067
1067
|
*/
|
|
1068
1068
|
async listOrgDiffScans(orgSlug) {
|
|
1069
1069
|
try {
|
|
1070
|
-
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)));
|
|
1071
1071
|
return this.#handleApiSuccess(data);
|
|
1072
1072
|
}
|
|
1073
1073
|
catch (e) {
|
|
@@ -1082,7 +1082,7 @@ class SocketSdk {
|
|
|
1082
1082
|
*/
|
|
1083
1083
|
async postAPIToken(orgSlug, tokenData) {
|
|
1084
1084
|
try {
|
|
1085
|
-
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)));
|
|
1086
1086
|
return this.#handleApiSuccess(data);
|
|
1087
1087
|
}
|
|
1088
1088
|
catch (e) {
|
|
@@ -1097,7 +1097,7 @@ class SocketSdk {
|
|
|
1097
1097
|
*/
|
|
1098
1098
|
async postAPITokensRevoke(orgSlug, tokenId) {
|
|
1099
1099
|
try {
|
|
1100
|
-
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)));
|
|
1101
1101
|
return this.#handleApiSuccess(data);
|
|
1102
1102
|
}
|
|
1103
1103
|
catch (e) {
|
|
@@ -1112,7 +1112,7 @@ class SocketSdk {
|
|
|
1112
1112
|
*/
|
|
1113
1113
|
async postAPITokensRotate(orgSlug, tokenId) {
|
|
1114
1114
|
try {
|
|
1115
|
-
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)));
|
|
1116
1116
|
return this.#handleApiSuccess(data);
|
|
1117
1117
|
}
|
|
1118
1118
|
catch (e) {
|
|
@@ -1127,7 +1127,7 @@ class SocketSdk {
|
|
|
1127
1127
|
*/
|
|
1128
1128
|
async postAPITokenUpdate(orgSlug, tokenId, updateData) {
|
|
1129
1129
|
try {
|
|
1130
|
-
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)));
|
|
1131
1131
|
return this.#handleApiSuccess(data);
|
|
1132
1132
|
}
|
|
1133
1133
|
catch (e) {
|
|
@@ -1142,7 +1142,7 @@ class SocketSdk {
|
|
|
1142
1142
|
*/
|
|
1143
1143
|
async postSettings(selectors) {
|
|
1144
1144
|
try {
|
|
1145
|
-
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)));
|
|
1146
1146
|
return this.#handleApiSuccess(data);
|
|
1147
1147
|
}
|
|
1148
1148
|
catch (e) {
|
|
@@ -1157,7 +1157,7 @@ class SocketSdk {
|
|
|
1157
1157
|
*/
|
|
1158
1158
|
async searchDependencies(queryParams) {
|
|
1159
1159
|
try {
|
|
1160
|
-
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)));
|
|
1161
1161
|
return this.#handleApiSuccess(data);
|
|
1162
1162
|
}
|
|
1163
1163
|
catch (e) {
|
|
@@ -1277,7 +1277,7 @@ class SocketSdk {
|
|
|
1277
1277
|
* Note: This method returns a ReadableStream for processing large datasets.
|
|
1278
1278
|
*/
|
|
1279
1279
|
async streamPatchesFromScan(orgSlug, scanId) {
|
|
1280
|
-
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));
|
|
1281
1281
|
// Check for HTTP error status codes.
|
|
1282
1282
|
if (!(0, http_client_1.isResponseOk)(response)) {
|
|
1283
1283
|
throw new http_client_1.ResponseError(response, 'GET Request failed');
|
|
@@ -1321,7 +1321,7 @@ class SocketSdk {
|
|
|
1321
1321
|
*/
|
|
1322
1322
|
async updateOrgAlertTriage(orgSlug, alertId, triageData) {
|
|
1323
1323
|
try {
|
|
1324
|
-
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)));
|
|
1325
1325
|
return this.#handleApiSuccess(data);
|
|
1326
1326
|
}
|
|
1327
1327
|
catch (e) {
|
|
@@ -1335,7 +1335,7 @@ class SocketSdk {
|
|
|
1335
1335
|
*/
|
|
1336
1336
|
async updateOrgLicensePolicy(orgSlug, policyData, queryParams) {
|
|
1337
1337
|
try {
|
|
1338
|
-
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)));
|
|
1339
1339
|
return this.#handleApiSuccess(data);
|
|
1340
1340
|
}
|
|
1341
1341
|
catch (e) {
|
|
@@ -1350,7 +1350,7 @@ class SocketSdk {
|
|
|
1350
1350
|
*/
|
|
1351
1351
|
async updateOrgRepo(orgSlug, repoSlug, queryParams) {
|
|
1352
1352
|
try {
|
|
1353
|
-
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)));
|
|
1354
1354
|
return this.#handleApiSuccess(data);
|
|
1355
1355
|
}
|
|
1356
1356
|
catch (e) {
|
|
@@ -1365,7 +1365,7 @@ class SocketSdk {
|
|
|
1365
1365
|
*/
|
|
1366
1366
|
async updateOrgRepoLabel(orgSlug, repoSlug, labelSlug, labelData) {
|
|
1367
1367
|
try {
|
|
1368
|
-
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)));
|
|
1369
1369
|
return this.#handleApiSuccess(data);
|
|
1370
1370
|
}
|
|
1371
1371
|
catch (e) {
|
|
@@ -1379,7 +1379,7 @@ class SocketSdk {
|
|
|
1379
1379
|
*/
|
|
1380
1380
|
async updateOrgSecurityPolicy(orgSlug, policyData) {
|
|
1381
1381
|
try {
|
|
1382
|
-
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)));
|
|
1383
1383
|
return this.#handleApiSuccess(data);
|
|
1384
1384
|
}
|
|
1385
1385
|
catch (e) {
|
|
@@ -1400,7 +1400,7 @@ class SocketSdk {
|
|
|
1400
1400
|
const basePath = (0, utils_1.resolveBasePath)(pathsRelativeTo);
|
|
1401
1401
|
const absFilepaths = (0, utils_1.resolveAbsPaths)(filepaths, basePath);
|
|
1402
1402
|
try {
|
|
1403
|
-
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)));
|
|
1404
1404
|
return this.#handleApiSuccess(data);
|
|
1405
1405
|
}
|
|
1406
1406
|
catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/sdk",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "SDK for the Socket API client",
|
|
6
6
|
"author": {
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"update:socket": "pnpm -r update '@socketsecurity/*' --latest"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@socketsecurity/registry": "1.4.
|
|
78
|
+
"@socketsecurity/registry": "1.4.1"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@biomejs/biome": "2.2.4",
|