@cdot65/prisma-airs-sdk 0.24.0 → 0.25.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.d.cts CHANGED
@@ -154351,8 +154351,8 @@ declare const MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 20;
154351
154351
  declare const MAX_CONNECTION_POOL_SIZE = 100;
154352
154352
  declare const MAX_NUMBER_OF_RETRIES = 5;
154353
154353
  declare const HTTP_FORCE_RETRY_STATUS_CODES: number[];
154354
- declare const SDK_VERSION = "0.24.0";
154355
- declare const USER_AGENT = "PAN-AIRS/0.24.0-typescript-sdk";
154354
+ declare const SDK_VERSION = "0.25.0";
154355
+ declare const USER_AGENT = "PAN-AIRS/0.25.0-typescript-sdk";
154356
154356
  declare const DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
154357
154357
  declare const DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
154358
154358
  declare const MGMT_CLIENT_ID = "PANW_MGMT_CLIENT_ID";
@@ -158897,7 +158897,7 @@ interface AIGatewayWindowOptions {
158897
158897
  }
158898
158898
 
158899
158899
  /**
158900
- * Standalone verified chart-filter validation, without workspace resolution or authentication.
158900
+ * Standalone verified chart/group filter validation, without workspace resolution or authentication.
158901
158901
  * Shared by the SDK transport and CLI input adapters; excludes time-window and workspace fields.
158902
158902
  * Cost bounds use cents. Lists use OR, distinct filters use AND, and bounds are inclusive.
158903
158903
  * @example
@@ -158958,7 +158958,7 @@ declare const AIGatewayChartFiltersSchema: z.ZodEffects<z.ZodObject<{
158958
158958
  costMin?: number | undefined;
158959
158959
  costMax?: number | undefined;
158960
158960
  }>;
158961
- /** Validated filters shared by the request, cost, token and latency charts. */
158961
+ /** Validated filters shared by four charts and all six grouped analytics endpoints. */
158962
158962
  type AIGatewayChartFilters = z.infer<typeof AIGatewayChartFiltersSchema>;
158963
158963
  /** @internal */
