@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/README.md CHANGED
@@ -101,6 +101,8 @@ Experimental runtime methods also model image/audio/moderation/rerank/OCR, legac
101
101
 
102
102
  Secret-reference CRUD is verified using owned, unbound synthetic references; external secret resolution is not certified. See the [captured lifecycle output](docs-site/docs/guides/examples.mdx#secret-reference-management-lifecycle). Portkey compatibility remains partial; retired upstream endpoints and tenant-unverified families stay visible in the [complete operation ledger](docs-site/docs/developer/gateway-coverage.md).
103
103
 
104
+ Request, cost, token and latency charts accept verified trace/metadata filters, status-code/API-key/provider-model lists and inclusive total-token/cost bounds. List members match with OR; distinct filters combine with AND. Cost bounds are in cents. Empty latency aggregates remain `null`, not measured zero. Unknown filters are rejected before authentication; the SCM query names differ from upstream Portkey. See the [typed telemetry contract](docs-site/docs/guides/ai-gateway-api.mdx#charts).
105
+
104
106
  All AI Gateway write bodies have exported Zod schemas and inferred TypeScript types. Validation
105
107
  happens before OAuth and network access; documented nonempty-update requirements are enforced. The package also
106
108
  exports typed routing/provider configuration, deterministic known-value catalogs,
package/dist/index.cjs CHANGED
@@ -22,6 +22,7 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  AIGatewayApiKeysClient: () => AIGatewayApiKeysClient,
24
24
  AIGatewayAuditLogsClient: () => AIGatewayAuditLogsClient,
25
+ AIGatewayChartFiltersSchema: () => AIGatewayChartFiltersSchema,
25
26
  AIGatewayClient: () => AIGatewayClient,
26
27
  AIGatewayConfigsClient: () => AIGatewayConfigsClient,
27
28
  AIGatewayDeploymentsClient: () => AIGatewayDeploymentsClient,
@@ -1357,7 +1358,7 @@ var MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 20;
1357
1358
  var MAX_CONNECTION_POOL_SIZE = 100;
1358
1359
  var MAX_NUMBER_OF_RETRIES = 5;
1359
1360
  var HTTP_FORCE_RETRY_STATUS_CODES = [500, 502, 503, 504];
1360
- var SDK_VERSION = "0.22.0";
1361
+ var SDK_VERSION = "0.24.0";
1361
1362
  var USER_AGENT = `PAN-AIRS/${SDK_VERSION}-typescript-sdk`;
1362
1363
  var DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
1363
1364
  var DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
@@ -6343,10 +6344,10 @@ var LatencyChartResponseSchema = aiGatewayEnvelope(
6343
6344
  p99: import_zod42.z.number()
6344
6345
  }).passthrough()
6345
6346
  ),
6346
- total: import_zod42.z.number(),
6347
- p50: import_zod42.z.number(),
6348
- p90: import_zod42.z.number(),
6349
- p99: import_zod42.z.number(),
6347
+ total: import_zod42.z.number().nullable(),
6348
+ p50: import_zod42.z.number().nullable(),
6349
+ p90: import_zod42.z.number().nullable(),
6350
+ p99: import_zod42.z.number().nullable(),
6350
6351
  ...quotaFlag
6351
6352
  }).passthrough()
6352
6353
  );
@@ -17957,10 +17958,34 @@ var logsOptionsSchema = telemetryWindowSchema.extend({
17957
17958
  traceId: nonBlankString.optional(),
17958
17959
  statusCode: import_zod54.z.number().int().nonnegative().safe().optional()
17959
17960
  }).strict();
