@cdot65/prisma-airs-sdk 0.22.0 → 0.24.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/dist/index.js CHANGED
@@ -29,7 +29,7 @@ var MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 20;
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.22.0";
32
+ var SDK_VERSION = "0.24.0";
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";
@@ -5015,10 +5015,10 @@ var LatencyChartResponseSchema = aiGatewayEnvelope(
5015
5015
  p99: z42.number()
5016
5016
  }).passthrough()
5017
5017
  ),
5018
- total: z42.number(),
5019
- p50: z42.number(),
5020
- p90: z42.number(),
5021
- p99: z42.number(),
5018
+ total: z42.number().nullable(),
5019
+ p50: z42.number().nullable(),
5020
+ p90: z42.number().nullable(),
5021
+ p99: z42.number().nullable(),
5022
5022
  ...quotaFlag
5023
5023
  }).passthrough()
5024
5024
  );
@@ -16629,10 +16629,34 @@ var logsOptionsSchema = telemetryWindowSchema.extend({
16629
16629
  traceId: nonBlankString.optional(),
16630
16630
  statusCode: z54.number().int().nonnegative().safe().optional()
16631
16631
  }).strict();
16632
- var requestChartOptionsSchema = telemetryWindowSchema.extend({
16632
+ var chartFilterFields = {
16633
16633
  traceId: nonBlankString.optional(),
16634
- metadata: GatewayJsonObjectSchema.pipe(z54.record(z54.string())).optional()
16635
- }).strict();
16634
+ metadata: GatewayJsonObjectSchema.pipe(z54.record(z54.string())).optional(),
16635
+ statusCodes: z54.array(z54.number().int().nonnegative().safe()).nonempty().optional(),
16636
+ apiKeyIds: z54.array(z54.string().uuid()).nonempty().optional(),
16637
+ aiOrgModels: z54.array(z54.string().regex(/^[^,\s]+__[^,\s]+$/)).nonempty().optional(),
16638
+ totalUnitsMin: z54.number().int().nonnegative().safe().optional(),
16639
+ totalUnitsMax: z54.number().int().nonnegative().safe().optional(),
16640
+ costMin: z54.number().finite().nonnegative().optional(),
16641
+ costMax: z54.number().finite().nonnegative().optional()
16642
+ };
16643
+ function validChartBounds(opts) {
16644
+ return (opts.totalUnitsMin === void 0 || opts.totalUnitsMax === void 0 || opts.totalUnitsMin <= opts.totalUnitsMax) && (opts.costMin === void 0 || opts.costMax === void 0 || opts.costMin <= opts.costMax);
16645
+ }
16646
+ var AIGatewayChartFiltersSchema = z54.object(chartFilterFields).strict().refine(validChartBounds);
16647
+ var filteredChartOptionsSchema = telemetryWindowSchema.extend(chartFilterFields).strict().refine(validChartBounds);
16648
+ function serializeChartOptions(tsgId, opts) {
16649
+ const params = serializeWindow(tsgId, opts, filteredChartOptionsSchema);
16650
+ if (opts.traceId !== void 0) params.traceId = opts.traceId;
16651
+ if (opts.metadata !== void 0) params.metadata = JSON.stringify(opts.metadata);
16652
+ if (opts.statusCodes !== void 0) params.statusCode = opts.statusCodes.join(",");
16653
+ if (opts.apiKeyIds !== void 0) params.apiKeyIds = opts.apiKeyIds.join(",");
16654
+ if (opts.aiOrgModels !== void 0) params.aiOrgModel = opts.aiOrgModels.join(",");
16655
+ for (const key of ["totalUnitsMin", "totalUnitsMax", "costMin", "costMax"]) {
16656
+ if (opts[key] !== void 0) params[key] = String(opts[key]);
16657
+ }
16658
+ return params;
16659
+ }
16636
16660
  var AIGatewayTelemetryClient = class {
16637
16661
  baseUrl;
16638
16662
  auth;
@@ -16658,7 +16682,7 @@ var AIGatewayTelemetryClient = class {
16658
16682
  }
16659
16683
  /**
16660
16684
  * Total and per-day spend. **Values are in cents.**
16661
- * @param opts - Workspace slug and time window.
16685
+ * @param opts - Workspace slug, time window and verified trace, metadata, list and range filters.
16662
16686
  * @returns Cost series plus the period total, in cents.
16663
16687
  * @example
16664
16688
  * ```ts
@@ -16670,11 +16694,16 @@ var AIGatewayTelemetryClient = class {
16670
16694
  * ```
16671
16695
  */
16672
16696
  async cost(opts) {
16673
- return this.chart("cost", opts, CostChartResponseSchema);
16697
+ return this.chart(
16698
+ "cost",
16699
+ opts,
16700
+ CostChartResponseSchema,
16701
+ serializeChartOptions(this.tsgId, opts)
16702
+ );
16674
16703
  }
16675
16704
  /**
16676
16705
  * Per-day request counts.
16677
- * @param opts - Workspace slug, time window and optional verified trace/metadata filters.
16706
+ * @param opts - Workspace slug, time window and verified trace, metadata, list and range filters.
16678
16707
  * @returns Request-count series plus the filtered period total.
16679
16708
  * @example
16680
16709
  * ```ts
@@ -16686,15 +16715,18 @@ var AIGatewayTelemetryClient = class {
16686
16715
  * ```
16687
16716
  */
16688
16717
  async requests(opts) {
16689
- const params = serializeWindow(this.tsgId, opts, requestChartOptionsSchema);
16690
- if (opts.traceId !== void 0) params.traceId = opts.traceId;
16691
- if (opts.metadata !== void 0) params.metadata = JSON.stringify(opts.metadata);
16692
- return this.chart("requests", opts, CountChartResponseSchema, params);
16718
+ return this.chart(
16719
+ "requests",
16720
+ opts,
16721
+ CountChartResponseSchema,
16722
+ serializeChartOptions(this.tsgId, opts)
16723
+ );
16693
16724
  }
16694
16725
  /**
16695
16726
  * Latency in milliseconds. Percentiles are returned per-bucket and for the period.
16696
- * @param opts - Workspace slug and time window.
16727
+ * @param opts - Workspace slug, time window and verified trace, metadata, list and range filters.
16697
16728
  * @returns Latency series with p50/p90/p99; `data.total` is the period mean, not a sum.
16729
+ * The period mean and percentiles are null when the cohort has no matching requests.
16698
16730
  * @example
16699
16731
  * ```ts
16700
16732
  * import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
@@ -16705,11 +16737,16 @@ var AIGatewayTelemetryClient = class {
16705
16737
  * ```
16706
16738
  */
16707
16739
  async latency(opts) {
16708
- return this.chart("latency", opts, LatencyChartResponseSchema);
16740
+ return this.chart(
16741
+ "latency",
16742
+ opts,
16743
+ LatencyChartResponseSchema,
16744
+ serializeChartOptions(this.tsgId, opts)
16745
+ );
16709
16746
  }
16710
16747
  /**
16711
16748
  * Token usage, split into request and response units.
16712
- * @param opts - Workspace slug and time window.
16749
+ * @param opts - Workspace slug, time window and verified trace, metadata, list and range filters.
16713
16750
  * @returns Token series plus request/response unit totals.
16714
16751
  * @example
16715
16752
  * ```ts
@@ -16721,7 +16758,12 @@ var AIGatewayTelemetryClient = class {
16721
16758
  * ```
16722
16759
  */
16723
16760
  async tokens(opts) {
16724
- return this.chart("tokens", opts, TokensChartResponseSchema);
16761
+ return this.chart(
16762
+ "tokens",
16763
+ opts,
16764
+ TokensChartResponseSchema,
16765
+ serializeChartOptions(this.tsgId, opts)
16766
+ );
16725
16767
  }
16726
16768
  /**
16727
16769
  * Per-day error counts.
@@ -21274,6 +21316,7 @@ function setDottedValue(input, path, value2) {
21274
21316
  export {
21275
21317
  AIGatewayApiKeysClient,
21276
21318
  AIGatewayAuditLogsClient,
21319
+ AIGatewayChartFiltersSchema,
21277
21320
  AIGatewayClient,
21278
21321
  AIGatewayConfigsClient,
21279
21322
  AIGatewayDeploymentsClient,