@cdot65/prisma-airs-sdk 0.6.5 → 0.6.6
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 +18 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +18 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -16503,6 +16503,7 @@ declare class Content {
|
|
|
16503
16503
|
/**
|
|
16504
16504
|
* Load content from a JSON file.
|
|
16505
16505
|
* @param filePath - Path to JSON file containing scan request contents.
|
|
16506
|
+
* @returns A new Content instance populated from the JSON file.
|
|
16506
16507
|
*/
|
|
16507
16508
|
static fromJSONFile(filePath: string): Content;
|
|
16508
16509
|
}
|
|
@@ -56696,8 +56697,8 @@ declare const MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 5;
|
|
|
56696
56697
|
declare const MAX_CONNECTION_POOL_SIZE = 100;
|
|
56697
56698
|
declare const MAX_NUMBER_OF_RETRIES = 5;
|
|
56698
56699
|
declare const HTTP_FORCE_RETRY_STATUS_CODES: number[];
|
|
56699
|
-
declare const SDK_VERSION = "0.6.
|
|
56700
|
-
declare const USER_AGENT = "PAN-AIRS/0.6.
|
|
56700
|
+
declare const SDK_VERSION = "0.6.6";
|
|
56701
|
+
declare const USER_AGENT = "PAN-AIRS/0.6.6-typescript-sdk";
|
|
56701
56702
|
declare const DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
|
|
56702
56703
|
declare const DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
|
|
56703
56704
|
declare const MGMT_CLIENT_ID = "PANW_MGMT_CLIENT_ID";
|
|
@@ -56811,7 +56812,6 @@ declare class OAuthClient {
|
|
|
56811
56812
|
getToken(): Promise<string>;
|
|
56812
56813
|
/**
|
|
56813
56814
|
* Clear the cached token, forcing a fresh fetch on next call.
|
|
56814
|
-
* @returns Nothing.
|
|
56815
56815
|
*/
|
|
56816
56816
|
clearToken(): void;
|
|
56817
56817
|
/**
|
|
@@ -56931,7 +56931,7 @@ declare class TopicsClient {
|
|
|
56931
56931
|
/**
|
|
56932
56932
|
* Force-delete a custom topic, removing it from any referencing profiles.
|
|
56933
56933
|
* @param topicId - UUID of the topic to force-delete.
|
|
56934
|
-
* @param updatedBy - Email of the user performing the deletion.
|
|
56934
|
+
* @param updatedBy - Optional. Email of the user performing the deletion.
|
|
56935
56935
|
* @returns Deletion confirmation message.
|
|
56936
56936
|
*/
|
|
56937
56937
|
forceDelete(topicId: string, updatedBy?: string): Promise<DeleteTopicResponse>;
|
|
@@ -57675,13 +57675,13 @@ declare class RedTeamReportsClient {
|
|
|
57675
57675
|
* Download a report in the specified format.
|
|
57676
57676
|
* @param jobId - The job UUID.
|
|
57677
57677
|
* @param format - The file format (e.g. "pdf", "csv").
|
|
57678
|
-
* @returns The
|
|
57678
|
+
* @returns The report data in the requested format (untyped — shape depends on `format`).
|
|
57679
57679
|
*/
|
|
57680
57680
|
downloadReport(jobId: string, format: string): Promise<unknown>;
|
|
57681
57681
|
/**
|
|
57682
57682
|
* Generate a partial report for a running scan.
|
|
57683
57683
|
* @param jobId - The job UUID.
|
|
57684
|
-
* @returns The partial report
|
|
57684
|
+
* @returns The partial report payload (untyped — schema not yet defined by the API).
|
|
57685
57685
|
*/
|
|
57686
57686
|
generatePartialReport(jobId: string): Promise<unknown>;
|
|
57687
57687
|
}
|
|
@@ -57907,7 +57907,7 @@ declare class RedTeamCustomAttacksClient {
|
|
|
57907
57907
|
/**
|
|
57908
57908
|
* Download CSV template for a prompt set.
|
|
57909
57909
|
* @param uuid - The prompt set UUID.
|
|
57910
|
-
* @returns The CSV template
|
|
57910
|
+
* @returns The CSV template content (untyped — raw response from the API).
|
|
57911
57911
|
*/
|
|
57912
57912
|
downloadTemplate(uuid: string): Promise<unknown>;
|
|
57913
57913
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -16503,6 +16503,7 @@ declare class Content {
|
|
|
16503
16503
|
/**
|
|
16504
16504
|
* Load content from a JSON file.
|
|
16505
16505
|
* @param filePath - Path to JSON file containing scan request contents.
|
|
16506
|
+
* @returns A new Content instance populated from the JSON file.
|
|
16506
16507
|
*/
|
|
16507
16508
|
static fromJSONFile(filePath: string): Content;
|
|
16508
16509
|
}
|
|
@@ -56696,8 +56697,8 @@ declare const MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 5;
|
|
|
56696
56697
|
declare const MAX_CONNECTION_POOL_SIZE = 100;
|
|
56697
56698
|
declare const MAX_NUMBER_OF_RETRIES = 5;
|
|
56698
56699
|
declare const HTTP_FORCE_RETRY_STATUS_CODES: number[];
|
|
56699
|
-
declare const SDK_VERSION = "0.6.
|
|
56700
|
-
declare const USER_AGENT = "PAN-AIRS/0.6.
|
|
56700
|
+
declare const SDK_VERSION = "0.6.6";
|
|
56701
|
+
declare const USER_AGENT = "PAN-AIRS/0.6.6-typescript-sdk";
|
|
56701
56702
|
declare const DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
|
|
56702
56703
|
declare const DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
|
|
56703
56704
|
declare const MGMT_CLIENT_ID = "PANW_MGMT_CLIENT_ID";
|
|
@@ -56811,7 +56812,6 @@ declare class OAuthClient {
|
|
|
56811
56812
|
getToken(): Promise<string>;
|
|
56812
56813
|
/**
|
|
56813
56814
|
* Clear the cached token, forcing a fresh fetch on next call.
|
|
56814
|
-
* @returns Nothing.
|
|
56815
56815
|
*/
|
|
56816
56816
|
clearToken(): void;
|
|
56817
56817
|
/**
|
|
@@ -56931,7 +56931,7 @@ declare class TopicsClient {
|
|
|
56931
56931
|
/**
|
|
56932
56932
|
* Force-delete a custom topic, removing it from any referencing profiles.
|
|
56933
56933
|
* @param topicId - UUID of the topic to force-delete.
|
|
56934
|
-
* @param updatedBy - Email of the user performing the deletion.
|
|
56934
|
+
* @param updatedBy - Optional. Email of the user performing the deletion.
|
|
56935
56935
|
* @returns Deletion confirmation message.
|
|
56936
56936
|
*/
|
|
56937
56937
|
forceDelete(topicId: string, updatedBy?: string): Promise<DeleteTopicResponse>;
|
|
@@ -57675,13 +57675,13 @@ declare class RedTeamReportsClient {
|
|
|
57675
57675
|
* Download a report in the specified format.
|
|
57676
57676
|
* @param jobId - The job UUID.
|
|
57677
57677
|
* @param format - The file format (e.g. "pdf", "csv").
|
|
57678
|
-
* @returns The
|
|
57678
|
+
* @returns The report data in the requested format (untyped — shape depends on `format`).
|
|
57679
57679
|
*/
|
|
57680
57680
|
downloadReport(jobId: string, format: string): Promise<unknown>;
|
|
57681
57681
|
/**
|
|
57682
57682
|
* Generate a partial report for a running scan.
|
|
57683
57683
|
* @param jobId - The job UUID.
|
|
57684
|
-
* @returns The partial report
|
|
57684
|
+
* @returns The partial report payload (untyped — schema not yet defined by the API).
|
|
57685
57685
|
*/
|
|
57686
57686
|
generatePartialReport(jobId: string): Promise<unknown>;
|
|
57687
57687
|
}
|
|
@@ -57907,7 +57907,7 @@ declare class RedTeamCustomAttacksClient {
|
|
|
57907
57907
|
/**
|
|
57908
57908
|
* Download CSV template for a prompt set.
|
|
57909
57909
|
* @param uuid - The prompt set UUID.
|
|
57910
|
-
* @returns The CSV template
|
|
57910
|
+
* @returns The CSV template content (untyped — raw response from the API).
|
|
57911
57911
|
*/
|
|
57912
57912
|
downloadTemplate(uuid: string): Promise<unknown>;
|
|
57913
57913
|
/**
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 5;
|
|
|
29
29
|
var MAX_CONNECTION_POOL_SIZE = 100;
|
|
30
30
|
var MAX_NUMBER_OF_RETRIES = 5;
|
|
31
31
|
var HTTP_FORCE_RETRY_STATUS_CODES = [500, 502, 503, 504];
|
|
32
|
-
var SDK_VERSION = "0.6.
|
|
32
|
+
var SDK_VERSION = "0.6.6";
|
|
33
33
|
var USER_AGENT = `PAN-AIRS/${SDK_VERSION}-typescript-sdk`;
|
|
34
34
|
var DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
|
|
35
35
|
var DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
|
|
@@ -258,6 +258,11 @@ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
|
258
258
|
function isValidUuid(value) {
|
|
259
259
|
return UUID_RE.test(value);
|
|
260
260
|
}
|
|
261
|
+
function validateJobId(jobId) {
|
|
262
|
+
if (!isValidUuid(jobId)) {
|
|
263
|
+
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
261
266
|
function generatePayloadHash(payload, secret) {
|
|
262
267
|
return createHmac("sha256", secret).update(payload).digest("hex");
|
|
263
268
|
}
|
|
@@ -567,6 +572,7 @@ var Content = class _Content {
|
|
|
567
572
|
/**
|
|
568
573
|
* Load content from a JSON file.
|
|
569
574
|
* @param filePath - Path to JSON file containing scan request contents.
|
|
575
|
+
* @returns A new Content instance populated from the JSON file.
|
|
570
576
|
*/
|
|
571
577
|
static fromJSONFile(filePath) {
|
|
572
578
|
const raw = readFileSync(filePath, "utf-8");
|
|
@@ -2753,7 +2759,6 @@ var OAuthClient = class {
|
|
|
2753
2759
|
}
|
|
2754
2760
|
/**
|
|
2755
2761
|
* Clear the cached token, forcing a fresh fetch on next call.
|
|
2756
|
-
* @returns Nothing.
|
|
2757
2762
|
*/
|
|
2758
2763
|
clearToken() {
|
|
2759
2764
|
this.accessToken = null;
|
|
@@ -3100,7 +3105,7 @@ var TopicsClient = class {
|
|
|
3100
3105
|
/**
|
|
3101
3106
|
* Force-delete a custom topic, removing it from any referencing profiles.
|
|
3102
3107
|
* @param topicId - UUID of the topic to force-delete.
|
|
3103
|
-
* @param updatedBy - Email of the user performing the deletion.
|
|
3108
|
+
* @param updatedBy - Optional. Email of the user performing the deletion.
|
|
3104
3109
|
* @returns Deletion confirmation message.
|
|
3105
3110
|
*/
|
|
3106
3111
|
async forceDelete(topicId, updatedBy) {
|
|
@@ -4312,11 +4317,6 @@ var RedTeamScansClient = class {
|
|
|
4312
4317
|
};
|
|
4313
4318
|
|
|
4314
4319
|
// src/red-team/reports-client.ts
|
|
4315
|
-
function validateJobId(jobId) {
|
|
4316
|
-
if (!isValidUuid(jobId)) {
|
|
4317
|
-
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
4318
|
-
}
|
|
4319
|
-
}
|
|
4320
4320
|
var RedTeamReportsClient = class {
|
|
4321
4321
|
baseUrl;
|
|
4322
4322
|
oauthClient;
|
|
@@ -4574,7 +4574,7 @@ var RedTeamReportsClient = class {
|
|
|
4574
4574
|
* Download a report in the specified format.
|
|
4575
4575
|
* @param jobId - The job UUID.
|
|
4576
4576
|
* @param format - The file format (e.g. "pdf", "csv").
|
|
4577
|
-
* @returns The
|
|
4577
|
+
* @returns The report data in the requested format (untyped — shape depends on `format`).
|
|
4578
4578
|
*/
|
|
4579
4579
|
async downloadReport(jobId, format) {
|
|
4580
4580
|
validateJobId(jobId);
|
|
@@ -4592,7 +4592,7 @@ var RedTeamReportsClient = class {
|
|
|
4592
4592
|
/**
|
|
4593
4593
|
* Generate a partial report for a running scan.
|
|
4594
4594
|
* @param jobId - The job UUID.
|
|
4595
|
-
* @returns The partial report
|
|
4595
|
+
* @returns The partial report payload (untyped — schema not yet defined by the API).
|
|
4596
4596
|
*/
|
|
4597
4597
|
async generatePartialReport(jobId) {
|
|
4598
4598
|
validateJobId(jobId);
|
|
@@ -4608,11 +4608,6 @@ var RedTeamReportsClient = class {
|
|
|
4608
4608
|
};
|
|
4609
4609
|
|
|
4610
4610
|
// src/red-team/custom-attack-reports-client.ts
|
|
4611
|
-
function validateJobId2(jobId) {
|
|
4612
|
-
if (!isValidUuid(jobId)) {
|
|
4613
|
-
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
4614
|
-
}
|
|
4615
|
-
}
|
|
4616
4611
|
var RedTeamCustomAttackReportsClient = class {
|
|
4617
4612
|
baseUrl;
|
|
4618
4613
|
oauthClient;
|
|
@@ -4628,7 +4623,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4628
4623
|
* @returns The custom attack report response.
|
|
4629
4624
|
*/
|
|
4630
4625
|
async getReport(jobId) {
|
|
4631
|
-
|
|
4626
|
+
validateJobId(jobId);
|
|
4632
4627
|
const res = await managementHttpRequest({
|
|
4633
4628
|
method: "GET",
|
|
4634
4629
|
baseUrl: this.baseUrl,
|
|
@@ -4644,7 +4639,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4644
4639
|
* @returns The prompt sets report response.
|
|
4645
4640
|
*/
|
|
4646
4641
|
async getPromptSets(jobId) {
|
|
4647
|
-
|
|
4642
|
+
validateJobId(jobId);
|
|
4648
4643
|
const res = await managementHttpRequest({
|
|
4649
4644
|
method: "GET",
|
|
4650
4645
|
baseUrl: this.baseUrl,
|
|
@@ -4662,7 +4657,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4662
4657
|
* @returns The list of prompt detail responses.
|
|
4663
4658
|
*/
|
|
4664
4659
|
async getPromptsBySet(jobId, promptSetId, opts) {
|
|
4665
|
-
|
|
4660
|
+
validateJobId(jobId);
|
|
4666
4661
|
if (!isValidUuid(promptSetId)) {
|
|
4667
4662
|
throw new AISecSDKException(
|
|
4668
4663
|
`Invalid prompt set id: ${promptSetId}`,
|
|
@@ -4688,7 +4683,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4688
4683
|
* @returns The prompt detail response.
|
|
4689
4684
|
*/
|
|
4690
4685
|
async getPromptDetail(jobId, promptId) {
|
|
4691
|
-
|
|
4686
|
+
validateJobId(jobId);
|
|
4692
4687
|
if (!isValidUuid(promptId)) {
|
|
4693
4688
|
throw new AISecSDKException(
|
|
4694
4689
|
`Invalid prompt id: ${promptId}`,
|
|
@@ -4711,7 +4706,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4711
4706
|
* @returns The paginated list of custom attacks.
|
|
4712
4707
|
*/
|
|
4713
4708
|
async listCustomAttacks(jobId, opts) {
|
|
4714
|
-
|
|
4709
|
+
validateJobId(jobId);
|
|
4715
4710
|
const params = buildRedTeamListParams(opts);
|
|
4716
4711
|
if (opts?.threat !== void 0) params.threat = String(opts.threat);
|
|
4717
4712
|
if (opts?.prompt_set_id !== void 0) params.prompt_set_id = opts.prompt_set_id;
|
|
@@ -4733,7 +4728,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4733
4728
|
* @returns The list of attack outputs.
|
|
4734
4729
|
*/
|
|
4735
4730
|
async getAttackOutputs(jobId, attackId) {
|
|
4736
|
-
|
|
4731
|
+
validateJobId(jobId);
|
|
4737
4732
|
if (!isValidUuid(attackId)) {
|
|
4738
4733
|
throw new AISecSDKException(
|
|
4739
4734
|
`Invalid attack id: ${attackId}`,
|
|
@@ -4755,7 +4750,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4755
4750
|
* @returns The list of property statistics.
|
|
4756
4751
|
*/
|
|
4757
4752
|
async getPropertyStats(jobId) {
|
|
4758
|
-
|
|
4753
|
+
validateJobId(jobId);
|
|
4759
4754
|
const res = await managementHttpRequest({
|
|
4760
4755
|
method: "GET",
|
|
4761
4756
|
baseUrl: this.baseUrl,
|
|
@@ -5102,7 +5097,7 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5102
5097
|
/**
|
|
5103
5098
|
* Download CSV template for a prompt set.
|
|
5104
5099
|
* @param uuid - The prompt set UUID.
|
|
5105
|
-
* @returns The CSV template
|
|
5100
|
+
* @returns The CSV template content (untyped — raw response from the API).
|
|
5106
5101
|
*/
|
|
5107
5102
|
async downloadTemplate(uuid) {
|
|
5108
5103
|
validateUuid(uuid, "prompt set uuid");
|