@cdot65/prisma-airs-sdk 0.6.2 → 0.6.4

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.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.2";
32
+ var SDK_VERSION = "0.6.4";
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";
@@ -437,6 +437,11 @@ var Content = class _Content {
437
437
  _codePrompt;
438
438
  _codeResponse;
439
439
  _toolEvent;
440
+ /**
441
+ * Create a new Content instance.
442
+ * @param opts - Content fields; at least one of prompt, response, codePrompt, codeResponse, or toolEvent is required.
443
+ * @throws {AISecSDKException} If no content field is provided or a field exceeds its byte-length limit.
444
+ */
440
445
  constructor(opts) {
441
446
  if (!opts.prompt && !opts.response && !opts.codePrompt && !opts.codeResponse && !opts.toolEvent) {
442
447
  throw new AISecSDKException(
@@ -604,7 +609,7 @@ import { z } from "zod";
604
609
  var AiProfileSchema = z.object({
605
610
  profile_id: z.string().uuid().optional(),
606
611
  profile_name: z.string().max(MAX_AI_PROFILE_NAME_LENGTH).optional()
607
- }).refine((d) => d.profile_id || d.profile_name, {
612
+ }).passthrough().refine((d) => d.profile_id || d.profile_name, {
608
613
  message: "Either profile_id or profile_name must be provided"
609
614
  });
610
615
 
@@ -614,14 +619,14 @@ var AgentMetaSchema = z2.object({
614
619
  agent_id: z2.string().optional(),
615
620
  agent_version: z2.string().optional(),
616
621
  agent_arn: z2.string().optional()
617
- });
622
+ }).passthrough();
618
623
  var MetadataSchema = z2.object({
619
624
  app_name: z2.string().optional(),
620
625
  app_user: z2.string().optional(),
621
626
  ai_model: z2.string().optional(),
622
627
  user_ip: z2.string().optional(),
623
628
  agent_meta: AgentMetaSchema.optional()
624
- });
629
+ }).passthrough();
625
630
 
626
631
  // src/models/tool-event.ts
627
632
  import { z as z3 } from "zod";
@@ -630,12 +635,12 @@ var ToolEventMetadataSchema = z3.object({
630
635
  method: z3.string(),
631
636
  server_name: z3.string(),
632
637
  tool_invoked: z3.string().optional()
633
- });
638
+ }).passthrough();
634
639
  var ToolEventSchema = z3.object({
635
640
  metadata: ToolEventMetadataSchema.optional(),
636
641
  input: z3.string().optional(),
637
642
  output: z3.string().optional()
638
- });
643
+ }).passthrough();
639
644
 
640
645
  // src/models/scan-request.ts
641
646
  import { z as z4 } from "zod";
@@ -646,14 +651,14 @@ var ScanRequestContentsInnerSchema = z4.object({
646
651
  code_response: z4.string().optional(),
647
652
  context: z4.string().optional(),
648
653
  tool_event: ToolEventSchema.optional()
649
- });
654
+ }).passthrough();
650
655
  var ScanRequestSchema = z4.object({
651
656
  tr_id: z4.string().max(MAX_TRANSACTION_ID_STR_LENGTH).optional(),
652
657
  session_id: z4.string().max(MAX_SESSION_ID_STR_LENGTH).optional(),
653
658
  ai_profile: AiProfileSchema,
654
659
  metadata: MetadataSchema.optional(),
655
660
  contents: z4.array(ScanRequestContentsInnerSchema).min(1)
656
- });
661
+ }).passthrough();
657
662
 
658
663
  // src/models/scan-response.ts
659
664
  import { z as z8 } from "zod";
@@ -662,7 +667,7 @@ import { z as z8 } from "zod";
662
667
  import { z as z5 } from "zod";
