@socketsecurity/sdk 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +100 -4
- package/README.md +10 -23
- package/data/api-method-quota-and-permissions.json +20 -0
- package/dist/constants.d.ts +1 -1
- package/dist/http-client.d.ts +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +340 -179
- package/dist/socket-sdk-class.d.ts +130 -25
- package/dist/types-strict.d.ts +48 -2
- package/dist/types.d.ts +6 -5
- package/package.json +36 -44
- package/types/api.d.ts +1257 -105
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,32 @@ 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
|
+
## [3.4.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v3.4.0) - 2026-03-11
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **listRepositories**: New `workspace` query parameter to filter repositories by workspace (when provided, only repos in that workspace are returned)
|
|
12
|
+
- New audit log action types for OAuth refresh tokens and repository access rules:
|
|
13
|
+
- `CreateOauthRefreshToken` - Track OAuth refresh token creation
|
|
14
|
+
- `RotateOauthRefreshToken` - Track OAuth refresh token rotation
|
|
15
|
+
- `CreateRepoAccessRule` - Track repository access rule creation
|
|
16
|
+
- `UpdateRepoAccessRule` - Track repository access rule updates
|
|
17
|
+
- `DeleteRepoAccessRule` - Track repository access rule deletion
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Synced OpenAPI type definitions with latest API specification
|
|
22
|
+
|
|
23
|
+
## [3.3.1](https://github.com/SocketDev/socket-sdk-js/releases/tag/v3.3.1) - 2026-03-03
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- **createRepository**: Now requires `repoSlug` as second parameter with typed options including `workspace`, `visibility`, `homepage`, `archived`, `default_branch`, and `description`
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- New API endpoints from OpenAPI sync: CSV/PDF export for full scans, delete triage alerts, new alert types
|
|
32
|
+
|
|
7
33
|
## [3.3.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v3.3.0) - 2026-01-25
|
|
8
34
|
|
|
9
35
|
### Added
|
|
@@ -313,6 +339,7 @@ The following methods mapped to deprecated `/report/*` backend endpoints and hav
|
|
|
313
339
|
#### Method Renames (Following REST Conventions)
|
|
314
340
|
|
|
315
341
|
**Full Scans (Modern API):**
|
|
342
|
+
|
|
316
343
|
- `getOrgFullScanList()` → `listFullScans()` with `ListFullScansOptions`
|
|
317
344
|
- `createOrgFullScan()` → `createFullScan()` with `CreateFullScanOptions`
|
|
318
345
|
- `getOrgFullScanBuffered()` → `getFullScan()`
|
|
@@ -321,9 +348,11 @@ The following methods mapped to deprecated `/report/*` backend endpoints and hav
|
|
|
321
348
|
- `getOrgFullScanMetadata()` → `getFullScanMetadata()`
|
|
322
349
|
|
|
323
350
|
**Organizations:**
|
|
351
|
+
|
|
324
352
|
- `getOrganizations()` → `listOrganizations()`
|
|
325
353
|
|
|
326
354
|
**Repositories:**
|
|
355
|
+
|
|
327
356
|
- `getOrgRepoList()` → `listRepositories()` with `ListRepositoriesOptions`
|
|
328
357
|
- `getOrgRepo()` → `getRepository()`
|
|
329
358
|
- `createOrgRepo()` → `createRepository()`
|
|
@@ -342,27 +371,29 @@ Strict types now mark guaranteed API fields as required instead of optional, imp
|
|
|
342
371
|
|
|
343
372
|
- File-upload methods automatically skip unreadable files with warnings instead of failing
|
|
344
373
|
|
|
345
|
-
See [docs/migration-v3.md](./docs/migration-v3.md) and [docs/when-to-use-what.md](./docs/when-to-use-what.md) for migration guidance.
|
|
346
|
-
|
|
347
374
|
## [2.0.7](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.7) - 2025-10-22
|
|
348
375
|
|
|
349
376
|
### Changed
|
|
377
|
+
|
|
350
378
|
- Sync with openapi definition
|
|
351
379
|
|
|
352
380
|
## [2.0.6](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.6) - 2025-10-22
|
|
353
381
|
|
|
354
382
|
### Fixed
|
|
383
|
+
|
|
355
384
|
- TypeScript lint compliance for array type syntax in `SocketSdkArrayElement` type helper
|
|
356
385
|
|
|
357
386
|
## [2.0.5](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.5) - 2025-10-22
|
|
358
387
|
|
|
359
388
|
### Added
|
|
389
|
+
|
|
360
390
|
- `SocketSdkData<T>` type helper for extracting data from SDK operation results
|
|
361
391
|
- `SocketSdkArrayElement<T, K>` type helper for extracting array element types from SDK operations
|
|
362
392
|
|
|
363
393
|
## [2.0.4](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.4) - 2025-10-22
|
|
364
394
|
|
|
365
395
|
### Added
|
|
396
|
+
|
|
366
397
|
- Support for `Retry-After` header in rate limit responses (HTTP 429)
|
|
367
398
|
- Automatically respects server-specified retry delays
|
|
368
399
|
- Parses both delay-seconds (numeric) and HTTP-date formats
|
|
@@ -371,16 +402,19 @@ See [docs/migration-v3.md](./docs/migration-v3.md) and [docs/when-to-use-what.md
|
|
|
371
402
|
## [2.0.3](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.3) - 2025-10-22
|
|
372
403
|
|
|
373
404
|
### Fixed
|
|
405
|
+
|
|
374
406
|
- Improved TypeScript module resolution with explicit type exports instead of wildcard re-exports
|
|
375
407
|
|
|
376
408
|
## [2.0.2](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.2) - 2025-10-22
|
|
377
409
|
|
|
378
410
|
### Fixed
|
|
411
|
+
|
|
379
412
|
- Ensured expected dist/ files are produced and refined package.json exports
|
|
380
413
|
|
|
381
414
|
## [2.0.1](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.1) - 2025-10-21
|
|
382
415
|
|
|
383
416
|
### Changed
|
|
417
|
+
|
|
384
418
|
- Use `@socketsecurity/lib` under the hood
|
|
385
419
|
- Synced OpenAPI type definitions with latest API specification
|
|
386
420
|
- Added documentation for `scan_type` query parameter on manifest upload endpoint (used for categorizing multiple SBOM heads per repository branch)
|
|
@@ -389,6 +423,7 @@ See [docs/migration-v3.md](./docs/migration-v3.md) and [docs/when-to-use-what.md
|
|
|
389
423
|
## [2.0.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.0) - 2025-10-10
|
|
390
424
|
|
|
391
425
|
### Changed
|
|
426
|
+
|
|
392
427
|
- **BREAKING**: Migrated to ESM-only module format
|
|
393
428
|
- Package is now ESM-only (`"type": "module"` in package.json)
|
|
394
429
|
- All output files use `.mjs` extension for JavaScript
|
|
@@ -399,43 +434,52 @@ See [docs/migration-v3.md](./docs/migration-v3.md) and [docs/when-to-use-what.md
|
|
|
399
434
|
- Improved code splitting for better tree-shaking with ESM
|
|
400
435
|
|
|
401
436
|
### Removed
|
|
437
|
+
|
|
402
438
|
- **BREAKING**: Removed CommonJS support and exports
|
|
403
439
|
- Removed CommonJS-specific build configurations
|
|
404
440
|
|
|
405
441
|
### Migration Guide
|
|
442
|
+
|
|
406
443
|
To migrate from v1.x to v2.0:
|
|
444
|
+
|
|
407
445
|
1. Ensure your project supports ESM modules (Node.js 14+ with `"type": "module"` or `.mjs` extensions)
|
|
408
446
|
2. Update imports from CommonJS `require()` to ESM `import` statements:
|
|
447
|
+
|
|
409
448
|
```javascript
|
|
410
449
|
// Before (v1.x)
|
|
411
|
-
const { SocketSdk } = require('@socketsecurity/sdk')
|
|
450
|
+
const { SocketSdk } = require('@socketsecurity/sdk')
|
|
412
451
|
|
|
413
452
|
// After (v2.0)
|
|
414
|
-
import { SocketSdk } from '@socketsecurity/sdk'
|
|
453
|
+
import { SocketSdk } from '@socketsecurity/sdk'
|
|
415
454
|
```
|
|
455
|
+
|
|
416
456
|
3. If your project still requires CommonJS, consider staying on v1.x or using a transpiler
|
|
417
457
|
|
|
418
458
|
## [1.11.2](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.11.2) - 2025-10-07
|
|
419
459
|
|
|
420
460
|
### Fixed
|
|
461
|
+
|
|
421
462
|
- Fixed typos in requirements.json
|
|
422
463
|
- Updated @socketsecurity/registry to fix bugs related to inlined runtime-dependent expressions
|
|
423
464
|
|
|
424
465
|
## [1.11.1](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.11.1) - 2025-10-06
|
|
425
466
|
|
|
426
467
|
### Added
|
|
468
|
+
|
|
427
469
|
- Performance optimizations with memoization for `normalizeBaseUrl` and quota utility functions
|
|
428
470
|
- Performance tracking to HTTP client functions
|
|
429
471
|
- Comprehensive error handling tests for SDK methods across organization, scanning, and batch APIs
|
|
430
472
|
- Reusable assertion helpers for SDK tests
|
|
431
473
|
|
|
432
474
|
### Changed
|
|
475
|
+
|
|
433
476
|
- Improved test coverage and reliability with additional test cases
|
|
434
477
|
- Streamlined documentation (README, TESTING.md, QUOTA.md, EXAMPLES.md) for better clarity and discoverability
|
|
435
478
|
|
|
436
479
|
## [1.11.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.11.0) - 2025-10-04
|
|
437
480
|
|
|
438
481
|
### Added
|
|
482
|
+
|
|
439
483
|
- Optional TTL caching for API responses with configurable cache duration
|
|
440
484
|
- New `cache` option (default: false) to enable response caching
|
|
441
485
|
- New `cacheTtl` option (default: 5 minutes) to customize cache duration
|
|
@@ -443,16 +487,19 @@ To migrate from v1.x to v2.0:
|
|
|
443
487
|
## [1.10.1](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.10.1) - 2025-10-04
|
|
444
488
|
|
|
445
489
|
### Added
|
|
490
|
+
|
|
446
491
|
- Automatic retry with exponential backoff to all HTTP API calls for improved reliability on transient failures
|
|
447
492
|
|
|
448
493
|
## [1.10.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.10.0) - 2025-10-04
|
|
449
494
|
|
|
450
495
|
### Added
|
|
496
|
+
|
|
451
497
|
- Added `PromiseQueue` utility for controlled concurrency in async operations
|
|
452
498
|
- HTTP retry logic with exponential backoff for improved reliability on transient failures
|
|
453
499
|
- Added option type interfaces: `CreateDependenciesSnapshotOptions`, `CreateOrgFullScanOptions`, `CreateScanFromFilepathsOptions`, `StreamOrgFullScanOptions`, `UploadManifestFilesOptions`
|
|
454
500
|
|
|
455
501
|
### Changed
|
|
502
|
+
|
|
456
503
|
- **BREAKING**: Refactored SDK methods to use options objects instead of positional parameters for better API clarity:
|
|
457
504
|
- `createDependenciesSnapshot(filepaths, options)` - replaced `repo` and `branch` positional parameters with options object
|
|
458
505
|
- `createOrgFullScan(orgSlug, filepaths, options)` - replaced positional parameters with options object
|
|
@@ -465,6 +512,7 @@ To migrate from v1.x to v2.0:
|
|
|
465
512
|
- Updated `@socketsecurity/registry` dependency to 1.4.0
|
|
466
513
|
|
|
467
514
|
### Fixed
|
|
515
|
+
|
|
468
516
|
- Fixed import assertion syntax for JSON imports to use standard import syntax
|
|
469
517
|
- Fixed HTTP retry test mocks to correctly match PUT method requests
|
|
470
518
|
- Fixed critical issues in type handling and URL search parameter conversions
|
|
@@ -472,22 +520,26 @@ To migrate from v1.x to v2.0:
|
|
|
472
520
|
## [1.9.2](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.9.2) - 2025-10-04
|
|
473
521
|
|
|
474
522
|
### Changed
|
|
523
|
+
|
|
475
524
|
- Improved TypeScript type definitions - All optional properties now include explicit `| undefined` type annotations for better type narrowing and null safety
|
|
476
525
|
|
|
477
526
|
## [1.9.1](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.9.1) - 2025-10-03
|
|
478
527
|
|
|
479
528
|
### Changed
|
|
529
|
+
|
|
480
530
|
- Disabled TypeScript declaration map generation to reduce package size
|
|
481
531
|
|
|
482
532
|
## [1.9.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.9.0) - 2025-10-03
|
|
483
533
|
|
|
484
534
|
### Changed
|
|
535
|
+
|
|
485
536
|
- **BREAKING**: Improved `SocketSdkResult` type compatibility - success and error results now have symmetric properties (`data`, `error`, `cause`) with explicit `undefined` types for better TypeScript narrowing
|
|
486
537
|
- **BREAKING**: Removed `CResult` type (CLI-specific) in favor of SDK-appropriate `SocketSdkGenericResult` type for `getApi()` and `sendApi()` methods
|
|
487
538
|
- Updated `getApi()` and `sendApi()` to use `SocketSdkGenericResult` with consistent HTTP status codes instead of CLI exit codes
|
|
488
539
|
- All result types now use `success` discriminant with `status` (HTTP code), `data`, `error`, and `cause` properties on both branches
|
|
489
540
|
|
|
490
541
|
### Migration Guide
|
|
542
|
+
|
|
491
543
|
- If using `getApi()` or `sendApi()` with `throws: false`, update from `CResult` to `SocketSdkGenericResult`
|
|
492
544
|
- Change `.ok` checks to `.success`
|
|
493
545
|
- Change `.code` to `.status` (now contains HTTP status code)
|
|
@@ -497,11 +549,13 @@ To migrate from v1.x to v2.0:
|
|
|
497
549
|
## [1.8.6](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.8.6) - 2025-10-02
|
|
498
550
|
|
|
499
551
|
### Changed
|
|
552
|
+
|
|
500
553
|
- Reduced package size by excluding source map files (.js.map) from published package
|
|
501
554
|
|
|
502
555
|
## [1.8.5](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.8.5) - 2025-10-02
|
|
503
556
|
|
|
504
557
|
### Changed
|
|
558
|
+
|
|
505
559
|
- Synced with OpenAPI definition
|
|
506
560
|
- Added new `/openapi.json` endpoint for retrieving API specification in JSON format
|
|
507
561
|
- Updated repo label filter descriptions to document empty string ("") usage for repositories with no labels
|
|
@@ -510,37 +564,44 @@ To migrate from v1.x to v2.0:
|
|
|
510
564
|
## [1.8.4](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.8.4) - 2025-10-01
|
|
511
565
|
|
|
512
566
|
### Fixed
|
|
567
|
+
|
|
513
568
|
- Fixed registry constant import paths to use correct casing (SOCKET_PUBLIC_API_TOKEN, UNKNOWN_ERROR)
|
|
514
569
|
|
|
515
570
|
## [1.8.3](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.8.3) - 2025-09-30
|
|
516
571
|
|
|
517
572
|
### Changed
|
|
573
|
+
|
|
518
574
|
- Synced with OpenAPI definition
|
|
519
575
|
|
|
520
576
|
## [1.8.2](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.8.2) - 2025-09-29
|
|
521
577
|
|
|
522
578
|
### Fixed
|
|
579
|
+
|
|
523
580
|
- Fixed publishing workflow to ensure dist folder is built before npm publish
|
|
524
581
|
- Changed prepublishOnly script to prevent accidental local publishing
|
|
525
582
|
|
|
526
583
|
## [1.8.1](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.8.1) - 2025-09-29
|
|
527
584
|
|
|
528
585
|
### Changed
|
|
586
|
+
|
|
529
587
|
- Update test infrastructure and build configuration
|
|
530
588
|
|
|
531
589
|
## [1.8.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.8.0) - 2025-09-27
|
|
532
590
|
|
|
533
591
|
### Added
|
|
592
|
+
|
|
534
593
|
- Quota utility functions for API cost management in `quota-utils.ts`
|
|
535
594
|
- New exported functions: `checkQuota`, `formatQuotaReport`, `getEstimatedCost`, `getMethodCost`, `getQuotaSummary`, `isWithinQuota`
|
|
536
595
|
- Example files demonstrating quota usage patterns
|
|
537
596
|
|
|
538
597
|
### Changed
|
|
598
|
+
|
|
539
599
|
- Improved error handling for quota utilities
|
|
540
600
|
|
|
541
601
|
## [1.7.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.7.0) - 2025-09-26
|
|
542
602
|
|
|
543
603
|
### Added
|
|
604
|
+
|
|
544
605
|
- `getApi` method for raw GET requests with configurable response handling
|
|
545
606
|
- `sendApi` method for POST/PUT requests with JSON body support
|
|
546
607
|
- `CResult` type pattern for non-throwing API operations
|
|
@@ -560,6 +621,7 @@ To migrate from v1.x to v2.0:
|
|
|
560
621
|
- Additional coverage tests for invalid JSON line handling in NDJSON streams
|
|
561
622
|
|
|
562
623
|
### Changed
|
|
624
|
+
|
|
563
625
|
- Improved error message formatting and JSON parsing error handling
|
|
564
626
|
- Enhanced type safety with better generic constraints
|
|
565
627
|
- Renamed option types to `GetOptions` and `SendOptions` for consistency
|
|
@@ -574,169 +636,203 @@ To migrate from v1.x to v2.0:
|
|
|
574
636
|
## [1.6.1](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.6.1) - 2025-09-24
|
|
575
637
|
|
|
576
638
|
### Changed
|
|
639
|
+
|
|
577
640
|
- Updated to use trusted publisher for npm package provenance
|
|
578
641
|
|
|
579
642
|
## [1.6.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.6.0) - 2025-09-24
|
|
580
643
|
|
|
581
644
|
### Changed
|
|
645
|
+
|
|
582
646
|
- **BREAKING:** Converted to single CommonJS export type, removing dual ESM/CJS support
|
|
583
647
|
|
|
584
648
|
## [1.5.1](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.5.1) - 2025-09-24
|
|
585
649
|
|
|
586
650
|
### Fixed
|
|
651
|
+
|
|
587
652
|
- Added missing setup-script to provenance workflow
|
|
588
653
|
|
|
589
654
|
## [1.5.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.5.0) - 2025-09-23
|
|
590
655
|
|
|
591
656
|
### Added
|
|
657
|
+
|
|
592
658
|
- `getOrgFullScanBuffered` method for buffered full scan retrieval
|
|
593
659
|
|
|
594
660
|
### Changed
|
|
661
|
+
|
|
595
662
|
- **BREAKING:** Renamed `getOrgFullScan` to `streamOrgFullScan` for clarity
|
|
596
663
|
|
|
597
664
|
### Fixed
|
|
665
|
+
|
|
598
666
|
- Added missing `getResponseJson` call to `createScanFromFilepaths`
|
|
599
667
|
- Improved handling of empty response bodies
|
|
600
668
|
|
|
601
669
|
## [1.4.93](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.93) - 2025-09-15
|
|
602
670
|
|
|
603
671
|
### Fixed
|
|
672
|
+
|
|
604
673
|
- Fixed malformed part header issue for upload of manifest files
|
|
605
674
|
|
|
606
675
|
## [1.4.91](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.91) - 2025-09-11
|
|
607
676
|
|
|
608
677
|
### Changed
|
|
678
|
+
|
|
609
679
|
- Improved URL handling
|
|
610
680
|
|
|
611
681
|
## [1.4.90](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.90) - 2025-09-11
|
|
612
682
|
|
|
613
683
|
### Fixed
|
|
684
|
+
|
|
614
685
|
- Improved error handling
|
|
615
686
|
|
|
616
687
|
## [1.4.84](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.84) - 2025-09-03
|
|
617
688
|
|
|
618
689
|
### Added
|
|
690
|
+
|
|
619
691
|
- Filter alerts by action
|
|
620
692
|
|
|
621
693
|
### Changed
|
|
694
|
+
|
|
622
695
|
- Improved JSON parsing
|
|
623
696
|
|
|
624
697
|
## [1.4.82](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.82) - 2025-09-02
|
|
625
698
|
|
|
626
699
|
### Changed
|
|
700
|
+
|
|
627
701
|
- Improved public policy handling
|
|
628
702
|
|
|
629
703
|
## [1.4.81](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.81) - 2025-09-02
|
|
630
704
|
|
|
631
705
|
### Added
|
|
706
|
+
|
|
632
707
|
- Add public security policy support
|
|
633
708
|
|
|
634
709
|
## [1.4.79](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.79) - 2025-08-27
|
|
635
710
|
|
|
636
711
|
### Fixed
|
|
712
|
+
|
|
637
713
|
- Fixed ESM module compatibility
|
|
638
714
|
|
|
639
715
|
## [1.4.77](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.77) - 2025-08-25
|
|
640
716
|
|
|
641
717
|
### Added
|
|
718
|
+
|
|
642
719
|
- Add timeout option for API requests
|
|
643
720
|
|
|
644
721
|
## [1.4.73](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.73) - 2025-08-08
|
|
645
722
|
|
|
646
723
|
### Fixed
|
|
724
|
+
|
|
647
725
|
- Fixed crates ecosystem support
|
|
648
726
|
|
|
649
727
|
## [1.4.72](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.72) - 2025-08-08
|
|
650
728
|
|
|
651
729
|
### Fixed
|
|
730
|
+
|
|
652
731
|
- Fixed rubygems ecosystem support
|
|
653
732
|
|
|
654
733
|
## [1.4.71](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.71) - 2025-08-08
|
|
655
734
|
|
|
656
735
|
### Added
|
|
736
|
+
|
|
657
737
|
- Support for crate and rubygem ecosystems
|
|
658
738
|
|
|
659
739
|
## [1.4.68](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.68) - 2025-08-02
|
|
660
740
|
|
|
661
741
|
### Changed
|
|
742
|
+
|
|
662
743
|
- Improved type definitions
|
|
663
744
|
- Memory usage optimizations
|
|
664
745
|
|
|
665
746
|
## [1.4.66](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.66) - 2025-07-29
|
|
666
747
|
|
|
667
748
|
### Fixed
|
|
749
|
+
|
|
668
750
|
- Fixed file upload timing issue
|
|
669
751
|
- Fixed multipart form data formatting
|
|
670
752
|
|
|
671
753
|
## [1.4.64](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.64) - 2025-07-22
|
|
672
754
|
|
|
673
755
|
### Changed
|
|
756
|
+
|
|
674
757
|
- Improved method signatures
|
|
675
758
|
|
|
676
759
|
## [1.4.62](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.62) - 2025-07-21
|
|
677
760
|
|
|
678
761
|
### Fixed
|
|
762
|
+
|
|
679
763
|
- Fixed query parameter handling for empty values
|
|
680
764
|
|
|
681
765
|
## [1.4.61](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.61) - 2025-07-21
|
|
682
766
|
|
|
683
767
|
### Changed
|
|
768
|
+
|
|
684
769
|
- Improved query parameter normalization
|
|
685
770
|
|
|
686
771
|
## [1.4.60](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.60) - 2025-07-21
|
|
687
772
|
|
|
688
773
|
### Changed
|
|
774
|
+
|
|
689
775
|
- Renamed result type for clarity
|
|
690
776
|
|
|
691
777
|
## [1.4.59](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.59) - 2025-07-20
|
|
692
778
|
|
|
693
779
|
### Added
|
|
780
|
+
|
|
694
781
|
- Add alias types for improved developer experience
|
|
695
782
|
|
|
696
783
|
## [1.4.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.4.0) - 2025-05-01
|
|
697
784
|
|
|
698
785
|
### Added
|
|
786
|
+
|
|
699
787
|
- Full scans feature support
|
|
700
788
|
- Audit log and repos features
|
|
701
789
|
- Organization security policy support (getOrgSecurityPolicy)
|
|
702
790
|
|
|
703
791
|
### Changed
|
|
792
|
+
|
|
704
793
|
- Improved TypeScript type exports
|
|
705
794
|
- Enhanced ESM and CJS dual package support
|
|
706
795
|
|
|
707
796
|
## [1.3.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.3.0) - 2025-03-01
|
|
708
797
|
|
|
709
798
|
### Added
|
|
799
|
+
|
|
710
800
|
- Support for multiple ecosystem types
|
|
711
801
|
- Enhanced error handling and reporting
|
|
712
802
|
|
|
713
803
|
### Changed
|
|
804
|
+
|
|
714
805
|
- Improved API client architecture
|
|
715
806
|
- Better TypeScript type definitions
|
|
716
807
|
|
|
717
808
|
## [1.2.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.2.0) - 2025-01-15
|
|
718
809
|
|
|
719
810
|
### Added
|
|
811
|
+
|
|
720
812
|
- File upload support for manifest files
|
|
721
813
|
- Request body creation for file paths
|
|
722
814
|
|
|
723
815
|
### Changed
|
|
816
|
+
|
|
724
817
|
- Enhanced multipart form data handling
|
|
725
818
|
- Improved streaming support
|
|
726
819
|
|
|
727
820
|
## [1.1.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.1.0) - 2024-11-01
|
|
728
821
|
|
|
729
822
|
### Added
|
|
823
|
+
|
|
730
824
|
- Query parameter normalization
|
|
731
825
|
- Enhanced search parameter handling
|
|
732
826
|
|
|
733
827
|
### Changed
|
|
828
|
+
|
|
734
829
|
- Improved URL parsing and handling
|
|
735
830
|
- Better error messages
|
|
736
831
|
|
|
737
832
|
## [1.0.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.0.0) - 2024-09-01
|
|
738
833
|
|
|
739
834
|
### Added
|
|
835
|
+
|
|
740
836
|
- Initial release of Socket SDK for JavaScript
|
|
741
837
|
- Full Socket API client implementation
|
|
742
838
|
- TypeScript support with comprehensive type definitions
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://socket.dev/npm/package/@socketsecurity/sdk)
|
|
4
4
|
[](https://github.com/SocketDev/socket-sdk-js/actions/workflows/ci.yml)
|
|
5
|
-

|
|
6
6
|
|
|
7
7
|
[](https://twitter.com/SocketSecurity)
|
|
8
8
|
[](https://bsky.app/profile/socket.dev)
|
|
@@ -21,9 +21,9 @@ pnpm add @socketsecurity/sdk
|
|
|
21
21
|
import { SocketSdk } from '@socketsecurity/sdk'
|
|
22
22
|
|
|
23
23
|
const client = new SocketSdk('your-api-key', {
|
|
24
|
-
retries: 3,
|
|
25
|
-
retryDelay: 1000,
|
|
26
|
-
timeout: 30000,
|
|
24
|
+
retries: 3, // Retry failed requests up to 3 times
|
|
25
|
+
retryDelay: 1000, // Start with 1s delay, exponential backoff
|
|
26
|
+
timeout: 30000, // 30 second timeout
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
// Check your quota
|
|
@@ -35,37 +35,24 @@ if (quota.success) {
|
|
|
35
35
|
// Analyze a package
|
|
36
36
|
const result = await client.getScoreByNpmPackage('express', '4.18.0')
|
|
37
37
|
if (result.success) {
|
|
38
|
-
console.log(`
|
|
38
|
+
console.log(`Dependency Score: ${result.data.depscore}`)
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// Batch analyze multiple packages
|
|
42
42
|
const batchResult = await client.batchPackageFetch({
|
|
43
43
|
components: [
|
|
44
44
|
{ purl: 'pkg:npm/express@4.18.0' },
|
|
45
|
-
{ purl: 'pkg:npm/react@18.0.0' }
|
|
46
|
-
]
|
|
45
|
+
{ purl: 'pkg:npm/react@18.0.0' },
|
|
46
|
+
],
|
|
47
47
|
})
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
## Documentation
|
|
51
51
|
|
|
52
|
-
| Guide
|
|
53
|
-
|
|
54
|
-
| **[
|
|
55
|
-
| **[API Reference](./docs/api-reference.md)** | Complete API method documentation |
|
|
56
|
-
| **[Usage Examples](./docs/usage-examples.md)** | Real-world patterns and code samples |
|
|
52
|
+
| Guide | Description |
|
|
53
|
+
| -------------------------------------------------- | ----------------------------------- |
|
|
54
|
+
| **[API Reference](./docs/api-reference.md)** | Complete API method documentation |
|
|
57
55
|
| **[Quota Management](./docs/quota-management.md)** | Cost tiers (0/10/100) and utilities |
|
|
58
|
-
| **[Testing Guide](./docs/dev/testing.md)** | Test helpers, fixtures, and patterns |
|
|
59
|
-
| **[Method Reference](./docs/when-to-use-what.md)** | Quick method selection guide |
|
|
60
|
-
|
|
61
|
-
## Examples
|
|
62
|
-
|
|
63
|
-
See **[usage-examples.md](./docs/usage-examples.md)** for complete examples including:
|
|
64
|
-
- Package security analysis
|
|
65
|
-
- Batch operations
|
|
66
|
-
- Full scans with SBOM
|
|
67
|
-
- Policy management
|
|
68
|
-
- Quota planning
|
|
69
56
|
|
|
70
57
|
## License
|
|
71
58
|
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
"quota": 100,
|
|
13
13
|
"permissions": ["report:write"]
|
|
14
14
|
},
|
|
15
|
+
"createFullScan": {
|
|
16
|
+
"quota": 0,
|
|
17
|
+
"permissions": ["full-scans:create"]
|
|
18
|
+
},
|
|
15
19
|
"createOrgFullScan": {
|
|
16
20
|
"quota": 0,
|
|
17
21
|
"permissions": ["full-scans:create"]
|
|
@@ -227,6 +231,22 @@
|
|
|
227
231
|
"sendApi": {
|
|
228
232
|
"quota": 0,
|
|
229
233
|
"permissions": []
|
|
234
|
+
},
|
|
235
|
+
"batchOrgPackageFetch": {
|
|
236
|
+
"quota": 100,
|
|
237
|
+
"permissions": ["packages:list"]
|
|
238
|
+
},
|
|
239
|
+
"exportOpenVEX": {
|
|
240
|
+
"quota": 0,
|
|
241
|
+
"permissions": ["report:read"]
|
|
242
|
+
},
|
|
243
|
+
"getOrgAlertFullScans": {
|
|
244
|
+
"quota": 10,
|
|
245
|
+
"permissions": ["alerts:list"]
|
|
246
|
+
},
|
|
247
|
+
"rescanFullScan": {
|
|
248
|
+
"quota": 0,
|
|
249
|
+
"permissions": ["full-scans:create"]
|
|
230
250
|
}
|
|
231
251
|
}
|
|
232
252
|
}
|
package/dist/constants.d.ts
CHANGED
|
@@ -13,4 +13,4 @@ export declare const MAX_RESPONSE_SIZE: number;
|
|
|
13
13
|
export declare const MAX_STREAM_SIZE: number;
|
|
14
14
|
export declare const SOCKET_PUBLIC_BLOB_STORE_URL = "https://socketusercontent.com";
|
|
15
15
|
export declare const httpAgentNames: Set<string>;
|
|
16
|
-
export declare const publicPolicy: Map<"ambiguousClassifier" | "badEncoding" | "badSemver" | "badSemverDependency" | "bidi" | "binScriptConfusion" | "chromeContentScript" | "chromeHostPermission" | "chromePermission" | "chromeWildcardHostPermission" | "chronoAnomaly" | "compromisedSSHKey" | "copyleftLicense" | "criticalCVE" | "cve" | "debugAccess" | "deprecated" | "deprecatedException" | "deprecatedLicense" | "didYouMean" | "dynamicRequire" | "emptyPackage" | "envVars" | "explicitlyUnlicensedItem" | "extraneousDependency" | "fileDependency" | "filesystemAccess" | "floatingDependency" | "generic" | "ghaArgToEnv" | "ghaArgToOutput" | "ghaArgToSink" | "ghaContextToEnv" | "ghaContextToOutput" | "ghaContextToSink" | "ghaEnvToSink" | "gitDependency" | "gitHubDependency" | "gptAnomaly" | "gptDidYouMean" | "gptMalware" | "gptSecurity" | "hasNativeCode" | "highEntropyStrings" | "homoglyphs" | "httpDependency" | "installScripts" | "invalidPackageJSON" | "invisibleChars" | "licenseChange" | "licenseException" | "licenseSpdxDisj" | "longStrings" | "majorRefactor" | "malware" | "manifestConfusion" | "mediumCVE" | "mildCVE" | "minifiedFile" | "miscLicenseIssues" | "missingAuthor" | "missingDependency" | "missingLicense" | "missingTarball" | "mixedLicense" | "modifiedException" | "modifiedLicense" | "networkAccess" | "newAuthor" | "noAuthorData" | "noBugTracker" | "noLicenseFound" | "noREADME" | "noRepository" | "noTests" | "noV1" | "noWebsite" | "nonOSILicense" | "nonSPDXLicense" | "nonpermissiveLicense" | "notice" | "obfuscatedFile" | "obfuscatedRequire" | "peerDependency" | "potentialVulnerability" | "recentlyPublished" | "semverAnomaly" | "shellAccess" | "shellScriptOverride" | "shrinkwrap" | "socketUpgradeAvailable" | "suspiciousStarActivity" | "suspiciousString" | "telemetry" | "tooManyFiles" | "trivialPackage" | "troll" | "typeModuleCompatibility" | "uncaughtOptionalDependency" | "unclearLicense" | "unidentifiedLicense" | "unmaintained" | "unpopularPackage" | "unpublished" | "unresolvedRequire" | "unsafeCopyright" | "unstableOwnership" | "unusedDependency" | "urlStrings" | "usesEval" | "vsxActivationWildcard" | "vsxDebuggerContribution" | "vsxExtensionDependency" | "vsxExtensionPack" | "vsxProposedApiUsage" | "vsxUntrustedWorkspaceSupported" | "vsxVirtualWorkspaceSupported" | "vsxWebviewContribution" | "vsxWorkspaceContainsActivation" | "zeroWidth", ALERT_ACTION>;
|
|
16
|
+
export declare const publicPolicy: Map<"ambiguousClassifier" | "badEncoding" | "badSemver" | "badSemverDependency" | "bidi" | "binScriptConfusion" | "chromeContentScript" | "chromeHostPermission" | "chromePermission" | "chromeWildcardHostPermission" | "chronoAnomaly" | "compromisedSSHKey" | "copyleftLicense" | "criticalCVE" | "cve" | "debugAccess" | "deprecated" | "deprecatedException" | "deprecatedLicense" | "didYouMean" | "dynamicRequire" | "emptyPackage" | "envVars" | "explicitlyUnlicensedItem" | "extraneousDependency" | "fileDependency" | "filesystemAccess" | "floatingDependency" | "generic" | "ghaArgToEnv" | "ghaArgToOutput" | "ghaArgToSink" | "ghaContextToEnv" | "ghaContextToOutput" | "ghaContextToSink" | "ghaEnvToSink" | "gitDependency" | "gitHubDependency" | "gptAnomaly" | "gptDidYouMean" | "gptMalware" | "gptSecurity" | "hasNativeCode" | "highEntropyStrings" | "homoglyphs" | "httpDependency" | "installScripts" | "invalidPackageJSON" | "invisibleChars" | "licenseChange" | "licenseException" | "licenseSpdxDisj" | "longStrings" | "majorRefactor" | "malware" | "manifestConfusion" | "mediumCVE" | "mildCVE" | "minifiedFile" | "miscLicenseIssues" | "missingAuthor" | "missingDependency" | "missingLicense" | "missingTarball" | "mixedLicense" | "modifiedException" | "modifiedLicense" | "networkAccess" | "newAuthor" | "noAuthorData" | "noBugTracker" | "noLicenseFound" | "noREADME" | "noRepository" | "noTests" | "noV1" | "noWebsite" | "nonOSILicense" | "nonSPDXLicense" | "nonpermissiveLicense" | "notice" | "obfuscatedFile" | "obfuscatedRequire" | "peerDependency" | "potentialVulnerability" | "recentlyPublished" | "semverAnomaly" | "shellAccess" | "shellScriptOverride" | "shrinkwrap" | "skillAutonomyAbuse" | "skillCommandInjection" | "skillDataExfiltration" | "skillDiscoveryAbuse" | "skillHardcodedSecrets" | "skillObfuscation" | "skillPromptInjection" | "skillResourceAbuse" | "skillSupplyChain" | "skillToolAbuse" | "skillToolChaining" | "skillTransitiveTrust" | "socketUpgradeAvailable" | "suspiciousStarActivity" | "suspiciousString" | "telemetry" | "tooManyFiles" | "trivialPackage" | "troll" | "typeModuleCompatibility" | "uncaughtOptionalDependency" | "unclearLicense" | "unidentifiedLicense" | "unmaintained" | "unpopularPackage" | "unpublished" | "unresolvedRequire" | "unsafeCopyright" | "unstableOwnership" | "unusedDependency" | "urlStrings" | "usesEval" | "vsxActivationWildcard" | "vsxDebuggerContribution" | "vsxExtensionDependency" | "vsxExtensionPack" | "vsxProposedApiUsage" | "vsxUntrustedWorkspaceSupported" | "vsxVirtualWorkspaceSupported" | "vsxWebviewContribution" | "vsxWorkspaceContainsActivation" | "zeroWidth", ALERT_ACTION>;
|
package/dist/http-client.d.ts
CHANGED
|
@@ -16,11 +16,12 @@ import type { ClientRequest, IncomingMessage } from 'node:http';
|
|
|
16
16
|
*/
|
|
17
17
|
export declare class ResponseError extends Error {
|
|
18
18
|
response: IncomingMessage;
|
|
19
|
+
url?: string | undefined;
|
|
19
20
|
/**
|
|
20
21
|
* Create a new ResponseError from an HTTP response.
|
|
21
22
|
* Automatically formats error message with status code and message.
|
|
22
23
|
*/
|
|
23
|
-
constructor(response: IncomingMessage, message?: string);
|
|
24
|
+
constructor(response: IncomingMessage, message?: string, url?: string | undefined);
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
27
|
* Create and execute an HTTP DELETE request.
|
|
@@ -74,7 +75,7 @@ export declare function getResponse(req: ClientRequest): Promise<IncomingMessage
|
|
|
74
75
|
* @throws {ResponseError} When response has non-2xx status code
|
|
75
76
|
* @throws {SyntaxError} When response body contains invalid JSON
|
|
76
77
|
*/
|
|
77
|
-
export declare function getResponseJson(response: IncomingMessage, method?: string | undefined): Promise<JsonValue | undefined>;
|
|
78
|
+
export declare function getResponseJson(response: IncomingMessage, method?: string | undefined, url?: string | undefined): Promise<JsonValue | undefined>;
|
|
78
79
|
/**
|
|
79
80
|
* Create DELETE request with automatic retry logic.
|
|
80
81
|
* Retries on network errors and 5xx responses.
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { createDeleteRequest, createGetRequest, createRequestWithJson, getErrorR
|
|
|
9
9
|
export { calculateTotalQuotaCost, getAllMethodRequirements, getMethodRequirements, getMethodsByPermissions, getMethodsByQuotaCost, getQuotaCost, getQuotaUsageSummary, getRequiredPermissions, hasQuotaForMethods, } from './quota-utils';
|
|
10
10
|
export { SocketSdk } from './socket-sdk-class';
|
|
11
11
|
export type { ALERT_ACTION, ALERT_TYPE, Agent, ArtifactPatches, BatchPackageFetchResultType, BatchPackageStreamOptions, CompactSocketArtifact, CompactSocketArtifactAlert, CreateDependenciesSnapshotOptions, CreateOrgFullScanOptions, CreateScanFromFilepathsOptions, CustomResponseType, Entitlement, EntitlementsResponse, FileValidationCallback, FileValidationResult, GetOptions, GotOptions, HeadersRecord, PatchFile, PatchRecord, PatchViewResponse, TelemetryConfig, PostOrgTelemetryPayload, PostOrgTelemetryResponse, QueryParams, RequestInfo, RequestOptions, RequestOptionsWithHooks, ResponseInfo, SecurityAlert, SendMethod, SendOptions, SocketArtifact, SocketArtifactAlert, SocketArtifactWithExtras, SocketId, SocketMetricSchema, SocketSdkArrayElement, SocketSdkData, SocketSdkErrorResult, SocketSdkGenericResult, SocketSdkOperations, SocketSdkOptions, SocketSdkResult, SocketSdkSuccessResult, StreamOrgFullScanOptions, UploadManifestFilesError, UploadManifestFilesOptions, UploadManifestFilesResponse, UploadManifestFilesReturnType, Vulnerability, } from './types';
|
|
12
|
-
export type { CreateFullScanOptions, DeleteRepositoryLabelResult, DeleteResult, FullScanItem, FullScanListData, FullScanListResult, FullScanResult, GetRepositoryOptions, ListFullScansOptions, ListRepositoriesOptions, OrganizationItem, OrganizationsResult, RepositoriesListData, RepositoriesListResult, RepositoryItem, RepositoryLabelItem, RepositoryLabelResult, RepositoryLabelsListData, RepositoryLabelsListResult, RepositoryResult, StreamFullScanOptions, StrictErrorResult, StrictResult, } from './types-strict';
|
|
12
|
+
export type { CreateFullScanOptions, DeleteRepositoryLabelResult, DeleteResult, FullScanItem, FullScanListData, FullScanListResult, FullScanResult, GetRepositoryOptions, ListFullScansOptions, ListRepositoriesOptions, OrganizationItem, OrganizationsResult, RepositoriesListData, RepositoriesListResult, RepositoryItem, RepositoryLabelItem, RepositoryLabelResult, RepositoryLabelsListData, RepositoryLabelsListResult, RepositoryListItem, RepositoryResult, StreamFullScanOptions, StrictErrorResult, StrictResult, } from './types-strict';
|
|
13
13
|
export { createUserAgentFromPkgJson } from './user-agent';
|
|
14
14
|
export { calculateWordSetSimilarity, filterRedundantCause, normalizeBaseUrl, promiseWithResolvers, queryToSearchParams, resolveAbsPaths, resolveBasePath, shouldOmitReason, };
|
|
15
15
|
export { DEFAULT_USER_AGENT, httpAgentNames, publicPolicy };
|