158964
158964
  interface AIGatewayTelemetryClientOptions {
@@ -158968,7 +158968,7 @@ interface AIGatewayTelemetryClientOptions {
158968
158968
  tsgId: string;
158969
158969
  }
158970
158970
  /** Options for a `logs/groups/{dimension}` query. */
158971
- interface AIGatewayGroupOptions extends AIGatewayWindowOptions {
158971
+ interface AIGatewayGroupOptions extends AIGatewayChartOptions {
158972
158972
  /**
158973
158973
  * Extra columns to aggregate. The SDK rejects unsupported names before I/O; the API would
158974
158974
  * silently drop them. See {@link AI_GW_GROUP_COLUMNS} for the valid set.
@@ -158976,7 +158976,9 @@ interface AIGatewayGroupOptions extends AIGatewayWindowOptions {
158976
158976
  columns?: (typeof AI_GW_GROUP_COLUMNS)[number][];
158977
158977
  }
158978
158978
  /**
158979
- * Verified SCM filters for requests, cost, tokens and latency charts only.
158979
+ * Verified SCM filters for requests, cost, tokens and latency charts, and grouped analytics.
158980
+ * The historical chart-options name is retained for compatibility. Other charts still accept
158981
+ * only time-window options; user grouping accepts these filters but not extra columns.
158980
158982
  * Members of each list match with OR; distinct supplied filters combine with AND.
158981
158983
  * Total-token and cost ranges are inclusive. Cost bounds are in cents, not dollars.
158982
158984
  * These are partial adapters, not the complete upstream analytics query contract.
@@ -159262,7 +159264,7 @@ declare class AIGatewayTelemetryClient {
159262
159264
  /**
159263
159265
  * Aggregate requests by a dimension.
159264
159266
  * @param dimension - One of {@link AI_GW_GROUP_DIMENSIONS}. Underscore names only.
159265
- * @param opts - Window plus optional extra columns.
159267
+ * @param opts - Window, verified trace/metadata/list/range filters, and optional extra columns.
159266
159268
  * @returns One row per distinct dimension value.
159267
159269
  * @example
159268
159270
  * ```ts
@@ -159279,7 +159281,7 @@ declare class AIGatewayTelemetryClient {
159279
159281
  groupBy(dimension: (typeof AI_GW_GROUP_DIMENSIONS)[number], opts: AIGatewayGroupOptions): Promise<GroupListResponse>;
159280
159282
  /**
159281
159283
  * Requests and cost per end user.
159282
- * @param opts - Workspace slug and time window.
159284
+ * @param opts - Workspace slug, time window and verified trace/metadata/list/range filters.
159283
159285
  * @returns One record per user; `_user: ''` means calls with no end-user id. Costs in cents.
159284
159286
  * @example
159285
159287
  * ```ts
@@ -159290,10 +159292,10 @@ declare class AIGatewayTelemetryClient {
159290
159292
  * // users.data.records[0] => { _user: '', count: 25748, cost: 411060.85 }
159291
159293
  * ```
159292
159294
  */
159293
- byUser(opts: AIGatewayWindowOptions): Promise<UserGroupResponse>;
159295
+ byUser(opts: AIGatewayChartOptions): Promise<UserGroupResponse>;
159294
159296
  /**
159295
159297
  * Requests grouped by HTTP status code.
159296
- * @param opts - Window plus optional extra columns.
159298
+ * @param opts - Window, verified trace/metadata/list/range filters, and optional extra columns.
159297
159299
  * @returns One row per status. **446 = AIRS security block** (cost 0, never reached the LLM).
159298
159300
  * @example
159299
159301
  * ```ts
package/dist/index.d.ts CHANGED
@@ -154351,8 +154351,8 @@ declare const MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 20;
154351
154351
  declare const MAX_CONNECTION_POOL_SIZE = 100;
154352
154352
  declare const MAX_NUMBER_OF_RETRIES = 5;
154353
154353
  declare const HTTP_FORCE_RETRY_STATUS_CODES: number[];
154354
- declare const SDK_VERSION = "0.24.0";
154355
- declare const USER_AGENT = "PAN-AIRS/0.24.0-typescript-sdk";
154354
+ declare const SDK_VERSION = "0.25.0";
154355
+ declare const USER_AGENT = "PAN-AIRS/0.25.0-typescript-sdk";
154356
154356
  declare const DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
154357
154357
  declare const DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
154358
154358
  declare const MGMT_CLIENT_ID = "PANW_MGMT_CLIENT_ID";
@@ -158897,7 +158897,7 @@ interface AIGatewayWindowOptions {
158897
158897
  }
158898
158898
 
158899
158899
  /**
158900
- * Standalone verified chart-filter validation, without workspace resolution or authentication.
158900
+ * Standalone verified chart/group filter validation, without workspace resolution or authentication.
158901
158901
  * Shared by the SDK transport and CLI input adapters; excludes time-window and workspace fields.
158902
158902
  * Cost bounds use cents. Lists use OR, distinct filters use AND, and bounds are inclusive.
158903
158903
  * @example
@@ -158958,7 +158958,7 @@ declare const AIGatewayChartFiltersSchema: z.ZodEffects<z.ZodObject<{
158958
158958
  costMin?: number | undefined;
158959
158959
  costMax?: number | undefined;
158960
158960
  }>;
158961
- /** Validated filters shared by the request, cost, token and latency charts. */
158961
+ /** Validated filters shared by four charts and all six grouped analytics endpoints. */
158962
158962
  type AIGatewayChartFilters = z.infer<typeof AIGatewayChartFiltersSchema>;
158963
158963
  /** @internal */
158964
158964
  interface AIGatewayTelemetryClientOptions {
@@ -158968,7 +158968,7 @@ interface AIGatewayTelemetryClientOptions {
158968
158968
  tsgId: string;
158969
158969
  }
158970
158970
  /** Options for a `logs/groups/{dimension}` query. */
158971
- interface AIGatewayGroupOptions extends AIGatewayWindowOptions {
158971
+ interface AIGatewayGroupOptions extends AIGatewayChartOptions {
158972
158972
  /**
158973
158973
  * Extra columns to aggregate. The SDK rejects unsupported names before I/O; the API would
158974
158974
  * silently drop them. See {@link AI_GW_GROUP_COLUMNS} for the valid set.
@@ -158976,7 +158976,9 @@ interface AIGatewayGroupOptions extends AIGatewayWindowOptions {
158976
158976
  columns?: (typeof AI_GW_GROUP_COLUMNS)[number][];
158977
158977
  }
158978
158978
  /**
158979
- * Verified SCM filters for requests, cost, tokens and latency charts only.
158979
+ * Verified SCM filters for requests, cost, tokens and latency charts, and grouped analytics.
158980
+ * The historical chart-options name is retained for compatibility. Other charts still accept
158981
+ * only time-window options; user grouping accepts these filters but not extra columns.
158980
158982
  * Members of each list match with OR; distinct supplied filters combine with AND.
158981
158983
  * Total-token and cost ranges are inclusive. Cost bounds are in cents, not dollars.
158982
158984
  * These are partial adapters, not the complete upstream analytics query contract.
@@ -159262,7 +159264,7 @@ declare class AIGatewayTelemetryClient {
159262
159264
  /**
159263
159265
  * Aggregate requests by a dimension.
159264
159266
  * @param dimension - One of {@link AI_GW_GROUP_DIMENSIONS}. Underscore names only.
159265
- * @param opts - Window plus optional extra columns.
159267
+ * @param opts - Window, verified trace/metadata/list/range filters, and optional extra columns.
159266
159268
  * @returns One row per distinct dimension value.
159267
159269
  * @example
159268
159270
  * ```ts
@@ -159279,7 +159281,7 @@ declare class AIGatewayTelemetryClient {
159279
159281
  groupBy(dimension: (typeof AI_GW_GROUP_DIMENSIONS)[number], opts: AIGatewayGroupOptions): Promise<GroupListResponse>;
159280
159282
  /**
159281
159283
  * Requests and cost per end user.
159282
- * @param opts - Workspace slug and time window.
159284
+ * @param opts - Workspace slug, time window and verified trace/metadata/list/range filters.
159283
159285
  * @returns One record per user; `_user: ''` means calls with no end-user id. Costs in cents.
159284
159286
  * @example
159285
159287
  * ```ts
@@ -159290,10 +159292,10 @@ declare class AIGatewayTelemetryClient {
159290
159292
  * // users.data.records[0] => { _user: '', count: 25748, cost: 411060.85 }
159291
159293
  * ```
159292
159294
  */
159293
- byUser(opts: AIGatewayWindowOptions): Promise<UserGroupResponse>;
159295
+ byUser(opts: AIGatewayChartOptions): Promise<UserGroupResponse>;
159294
159296
  /**
159295
159297
  * Requests grouped by HTTP status code.
159296
- * @param opts - Window plus optional extra columns.
159298
+ * @param opts - Window, verified trace/metadata/list/range filters, and optional extra columns.
159297
159299
  * @returns One row per status. **446 = AIRS security block** (cost 0, never reached the LLM).
159298
159300
  * @example
159299
159301
  * ```ts
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.24.0";
32
+ var SDK_VERSION = "0.25.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";
@@ -16606,24 +16606,27 @@ function toOffsetIso(d) {
16606
16606
  return `${String(d.getFullYear()).padStart(4, "0")}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}${sign}${pad(offsetMin / 60)}:${pad(offsetMin % 60)}`;
16607
16607
  }
16608
16608
  function serializeWindow(tsgId, opts, schema = telemetryWindowSchema) {
16609
+ return serializeWindowWithOptions(tsgId, opts, schema).params;
16610
+ }
16611
+ function serializeWindowWithOptions(tsgId, opts, schema) {
16609
16612
  const result = schema.safeParse(opts);
16610
16613
  if (!result.success || typeof tsgId !== "string" || !/^\d+$/.test(tsgId)) invalidWindow();
16611
16614
  const end = result.data.end ?? /* @__PURE__ */ new Date();
16612
16615
  const start = result.data.start ?? new Date(end.getTime() - (result.data.days ?? 7) * 864e5);
16613
16616
  if (start.getTime() > end.getTime()) invalidWindow();
16614
16617
  return {
16615
- organisationId: tsgId,
16616
- workspaceSlug: result.data.workspaceSlug,
16617
- timeOfGenerationMin: toOffsetIso(start),
16618
- timeOfGenerationMax: toOffsetIso(end)
16618
+ options: result.data,
16619
+ params: {
16620
+ organisationId: tsgId,
16621
+ workspaceSlug: result.data.workspaceSlug,
16622
+ timeOfGenerationMin: toOffsetIso(start),
16623
+ timeOfGenerationMax: toOffsetIso(end)
16624
+ }
16619
16625
  };
16620
16626
  }
16621
16627
 
16622
16628
  // src/ai-gateway/telemetry-client.ts
16623
16629
  var nonBlankString = z54.string().min(1).refine((value2) => value2.trim().length > 0);
16624
- var groupOptionsSchema = telemetryWindowSchema.extend({
16625
- columns: z54.array(z54.enum(AI_GW_GROUP_COLUMNS)).optional()
16626
- }).strict();
16627
16630
  var logsOptionsSchema = telemetryWindowSchema.extend({
16628
16631
  pageSize: z54.number().int().nonnegative().safe().optional(),
16629
16632
  traceId: nonBlankString.optional(),
@@ -16645,8 +16648,12 @@ function validChartBounds(opts) {
16645
16648
  }
16646
16649
  var AIGatewayChartFiltersSchema = z54.object(chartFilterFields).strict().refine(validChartBounds);
16647
16650
  var filteredChartOptionsSchema = telemetryWindowSchema.extend(chartFilterFields).strict().refine(validChartBounds);
16648
- function serializeChartOptions(tsgId, opts) {
16649
- const params = serializeWindow(tsgId, opts, filteredChartOptionsSchema);
16651
+ var groupOptionsSchema = telemetryWindowSchema.extend({
16652
+ ...chartFilterFields,
16653
+ columns: z54.array(z54.enum(AI_GW_GROUP_COLUMNS)).optional()
16654
+ }).strict().refine(validChartBounds);
16655
+ function serializeFilteredOptions(tsgId, input, schema = filteredChartOptionsSchema) {
16656
+ const { params, options: opts } = serializeWindowWithOptions(tsgId, input, schema);
16650
16657
  if (opts.traceId !== void 0) params.traceId = opts.traceId;
16651
16658
  if (opts.metadata !== void 0) params.metadata = JSON.stringify(opts.metadata);
16652
16659
  if (opts.statusCodes !== void 0) params.statusCode = opts.statusCodes.join(",");
@@ -16655,6 +16662,7 @@ function serializeChartOptions(tsgId, opts) {
16655
16662
  for (const key of ["totalUnitsMin", "totalUnitsMax", "costMin", "costMax"]) {
16656
16663
  if (opts[key] !== void 0) params[key] = String(opts[key]);
16657
16664
  }
16665
+ if (opts.columns?.length) params.columns = opts.columns.join(",");
16658
16666
  return params;
16659
16667
  }
16660
16668
  var AIGatewayTelemetryClient = class {
@@ -16698,7 +16706,7 @@ var AIGatewayTelemetryClient = class {
16698
16706
  "cost",
16699
16707
  opts,
16700
16708
  CostChartResponseSchema,
16701
- serializeChartOptions(this.tsgId, opts)
16709
+ serializeFilteredOptions(this.tsgId, opts)
16702
16710
  );
16703
16711
  }
16704
16712
  /**
@@ -16719,7 +16727,7 @@ var AIGatewayTelemetryClient = class {
16719
16727
  "requests",
16720
16728
  opts,
16721
16729
  CountChartResponseSchema,
16722
- serializeChartOptions(this.tsgId, opts)
16730
+ serializeFilteredOptions(this.tsgId, opts)
16723
16731
  );
16724
16732
  }
16725
16733
  /**
@@ -16741,7 +16749,7 @@ var AIGatewayTelemetryClient = class {
16741
16749
  "latency",
16742
16750
  opts,
16743
16751
  LatencyChartResponseSchema,
16744
- serializeChartOptions(this.tsgId, opts)
16752
+ serializeFilteredOptions(this.tsgId, opts)
16745
16753
  );
16746
16754
  }
16747
16755
  /**
@@ -16762,7 +16770,7 @@ var AIGatewayTelemetryClient = class {
16762
16770
  "tokens",
16763
16771
  opts,
16764
16772
  TokensChartResponseSchema,
16765
- serializeChartOptions(this.tsgId, opts)
16773
+ serializeFilteredOptions(this.tsgId, opts)
16766
16774
  );
16767
16775
  }
16768
16776
  /**
@@ -16946,7 +16954,7 @@ var AIGatewayTelemetryClient = class {
16946
16954
  /**
16947
16955
  * Aggregate requests by a dimension.
16948
16956
  * @param dimension - One of {@link AI_GW_GROUP_DIMENSIONS}. Underscore names only.
16949
- * @param opts - Window plus optional extra columns.
16957
+ * @param opts - Window, verified trace/metadata/list/range filters, and optional extra columns.
16950
16958
  * @returns One row per distinct dimension value.
16951
16959
  * @example
16952
16960
  * ```ts
@@ -16966,8 +16974,7 @@ var AIGatewayTelemetryClient = class {
16966
16974
  "Invalid telemetry grouping dimension",
16967
16975
  "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
16968
16976
  );
16969
- const params = serializeWindow(this.tsgId, opts, groupOptionsSchema);
16970
- if (opts.columns?.length) params.columns = opts.columns.join(",");
16977
+ const params = serializeFilteredOptions(this.tsgId, opts, groupOptionsSchema);
16971
16978
  return request({
16972
16979
  method: "GET",
16973
16980
  baseUrl: this.baseUrl,
@@ -16980,7 +16987,7 @@ var AIGatewayTelemetryClient = class {
16980
16987
  }
16981
16988
  /**
16982
16989
  * Requests and cost per end user.
16983
- * @param opts - Workspace slug and time window.
16990
+ * @param opts - Workspace slug, time window and verified trace/metadata/list/range filters.
16984
16991
  * @returns One record per user; `_user: ''` means calls with no end-user id. Costs in cents.
16985
16992
  * @example
16986
16993
  * ```ts
@@ -16996,7 +17003,7 @@ var AIGatewayTelemetryClient = class {
16996
17003
  method: "GET",
16997
17004
  baseUrl: this.baseUrl,
16998
17005
  path: `${AI_GW_GROUPS_PATH}/users`,
16999
- params: serializeWindow(this.tsgId, opts),
17006
+ params: serializeFilteredOptions(this.tsgId, opts),
17000
17007
  responseSchema: UserGroupResponseSchema,
17001
17008
  auth: this.auth,
17002
17009
  numRetries: this.numRetries
@@ -17004,7 +17011,7 @@ var AIGatewayTelemetryClient = class {
17004
17011
  }
17005
17012
  /**
17006
17013
  * Requests grouped by HTTP status code.
17007
- * @param opts - Window plus optional extra columns.
17014
+ * @param opts - Window, verified trace/metadata/list/range filters, and optional extra columns.
17008
17015
  * @returns One row per status. **446 = AIRS security block** (cost 0, never reached the LLM).
17009
17016
  * @example
17010
17017
  * ```ts
@@ -17019,8 +17026,7 @@ var AIGatewayTelemetryClient = class {
17019
17026
  * ```
17020
17027
  */
17021
17028
  async byStatusCode(opts) {
17022
- const params = serializeWindow(this.tsgId, opts, groupOptionsSchema);
17023
- if (opts.columns?.length) params.columns = opts.columns.join(",");
17029
+ const params = serializeFilteredOptions(this.tsgId, opts, groupOptionsSchema);
17024
17030
  return request({
17025
17031
  method: "GET",
17026
17032
  baseUrl: this.baseUrl,
@@ -17055,10 +17061,14 @@ var AIGatewayTelemetryClient = class {
17055
17061
  * ```
17056
17062
  */
17057
17063
  async logs(opts) {
17058
- const params = serializeWindow(this.tsgId, opts, logsOptionsSchema);
17059
- if (opts.pageSize !== void 0) params.pageSize = String(opts.pageSize);
17060
- if (opts.traceId !== void 0) params.traceId = opts.traceId;
17061
- if (opts.statusCode !== void 0) params.statusCode = String(opts.statusCode);
17064
+ const { params, options: validated } = serializeWindowWithOptions(
17065
+ this.tsgId,
17066
+ opts,
17067
+ logsOptionsSchema
17068
+ );
17069
+ if (validated.pageSize !== void 0) params.pageSize = String(validated.pageSize);
17070
+ if (validated.traceId !== void 0) params.traceId = validated.traceId;
17071
+ if (validated.statusCode !== void 0) params.statusCode = String(validated.statusCode);
17062
17072
  return request({
17063
17073
  method: "GET",
17064
17074
  baseUrl: this.baseUrl,