@cdot65/prisma-airs-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +157 -0
- package/dist/index.cjs +812 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2455 -0
- package/dist/index.d.ts +2455 -0
- package/dist/index.js +724 -0
- package/dist/index.js.map +1 -0
- package/package.json +66 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,812 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
AISecSDKException: () => AISecSDKException,
|
|
24
|
+
AI_SEC_API_ENDPOINT: () => AI_SEC_API_ENDPOINT,
|
|
25
|
+
AI_SEC_API_KEY: () => AI_SEC_API_KEY,
|
|
26
|
+
AI_SEC_API_TOKEN: () => AI_SEC_API_TOKEN,
|
|
27
|
+
ASYNC_SCAN_PATH: () => ASYNC_SCAN_PATH,
|
|
28
|
+
AgentMetaSchema: () => AgentMetaSchema,
|
|
29
|
+
AiProfileSchema: () => AiProfileSchema,
|
|
30
|
+
AsyncScanObjectSchema: () => AsyncScanObjectSchema,
|
|
31
|
+
AsyncScanResponseSchema: () => AsyncScanResponseSchema,
|
|
32
|
+
BEARER: () => BEARER,
|
|
33
|
+
Content: () => Content,
|
|
34
|
+
DEFAULT_ENDPOINT: () => DEFAULT_ENDPOINT,
|
|
35
|
+
DSDetailResultSchema: () => DSDetailResultSchema,
|
|
36
|
+
DSResultMetadataSchema: () => DSResultMetadataSchema,
|
|
37
|
+
DetectionServiceResultSchema: () => DetectionServiceResultSchema,
|
|
38
|
+
DlpReportSchema: () => DlpReportSchema,
|
|
39
|
+
ErrorResponseSchema: () => ErrorResponseSchema,
|
|
40
|
+
ErrorType: () => ErrorType,
|
|
41
|
+
HEADER_API_KEY: () => HEADER_API_KEY,
|
|
42
|
+
HEADER_AUTH_TOKEN: () => HEADER_AUTH_TOKEN,
|
|
43
|
+
HTTP_FORCE_RETRY_STATUS_CODES: () => HTTP_FORCE_RETRY_STATUS_CODES,
|
|
44
|
+
IODetectedSchema: () => IODetectedSchema,
|
|
45
|
+
MAX_AI_PROFILE_NAME_LENGTH: () => MAX_AI_PROFILE_NAME_LENGTH,
|
|
46
|
+
MAX_API_KEY_LENGTH: () => MAX_API_KEY_LENGTH,
|
|
47
|
+
MAX_CONNECTION_POOL_SIZE: () => MAX_CONNECTION_POOL_SIZE,
|
|
48
|
+
MAX_CONTENT_CONTEXT_LENGTH: () => MAX_CONTENT_CONTEXT_LENGTH,
|
|
49
|
+
MAX_CONTENT_PROMPT_LENGTH: () => MAX_CONTENT_PROMPT_LENGTH,
|
|
50
|
+
MAX_CONTENT_RESPONSE_LENGTH: () => MAX_CONTENT_RESPONSE_LENGTH,
|
|
51
|
+
MAX_NUMBER_OF_BATCH_SCAN_OBJECTS: () => MAX_NUMBER_OF_BATCH_SCAN_OBJECTS,
|
|
52
|
+
MAX_NUMBER_OF_REPORT_IDS: () => MAX_NUMBER_OF_REPORT_IDS,
|
|
53
|
+
MAX_NUMBER_OF_RETRIES: () => MAX_NUMBER_OF_RETRIES,
|
|
54
|
+
MAX_NUMBER_OF_SCAN_IDS: () => MAX_NUMBER_OF_SCAN_IDS,
|
|
55
|
+
MAX_REPORT_ID_STR_LENGTH: () => MAX_REPORT_ID_STR_LENGTH,
|
|
56
|
+
MAX_SCAN_ID_STR_LENGTH: () => MAX_SCAN_ID_STR_LENGTH,
|
|
57
|
+
MAX_SESSION_ID_STR_LENGTH: () => MAX_SESSION_ID_STR_LENGTH,
|
|
58
|
+
MAX_TOKEN_LENGTH: () => MAX_TOKEN_LENGTH,
|
|
59
|
+
MAX_TRANSACTION_ID_STR_LENGTH: () => MAX_TRANSACTION_ID_STR_LENGTH,
|
|
60
|
+
MaskedDataSchema: () => MaskedDataSchema,
|
|
61
|
+
MetadataSchema: () => MetadataSchema,
|
|
62
|
+
PAYLOAD_HASH: () => PAYLOAD_HASH,
|
|
63
|
+
PromptDetectedSchema: () => PromptDetectedSchema,
|
|
64
|
+
PromptDetectionDetailsSchema: () => PromptDetectionDetailsSchema,
|
|
65
|
+
ResponseDetectedSchema: () => ResponseDetectedSchema,
|
|
66
|
+
ResponseDetectionDetailsSchema: () => ResponseDetectionDetailsSchema,
|
|
67
|
+
SCAN_REPORTS_PATH: () => SCAN_REPORTS_PATH,
|
|
68
|
+
SCAN_RESULTS_PATH: () => SCAN_RESULTS_PATH,
|
|
69
|
+
SDK_VERSION: () => SDK_VERSION,
|
|
70
|
+
SYNC_SCAN_PATH: () => SYNC_SCAN_PATH,
|
|
71
|
+
ScanIdResultSchema: () => ScanIdResultSchema,
|
|
72
|
+
ScanRequestContentsInnerSchema: () => ScanRequestContentsInnerSchema,
|
|
73
|
+
ScanRequestSchema: () => ScanRequestSchema,
|
|
74
|
+
ScanResponseSchema: () => ScanResponseSchema,
|
|
75
|
+
ScanSummarySchema: () => ScanSummarySchema,
|
|
76
|
+
Scanner: () => Scanner,
|
|
77
|
+
ThreatScanReportSchema: () => ThreatScanReportSchema,
|
|
78
|
+
ToolDetectedSchema: () => ToolDetectedSchema,
|
|
79
|
+
ToolEventMetadataSchema: () => ToolEventMetadataSchema,
|
|
80
|
+
ToolEventSchema: () => ToolEventSchema,
|
|
81
|
+
USER_AGENT: () => USER_AGENT,
|
|
82
|
+
UrlfEntrySchema: () => UrlfEntrySchema,
|
|
83
|
+
globalConfiguration: () => globalConfiguration,
|
|
84
|
+
init: () => init
|
|
85
|
+
});
|
|
86
|
+
module.exports = __toCommonJS(index_exports);
|
|
87
|
+
|
|
88
|
+
// src/constants.ts
|
|
89
|
+
var HEADER_API_KEY = "x-pan-token";
|
|
90
|
+
var HEADER_AUTH_TOKEN = "Authorization";
|
|
91
|
+
var PAYLOAD_HASH = "x-payload-hash";
|
|
92
|
+
var BEARER = "Bearer ";
|
|
93
|
+
var DEFAULT_ENDPOINT = "https://service.api.aisecurity.paloaltonetworks.com";
|
|
94
|
+
var AI_SEC_API_KEY = "PANW_AI_SEC_API_KEY";
|
|
95
|
+
var AI_SEC_API_TOKEN = "PANW_AI_SEC_API_TOKEN";
|
|
96
|
+
var AI_SEC_API_ENDPOINT = "PANW_AI_SEC_API_ENDPOINT";
|
|
97
|
+
var MAX_CONTENT_PROMPT_LENGTH = 2 * 1024 * 1024;
|
|
98
|
+
var MAX_CONTENT_RESPONSE_LENGTH = 2 * 1024 * 1024;
|
|
99
|
+
var MAX_CONTENT_CONTEXT_LENGTH = 100 * 1024 * 1024;
|
|
100
|
+
var MAX_API_KEY_LENGTH = 2048;
|
|
101
|
+
var MAX_TOKEN_LENGTH = 2048;
|
|
102
|
+
var MAX_TRANSACTION_ID_STR_LENGTH = 100;
|
|
103
|
+
var MAX_SESSION_ID_STR_LENGTH = 100;
|
|
104
|
+
var MAX_SCAN_ID_STR_LENGTH = 36;
|
|
105
|
+
var MAX_REPORT_ID_STR_LENGTH = 40;
|
|
106
|
+
var MAX_AI_PROFILE_NAME_LENGTH = 100;
|
|
107
|
+
var MAX_NUMBER_OF_SCAN_IDS = 5;
|
|
108
|
+
var MAX_NUMBER_OF_REPORT_IDS = 5;
|
|
109
|
+
var MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 5;
|
|
110
|
+
var MAX_CONNECTION_POOL_SIZE = 100;
|
|
111
|
+
var MAX_NUMBER_OF_RETRIES = 5;
|
|
112
|
+
var HTTP_FORCE_RETRY_STATUS_CODES = [500, 502, 503, 504];
|
|
113
|
+
var SDK_VERSION = "0.1.0";
|
|
114
|
+
var USER_AGENT = `PAN-AIRS/${SDK_VERSION}-typescript-sdk`;
|
|
115
|
+
var SYNC_SCAN_PATH = "/v1/scan/sync/request";
|
|
116
|
+
var ASYNC_SCAN_PATH = "/v1/scan/async/request";
|
|
117
|
+
var SCAN_RESULTS_PATH = "/v1/scan/results";
|
|
118
|
+
var SCAN_REPORTS_PATH = "/v1/scan/reports";
|
|
119
|
+
|
|
120
|
+
// src/errors.ts
|
|
121
|
+
var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
|
|
122
|
+
ErrorType2["SERVER_SIDE_ERROR"] = "AISEC_SERVER_SIDE_ERROR";
|
|
123
|
+
ErrorType2["CLIENT_SIDE_ERROR"] = "AISEC_CLIENT_SIDE_ERROR";
|
|
124
|
+
ErrorType2["USER_REQUEST_PAYLOAD_ERROR"] = "AISEC_USER_REQUEST_PAYLOAD_ERROR";
|
|
125
|
+
ErrorType2["MISSING_VARIABLE"] = "AISEC_MISSING_VARIABLE";
|
|
126
|
+
ErrorType2["AISEC_SDK_ERROR"] = "AISEC_SDK_ERROR";
|
|
127
|
+
return ErrorType2;
|
|
128
|
+
})(ErrorType || {});
|
|
129
|
+
var AISecSDKException = class _AISecSDKException extends Error {
|
|
130
|
+
errorType;
|
|
131
|
+
constructor(message, errorType) {
|
|
132
|
+
super(errorType ? `${errorType}:${message}` : message);
|
|
133
|
+
this.name = "AISecSDKException";
|
|
134
|
+
this.errorType = errorType;
|
|
135
|
+
if (Error.captureStackTrace) {
|
|
136
|
+
Error.captureStackTrace(this, _AISecSDKException);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
// src/configuration.ts
|
|
142
|
+
var Configuration = class {
|
|
143
|
+
_apiKey;
|
|
144
|
+
_apiToken;
|
|
145
|
+
_apiEndpoint = DEFAULT_ENDPOINT;
|
|
146
|
+
_numRetries = MAX_NUMBER_OF_RETRIES;
|
|
147
|
+
_initialized = false;
|
|
148
|
+
get apiKey() {
|
|
149
|
+
return this._apiKey;
|
|
150
|
+
}
|
|
151
|
+
get apiToken() {
|
|
152
|
+
return this._apiToken;
|
|
153
|
+
}
|
|
154
|
+
get apiEndpoint() {
|
|
155
|
+
return this._apiEndpoint;
|
|
156
|
+
}
|
|
157
|
+
get numRetries() {
|
|
158
|
+
return this._numRetries;
|
|
159
|
+
}
|
|
160
|
+
get initialized() {
|
|
161
|
+
return this._initialized;
|
|
162
|
+
}
|
|
163
|
+
init(opts = {}) {
|
|
164
|
+
const apiKey = (opts.apiKey ?? process.env[AI_SEC_API_KEY] ?? "").trim() || void 0;
|
|
165
|
+
const apiToken = (opts.apiToken ?? process.env[AI_SEC_API_TOKEN] ?? "").trim() || void 0;
|
|
166
|
+
if (!apiKey && !apiToken) {
|
|
167
|
+
throw new AISecSDKException(
|
|
168
|
+
"Either apiKey or apiToken must be provided (or set via environment variables)",
|
|
169
|
+
"AISEC_MISSING_VARIABLE" /* MISSING_VARIABLE */
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
if (apiKey && apiKey.length > MAX_API_KEY_LENGTH) {
|
|
173
|
+
throw new AISecSDKException(
|
|
174
|
+
`apiKey exceeds max length of ${MAX_API_KEY_LENGTH}`,
|
|
175
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
if (apiToken && apiToken.length > MAX_TOKEN_LENGTH) {
|
|
179
|
+
throw new AISecSDKException(
|
|
180
|
+
`apiToken exceeds max length of ${MAX_TOKEN_LENGTH}`,
|
|
181
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
this._apiKey = apiKey;
|
|
185
|
+
this._apiToken = apiToken;
|
|
186
|
+
const endpoint = opts.apiEndpoint ?? process.env[AI_SEC_API_ENDPOINT] ?? DEFAULT_ENDPOINT;
|
|
187
|
+
this._apiEndpoint = endpoint.replace(/\/+$/, "");
|
|
188
|
+
if (opts.numRetries !== void 0) {
|
|
189
|
+
if (opts.numRetries < 0 || opts.numRetries > MAX_NUMBER_OF_RETRIES) {
|
|
190
|
+
throw new AISecSDKException(
|
|
191
|
+
`numRetries must be between 0 and ${MAX_NUMBER_OF_RETRIES}`,
|
|
192
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
this._numRetries = opts.numRetries;
|
|
196
|
+
}
|
|
197
|
+
this._initialized = true;
|
|
198
|
+
}
|
|
199
|
+
reset() {
|
|
200
|
+
this._apiKey = void 0;
|
|
201
|
+
this._apiToken = void 0;
|
|
202
|
+
this._apiEndpoint = DEFAULT_ENDPOINT;
|
|
203
|
+
this._numRetries = MAX_NUMBER_OF_RETRIES;
|
|
204
|
+
this._initialized = false;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
var globalConfiguration = new Configuration();
|
|
208
|
+
function init(opts = {}) {
|
|
209
|
+
globalConfiguration.init(opts);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// src/utils.ts
|
|
213
|
+
var import_node_crypto = require("crypto");
|
|
214
|
+
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
215
|
+
function isValidUuid(value) {
|
|
216
|
+
return UUID_RE.test(value);
|
|
217
|
+
}
|
|
218
|
+
function generatePayloadHash(payload, secret) {
|
|
219
|
+
return (0, import_node_crypto.createHmac)("sha256", secret).update(payload).digest("hex");
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// src/http-client.ts
|
|
223
|
+
function buildHeaders() {
|
|
224
|
+
const headers = {
|
|
225
|
+
"Content-Type": "application/json",
|
|
226
|
+
"User-Agent": USER_AGENT
|
|
227
|
+
};
|
|
228
|
+
const cfg = globalConfiguration;
|
|
229
|
+
if (cfg.apiToken) {
|
|
230
|
+
headers[HEADER_AUTH_TOKEN] = `${BEARER}${cfg.apiToken}`;
|
|
231
|
+
}
|
|
232
|
+
if (cfg.apiKey) {
|
|
233
|
+
headers[HEADER_API_KEY] = cfg.apiKey;
|
|
234
|
+
}
|
|
235
|
+
return headers;
|
|
236
|
+
}
|
|
237
|
+
function sleep(ms) {
|
|
238
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
239
|
+
}
|
|
240
|
+
async function httpRequest(opts) {
|
|
241
|
+
if (!globalConfiguration.initialized) {
|
|
242
|
+
throw new AISecSDKException(
|
|
243
|
+
"SDK not initialized. Call init() before making requests.",
|
|
244
|
+
"AISEC_MISSING_VARIABLE" /* MISSING_VARIABLE */
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
const baseUrl = globalConfiguration.apiEndpoint;
|
|
248
|
+
const url = new URL(opts.path, baseUrl);
|
|
249
|
+
if (opts.params) {
|
|
250
|
+
for (const [key, value] of Object.entries(opts.params)) {
|
|
251
|
+
url.searchParams.set(key, value);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
const headers = buildHeaders();
|
|
255
|
+
let bodyStr;
|
|
256
|
+
if (opts.body !== void 0) {
|
|
257
|
+
bodyStr = JSON.stringify(opts.body);
|
|
258
|
+
if (globalConfiguration.apiKey) {
|
|
259
|
+
headers[PAYLOAD_HASH] = generatePayloadHash(bodyStr, globalConfiguration.apiKey);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
const maxRetries = globalConfiguration.numRetries;
|
|
263
|
+
let lastError;
|
|
264
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
265
|
+
try {
|
|
266
|
+
const response = await fetch(url.toString(), {
|
|
267
|
+
method: opts.method,
|
|
268
|
+
headers,
|
|
269
|
+
body: bodyStr
|
|
270
|
+
});
|
|
271
|
+
if (response.ok) {
|
|
272
|
+
const data = await response.json();
|
|
273
|
+
return { status: response.status, data };
|
|
274
|
+
}
|
|
275
|
+
if (HTTP_FORCE_RETRY_STATUS_CODES.includes(response.status) && attempt < maxRetries) {
|
|
276
|
+
await sleep(Math.pow(2, attempt) * 1e3);
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
let errorMessage;
|
|
280
|
+
try {
|
|
281
|
+
const errorBody = await response.json();
|
|
282
|
+
errorMessage = errorBody.message ?? errorBody.error?.message ?? `API error ${response.status}`;
|
|
283
|
+
} catch {
|
|
284
|
+
errorMessage = `API error ${response.status}`;
|
|
285
|
+
}
|
|
286
|
+
const errorType = response.status >= 500 ? "AISEC_SERVER_SIDE_ERROR" /* SERVER_SIDE_ERROR */ : "AISEC_CLIENT_SIDE_ERROR" /* CLIENT_SIDE_ERROR */;
|
|
287
|
+
throw new AISecSDKException(errorMessage, errorType);
|
|
288
|
+
} catch (err) {
|
|
289
|
+
if (err instanceof AISecSDKException) {
|
|
290
|
+
throw err;
|
|
291
|
+
}
|
|
292
|
+
lastError = err;
|
|
293
|
+
if (attempt < maxRetries) {
|
|
294
|
+
await sleep(Math.pow(2, attempt) * 1e3);
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
throw new AISecSDKException(lastError?.message ?? "Network error", "AISEC_CLIENT_SIDE_ERROR" /* CLIENT_SIDE_ERROR */);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// src/scan/scanner.ts
|
|
303
|
+
var Scanner = class {
|
|
304
|
+
async syncScan(aiProfile, content, opts = {}) {
|
|
305
|
+
if (opts.trId && opts.trId.length > MAX_TRANSACTION_ID_STR_LENGTH) {
|
|
306
|
+
throw new AISecSDKException(
|
|
307
|
+
`trId exceeds max length of ${MAX_TRANSACTION_ID_STR_LENGTH}`,
|
|
308
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
if (opts.sessionId && opts.sessionId.length > MAX_SESSION_ID_STR_LENGTH) {
|
|
312
|
+
throw new AISecSDKException(
|
|
313
|
+
`sessionId exceeds max length of ${MAX_SESSION_ID_STR_LENGTH}`,
|
|
314
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
const body = {
|
|
318
|
+
ai_profile: aiProfile,
|
|
319
|
+
contents: [content.toJSON()]
|
|
320
|
+
};
|
|
321
|
+
if (opts.trId) body.tr_id = opts.trId;
|
|
322
|
+
if (opts.sessionId) body.session_id = opts.sessionId;
|
|
323
|
+
if (opts.metadata) body.metadata = opts.metadata;
|
|
324
|
+
const res = await httpRequest({
|
|
325
|
+
method: "POST",
|
|
326
|
+
path: SYNC_SCAN_PATH,
|
|
327
|
+
body
|
|
328
|
+
});
|
|
329
|
+
return res.data;
|
|
330
|
+
}
|
|
331
|
+
async asyncScan(scanObjects) {
|
|
332
|
+
if (scanObjects.length < 1) {
|
|
333
|
+
throw new AISecSDKException(
|
|
334
|
+
"At least 1 scan object is required",
|
|
335
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
if (scanObjects.length > MAX_NUMBER_OF_BATCH_SCAN_OBJECTS) {
|
|
339
|
+
throw new AISecSDKException(
|
|
340
|
+
`Max of ${MAX_NUMBER_OF_BATCH_SCAN_OBJECTS} scan objects allowed`,
|
|
341
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
const res = await httpRequest({
|
|
345
|
+
method: "POST",
|
|
346
|
+
path: ASYNC_SCAN_PATH,
|
|
347
|
+
body: scanObjects
|
|
348
|
+
});
|
|
349
|
+
return res.data;
|
|
350
|
+
}
|
|
351
|
+
async queryByScanIds(scanIds) {
|
|
352
|
+
if (scanIds.length < 1) {
|
|
353
|
+
throw new AISecSDKException(
|
|
354
|
+
"At least 1 scan_id is required",
|
|
355
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
if (scanIds.length > MAX_NUMBER_OF_SCAN_IDS) {
|
|
359
|
+
throw new AISecSDKException(
|
|
360
|
+
`Max of ${MAX_NUMBER_OF_SCAN_IDS} scan_ids allowed`,
|
|
361
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
for (const id of scanIds) {
|
|
365
|
+
if (!isValidUuid(id)) {
|
|
366
|
+
throw new AISecSDKException(`Invalid scan_id: ${id}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
const res = await httpRequest({
|
|
370
|
+
method: "GET",
|
|
371
|
+
path: SCAN_RESULTS_PATH,
|
|
372
|
+
params: { scan_ids: scanIds.join(",") }
|
|
373
|
+
});
|
|
374
|
+
return res.data;
|
|
375
|
+
}
|
|
376
|
+
async queryByReportIds(reportIds) {
|
|
377
|
+
if (reportIds.length < 1) {
|
|
378
|
+
throw new AISecSDKException(
|
|
379
|
+
"At least 1 report_id is required",
|
|
380
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
if (reportIds.length > MAX_NUMBER_OF_REPORT_IDS) {
|
|
384
|
+
throw new AISecSDKException(
|
|
385
|
+
`Max of ${MAX_NUMBER_OF_REPORT_IDS} report_ids allowed`,
|
|
386
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
const res = await httpRequest({
|
|
390
|
+
method: "GET",
|
|
391
|
+
path: SCAN_REPORTS_PATH,
|
|
392
|
+
params: { report_ids: reportIds.join(",") }
|
|
393
|
+
});
|
|
394
|
+
return res.data;
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
// src/scan/content.ts
|
|
399
|
+
var import_node_fs = require("fs");
|
|
400
|
+
var Content = class _Content {
|
|
401
|
+
_prompt;
|
|
402
|
+
_response;
|
|
403
|
+
_context;
|
|
404
|
+
_codePrompt;
|
|
405
|
+
_codeResponse;
|
|
406
|
+
_toolEvent;
|
|
407
|
+
constructor(opts) {
|
|
408
|
+
if (!opts.prompt && !opts.response && !opts.codePrompt && !opts.codeResponse && !opts.toolEvent) {
|
|
409
|
+
throw new AISecSDKException(
|
|
410
|
+
"At least one of prompt, response, codePrompt, codeResponse, or toolEvent must be provided",
|
|
411
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
if (opts.prompt !== void 0) this.prompt = opts.prompt;
|
|
415
|
+
if (opts.response !== void 0) this.response = opts.response;
|
|
416
|
+
if (opts.context !== void 0) this.context = opts.context;
|
|
417
|
+
if (opts.codePrompt !== void 0) this.codePrompt = opts.codePrompt;
|
|
418
|
+
if (opts.codeResponse !== void 0) this.codeResponse = opts.codeResponse;
|
|
419
|
+
if (opts.toolEvent !== void 0) this._toolEvent = opts.toolEvent;
|
|
420
|
+
}
|
|
421
|
+
get prompt() {
|
|
422
|
+
return this._prompt;
|
|
423
|
+
}
|
|
424
|
+
set prompt(value) {
|
|
425
|
+
if (value !== void 0 && Buffer.byteLength(value) > MAX_CONTENT_PROMPT_LENGTH) {
|
|
426
|
+
throw new AISecSDKException(
|
|
427
|
+
`prompt exceeds max length of ${MAX_CONTENT_PROMPT_LENGTH} bytes`,
|
|
428
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
this._prompt = value;
|
|
432
|
+
}
|
|
433
|
+
get response() {
|
|
434
|
+
return this._response;
|
|
435
|
+
}
|
|
436
|
+
set response(value) {
|
|
437
|
+
if (value !== void 0 && Buffer.byteLength(value) > MAX_CONTENT_RESPONSE_LENGTH) {
|
|
438
|
+
throw new AISecSDKException(
|
|
439
|
+
`response exceeds max length of ${MAX_CONTENT_RESPONSE_LENGTH} bytes`,
|
|
440
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
this._response = value;
|
|
444
|
+
}
|
|
445
|
+
get context() {
|
|
446
|
+
return this._context;
|
|
447
|
+
}
|
|
448
|
+
set context(value) {
|
|
449
|
+
if (value !== void 0 && Buffer.byteLength(value) > MAX_CONTENT_CONTEXT_LENGTH) {
|
|
450
|
+
throw new AISecSDKException(
|
|
451
|
+
`context exceeds max length of ${MAX_CONTENT_CONTEXT_LENGTH} bytes`,
|
|
452
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
this._context = value;
|
|
456
|
+
}
|
|
457
|
+
get codePrompt() {
|
|
458
|
+
return this._codePrompt;
|
|
459
|
+
}
|
|
460
|
+
set codePrompt(value) {
|
|
461
|
+
if (value !== void 0 && Buffer.byteLength(value) > MAX_CONTENT_PROMPT_LENGTH) {
|
|
462
|
+
throw new AISecSDKException(
|
|
463
|
+
`codePrompt exceeds max length of ${MAX_CONTENT_PROMPT_LENGTH} bytes`,
|
|
464
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
this._codePrompt = value;
|
|
468
|
+
}
|
|
469
|
+
get codeResponse() {
|
|
470
|
+
return this._codeResponse;
|
|
471
|
+
}
|
|
472
|
+
set codeResponse(value) {
|
|
473
|
+
if (value !== void 0 && Buffer.byteLength(value) > MAX_CONTENT_RESPONSE_LENGTH) {
|
|
474
|
+
throw new AISecSDKException(
|
|
475
|
+
`codeResponse exceeds max length of ${MAX_CONTENT_RESPONSE_LENGTH} bytes`,
|
|
476
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
this._codeResponse = value;
|
|
480
|
+
}
|
|
481
|
+
get toolEvent() {
|
|
482
|
+
return this._toolEvent;
|
|
483
|
+
}
|
|
484
|
+
set toolEvent(value) {
|
|
485
|
+
this._toolEvent = value;
|
|
486
|
+
}
|
|
487
|
+
get length() {
|
|
488
|
+
let total = 0;
|
|
489
|
+
if (this._prompt) total += Buffer.byteLength(this._prompt);
|
|
490
|
+
if (this._response) total += Buffer.byteLength(this._response);
|
|
491
|
+
if (this._context) total += Buffer.byteLength(this._context);
|
|
492
|
+
if (this._codePrompt) total += Buffer.byteLength(this._codePrompt);
|
|
493
|
+
if (this._codeResponse) total += Buffer.byteLength(this._codeResponse);
|
|
494
|
+
return total;
|
|
495
|
+
}
|
|
496
|
+
toJSON() {
|
|
497
|
+
const obj = {};
|
|
498
|
+
if (this._prompt !== void 0) obj.prompt = this._prompt;
|
|
499
|
+
if (this._response !== void 0) obj.response = this._response;
|
|
500
|
+
if (this._context !== void 0) obj.context = this._context;
|
|
501
|
+
if (this._codePrompt !== void 0) obj.code_prompt = this._codePrompt;
|
|
502
|
+
if (this._codeResponse !== void 0) obj.code_response = this._codeResponse;
|
|
503
|
+
if (this._toolEvent !== void 0) obj.tool_event = this._toolEvent;
|
|
504
|
+
return obj;
|
|
505
|
+
}
|
|
506
|
+
static fromJSON(json) {
|
|
507
|
+
return new _Content({
|
|
508
|
+
prompt: json.prompt,
|
|
509
|
+
response: json.response,
|
|
510
|
+
context: json.context,
|
|
511
|
+
codePrompt: json.code_prompt,
|
|
512
|
+
codeResponse: json.code_response,
|
|
513
|
+
toolEvent: json.tool_event
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
static fromJSONFile(filePath) {
|
|
517
|
+
const raw = (0, import_node_fs.readFileSync)(filePath, "utf-8");
|
|
518
|
+
const parsed = JSON.parse(raw);
|
|
519
|
+
return _Content.fromJSON(parsed);
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
// src/models/ai-profile.ts
|
|
524
|
+
var import_zod = require("zod");
|
|
525
|
+
var AiProfileSchema = import_zod.z.object({
|
|
526
|
+
profile_id: import_zod.z.string().uuid().optional(),
|
|
527
|
+
profile_name: import_zod.z.string().max(MAX_AI_PROFILE_NAME_LENGTH).optional()
|
|
528
|
+
}).refine((d) => d.profile_id || d.profile_name, {
|
|
529
|
+
message: "Either profile_id or profile_name must be provided"
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
// src/models/metadata.ts
|
|
533
|
+
var import_zod2 = require("zod");
|
|
534
|
+
var AgentMetaSchema = import_zod2.z.object({
|
|
535
|
+
agent_id: import_zod2.z.string().optional(),
|
|
536
|
+
agent_version: import_zod2.z.string().optional(),
|
|
537
|
+
agent_arn: import_zod2.z.string().optional()
|
|
538
|
+
});
|
|
539
|
+
var MetadataSchema = import_zod2.z.object({
|
|
540
|
+
app_name: import_zod2.z.string().optional(),
|
|
541
|
+
app_user: import_zod2.z.string().optional(),
|
|
542
|
+
ai_model: import_zod2.z.string().optional(),
|
|
543
|
+
user_ip: import_zod2.z.string().optional(),
|
|
544
|
+
agent_meta: AgentMetaSchema.optional()
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
// src/models/tool-event.ts
|
|
548
|
+
var import_zod3 = require("zod");
|
|
549
|
+
var ToolEventMetadataSchema = import_zod3.z.object({
|
|
550
|
+
ecosystem: import_zod3.z.string(),
|
|
551
|
+
method: import_zod3.z.string(),
|
|
552
|
+
server_name: import_zod3.z.string(),
|
|
553
|
+
tool_invoked: import_zod3.z.string().optional()
|
|
554
|
+
});
|
|
555
|
+
var ToolEventSchema = import_zod3.z.object({
|
|
556
|
+
metadata: ToolEventMetadataSchema.optional(),
|
|
557
|
+
input: import_zod3.z.string().optional(),
|
|
558
|
+
output: import_zod3.z.string().optional()
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
// src/models/scan-request.ts
|
|
562
|
+
var import_zod4 = require("zod");
|
|
563
|
+
var ScanRequestContentsInnerSchema = import_zod4.z.object({
|
|
564
|
+
prompt: import_zod4.z.string().optional(),
|
|
565
|
+
response: import_zod4.z.string().optional(),
|
|
566
|
+
code_prompt: import_zod4.z.string().optional(),
|
|
567
|
+
code_response: import_zod4.z.string().optional(),
|
|
568
|
+
context: import_zod4.z.string().optional(),
|
|
569
|
+
tool_event: ToolEventSchema.optional()
|
|
570
|
+
});
|
|
571
|
+
var ScanRequestSchema = import_zod4.z.object({
|
|
572
|
+
tr_id: import_zod4.z.string().max(MAX_TRANSACTION_ID_STR_LENGTH).optional(),
|
|
573
|
+
session_id: import_zod4.z.string().max(MAX_SESSION_ID_STR_LENGTH).optional(),
|
|
574
|
+
ai_profile: AiProfileSchema,
|
|
575
|
+
metadata: MetadataSchema.optional(),
|
|
576
|
+
contents: import_zod4.z.array(ScanRequestContentsInnerSchema).min(1)
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
// src/models/scan-response.ts
|
|
580
|
+
var import_zod7 = require("zod");
|
|
581
|
+
|
|
582
|
+
// src/models/prompt-detected.ts
|
|
583
|
+
var import_zod5 = require("zod");
|
|
584
|
+
var PromptDetectionDetailsSchema = import_zod5.z.object({
|
|
585
|
+
topic_guardrails_details: import_zod5.z.record(import_zod5.z.unknown()).optional()
|
|
586
|
+
});
|
|
587
|
+
var PromptDetectedSchema = import_zod5.z.object({
|
|
588
|
+
url_cats: import_zod5.z.boolean().optional(),
|
|
589
|
+
dlp: import_zod5.z.boolean().optional(),
|
|
590
|
+
injection: import_zod5.z.boolean().optional(),
|
|
591
|
+
toxic_content: import_zod5.z.boolean().optional(),
|
|
592
|
+
malicious_code: import_zod5.z.boolean().optional(),
|
|
593
|
+
agent: import_zod5.z.boolean().optional(),
|
|
594
|
+
topic_violation: import_zod5.z.boolean().optional()
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
// src/models/response-detected.ts
|
|
598
|
+
var import_zod6 = require("zod");
|
|
599
|
+
var ResponseDetectionDetailsSchema = import_zod6.z.object({
|
|
600
|
+
topic_guardrails_details: import_zod6.z.record(import_zod6.z.unknown()).optional()
|
|
601
|
+
});
|
|
602
|
+
var ResponseDetectedSchema = import_zod6.z.object({
|
|
603
|
+
url_cats: import_zod6.z.boolean().optional(),
|
|
604
|
+
dlp: import_zod6.z.boolean().optional(),
|
|
605
|
+
db_security: import_zod6.z.boolean().optional(),
|
|
606
|
+
toxic_content: import_zod6.z.boolean().optional(),
|
|
607
|
+
malicious_code: import_zod6.z.boolean().optional(),
|
|
608
|
+
agent: import_zod6.z.boolean().optional(),
|
|
609
|
+
ungrounded: import_zod6.z.boolean().optional(),
|
|
610
|
+
topic_violation: import_zod6.z.boolean().optional()
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
// src/models/scan-response.ts
|
|
614
|
+
var MaskedDataSchema = import_zod7.z.object({
|
|
615
|
+
data: import_zod7.z.string().optional(),
|
|
616
|
+
pattern_detections: import_zod7.z.array(import_zod7.z.record(import_zod7.z.unknown())).optional()
|
|
617
|
+
});
|
|
618
|
+
var IODetectedSchema = import_zod7.z.object({
|
|
619
|
+
url_cats: import_zod7.z.boolean().optional(),
|
|
620
|
+
dlp: import_zod7.z.boolean().optional(),
|
|
621
|
+
injection: import_zod7.z.boolean().optional(),
|
|
622
|
+
toxic_content: import_zod7.z.boolean().optional(),
|
|
623
|
+
malicious_code: import_zod7.z.boolean().optional()
|
|
624
|
+
}).passthrough();
|
|
625
|
+
var ScanSummarySchema = import_zod7.z.object({
|
|
626
|
+
verdict: import_zod7.z.string().optional(),
|
|
627
|
+
action: import_zod7.z.string().optional()
|
|
628
|
+
}).passthrough();
|
|
629
|
+
var ToolDetectedSchema = import_zod7.z.object({
|
|
630
|
+
verdict: import_zod7.z.string().optional(),
|
|
631
|
+
metadata: ToolEventMetadataSchema.optional(),
|
|
632
|
+
summary: ScanSummarySchema.optional(),
|
|
633
|
+
input_detected: IODetectedSchema.optional(),
|
|
634
|
+
output_detected: IODetectedSchema.optional()
|
|
635
|
+
});
|
|
636
|
+
var ScanResponseSchema = import_zod7.z.object({
|
|
637
|
+
source: import_zod7.z.string().optional(),
|
|
638
|
+
report_id: import_zod7.z.string(),
|
|
639
|
+
scan_id: import_zod7.z.string(),
|
|
640
|
+
tr_id: import_zod7.z.string().optional(),
|
|
641
|
+
session_id: import_zod7.z.string().optional(),
|
|
642
|
+
profile_id: import_zod7.z.string().optional(),
|
|
643
|
+
profile_name: import_zod7.z.string().optional(),
|
|
644
|
+
category: import_zod7.z.string(),
|
|
645
|
+
action: import_zod7.z.string(),
|
|
646
|
+
prompt_detected: PromptDetectedSchema.optional(),
|
|
647
|
+
response_detected: ResponseDetectedSchema.optional(),
|
|
648
|
+
prompt_masked_data: MaskedDataSchema.optional(),
|
|
649
|
+
response_masked_data: MaskedDataSchema.optional(),
|
|
650
|
+
prompt_detection_details: PromptDetectionDetailsSchema.optional(),
|
|
651
|
+
response_detection_details: ResponseDetectionDetailsSchema.optional(),
|
|
652
|
+
tool_detected: ToolDetectedSchema.optional(),
|
|
653
|
+
created_at: import_zod7.z.string().optional(),
|
|
654
|
+
completed_at: import_zod7.z.string().optional()
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
// src/models/async-scan.ts
|
|
658
|
+
var import_zod8 = require("zod");
|
|
659
|
+
var AsyncScanObjectSchema = import_zod8.z.object({
|
|
660
|
+
req_id: import_zod8.z.number().int(),
|
|
661
|
+
scan_req: ScanRequestSchema
|
|
662
|
+
});
|
|
663
|
+
var AsyncScanResponseSchema = import_zod8.z.object({
|
|
664
|
+
received: import_zod8.z.string(),
|
|
665
|
+
scan_id: import_zod8.z.string(),
|
|
666
|
+
report_id: import_zod8.z.string().optional(),
|
|
667
|
+
source: import_zod8.z.string().optional()
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
// src/models/scan-id-result.ts
|
|
671
|
+
var import_zod9 = require("zod");
|
|
672
|
+
var ScanIdResultSchema = import_zod9.z.object({
|
|
673
|
+
source: import_zod9.z.string().optional(),
|
|
674
|
+
req_id: import_zod9.z.number().optional(),
|
|
675
|
+
status: import_zod9.z.string().optional(),
|
|
676
|
+
scan_id: import_zod9.z.string().optional(),
|
|
677
|
+
result: ScanResponseSchema.optional()
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
// src/models/threat-report.ts
|
|
681
|
+
var import_zod13 = require("zod");
|
|
682
|
+
|
|
683
|
+
// src/models/detection.ts
|
|
684
|
+
var import_zod12 = require("zod");
|
|
685
|
+
|
|
686
|
+
// src/models/dlp-report.ts
|
|
687
|
+
var import_zod10 = require("zod");
|
|
688
|
+
var DlpReportSchema = import_zod10.z.object({
|
|
689
|
+
dlp_report_id: import_zod10.z.string().optional(),
|
|
690
|
+
dlp_profile_name: import_zod10.z.string().optional(),
|
|
691
|
+
dlp_profile_id: import_zod10.z.string().optional(),
|
|
692
|
+
dlp_profile_version: import_zod10.z.number().optional(),
|
|
693
|
+
data_pattern_rule1_verdict: import_zod10.z.string().optional(),
|
|
694
|
+
data_pattern_rule2_verdict: import_zod10.z.string().optional()
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
// src/models/urlf-report.ts
|
|
698
|
+
var import_zod11 = require("zod");
|
|
699
|
+
var UrlfEntrySchema = import_zod11.z.object({
|
|
700
|
+
url: import_zod11.z.string().optional(),
|
|
701
|
+
risk_level: import_zod11.z.string().optional(),
|
|
702
|
+
categories: import_zod11.z.array(import_zod11.z.string()).optional()
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
// src/models/detection.ts
|
|
706
|
+
var DSDetailResultSchema = import_zod12.z.object({
|
|
707
|
+
urlf_report: import_zod12.z.array(UrlfEntrySchema).optional(),
|
|
708
|
+
dlp_report: DlpReportSchema.optional()
|
|
709
|
+
});
|
|
710
|
+
var DSResultMetadataSchema = import_zod12.z.object({
|
|
711
|
+
score: import_zod12.z.number().optional(),
|
|
712
|
+
confidence: import_zod12.z.string().optional()
|
|
713
|
+
}).passthrough();
|
|
714
|
+
var DetectionServiceResultSchema = import_zod12.z.object({
|
|
715
|
+
data_type: import_zod12.z.string().optional(),
|
|
716
|
+
detection_service: import_zod12.z.string().optional(),
|
|
717
|
+
verdict: import_zod12.z.string().optional(),
|
|
718
|
+
action: import_zod12.z.string().optional(),
|
|
719
|
+
metadata: DSResultMetadataSchema.optional(),
|
|
720
|
+
result_detail: DSDetailResultSchema.optional()
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
// src/models/threat-report.ts
|
|
724
|
+
var ThreatScanReportSchema = import_zod13.z.object({
|
|
725
|
+
source: import_zod13.z.string().optional(),
|
|
726
|
+
report_id: import_zod13.z.string().optional(),
|
|
727
|
+
scan_id: import_zod13.z.string().optional(),
|
|
728
|
+
req_id: import_zod13.z.number().optional(),
|
|
729
|
+
transaction_id: import_zod13.z.string().optional(),
|
|
730
|
+
session_id: import_zod13.z.string().optional(),
|
|
731
|
+
detection_results: import_zod13.z.array(DetectionServiceResultSchema).optional()
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
// src/models/error-response.ts
|
|
735
|
+
var import_zod14 = require("zod");
|
|
736
|
+
var ErrorResponseSchema = import_zod14.z.object({
|
|
737
|
+
status_code: import_zod14.z.number().optional(),
|
|
738
|
+
message: import_zod14.z.string().optional(),
|
|
739
|
+
error: import_zod14.z.object({
|
|
740
|
+
message: import_zod14.z.string().optional()
|
|
741
|
+
}).passthrough().optional(),
|
|
742
|
+
retry_after: import_zod14.z.object({
|
|
743
|
+
interval: import_zod14.z.number().optional(),
|
|
744
|
+
unit: import_zod14.z.string().optional()
|
|
745
|
+
}).optional()
|
|
746
|
+
});
|
|
747
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
748
|
+
0 && (module.exports = {
|
|
749
|
+
AISecSDKException,
|
|
750
|
+
AI_SEC_API_ENDPOINT,
|
|
751
|
+
AI_SEC_API_KEY,
|
|
752
|
+
AI_SEC_API_TOKEN,
|
|
753
|
+
ASYNC_SCAN_PATH,
|
|
754
|
+
AgentMetaSchema,
|
|
755
|
+
AiProfileSchema,
|
|
756
|
+
AsyncScanObjectSchema,
|
|
757
|
+
AsyncScanResponseSchema,
|
|
758
|
+
BEARER,
|
|
759
|
+
Content,
|
|
760
|
+
DEFAULT_ENDPOINT,
|
|
761
|
+
DSDetailResultSchema,
|
|
762
|
+
DSResultMetadataSchema,
|
|
763
|
+
DetectionServiceResultSchema,
|
|
764
|
+
DlpReportSchema,
|
|
765
|
+
ErrorResponseSchema,
|
|
766
|
+
ErrorType,
|
|
767
|
+
HEADER_API_KEY,
|
|
768
|
+
HEADER_AUTH_TOKEN,
|
|
769
|
+
HTTP_FORCE_RETRY_STATUS_CODES,
|
|
770
|
+
IODetectedSchema,
|
|
771
|
+
MAX_AI_PROFILE_NAME_LENGTH,
|
|
772
|
+
MAX_API_KEY_LENGTH,
|
|
773
|
+
MAX_CONNECTION_POOL_SIZE,
|
|
774
|
+
MAX_CONTENT_CONTEXT_LENGTH,
|
|
775
|
+
MAX_CONTENT_PROMPT_LENGTH,
|
|
776
|
+
MAX_CONTENT_RESPONSE_LENGTH,
|
|
777
|
+
MAX_NUMBER_OF_BATCH_SCAN_OBJECTS,
|
|
778
|
+
MAX_NUMBER_OF_REPORT_IDS,
|
|
779
|
+
MAX_NUMBER_OF_RETRIES,
|
|
780
|
+
MAX_NUMBER_OF_SCAN_IDS,
|
|
781
|
+
MAX_REPORT_ID_STR_LENGTH,
|
|
782
|
+
MAX_SCAN_ID_STR_LENGTH,
|
|
783
|
+
MAX_SESSION_ID_STR_LENGTH,
|
|
784
|
+
MAX_TOKEN_LENGTH,
|
|
785
|
+
MAX_TRANSACTION_ID_STR_LENGTH,
|
|
786
|
+
MaskedDataSchema,
|
|
787
|
+
MetadataSchema,
|
|
788
|
+
PAYLOAD_HASH,
|
|
789
|
+
PromptDetectedSchema,
|
|
790
|
+
PromptDetectionDetailsSchema,
|
|
791
|
+
ResponseDetectedSchema,
|
|
792
|
+
ResponseDetectionDetailsSchema,
|
|
793
|
+
SCAN_REPORTS_PATH,
|
|
794
|
+
SCAN_RESULTS_PATH,
|
|
795
|
+
SDK_VERSION,
|
|
796
|
+
SYNC_SCAN_PATH,
|
|
797
|
+
ScanIdResultSchema,
|
|
798
|
+
ScanRequestContentsInnerSchema,
|
|
799
|
+
ScanRequestSchema,
|
|
800
|
+
ScanResponseSchema,
|
|
801
|
+
ScanSummarySchema,
|
|
802
|
+
Scanner,
|
|
803
|
+
ThreatScanReportSchema,
|
|
804
|
+
ToolDetectedSchema,
|
|
805
|
+
ToolEventMetadataSchema,
|
|
806
|
+
ToolEventSchema,
|
|
807
|
+
USER_AGENT,
|
|
808
|
+
UrlfEntrySchema,
|
|
809
|
+
globalConfiguration,
|
|
810
|
+
init
|
|
811
|
+
});
|
|
812
|
+
//# sourceMappingURL=index.cjs.map
|