663
668
  var PromptDetectionDetailsSchema = z5.object({
664
669
  topic_guardrails_details: z5.record(z5.unknown()).optional()
665
- });
670
+ }).passthrough();
666
671
  var PromptDetectedSchema = z5.object({
667
672
  url_cats: z5.boolean().optional(),
668
673
  dlp: z5.boolean().optional(),
@@ -671,13 +676,13 @@ var PromptDetectedSchema = z5.object({
671
676
  malicious_code: z5.boolean().optional(),
672
677
  agent: z5.boolean().optional(),
673
678
  topic_violation: z5.boolean().optional()
674
- });
679
+ }).passthrough();
675
680
 
676
681
  // src/models/response-detected.ts
677
682
  import { z as z6 } from "zod";
678
683
  var ResponseDetectionDetailsSchema = z6.object({
679
684
  topic_guardrails_details: z6.record(z6.unknown()).optional()
680
- });
685
+ }).passthrough();
681
686
  var ResponseDetectedSchema = z6.object({
682
687
  url_cats: z6.boolean().optional(),
683
688
  dlp: z6.boolean().optional(),
@@ -687,7 +692,7 @@ var ResponseDetectedSchema = z6.object({
687
692
  agent: z6.boolean().optional(),
688
693
  ungrounded: z6.boolean().optional(),
689
694
  topic_violation: z6.boolean().optional()
690
- });
695
+ }).passthrough();
691
696
 
692
697
  // src/models/detection-reports.ts
693
698
  import { z as z7 } from "zod";
@@ -763,7 +768,7 @@ var ContentErrorSchema = z7.object({
763
768
  var MaskedDataSchema = z8.object({
764
769
  data: z8.string().optional(),
765
770
  pattern_detections: z8.array(PatternDetectionSchema).optional()
766
- });
771
+ }).passthrough();
767
772
  var IODetectedSchema = z8.object({
768
773
  url_cats: z8.boolean().optional(),
769
774
  dlp: z8.boolean().optional(),
@@ -781,7 +786,7 @@ var ToolDetectedSchema = z8.object({
781
786
  summary: ScanSummarySchema.optional(),
782
787
  input_detected: IODetectedSchema.optional(),
783
788
  output_detected: IODetectedSchema.optional()
784
- });
789
+ }).passthrough();
785
790
  var ScanResponseSchema = z8.object({
786
791
  source: z8.string().optional(),
787
792
  report_id: z8.string(),
@@ -804,20 +809,20 @@ var ScanResponseSchema = z8.object({
804
809
  tool_detected: ToolDetectedSchema.optional(),
805
810
  created_at: z8.string().optional(),
806
811
  completed_at: z8.string().optional()
807
- });
812
+ }).passthrough();
808
813
 
809
814
  // src/models/async-scan.ts
810
815
  import { z as z9 } from "zod";
811
816
  var AsyncScanObjectSchema = z9.object({
812
817
  req_id: z9.number().int(),
813
818
  scan_req: ScanRequestSchema
814
- });
819
+ }).passthrough();
815
820
  var AsyncScanResponseSchema = z9.object({
816
821
  received: z9.string(),
817
822
  scan_id: z9.string(),
818
823
  report_id: z9.string().optional(),
819
824
  source: z9.string().optional()
820
- });
825
+ }).passthrough();
821
826
 
822
827
  // src/models/scan-id-result.ts
823
828
  import { z as z10 } from "zod";
@@ -827,7 +832,7 @@ var ScanIdResultSchema = z10.object({
827
832
  status: z10.string().optional(),
828
833
  scan_id: z10.string().optional(),
829
834
  result: ScanResponseSchema.optional()
830
- });
835
+ }).passthrough();
831
836
 
832
837
  // src/models/threat-report.ts
833
838
  import { z as z14 } from "zod";
@@ -845,7 +850,7 @@ var DlpReportSchema = z11.object({
845
850
  data_pattern_rule1_verdict: z11.string().optional(),
846
851
  data_pattern_rule2_verdict: z11.string().optional(),
847
852
  data_pattern_detection_offsets: z11.array(DlpPatternDetectionSchema).optional()
848
- });
853
+ }).passthrough();
849
854
 