17960
- var requestChartOptionsSchema = telemetryWindowSchema.extend({
17961
+ var chartFilterFields = {
17961
17962
  traceId: nonBlankString.optional(),
17962
- metadata: GatewayJsonObjectSchema.pipe(import_zod54.z.record(import_zod54.z.string())).optional()
17963
- }).strict();
17963
+ metadata: GatewayJsonObjectSchema.pipe(import_zod54.z.record(import_zod54.z.string())).optional(),
17964
+ statusCodes: import_zod54.z.array(import_zod54.z.number().int().nonnegative().safe()).nonempty().optional(),
17965
+ apiKeyIds: import_zod54.z.array(import_zod54.z.string().uuid()).nonempty().optional(),
17966
+ aiOrgModels: import_zod54.z.array(import_zod54.z.string().regex(/^[^,\s]+__[^,\s]+$/)).nonempty().optional(),
17967
+ totalUnitsMin: import_zod54.z.number().int().nonnegative().safe().optional(),
17968
+ totalUnitsMax: import_zod54.z.number().int().nonnegative().safe().optional(),
17969
+ costMin: import_zod54.z.number().finite().nonnegative().optional(),
17970
+ costMax: import_zod54.z.number().finite().nonnegative().optional()
17971
+ };
17972
+ function validChartBounds(opts) {
17973
+ 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);
17974
+ }
17975
+ var AIGatewayChartFiltersSchema = import_zod54.z.object(chartFilterFields).strict().refine(validChartBounds);
17976
+ var filteredChartOptionsSchema = telemetryWindowSchema.extend(chartFilterFields).strict().refine(validChartBounds);
17977
+ function serializeChartOptions(tsgId, opts) {
17978
+ const params = serializeWindow(tsgId, opts, filteredChartOptionsSchema);
17979
+ if (opts.traceId !== void 0) params.traceId = opts.traceId;
17980
+ if (opts.metadata !== void 0) params.metadata = JSON.stringify(opts.metadata);
17981
+ if (opts.statusCodes !== void 0) params.statusCode = opts.statusCodes.join(",");
17982
+ if (opts.apiKeyIds !== void 0) params.apiKeyIds = opts.apiKeyIds.join(",");
17983
+ if (opts.aiOrgModels !== void 0) params.aiOrgModel = opts.aiOrgModels.join(",");
17984
+ for (const key of ["totalUnitsMin", "totalUnitsMax", "costMin", "costMax"]) {
17985
+ if (opts[key] !== void 0) params[key] = String(opts[key]);
17986
+ }
17987
+ return params;
17988
+ }
17964
17989
  var AIGatewayTelemetryClient = class {
17965
17990
  baseUrl;
17966
17991
  auth;
@@ -17986,7 +18011,7 @@ var AIGatewayTelemetryClient = class {
17986
18011
  }
17987
18012
  /**
17988
18013
  * Total and per-day spend. **Values are in cents.**
17989
- * @param opts - Workspace slug and time window.
18014
+ * @param opts - Workspace slug, time window and verified trace, metadata, list and range filters.
17990
18015
  * @returns Cost series plus the period total, in cents.
17991
18016
  * @example
17992
18017
  * ```ts
@@ -17998,11 +18023,16 @@ var AIGatewayTelemetryClient = class {
17998
18023
  * ```
17999
18024
  */
18000
18025
  async cost(opts) {
18001
- return this.chart("cost", opts, CostChartResponseSchema);
18026
+ return this.chart(
18027
+ "cost",
18028
+ opts,
18029
+ CostChartResponseSchema,
18030
+ serializeChartOptions(this.tsgId, opts)
18031
+ );
18002
18032
  }
18003
18033
  /**
18004
18034
  * Per-day request counts.
18005
- * @param opts - Workspace slug, time window and optional verified trace/metadata filters.
18035
+ * @param opts - Workspace slug, time window and verified trace, metadata, list and range filters.
18006
18036
  * @returns Request-count series plus the filtered period total.
18007
18037
  * @example
18008
18038
  * ```ts
@@ -18014,15 +18044,18 @@ var AIGatewayTelemetryClient = class {
18014
18044
  * ```
18015
18045
  */
18016
18046
  async requests(opts) {
18017
- const params = serializeWindow(this.tsgId, opts, requestChartOptionsSchema);
18018
- if (opts.traceId !== void 0) params.traceId = opts.traceId;
18019
- if (opts.metadata !== void 0) params.metadata = JSON.stringify(opts.metadata);
18020
- return this.chart("requests", opts, CountChartResponseSchema, params);
18047
+ return this.chart(
18048
+ "requests",
18049
+ opts,
18050
+ CountChartResponseSchema,
18051
+ serializeChartOptions(this.tsgId, opts)
18052
+ );
18021
18053
  }
18022
18054
  /**
18023
18055
  * Latency in milliseconds. Percentiles are returned per-bucket and for the period.
18024
- * @param opts - Workspace slug and time window.
18056
+ * @param opts - Workspace slug, time window and verified trace, metadata, list and range filters.
18025
18057
  * @returns Latency series with p50/p90/p99; `data.total` is the period mean, not a sum.
18058
+ * The period mean and percentiles are null when the cohort has no matching requests.
18026
18059
  * @example
18027
18060
  * ```ts
18028
18061
  * import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
@@ -18033,11 +18066,16 @@ var AIGatewayTelemetryClient = class {
18033
18066
  * ```
18034
18067
  */
18035
18068
  async latency(opts) {
18036
- return this.chart("latency", opts, LatencyChartResponseSchema);
18069
+ return this.chart(
18070
+ "latency",
18071
+ opts,
18072
+ LatencyChartResponseSchema,
18073
+ serializeChartOptions(this.tsgId, opts)
18074
+ );
18037
18075
  }
18038
18076
  /**
18039
18077
  * Token usage, split into request and response units.
18040
- * @param opts - Workspace slug and time window.
18078
+ * @param opts - Workspace slug, time window and verified trace, metadata, list and range filters.
18041
18079
  * @returns Token series plus request/response unit totals.
18042
18080
  * @example
18043
18081
  * ```ts
@@ -18049,7 +18087,12 @@ var AIGatewayTelemetryClient = class {
18049
18087
  * ```
18050
18088
  */
18051
18089
  async tokens(opts) {
18052
- return this.chart("tokens", opts, TokensChartResponseSchema);
18090
+ return this.chart(
18091
+ "tokens",
18092
+ opts,
18093
+ TokensChartResponseSchema,
18094
+ serializeChartOptions(this.tsgId, opts)
18095
+ );
18053
18096
  }
18054
18097
  /**
18055
18098
  * Per-day error counts.
@@ -22603,6 +22646,7 @@ function setDottedValue(input, path, value2) {
22603
22646
  0 && (module.exports = {
22604
22647
  AIGatewayApiKeysClient,
22605
22648
  AIGatewayAuditLogsClient,
22649
+ AIGatewayChartFiltersSchema,
22606
22650
  AIGatewayClient,
22607
22651
  AIGatewayConfigsClient,
22608
22652
  AIGatewayDeploymentsClient,