@cdot65/prisma-airs-sdk 0.8.2 → 0.8.3

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.d.cts CHANGED
@@ -84882,8 +84882,8 @@ declare const MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 5;
84882
84882
  declare const MAX_CONNECTION_POOL_SIZE = 100;
84883
84883
  declare const MAX_NUMBER_OF_RETRIES = 5;
84884
84884
  declare const HTTP_FORCE_RETRY_STATUS_CODES: number[];
84885
- declare const SDK_VERSION = "0.8.2";
84886
- declare const USER_AGENT = "PAN-AIRS/0.8.2-typescript-sdk";
84885
+ declare const SDK_VERSION = "0.8.3";
84886
+ declare const USER_AGENT = "PAN-AIRS/0.8.3-typescript-sdk";
84887
84887
  declare const DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
84888
84888
  declare const DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
84889
84889
  declare const MGMT_CLIENT_ID = "PANW_MGMT_CLIENT_ID";
@@ -86128,10 +86128,14 @@ declare class RedTeamCustomAttacksClient {
86128
86128
  listActivePromptSets(): Promise<CustomPromptSetListActive>;
86129
86129
  /**
86130
86130
  * Download CSV template for a prompt set.
86131
+ *
86132
+ * Bypasses `request()` because the response is `text/csv`, not JSON, and
86133
+ * `request()` unconditionally `JSON.parse()`s 2xx bodies.
86134
+ *
86131
86135
  * @param uuid - The prompt set UUID.
86132
- * @returns The CSV template content (untyped raw response from the API).
86136
+ * @returns The CSV template content as a raw string.
86133
86137
  */
86134
- downloadTemplate(uuid: string): Promise<unknown>;
86138
+ downloadTemplate(uuid: string): Promise<string>;
86135
86139
  /**
86136
86140
  * Upload a CSV file of custom prompts for a prompt set.
86137
86141
  * Bypasses `request()` because the body is `FormData`, not JSON.
package/dist/index.d.ts CHANGED
@@ -84882,8 +84882,8 @@ declare const MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 5;
84882
84882
  declare const MAX_CONNECTION_POOL_SIZE = 100;
84883
84883
  declare const MAX_NUMBER_OF_RETRIES = 5;
84884
84884
  declare const HTTP_FORCE_RETRY_STATUS_CODES: number[];
84885
- declare const SDK_VERSION = "0.8.2";
84886
- declare const USER_AGENT = "PAN-AIRS/0.8.2-typescript-sdk";
84885
+ declare const SDK_VERSION = "0.8.3";
84886
+ declare const USER_AGENT = "PAN-AIRS/0.8.3-typescript-sdk";
84887
84887
  declare const DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
84888
84888
  declare const DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
84889
84889
  declare const MGMT_CLIENT_ID = "PANW_MGMT_CLIENT_ID";
@@ -86128,10 +86128,14 @@ declare class RedTeamCustomAttacksClient {
86128
86128
  listActivePromptSets(): Promise<CustomPromptSetListActive>;
86129
86129
  /**
86130
86130
  * Download CSV template for a prompt set.
86131
+ *
86132
+ * Bypasses `request()` because the response is `text/csv`, not JSON, and
86133
+ * `request()` unconditionally `JSON.parse()`s 2xx bodies.
86134
+ *
86131
86135
  * @param uuid - The prompt set UUID.
86132
- * @returns The CSV template content (untyped raw response from the API).
86136
+ * @returns The CSV template content as a raw string.
86133
86137
  */
86134
- downloadTemplate(uuid: string): Promise<unknown>;
86138
+ downloadTemplate(uuid: string): Promise<string>;
86135
86139
  /**
86136
86140
  * Upload a CSV file of custom prompts for a prompt set.
86137
86141
  * Bypasses `request()` because the body is `FormData`, not JSON.
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.8.2";
32
+ var SDK_VERSION = "0.8.3";
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";
@@ -5043,7 +5043,6 @@ var RedTeamTargetsClient = class {
5043
5043
  };
5044
5044
 
5045
5045
  // src/red-team/custom-attacks-client.ts
5046
- import { z as z33 } from "zod";
5047
5046
  var RedTeamCustomAttacksClient = class {
5048
5047
  baseUrl;
5049
5048
  auth;
@@ -5196,19 +5195,36 @@ var RedTeamCustomAttacksClient = class {
5196
5195
  }
5197
5196
  /**
5198
5197
  * Download CSV template for a prompt set.
5198
+ *
5199
+ * Bypasses `request()` because the response is `text/csv`, not JSON, and
5200
+ * `request()` unconditionally `JSON.parse()`s 2xx bodies.
5201
+ *
5199
5202
  * @param uuid - The prompt set UUID.
5200
- * @returns The CSV template content (untyped raw response from the API).
5203
+ * @returns The CSV template content as a raw string.
5201
5204
  */
5202
5205
  async downloadTemplate(uuid) {
5203
5206
  assertUuid(uuid, "prompt set uuid");
5204
- return request({
5207
+ const url = new URL(
5208
+ `${this.baseUrl.replace(/\/+$/, "")}${RED_TEAM_CUSTOM_ATTACK_PATH}/download-template/${uuid}`
5209
+ );
5210
+ const stub = {
5205
5211
  method: "GET",
5206
- baseUrl: this.baseUrl,
5207
- path: `${RED_TEAM_CUSTOM_ATTACK_PATH}/download-template/${uuid}`,
5208
- responseSchema: z33.unknown(),
5209
- auth: this.auth,
5210
- numRetries: this.numRetries
5212
+ url,
5213
+ headers: { "User-Agent": USER_AGENT }
5214
+ };
5215
+ const prepared = await this.auth.prepare(stub);
5216
+ const response = await fetch(prepared.url.toString(), {
5217
+ method: "GET",
5218
+ headers: prepared.headers
5211
5219
  });
5220
+ const text = await response.text();
5221
+ if (!response.ok) {
5222
+ throw new AISecSDKException(
5223
+ `Download template failed (${response.status}): ${text}`,
5224
+ "AISEC_SERVER_SIDE_ERROR" /* SERVER_SIDE_ERROR */
5225
+ );
5226
+ }
5227
+ return text;
5212
5228
  }
5213
5229
  /**
5214
5230
  * Upload a CSV file of custom prompts for a prompt set.