850
855
  // src/models/urlf-report.ts
851
856
  import { z as z12 } from "zod";
@@ -854,7 +859,7 @@ var UrlfEntrySchema = z12.object({
854
859
  risk_level: z12.string().optional(),
855
860
  action: z12.string().optional(),
856
861
  categories: z12.array(z12.string()).optional()
857
- });
862
+ }).passthrough();
858
863
 
859
864
  // src/models/detection.ts
860
865
  var DSDetailResultSchema = z13.object({
@@ -883,7 +888,7 @@ var DetectionServiceResultSchema = z13.object({
883
888
  action: z13.string().optional(),
884
889
  metadata: DSResultMetadataSchema.optional(),
885
890
  result_detail: DSDetailResultSchema.optional()
886
- });
891
+ }).passthrough();
887
892
 
888
893
  // src/models/threat-report.ts
889
894
  var ThreatScanReportSchema = z14.object({
@@ -894,7 +899,7 @@ var ThreatScanReportSchema = z14.object({
894
899
  transaction_id: z14.string().optional(),
895
900
  session_id: z14.string().optional(),
896
901
  detection_results: z14.array(DetectionServiceResultSchema).optional()
897
- });
902
+ }).passthrough();
898
903
 
899
904
  // src/models/error-response.ts
900
905
  import { z as z15 } from "zod";
@@ -908,7 +913,7 @@ var ErrorResponseSchema = z15.object({
908
913
  interval: z15.number().optional(),
909
914
  unit: z15.string().optional()
910
915
  }).optional()
911
- });
916
+ }).passthrough();
912
917
 
913
918
  // src/models/mgmt-security-profile.ts
914
919
  import { z as z16 } from "zod";
@@ -1392,10 +1397,10 @@ var ModelSecurityPaginationSchema = z24.object({
1392
1397
  var LabelSchema = z24.object({
1393
1398
  key: z24.string(),
1394
1399
  value: z24.string()
1395
- });
1400
+ }).passthrough();
1396
1401
  var LabelsCreateRequestSchema = z24.object({
1397
1402
  labels: z24.array(LabelSchema)
1398
- });
1403
+ }).passthrough();
1399
1404
  var LabelsResponseSchema = z24.object({}).passthrough();
