@cdot65/prisma-airs-sdk 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +215 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +255 -3
- package/dist/index.d.ts +255 -3
- package/dist/index.js +212 -106
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/constants.ts","../src/errors.ts","../src/configuration.ts","../src/utils.ts","../src/http-client.ts","../src/scan/scanner.ts","../src/scan/content.ts","../src/models/ai-profile.ts","../src/models/metadata.ts","../src/models/tool-event.ts","../src/models/scan-request.ts","../src/models/scan-response.ts","../src/models/prompt-detected.ts","../src/models/response-detected.ts","../src/models/async-scan.ts","../src/models/scan-id-result.ts","../src/models/threat-report.ts","../src/models/detection.ts","../src/models/dlp-report.ts","../src/models/urlf-report.ts","../src/models/error-response.ts","../src/models/mgmt-security-profile.ts","../src/models/mgmt-custom-topic.ts","../src/models/oauth-token.ts","../src/management/oauth-client.ts","../src/management/management-http-client.ts","../src/management/profiles.ts","../src/management/topics.ts","../src/management/client.ts"],"sourcesContent":["// Public API surface\nexport { init, globalConfiguration, type InitOptions } from './configuration.js';\nexport { Scanner, Content, type SyncScanOptions, type ContentOptions } from './scan/index.js';\nexport { AISecSDKException, ErrorType } from './errors.js';\nexport * from './models/index.js';\nexport * from './constants.js';\nexport * from './management/index.js';\n","// src/constants.ts — mirrors Python SDK constants/base.py\n\nexport const HEADER_API_KEY = 'x-pan-token';\nexport const HEADER_AUTH_TOKEN = 'Authorization';\nexport const PAYLOAD_HASH = 'x-payload-hash';\nexport const BEARER = 'Bearer ';\n\nexport const DEFAULT_ENDPOINT = 'https://service.api.aisecurity.paloaltonetworks.com';\n\n// Environment variable names\nexport const AI_SEC_API_KEY = 'PANW_AI_SEC_API_KEY';\nexport const AI_SEC_API_TOKEN = 'PANW_AI_SEC_API_TOKEN';\nexport const AI_SEC_API_ENDPOINT = 'PANW_AI_SEC_API_ENDPOINT';\n\n// Content length limits (bytes)\nexport const MAX_CONTENT_PROMPT_LENGTH = 2 * 1024 * 1024; // 2 MB\nexport const MAX_CONTENT_RESPONSE_LENGTH = 2 * 1024 * 1024; // 2 MB\nexport const MAX_CONTENT_CONTEXT_LENGTH = 100 * 1024 * 1024; // 100 MB\n\n// Auth limits\nexport const MAX_API_KEY_LENGTH = 2048;\nexport const MAX_TOKEN_LENGTH = 2048;\n\n// String length limits\nexport const MAX_TRANSACTION_ID_STR_LENGTH = 100;\nexport const MAX_SESSION_ID_STR_LENGTH = 100;\nexport const MAX_SCAN_ID_STR_LENGTH = 36;\nexport const MAX_REPORT_ID_STR_LENGTH = 40;\nexport const MAX_AI_PROFILE_NAME_LENGTH = 100;\n\n// Batch / query limits\nexport const MAX_NUMBER_OF_SCAN_IDS = 5;\nexport const MAX_NUMBER_OF_REPORT_IDS = 5;\nexport const MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 5;\n\n// HTTP / retry\nexport const MAX_CONNECTION_POOL_SIZE = 100;\nexport const MAX_NUMBER_OF_RETRIES = 5;\nexport const HTTP_FORCE_RETRY_STATUS_CODES = [500, 502, 503, 504];\n\n// User-Agent (version injected at build time or read from package.json)\nexport const SDK_VERSION = '0.1.2';\nexport const USER_AGENT = `PAN-AIRS/${SDK_VERSION}-typescript-sdk`;\n\n// Management API defaults\nexport const DEFAULT_MGMT_ENDPOINT = 'https://api.sase.paloaltonetworks.com/aisec';\nexport const DEFAULT_TOKEN_ENDPOINT = 'https://auth.apps.paloaltonetworks.com/oauth2/access_token';\n\n// Management env vars\nexport const MGMT_CLIENT_ID = 'PANW_MGMT_CLIENT_ID';\nexport const MGMT_CLIENT_SECRET = 'PANW_MGMT_CLIENT_SECRET';\nexport const MGMT_TSG_ID = 'PANW_MGMT_TSG_ID';\nexport const MGMT_ENDPOINT = 'PANW_MGMT_ENDPOINT';\nexport const MGMT_TOKEN_ENDPOINT = 'PANW_MGMT_TOKEN_ENDPOINT';\n\n// API paths — scan\nexport const SYNC_SCAN_PATH = '/v1/scan/sync/request';\nexport const ASYNC_SCAN_PATH = '/v1/scan/async/request';\nexport const SCAN_RESULTS_PATH = '/v1/scan/results';\nexport const SCAN_REPORTS_PATH = '/v1/scan/reports';\n\n// API paths — management\nexport const MGMT_PROFILE_PATH = '/v1/mgmt/profile';\nexport const MGMT_PROFILES_TSG_PATH = '/v1/mgmt/profiles/tsg';\nexport const MGMT_TOPIC_PATH = '/v1/mgmt/topic';\nexport const MGMT_TOPICS_TSG_PATH = '/v1/mgmt/topics/tsg';\nexport const MGMT_TOPIC_FORCE_PATH = '/v1/mgmt/topic/force';\n","// src/errors.ts — mirrors Python SDK exceptions.py\n\nexport enum ErrorType {\n SERVER_SIDE_ERROR = 'AISEC_SERVER_SIDE_ERROR',\n CLIENT_SIDE_ERROR = 'AISEC_CLIENT_SIDE_ERROR',\n USER_REQUEST_PAYLOAD_ERROR = 'AISEC_USER_REQUEST_PAYLOAD_ERROR',\n MISSING_VARIABLE = 'AISEC_MISSING_VARIABLE',\n AISEC_SDK_ERROR = 'AISEC_SDK_ERROR',\n OAUTH_ERROR = 'AISEC_OAUTH_ERROR',\n}\n\nexport class AISecSDKException extends Error {\n public readonly errorType?: ErrorType;\n\n constructor(message: string, errorType?: ErrorType) {\n super(errorType ? `${errorType}:${message}` : message);\n this.name = 'AISecSDKException';\n this.errorType = errorType;\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, AISecSDKException);\n }\n }\n}\n","// src/configuration.ts — mirrors Python SDK configuration.py\n\nimport {\n DEFAULT_ENDPOINT,\n AI_SEC_API_KEY,\n AI_SEC_API_TOKEN,\n AI_SEC_API_ENDPOINT,\n MAX_API_KEY_LENGTH,\n MAX_TOKEN_LENGTH,\n MAX_NUMBER_OF_RETRIES,\n} from './constants.js';\nimport { AISecSDKException, ErrorType } from './errors.js';\n\nexport interface InitOptions {\n apiKey?: string;\n apiToken?: string;\n apiEndpoint?: string;\n numRetries?: number;\n}\n\nclass Configuration {\n private _apiKey?: string;\n private _apiToken?: string;\n private _apiEndpoint: string = DEFAULT_ENDPOINT;\n private _numRetries: number = MAX_NUMBER_OF_RETRIES;\n private _initialized = false;\n\n get apiKey(): string | undefined {\n return this._apiKey;\n }\n get apiToken(): string | undefined {\n return this._apiToken;\n }\n get apiEndpoint(): string {\n return this._apiEndpoint;\n }\n get numRetries(): number {\n return this._numRetries;\n }\n get initialized(): boolean {\n return this._initialized;\n }\n\n init(opts: InitOptions = {}): void {\n // Resolve api key\n const apiKey = (opts.apiKey ?? process.env[AI_SEC_API_KEY] ?? '').trim() || undefined;\n const apiToken = (opts.apiToken ?? process.env[AI_SEC_API_TOKEN] ?? '').trim() || undefined;\n\n if (!apiKey && !apiToken) {\n throw new AISecSDKException(\n 'Either apiKey or apiToken must be provided (or set via environment variables)',\n ErrorType.MISSING_VARIABLE,\n );\n }\n\n if (apiKey && apiKey.length > MAX_API_KEY_LENGTH) {\n throw new AISecSDKException(\n `apiKey exceeds max length of ${MAX_API_KEY_LENGTH}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n if (apiToken && apiToken.length > MAX_TOKEN_LENGTH) {\n throw new AISecSDKException(\n `apiToken exceeds max length of ${MAX_TOKEN_LENGTH}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n this._apiKey = apiKey;\n this._apiToken = apiToken;\n\n // Resolve endpoint\n const endpoint = opts.apiEndpoint ?? process.env[AI_SEC_API_ENDPOINT] ?? DEFAULT_ENDPOINT;\n this._apiEndpoint = endpoint.replace(/\\/+$/, ''); // strip trailing slashes\n\n // Resolve retries\n if (opts.numRetries !== undefined) {\n if (opts.numRetries < 0 || opts.numRetries > MAX_NUMBER_OF_RETRIES) {\n throw new AISecSDKException(\n `numRetries must be between 0 and ${MAX_NUMBER_OF_RETRIES}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n this._numRetries = opts.numRetries;\n }\n\n this._initialized = true;\n }\n\n reset(): void {\n this._apiKey = undefined;\n this._apiToken = undefined;\n this._apiEndpoint = DEFAULT_ENDPOINT;\n this._numRetries = MAX_NUMBER_OF_RETRIES;\n this._initialized = false;\n }\n}\n\nexport const globalConfiguration = new Configuration();\n\nexport function init(opts: InitOptions = {}): void {\n globalConfiguration.init(opts);\n}\n","// src/utils.ts — UUID validation + HMAC payload hash\n\nimport { createHmac } from 'node:crypto';\n\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nexport function isValidUuid(value: string): boolean {\n return UUID_RE.test(value);\n}\n\nexport function generatePayloadHash(payload: string, secret: string): string {\n return createHmac('sha256', secret).update(payload).digest('hex');\n}\n","// src/http-client.ts — internal fetch wrapper with retry\n\nimport { globalConfiguration } from './configuration.js';\nimport {\n HEADER_API_KEY,\n HEADER_AUTH_TOKEN,\n BEARER,\n PAYLOAD_HASH,\n USER_AGENT,\n HTTP_FORCE_RETRY_STATUS_CODES,\n} from './constants.js';\nimport { AISecSDKException, ErrorType } from './errors.js';\nimport { generatePayloadHash } from './utils.js';\n\nexport interface HttpRequestOptions {\n method: 'GET' | 'POST';\n path: string;\n body?: unknown;\n params?: Record<string, string>;\n}\n\nexport interface HttpResponse<T = unknown> {\n status: number;\n data: T;\n}\n\nfunction buildHeaders(): Record<string, string> {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n 'User-Agent': USER_AGENT,\n };\n\n const cfg = globalConfiguration;\n if (cfg.apiToken) {\n headers[HEADER_AUTH_TOKEN] = `${BEARER}${cfg.apiToken}`;\n }\n if (cfg.apiKey) {\n headers[HEADER_API_KEY] = cfg.apiKey;\n }\n\n return headers;\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nexport async function httpRequest<T>(opts: HttpRequestOptions): Promise<HttpResponse<T>> {\n if (!globalConfiguration.initialized) {\n throw new AISecSDKException(\n 'SDK not initialized. Call init() before making requests.',\n ErrorType.MISSING_VARIABLE,\n );\n }\n\n const baseUrl = globalConfiguration.apiEndpoint;\n const url = new URL(opts.path, baseUrl);\n\n if (opts.params) {\n for (const [key, value] of Object.entries(opts.params)) {\n url.searchParams.set(key, value);\n }\n }\n\n const headers = buildHeaders();\n let bodyStr: string | undefined;\n if (opts.body !== undefined) {\n bodyStr = JSON.stringify(opts.body);\n // Add payload hash if api key is present\n if (globalConfiguration.apiKey) {\n headers[PAYLOAD_HASH] = generatePayloadHash(bodyStr, globalConfiguration.apiKey);\n }\n }\n\n const maxRetries = globalConfiguration.numRetries;\n let lastError: Error | undefined;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n const response = await fetch(url.toString(), {\n method: opts.method,\n headers,\n body: bodyStr,\n });\n\n if (response.ok) {\n const data = (await response.json()) as T;\n return { status: response.status, data };\n }\n\n // Check if retryable\n if (HTTP_FORCE_RETRY_STATUS_CODES.includes(response.status) && attempt < maxRetries) {\n await sleep(Math.pow(2, attempt) * 1000);\n continue;\n }\n\n // Non-retryable error\n let errorMessage: string;\n try {\n const errorBody = await response.json();\n errorMessage =\n ((errorBody as Record<string, unknown>).message as string) ??\n ((errorBody as Record<string, Record<string, unknown>>).error?.message as string) ??\n `API error ${response.status}`;\n } catch {\n errorMessage = `API error ${response.status}`;\n }\n\n const errorType =\n response.status >= 500 ? ErrorType.SERVER_SIDE_ERROR : ErrorType.CLIENT_SIDE_ERROR;\n throw new AISecSDKException(errorMessage, errorType);\n } catch (err) {\n if (err instanceof AISecSDKException) {\n throw err;\n }\n lastError = err as Error;\n if (attempt < maxRetries) {\n await sleep(Math.pow(2, attempt) * 1000);\n continue;\n }\n }\n }\n\n throw new AISecSDKException(lastError?.message ?? 'Network error', ErrorType.CLIENT_SIDE_ERROR);\n}\n","// src/scan/scanner.ts — mirrors Python SDK scanner classes\n\nimport { httpRequest } from '../http-client.js';\nimport {\n SYNC_SCAN_PATH,\n ASYNC_SCAN_PATH,\n SCAN_RESULTS_PATH,\n SCAN_REPORTS_PATH,\n MAX_NUMBER_OF_SCAN_IDS,\n MAX_NUMBER_OF_REPORT_IDS,\n MAX_NUMBER_OF_BATCH_SCAN_OBJECTS,\n MAX_TRANSACTION_ID_STR_LENGTH,\n MAX_SESSION_ID_STR_LENGTH,\n} from '../constants.js';\nimport { AISecSDKException, ErrorType } from '../errors.js';\nimport { isValidUuid } from '../utils.js';\n\nimport type { AiProfile } from '../models/ai-profile.js';\nimport type { Metadata } from '../models/metadata.js';\nimport type { ScanResponse } from '../models/scan-response.js';\nimport type { AsyncScanObject, AsyncScanResponse } from '../models/async-scan.js';\nimport type { ScanIdResult } from '../models/scan-id-result.js';\nimport type { ThreatScanReport } from '../models/threat-report.js';\nimport { Content } from './content.js';\n\nexport interface SyncScanOptions {\n trId?: string;\n sessionId?: string;\n metadata?: Metadata;\n}\n\nexport class Scanner {\n async syncScan(\n aiProfile: AiProfile,\n content: Content,\n opts: SyncScanOptions = {},\n ): Promise<ScanResponse> {\n if (opts.trId && opts.trId.length > MAX_TRANSACTION_ID_STR_LENGTH) {\n throw new AISecSDKException(\n `trId exceeds max length of ${MAX_TRANSACTION_ID_STR_LENGTH}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n if (opts.sessionId && opts.sessionId.length > MAX_SESSION_ID_STR_LENGTH) {\n throw new AISecSDKException(\n `sessionId exceeds max length of ${MAX_SESSION_ID_STR_LENGTH}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const body: Record<string, unknown> = {\n ai_profile: aiProfile,\n contents: [content.toJSON()],\n };\n if (opts.trId) body.tr_id = opts.trId;\n if (opts.sessionId) body.session_id = opts.sessionId;\n if (opts.metadata) body.metadata = opts.metadata;\n\n const res = await httpRequest<ScanResponse>({\n method: 'POST',\n path: SYNC_SCAN_PATH,\n body,\n });\n return res.data;\n }\n\n async asyncScan(scanObjects: AsyncScanObject[]): Promise<AsyncScanResponse> {\n if (scanObjects.length < 1) {\n throw new AISecSDKException(\n 'At least 1 scan object is required',\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n if (scanObjects.length > MAX_NUMBER_OF_BATCH_SCAN_OBJECTS) {\n throw new AISecSDKException(\n `Max of ${MAX_NUMBER_OF_BATCH_SCAN_OBJECTS} scan objects allowed`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const res = await httpRequest<AsyncScanResponse>({\n method: 'POST',\n path: ASYNC_SCAN_PATH,\n body: scanObjects,\n });\n return res.data;\n }\n\n async queryByScanIds(scanIds: string[]): Promise<ScanIdResult[]> {\n if (scanIds.length < 1) {\n throw new AISecSDKException(\n 'At least 1 scan_id is required',\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n if (scanIds.length > MAX_NUMBER_OF_SCAN_IDS) {\n throw new AISecSDKException(\n `Max of ${MAX_NUMBER_OF_SCAN_IDS} scan_ids allowed`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n for (const id of scanIds) {\n if (!isValidUuid(id)) {\n throw new AISecSDKException(`Invalid scan_id: ${id}`, ErrorType.USER_REQUEST_PAYLOAD_ERROR);\n }\n }\n\n const res = await httpRequest<ScanIdResult[]>({\n method: 'GET',\n path: SCAN_RESULTS_PATH,\n params: { scan_ids: scanIds.join(',') },\n });\n return res.data;\n }\n\n async queryByReportIds(reportIds: string[]): Promise<ThreatScanReport[]> {\n if (reportIds.length < 1) {\n throw new AISecSDKException(\n 'At least 1 report_id is required',\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n if (reportIds.length > MAX_NUMBER_OF_REPORT_IDS) {\n throw new AISecSDKException(\n `Max of ${MAX_NUMBER_OF_REPORT_IDS} report_ids allowed`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const res = await httpRequest<ThreatScanReport[]>({\n method: 'GET',\n path: SCAN_REPORTS_PATH,\n params: { report_ids: reportIds.join(',') },\n });\n return res.data;\n }\n}\n","// src/scan/content.ts — mirrors Python SDK scan/models/content.py\n\nimport { readFileSync } from 'node:fs';\nimport {\n MAX_CONTENT_PROMPT_LENGTH,\n MAX_CONTENT_RESPONSE_LENGTH,\n MAX_CONTENT_CONTEXT_LENGTH,\n} from '../constants.js';\nimport { AISecSDKException, ErrorType } from '../errors.js';\nimport type { ToolEvent } from '../models/tool-event.js';\nimport type { ScanRequestContentsInner } from '../models/scan-request.js';\n\nexport interface ContentOptions {\n prompt?: string;\n response?: string;\n context?: string;\n codePrompt?: string;\n codeResponse?: string;\n toolEvent?: ToolEvent;\n}\n\nexport class Content {\n private _prompt?: string;\n private _response?: string;\n private _context?: string;\n private _codePrompt?: string;\n private _codeResponse?: string;\n private _toolEvent?: ToolEvent;\n\n constructor(opts: ContentOptions) {\n if (\n !opts.prompt &&\n !opts.response &&\n !opts.codePrompt &&\n !opts.codeResponse &&\n !opts.toolEvent\n ) {\n throw new AISecSDKException(\n 'At least one of prompt, response, codePrompt, codeResponse, or toolEvent must be provided',\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n if (opts.prompt !== undefined) this.prompt = opts.prompt;\n if (opts.response !== undefined) this.response = opts.response;\n if (opts.context !== undefined) this.context = opts.context;\n if (opts.codePrompt !== undefined) this.codePrompt = opts.codePrompt;\n if (opts.codeResponse !== undefined) this.codeResponse = opts.codeResponse;\n if (opts.toolEvent !== undefined) this._toolEvent = opts.toolEvent;\n }\n\n get prompt(): string | undefined {\n return this._prompt;\n }\n set prompt(value: string | undefined) {\n if (value !== undefined && Buffer.byteLength(value) > MAX_CONTENT_PROMPT_LENGTH) {\n throw new AISecSDKException(\n `prompt exceeds max length of ${MAX_CONTENT_PROMPT_LENGTH} bytes`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n this._prompt = value;\n }\n\n get response(): string | undefined {\n return this._response;\n }\n set response(value: string | undefined) {\n if (value !== undefined && Buffer.byteLength(value) > MAX_CONTENT_RESPONSE_LENGTH) {\n throw new AISecSDKException(\n `response exceeds max length of ${MAX_CONTENT_RESPONSE_LENGTH} bytes`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n this._response = value;\n }\n\n get context(): string | undefined {\n return this._context;\n }\n set context(value: string | undefined) {\n if (value !== undefined && Buffer.byteLength(value) > MAX_CONTENT_CONTEXT_LENGTH) {\n throw new AISecSDKException(\n `context exceeds max length of ${MAX_CONTENT_CONTEXT_LENGTH} bytes`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n this._context = value;\n }\n\n get codePrompt(): string | undefined {\n return this._codePrompt;\n }\n set codePrompt(value: string | undefined) {\n if (value !== undefined && Buffer.byteLength(value) > MAX_CONTENT_PROMPT_LENGTH) {\n throw new AISecSDKException(\n `codePrompt exceeds max length of ${MAX_CONTENT_PROMPT_LENGTH} bytes`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n this._codePrompt = value;\n }\n\n get codeResponse(): string | undefined {\n return this._codeResponse;\n }\n set codeResponse(value: string | undefined) {\n if (value !== undefined && Buffer.byteLength(value) > MAX_CONTENT_RESPONSE_LENGTH) {\n throw new AISecSDKException(\n `codeResponse exceeds max length of ${MAX_CONTENT_RESPONSE_LENGTH} bytes`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n this._codeResponse = value;\n }\n\n get toolEvent(): ToolEvent | undefined {\n return this._toolEvent;\n }\n set toolEvent(value: ToolEvent | undefined) {\n this._toolEvent = value;\n }\n\n get length(): number {\n let total = 0;\n if (this._prompt) total += Buffer.byteLength(this._prompt);\n if (this._response) total += Buffer.byteLength(this._response);\n if (this._context) total += Buffer.byteLength(this._context);\n if (this._codePrompt) total += Buffer.byteLength(this._codePrompt);\n if (this._codeResponse) total += Buffer.byteLength(this._codeResponse);\n return total;\n }\n\n toJSON(): ScanRequestContentsInner {\n const obj: ScanRequestContentsInner = {};\n if (this._prompt !== undefined) obj.prompt = this._prompt;\n if (this._response !== undefined) obj.response = this._response;\n if (this._context !== undefined) obj.context = this._context;\n if (this._codePrompt !== undefined) obj.code_prompt = this._codePrompt;\n if (this._codeResponse !== undefined) obj.code_response = this._codeResponse;\n if (this._toolEvent !== undefined) obj.tool_event = this._toolEvent;\n return obj;\n }\n\n static fromJSON(json: ScanRequestContentsInner): Content {\n return new Content({\n prompt: json.prompt,\n response: json.response,\n context: json.context,\n codePrompt: json.code_prompt,\n codeResponse: json.code_response,\n toolEvent: json.tool_event,\n });\n }\n\n static fromJSONFile(filePath: string): Content {\n const raw = readFileSync(filePath, 'utf-8');\n const parsed: ScanRequestContentsInner = JSON.parse(raw);\n return Content.fromJSON(parsed);\n }\n}\n","import { z } from 'zod';\nimport { MAX_AI_PROFILE_NAME_LENGTH } from '../constants.js';\n\nexport const AiProfileSchema = z\n .object({\n profile_id: z.string().uuid().optional(),\n profile_name: z.string().max(MAX_AI_PROFILE_NAME_LENGTH).optional(),\n })\n .refine((d) => d.profile_id || d.profile_name, {\n message: 'Either profile_id or profile_name must be provided',\n });\n\nexport type AiProfile = z.infer<typeof AiProfileSchema>;\n","import { z } from 'zod';\n\nexport const AgentMetaSchema = z.object({\n agent_id: z.string().optional(),\n agent_version: z.string().optional(),\n agent_arn: z.string().optional(),\n});\n\nexport type AgentMeta = z.infer<typeof AgentMetaSchema>;\n\nexport const MetadataSchema = z.object({\n app_name: z.string().optional(),\n app_user: z.string().optional(),\n ai_model: z.string().optional(),\n user_ip: z.string().optional(),\n agent_meta: AgentMetaSchema.optional(),\n});\n\nexport type Metadata = z.infer<typeof MetadataSchema>;\n","import { z } from 'zod';\n\nexport const ToolEventMetadataSchema = z.object({\n ecosystem: z.string(),\n method: z.string(),\n server_name: z.string(),\n tool_invoked: z.string().optional(),\n});\n\nexport type ToolEventMetadata = z.infer<typeof ToolEventMetadataSchema>;\n\nexport const ToolEventSchema = z.object({\n metadata: ToolEventMetadataSchema.optional(),\n input: z.string().optional(),\n output: z.string().optional(),\n});\n\nexport type ToolEvent = z.infer<typeof ToolEventSchema>;\n","import { z } from 'zod';\nimport { MAX_TRANSACTION_ID_STR_LENGTH, MAX_SESSION_ID_STR_LENGTH } from '../constants.js';\nimport { AiProfileSchema } from './ai-profile.js';\nimport { MetadataSchema } from './metadata.js';\nimport { ToolEventSchema } from './tool-event.js';\n\nexport const ScanRequestContentsInnerSchema = z.object({\n prompt: z.string().optional(),\n response: z.string().optional(),\n code_prompt: z.string().optional(),\n code_response: z.string().optional(),\n context: z.string().optional(),\n tool_event: ToolEventSchema.optional(),\n});\n\nexport type ScanRequestContentsInner = z.infer<typeof ScanRequestContentsInnerSchema>;\n\nexport const ScanRequestSchema = z.object({\n tr_id: z.string().max(MAX_TRANSACTION_ID_STR_LENGTH).optional(),\n session_id: z.string().max(MAX_SESSION_ID_STR_LENGTH).optional(),\n ai_profile: AiProfileSchema,\n metadata: MetadataSchema.optional(),\n contents: z.array(ScanRequestContentsInnerSchema).min(1),\n});\n\nexport type ScanRequest = z.infer<typeof ScanRequestSchema>;\n","import { z } from 'zod';\nimport { PromptDetectedSchema, PromptDetectionDetailsSchema } from './prompt-detected.js';\nimport { ResponseDetectedSchema, ResponseDetectionDetailsSchema } from './response-detected.js';\nimport { ToolEventMetadataSchema } from './tool-event.js';\n\nexport const MaskedDataSchema = z.object({\n data: z.string().optional(),\n pattern_detections: z.array(z.record(z.unknown())).optional(),\n});\n\nexport type MaskedData = z.infer<typeof MaskedDataSchema>;\n\nexport const IODetectedSchema = z\n .object({\n url_cats: z.boolean().optional(),\n dlp: z.boolean().optional(),\n injection: z.boolean().optional(),\n toxic_content: z.boolean().optional(),\n malicious_code: z.boolean().optional(),\n })\n .passthrough();\n\nexport type IODetected = z.infer<typeof IODetectedSchema>;\n\nexport const ScanSummarySchema = z\n .object({\n verdict: z.string().optional(),\n action: z.string().optional(),\n })\n .passthrough();\n\nexport type ScanSummary = z.infer<typeof ScanSummarySchema>;\n\nexport const ToolDetectedSchema = z.object({\n verdict: z.string().optional(),\n metadata: ToolEventMetadataSchema.optional(),\n summary: ScanSummarySchema.optional(),\n input_detected: IODetectedSchema.optional(),\n output_detected: IODetectedSchema.optional(),\n});\n\nexport type ToolDetected = z.infer<typeof ToolDetectedSchema>;\n\nexport const ScanResponseSchema = z.object({\n source: z.string().optional(),\n report_id: z.string(),\n scan_id: z.string(),\n tr_id: z.string().optional(),\n session_id: z.string().optional(),\n profile_id: z.string().optional(),\n profile_name: z.string().optional(),\n category: z.string(),\n action: z.string(),\n prompt_detected: PromptDetectedSchema.optional(),\n response_detected: ResponseDetectedSchema.optional(),\n prompt_masked_data: MaskedDataSchema.optional(),\n response_masked_data: MaskedDataSchema.optional(),\n prompt_detection_details: PromptDetectionDetailsSchema.optional(),\n response_detection_details: ResponseDetectionDetailsSchema.optional(),\n tool_detected: ToolDetectedSchema.optional(),\n created_at: z.string().optional(),\n completed_at: z.string().optional(),\n});\n\nexport type ScanResponse = z.infer<typeof ScanResponseSchema>;\n","import { z } from 'zod';\n\nexport const PromptDetectionDetailsSchema = z.object({\n topic_guardrails_details: z.record(z.unknown()).optional(),\n});\n\nexport type PromptDetectionDetails = z.infer<typeof PromptDetectionDetailsSchema>;\n\nexport const PromptDetectedSchema = z.object({\n url_cats: z.boolean().optional(),\n dlp: z.boolean().optional(),\n injection: z.boolean().optional(),\n toxic_content: z.boolean().optional(),\n malicious_code: z.boolean().optional(),\n agent: z.boolean().optional(),\n topic_violation: z.boolean().optional(),\n});\n\nexport type PromptDetected = z.infer<typeof PromptDetectedSchema>;\n","import { z } from 'zod';\n\nexport const ResponseDetectionDetailsSchema = z.object({\n topic_guardrails_details: z.record(z.unknown()).optional(),\n});\n\nexport type ResponseDetectionDetails = z.infer<typeof ResponseDetectionDetailsSchema>;\n\nexport const ResponseDetectedSchema = z.object({\n url_cats: z.boolean().optional(),\n dlp: z.boolean().optional(),\n db_security: z.boolean().optional(),\n toxic_content: z.boolean().optional(),\n malicious_code: z.boolean().optional(),\n agent: z.boolean().optional(),\n ungrounded: z.boolean().optional(),\n topic_violation: z.boolean().optional(),\n});\n\nexport type ResponseDetected = z.infer<typeof ResponseDetectedSchema>;\n","import { z } from 'zod';\nimport { ScanRequestSchema } from './scan-request.js';\n\nexport const AsyncScanObjectSchema = z.object({\n req_id: z.number().int(),\n scan_req: ScanRequestSchema,\n});\n\nexport type AsyncScanObject = z.infer<typeof AsyncScanObjectSchema>;\n\nexport const AsyncScanResponseSchema = z.object({\n received: z.string(),\n scan_id: z.string(),\n report_id: z.string().optional(),\n source: z.string().optional(),\n});\n\nexport type AsyncScanResponse = z.infer<typeof AsyncScanResponseSchema>;\n","import { z } from 'zod';\nimport { ScanResponseSchema } from './scan-response.js';\n\nexport const ScanIdResultSchema = z.object({\n source: z.string().optional(),\n req_id: z.number().optional(),\n status: z.string().optional(),\n scan_id: z.string().optional(),\n result: ScanResponseSchema.optional(),\n});\n\nexport type ScanIdResult = z.infer<typeof ScanIdResultSchema>;\n","import { z } from 'zod';\nimport { DetectionServiceResultSchema } from './detection.js';\n\nexport const ThreatScanReportSchema = z.object({\n source: z.string().optional(),\n report_id: z.string().optional(),\n scan_id: z.string().optional(),\n req_id: z.number().optional(),\n transaction_id: z.string().optional(),\n session_id: z.string().optional(),\n detection_results: z.array(DetectionServiceResultSchema).optional(),\n});\n\nexport type ThreatScanReport = z.infer<typeof ThreatScanReportSchema>;\n","import { z } from 'zod';\nimport { DlpReportSchema } from './dlp-report.js';\nimport { UrlfEntrySchema } from './urlf-report.js';\n\nexport const DSDetailResultSchema = z.object({\n urlf_report: z.array(UrlfEntrySchema).optional(),\n dlp_report: DlpReportSchema.optional(),\n});\n\nexport type DSDetailResult = z.infer<typeof DSDetailResultSchema>;\n\nexport const DSResultMetadataSchema = z\n .object({\n score: z.number().optional(),\n confidence: z.string().optional(),\n })\n .passthrough();\n\nexport type DSResultMetadata = z.infer<typeof DSResultMetadataSchema>;\n\nexport const DetectionServiceResultSchema = z.object({\n data_type: z.string().optional(),\n detection_service: z.string().optional(),\n verdict: z.string().optional(),\n action: z.string().optional(),\n metadata: DSResultMetadataSchema.optional(),\n result_detail: DSDetailResultSchema.optional(),\n});\n\nexport type DetectionServiceResult = z.infer<typeof DetectionServiceResultSchema>;\n","import { z } from 'zod';\n\nexport const DlpReportSchema = z.object({\n dlp_report_id: z.string().optional(),\n dlp_profile_name: z.string().optional(),\n dlp_profile_id: z.string().optional(),\n dlp_profile_version: z.number().optional(),\n data_pattern_rule1_verdict: z.string().optional(),\n data_pattern_rule2_verdict: z.string().optional(),\n});\n\nexport type DlpReport = z.infer<typeof DlpReportSchema>;\n","import { z } from 'zod';\n\nexport const UrlfEntrySchema = z.object({\n url: z.string().optional(),\n risk_level: z.string().optional(),\n categories: z.array(z.string()).optional(),\n});\n\nexport type UrlfEntry = z.infer<typeof UrlfEntrySchema>;\n","import { z } from 'zod';\n\nexport const ErrorResponseSchema = z.object({\n status_code: z.number().optional(),\n message: z.string().optional(),\n error: z\n .object({\n message: z.string().optional(),\n })\n .passthrough()\n .optional(),\n retry_after: z\n .object({\n interval: z.number().optional(),\n unit: z.string().optional(),\n })\n .optional(),\n});\n\nexport type ErrorResponse = z.infer<typeof ErrorResponseSchema>;\n","import { z } from 'zod';\n\nexport const DlpDataProfileSchema = z\n .object({\n profile_name: z.string(),\n active: z.boolean().optional(),\n })\n .passthrough();\n\nexport type DlpDataProfile = z.infer<typeof DlpDataProfileSchema>;\n\nexport const DlpSchema = z\n .object({\n dlp_status: z.string().optional(),\n data_profiles: z.array(DlpDataProfileSchema).optional(),\n })\n .passthrough();\n\nexport type Dlp = z.infer<typeof DlpSchema>;\n\nexport const DataLeakDetectionSchema = z\n .object({\n 'data-leak-detection-status': z.string().optional(),\n dlp: DlpSchema.optional(),\n })\n .passthrough();\n\nexport type DataLeakDetection = z.infer<typeof DataLeakDetectionSchema>;\n\nexport const AppProtectionSchema = z\n .object({\n 'prompt-injection': z.string().optional(),\n 'jailbreak-detection': z.string().optional(),\n })\n .passthrough();\n\nexport type AppProtection = z.infer<typeof AppProtectionSchema>;\n\nexport const ModelProtectionSchema = z\n .object({\n 'model-denial-of-service': z.string().optional(),\n })\n .passthrough();\n\nexport type ModelProtection = z.infer<typeof ModelProtectionSchema>;\n\nexport const AgentProtectionSchema = z\n .object({\n 'malicious-agent-activity': z.string().optional(),\n })\n .passthrough();\n\nexport type AgentProtection = z.infer<typeof AgentProtectionSchema>;\n\nexport const LatencySchema = z\n .object({\n status: z.string().optional(),\n max_latency_ms: z.number().optional(),\n })\n .passthrough();\n\nexport type Latency = z.infer<typeof LatencySchema>;\n\nexport const ModelConfigurationSchema = z\n .object({\n latency: LatencySchema.optional(),\n })\n .passthrough();\n\nexport type ModelConfiguration = z.infer<typeof ModelConfigurationSchema>;\n\nexport const PolicySchema = z\n .object({\n 'data-leak-detection': DataLeakDetectionSchema.optional(),\n 'app-protection': AppProtectionSchema.optional(),\n 'model-protection': ModelProtectionSchema.optional(),\n 'agent-protection': AgentProtectionSchema.optional(),\n 'model-configuration': ModelConfigurationSchema.optional(),\n })\n .passthrough();\n\nexport type Policy = z.infer<typeof PolicySchema>;\n\nexport const SecurityProfileSchema = z\n .object({\n profile_id: z.string().optional(),\n profile_name: z.string(),\n revision: z.number().optional(),\n active: z.boolean().optional(),\n policy: PolicySchema.optional(),\n created_by: z.string().optional(),\n updated_by: z.string().optional(),\n last_modified_ts: z.string().optional(),\n })\n .passthrough();\n\nexport type SecurityProfile = z.infer<typeof SecurityProfileSchema>;\n\nexport const CreateSecurityProfileRequestSchema = z\n .object({\n profile_id: z.string().optional(),\n profile_name: z.string(),\n revision: z.number().optional(),\n active: z.boolean().optional(),\n policy: PolicySchema.optional(),\n created_by: z.string().optional(),\n updated_by: z.string().optional(),\n last_modified_ts: z.string().optional(),\n })\n .passthrough();\n\nexport type CreateSecurityProfileRequest = z.infer<typeof CreateSecurityProfileRequestSchema>;\n\nexport const SecurityProfileListResponseSchema = z\n .object({\n ai_profiles: z.array(SecurityProfileSchema),\n next_offset: z.number().optional(),\n })\n .passthrough();\n\nexport type SecurityProfileListResponse = z.infer<typeof SecurityProfileListResponseSchema>;\n\nexport const DeleteProfileResponseSchema = z\n .object({\n message: z.string(),\n })\n .passthrough();\n\nexport type DeleteProfileResponse = z.infer<typeof DeleteProfileResponseSchema>;\n\nexport const DeleteProfileConflictSchema = z\n .object({\n message: z.string(),\n payload: z.array(\n z\n .object({\n policy_id: z.string(),\n policy_name: z.string(),\n priority: z.number(),\n })\n .passthrough(),\n ),\n })\n .passthrough();\n\nexport type DeleteProfileConflict = z.infer<typeof DeleteProfileConflictSchema>;\n","import { z } from 'zod';\n\nexport const CustomTopicSchema = z\n .object({\n topic_id: z.string().optional(),\n topic_name: z.string(),\n revision: z.number().optional(),\n active: z.boolean().optional(),\n description: z.string().optional(),\n examples: z.array(z.string()).optional(),\n created_by: z.string().optional(),\n updated_by: z.string().optional(),\n last_modified_ts: z.string().optional(),\n created_ts: z.string().optional(),\n })\n .passthrough();\n\nexport type CustomTopic = z.infer<typeof CustomTopicSchema>;\n\nexport const CreateCustomTopicRequestSchema = z\n .object({\n topic_id: z.string().optional(),\n topic_name: z.string(),\n revision: z.number().optional(),\n active: z.boolean().optional(),\n description: z.string().optional(),\n examples: z.array(z.string()).optional(),\n created_by: z.string().optional(),\n updated_by: z.string().optional(),\n last_modified_ts: z.string().optional(),\n created_ts: z.string().optional(),\n })\n .passthrough();\n\nexport type CreateCustomTopicRequest = z.infer<typeof CreateCustomTopicRequestSchema>;\n\nexport const CustomTopicListResponseSchema = z\n .object({\n custom_topics: z.array(CustomTopicSchema),\n next_offset: z.number().optional(),\n })\n .passthrough();\n\nexport type CustomTopicListResponse = z.infer<typeof CustomTopicListResponseSchema>;\n\nexport const DeleteTopicResponseSchema = z\n .object({\n message: z.string(),\n })\n .passthrough();\n\nexport type DeleteTopicResponse = z.infer<typeof DeleteTopicResponseSchema>;\n\nexport const DeleteTopicConflictSchema = z\n .object({\n message: z.string(),\n payload: z.array(\n z\n .object({\n profile_id: z.string(),\n profile_name: z.string(),\n revision: z.number(),\n })\n .passthrough(),\n ),\n })\n .passthrough();\n\nexport type DeleteTopicConflict = z.infer<typeof DeleteTopicConflictSchema>;\n","import { z } from 'zod';\n\nexport const OAuthTokenResponseSchema = z.object({\n access_token: z.string(),\n token_type: z.string().optional(),\n expires_in: z.number(),\n scope: z.string().optional(),\n});\n\nexport type OAuthTokenResponse = z.infer<typeof OAuthTokenResponseSchema>;\n","import { DEFAULT_TOKEN_ENDPOINT } from '../constants.js';\nimport { AISecSDKException, ErrorType } from '../errors.js';\nimport { OAuthTokenResponseSchema } from '../models/oauth-token.js';\n\nexport interface OAuthClientOptions {\n clientId: string;\n clientSecret: string;\n tsgId: string;\n tokenEndpoint?: string;\n}\n\nconst TOKEN_BUFFER_MS = 30_000; // refresh 30s before expiry\n\nexport class OAuthClient {\n public readonly tokenEndpoint: string;\n private readonly clientId: string;\n private readonly clientSecret: string;\n private readonly tsgId: string;\n\n private accessToken: string | null = null;\n private expiresAt = 0;\n private pendingFetch: Promise<string> | null = null;\n\n constructor(opts: OAuthClientOptions) {\n this.clientId = opts.clientId;\n this.clientSecret = opts.clientSecret;\n this.tsgId = opts.tsgId;\n this.tokenEndpoint = opts.tokenEndpoint ?? DEFAULT_TOKEN_ENDPOINT;\n }\n\n async getToken(): Promise<string> {\n if (this.accessToken && Date.now() < this.expiresAt - TOKEN_BUFFER_MS) {\n return this.accessToken;\n }\n\n if (this.pendingFetch) {\n return this.pendingFetch;\n }\n\n this.pendingFetch = this.fetchToken().finally(() => {\n this.pendingFetch = null;\n });\n\n return this.pendingFetch;\n }\n\n clearToken(): void {\n this.accessToken = null;\n this.expiresAt = 0;\n }\n\n private async fetchToken(): Promise<string> {\n const credentials = btoa(`${this.clientId}:${this.clientSecret}`);\n const body = new URLSearchParams({\n grant_type: 'client_credentials',\n scope: `tsg_id:${this.tsgId}`,\n });\n\n let response: Response;\n try {\n response = await fetch(this.tokenEndpoint, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n Authorization: `Basic ${credentials}`,\n },\n body: body.toString(),\n });\n } catch (err) {\n throw new AISecSDKException(\n `Token request failed: ${(err as Error).message}`,\n ErrorType.OAUTH_ERROR,\n );\n }\n\n if (!response.ok) {\n let errorMsg: string;\n try {\n const errorBody = (await response.json()) as Record<string, unknown>;\n errorMsg =\n (errorBody.error_description as string) ??\n (errorBody.error as string) ??\n `Token request failed with status ${response.status}`;\n } catch {\n errorMsg = `Token request failed with status ${response.status}`;\n }\n throw new AISecSDKException(errorMsg, ErrorType.OAUTH_ERROR);\n }\n\n const data = OAuthTokenResponseSchema.parse(await response.json());\n this.accessToken = data.access_token;\n this.expiresAt = Date.now() + data.expires_in * 1000;\n return this.accessToken;\n }\n}\n","import { USER_AGENT, HTTP_FORCE_RETRY_STATUS_CODES } from '../constants.js';\nimport { AISecSDKException, ErrorType } from '../errors.js';\nimport type { OAuthClient } from './oauth-client.js';\n\nexport interface MgmtHttpRequestOptions {\n method: 'GET' | 'POST' | 'PUT' | 'DELETE';\n baseUrl: string;\n path: string;\n body?: unknown;\n params?: Record<string, string>;\n oauthClient: OAuthClient;\n numRetries: number;\n}\n\nexport interface MgmtHttpResponse<T = unknown> {\n status: number;\n data: T;\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nfunction extractError(body: string, status: number): string {\n try {\n const parsed = JSON.parse(body) as Record<string, unknown>;\n return (\n (parsed.error_message as string) ??\n (parsed.message as string) ??\n `API error ${status}: ${body}`\n );\n } catch {\n return body ? `API error ${status}: ${body}` : `API error ${status}`;\n }\n}\n\nexport async function managementHttpRequest<T>(\n opts: MgmtHttpRequestOptions,\n): Promise<MgmtHttpResponse<T>> {\n const { method, baseUrl, path, body, params, oauthClient, numRetries } = opts;\n let hadTokenRefresh = false;\n\n for (let attempt = 0; attempt <= numRetries; attempt++) {\n const token = await oauthClient.getToken();\n const stripped = baseUrl.replace(/\\/+$/, '');\n const url = new URL(`${stripped}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n url.searchParams.set(key, value);\n }\n }\n\n const headers: Record<string, string> = {\n Authorization: `Bearer ${token}`,\n 'User-Agent': USER_AGENT,\n };\n\n let bodyStr: string | undefined;\n if (body !== undefined) {\n headers['Content-Type'] = 'application/json';\n bodyStr = JSON.stringify(body);\n }\n\n let response: Response;\n try {\n response = await fetch(url.toString(), {\n method,\n headers,\n body: bodyStr,\n });\n } catch (err) {\n if (attempt < numRetries) {\n await sleep(Math.pow(2, attempt) * 1000);\n continue;\n }\n throw new AISecSDKException(\n (err as Error).message ?? 'Network error',\n ErrorType.CLIENT_SIDE_ERROR,\n );\n }\n\n if (response.ok) {\n const text = await response.text();\n const data = text ? (JSON.parse(text) as T) : ({} as T);\n return { status: response.status, data };\n }\n\n // 401: clear token and retry once (doesn't count against retry budget)\n if (response.status === 401 && !hadTokenRefresh) {\n hadTokenRefresh = true;\n oauthClient.clearToken();\n attempt--;\n continue;\n }\n\n // Retryable 5xx\n if (HTTP_FORCE_RETRY_STATUS_CODES.includes(response.status) && attempt < numRetries) {\n await sleep(Math.pow(2, attempt) * 1000);\n continue;\n }\n\n // Non-retryable error\n const errorText = await response.text();\n const errorMessage = extractError(errorText, response.status);\n const errorType =\n response.status >= 500 ? ErrorType.SERVER_SIDE_ERROR : ErrorType.CLIENT_SIDE_ERROR;\n throw new AISecSDKException(errorMessage, errorType);\n }\n\n throw new AISecSDKException('Max retries exceeded', ErrorType.CLIENT_SIDE_ERROR);\n}\n","import { MGMT_PROFILE_PATH, MGMT_PROFILES_TSG_PATH } from '../constants.js';\nimport { AISecSDKException, ErrorType } from '../errors.js';\nimport { isValidUuid } from '../utils.js';\nimport { managementHttpRequest } from './management-http-client.js';\nimport type { OAuthClient } from './oauth-client.js';\nimport type {\n SecurityProfile,\n CreateSecurityProfileRequest,\n SecurityProfileListResponse,\n DeleteProfileResponse,\n} from '../models/mgmt-security-profile.js';\n\nexport interface PaginationOptions {\n offset?: number;\n limit?: number;\n}\n\nexport interface ProfilesClientOptions {\n baseUrl: string;\n oauthClient: OAuthClient;\n tsgId: string;\n numRetries: number;\n}\n\nexport class ProfilesClient {\n private readonly baseUrl: string;\n private readonly oauthClient: OAuthClient;\n private readonly tsgId: string;\n private readonly numRetries: number;\n\n constructor(opts: ProfilesClientOptions) {\n this.baseUrl = opts.baseUrl;\n this.oauthClient = opts.oauthClient;\n this.tsgId = opts.tsgId;\n this.numRetries = opts.numRetries;\n }\n\n async create(request: CreateSecurityProfileRequest): Promise<SecurityProfile> {\n const res = await managementHttpRequest<SecurityProfile>({\n method: 'POST',\n baseUrl: this.baseUrl,\n path: MGMT_PROFILE_PATH,\n body: request,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n\n async list(opts?: PaginationOptions): Promise<SecurityProfileListResponse> {\n const params: Record<string, string> = {\n offset: String(opts?.offset ?? 0),\n limit: String(opts?.limit ?? 100),\n };\n\n const res = await managementHttpRequest<SecurityProfileListResponse>({\n method: 'GET',\n baseUrl: this.baseUrl,\n path: `${MGMT_PROFILES_TSG_PATH}/${this.tsgId}`,\n params,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n\n async update(profileId: string, request: CreateSecurityProfileRequest): Promise<SecurityProfile> {\n if (!isValidUuid(profileId)) {\n throw new AISecSDKException(\n `Invalid profile_id: ${profileId}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const res = await managementHttpRequest<SecurityProfile>({\n method: 'PUT',\n baseUrl: this.baseUrl,\n path: `${MGMT_PROFILE_PATH}/uuid/${profileId}`,\n body: request,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n\n async delete(profileId: string): Promise<DeleteProfileResponse> {\n if (!isValidUuid(profileId)) {\n throw new AISecSDKException(\n `Invalid profile_id: ${profileId}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const res = await managementHttpRequest<DeleteProfileResponse>({\n method: 'DELETE',\n baseUrl: this.baseUrl,\n path: `${MGMT_PROFILE_PATH}/${profileId}`,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n}\n","import { MGMT_TOPIC_PATH, MGMT_TOPICS_TSG_PATH, MGMT_TOPIC_FORCE_PATH } from '../constants.js';\nimport { AISecSDKException, ErrorType } from '../errors.js';\nimport { isValidUuid } from '../utils.js';\nimport { managementHttpRequest } from './management-http-client.js';\nimport type { OAuthClient } from './oauth-client.js';\nimport type {\n CustomTopic,\n CreateCustomTopicRequest,\n CustomTopicListResponse,\n DeleteTopicResponse,\n} from '../models/mgmt-custom-topic.js';\nimport type { PaginationOptions } from './profiles.js';\n\nexport interface TopicsClientOptions {\n baseUrl: string;\n oauthClient: OAuthClient;\n tsgId: string;\n numRetries: number;\n}\n\nexport class TopicsClient {\n private readonly baseUrl: string;\n private readonly oauthClient: OAuthClient;\n private readonly tsgId: string;\n private readonly numRetries: number;\n\n constructor(opts: TopicsClientOptions) {\n this.baseUrl = opts.baseUrl;\n this.oauthClient = opts.oauthClient;\n this.tsgId = opts.tsgId;\n this.numRetries = opts.numRetries;\n }\n\n async create(request: CreateCustomTopicRequest): Promise<CustomTopic> {\n const res = await managementHttpRequest<CustomTopic>({\n method: 'POST',\n baseUrl: this.baseUrl,\n path: MGMT_TOPIC_PATH,\n body: request,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n\n async list(opts?: PaginationOptions): Promise<CustomTopicListResponse> {\n const params: Record<string, string> = {\n offset: String(opts?.offset ?? 0),\n limit: String(opts?.limit ?? 100),\n };\n\n const res = await managementHttpRequest<CustomTopicListResponse>({\n method: 'GET',\n baseUrl: this.baseUrl,\n path: `${MGMT_TOPICS_TSG_PATH}/${this.tsgId}`,\n params,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n\n async update(topicId: string, request: CreateCustomTopicRequest): Promise<CustomTopic> {\n if (!isValidUuid(topicId)) {\n throw new AISecSDKException(\n `Invalid topic_id: ${topicId}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const res = await managementHttpRequest<CustomTopic>({\n method: 'PUT',\n baseUrl: this.baseUrl,\n path: `${MGMT_TOPIC_PATH}/uuid/${topicId}`,\n body: request,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n\n async delete(topicId: string): Promise<DeleteTopicResponse> {\n if (!isValidUuid(topicId)) {\n throw new AISecSDKException(\n `Invalid topic_id: ${topicId}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const res = await managementHttpRequest<DeleteTopicResponse>({\n method: 'DELETE',\n baseUrl: this.baseUrl,\n path: `${MGMT_TOPIC_PATH}/${topicId}`,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n\n async forceDelete(topicId: string): Promise<DeleteTopicResponse> {\n if (!isValidUuid(topicId)) {\n throw new AISecSDKException(\n `Invalid topic_id: ${topicId}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const res = await managementHttpRequest<DeleteTopicResponse>({\n method: 'DELETE',\n baseUrl: this.baseUrl,\n path: `${MGMT_TOPIC_FORCE_PATH}/${topicId}`,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n}\n","import {\n DEFAULT_MGMT_ENDPOINT,\n MGMT_CLIENT_ID,\n MGMT_CLIENT_SECRET,\n MGMT_TSG_ID,\n MGMT_ENDPOINT,\n MGMT_TOKEN_ENDPOINT,\n MAX_NUMBER_OF_RETRIES,\n} from '../constants.js';\nimport { AISecSDKException, ErrorType } from '../errors.js';\nimport { OAuthClient } from './oauth-client.js';\nimport { ProfilesClient } from './profiles.js';\nimport { TopicsClient } from './topics.js';\n\nexport interface ManagementClientOptions {\n clientId?: string;\n clientSecret?: string;\n tsgId?: string;\n apiEndpoint?: string;\n tokenEndpoint?: string;\n numRetries?: number;\n}\n\nexport class ManagementClient {\n public readonly profiles: ProfilesClient;\n public readonly topics: TopicsClient;\n\n constructor(opts: ManagementClientOptions = {}) {\n const clientId = opts.clientId ?? process.env[MGMT_CLIENT_ID];\n const clientSecret = opts.clientSecret ?? process.env[MGMT_CLIENT_SECRET];\n const tsgId = opts.tsgId ?? process.env[MGMT_TSG_ID];\n const apiEndpoint = opts.apiEndpoint ?? process.env[MGMT_ENDPOINT] ?? DEFAULT_MGMT_ENDPOINT;\n const tokenEndpoint = opts.tokenEndpoint ?? process.env[MGMT_TOKEN_ENDPOINT];\n const numRetries = Math.min(\n Math.max(opts.numRetries ?? MAX_NUMBER_OF_RETRIES, 0),\n MAX_NUMBER_OF_RETRIES,\n );\n\n if (!clientId) {\n throw new AISecSDKException(\n 'clientId is required (option or PANW_MGMT_CLIENT_ID env var)',\n ErrorType.MISSING_VARIABLE,\n );\n }\n if (!clientSecret) {\n throw new AISecSDKException(\n 'clientSecret is required (option or PANW_MGMT_CLIENT_SECRET env var)',\n ErrorType.MISSING_VARIABLE,\n );\n }\n if (!tsgId) {\n throw new AISecSDKException(\n 'tsgId is required (option or PANW_MGMT_TSG_ID env var)',\n ErrorType.MISSING_VARIABLE,\n );\n }\n\n const oauthClient = new OAuthClient({\n clientId,\n clientSecret,\n tsgId,\n tokenEndpoint,\n });\n\n this.profiles = new ProfilesClient({\n baseUrl: apiEndpoint,\n oauthClient,\n tsgId,\n numRetries,\n });\n\n this.topics = new TopicsClient({\n baseUrl: apiEndpoint,\n oauthClient,\n tsgId,\n numRetries,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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B;AAAA,EACZ;AAAA,EACA;AAAA,EAEhB,YAAY,OAAgC,CAAC,GAAG;AAC9C,UAAM,WAAW,KAAK,YAAY,QAAQ,IAAI,cAAc;AAC5D,UAAM,eAAe,KAAK,gBAAgB,QAAQ,IAAI,kBAAkB;AACxE,UAAM,QAAQ,KAAK,SAAS,QAAQ,IAAI,WAAW;AACnD,UAAM,cAAc,KAAK,eAAe,QAAQ,IAAI,aAAa,KAAK;AACtE,UAAM,gBAAgB,KAAK,iBAAiB,QAAQ,IAAI,mBAAmB;AAC3E,UAAM,aAAa,KAAK;AAAA,MACtB,KAAK,IAAI,KAAK,cAAc,uBAAuB,CAAC;AAAA,MACpD;AAAA,IACF;AAEA,QAAI,CAAC,UAAU;AACb,YAAM,IAAI;AAAA,QACR;AAAA;AAAA,MAEF;AAAA,IACF;AACA,QAAI,CAAC,cAAc;AACjB,YAAM,IAAI;AAAA,QACR;AAAA;AAAA,MAEF;AAAA,IACF;AACA,QAAI,CAAC,OAAO;AACV,YAAM,IAAI;AAAA,QACR;AAAA;AAAA,MAEF;AAAA,IACF;AAEA,UAAM,cAAc,IAAI,YAAY;AAAA,MAClC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,SAAK,WAAW,IAAI,eAAe;AAAA,MACjC,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,SAAK,SAAS,IAAI,aAAa;AAAA,MAC7B,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":["ErrorType","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","sleep"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/constants.ts","../src/errors.ts","../src/configuration.ts","../src/http-retry.ts","../src/utils.ts","../src/http-client.ts","../src/scan/scanner.ts","../src/scan/content.ts","../src/models/enums.ts","../src/models/ai-profile.ts","../src/models/metadata.ts","../src/models/tool-event.ts","../src/models/scan-request.ts","../src/models/scan-response.ts","../src/models/prompt-detected.ts","../src/models/response-detected.ts","../src/models/async-scan.ts","../src/models/scan-id-result.ts","../src/models/threat-report.ts","../src/models/detection.ts","../src/models/dlp-report.ts","../src/models/urlf-report.ts","../src/models/error-response.ts","../src/models/mgmt-security-profile.ts","../src/models/mgmt-custom-topic.ts","../src/models/oauth-token.ts","../src/management/oauth-client.ts","../src/management/management-http-client.ts","../src/management/profiles.ts","../src/management/topics.ts","../src/management/client.ts"],"sourcesContent":["// Public API surface\nexport { init, globalConfiguration, type InitOptions } from './configuration.js';\nexport { Scanner, Content, type SyncScanOptions, type ContentOptions } from './scan/index.js';\nexport { AISecSDKException, ErrorType } from './errors.js';\nexport * from './models/index.js';\nexport * from './constants.js';\nexport * from './management/index.js';\n","// src/constants.ts — mirrors Python SDK constants/base.py\n\nexport const HEADER_API_KEY = 'x-pan-token';\nexport const HEADER_AUTH_TOKEN = 'Authorization';\nexport const PAYLOAD_HASH = 'x-payload-hash';\nexport const BEARER = 'Bearer ';\n\nexport const DEFAULT_ENDPOINT = 'https://service.api.aisecurity.paloaltonetworks.com';\n\n// Environment variable names\nexport const AI_SEC_API_KEY = 'PANW_AI_SEC_API_KEY';\nexport const AI_SEC_API_TOKEN = 'PANW_AI_SEC_API_TOKEN';\nexport const AI_SEC_API_ENDPOINT = 'PANW_AI_SEC_API_ENDPOINT';\n\n// Content length limits (bytes)\nexport const MAX_CONTENT_PROMPT_LENGTH = 2 * 1024 * 1024; // 2 MB\nexport const MAX_CONTENT_RESPONSE_LENGTH = 2 * 1024 * 1024; // 2 MB\nexport const MAX_CONTENT_CONTEXT_LENGTH = 100 * 1024 * 1024; // 100 MB\n\n// Auth limits\nexport const MAX_API_KEY_LENGTH = 2048;\nexport const MAX_TOKEN_LENGTH = 2048;\n\n// String length limits\nexport const MAX_TRANSACTION_ID_STR_LENGTH = 100;\nexport const MAX_SESSION_ID_STR_LENGTH = 100;\nexport const MAX_SCAN_ID_STR_LENGTH = 36;\nexport const MAX_REPORT_ID_STR_LENGTH = 40;\nexport const MAX_AI_PROFILE_NAME_LENGTH = 100;\n\n// Batch / query limits\nexport const MAX_NUMBER_OF_SCAN_IDS = 5;\nexport const MAX_NUMBER_OF_REPORT_IDS = 5;\nexport const MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 5;\n\n// HTTP / retry\nexport const MAX_CONNECTION_POOL_SIZE = 100;\nexport const MAX_NUMBER_OF_RETRIES = 5;\nexport const HTTP_FORCE_RETRY_STATUS_CODES = [500, 502, 503, 504];\n\n// User-Agent (version injected at build time or read from package.json)\nexport const SDK_VERSION = '0.2.1';\nexport const USER_AGENT = `PAN-AIRS/${SDK_VERSION}-typescript-sdk`;\n\n// Management API defaults\nexport const DEFAULT_MGMT_ENDPOINT = 'https://api.sase.paloaltonetworks.com/aisec';\nexport const DEFAULT_TOKEN_ENDPOINT = 'https://auth.apps.paloaltonetworks.com/oauth2/access_token';\n\n// Management env vars\nexport const MGMT_CLIENT_ID = 'PANW_MGMT_CLIENT_ID';\nexport const MGMT_CLIENT_SECRET = 'PANW_MGMT_CLIENT_SECRET';\nexport const MGMT_TSG_ID = 'PANW_MGMT_TSG_ID';\nexport const MGMT_ENDPOINT = 'PANW_MGMT_ENDPOINT';\nexport const MGMT_TOKEN_ENDPOINT = 'PANW_MGMT_TOKEN_ENDPOINT';\n\n// API paths — scan\nexport const SYNC_SCAN_PATH = '/v1/scan/sync/request';\nexport const ASYNC_SCAN_PATH = '/v1/scan/async/request';\nexport const SCAN_RESULTS_PATH = '/v1/scan/results';\nexport const SCAN_REPORTS_PATH = '/v1/scan/reports';\n\n// API paths — management\nexport const MGMT_PROFILE_PATH = '/v1/mgmt/profile';\nexport const MGMT_PROFILES_TSG_PATH = '/v1/mgmt/profiles/tsg';\nexport const MGMT_TOPIC_PATH = '/v1/mgmt/topic';\nexport const MGMT_TOPICS_TSG_PATH = '/v1/mgmt/topics/tsg';\nexport const MGMT_TOPIC_FORCE_PATH = '/v1/mgmt/topic/force';\n","// src/errors.ts — mirrors Python SDK exceptions.py\n\n/** Classification of SDK errors by origin. */\nexport enum ErrorType {\n /** 5xx response from the AIRS API. */\n SERVER_SIDE_ERROR = 'AISEC_SERVER_SIDE_ERROR',\n /** 4xx response or network failure. */\n CLIENT_SIDE_ERROR = 'AISEC_CLIENT_SIDE_ERROR',\n /** Invalid user-supplied input (bad UUID, oversized content, etc.). */\n USER_REQUEST_PAYLOAD_ERROR = 'AISEC_USER_REQUEST_PAYLOAD_ERROR',\n /** Required configuration value is missing. */\n MISSING_VARIABLE = 'AISEC_MISSING_VARIABLE',\n /** Internal SDK error. */\n AISEC_SDK_ERROR = 'AISEC_SDK_ERROR',\n /** OAuth2 token fetch failure. */\n OAUTH_ERROR = 'AISEC_OAUTH_ERROR',\n}\n\n/**\n * Base exception for all AIRS SDK errors.\n * The `errorType` field classifies the error origin.\n */\nexport class AISecSDKException extends Error {\n public readonly errorType?: ErrorType;\n\n /**\n * @param message - Human-readable error description.\n * @param errorType - Classification of the error.\n */\n constructor(message: string, errorType?: ErrorType) {\n super(errorType ? `${errorType}:${message}` : message);\n this.name = 'AISecSDKException';\n this.errorType = errorType;\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, AISecSDKException);\n }\n }\n}\n","// src/configuration.ts — mirrors Python SDK configuration.py\n\nimport {\n DEFAULT_ENDPOINT,\n AI_SEC_API_KEY,\n AI_SEC_API_TOKEN,\n AI_SEC_API_ENDPOINT,\n MAX_API_KEY_LENGTH,\n MAX_TOKEN_LENGTH,\n MAX_NUMBER_OF_RETRIES,\n} from './constants.js';\nimport { AISecSDKException, ErrorType } from './errors.js';\n\n/** Options for initializing the global scan API configuration. */\nexport interface InitOptions {\n /** AIRS API key. Falls back to `PANW_AI_SEC_API_KEY` env var. */\n apiKey?: string;\n /** Pre-obtained bearer token. Falls back to `PANW_AI_SEC_API_TOKEN` env var. */\n apiToken?: string;\n /** AIRS API endpoint URL. Falls back to `PANW_AI_SEC_API_ENDPOINT` env var. */\n apiEndpoint?: string;\n /** Max retry attempts (0–5). Defaults to 5. */\n numRetries?: number;\n}\n\nclass Configuration {\n private _apiKey?: string;\n private _apiToken?: string;\n private _apiEndpoint: string = DEFAULT_ENDPOINT;\n private _numRetries: number = MAX_NUMBER_OF_RETRIES;\n private _initialized = false;\n\n get apiKey(): string | undefined {\n return this._apiKey;\n }\n get apiToken(): string | undefined {\n return this._apiToken;\n }\n get apiEndpoint(): string {\n return this._apiEndpoint;\n }\n get numRetries(): number {\n return this._numRetries;\n }\n get initialized(): boolean {\n return this._initialized;\n }\n\n init(opts: InitOptions = {}): void {\n // Resolve api key\n const apiKey = (opts.apiKey ?? process.env[AI_SEC_API_KEY] ?? '').trim() || undefined;\n const apiToken = (opts.apiToken ?? process.env[AI_SEC_API_TOKEN] ?? '').trim() || undefined;\n\n if (!apiKey && !apiToken) {\n throw new AISecSDKException(\n 'Either apiKey or apiToken must be provided (or set via environment variables)',\n ErrorType.MISSING_VARIABLE,\n );\n }\n\n if (apiKey && apiKey.length > MAX_API_KEY_LENGTH) {\n throw new AISecSDKException(\n `apiKey exceeds max length of ${MAX_API_KEY_LENGTH}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n if (apiToken && apiToken.length > MAX_TOKEN_LENGTH) {\n throw new AISecSDKException(\n `apiToken exceeds max length of ${MAX_TOKEN_LENGTH}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n this._apiKey = apiKey;\n this._apiToken = apiToken;\n\n // Resolve endpoint\n const endpoint = opts.apiEndpoint ?? process.env[AI_SEC_API_ENDPOINT] ?? DEFAULT_ENDPOINT;\n this._apiEndpoint = endpoint.replace(/\\/+$/, ''); // strip trailing slashes\n\n // Resolve retries\n if (opts.numRetries !== undefined) {\n if (opts.numRetries < 0 || opts.numRetries > MAX_NUMBER_OF_RETRIES) {\n throw new AISecSDKException(\n `numRetries must be between 0 and ${MAX_NUMBER_OF_RETRIES}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n this._numRetries = opts.numRetries;\n }\n\n this._initialized = true;\n }\n\n reset(): void {\n this._apiKey = undefined;\n this._apiToken = undefined;\n this._apiEndpoint = DEFAULT_ENDPOINT;\n this._numRetries = MAX_NUMBER_OF_RETRIES;\n this._initialized = false;\n }\n}\n\n/** Global singleton holding scan API configuration. */\nexport const globalConfiguration = new Configuration();\n\n/**\n * Initialize the global scan API configuration. Must be called before using {@link Scanner}.\n * @param opts - Configuration options. Reads env vars as fallbacks.\n * @throws {AISecSDKException} If neither apiKey nor apiToken is provided.\n */\nexport function init(opts: InitOptions = {}): void {\n globalConfiguration.init(opts);\n}\n","// src/http-retry.ts — shared retry logic for HTTP clients\n\nimport { HTTP_FORCE_RETRY_STATUS_CODES } from './constants.js';\nimport { AISecSDKException, ErrorType } from './errors.js';\n\n/**\n * Sleep for the given number of milliseconds.\n * @param ms - Milliseconds to wait.\n */\nexport function sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Calculate exponential backoff delay for the given attempt.\n * @param attempt - Zero-based attempt number.\n * @returns Delay in milliseconds.\n */\nexport function backoffDelay(attempt: number): number {\n return Math.pow(2, attempt) * 1000;\n}\n\n/**\n * Check if an HTTP status code should trigger a retry.\n * @param status - HTTP status code.\n */\nexport function isRetryableStatus(status: number): boolean {\n return HTTP_FORCE_RETRY_STATUS_CODES.includes(status);\n}\n\n/**\n * Classify an HTTP status code as server-side or client-side error.\n * @param status - HTTP status code.\n */\nexport function classifyErrorType(status: number): ErrorType {\n return status >= 500 ? ErrorType.SERVER_SIDE_ERROR : ErrorType.CLIENT_SIDE_ERROR;\n}\n\n/**\n * Extract a human-readable error message from an API error response body.\n * Tries `error_message`, `message`, and `error.message` fields in order.\n * @param body - Raw response body string.\n * @param status - HTTP status code for fallback message.\n */\nexport function extractErrorMessage(body: string, status: number): string {\n try {\n const parsed = JSON.parse(body) as Record<string, unknown>;\n return (\n (parsed.error_message as string) ??\n (parsed.message as string) ??\n ((parsed.error as Record<string, unknown> | undefined)?.message as string) ??\n `API error ${status}`\n );\n } catch {\n return body ? `API error ${status}: ${body}` : `API error ${status}`;\n }\n}\n\n/** Options for {@link executeWithRetry}. */\nexport interface RetryOptions {\n /** Maximum number of retry attempts. */\n maxRetries: number;\n /** Function that performs the HTTP request for each attempt. */\n execute: (attempt: number) => Promise<Response>;\n /** Optional callback for handling special failure cases (e.g. 401 token refresh). Return true to retry without consuming the retry budget. */\n onRetryableFailure?: (response: Response, attempt: number) => Promise<boolean>;\n}\n\n/**\n * Execute an HTTP request with exponential backoff retry.\n * @param opts - Retry configuration and request function.\n * @returns Successful HTTP Response.\n * @throws {AISecSDKException} After exhausting retries or on non-retryable errors.\n */\nexport async function executeWithRetry(opts: RetryOptions): Promise<Response> {\n const { maxRetries, execute, onRetryableFailure } = opts;\n let lastError: Error | undefined;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n let response: Response;\n try {\n response = await execute(attempt);\n } catch (err) {\n if (err instanceof AISecSDKException) throw err;\n lastError = err as Error;\n if (attempt < maxRetries) {\n await sleep(backoffDelay(attempt));\n continue;\n }\n throw new AISecSDKException(\n lastError.message ?? 'Network error',\n ErrorType.CLIENT_SIDE_ERROR,\n );\n }\n\n if (response.ok) return response;\n\n // Let caller handle special status codes (e.g. 401 token refresh)\n // When handled, decrement attempt so it doesn't count against retry budget\n if (onRetryableFailure) {\n const handled = await onRetryableFailure(response, attempt);\n if (handled) {\n attempt--;\n continue;\n }\n }\n\n if (isRetryableStatus(response.status) && attempt < maxRetries) {\n await sleep(backoffDelay(attempt));\n continue;\n }\n\n // Non-retryable error\n const errorText = await response.text();\n const errorMessage = extractErrorMessage(errorText, response.status);\n throw new AISecSDKException(errorMessage, classifyErrorType(response.status));\n }\n\n throw new AISecSDKException(\n lastError?.message ?? 'Max retries exceeded',\n ErrorType.CLIENT_SIDE_ERROR,\n );\n}\n","// src/utils.ts — UUID validation + HMAC payload hash\n\nimport { createHmac } from 'node:crypto';\n\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nexport function isValidUuid(value: string): boolean {\n return UUID_RE.test(value);\n}\n\nexport function generatePayloadHash(payload: string, secret: string): string {\n return createHmac('sha256', secret).update(payload).digest('hex');\n}\n","// src/http-client.ts — internal fetch wrapper with retry\n\nimport { globalConfiguration } from './configuration.js';\nimport {\n HEADER_API_KEY,\n HEADER_AUTH_TOKEN,\n BEARER,\n PAYLOAD_HASH,\n USER_AGENT,\n} from './constants.js';\nimport { AISecSDKException, ErrorType } from './errors.js';\nimport { executeWithRetry } from './http-retry.js';\nimport { generatePayloadHash } from './utils.js';\n\n/** Options for a scan API HTTP request. */\nexport interface HttpRequestOptions {\n /** HTTP method. */\n method: 'GET' | 'POST';\n /** API path (appended to the configured endpoint). */\n path: string;\n /** Request body (JSON-serialized). */\n body?: unknown;\n /** URL query parameters. */\n params?: Record<string, string>;\n}\n\n/** Typed HTTP response wrapper. */\nexport interface HttpResponse<T = unknown> {\n /** HTTP status code. */\n status: number;\n /** Parsed response body. */\n data: T;\n}\n\nfunction buildHeaders(): Record<string, string> {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n 'User-Agent': USER_AGENT,\n };\n\n const cfg = globalConfiguration;\n if (cfg.apiToken) {\n headers[HEADER_AUTH_TOKEN] = `${BEARER}${cfg.apiToken}`;\n }\n if (cfg.apiKey) {\n headers[HEADER_API_KEY] = cfg.apiKey;\n }\n\n return headers;\n}\n\nexport async function httpRequest<T>(opts: HttpRequestOptions): Promise<HttpResponse<T>> {\n if (!globalConfiguration.initialized) {\n throw new AISecSDKException(\n 'SDK not initialized. Call init() before making requests.',\n ErrorType.MISSING_VARIABLE,\n );\n }\n\n const baseUrl = globalConfiguration.apiEndpoint;\n const url = new URL(opts.path, baseUrl);\n\n if (opts.params) {\n for (const [key, value] of Object.entries(opts.params)) {\n url.searchParams.set(key, value);\n }\n }\n\n const headers = buildHeaders();\n let bodyStr: string | undefined;\n if (opts.body !== undefined) {\n bodyStr = JSON.stringify(opts.body);\n if (globalConfiguration.apiKey) {\n headers[PAYLOAD_HASH] = generatePayloadHash(bodyStr, globalConfiguration.apiKey);\n }\n }\n\n const response = await executeWithRetry({\n maxRetries: globalConfiguration.numRetries,\n execute: () =>\n fetch(url.toString(), {\n method: opts.method,\n headers,\n body: bodyStr,\n }),\n });\n\n const data = (await response.json()) as T;\n return { status: response.status, data };\n}\n","// src/scan/scanner.ts — mirrors Python SDK scanner classes\n\nimport { httpRequest } from '../http-client.js';\nimport {\n SYNC_SCAN_PATH,\n ASYNC_SCAN_PATH,\n SCAN_RESULTS_PATH,\n SCAN_REPORTS_PATH,\n MAX_NUMBER_OF_SCAN_IDS,\n MAX_NUMBER_OF_REPORT_IDS,\n MAX_NUMBER_OF_BATCH_SCAN_OBJECTS,\n MAX_TRANSACTION_ID_STR_LENGTH,\n MAX_SESSION_ID_STR_LENGTH,\n} from '../constants.js';\nimport { AISecSDKException, ErrorType } from '../errors.js';\nimport { isValidUuid } from '../utils.js';\n\nimport type { AiProfile } from '../models/ai-profile.js';\nimport type { Metadata } from '../models/metadata.js';\nimport type { ScanResponse } from '../models/scan-response.js';\nimport type { AsyncScanObject, AsyncScanResponse } from '../models/async-scan.js';\nimport type { ScanIdResult } from '../models/scan-id-result.js';\nimport type { ThreatScanReport } from '../models/threat-report.js';\nimport { Content } from './content.js';\n\n/** Optional parameters for {@link Scanner.syncScan}. */\nexport interface SyncScanOptions {\n /** Transaction ID for tracing. Max 100 characters. */\n trId?: string;\n /** Session ID for grouping related scans. Max 100 characters. */\n sessionId?: string;\n /** Application metadata attached to the scan request. */\n metadata?: Metadata;\n}\n\n/** Client for AIRS scan operations (sync, async, and query). */\nexport class Scanner {\n /**\n * Perform a synchronous content scan.\n * @param aiProfile - AI security profile to scan against.\n * @param content - Content to scan.\n * @param opts - Optional transaction/session IDs and metadata.\n * @returns Scan response with verdict, action, and detection details.\n */\n async syncScan(\n aiProfile: AiProfile,\n content: Content,\n opts: SyncScanOptions = {},\n ): Promise<ScanResponse> {\n if (opts.trId && opts.trId.length > MAX_TRANSACTION_ID_STR_LENGTH) {\n throw new AISecSDKException(\n `trId exceeds max length of ${MAX_TRANSACTION_ID_STR_LENGTH}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n if (opts.sessionId && opts.sessionId.length > MAX_SESSION_ID_STR_LENGTH) {\n throw new AISecSDKException(\n `sessionId exceeds max length of ${MAX_SESSION_ID_STR_LENGTH}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const body: Record<string, unknown> = {\n ai_profile: aiProfile,\n contents: [content.toJSON()],\n };\n if (opts.trId) body.tr_id = opts.trId;\n if (opts.sessionId) body.session_id = opts.sessionId;\n if (opts.metadata) body.metadata = opts.metadata;\n\n const res = await httpRequest<ScanResponse>({\n method: 'POST',\n path: SYNC_SCAN_PATH,\n body,\n });\n return res.data;\n }\n\n /**\n * Submit content for asynchronous scanning.\n * @param scanObjects - Array of scan objects (1–5 items).\n * @returns Response containing scan IDs for later querying.\n */\n async asyncScan(scanObjects: AsyncScanObject[]): Promise<AsyncScanResponse> {\n if (scanObjects.length < 1) {\n throw new AISecSDKException(\n 'At least 1 scan object is required',\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n if (scanObjects.length > MAX_NUMBER_OF_BATCH_SCAN_OBJECTS) {\n throw new AISecSDKException(\n `Max of ${MAX_NUMBER_OF_BATCH_SCAN_OBJECTS} scan objects allowed`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const res = await httpRequest<AsyncScanResponse>({\n method: 'POST',\n path: ASYNC_SCAN_PATH,\n body: scanObjects,\n });\n return res.data;\n }\n\n /**\n * Query scan results by scan IDs.\n * @param scanIds - Array of scan UUIDs (1–5 items).\n * @returns Array of scan results with status and response data.\n */\n async queryByScanIds(scanIds: string[]): Promise<ScanIdResult[]> {\n if (scanIds.length < 1) {\n throw new AISecSDKException(\n 'At least 1 scan_id is required',\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n if (scanIds.length > MAX_NUMBER_OF_SCAN_IDS) {\n throw new AISecSDKException(\n `Max of ${MAX_NUMBER_OF_SCAN_IDS} scan_ids allowed`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n for (const id of scanIds) {\n if (!isValidUuid(id)) {\n throw new AISecSDKException(`Invalid scan_id: ${id}`, ErrorType.USER_REQUEST_PAYLOAD_ERROR);\n }\n }\n\n const res = await httpRequest<ScanIdResult[]>({\n method: 'GET',\n path: SCAN_RESULTS_PATH,\n params: { scan_ids: scanIds.join(',') },\n });\n return res.data;\n }\n\n /**\n * Query detailed threat reports by report IDs.\n * @param reportIds - Array of report IDs (1–5 items).\n * @returns Array of threat scan reports with detection details.\n */\n async queryByReportIds(reportIds: string[]): Promise<ThreatScanReport[]> {\n if (reportIds.length < 1) {\n throw new AISecSDKException(\n 'At least 1 report_id is required',\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n if (reportIds.length > MAX_NUMBER_OF_REPORT_IDS) {\n throw new AISecSDKException(\n `Max of ${MAX_NUMBER_OF_REPORT_IDS} report_ids allowed`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const res = await httpRequest<ThreatScanReport[]>({\n method: 'GET',\n path: SCAN_REPORTS_PATH,\n params: { report_ids: reportIds.join(',') },\n });\n return res.data;\n }\n}\n","// src/scan/content.ts — mirrors Python SDK scan/models/content.py\n\nimport { readFileSync } from 'node:fs';\nimport {\n MAX_CONTENT_PROMPT_LENGTH,\n MAX_CONTENT_RESPONSE_LENGTH,\n MAX_CONTENT_CONTEXT_LENGTH,\n} from '../constants.js';\nimport { AISecSDKException, ErrorType } from '../errors.js';\nimport type { ToolEvent } from '../models/tool-event.js';\nimport type { ScanRequestContentsInner } from '../models/scan-request.js';\n\n/** Options for constructing a {@link Content} instance. At least one field is required. */\nexport interface ContentOptions {\n /** User prompt text. Max 2 MB. */\n prompt?: string;\n /** AI model response text. Max 2 MB. */\n response?: string;\n /** Conversation context. Max 100 MB. */\n context?: string;\n /** Code prompt text. Max 2 MB. */\n codePrompt?: string;\n /** Code response text. Max 2 MB. */\n codeResponse?: string;\n /** Tool/function call event data. */\n toolEvent?: ToolEvent;\n}\n\n/**\n * Represents content to be scanned by AIRS.\n * Validates byte-length limits on construction and property assignment.\n */\nexport class Content {\n private _prompt?: string;\n private _response?: string;\n private _context?: string;\n private _codePrompt?: string;\n private _codeResponse?: string;\n private _toolEvent?: ToolEvent;\n\n constructor(opts: ContentOptions) {\n if (\n !opts.prompt &&\n !opts.response &&\n !opts.codePrompt &&\n !opts.codeResponse &&\n !opts.toolEvent\n ) {\n throw new AISecSDKException(\n 'At least one of prompt, response, codePrompt, codeResponse, or toolEvent must be provided',\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n if (opts.prompt !== undefined) this.prompt = opts.prompt;\n if (opts.response !== undefined) this.response = opts.response;\n if (opts.context !== undefined) this.context = opts.context;\n if (opts.codePrompt !== undefined) this.codePrompt = opts.codePrompt;\n if (opts.codeResponse !== undefined) this.codeResponse = opts.codeResponse;\n if (opts.toolEvent !== undefined) this._toolEvent = opts.toolEvent;\n }\n\n get prompt(): string | undefined {\n return this._prompt;\n }\n set prompt(value: string | undefined) {\n if (value !== undefined && Buffer.byteLength(value) > MAX_CONTENT_PROMPT_LENGTH) {\n throw new AISecSDKException(\n `prompt exceeds max length of ${MAX_CONTENT_PROMPT_LENGTH} bytes`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n this._prompt = value;\n }\n\n get response(): string | undefined {\n return this._response;\n }\n set response(value: string | undefined) {\n if (value !== undefined && Buffer.byteLength(value) > MAX_CONTENT_RESPONSE_LENGTH) {\n throw new AISecSDKException(\n `response exceeds max length of ${MAX_CONTENT_RESPONSE_LENGTH} bytes`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n this._response = value;\n }\n\n get context(): string | undefined {\n return this._context;\n }\n set context(value: string | undefined) {\n if (value !== undefined && Buffer.byteLength(value) > MAX_CONTENT_CONTEXT_LENGTH) {\n throw new AISecSDKException(\n `context exceeds max length of ${MAX_CONTENT_CONTEXT_LENGTH} bytes`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n this._context = value;\n }\n\n get codePrompt(): string | undefined {\n return this._codePrompt;\n }\n set codePrompt(value: string | undefined) {\n if (value !== undefined && Buffer.byteLength(value) > MAX_CONTENT_PROMPT_LENGTH) {\n throw new AISecSDKException(\n `codePrompt exceeds max length of ${MAX_CONTENT_PROMPT_LENGTH} bytes`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n this._codePrompt = value;\n }\n\n get codeResponse(): string | undefined {\n return this._codeResponse;\n }\n set codeResponse(value: string | undefined) {\n if (value !== undefined && Buffer.byteLength(value) > MAX_CONTENT_RESPONSE_LENGTH) {\n throw new AISecSDKException(\n `codeResponse exceeds max length of ${MAX_CONTENT_RESPONSE_LENGTH} bytes`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n this._codeResponse = value;\n }\n\n get toolEvent(): ToolEvent | undefined {\n return this._toolEvent;\n }\n set toolEvent(value: ToolEvent | undefined) {\n this._toolEvent = value;\n }\n\n /** Total byte length of all text content fields. */\n get length(): number {\n let total = 0;\n if (this._prompt) total += Buffer.byteLength(this._prompt);\n if (this._response) total += Buffer.byteLength(this._response);\n if (this._context) total += Buffer.byteLength(this._context);\n if (this._codePrompt) total += Buffer.byteLength(this._codePrompt);\n if (this._codeResponse) total += Buffer.byteLength(this._codeResponse);\n return total;\n }\n\n /** Serialize to the API request format. */\n toJSON(): ScanRequestContentsInner {\n const obj: ScanRequestContentsInner = {};\n if (this._prompt !== undefined) obj.prompt = this._prompt;\n if (this._response !== undefined) obj.response = this._response;\n if (this._context !== undefined) obj.context = this._context;\n if (this._codePrompt !== undefined) obj.code_prompt = this._codePrompt;\n if (this._codeResponse !== undefined) obj.code_response = this._codeResponse;\n if (this._toolEvent !== undefined) obj.tool_event = this._toolEvent;\n return obj;\n }\n\n /**\n * Create a Content instance from an API response object.\n * @param json - Scan request contents inner object.\n */\n static fromJSON(json: ScanRequestContentsInner): Content {\n return new Content({\n prompt: json.prompt,\n response: json.response,\n context: json.context,\n codePrompt: json.code_prompt,\n codeResponse: json.code_response,\n toolEvent: json.tool_event,\n });\n }\n\n /**\n * Load content from a JSON file.\n * @param filePath - Path to JSON file containing scan request contents.\n */\n static fromJSONFile(filePath: string): Content {\n const raw = readFileSync(filePath, 'utf-8');\n const parsed: ScanRequestContentsInner = JSON.parse(raw);\n return Content.fromJSON(parsed);\n }\n}\n","// src/models/enums.ts — typed enums for AIRS API verdict/action/category values\n\n/** Scan result verdict classification. */\nexport const Verdict = {\n BENIGN: 'benign',\n MALICIOUS: 'malicious',\n UNKNOWN: 'unknown',\n} as const;\n\n/** Union type of all possible verdict values. */\nexport type Verdict = (typeof Verdict)[keyof typeof Verdict];\n\n/** Enforcement action taken by AIRS. */\nexport const Action = {\n ALLOW: 'allow',\n BLOCK: 'block',\n ALERT: 'alert',\n} as const;\n\n/** Union type of all possible action values. */\nexport type Action = (typeof Action)[keyof typeof Action];\n\n/** Top-level scan result category. */\nexport const Category = {\n BENIGN: 'benign',\n MALICIOUS: 'malicious',\n UNKNOWN: 'unknown',\n} as const;\n\n/** Union type of all possible category values. */\nexport type Category = (typeof Category)[keyof typeof Category];\n","import { z } from 'zod';\nimport { MAX_AI_PROFILE_NAME_LENGTH } from '../constants.js';\n\n/** Zod schema for AI security profile identifier. Requires profile_id or profile_name. */\nexport const AiProfileSchema = z\n .object({\n profile_id: z.string().uuid().optional(),\n profile_name: z.string().max(MAX_AI_PROFILE_NAME_LENGTH).optional(),\n })\n .refine((d) => d.profile_id || d.profile_name, {\n message: 'Either profile_id or profile_name must be provided',\n });\n\n/** AI security profile identifier. At least one of profile_id or profile_name required. */\nexport type AiProfile = z.infer<typeof AiProfileSchema>;\n","import { z } from 'zod';\n\n/** Zod schema for AI agent metadata. */\nexport const AgentMetaSchema = z.object({\n agent_id: z.string().optional(),\n agent_version: z.string().optional(),\n agent_arn: z.string().optional(),\n});\n\n/** AI agent metadata (agent ID, version, ARN). */\nexport type AgentMeta = z.infer<typeof AgentMetaSchema>;\n\n/** Zod schema for scan request metadata. */\nexport const MetadataSchema = z.object({\n app_name: z.string().optional(),\n app_user: z.string().optional(),\n ai_model: z.string().optional(),\n user_ip: z.string().optional(),\n agent_meta: AgentMetaSchema.optional(),\n});\n\n/** Application metadata attached to scan requests. */\nexport type Metadata = z.infer<typeof MetadataSchema>;\n","import { z } from 'zod';\n\n/** Zod schema for tool/function call event metadata. */\nexport const ToolEventMetadataSchema = z.object({\n ecosystem: z.string(),\n method: z.string(),\n server_name: z.string(),\n tool_invoked: z.string().optional(),\n});\n\n/** Tool/function call event metadata (ecosystem, method, server, tool). */\nexport type ToolEventMetadata = z.infer<typeof ToolEventMetadataSchema>;\n\n/** Zod schema for a tool/function call event with input and output. */\nexport const ToolEventSchema = z.object({\n metadata: ToolEventMetadataSchema.optional(),\n input: z.string().optional(),\n output: z.string().optional(),\n});\n\n/** Tool/function call event with optional input and output strings. */\nexport type ToolEvent = z.infer<typeof ToolEventSchema>;\n","import { z } from 'zod';\nimport { MAX_TRANSACTION_ID_STR_LENGTH, MAX_SESSION_ID_STR_LENGTH } from '../constants.js';\nimport { AiProfileSchema } from './ai-profile.js';\nimport { MetadataSchema } from './metadata.js';\nimport { ToolEventSchema } from './tool-event.js';\n\n/** Zod schema for a single content item within a scan request. */\nexport const ScanRequestContentsInnerSchema = z.object({\n prompt: z.string().optional(),\n response: z.string().optional(),\n code_prompt: z.string().optional(),\n code_response: z.string().optional(),\n context: z.string().optional(),\n tool_event: ToolEventSchema.optional(),\n});\n\n/** Single content item within a scan request. */\nexport type ScanRequestContentsInner = z.infer<typeof ScanRequestContentsInnerSchema>;\n\n/** Zod schema for a complete scan request payload. */\nexport const ScanRequestSchema = z.object({\n tr_id: z.string().max(MAX_TRANSACTION_ID_STR_LENGTH).optional(),\n session_id: z.string().max(MAX_SESSION_ID_STR_LENGTH).optional(),\n ai_profile: AiProfileSchema,\n metadata: MetadataSchema.optional(),\n contents: z.array(ScanRequestContentsInnerSchema).min(1),\n});\n\n/** Complete scan request payload sent to the AIRS API. */\nexport type ScanRequest = z.infer<typeof ScanRequestSchema>;\n","import { z } from 'zod';\nimport { PromptDetectedSchema, PromptDetectionDetailsSchema } from './prompt-detected.js';\nimport { ResponseDetectedSchema, ResponseDetectionDetailsSchema } from './response-detected.js';\nimport { ToolEventMetadataSchema } from './tool-event.js';\n\n/** Zod schema for masked data in scan results. */\nexport const MaskedDataSchema = z.object({\n data: z.string().optional(),\n pattern_detections: z.array(z.record(z.unknown())).optional(),\n});\n\n/** Masked data containing redacted content and pattern detections. */\nexport type MaskedData = z.infer<typeof MaskedDataSchema>;\n\n/** Zod schema for I/O detection flags. */\nexport const IODetectedSchema = z\n .object({\n url_cats: z.boolean().optional(),\n dlp: z.boolean().optional(),\n injection: z.boolean().optional(),\n toxic_content: z.boolean().optional(),\n malicious_code: z.boolean().optional(),\n })\n .passthrough();\n\n/** Flags indicating which detection types triggered on input or output. */\nexport type IODetected = z.infer<typeof IODetectedSchema>;\n\n/** Zod schema for the scan summary (verdict + action). */\nexport const ScanSummarySchema = z\n .object({\n verdict: z.string().optional(),\n action: z.string().optional(),\n })\n .passthrough();\n\n/** Scan summary containing overall verdict and action. */\nexport type ScanSummary = z.infer<typeof ScanSummarySchema>;\n\n/** Zod schema for tool/agent detection results. */\nexport const ToolDetectedSchema = z.object({\n verdict: z.string().optional(),\n metadata: ToolEventMetadataSchema.optional(),\n summary: ScanSummarySchema.optional(),\n input_detected: IODetectedSchema.optional(),\n output_detected: IODetectedSchema.optional(),\n});\n\n/** Detection results for tool/agent interactions. */\nexport type ToolDetected = z.infer<typeof ToolDetectedSchema>;\n\n/** Zod schema for a complete scan response from the AIRS API. */\nexport const ScanResponseSchema = z.object({\n source: z.string().optional(),\n report_id: z.string(),\n scan_id: z.string(),\n tr_id: z.string().optional(),\n session_id: z.string().optional(),\n profile_id: z.string().optional(),\n profile_name: z.string().optional(),\n category: z.string(),\n action: z.string(),\n prompt_detected: PromptDetectedSchema.optional(),\n response_detected: ResponseDetectedSchema.optional(),\n prompt_masked_data: MaskedDataSchema.optional(),\n response_masked_data: MaskedDataSchema.optional(),\n prompt_detection_details: PromptDetectionDetailsSchema.optional(),\n response_detection_details: ResponseDetectionDetailsSchema.optional(),\n tool_detected: ToolDetectedSchema.optional(),\n created_at: z.string().optional(),\n completed_at: z.string().optional(),\n});\n\n/** Complete scan response with verdict, action, and detection details. */\nexport type ScanResponse = z.infer<typeof ScanResponseSchema>;\n","import { z } from 'zod';\n\n/** Zod schema for prompt detection detail data. */\nexport const PromptDetectionDetailsSchema = z.object({\n topic_guardrails_details: z.record(z.unknown()).optional(),\n});\n\n/** Prompt detection detail data including topic guardrails. */\nexport type PromptDetectionDetails = z.infer<typeof PromptDetectionDetailsSchema>;\n\n/** Zod schema for prompt-side detection flags. */\nexport const PromptDetectedSchema = z.object({\n url_cats: z.boolean().optional(),\n dlp: z.boolean().optional(),\n injection: z.boolean().optional(),\n toxic_content: z.boolean().optional(),\n malicious_code: z.boolean().optional(),\n agent: z.boolean().optional(),\n topic_violation: z.boolean().optional(),\n});\n\n/** Flags indicating which detection types triggered on the prompt. */\nexport type PromptDetected = z.infer<typeof PromptDetectedSchema>;\n","import { z } from 'zod';\n\n/** Zod schema for response detection detail data. */\nexport const ResponseDetectionDetailsSchema = z.object({\n topic_guardrails_details: z.record(z.unknown()).optional(),\n});\n\n/** Response detection detail data including topic guardrails. */\nexport type ResponseDetectionDetails = z.infer<typeof ResponseDetectionDetailsSchema>;\n\n/** Zod schema for response-side detection flags. */\nexport const ResponseDetectedSchema = z.object({\n url_cats: z.boolean().optional(),\n dlp: z.boolean().optional(),\n db_security: z.boolean().optional(),\n toxic_content: z.boolean().optional(),\n malicious_code: z.boolean().optional(),\n agent: z.boolean().optional(),\n ungrounded: z.boolean().optional(),\n topic_violation: z.boolean().optional(),\n});\n\n/** Flags indicating which detection types triggered on the response. */\nexport type ResponseDetected = z.infer<typeof ResponseDetectedSchema>;\n","import { z } from 'zod';\nimport { ScanRequestSchema } from './scan-request.js';\n\n/** Zod schema for an async scan batch item. */\nexport const AsyncScanObjectSchema = z.object({\n req_id: z.number().int(),\n scan_req: ScanRequestSchema,\n});\n\n/** Async scan batch item containing a request ID and scan request. */\nexport type AsyncScanObject = z.infer<typeof AsyncScanObjectSchema>;\n\n/** Zod schema for the async scan API response. */\nexport const AsyncScanResponseSchema = z.object({\n received: z.string(),\n scan_id: z.string(),\n report_id: z.string().optional(),\n source: z.string().optional(),\n});\n\n/** Async scan API response with scan ID for later querying. */\nexport type AsyncScanResponse = z.infer<typeof AsyncScanResponseSchema>;\n","import { z } from 'zod';\nimport { ScanResponseSchema } from './scan-response.js';\n\n/** Zod schema for a scan ID query result. */\nexport const ScanIdResultSchema = z.object({\n source: z.string().optional(),\n req_id: z.number().optional(),\n status: z.string().optional(),\n scan_id: z.string().optional(),\n result: ScanResponseSchema.optional(),\n});\n\n/** Result of querying a scan by its scan ID, including status and full scan response. */\nexport type ScanIdResult = z.infer<typeof ScanIdResultSchema>;\n","import { z } from 'zod';\nimport { DetectionServiceResultSchema } from './detection.js';\n\n/** Zod schema for a detailed threat scan report. */\nexport const ThreatScanReportSchema = z.object({\n source: z.string().optional(),\n report_id: z.string().optional(),\n scan_id: z.string().optional(),\n req_id: z.number().optional(),\n transaction_id: z.string().optional(),\n session_id: z.string().optional(),\n detection_results: z.array(DetectionServiceResultSchema).optional(),\n});\n\n/** Detailed threat scan report with per-service detection results. */\nexport type ThreatScanReport = z.infer<typeof ThreatScanReportSchema>;\n","import { z } from 'zod';\nimport { DlpReportSchema } from './dlp-report.js';\nimport { UrlfEntrySchema } from './urlf-report.js';\n\n/** Zod schema for detection service detail results (URLF and DLP reports). */\nexport const DSDetailResultSchema = z.object({\n urlf_report: z.array(UrlfEntrySchema).optional(),\n dlp_report: DlpReportSchema.optional(),\n});\n\n/** Detection service detail results containing URLF and DLP reports. */\nexport type DSDetailResult = z.infer<typeof DSDetailResultSchema>;\n\n/** Zod schema for detection service result metadata (score and confidence). */\nexport const DSResultMetadataSchema = z\n .object({\n score: z.number().optional(),\n confidence: z.string().optional(),\n })\n .passthrough();\n\n/** Detection service result metadata with score and confidence. */\nexport type DSResultMetadata = z.infer<typeof DSResultMetadataSchema>;\n\n/** Zod schema for an individual detection service result. */\nexport const DetectionServiceResultSchema = z.object({\n data_type: z.string().optional(),\n detection_service: z.string().optional(),\n verdict: z.string().optional(),\n action: z.string().optional(),\n metadata: DSResultMetadataSchema.optional(),\n result_detail: DSDetailResultSchema.optional(),\n});\n\n/** Individual detection service result with verdict, action, and details. */\nexport type DetectionServiceResult = z.infer<typeof DetectionServiceResultSchema>;\n","import { z } from 'zod';\n\n/** Zod schema for a DLP (Data Loss Prevention) report. */\nexport const DlpReportSchema = z.object({\n dlp_report_id: z.string().optional(),\n dlp_profile_name: z.string().optional(),\n dlp_profile_id: z.string().optional(),\n dlp_profile_version: z.number().optional(),\n data_pattern_rule1_verdict: z.string().optional(),\n data_pattern_rule2_verdict: z.string().optional(),\n});\n\n/** DLP report with profile info and data pattern rule verdicts. */\nexport type DlpReport = z.infer<typeof DlpReportSchema>;\n","import { z } from 'zod';\n\n/** Zod schema for a URL filtering report entry. */\nexport const UrlfEntrySchema = z.object({\n url: z.string().optional(),\n risk_level: z.string().optional(),\n categories: z.array(z.string()).optional(),\n});\n\n/** URL filtering report entry with URL, risk level, and categories. */\nexport type UrlfEntry = z.infer<typeof UrlfEntrySchema>;\n","import { z } from 'zod';\n\n/** Zod schema for an AIRS API error response. */\nexport const ErrorResponseSchema = z.object({\n status_code: z.number().optional(),\n message: z.string().optional(),\n error: z\n .object({\n message: z.string().optional(),\n })\n .passthrough()\n .optional(),\n retry_after: z\n .object({\n interval: z.number().optional(),\n unit: z.string().optional(),\n })\n .optional(),\n});\n\n/** AIRS API error response with optional retry-after guidance. */\nexport type ErrorResponse = z.infer<typeof ErrorResponseSchema>;\n","import { z } from 'zod';\n\n/** Zod schema for DLP data profile configuration. */\nexport const DlpDataProfileSchema = z\n .object({\n profile_name: z.string(),\n active: z.boolean().optional(),\n })\n .passthrough();\n\n/** DLP data profile configuration. */\nexport type DlpDataProfile = z.infer<typeof DlpDataProfileSchema>;\n\n/** Zod schema for DLP configuration. */\nexport const DlpSchema = z\n .object({\n dlp_status: z.string().optional(),\n data_profiles: z.array(DlpDataProfileSchema).optional(),\n })\n .passthrough();\n\n/** DLP configuration with status and data profiles. */\nexport type Dlp = z.infer<typeof DlpSchema>;\n\n/** Zod schema for data leak detection settings. */\nexport const DataLeakDetectionSchema = z\n .object({\n 'data-leak-detection-status': z.string().optional(),\n dlp: DlpSchema.optional(),\n })\n .passthrough();\n\n/** Data leak detection settings. */\nexport type DataLeakDetection = z.infer<typeof DataLeakDetectionSchema>;\n\n/** Zod schema for application protection settings. */\nexport const AppProtectionSchema = z\n .object({\n 'prompt-injection': z.string().optional(),\n 'jailbreak-detection': z.string().optional(),\n })\n .passthrough();\n\n/** Application protection settings (prompt injection, jailbreak detection). */\nexport type AppProtection = z.infer<typeof AppProtectionSchema>;\n\n/** Zod schema for model protection settings. */\nexport const ModelProtectionSchema = z\n .object({\n 'model-denial-of-service': z.string().optional(),\n })\n .passthrough();\n\n/** Model protection settings (DoS protection). */\nexport type ModelProtection = z.infer<typeof ModelProtectionSchema>;\n\n/** Zod schema for agent protection settings. */\nexport const AgentProtectionSchema = z\n .object({\n 'malicious-agent-activity': z.string().optional(),\n })\n .passthrough();\n\n/** Agent protection settings (malicious agent activity detection). */\nexport type AgentProtection = z.infer<typeof AgentProtectionSchema>;\n\n/** Zod schema for latency configuration. */\nexport const LatencySchema = z\n .object({\n status: z.string().optional(),\n max_latency_ms: z.number().optional(),\n })\n .passthrough();\n\n/** Latency configuration for inline scanning. */\nexport type Latency = z.infer<typeof LatencySchema>;\n\n/** Zod schema for model configuration. */\nexport const ModelConfigurationSchema = z\n .object({\n latency: LatencySchema.optional(),\n })\n .passthrough();\n\n/** Model configuration including latency settings. */\nexport type ModelConfiguration = z.infer<typeof ModelConfigurationSchema>;\n\n/** Zod schema for the security profile policy. */\nexport const PolicySchema = z\n .object({\n 'data-leak-detection': DataLeakDetectionSchema.optional(),\n 'app-protection': AppProtectionSchema.optional(),\n 'model-protection': ModelProtectionSchema.optional(),\n 'agent-protection': AgentProtectionSchema.optional(),\n 'model-configuration': ModelConfigurationSchema.optional(),\n })\n .passthrough();\n\n/** Security profile policy containing all protection and configuration settings. */\nexport type Policy = z.infer<typeof PolicySchema>;\n\n/** Zod schema for an AIRS security profile. */\nexport const SecurityProfileSchema = z\n .object({\n profile_id: z.string().optional(),\n profile_name: z.string(),\n revision: z.number().optional(),\n active: z.boolean().optional(),\n policy: PolicySchema.optional(),\n created_by: z.string().optional(),\n updated_by: z.string().optional(),\n last_modified_ts: z.string().optional(),\n })\n .passthrough();\n\n/** AIRS security profile with name, policy, and audit metadata. */\nexport type SecurityProfile = z.infer<typeof SecurityProfileSchema>;\n\n/** Zod schema for a security profile create/update request. */\nexport const CreateSecurityProfileRequestSchema = z\n .object({\n profile_id: z.string().optional(),\n profile_name: z.string(),\n revision: z.number().optional(),\n active: z.boolean().optional(),\n policy: PolicySchema.optional(),\n created_by: z.string().optional(),\n updated_by: z.string().optional(),\n last_modified_ts: z.string().optional(),\n })\n .passthrough();\n\n/** Request body for creating or updating a security profile. */\nexport type CreateSecurityProfileRequest = z.infer<typeof CreateSecurityProfileRequestSchema>;\n\n/** Zod schema for a paginated security profile list response. */\nexport const SecurityProfileListResponseSchema = z\n .object({\n ai_profiles: z.array(SecurityProfileSchema),\n next_offset: z.number().optional(),\n })\n .passthrough();\n\n/** Paginated list of security profiles. */\nexport type SecurityProfileListResponse = z.infer<typeof SecurityProfileListResponseSchema>;\n\n/** Zod schema for a profile deletion response. */\nexport const DeleteProfileResponseSchema = z\n .object({\n message: z.string(),\n })\n .passthrough();\n\n/** Response from deleting a security profile. */\nexport type DeleteProfileResponse = z.infer<typeof DeleteProfileResponseSchema>;\n\n/** Zod schema for a profile deletion conflict (409). */\nexport const DeleteProfileConflictSchema = z\n .object({\n message: z.string(),\n payload: z.array(\n z\n .object({\n policy_id: z.string(),\n policy_name: z.string(),\n priority: z.number(),\n })\n .passthrough(),\n ),\n })\n .passthrough();\n\n/** Conflict response when deleting a profile referenced by policies. */\nexport type DeleteProfileConflict = z.infer<typeof DeleteProfileConflictSchema>;\n","import { z } from 'zod';\n\n/** Zod schema for an AIRS custom topic. */\nexport const CustomTopicSchema = z\n .object({\n topic_id: z.string().optional(),\n topic_name: z.string(),\n revision: z.number().optional(),\n active: z.boolean().optional(),\n description: z.string().optional(),\n examples: z.array(z.string()).optional(),\n created_by: z.string().optional(),\n updated_by: z.string().optional(),\n last_modified_ts: z.string().optional(),\n created_ts: z.string().optional(),\n })\n .passthrough();\n\n/** AIRS custom topic with name, description, examples, and audit metadata. */\nexport type CustomTopic = z.infer<typeof CustomTopicSchema>;\n\n/** Zod schema for a custom topic create/update request. */\nexport const CreateCustomTopicRequestSchema = z\n .object({\n topic_id: z.string().optional(),\n topic_name: z.string(),\n revision: z.number().optional(),\n active: z.boolean().optional(),\n description: z.string().optional(),\n examples: z.array(z.string()).optional(),\n created_by: z.string().optional(),\n updated_by: z.string().optional(),\n last_modified_ts: z.string().optional(),\n created_ts: z.string().optional(),\n })\n .passthrough();\n\n/** Request body for creating or updating a custom topic. */\nexport type CreateCustomTopicRequest = z.infer<typeof CreateCustomTopicRequestSchema>;\n\n/** Zod schema for a paginated custom topic list response. */\nexport const CustomTopicListResponseSchema = z\n .object({\n custom_topics: z.array(CustomTopicSchema),\n next_offset: z.number().optional(),\n })\n .passthrough();\n\n/** Paginated list of custom topics. */\nexport type CustomTopicListResponse = z.infer<typeof CustomTopicListResponseSchema>;\n\n/** Zod schema for a topic deletion response. */\nexport const DeleteTopicResponseSchema = z\n .object({\n message: z.string(),\n })\n .passthrough();\n\n/** Response from deleting a custom topic. */\nexport type DeleteTopicResponse = z.infer<typeof DeleteTopicResponseSchema>;\n\n/** Zod schema for a topic deletion conflict (409). */\nexport const DeleteTopicConflictSchema = z\n .object({\n message: z.string(),\n payload: z.array(\n z\n .object({\n profile_id: z.string(),\n profile_name: z.string(),\n revision: z.number(),\n })\n .passthrough(),\n ),\n })\n .passthrough();\n\n/** Conflict response when deleting a topic referenced by profiles. */\nexport type DeleteTopicConflict = z.infer<typeof DeleteTopicConflictSchema>;\n","import { z } from 'zod';\n\n/** Zod schema for an OAuth2 token response. */\nexport const OAuthTokenResponseSchema = z.object({\n access_token: z.string(),\n token_type: z.string().optional(),\n expires_in: z.number(),\n scope: z.string().optional(),\n});\n\n/** OAuth2 token response with access token and expiry. */\nexport type OAuthTokenResponse = z.infer<typeof OAuthTokenResponseSchema>;\n","import { DEFAULT_TOKEN_ENDPOINT } from '../constants.js';\nimport { AISecSDKException, ErrorType } from '../errors.js';\nimport { OAuthTokenResponseSchema } from '../models/oauth-token.js';\n\n/** Options for constructing an {@link OAuthClient}. */\nexport interface OAuthClientOptions {\n /** OAuth2 client ID. */\n clientId: string;\n /** OAuth2 client secret. */\n clientSecret: string;\n /** Tenant Service Group ID. */\n tsgId: string;\n /** OAuth2 token endpoint URL. Defaults to Palo Alto Networks auth endpoint. */\n tokenEndpoint?: string;\n}\n\nconst TOKEN_BUFFER_MS = 30_000; // refresh 30s before expiry\n\n/**\n * OAuth2 client_credentials token manager.\n * Caches tokens, refreshes before expiry, and deduplicates concurrent requests.\n */\nexport class OAuthClient {\n public readonly tokenEndpoint: string;\n private readonly clientId: string;\n private readonly clientSecret: string;\n private readonly tsgId: string;\n\n private accessToken: string | null = null;\n private expiresAt = 0;\n private pendingFetch: Promise<string> | null = null;\n\n constructor(opts: OAuthClientOptions) {\n this.clientId = opts.clientId;\n this.clientSecret = opts.clientSecret;\n this.tsgId = opts.tsgId;\n this.tokenEndpoint = opts.tokenEndpoint ?? DEFAULT_TOKEN_ENDPOINT;\n }\n\n /**\n * Get a valid access token, refreshing if needed.\n * @returns Bearer access token string.\n */\n async getToken(): Promise<string> {\n if (this.accessToken && Date.now() < this.expiresAt - TOKEN_BUFFER_MS) {\n return this.accessToken;\n }\n\n if (this.pendingFetch) {\n return this.pendingFetch;\n }\n\n this.pendingFetch = this.fetchToken().finally(() => {\n this.pendingFetch = null;\n });\n\n return this.pendingFetch;\n }\n\n /** Clear the cached token, forcing a fresh fetch on next call. */\n clearToken(): void {\n this.accessToken = null;\n this.expiresAt = 0;\n }\n\n private async fetchToken(): Promise<string> {\n const credentials = btoa(`${this.clientId}:${this.clientSecret}`);\n const body = new URLSearchParams({\n grant_type: 'client_credentials',\n scope: `tsg_id:${this.tsgId}`,\n });\n\n let response: Response;\n try {\n response = await fetch(this.tokenEndpoint, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n Authorization: `Basic ${credentials}`,\n },\n body: body.toString(),\n });\n } catch (err) {\n throw new AISecSDKException(\n `Token request failed: ${(err as Error).message}`,\n ErrorType.OAUTH_ERROR,\n );\n }\n\n if (!response.ok) {\n let errorMsg: string;\n try {\n const errorBody = (await response.json()) as Record<string, unknown>;\n errorMsg =\n (errorBody.error_description as string) ??\n (errorBody.error as string) ??\n `Token request failed with status ${response.status}`;\n } catch {\n errorMsg = `Token request failed with status ${response.status}`;\n }\n throw new AISecSDKException(errorMsg, ErrorType.OAUTH_ERROR);\n }\n\n const data = OAuthTokenResponseSchema.parse(await response.json());\n this.accessToken = data.access_token;\n this.expiresAt = Date.now() + data.expires_in * 1000;\n return this.accessToken;\n }\n}\n","import { USER_AGENT } from '../constants.js';\nimport { executeWithRetry } from '../http-retry.js';\nimport type { OAuthClient } from './oauth-client.js';\n\n/** @internal Options for a management API HTTP request. */\nexport interface MgmtHttpRequestOptions {\n method: 'GET' | 'POST' | 'PUT' | 'DELETE';\n baseUrl: string;\n path: string;\n body?: unknown;\n params?: Record<string, string>;\n oauthClient: OAuthClient;\n numRetries: number;\n}\n\n/** @internal Typed management API HTTP response. */\nexport interface MgmtHttpResponse<T = unknown> {\n status: number;\n data: T;\n}\n\nexport async function managementHttpRequest<T>(\n opts: MgmtHttpRequestOptions,\n): Promise<MgmtHttpResponse<T>> {\n const { method, baseUrl, path, body, params, oauthClient, numRetries } = opts;\n let hadTokenRefresh = false;\n\n const response = await executeWithRetry({\n maxRetries: numRetries,\n execute: async () => {\n const token = await oauthClient.getToken();\n const stripped = baseUrl.replace(/\\/+$/, '');\n const url = new URL(`${stripped}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n url.searchParams.set(key, value);\n }\n }\n\n const headers: Record<string, string> = {\n Authorization: `Bearer ${token}`,\n 'User-Agent': USER_AGENT,\n };\n\n let bodyStr: string | undefined;\n if (body !== undefined) {\n headers['Content-Type'] = 'application/json';\n bodyStr = JSON.stringify(body);\n }\n\n return fetch(url.toString(), { method, headers, body: bodyStr });\n },\n onRetryableFailure: async (response) => {\n if (response.status === 401 && !hadTokenRefresh) {\n hadTokenRefresh = true;\n oauthClient.clearToken();\n return true;\n }\n return false;\n },\n });\n\n const text = await response.text();\n const data = text ? (JSON.parse(text) as T) : ({} as T);\n return { status: response.status, data };\n}\n","import { MGMT_PROFILE_PATH, MGMT_PROFILES_TSG_PATH } from '../constants.js';\nimport { AISecSDKException, ErrorType } from '../errors.js';\nimport { isValidUuid } from '../utils.js';\nimport { managementHttpRequest } from './management-http-client.js';\nimport type { OAuthClient } from './oauth-client.js';\nimport type {\n SecurityProfile,\n CreateSecurityProfileRequest,\n SecurityProfileListResponse,\n DeleteProfileResponse,\n} from '../models/mgmt-security-profile.js';\n\n/** Pagination parameters for list operations. */\nexport interface PaginationOptions {\n /** Starting offset. Defaults to 0. */\n offset?: number;\n /** Max items to return. Defaults to 100. */\n limit?: number;\n}\n\n/** @internal */\nexport interface ProfilesClientOptions {\n baseUrl: string;\n oauthClient: OAuthClient;\n tsgId: string;\n numRetries: number;\n}\n\n/** Client for AIRS security profile CRUD operations. */\nexport class ProfilesClient {\n private readonly baseUrl: string;\n private readonly oauthClient: OAuthClient;\n private readonly tsgId: string;\n private readonly numRetries: number;\n\n constructor(opts: ProfilesClientOptions) {\n this.baseUrl = opts.baseUrl;\n this.oauthClient = opts.oauthClient;\n this.tsgId = opts.tsgId;\n this.numRetries = opts.numRetries;\n }\n\n /**\n * Create a new security profile.\n * @param request - Profile configuration.\n * @returns The created security profile.\n */\n async create(request: CreateSecurityProfileRequest): Promise<SecurityProfile> {\n const res = await managementHttpRequest<SecurityProfile>({\n method: 'POST',\n baseUrl: this.baseUrl,\n path: MGMT_PROFILE_PATH,\n body: request,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n\n /**\n * List security profiles for the TSG.\n * @param opts - Pagination options.\n * @returns Paginated list of security profiles.\n */\n async list(opts?: PaginationOptions): Promise<SecurityProfileListResponse> {\n const params: Record<string, string> = {\n offset: String(opts?.offset ?? 0),\n limit: String(opts?.limit ?? 100),\n };\n\n const res = await managementHttpRequest<SecurityProfileListResponse>({\n method: 'GET',\n baseUrl: this.baseUrl,\n path: `${MGMT_PROFILES_TSG_PATH}/${this.tsgId}`,\n params,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n\n /**\n * Update an existing security profile.\n * @param profileId - UUID of the profile to update.\n * @param request - Updated profile configuration.\n * @returns The updated security profile.\n */\n async update(profileId: string, request: CreateSecurityProfileRequest): Promise<SecurityProfile> {\n if (!isValidUuid(profileId)) {\n throw new AISecSDKException(\n `Invalid profile_id: ${profileId}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const res = await managementHttpRequest<SecurityProfile>({\n method: 'PUT',\n baseUrl: this.baseUrl,\n path: `${MGMT_PROFILE_PATH}/uuid/${profileId}`,\n body: request,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n\n /**\n * Delete a security profile.\n * @param profileId - UUID of the profile to delete.\n * @returns Deletion confirmation message.\n */\n async delete(profileId: string): Promise<DeleteProfileResponse> {\n if (!isValidUuid(profileId)) {\n throw new AISecSDKException(\n `Invalid profile_id: ${profileId}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const res = await managementHttpRequest<DeleteProfileResponse>({\n method: 'DELETE',\n baseUrl: this.baseUrl,\n path: `${MGMT_PROFILE_PATH}/${profileId}`,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n}\n","import { MGMT_TOPIC_PATH, MGMT_TOPICS_TSG_PATH, MGMT_TOPIC_FORCE_PATH } from '../constants.js';\nimport { AISecSDKException, ErrorType } from '../errors.js';\nimport { isValidUuid } from '../utils.js';\nimport { managementHttpRequest } from './management-http-client.js';\nimport type { OAuthClient } from './oauth-client.js';\nimport type {\n CustomTopic,\n CreateCustomTopicRequest,\n CustomTopicListResponse,\n DeleteTopicResponse,\n} from '../models/mgmt-custom-topic.js';\nimport type { PaginationOptions } from './profiles.js';\n\n/** @internal */\nexport interface TopicsClientOptions {\n baseUrl: string;\n oauthClient: OAuthClient;\n tsgId: string;\n numRetries: number;\n}\n\n/** Client for AIRS custom topic CRUD operations. */\nexport class TopicsClient {\n private readonly baseUrl: string;\n private readonly oauthClient: OAuthClient;\n private readonly tsgId: string;\n private readonly numRetries: number;\n\n constructor(opts: TopicsClientOptions) {\n this.baseUrl = opts.baseUrl;\n this.oauthClient = opts.oauthClient;\n this.tsgId = opts.tsgId;\n this.numRetries = opts.numRetries;\n }\n\n /**\n * Create a new custom topic.\n * @param request - Topic definition with name, description, and examples.\n * @returns The created custom topic.\n */\n async create(request: CreateCustomTopicRequest): Promise<CustomTopic> {\n const res = await managementHttpRequest<CustomTopic>({\n method: 'POST',\n baseUrl: this.baseUrl,\n path: MGMT_TOPIC_PATH,\n body: request,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n\n /**\n * List custom topics for the TSG.\n * @param opts - Pagination options.\n * @returns Paginated list of custom topics.\n */\n async list(opts?: PaginationOptions): Promise<CustomTopicListResponse> {\n const params: Record<string, string> = {\n offset: String(opts?.offset ?? 0),\n limit: String(opts?.limit ?? 100),\n };\n\n const res = await managementHttpRequest<CustomTopicListResponse>({\n method: 'GET',\n baseUrl: this.baseUrl,\n path: `${MGMT_TOPICS_TSG_PATH}/${this.tsgId}`,\n params,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n\n /**\n * Update an existing custom topic.\n * @param topicId - UUID of the topic to update.\n * @param request - Updated topic definition.\n * @returns The updated custom topic.\n */\n async update(topicId: string, request: CreateCustomTopicRequest): Promise<CustomTopic> {\n if (!isValidUuid(topicId)) {\n throw new AISecSDKException(\n `Invalid topic_id: ${topicId}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const res = await managementHttpRequest<CustomTopic>({\n method: 'PUT',\n baseUrl: this.baseUrl,\n path: `${MGMT_TOPIC_PATH}/uuid/${topicId}`,\n body: request,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n\n /**\n * Delete a custom topic. Fails if topic is referenced by a profile.\n * @param topicId - UUID of the topic to delete.\n * @returns Deletion confirmation message.\n */\n async delete(topicId: string): Promise<DeleteTopicResponse> {\n if (!isValidUuid(topicId)) {\n throw new AISecSDKException(\n `Invalid topic_id: ${topicId}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const res = await managementHttpRequest<DeleteTopicResponse>({\n method: 'DELETE',\n baseUrl: this.baseUrl,\n path: `${MGMT_TOPIC_PATH}/${topicId}`,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n\n /**\n * Force-delete a custom topic, removing it from any referencing profiles.\n * @param topicId - UUID of the topic to force-delete.\n * @returns Deletion confirmation message.\n */\n async forceDelete(topicId: string): Promise<DeleteTopicResponse> {\n if (!isValidUuid(topicId)) {\n throw new AISecSDKException(\n `Invalid topic_id: ${topicId}`,\n ErrorType.USER_REQUEST_PAYLOAD_ERROR,\n );\n }\n\n const res = await managementHttpRequest<DeleteTopicResponse>({\n method: 'DELETE',\n baseUrl: this.baseUrl,\n path: `${MGMT_TOPIC_FORCE_PATH}/${topicId}`,\n oauthClient: this.oauthClient,\n numRetries: this.numRetries,\n });\n return res.data;\n }\n}\n","import {\n DEFAULT_MGMT_ENDPOINT,\n MGMT_CLIENT_ID,\n MGMT_CLIENT_SECRET,\n MGMT_TSG_ID,\n MGMT_ENDPOINT,\n MGMT_TOKEN_ENDPOINT,\n MAX_NUMBER_OF_RETRIES,\n} from '../constants.js';\nimport { AISecSDKException, ErrorType } from '../errors.js';\nimport { OAuthClient } from './oauth-client.js';\nimport { ProfilesClient } from './profiles.js';\nimport { TopicsClient } from './topics.js';\n\n/** Options for constructing a {@link ManagementClient}. */\nexport interface ManagementClientOptions {\n /** OAuth2 client ID. Falls back to `PANW_MGMT_CLIENT_ID` env var. */\n clientId?: string;\n /** OAuth2 client secret. Falls back to `PANW_MGMT_CLIENT_SECRET` env var. */\n clientSecret?: string;\n /** Tenant Service Group ID. Falls back to `PANW_MGMT_TSG_ID` env var. */\n tsgId?: string;\n /** Management API endpoint URL. Falls back to `PANW_MGMT_ENDPOINT` env var. */\n apiEndpoint?: string;\n /** OAuth2 token endpoint URL. Falls back to `PANW_MGMT_TOKEN_ENDPOINT` env var. */\n tokenEndpoint?: string;\n /** Max retry attempts (0–5). Defaults to 5. */\n numRetries?: number;\n}\n\n/**\n * Client for AIRS management API operations (profiles and topics CRUD).\n * Authenticates via OAuth2 client_credentials flow.\n */\nexport class ManagementClient {\n public readonly profiles: ProfilesClient;\n public readonly topics: TopicsClient;\n\n constructor(opts: ManagementClientOptions = {}) {\n const clientId = opts.clientId ?? process.env[MGMT_CLIENT_ID];\n const clientSecret = opts.clientSecret ?? process.env[MGMT_CLIENT_SECRET];\n const tsgId = opts.tsgId ?? process.env[MGMT_TSG_ID];\n const apiEndpoint = opts.apiEndpoint ?? process.env[MGMT_ENDPOINT] ?? DEFAULT_MGMT_ENDPOINT;\n const tokenEndpoint = opts.tokenEndpoint ?? process.env[MGMT_TOKEN_ENDPOINT];\n const numRetries = Math.min(\n Math.max(opts.numRetries ?? MAX_NUMBER_OF_RETRIES, 0),\n MAX_NUMBER_OF_RETRIES,\n );\n\n if (!clientId) {\n throw new AISecSDKException(\n 'clientId is required (option or PANW_MGMT_CLIENT_ID env var)',\n ErrorType.MISSING_VARIABLE,\n );\n }\n if (!clientSecret) {\n throw new AISecSDKException(\n 'clientSecret is required (option or PANW_MGMT_CLIENT_SECRET env var)',\n ErrorType.MISSING_VARIABLE,\n );\n }\n if (!tsgId) {\n throw new AISecSDKException(\n 'tsgId is required (option or PANW_MGMT_TSG_ID env var)',\n ErrorType.MISSING_VARIABLE,\n );\n }\n\n const oauthClient = new OAuthClient({\n clientId,\n clientSecret,\n tsgId,\n tokenEndpoint,\n });\n\n this.profiles = new ProfilesClient({\n baseUrl: apiEndpoint,\n oauthClient,\n tsgId,\n numRetries,\n });\n\n this.topics = new TopicsClient({\n baseUrl: apiEndpoint,\n oauthClient,\n tsgId,\n numRetries,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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MACA;AAAA,IACF,CAAC;AAED,SAAK,WAAW,IAAI,eAAe;AAAA,MACjC,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,SAAK,SAAS,IAAI,aAAa;AAAA,MAC7B,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":["ErrorType","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","response"]}
|