export declare function getSdkAbortSignal(): AbortSignal; import type { ArtifactPatches, BatchPackageFetchResultType, BatchPackageStreamOptions, CreateDependenciesSnapshotOptions, Entitlement, GetOptions, MalwareCheckResult, PatchViewResponse, PostOrgTelemetryPayload, PostOrgTelemetryResponse, QueryParams, SendOptions, SocketSdkGenericResult, SocketSdkOptions, SocketSdkResult, StreamOrgFullScanOptions, UploadManifestFilesError, UploadManifestFilesOptions, UploadManifestFilesReturnType } from './types.mts'; import type { CreateOrgRepoDiffOptions, GetOrgFullScanCsvOptions, GetOrgFullScanPdfOptions, HistoricalAlertsListOptions, HistoricalAlertsTrendOptions, HistoricalDependenciesTrendOptions, HistoricalSnapshotsListOptions, LicensePolicyViolations, UpdateOrgRepoLabelSettingBody } from './types-parity.mts'; import type { CreateFullScanOptions, DeleteRepositoryLabelResult, DeleteResult, FullScanListResult, FullScanResult, GetRepositoryOptions, ListFullScansOptions, ListRepositoriesOptions, OrganizationsResult, RepositoriesListResult, RepositoryLabelResult, RepositoryLabelsListResult, RepositoryResult, StrictErrorResult } from './types-strict.mts'; import type { BlobUploadEntry, CreateFullScanFromManifestParams, CreateFullScanFromManifestResult, FullScanManifest, UploadBlobsResult } from './full-scans-v1.mts'; import type { PostEventsResult, SocketEvent } from './events-v1.mts'; import type { GetThreatCampaignResult, ListThreatCampaignPackagesOptions, ListThreatCampaignPackagesResult, ListThreatCampaignsOptions, ListThreatCampaignsResult } from './threat-campaigns-v1.mts'; import type { HttpResponse } from '@socketsecurity/lib/http-request/response-types'; /** * Socket SDK for programmatic access to Socket.dev security analysis APIs. * Provides methods for package scanning, organization management, and security * analysis. */ export declare class SocketSdk { #private; /** * Initialize Socket SDK with API token and configuration options. Sets up * authentication, base URL, HTTP client options, retry behavior, and * caching. */ constructor(apiToken: string, options?: SocketSdkOptions | undefined); /** * Get metadata for a set of alert types. Accepts an array of alert type * identifiers and returns human-readable metadata for each, optionally * localized via the `language` query param. * * @param alertTypes - Alert type identifiers to look up. * @param options - Optional query params (e.g. `language`). * * @returns Metadata for the requested alert types. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /alert-types * * @quota 1 units * * @see https://docs.socket.dev/reference/alerttypes */ alertTypes(alertTypes: string[], options?: { language?: string | undefined; } | undefined): Promise>; /** * Associate a repository with an organization repository label. * * @param orgSlug - Organization identifier. * @param labelId - Label identifier. * @param repositoryId - Repository identifier to associate with the label. * * @returns Association result. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /orgs/{org_slug}/repos/labels/{label_id}/associate * * @quota 1 units * * @scopes repo-label:update * * @see https://docs.socket.dev/reference/associateorgrepolabel */ associateOrgRepoLabel(orgSlug: string, labelId: string, repositoryId: string): Promise>; /** * Get package metadata and alerts by PURL strings for a specific * organization. Organization-scoped version of batchPackageFetch with * security policy label support. * * @example * ```typescript * const result = await sdk.batchOrgPackageFetch( * 'my-org', * { * components: [ * { purl: 'pkg:npm/express@4.19.2' }, * { purl: 'pkg:pypi/django@5.0.6' }, * ], * }, * { labels: ['production'], alerts: true }, * ) * * if (result.success) { * for (const artifact of result.data) { * console.log(`${artifact.name}@${artifact.version}`) * } * } * ``` * * @param orgSlug - Organization identifier. * @param componentsObj - Object containing array of components with PURL * strings. * @param queryParams - Optional query parameters including labels, alerts, * compact, etc. * * @returns Package metadata and alerts for the requested PURLs * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /orgs/{org_slug}/purl * * @quota 100 units * * @scopes packages:list * * @see https://docs.socket.dev/reference/batchpackagefetchbyorg */ batchOrgPackageFetch(orgSlug: string, componentsObj: { components: Array<{ purl: string; }>; }, queryParams?: QueryParams | undefined): Promise>; /** * Fetch package analysis data for multiple packages in a single batch * request. Returns all results at once after processing is complete. * * @throws {Error} When server returns 5xx status codes */ batchPackageFetch(componentsObj: { components: Array<{ purl: string; }>; }, queryParams?: QueryParams | undefined): Promise; /** * Stream package analysis data for multiple packages with chunked processing * and concurrency control. Returns results as they become available via async * generator. * * @throws {Error} When server returns 5xx status codes * * @operationId batchPackageStream * * @quota 100 units */ batchPackageStream(componentsObj: { components: Array<{ purl: string; }>; }, options?: BatchPackageStreamOptions | undefined): AsyncGenerator; /** * Check packages for malware and security alerts. * * For small sets (≤ MAX_FIREWALL_COMPONENTS), uses parallel firewall API * requests which return full artifact data including score and alert * details. * * For larger sets, uses the batch PURL API for efficiency. * * Both paths normalize alerts through publicPolicy and only return * malware-relevant results. * * @param components - Array of package URLs to check. * * @returns Normalized results with policy-filtered alerts per package * * @operationId none */ checkMalware(components: Array<{ purl: string; }>): Promise>; /** * Create a snapshot of project dependencies by uploading manifest files. * Analyzes dependency files to generate a comprehensive security report. * * @throws {Error} When server returns 5xx status codes */ createDependenciesSnapshot(filepaths: string[], options?: CreateDependenciesSnapshotOptions | undefined): Promise>; /** * Create a full security scan for an organization. * * Uploads project manifest files and initiates full security analysis. * Returns scan metadata with guaranteed required fields. * * Transparently attempts the v1 content-addressed blob-cache path first; that * attempt may issue additional HTTP requests (manifest post, blob uploads) * before the scan is created, observable through the `onRequest`/`onResponse` * hooks, before falling back to the v0 multipart upload. * * @example * ;```typescript * const result = await sdk.createFullScan( * 'my-org', * ['package.json', 'package-lock.json'], * { * repo: 'my-repo', * branch: 'main', * commit_message: 'Update dependencies', * commit_hash: 'abc123', * pathsRelativeTo: './my-project', * }, * ) * * if (result.success) { * console.log('Scan ID:', result.data.id) * console.log('Report URL:', result.data.html_report_url) * } * ``` * * @param orgSlug - Organization identifier. * @param filepaths - Array of file paths to upload (package.json, * package-lock.json, etc.) * @param options - Scan configuration including repository, branch, and * commit details. * * @returns Full scan metadata including ID and URLs * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /orgs/{org_slug}/full-scans * * @quota 0 units * * @scopes full-scans:create * * @see https://docs.socket.dev/reference/createorgfullscan */ createFullScan(orgSlug: string, filepaths: string[], options: CreateFullScanOptions): Promise; /** * Create a full scan from a pre-built content-addressed manifest (v1 API, * internal preview — hidden from the public OpenAPI spec). A 201 means the * scan was created outright; a 202 means one or more manifest entries are * unknown to the org's blob store — upload the blobs named in * `data.missing` via `uploadBlobs`, then re-post the same manifest. * * @param orgSlug - Organization identifier. * @param manifest - Content-addressed manifest (see `assembleManifest`). * @param params - Scan metadata; only defined keys are sent. * * @returns 201 full-scan details, or 202 with the blob-presence breakdown * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /orgs/{org_slug}/full-scans (v1) * * @operationId none */ createFullScanFromManifest(orgSlug: string, manifest: FullScanManifest, params: CreateFullScanFromManifestParams): Promise; /** * Create a diff scan from two full scan IDs. Compares two existing full scans * to identify changes. * * @example * ;```typescript * const result = await sdk.createOrgDiffScanFromIds('my-org', { * before: 'scan-id-1', * after: 'scan-id-2', * description: 'Compare versions', * merge: false, * }) * * if (result.success) { * console.log('Diff scan created:', result.data.diff_scan.id) * } * ``` * * @param orgSlug - Organization identifier. * @param options - Diff scan creation options. * @param options.after - ID of the after/head full scan (newer) * @param options.before - ID of the before/base full scan (older) * @param options.description - Description of the diff scan. * @param options.external_href - External URL to associate with the diff * scan. * @param options.merge - Set true for merged commits, false for open PR * diffs. * @param options.on_duplicate - Set to "redirect" to receive a 302 redirect * to the existing diff scan instead of a 409 error when a duplicate is * detected. * * @returns Diff scan details * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /orgs/{org_slug}/diff-scans/from-ids * * @quota 0 units * * @scopes diff-scans:create, full-scans:list * * @see https://docs.socket.dev/reference/createorgdiffscanfromids */ createOrgDiffScanFromIds(orgSlug: string, options: { after: string; before: string; description?: string | undefined; external_href?: string | undefined; merge?: boolean | undefined; on_duplicate?: string | undefined; }): Promise>; /** * Create a full scan from an archive file (.tar, .tar.gz/.tgz, or .zip). * Uploads and scans a compressed archive of project files. * * @param orgSlug - Organization identifier. * @param archivePath - Path to the archive file to upload. * @param options - Scan configuration options including repo, branch, and * metadata. * * @returns Created full scan details with scan ID and status * * @throws {Error} When server returns 5xx status codes or file cannot be read */ createOrgFullScanFromArchive(orgSlug: string, archivePath: string, options: { branch?: string | undefined; commit_hash?: string | undefined; commit_message?: string | undefined; committers?: string | undefined; integration_org_slug?: string | undefined; integration_type?: 'api' | 'azure' | 'bitbucket' | 'github' | 'gitlab' | 'web' | undefined; make_default_branch?: boolean | undefined; pull_request?: number | undefined; repo: string; scan_type?: string | undefined; set_as_pending_head?: boolean | undefined; tmp?: boolean | undefined; workspace?: string | undefined; }): Promise>; /** * Create a diff scan between a repository's current HEAD full scan and a new * full scan built from the uploaded manifest files. Returns metadata about * the new full scan and the diff scan. * * @param orgSlug - Organization identifier. * @param repoSlug - Repository slug whose HEAD full scan is the diff base. * @param filepaths - Manifest file paths to upload as the new full scan. * @param options - Diff scan metadata (branch, commit, PR, etc.) and * `pathsRelativeTo` controlling how the file paths are resolved. * * @returns Created full scan and diff scan details. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /orgs/{org_slug}/diff-scans/from-repo/{repo_slug} * * @quota 1 units * * @scopes repo:list, diff-scans:create, full-scans:create * * @see https://docs.socket.dev/reference/createorgrepodiff */ createOrgRepoDiff(orgSlug: string, repoSlug: string, filepaths: string[], options?: CreateOrgRepoDiffOptions | undefined): Promise>; /** * Create a new webhook for an organization. Webhooks allow you to receive * HTTP POST notifications when specific events occur. * * @param orgSlug - Organization identifier. * @param webhookData - Webhook configuration including name, URL, secret, and * events. * * @returns Created webhook details including webhook ID * * @throws {Error} When server returns 5xx status codes */ createOrgWebhook(orgSlug: string, webhookData: { description?: null | string | undefined; events: string[]; filters?: { repositoryIds: null | string[]; } | null | undefined; headers?: null | Record | undefined; name: string; secret: string; url: string; }): Promise>; /** * Create a new repository in an organization. * * Registers a repository for monitoring and security scanning. * * @example * ;```typescript * const result = await sdk.createRepository('my-org', 'my-repo', { * description: 'My project repository', * homepage: 'https://example.com', * visibility: 'private', * }) * * if (result.success) { * console.log('Repository created:', result.data.id) * } * ``` * * @param orgSlug - Organization identifier. * @param repoSlug - Repository name/slug. * @param params - Additional repository configuration. * @param params.archived - Whether the repository is archived. * @param params.default_branch - Default branch of the repository. * @param params.description - Description of the repository. * @param params.homepage - Homepage URL of the repository. * @param params.visibility - Visibility setting ('public' or 'private') * @param params.workspace - Workspace of the repository. * * @returns Created repository details * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /orgs/{org_slug}/repos * * @quota 0 units * * @scopes repo:write * * @see https://docs.socket.dev/reference/createorgrepo */ createRepository(orgSlug: string, repoSlug: string, params?: { archived?: boolean | undefined; default_branch?: null | string | undefined; description?: null | string | undefined; homepage?: null | string | undefined; visibility?: 'private' | 'public' | undefined; workspace?: string | undefined; } | undefined): Promise; /** * Create a new repository label for an organization. * * Labels can be used to group and organize repositories and apply * security/license policies. * * @example * ;```typescript * const result = await sdk.createRepositoryLabel('my-org', { * name: 'production', * }) * * if (result.success) { * console.log('Label created:', result.data.id) * console.log('Label name:', result.data.name) * } * ``` * * @param orgSlug - Organization identifier. * @param labelData - Label configuration (must include name property) * * @returns Created label with guaranteed id and name fields * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /orgs/{org_slug}/repos/labels * * @quota 0 units * * @scopes repo-label:create * * @see https://docs.socket.dev/reference/createorgrepolabel */ createRepositoryLabel(orgSlug: string, labelData: QueryParams): Promise; /** * Delete a full scan from an organization. * * Permanently removes scan data and results. * * @example * ;```typescript * const result = await sdk.deleteFullScan('my-org', 'scan_123') * * if (result.success) { * console.log('Scan deleted successfully') * } * ``` * * @param orgSlug - Organization identifier. * @param scanId - Full scan identifier to delete. * * @returns Success confirmation * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint DELETE /orgs/{org_slug}/full-scans/{full_scan_id} * * @quota 0 units * * @scopes full-scans:delete * * @see https://docs.socket.dev/reference/deleteorgfullscan */ deleteFullScan(orgSlug: string, scanId: string): Promise; /** * Delete an alert resolution by UUID. Once deleted, alerts previously * hidden by this resolution reappear after the next org snapshot. * * @param orgSlug - Organization identifier. * @param uuid - UUID of the alert resolution to delete. * * @returns Success confirmation * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint DELETE /orgs/{org_slug}/alerts/resolutions/{uuid} * * @quota 1 units * * @scopes alert-resolution:delete */ deleteOrgAlertResolution(orgSlug: string, uuid: string): Promise>; /** * Delete a triage entry for a specific alert in an organization. Removes the * triage record identified by its UUID. * * @param orgSlug - Organization identifier. * @param uuid - Alert triage UUID to delete. * * @returns Deletion result. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint DELETE /orgs/{org_slug}/triage/alerts/{uuid} * * @quota 1 units * * @scopes triage:alerts-update * * @see https://docs.socket.dev/reference/deleteorgalerttriage */ deleteOrgAlertTriage(orgSlug: string, uuid: string): Promise>; /** * Delete a diff scan from an organization. Permanently removes diff scan data * and results. * * @throws {Error} When server returns 5xx status codes */ deleteOrgDiffScan(orgSlug: string, diffScanId: string): Promise>; /** * Delete a single setting from a repository label. * * @param orgSlug - Organization identifier. * @param labelId - Label identifier. * @param settingKey - Key of the label setting to delete. * * @returns Deletion result. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint DELETE * /orgs/{org_slug}/repos/labels/{label_id}/label-setting * * @quota 1 units * * @scopes repo-label:update * * @see https://docs.socket.dev/reference/deleteorgrepolabelsetting */ deleteOrgRepoLabelSetting(orgSlug: string, labelId: string, settingKey: string): Promise>; /** * Delete a webhook from an organization. This will stop all future webhook * deliveries to the webhook URL. * * @param orgSlug - Organization identifier. * @param webhookId - Webhook ID to delete. * * @returns Success status * * @throws {Error} When server returns 5xx status codes */ deleteOrgWebhook(orgSlug: string, webhookId: string): Promise>; /** * Delete a repository from an organization. * * Removes repository monitoring and associated scan data. * * @example * ;```typescript * const result = await sdk.deleteRepository('my-org', 'old-repo') * * if (result.success) { * console.log('Repository deleted') * } * ``` * * @param orgSlug - Organization identifier. * @param repoSlug - Repository slug/name to delete. * @param options - Optional parameters including workspace. * * @returns Success confirmation * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint DELETE /orgs/{org_slug}/repos/{repo_slug} * * @quota 0 units * * @scopes repo:write * * @see https://docs.socket.dev/reference/deleteorgrepo */ deleteRepository(orgSlug: string, repoSlug: string, options?: GetRepositoryOptions | undefined): Promise; /** * Delete a repository label from an organization. * * Removes label and all its associations (repositories, security policy, * license policy, etc.). * * @example * ;```typescript * const result = await sdk.deleteRepositoryLabel('my-org', 'label-id-123') * * if (result.success) { * console.log('Label deleted:', result.data.status) * } * ``` * * @param orgSlug - Organization identifier. * @param labelId - Label identifier. * * @returns Deletion confirmation * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint DELETE /orgs/{org_slug}/repos/labels/{label_id} * * @quota 0 units * * @scopes repo-label:delete * * @see https://docs.socket.dev/reference/deleteorgrepolabel */ deleteRepositoryLabel(orgSlug: string, labelId: string): Promise; /** * Disassociate a repository from an organization repository label. * * @param orgSlug - Organization identifier. * @param labelId - Label identifier. * @param repositoryId - Repository identifier to disassociate from the label. * * @returns Disassociation result. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /orgs/{org_slug}/repos/labels/{label_id}/disassociate * * @quota 1 units * * @scopes repo-label:update * * @see https://docs.socket.dev/reference/disassociateorgrepolabel */ disassociateOrgRepoLabel(orgSlug: string, labelId: string, repositoryId: string): Promise>; /** * Download full scan files as a tar archive. * * Streams the full scan file contents to the specified output path as a tar * file. Includes size limit enforcement to prevent excessive disk usage. * * @param orgSlug - Organization identifier. * @param fullScanId - Full scan identifier. * @param outputPath - Local file path to write the tar archive. * * @returns Download result with success/error status * * @throws {Error} When server returns 5xx status codes */ downloadOrgFullScanFilesAsTar(orgSlug: string, fullScanId: string, outputPath: string): Promise>; /** * Download patch file content from Socket blob storage. Retrieves patched * file contents using SSRI hash or hex hash. * * This is a low-level utility method - you'll typically use this after * calling `viewPatch()` to get patch metadata, then download individual * patched files. * * @example * ;```typescript * const sdk = new SocketSdk('your-api-token') * // First get patch metadata * const patch = await sdk.viewPatch('my-org', 'patch-uuid') * // Then download the actual patched file * const fileContent = await sdk.downloadPatch( * patch.files['index.js'].socketBlob, * ) * ``` * * @param hash - The blob hash in SSRI (sha256-base64) or hex format. * @param options - Optional configuration. * @param options.baseUrl - Override blob store URL (for testing) * * @returns Promise - The patch file content as UTF-8 string * * @throws Error if blob not found (404) or download fails * * @operationId none */ downloadPatch(hash: string, options?: { baseUrl?: string | undefined; } | undefined): Promise; /** * Export scan results in CycloneDX SBOM format. Returns Software Bill of * Materials compliant with CycloneDX standard. * * @throws {Error} When server returns 5xx status codes */ exportCDX(orgSlug: string, fullScanId: string): Promise>; /** * Export vulnerability exploitability data as an OpenVEX v0.2.0 document. * Includes patch data and reachability analysis for vulnerability * assessment. * * @example * ;```typescript * const result = await sdk.exportOpenVEX('my-org', 'scan-id', { * author: 'Security Team', * role: 'VEX Generator', * }) * * if (result.success) { * console.log('VEX Version:', result.data.version) * console.log('Statements:', result.data.statements.length) * } * ``` * * @param orgSlug - Organization identifier. * @param id - Full scan or SBOM report ID. * @param options - Optional parameters including author, role, and * document_id. * * @returns OpenVEX document with vulnerability exploitability information * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/export/openvex/{id} * * @quota 0 units * * @scopes report:read * * @see https://docs.socket.dev/reference/exportopenvex */ exportOpenVEX(orgSlug: string, id: string, options?: { author?: string | undefined; document_id?: string | undefined; role?: string | undefined; } | undefined): Promise>; /** * Export scan results in SPDX SBOM format. Returns Software Bill of Materials * compliant with SPDX standard. * * @throws {Error} When server returns 5xx status codes */ exportSPDX(orgSlug: string, fullScanId: string): Promise>; /** * Execute a raw GET request to any API endpoint with configurable response * type. Supports both throwing (default) and non-throwing modes. * * @param urlPath - API endpoint path (e.g., 'organizations') * @param options - Request options including responseType and throws * behavior. * * @returns Raw response, parsed data, or SocketSdkGenericResult based on * options. * * @operationId getApi * * @quota 0 units */ getApi(urlPath: string, options?: GetOptions | undefined): Promise>; /** * Get list of API tokens for an organization. Returns organization API tokens * with metadata and permissions. * * @throws {Error} When server returns 5xx status codes */ getAPITokens(orgSlug: string): Promise>; /** * Retrieve audit log events for an organization. Returns chronological log of * security and administrative actions. * * @throws {Error} When server returns 5xx status codes */ getAuditLogEvents(orgSlug: string, queryParams?: QueryParams | undefined): Promise>; /** * Get details for a specific diff scan. Returns comparison between two full * scans with artifact changes. * * Reads from the immutable cached-scan store by default (`cached: true`). On * a cache miss the API returns 202 Accepted and computes the result in the * background; this method polls transparently until the result is ready, so * callers only ever observe the final comparison. Pass `cached: false` to * bypass the cache and live-compute the diff (slower, for debugging). When * `cached` is true the `omit_license_details` option is ignored server-side — * cached results always include license details. * * @example * ;```typescript * const result = await sdk.getDiffScanById('my-org', 'diff-scan-id') * * if (result.success) { * console.log(result.data.diff_scan.artifacts.added) * } * ``` * * @param orgSlug - Organization identifier. * @param diffScanId - Diff scan identifier. * @param options - Optional query parameters. * @param options.cached - Read cached immutable results (defaults to true). * @param options.omit_license_details - Omit license details (ignored when * cached). * @param options.omit_unchanged - Omit unchanged artifacts from the response. * * @returns Diff scan comparison with artifact changes * * @throws {Error} When server returns 5xx status codes or polling times out * * @apiEndpoint GET /orgs/{org_slug}/diff-scans/{diff_scan_id} * * @quota 0 units * * @scopes diff-scans:list * * @see https://docs.socket.dev/reference/getdiffscanbyid */ getDiffScanById(orgSlug: string, diffScanId: string, options?: { cached?: boolean | undefined; omit_license_details?: boolean | undefined; omit_unchanged?: boolean | undefined; } | undefined): Promise>; /** * Get GitHub-flavored markdown comments for a diff scan. Returns dependency * overview and alert comments suitable for pull requests. * * @example * ;```typescript * const result = await sdk.getDiffScanGfm('my-org', 'diff-scan-id') * * if (result.success) { * console.log(result.data.dependency_overview_comment) * console.log(result.data.dependency_alert_comment) * } * ``` * * @param orgSlug - Organization identifier. * @param diffScanId - Diff scan identifier. * @param options - Optional query parameters. * @param options.github_installation_id - GitHub installation ID for * settings. * * @returns Diff scan metadata with formatted markdown comments * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/diff-scans/{diff_scan_id}/gfm * * @quota 0 units * * @scopes diff-scans:list * * @see https://docs.socket.dev/reference/getdiffscangfm */ getDiffScanGfm(orgSlug: string, diffScanId: string, options?: { github_installation_id?: string | undefined; } | undefined): Promise>; /** * Retrieve the enabled entitlements for an organization. * * This method fetches the organization's entitlements and filters for only * the enabled ones, returning their keys. Entitlements represent Socket * Products that the organization has access to use. * * @operationId getEnabledEntitlements * * @quota 0 units */ getEnabledEntitlements(orgSlug: string): Promise; /** * Retrieve all entitlements for an organization. * * This method fetches all entitlements for an organization and returns the * complete list with their status. The result covers both enabled and * disabled entitlements. * * @operationId getEntitlements * * @quota 0 units */ getEntitlements(orgSlug: string): Promise; /** * Get complete full scan results buffered in memory. * * Returns entire scan data as JSON for programmatic processing. For large * scans, consider using streamFullScan() instead. * * @example * ;```typescript * const result = await sdk.getFullScan('my-org', 'scan_123') * * if (result.success) { * console.log('Scan status:', result.data.scan_state) * console.log('Repository:', result.data.repository_slug) * } * ``` * * Reads from the immutable cached-scan store by default (`cached: true`). On a * cache miss the API returns 202 Accepted and computes the result in the * background; this method polls transparently until the result is ready, so * callers only ever observe the final scan. Pass `cached: false` to bypass the * cache and live-compute the scan (slower, for debugging). * * @param orgSlug - Organization identifier. * @param scanId - Full scan identifier. * @param options - Optional query parameters. * @param options.cached - Read cached immutable results (defaults to true). * @param options.include_license_details - Include per-artifact license * details. * @param options.include_scores - Include score data for each artifact. * * @returns Complete full scan data including all artifacts * * @throws {Error} When server returns 5xx status codes or polling times out * * @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id} * * @quota 0 units * * @scopes full-scans:list * * @see https://docs.socket.dev/reference/getorgfullscan */ getFullScan(orgSlug: string, scanId: string, options?: { cached?: boolean | undefined; include_license_details?: boolean | undefined; include_scores?: boolean | undefined; } | undefined): Promise; /** * Get metadata for a specific full scan. * * Returns scan configuration, status, and summary information without full * artifact data. Useful for checking scan status without downloading complete * results. * * @example * ;```typescript * const result = await sdk.getFullScanMetadata('my-org', 'scan_123') * * if (result.success) { * console.log('Scan state:', result.data.scan_state) * console.log('Branch:', result.data.branch) * } * ``` * * @param orgSlug - Organization identifier. * @param scanId - Full scan identifier. * * @returns Scan metadata including status and configuration * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id}/metadata * * @quota 0 units * * @scopes full-scans:list * * @see https://docs.socket.dev/reference/getorgfullscanmetadata */ getFullScanMetadata(orgSlug: string, scanId: string): Promise; /** * List integration events for a specific organization integration. * * @param orgSlug - Organization identifier. * @param integrationId - Integration identifier. * * @returns Integration event history. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET * /orgs/{org_slug}/settings/integrations/{integration_id}/events * * @quota 1 units * * @scopes integration:list * * @see https://docs.socket.dev/reference/getintegrationevents */ getIntegrationEvents(orgSlug: string, integrationId: string): Promise>; /** * Get security issues for a specific npm package and version. Returns * detailed vulnerability and security alert information. * * @throws {Error} When server returns 5xx status codes */ getIssuesByNpmPackage(pkgName: string, version: string): Promise>; /** * Get the Socket API OpenAPI definition. * * @returns The OpenAPI document. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /openapi * * @quota 1 units * * @see https://docs.socket.dev/reference/getopenapi */ getOpenAPI(): Promise>; /** * Get the Socket API OpenAPI definition as JSON. * * @returns The OpenAPI document. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /openapi.json * * @quota 1 units * * @see https://docs.socket.dev/reference/getopenapijson */ getOpenAPIJSON(): Promise>; /** * List full scans associated with a specific alert. Returns paginated full * scan references for alert investigation. * * @example * ;```typescript * const result = await sdk.getOrgAlertFullScans('my-org', { * alertKey: 'npm/lodash/cve-2021-23337', * range: '-7d', * per_page: 50, * }) * * if (result.success) { * for (const item of result.data.items) { * console.log('Full Scan ID:', item.fullScanId) * } * } * ``` * * @param orgSlug - Organization identifier. * @param options - Query parameters including alertKey, range, pagination. * * @returns Paginated array of full scans associated with the alert * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/alert-full-scan-search * * @quota 10 units * * @scopes alerts:list * * @see https://docs.socket.dev/reference/alertfullscans */ getOrgAlertFullScans(orgSlug: string, options: { alertKey: string; per_page?: number | undefined; range?: string | undefined; startAfterCursor?: string | undefined; }): Promise>; /** * Fetch a single active alert resolution by UUID. Returns the same row * shape as the list endpoint. * * @param orgSlug - Organization identifier. * @param uuid - UUID of the alert resolution to fetch. * * @returns The requested alert resolution. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/alerts/resolutions/{uuid} * * @quota 1 units * * @scopes alert-resolution:read */ getOrgAlertResolution(orgSlug: string, uuid: string): Promise>; /** * List active alert resolutions for an organization. Results are * paginated via an opaque cursor and ordered by created_at. * * @param orgSlug - Organization identifier. * @param options - Optional query parameters for sort direction and * pagination. * * @returns Paginated list of alert resolutions with cursor-based * pagination. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/alerts/resolutions * * @quota 1 units * * @scopes alert-resolution:list */ getOrgAlertResolutions(orgSlug: string, options?: { direction?: string | undefined; per_page?: number | undefined; startAfterCursor?: string | undefined; } | undefined): Promise>; /** * List latest alerts for an organization (Beta). Returns paginated alerts * with comprehensive filtering options. * * @param orgSlug - Organization identifier. * @param options - Optional query parameters for pagination and filtering. * * @returns Paginated list of alerts with cursor-based pagination * * @throws {Error} When server returns 5xx status codes */ getOrgAlertsList(orgSlug: string, options?: { 'filters.alertAction'?: string | undefined; 'filters.alertAction.notIn'?: string | undefined; 'filters.alertCategory'?: string | undefined; 'filters.alertCategory.notIn'?: string | undefined; 'filters.alertCveId'?: string | undefined; 'filters.alertCveId.notIn'?: string | undefined; 'filters.alertCveTitle'?: string | undefined; 'filters.alertCveTitle.notIn'?: string | undefined; 'filters.alertCweId'?: string | undefined; 'filters.alertCweId.notIn'?: string | undefined; 'filters.alertCweName'?: string | undefined; 'filters.alertCweName.notIn'?: string | undefined; 'filters.alertEPSS'?: string | undefined; 'filters.alertEPSS.notIn'?: string | undefined; 'filters.alertFixType'?: string | undefined; 'filters.alertFixType.notIn'?: string | undefined; 'filters.alertKEV'?: boolean | undefined; 'filters.alertKEV.notIn'?: boolean | undefined; 'filters.alertPriority'?: string | undefined; 'filters.alertPriority.notIn'?: string | undefined; 'filters.alertReachabilityType'?: string | undefined; 'filters.alertReachabilityType.notIn'?: string | undefined; 'filters.alertSeverity'?: string | undefined; 'filters.alertSeverity.notIn'?: string | undefined; 'filters.alertStatus'?: string | undefined; 'filters.alertStatus.notIn'?: string | undefined; 'filters.alertType'?: string | undefined; 'filters.alertType.notIn'?: string | undefined; 'filters.alertUpdatedAt.eq'?: string | undefined; 'filters.alertUpdatedAt.gt'?: string | undefined; 'filters.alertUpdatedAt.gte'?: string | undefined; 'filters.alertUpdatedAt.lt'?: string | undefined; 'filters.alertUpdatedAt.lte'?: string | undefined; 'filters.repoFullName'?: string | undefined; 'filters.repoFullName.notIn'?: string | undefined; 'filters.repoLabels'?: string | undefined; 'filters.repoLabels.notIn'?: string | undefined; 'filters.repoSlug'?: string | undefined; 'filters.repoSlug.notIn'?: string | undefined; per_page?: number | undefined; startAfterCursor?: string | undefined; } | undefined): Promise>; /** * Get analytics data for organization usage patterns and security metrics. * Returns statistical analysis for specified time period. * * @throws {Error} When server returns 5xx status codes */ getOrgAnalytics(time: string): Promise>; /** * Fetch available fixes for vulnerabilities in a repository or scan. Returns * fix recommendations including version upgrades and update types. * * @param orgSlug - Organization identifier. * @param options - Fix query options including repo_slug or full_scan_id, * vulnerability IDs, and preferences. * @param options.include_stateful_alert_ids - Set to include a * statefulAlertIds map (GHSA ID → open stateful alert IDs) in the * response, org-scoped only. * * @returns Fix details for requested vulnerabilities with upgrade * recommendations. * * @throws {Error} When server returns 5xx status codes * * @operationId none */ getOrgFixes(orgSlug: string, options: { allow_major_updates: boolean; full_scan_id?: string | undefined; include_details?: boolean | undefined; include_responsible_direct_dependencies?: boolean | undefined; include_stateful_alert_ids?: boolean | undefined; minimum_release_age?: string | undefined; repo_slug?: string | undefined; vulnerability_ids: string; }): Promise>; /** * Export a full scan's alerts as CSV. The endpoint responds with raw * `text/csv`, so the result data is the CSV text rather than a parsed object. * * @param orgSlug - Organization identifier. * @param fullScanId - Full scan identifier. * @param options - Query params (`include_license_details` is required) plus * an optional `filters` body forwarded to the export. * * @returns The CSV export text. * * @throws {Error} When server returns 5xx status codes * * @operationId getOrgFullScanCsv * * @apiEndpoint POST /orgs/{org_slug}/full-scans/{full_scan_id}/format/csv * * @quota 1 units * * @scopes full-scans:list * * @see https://docs.socket.dev/reference/getorgfullscancsv */ getOrgFullScanCsv(orgSlug: string, fullScanId: string, options: GetOrgFullScanCsvOptions): Promise>; /** * Export a full scan's alerts as a PDF report. The endpoint responds with raw * `application/pdf`, so the result data is the PDF bytes as a Buffer. * * @param orgSlug - Organization identifier. * @param fullScanId - Full scan identifier. * @param options - Query params (`include_license_details` is required) plus * optional `filters`, `groupBy`, and `additionalInformation` body fields. * * @returns The PDF report bytes. * * @throws {Error} When server returns 5xx status codes * * @operationId getOrgFullScanPdf * * @apiEndpoint POST /orgs/{org_slug}/full-scans/{full_scan_id}/format/pdf * * @quota 1 units * * @scopes full-scans:list * * @see https://docs.socket.dev/reference/getorgfullscanpdf */ getOrgFullScanPdf(orgSlug: string, fullScanId: string, options: GetOrgFullScanPdfOptions): Promise>; /** * Get organization's license policy configuration. Returns allowed, * restricted, and monitored license types. * * @throws {Error} When server returns 5xx status codes */ getOrgLicensePolicy(orgSlug: string): Promise>; /** * Get a single setting for a repository label. * * @param orgSlug - Organization identifier. * @param labelId - Label identifier. * @param settingKey - Key of the label setting to fetch. * * @returns The requested label setting. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/repos/labels/{label_id}/label-setting * * @quota 1 units * * @scopes repo-label:list * * @see https://docs.socket.dev/reference/getorgrepolabelsetting */ getOrgRepoLabelSetting(orgSlug: string, labelId: string, settingKey: string): Promise>; /** * Get organization's security policy configuration. Returns alert rules, * severity thresholds, and enforcement settings. * * @throws {Error} When server returns 5xx status codes */ getOrgSecurityPolicy(orgSlug: string): Promise>; /** * Get organization's telemetry configuration. Returns whether telemetry is * enabled for the organization. * * @param orgSlug - Organization identifier. * * @returns Telemetry configuration with enabled status * * @throws {Error} When server returns 5xx status codes */ getOrgTelemetryConfig(orgSlug: string): Promise>; /** * List threat-feed items for an organization. Returns recently observed * malicious / suspicious packages, paginated and filterable by ecosystem, * name, version, and review state. Requires an Enterprise plan with the * Threat Feed add-on and the `threat-feed:list` scope. * * @throws {Error} When server returns 5xx status codes * * @quota 1 units */ getOrgThreatFeedItems(orgSlug: string, queryParams?: QueryParams | undefined): Promise>; /** * Get organization triage settings and status. Returns alert triage * configuration and current state. * * @throws {Error} When server returns 5xx status codes */ getOrgTriage(orgSlug: string): Promise>; /** * Get details of a specific webhook. Returns webhook configuration including * events, URL, and filters. * * @param orgSlug - Organization identifier. * @param webhookId - Webhook ID to retrieve. * * @returns Webhook details * * @throws {Error} When server returns 5xx status codes */ getOrgWebhook(orgSlug: string, webhookId: string): Promise>; /** * List all webhooks for an organization. Supports pagination and sorting * options. * * @param orgSlug - Organization identifier. * @param options - Optional query parameters for pagination and sorting. * * @returns List of webhooks with pagination info * * @throws {Error} When server returns 5xx status codes */ getOrgWebhooksList(orgSlug: string, options?: { direction?: string | undefined; page?: number | undefined; per_page?: number | undefined; sort?: string | undefined; } | undefined): Promise>; /** * Get current API quota usage and limits. Returns remaining requests, rate * limits, and quota reset times. * * @throws {Error} When server returns 5xx status codes */ getQuota(): Promise>; /** * Get analytics data for a specific repository. Returns security metrics, * dependency trends, and vulnerability statistics. * * @throws {Error} When server returns 5xx status codes */ getRepoAnalytics(repo: string, time: string): Promise>; /** * Get details for a specific repository. * * Returns repository configuration, monitoring status, and metadata. * * @example * ;```typescript * const result = await sdk.getRepository('my-org', 'my-repo') * * if (result.success) { * console.log('Repository:', result.data.name) * console.log('Visibility:', result.data.visibility) * console.log('Default branch:', result.data.default_branch) * } * ``` * * @param orgSlug - Organization identifier. * @param repoSlug - Repository slug/name. * @param options - Optional parameters including workspace. * * @returns Repository details with configuration * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/repos/{repo_slug} * * @quota 0 units * * @scopes repo:read * * @see https://docs.socket.dev/reference/getorgrepo */ getRepository(orgSlug: string, repoSlug: string, options?: GetRepositoryOptions | undefined): Promise; /** * Get details for a specific repository label. * * Returns label configuration, associated repositories, and policy settings. * * @example * ;```typescript * const result = await sdk.getRepositoryLabel('my-org', 'label-id-123') * * if (result.success) { * console.log('Label name:', result.data.name) * console.log('Associated repos:', result.data.repository_ids) * console.log('Has security policy:', result.data.has_security_policy) * } * ``` * * @param orgSlug - Organization identifier. * @param labelId - Label identifier. * * @returns Label details with guaranteed id and name fields * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/repos/labels/{label_id} * * @quota 0 units * * @scopes repo-label:list * * @see https://docs.socket.dev/reference/getorgrepolabel */ getRepositoryLabel(orgSlug: string, labelId: string): Promise; /** * Get security score for a specific npm package and version. Returns * numerical security rating and scoring breakdown. * * @throws {Error} When server returns 5xx status codes */ getScoreByNpmPackage(pkgName: string, version: string): Promise>; /** * Get the Socket Basics configuration for an organization. * * @param orgSlug - Organization identifier. * * @returns The Socket Basics configuration. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/settings/socket-basics * * @quota 1 units * * @scopes socket-basics:read * * @see https://docs.socket.dev/reference/getsocketbasicsconfig */ getSocketBasicsConfig(orgSlug: string): Promise>; /** * Get list of supported file types for full scan generation. Returns glob * patterns for supported manifest files, lockfiles, and configuration * formats. * * Files whose names match the patterns returned by this endpoint can be * uploaded for report generation. Examples include `package.json`, * `package-lock.json`, and `yarn.lock`. * * @example * ;```typescript * const result = await sdk.getSupportedFiles('my-org') * * if (result.success) { * console.log('NPM patterns:', result.data.NPM) * console.log('PyPI patterns:', result.data.PyPI) * } * ``` * * @param orgSlug - Organization identifier. * * @returns Nested object with environment and file type patterns * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/supported-files * * @quota 0 units * * @scopes No scopes required, but authentication is required * * @see https://docs.socket.dev/reference/getsupportedfiles */ getSupportedFiles(orgSlug: string): Promise>; /** * Get a single threat campaign by ID (v1 API, public route). Same shape as * one item from `listThreatCampaigns`; package PURLs are not inlined — * fetch them via `listThreatCampaignPackages`. Requires an Enterprise plan * with the Threat Feed add-on and the `threat-campaigns:list` token scope. * * @param orgSlug - Organization identifier. * @param campaignId - Campaign identifier. * * @returns The campaign * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/threat-campaigns/{campaign_id} (v1) * * @operationId none */ getThreatCampaign(orgSlug: string, campaignId: string): Promise; /** * List threat-feed items across all organizations the token can see. Returns * recently observed malicious / suspicious packages, paginated and filterable * by ecosystem, name, version, and review state. * * @deprecated socket-lint: allow deprecated-marker -- quoting the backend * API's own deprecation: it marks the top-level `/threat-feed` route as * the deprecated form; prefer the org-scoped * {@link getOrgThreatFeedItems}. * * @throws {Error} When server returns 5xx status codes * * @quota 1 units */ getThreatFeedItems(queryParams?: QueryParams | undefined): Promise>; /** * List historical alerts for an organization. Returns point-in-time alert * data across repositories with extensive filtering and cursor pagination. * * @param orgSlug - Organization identifier. * @param options - Date, range, pagination, and alert filter options. * * @returns Paginated historical alerts with an end cursor. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/historical/alerts * * @quota 10 units * * @scopes historical:alerts-list * * @see https://docs.socket.dev/reference/historicalalertslist */ historicalAlertsList(orgSlug: string, options?: HistoricalAlertsListOptions | undefined): Promise>; /** * Get a trend of historical alert counts for an organization. Returns * aggregated alert totals over the requested time range. * * @param orgSlug - Organization identifier. * @param options - Date, range, aggregation, and alert filter options. * * @returns Historical alert trend data. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/historical/alerts/trend * * @quota 10 units * * @scopes historical:alerts-trend * * @see https://docs.socket.dev/reference/historicalalertstrend */ historicalAlertsTrend(orgSlug: string, options?: HistoricalAlertsTrendOptions | undefined): Promise>; /** * Get a trend of historical dependency counts for an organization. Returns * aggregated dependency totals over the requested time range. * * @param orgSlug - Organization identifier. * @param options - Date, range, and dependency filter options. * * @returns Historical dependency trend data. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/historical/dependencies/trend * * @quota 10 units * * @scopes historical:dependencies-trend * * @see https://docs.socket.dev/reference/historicaldependenciestrend */ historicalDependenciesTrend(orgSlug: string, options?: HistoricalDependenciesTrendOptions | undefined): Promise>; /** * List historical dependency snapshots for an organization. Returns snapshot * metadata with status filtering and cursor pagination. * * @param orgSlug - Organization identifier. * @param options - Date, range, pagination, and snapshot filter options. * * @returns Paginated historical snapshots with an end cursor. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/historical/snapshots * * @quota 10 units * * @scopes historical:snapshots-list * * @see https://docs.socket.dev/reference/historicalsnapshotslist */ historicalSnapshotsList(orgSlug: string, options?: HistoricalSnapshotsListOptions | undefined): Promise>; /** * Start a new historical dependency snapshot for an organization. Triggers * the background computation of a point-in-time dependency snapshot. * * @param orgSlug - Organization identifier. * * @returns Snapshot start acknowledgement, including the new request ID. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /orgs/{org_slug}/historical/snapshots * * @quota 10 units * * @scopes historical:snapshots-start * * @see https://docs.socket.dev/reference/historicalsnapshotsstart */ historicalSnapshotsStart(orgSlug: string): Promise>; /** * Get metadata for a set of licenses (SPDX identifiers or expressions). * * @param request - License metadata request body. * @param options - Optional query params (e.g. `includetext` to include the * full license text). * * @returns Metadata for the requested licenses. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /license-metadata * * @quota 1 units * * @see https://docs.socket.dev/reference/licensemetadata */ licenseMetadata(request: QueryParams, options?: { includetext?: boolean | undefined; } | undefined): Promise>; /** * Compute license policy violations for a set of packages (Beta). The * endpoint streams newline-delimited JSON, which this method parses into an * array of violation records. * * @param request - License allow-list request body. * * @returns The parsed license policy violations. * * @throws {Error} When server returns 5xx status codes * * @operationId licensePolicy * * @apiEndpoint POST /license-policy * * @quota 100 units * * @scopes packages:list, license-policy:read * * @see https://docs.socket.dev/reference/licensepolicy */ licensePolicy(request: QueryParams): Promise>; /** * List all full scans for an organization. * * Returns paginated list of full scan metadata with guaranteed required * fields for improved TypeScript autocomplete. * * @example * ;```typescript * const result = await sdk.listFullScans('my-org', { * branch: 'main', * per_page: 50, * use_cursor: true, * }) * * if (result.success) { * result.data.results.forEach(scan => { * console.log(scan.id, scan.created_at) // Guaranteed fields * }) * } * ``` * * @param orgSlug - Organization identifier. * @param options - Filtering and pagination options. * * @returns List of full scans with metadata * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/full-scans * * @quota 0 units * * @scopes full-scans:list * * @see https://docs.socket.dev/reference/getorgfullscanlist */ listFullScans(orgSlug: string, options?: ListFullScansOptions | undefined): Promise; /** * List all organizations accessible to the current user. * * Returns organization details and access permissions with guaranteed * required fields. * * @example * ;```typescript * const result = await sdk.listOrganizations() * * if (result.success) { * // `organizations` is a map keyed by org id, so iterate its values. * Object.values(result.data.organizations).forEach(org => { * console.log(org.name, org.slug) // Guaranteed fields * }) * } * ``` * * @returns List of organizations with metadata * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /organizations * * @quota 0 units * * @see https://docs.socket.dev/reference/getorganizations */ listOrganizations(): Promise; /** * List all diff scans for an organization. Returns paginated list of diff * scan metadata and status. * * @throws {Error} When server returns 5xx status codes */ listOrgDiffScans(orgSlug: string): Promise>; /** * List all repositories in an organization. * * Returns paginated list of repository metadata with guaranteed required * fields. * * @example * ;```typescript * const result = await sdk.listRepositories('my-org', { * per_page: 50, * sort: 'name', * direction: 'asc', * }) * * if (result.success) { * result.data.results.forEach(repo => { * console.log(repo.name, repo.visibility) * }) * } * ``` * * @param orgSlug - Organization identifier. * @param options - Pagination and filtering options. * * @returns List of repositories with metadata * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/repos * * @quota 0 units * * @scopes repo:list * * @see https://docs.socket.dev/reference/getorgrepolist */ listRepositories(orgSlug: string, options?: ListRepositoriesOptions | undefined): Promise; /** * List all repository labels for an organization. * * Returns paginated list of labels configured for repository organization and * policy management. * * @example * ;```typescript * const result = await sdk.listRepositoryLabels('my-org', { * per_page: 50, * page: 1, * }) * * if (result.success) { * result.data.results.forEach(label => { * console.log('Label:', label.name) * console.log('Associated repos:', label.repository_ids?.length || 0) * }) * } * ``` * * @param orgSlug - Organization identifier. * @param options - Pagination options. * * @returns List of labels with guaranteed id and name fields * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/repos/labels * * @quota 0 units * * @scopes repo-label:list * * @see https://docs.socket.dev/reference/getorgrepolabellist */ listRepositoryLabels(orgSlug: string, options?: QueryParams | undefined): Promise; /** * List package PURLs affected by a single threat campaign (v1 API, public * route), cursor-paginated. Pass the previous response's `endCursor` back * as `options.cursor` to fetch the next page. Requires an Enterprise plan * with the Threat Feed add-on and the `threat-campaigns:list` token scope. * * @param orgSlug - Organization identifier. * @param campaignId - Campaign identifier. * @param options - Pagination options (`per_page`, `cursor`). * * @returns `{ items, endCursor }` — opaque PURL strings and the next cursor * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/threat-campaigns/{campaign_id}/packages (v1) * * @operationId none */ listThreatCampaignPackages(orgSlug: string, campaignId: string, options?: ListThreatCampaignPackagesOptions | undefined): Promise; /** * List threat campaigns for an organization (v1 API, public route), * paginated and filterable by status, ecosystem, and an incremental sync * parameter (`updated_after`). Package PURLs are not inlined — fetch them * per campaign via `listThreatCampaignPackages`. Requires an Enterprise * plan with the Threat Feed add-on and the `threat-campaigns:list` token * scope. * * @param orgSlug - Organization identifier. * @param options - Filter and pagination options; `status` defaults to * `'ongoing'` server-side when omitted. * * @returns `{ items, endCursor }` — campaigns and the next cursor * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/threat-campaigns (v1) * * @operationId none */ listThreatCampaigns(orgSlug: string, options?: ListThreatCampaignsOptions | undefined): Promise; /** * Create a new API token for an organization. Generates API token with * specified scopes and metadata. * * @throws {Error} When server returns 5xx status codes */ postAPIToken(orgSlug: string, tokenData: QueryParams): Promise>; /** * Revoke an API token for an organization. Permanently disables the token and * removes access. * * @throws {Error} When server returns 5xx status codes */ postAPITokensRevoke(orgSlug: string, tokenId: string): Promise>; /** * Rotate an API token for an organization. Generates new token value while * preserving token metadata. * * @throws {Error} When server returns 5xx status codes */ postAPITokensRotate(orgSlug: string, tokenId: string): Promise>; /** * Update an existing API token for an organization. Modifies token metadata, * scopes, or other properties. * * @throws {Error} When server returns 5xx status codes */ postAPITokenUpdate(orgSlug: string, tokenId: string, updateData: QueryParams): Promise>; /** * Post organization events for telemetry ingestion (v1 API, public route). * Send events directly to Socket; an empty batch is accepted as a no-op. * Requires an organization API token (any scope). * * @param orgSlug - Organization identifier. * @param events - Event payloads to ingest (max 1000 per call). * * @returns Empty object envelope on success * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /orgs/{org_slug}/events (v1) * * @operationId none */ postEvents(orgSlug: string, events: SocketEvent[]): Promise; /** * Post telemetry data for an organization. Sends telemetry events and * analytics data for monitoring and analysis. * * @param orgSlug - Organization identifier. * @param telemetryData - Telemetry payload containing events and metrics. * * @returns Empty object on successful submission * * @throws {Error} When server returns 5xx status codes * * @operationId none */ postOrgTelemetry(orgSlug: string, telemetryData: PostOrgTelemetryPayload): Promise>; /** * Update user or organization settings. Configures preferences, * notifications, and security policies. * * @throws {Error} When server returns 5xx status codes */ postSettings(selectors: Array<{ organization?: string | undefined; }>): Promise>; /** * Create a new full scan by rescanning an existing scan. Supports shallow * (policy reapplication) and deep (dependency resolution rerun) modes. * * @example * ;```typescript * // Shallow rescan (reapply policies to cached data) * const result = await sdk.rescanFullScan('my-org', 'scan_123', { * mode: 'shallow', * }) * * if (result.success) { * console.log('New Scan ID:', result.data.id) * console.log('Status:', result.data.status) * } * * // Deep rescan (rerun dependency resolution) * const deepResult = await sdk.rescanFullScan('my-org', 'scan_123', { * mode: 'deep', * }) * ``` * * @param orgSlug - Organization identifier. * @param fullScanId - Full scan ID to rescan. * @param options - Rescan options including mode (shallow or deep) * * @returns New scan ID and status * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /orgs/{org_slug}/full-scans/{full_scan_id}/rescan * * @quota 0 units * * @scopes full-scans:create * * @see https://docs.socket.dev/reference/rescanorgfullscan */ rescanFullScan(orgSlug: string, fullScanId: string, options?: { mode?: 'shallow' | 'deep' | undefined; } | undefined): Promise>; /** * Search for dependencies across monitored projects. Returns matching * packages with security information and usage patterns. * * @throws {Error} When server returns 5xx status codes */ searchDependencies(queryParams?: QueryParams | undefined): Promise>; /** * Send POST or PUT request with JSON body and return parsed JSON response. * Supports both throwing (default) and non-throwing modes. * * @param urlPath - API endpoint path (e.g., 'organizations') * @param options - Request options including method, body, and throws * behavior. * * @returns Parsed JSON response or SocketSdkGenericResult based on options * * @operationId sendApi * * @quota 0 units */ sendApi(urlPath: string, options?: SendOptions | undefined): Promise>; /** * Stream a full scan's results to a file, to stdout, or to the caller. * * The response body is never buffered: the request resolves as soon as the * headers arrive, and the body is piped straight to the destination. Without * an `output` the body is left unread on `data.rawResponse` for the caller to * pipe or iterate — read or destroy that stream, or the socket stays open. * * @example * ;```typescript * // Stream to file * await sdk.streamFullScan('my-org', 'scan_123', { * output: './scan-results.json', * }) * * // Stream to stdout * await sdk.streamFullScan('my-org', 'scan_123', { * output: true, * }) * * // Consume the body yourself * const result = await sdk.streamFullScan('my-org', 'scan_123') * if (result.success) { * for await (const chunk of result.data.rawResponse) { * // ... * } * } * ``` * * @param orgSlug - Organization identifier. * @param scanId - Full scan identifier. * @param options - Where to send the body. Set `output` to a file path to * write there, or to `true` to write to stdout. * * @returns Scan result carrying the unconsumed response stream * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id} * * @quota 0 units * * @scopes full-scans:list * * @see https://docs.socket.dev/reference/getorgfullscan */ streamFullScan(orgSlug: string, scanId: string, options?: StreamOrgFullScanOptions | undefined): Promise>; /** * Stream patches for artifacts in a scan report. * * This method streams all available patches for artifacts in a scan. Free * tier users will only receive free patches. * * The returned ReadableStream is pull-driven: each `read()` parses only as * much of the NDJSON response as that record needs, so the first record is * available before the API has finished sending, a slow consumer applies * backpressure to the socket, and the full dataset is never resident. A * transport that cannot expose the response stream (the browser build's * `fetch` backend) falls back to reading the buffered body. * * @operationId streamPatchesFromScan * * @quota 0 units */ streamPatchesFromScan(orgSlug: string, scanId: string): Promise>; /** * Update alert triage status for an organization. Modifies alert resolution * status and triage decisions. * * @throws {Error} When server returns 5xx status codes */ updateOrgAlertTriage(orgSlug: string, alertId: string, triageData: QueryParams): Promise>; /** * Update organization's license policy configuration. Modifies allowed, * restricted, and monitored license types. * * @throws {Error} When server returns 5xx status codes */ updateOrgLicensePolicy(orgSlug: string, policyData: QueryParams, queryParams?: QueryParams | undefined): Promise>; /** * Update the settings for a repository label. Accepts the structured * issue-rules body defined by the API. * * @param orgSlug - Organization identifier. * @param labelId - Label identifier. * @param settings - Label settings body (issue rules). * * @returns Update result. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint PUT /orgs/{org_slug}/repos/labels/{label_id}/label-setting * * @quota 1 units * * @scopes repo-label:update * * @see https://docs.socket.dev/reference/updateorgrepolabelsetting */ updateOrgRepoLabelSetting(orgSlug: string, labelId: string, settings: UpdateOrgRepoLabelSettingBody): Promise>; /** * Update organization's security policy configuration. Modifies alert rules, * severity thresholds, and enforcement settings. * * @throws {Error} When server returns 5xx status codes */ updateOrgSecurityPolicy(orgSlug: string, policyData: QueryParams): Promise>; /** * Update organization's telemetry configuration. Enables or disables * telemetry for the organization. * * @param orgSlug - Organization identifier. * @param telemetryData - Telemetry configuration with enabled flag. * * @returns Updated telemetry configuration * * @throws {Error} When server returns 5xx status codes */ updateOrgTelemetryConfig(orgSlug: string, telemetryData: { enabled?: boolean | undefined; }): Promise>; /** * Update an existing webhook's configuration. All fields are optional - only * provided fields will be updated. * * @param orgSlug - Organization identifier. * @param webhookId - Webhook ID to update. * @param webhookData - Updated webhook configuration. * * @returns Updated webhook details * * @throws {Error} When server returns 5xx status codes */ updateOrgWebhook(orgSlug: string, webhookId: string, webhookData: { description?: null | string | undefined; events?: string[] | undefined; filters?: { repositoryIds: null | string[]; } | null | undefined; headers?: null | Record | undefined; name?: string | undefined; secret?: null | string | undefined; url?: string | undefined; }): Promise>; /** * Update configuration for a repository. * * Modifies monitoring settings, branch configuration, and scan preferences. * * @example * ;```typescript * const result = await sdk.updateRepository('my-org', 'my-repo', { * description: 'Updated description', * default_branch: 'develop', * }) * * if (result.success) { * console.log('Repository updated:', result.data.name) * } * ``` * * @param orgSlug - Organization identifier. * @param repoSlug - Repository slug/name. * @param params - Configuration updates (description, homepage, * default_branch, etc.) * @param options - Optional parameters including workspace. * * @returns Updated repository details * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /orgs/{org_slug}/repos/{repo_slug} * * @quota 0 units * * @scopes repo:write * * @see https://docs.socket.dev/reference/updateorgrepo */ updateRepository(orgSlug: string, repoSlug: string, params?: QueryParams | undefined, options?: GetRepositoryOptions | undefined): Promise; /** * Update a repository label for an organization. * * Modifies label properties like name. Label names must be non-empty and less * than 1000 characters. * * @example * ;```typescript * const result = await sdk.updateRepositoryLabel( * 'my-org', * 'label-id-123', * { name: 'staging' }, * ) * * if (result.success) { * console.log('Label updated:', result.data.name) * console.log('Label ID:', result.data.id) * } * ``` * * @param orgSlug - Organization identifier. * @param labelId - Label identifier. * @param labelData - Label updates (typically name property) * * @returns Updated label with guaranteed id and name fields * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint PUT /orgs/{org_slug}/repos/labels/{label_id} * * @quota 0 units * * @scopes repo-label:update * * @see https://docs.socket.dev/reference/updateorgrepolabel */ updateRepositoryLabel(orgSlug: string, labelId: string, labelData: QueryParams): Promise; /** * Upload blobs to an organization's content-addressed blob store (v1 API, * internal preview — hidden from the public OpenAPI spec). Each entry's * hash is computed from `localPath` when omitted; `name` is diagnostics- * only metadata (defaults to the file's basename). Idempotent: re-uploading * an already-stored digest reports it under `already_existed`. * * @param orgSlug - Organization identifier. * @param entries - Files to upload; see `BlobUploadEntry`. * * @returns Digests grouped into `stored` (newly written) and * `already_existed` * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint POST /orgs/{org_slug}/blobs (v1) * * @operationId none */ uploadBlobs(orgSlug: string, entries: BlobUploadEntry[]): Promise; /** * Upload manifest files for dependency analysis. Processes package files to * create dependency snapshots and security analysis. * * @throws {Error} When server returns 5xx status codes * * @operationId uploadManifestFiles * * @quota 100 units */ uploadManifestFiles(orgSlug: string, filepaths: string[], options?: UploadManifestFilesOptions | undefined): Promise; /** * View an organization's computed license policy allow list (Beta). Returns * the saturated license policy for the organization. * * @param orgSlug - Organization identifier. * * @returns The organization's license policy view. * * @throws {Error} When server returns 5xx status codes * * @apiEndpoint GET /orgs/{org_slug}/settings/license-policy/view * * @quota 1 units * * @scopes license-policy:read * * @see https://docs.socket.dev/reference/viewlicensepolicy */ viewLicensePolicy(orgSlug: string): Promise>; /** * View detailed information about a specific patch by its UUID. * * This method retrieves comprehensive patch details including files, * vulnerabilities, description, license, and tier information. * * @operationId viewPatch * * @quota 0 units */ viewPatch(orgSlug: string, uuid: string): Promise; }