1400
1405
  var LabelKeyListSchema = z24.object({
1401
1406
  pagination: ModelSecurityPaginationSchema,
@@ -1436,7 +1441,7 @@ var ScanDetailsSchema = z24.object({
1436
1441
  scan_duration_ms: z24.number().int(),
1437
1442
  error_code: z24.string().nullable().optional(),
1438
1443
  error_message: z24.string().nullable().optional()
1439
- });
1444
+ }).passthrough();
1440
1445
  var ScanCreateRequestSchema = z24.object({
1441
1446
  model_uri: z24.string(),
1442
1447
  security_group_uuid: z24.string(),
@@ -1448,7 +1453,7 @@ var ScanCreateRequestSchema = z24.object({
1448
1453
  model_name: z24.string().nullable().optional(),
1449
1454
  model_version: z24.string().nullable().optional(),
1450
1455
  scan_details: ScanDetailsSchema.nullable().optional()
1451
- });
1456
+ }).passthrough();
1452
1457
  var ScanBaseResponseSchema = z24.object({
1453
1458
  uuid: z24.string(),
1454
1459
  tsg_id: z24.string(),
@@ -1586,7 +1591,7 @@ var ModelSecurityRuleInstanceUpdateRequestSchema = z24.object({
1586
1591
  security_group_uuid: z24.string(),
1587
1592
  state: z24.string().nullable().optional(),
1588
1593
  field_values: z24.record(z24.unknown()).nullable().optional()
1589
- });
1594
+ }).passthrough();
1590
1595
  var ListModelSecurityRuleInstancesResponseSchema = z24.object({
1591
1596
  pagination: ModelSecurityPaginationSchema,
1592
1597
  rule_instances: z24.array(ModelSecurityRuleInstanceResponseSchema)
@@ -1596,7 +1601,7 @@ var ModelSecurityGroupCreateRequestSchema = z24.object({
1596
1601
  source_type: z24.string(),
1597
1602
  description: z24.string().optional().default(""),
1598
1603
  rule_configurations: z24.record(RuleConfigurationSchema).optional()
1599
- });
1604
+ }).passthrough();
1600
1605
  var ModelSecurityGroupResponseSchema = z24.object({
1601
1606
  uuid: z24.string(),
1602
1607
  tsg_id: z24.string(),
@@ -1611,7 +1616,7 @@ var ModelSecurityGroupResponseSchema = z24.object({
1611
1616
  var ModelSecurityGroupUpdateRequestSchema = z24.object({
1612
1617
  name: z24.string().nullable().optional(),
1613
1618
  description: z24.string().nullable().optional()
1614
- });
1619
+ }).passthrough();
1615
1620
  var ListModelSecurityGroupsResponseSchema = z24.object({
1616
1621
  pagination: ModelSecurityPaginationSchema,
1617
1622
  security_groups: z24.array(ModelSecurityGroupResponseSchema)
@@ -1818,12 +1823,12 @@ var TargetType = {
1818
1823
  // src/models/red-team.ts
1819
1824
  import { z as z25 } from "zod";
1820
1825
  var RedTeamPaginationSchema = z25.object({ total_items: z25.number().int().nullable().optional() }).passthrough();
1821
- var CountByNameSchema = z25.object({ name: z25.string(), count: z25.number().int() });
1826
+ var CountByNameSchema = z25.object({ name: z25.string(), count: z25.number().int() }).passthrough();
1822
1827
  var ValidationErrorSchema = z25.object({
1823
1828
  loc: z25.array(z25.union([z25.string(), z25.number()])),
1824
1829
  msg: z25.string(),
1825
1830
  type: z25.string()
1826
- });
1831
+ }).passthrough();
1827
1832
  var HTTPValidationErrorSchema = z25.object({ detail: z25.array(ValidationErrorSchema).optional() }).passthrough();
1828
1833
  var TargetBackgroundSchema = z25.object({
1829
1834
  industry: z25.string().nullable().optional(),
@@ -1906,7 +1911,7 @@ var ConnectionParamsSchema = z25.union([
1906
1911
  var TargetJobRequestSchema = z25.object({
1907
1912
  uuid: z25.string(),
1908
1913
  version: z25.number().int().nullable().optional()
1909
- });
1914
+ }).passthrough();
1910
1915
  var JobTimeRecordSchema = z25.object({
1911
1916
  queued_at: z25.string().nullable().optional(),
1912
1917
  started_at: z25.string().nullable().optional(),
@@ -1967,7 +1972,7 @@ var JobCreateRequestSchema = z25.object({
1967
1972
  ]),
1968
1973
  version: z25.number().int().nullable().optional(),
1969
1974
  extra_info: z25.record(z25.unknown()).nullable().optional()
1970
- });
1975
+ }).passthrough();
1971
1976
  var StaticJobReportStatsSchema = z25.object({
1972
1977
  output_completion_percentage: z25.number(),
1973
1978
  partial_report_unlocked: z25.boolean().optional(),
@@ -2038,12 +2043,12 @@ var JobListResponseSchema = z25.object({
2038
2043
  var JobAbortResponseSchema = z25.object({
2039
2044
  job_id: z25.string(),
2040
2045
  message: z25.string()
2041
- });
2046
+ }).passthrough();
2042
2047
  var PrerequisiteModelSchema = z25.object({
2043
2048
  id: z25.string(),
2044
2049
  display_name: z25.string(),
2045
2050
  description: z25.string()
2046
- });
2051
+ }).passthrough();
2047
2052
  var SubCategoryModelSchema = z25.object({
2048
2053
  id: z25.string(),
2049
2054
  display_name: z25.string(),
@@ -2337,17 +2342,17 @@ var CustomAttackOutputSchema = z25.object({
2337
2342
  var PropertyAssignmentSchema = z25.object({
2338
2343
  name: z25.string(),
2339
2344
  value: z25.string()
2340
- });
2345
+ }).passthrough();
2341
2346
  var PropertyValueStatisticSchema = z25.object({
2342
2347
  value: z25.string(),
2343
2348
  successful_attack_count: z25.number().int(),
2344
2349
  total_attack_count: z25.number().int(),
2345
2350
  success_rate: z25.number()
2346
- });
2351
+ }).passthrough();
2347
2352
  var PropertyStatisticSchema = z25.object({
2348
2353
  property_name: z25.string(),
2349
2354
  values: z25.array(PropertyValueStatisticSchema)
2350
- });
2355
+ }).passthrough();
2351
2356
  var PromptSetSummarySchema = z25.object({
2352
2357
  prompt_set_id: z25.string(),
2353
2358
  prompt_set_name: z25.string(),
@@ -2408,16 +2413,16 @@ var ScanStatisticsResponseSchema = z25.object({
2408
2413
  var ScoreTrendSeriesSchema = z25.object({
2409
2414
  label: z25.string(),
2410
2415
  data: z25.array(z25.number().nullable())
2411
- });
2416
+ }).passthrough();
2412
2417
  var ScoreTrendResponseSchema = z25.object({
2413
2418
  labels: z25.array(z25.string()),
2414
2419
  series: z25.array(ScoreTrendSeriesSchema)
2415
- });
2420
+ }).passthrough();
2416
2421
  var SentimentRequestSchema = z25.object({
2417
2422
  job_id: z25.string(),
2418
2423
  up_vote: z25.boolean().optional(),
2419
2424
  down_vote: z25.boolean().optional()
2420
- });
2425
+ }).passthrough();
2421
2426
  var SentimentResponseSchema = z25.object({
2422
2427
  job_id: z25.string(),
2423
2428
  up_vote: z25.boolean().optional(),
@@ -2427,12 +2432,12 @@ var QuotaDetailsSchema = z25.object({
2427
2432
  allocated: z25.number().int(),
2428
2433
  unlimited: z25.boolean(),
2429
2434
  consumed: z25.number().int()
2430
- });
2435
+ }).passthrough();
2431
2436
  var QuotaSummarySchema = z25.object({
2432
2437
  static: QuotaDetailsSchema,
2433
2438
  dynamic: QuotaDetailsSchema,
2434
2439
  custom: QuotaDetailsSchema
2435
- });
2440
+ }).passthrough();
2436
2441
  var ErrorLogSchema = z25.object({
2437
2442
  created_at: z25.string(),
2438
2443
  updated_at: z25.string(),
@@ -2559,7 +2564,7 @@ var TargetProfileResponseSchema = z25.object({
2559
2564
  var BaseResponseSchema = z25.object({
2560
2565
  message: z25.string(),
2561
2566
  status: z25.number().int()
2562
- });
2567
+ }).passthrough();
2563
2568
  var PromptSetStatsSchema = z25.object({
2564
2569
  total_prompts: z25.number().int(),
2565
2570
  active_prompts: z25.number().int(),
@@ -2571,14 +2576,14 @@ var CustomPromptSetCreateRequestSchema = z25.object({
2571
2576
  name: z25.string(),
2572
2577
  description: z25.unknown().optional(),
2573
2578
  property_names: z25.array(z25.string()).optional()
2574
- });
2579
+ }).passthrough();
2575
2580
  var CustomPromptSetUpdateRequestSchema = z25.object({
2576
2581
  name: z25.unknown().optional(),
2577
2582
  description: z25.unknown().optional(),
2578
2583
  archive: z25.unknown().optional(),
2579
2584
  property_names: z25.unknown().optional()
2580
2585
  }).passthrough();
2581
- var CustomPromptSetArchiveRequestSchema = z25.object({ archive: z25.boolean() });
2586
+ var CustomPromptSetArchiveRequestSchema = z25.object({ archive: z25.boolean() }).passthrough();
2582
2587
  var CustomPromptSetResponseSchema = z25.object({
2583
2588
  uuid: z25.string(),
2584
2589
  name: z25.string(),
@@ -2637,7 +2642,7 @@ var CustomPromptCreateRequestSchema = z25.object({
2637
2642
  prompt_set_id: z25.string(),
2638
2643
  goal: z25.unknown().optional(),
2639
2644
  properties: z25.unknown().optional()
2640
- });
2645
+ }).passthrough();
2641
2646
  var CustomPromptUpdateRequestSchema = z25.object({
2642
2647
  prompt: z25.unknown().optional(),
2643
2648
  goal: z25.unknown().optional(),
@@ -2674,15 +2679,15 @@ var CustomPromptListSchema = z25.object({
2674
2679
  pagination: RedTeamPaginationSchema,
2675
2680
  data: z25.array(CustomPromptListItemSchema).optional()
2676
2681
  }).passthrough();
2677
- var PropertyNameCreateRequestSchema = z25.object({ name: z25.string() });
2682
+ var PropertyNameCreateRequestSchema = z25.object({ name: z25.string() }).passthrough();
2678
2683
  var PropertyValueCreateRequestSchema = z25.object({
2679
2684
  property_name: z25.string(),
2680
2685
  property_value: z25.string()
2681
- });
2686
+ }).passthrough();
2682
2687
  var PropertyDefinitionSchema = z25.object({
2683
2688
  property_name: z25.string(),
2684
2689
  created_at: z25.string()
2685
- });
2690
+ }).passthrough();
2686
2691
  var PropertyNamesListResponseSchema = z25.object({ data: z25.array(PropertyDefinitionSchema).optional() }).passthrough();
2687
2692
  var PropertyValuesResponseSchema = z25.object({
2688
2693
  name: z25.string(),
@@ -2701,7 +2706,7 @@ var OAuthTokenResponseSchema = z26.object({
2701
2706
  token_type: z26.string().optional(),
2702
2707
  expires_in: z26.number(),
2703
2708
  scope: z26.string().optional()
2704
- });
2709
+ }).passthrough();
2705
2710
 
2706
2711
  // src/management/oauth-client.ts
2707
2712
  var DEFAULT_TOKEN_BUFFER_MS = 3e4;
@@ -3717,6 +3722,7 @@ var ModelSecurityScansClient = class {
3717
3722
  * Delete labels from a scan by key.
3718
3723
  * @param scanUuid - Scan UUID.
3719
3724
  * @param keys - Label keys to delete.
3725
+ * @returns Resolves when the labels are deleted.
3720
3726
  */
3721
3727
  async deleteLabels(scanUuid, keys) {
3722
3728
  if (!isValidUuid(scanUuid)) {
@@ -4200,7 +4206,11 @@ var RedTeamScansClient = class {
4200
4206
  this.oauthClient = opts.oauthClient;
4201
4207
  this.numRetries = opts.numRetries;
4202
4208
  }
4203
- /** Create a new red team scan job. */
4209
+ /**
4210
+ * Create a new red team scan job.
4211
+ * @param request - Job creation request body.
4212
+ * @returns The created job response.
4213
+ */
4204
4214
  async create(request) {
4205
4215
  const res = await managementHttpRequest({
4206
4216
  method: "POST",
@@ -4660,7 +4670,12 @@ var RedTeamTargetsClient = class {
4660
4670
  this.oauthClient = opts.oauthClient;
4661
4671
  this.numRetries = opts.numRetries;
4662
4672
  }
4663
- /** Create a new target. */
4673
+ /**
4674
+ * Create a new target.
4675
+ * @param request - Target creation request body.
4676
+ * @param opts - Optional operation options (e.g. validate connection).
4677
+ * @returns The created target response.
4678
+ */
4664
4679
  async create(request, opts) {
4665
4680
  const params = {};
4666
4681
  if (opts?.validate !== void 0) params.validate = String(opts.validate);