@cdot65/prisma-airs-sdk 0.13.2 → 0.14.1
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 +46 -2
- package/dist/index.cjs +2537 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11281 -2687
- package/dist/index.d.ts +11281 -2687
- package/dist/index.js +2448 -21
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
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.
|
|
32
|
+
var SDK_VERSION = "0.14.1";
|
|
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";
|
|
@@ -112,6 +112,55 @@ var RED_TEAM_CUSTOM_ATTACK_PATH = "/v1/custom-attack";
|
|
|
112
112
|
var RED_TEAM_MGMT_DASHBOARD_PATH = "/v1/dashboard/overview";
|
|
113
113
|
var RED_TEAM_CHANNELS_PATH = "/v1/channels";
|
|
114
114
|
var RED_TEAM_CHANNELS_STATS_PATH = "/v1/channels/stats";
|
|
115
|
+
var DEFAULT_AI_GW_DATA_ENDPOINT = "https://api.apps.paloaltonetworks.com/ai_gw/v2";
|
|
116
|
+
var DEFAULT_AI_GW_ADMIN_ENDPOINT = "https://api.apps.paloaltonetworks.com/ai_gw/admin/v2";
|
|
117
|
+
var AI_GW_DATA_ENDPOINT = "PANW_AI_GW_DATA_ENDPOINT";
|
|
118
|
+
var AI_GW_ADMIN_ENDPOINT = "PANW_AI_GW_ADMIN_ENDPOINT";
|
|
119
|
+
var TSG_ID_HEADER = "x-tsg-id";
|
|
120
|
+
var AI_GW_WORKSPACES_PATH = "/workspaces";
|
|
121
|
+
var AI_GW_CONFIGS_PATH = "/configs";
|
|
122
|
+
var AI_GW_GUARDRAILS_PATH = "/guardrails";
|
|
123
|
+
var AI_GW_PROVIDERS_PATH = "/providers";
|
|
124
|
+
var AI_GW_API_KEYS_SERVICE_PATH = "/api-keys/service";
|
|
125
|
+
var AI_GW_API_KEYS_USER_PATH = "/api-keys/user";
|
|
126
|
+
var AI_GW_LOGS_PATH = "/logs";
|
|
127
|
+
var AI_GW_CHARTS_PATH = "/logs/charts";
|
|
128
|
+
var AI_GW_GROUPS_PATH = "/logs/groups";
|
|
129
|
+
var AI_GW_INTEGRATIONS_PATH = "/integrations";
|
|
130
|
+
var AI_GW_MCP_INTEGRATIONS_PATH = "/mcp-integrations";
|
|
131
|
+
var AI_GW_DEPLOYMENTS_PATH = "/deployments";
|
|
132
|
+
var AI_GW_PLUGINS_PATH = "/plugins";
|
|
133
|
+
var AI_GW_ORGANISATIONS_SELF_PATH = "/organisations/self";
|
|
134
|
+
var AI_GW_AUDIT_LOGS_PATH = "/audit-logs";
|
|
135
|
+
function aiGwOrganisationsAuthSettingsPath(tsgId) {
|
|
136
|
+
return `/organisations/${tsgId}/auth-settings`;
|
|
137
|
+
}
|
|
138
|
+
var AI_GW_CHART_METRICS = [
|
|
139
|
+
"cost",
|
|
140
|
+
"requests",
|
|
141
|
+
"latency",
|
|
142
|
+
"tokens",
|
|
143
|
+
"errors",
|
|
144
|
+
"users",
|
|
145
|
+
"cache-summary",
|
|
146
|
+
"cache-hit-trend",
|
|
147
|
+
"user-trends",
|
|
148
|
+
"error-trends",
|
|
149
|
+
"rescued-retries",
|
|
150
|
+
"feedback-trend",
|
|
151
|
+
"feedback-weighted",
|
|
152
|
+
"feedback-score-distribution",
|
|
153
|
+
"feedback-models"
|
|
154
|
+
];
|
|
155
|
+
var AI_GW_GROUP_DIMENSIONS = ["ai_service", "model", "api_key", "provider"];
|
|
156
|
+
var AI_GW_GROUP_COLUMNS = [
|
|
157
|
+
"cost",
|
|
158
|
+
"avg_latency",
|
|
159
|
+
"avg_tokens",
|
|
160
|
+
"total_tokens",
|
|
161
|
+
"success_rate",
|
|
162
|
+
"last_seen"
|
|
163
|
+
];
|
|
115
164
|
|
|
116
165
|
// src/errors.ts
|
|
117
166
|
var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
|
|
@@ -274,7 +323,10 @@ function classifyErrorType(status) {
|
|
|
274
323
|
function extractErrorMessage(body, status) {
|
|
275
324
|
try {
|
|
276
325
|
const parsed = JSON.parse(body);
|
|
277
|
-
|
|
326
|
+
const data = parsed.data;
|
|
327
|
+
const code = data?.errorCode ?? void 0;
|
|
328
|
+
const base = parsed.error_message ?? parsed.message ?? data?.message ?? parsed.error?.message ?? parsed.msg ?? `API error ${status}`;
|
|
329
|
+
return code ? `${base} (errorCode: ${code})` : base;
|
|
278
330
|
} catch {
|
|
279
331
|
return body ? `API error ${status}: ${body}` : `API error ${status}`;
|
|
280
332
|
}
|
|
@@ -3963,6 +4015,469 @@ var ChannelStatsSchema = z34.object({
|
|
|
3963
4015
|
client_version: z34.string().nullable().optional()
|
|
3964
4016
|
}).passthrough();
|
|
3965
4017
|
|
|
4018
|
+
// src/models/ai-gateway.ts
|
|
4019
|
+
import { z as z35 } from "zod";
|
|
4020
|
+
var aiGatewayEnvelope = (data) => z35.object({ success: z35.boolean(), data }).passthrough();
|
|
4021
|
+
var aiGatewayList = (item) => z35.object({
|
|
4022
|
+
object: z35.string(),
|
|
4023
|
+
total: z35.number(),
|
|
4024
|
+
has_more: z35.boolean().optional(),
|
|
4025
|
+
data: z35.array(item)
|
|
4026
|
+
}).passthrough();
|
|
4027
|
+
var aiGatewayGroupList = (item) => z35.object({
|
|
4028
|
+
object: z35.string(),
|
|
4029
|
+
is_quota_exceeded: z35.boolean(),
|
|
4030
|
+
total: z35.number(),
|
|
4031
|
+
data: z35.array(item)
|
|
4032
|
+
}).passthrough();
|
|
4033
|
+
var quotaFlag = { isQuotaExceeded: z35.boolean() };
|
|
4034
|
+
var GatewayChartRecordSchema = z35.object({ x: z35.string(), y: z35.number(), avg: z35.number().optional() }).passthrough();
|
|
4035
|
+
var CostChartResponseSchema = aiGatewayEnvelope(
|
|
4036
|
+
z35.object({
|
|
4037
|
+
records: z35.array(GatewayChartRecordSchema),
|
|
4038
|
+
total: z35.number(),
|
|
4039
|
+
avg: z35.number(),
|
|
4040
|
+
...quotaFlag
|
|
4041
|
+
}).passthrough()
|
|
4042
|
+
);
|
|
4043
|
+
var CountChartResponseSchema = aiGatewayEnvelope(
|
|
4044
|
+
z35.object({
|
|
4045
|
+
records: z35.array(GatewayChartRecordSchema),
|
|
4046
|
+
total: z35.number().nullable(),
|
|
4047
|
+
...quotaFlag
|
|
4048
|
+
}).passthrough()
|
|
4049
|
+
);
|
|
4050
|
+
var LatencyChartResponseSchema = aiGatewayEnvelope(
|
|
4051
|
+
z35.object({
|
|
4052
|
+
records: z35.array(
|
|
4053
|
+
z35.object({
|
|
4054
|
+
x: z35.string(),
|
|
4055
|
+
y: z35.number(),
|
|
4056
|
+
p50: z35.number(),
|
|
4057
|
+
p90: z35.number(),
|
|
4058
|
+
p99: z35.number()
|
|
4059
|
+
}).passthrough()
|
|
4060
|
+
),
|
|
4061
|
+
total: z35.number(),
|
|
4062
|
+
p50: z35.number(),
|
|
4063
|
+
p90: z35.number(),
|
|
4064
|
+
p99: z35.number(),
|
|
4065
|
+
...quotaFlag
|
|
4066
|
+
}).passthrough()
|
|
4067
|
+
);
|
|
4068
|
+
var TokensChartResponseSchema = aiGatewayEnvelope(
|
|
4069
|
+
z35.object({
|
|
4070
|
+
records: z35.array(
|
|
4071
|
+
z35.object({
|
|
4072
|
+
x: z35.string(),
|
|
4073
|
+
y: z35.number(),
|
|
4074
|
+
total_request_units: z35.number(),
|
|
4075
|
+
total_response_units: z35.number(),
|
|
4076
|
+
avg: z35.number()
|
|
4077
|
+
}).passthrough()
|
|
4078
|
+
),
|
|
4079
|
+
total: z35.number(),
|
|
4080
|
+
avg: z35.number(),
|
|
4081
|
+
total_request_units: z35.number(),
|
|
4082
|
+
total_response_units: z35.number(),
|
|
4083
|
+
...quotaFlag
|
|
4084
|
+
}).passthrough()
|
|
4085
|
+
);
|
|
4086
|
+
var CacheSummaryResponseSchema = aiGatewayEnvelope(
|
|
4087
|
+
z35.object({
|
|
4088
|
+
summary: z35.object({
|
|
4089
|
+
cacheHits: z35.number(),
|
|
4090
|
+
avgCacheLatency: z35.number().nullable(),
|
|
4091
|
+
totalRequests: z35.number(),
|
|
4092
|
+
cacheSpeedup: z35.number()
|
|
4093
|
+
}).passthrough(),
|
|
4094
|
+
...quotaFlag
|
|
4095
|
+
}).passthrough()
|
|
4096
|
+
);
|
|
4097
|
+
var CacheHitTrendResponseSchema = aiGatewayEnvelope(
|
|
4098
|
+
z35.object({
|
|
4099
|
+
trend: z35.array(
|
|
4100
|
+
z35.object({
|
|
4101
|
+
x: z35.string(),
|
|
4102
|
+
simpleHits: z35.number(),
|
|
4103
|
+
semanticHits: z35.number(),
|
|
4104
|
+
hitRate: z35.number(),
|
|
4105
|
+
cumulativeSimpleHitSavings: z35.number(),
|
|
4106
|
+
cumulativeSemanticHitSavings: z35.number()
|
|
4107
|
+
}).passthrough()
|
|
4108
|
+
),
|
|
4109
|
+
total: z35.number(),
|
|
4110
|
+
summary: z35.object({ totalCacheHits: z35.number(), hitRate: z35.number() }).passthrough(),
|
|
4111
|
+
...quotaFlag
|
|
4112
|
+
}).passthrough()
|
|
4113
|
+
);
|
|
4114
|
+
var UserTrendsResponseSchema = aiGatewayEnvelope(
|
|
4115
|
+
z35.object({
|
|
4116
|
+
summary: z35.object({ total: z35.number(), unique: z35.number(), avg: z35.number() }).passthrough(),
|
|
4117
|
+
trend: z35.array(GatewayChartRecordSchema),
|
|
4118
|
+
...quotaFlag
|
|
4119
|
+
}).passthrough()
|
|
4120
|
+
);
|
|
4121
|
+
var ErrorTrendsResponseSchema = aiGatewayEnvelope(
|
|
4122
|
+
z35.object({
|
|
4123
|
+
summary: z35.object({ errorPercent: z35.number() }).passthrough(),
|
|
4124
|
+
trend: z35.array(GatewayChartRecordSchema),
|
|
4125
|
+
...quotaFlag
|
|
4126
|
+
}).passthrough()
|
|
4127
|
+
);
|
|
4128
|
+
var RescuedRetriesResponseSchema = aiGatewayEnvelope(
|
|
4129
|
+
z35.object({
|
|
4130
|
+
trend: z35.array(
|
|
4131
|
+
z35.object({
|
|
4132
|
+
x: z35.string(),
|
|
4133
|
+
// Element shape unobserved — sample tenants only ever produced an empty array.
|
|
4134
|
+
// Treated like the sibling trends[].retry/fallback below until a tenant with
|
|
4135
|
+
// actual gateway retries lets us confirm the real shape. See open questions in
|
|
4136
|
+
// PRD-ai-gateway-client.md.
|
|
4137
|
+
y: z35.array(z35.unknown())
|
|
4138
|
+
}).passthrough()
|
|
4139
|
+
),
|
|
4140
|
+
total: z35.number(),
|
|
4141
|
+
trends: z35.array(
|
|
4142
|
+
z35.object({ x: z35.string(), retry: z35.array(z35.unknown()), fallback: z35.array(z35.unknown()) }).passthrough()
|
|
4143
|
+
),
|
|
4144
|
+
retryTotal: z35.number(),
|
|
4145
|
+
fallbackTotal: z35.number(),
|
|
4146
|
+
...quotaFlag
|
|
4147
|
+
}).passthrough()
|
|
4148
|
+
);
|
|
4149
|
+
var FeedbackScoreDistributionResponseSchema = aiGatewayEnvelope(
|
|
4150
|
+
z35.object({
|
|
4151
|
+
records: z35.array(z35.object({ x: z35.number(), y: z35.number() }).passthrough()),
|
|
4152
|
+
total: z35.number().nullable(),
|
|
4153
|
+
...quotaFlag
|
|
4154
|
+
}).passthrough()
|
|
4155
|
+
);
|
|
4156
|
+
var FeedbackModelsResponseSchema = aiGatewayEnvelope(
|
|
4157
|
+
z35.object({
|
|
4158
|
+
records: z35.array(
|
|
4159
|
+
z35.object({
|
|
4160
|
+
x: z35.string(),
|
|
4161
|
+
y: z35.object({ avgWeightedFeedback: z35.number(), feedbackCount: z35.number() }).passthrough()
|
|
4162
|
+
}).passthrough()
|
|
4163
|
+
),
|
|
4164
|
+
...quotaFlag
|
|
4165
|
+
}).passthrough()
|
|
4166
|
+
);
|
|
4167
|
+
var GatewayGroupRowSchema = z35.object({
|
|
4168
|
+
requests: z35.number(),
|
|
4169
|
+
cost: z35.number().optional(),
|
|
4170
|
+
avg_latency: z35.number().optional(),
|
|
4171
|
+
avg_tokens: z35.number().optional(),
|
|
4172
|
+
total_tokens: z35.number().optional(),
|
|
4173
|
+
success_rate: z35.number().optional(),
|
|
4174
|
+
last_seen: z35.string().optional(),
|
|
4175
|
+
object: z35.string()
|
|
4176
|
+
}).passthrough();
|
|
4177
|
+
var GroupListResponseSchema = aiGatewayGroupList(GatewayGroupRowSchema);
|
|
4178
|
+
var UserGroupResponseSchema = aiGatewayEnvelope(
|
|
4179
|
+
z35.object({
|
|
4180
|
+
records: z35.array(
|
|
4181
|
+
z35.object({ _user: z35.string(), count: z35.number(), cost: z35.number() }).passthrough()
|
|
4182
|
+
),
|
|
4183
|
+
total: z35.number(),
|
|
4184
|
+
...quotaFlag
|
|
4185
|
+
}).passthrough()
|
|
4186
|
+
);
|
|
4187
|
+
var GatewayLogRecordSchema = z35.object({
|
|
4188
|
+
id: z35.string(),
|
|
4189
|
+
workspace_slug: z35.string(),
|
|
4190
|
+
ai_model: z35.string(),
|
|
4191
|
+
_user: z35.string(),
|
|
4192
|
+
total_units: z35.number(),
|
|
4193
|
+
/** Cents. */
|
|
4194
|
+
cost: z35.number(),
|
|
4195
|
+
trace_id: z35.string(),
|
|
4196
|
+
/** 0/1, not boolean. */
|
|
4197
|
+
is_proxy_call: z35.number(),
|
|
4198
|
+
created_at: z35.string(),
|
|
4199
|
+
/** 0/1, not boolean. */
|
|
4200
|
+
is_success: z35.number(),
|
|
4201
|
+
/** `HIT` | `MISS` | `DISABLED`. */
|
|
4202
|
+
cache_status: z35.string(),
|
|
4203
|
+
retry_success_count: z35.number(),
|
|
4204
|
+
mode: z35.string(),
|
|
4205
|
+
last_used_option_index: z35.number(),
|
|
4206
|
+
/** 200 success, 446 AIRS security block (cost 0), 400 validation. */
|
|
4207
|
+
response_status_code: z35.number(),
|
|
4208
|
+
request_url: z35.string(),
|
|
4209
|
+
request_method: z35.string(),
|
|
4210
|
+
ai_org: z35.string(),
|
|
4211
|
+
api_key_id: z35.string(),
|
|
4212
|
+
license_id: z35.string(),
|
|
4213
|
+
log_store_file_path_format: z35.string(),
|
|
4214
|
+
metadataKey: z35.array(z35.string()),
|
|
4215
|
+
metadataValue: z35.array(z35.string()),
|
|
4216
|
+
prompt_slug: z35.string(),
|
|
4217
|
+
feedback: z35.array(z35.unknown())
|
|
4218
|
+
}).passthrough();
|
|
4219
|
+
var GatewayLogsResponseSchema = aiGatewayEnvelope(
|
|
4220
|
+
z35.object({
|
|
4221
|
+
records: z35.array(GatewayLogRecordSchema),
|
|
4222
|
+
total: z35.number(),
|
|
4223
|
+
capturedTotal: z35.number(),
|
|
4224
|
+
...quotaFlag
|
|
4225
|
+
}).passthrough()
|
|
4226
|
+
);
|
|
4227
|
+
var GatewayWriteResponseSchema = z35.object({}).passthrough();
|
|
4228
|
+
var GatewayWorkspaceSchema = z35.object({
|
|
4229
|
+
id: z35.string(),
|
|
4230
|
+
slug: z35.string(),
|
|
4231
|
+
name: z35.string(),
|
|
4232
|
+
icon: z35.string().nullable(),
|
|
4233
|
+
description: z35.string(),
|
|
4234
|
+
created_at: z35.string(),
|
|
4235
|
+
last_updated_at: z35.string(),
|
|
4236
|
+
is_default: z35.number(),
|
|
4237
|
+
status: z35.string(),
|
|
4238
|
+
scope_name: z35.string(),
|
|
4239
|
+
object: z35.string()
|
|
4240
|
+
}).passthrough();
|
|
4241
|
+
var GatewayWorkspaceDetailSchema = z35.object({
|
|
4242
|
+
id: z35.string(),
|
|
4243
|
+
name: z35.string(),
|
|
4244
|
+
description: z35.string(),
|
|
4245
|
+
created_at: z35.string(),
|
|
4246
|
+
last_updated_at: z35.string(),
|
|
4247
|
+
is_default: z35.number(),
|
|
4248
|
+
slug: z35.string(),
|
|
4249
|
+
icon: z35.string().nullable(),
|
|
4250
|
+
defaults: z35.record(z35.unknown()).nullable(),
|
|
4251
|
+
usage_limits: z35.record(z35.unknown()).nullable(),
|
|
4252
|
+
rate_limits: z35.record(z35.unknown()).nullable(),
|
|
4253
|
+
security_settings: z35.record(z35.boolean()).optional(),
|
|
4254
|
+
data_plane_security_settings: z35.record(z35.unknown()).optional(),
|
|
4255
|
+
settings: z35.record(z35.unknown()).optional()
|
|
4256
|
+
}).passthrough();
|
|
4257
|
+
var ListWorkspacesResponseSchema = aiGatewayList(GatewayWorkspaceSchema);
|
|
4258
|
+
var GatewayConfigSchema = z35.object({
|
|
4259
|
+
id: z35.string(),
|
|
4260
|
+
name: z35.string(),
|
|
4261
|
+
slug: z35.string(),
|
|
4262
|
+
/** Internal organisation UUID — NOT the TSG that write requests take. */
|
|
4263
|
+
organisation_id: z35.string(),
|
|
4264
|
+
is_default: z35.number(),
|
|
4265
|
+
status: z35.string(),
|
|
4266
|
+
owner_id: z35.string(),
|
|
4267
|
+
updated_by: z35.string(),
|
|
4268
|
+
created_at: z35.string(),
|
|
4269
|
+
last_updated_at: z35.string(),
|
|
4270
|
+
workspace_id: z35.string(),
|
|
4271
|
+
object: z35.string()
|
|
4272
|
+
}).passthrough();
|
|
4273
|
+
var ListConfigsResponseSchema = aiGatewayList(GatewayConfigSchema);
|
|
4274
|
+
var GatewayConfigDetailSchema = GatewayConfigSchema.extend({
|
|
4275
|
+
config: z35.string(),
|
|
4276
|
+
format: z35.string(),
|
|
4277
|
+
type: z35.string(),
|
|
4278
|
+
version_id: z35.string()
|
|
4279
|
+
}).passthrough();
|
|
4280
|
+
var GatewayConfigCreateResponseSchema = z35.object({
|
|
4281
|
+
id: z35.string(),
|
|
4282
|
+
version_id: z35.string(),
|
|
4283
|
+
slug: z35.string(),
|
|
4284
|
+
object: z35.string()
|
|
4285
|
+
}).passthrough();
|
|
4286
|
+
var GatewayGuardrailSchema = z35.object({
|
|
4287
|
+
id: z35.string(),
|
|
4288
|
+
name: z35.string(),
|
|
4289
|
+
slug: z35.string(),
|
|
4290
|
+
organisation_id: z35.string(),
|
|
4291
|
+
status: z35.string(),
|
|
4292
|
+
owner_id: z35.string(),
|
|
4293
|
+
updated_by: z35.string().nullable(),
|
|
4294
|
+
created_at: z35.string(),
|
|
4295
|
+
last_updated_at: z35.string(),
|
|
4296
|
+
workspace_id: z35.string(),
|
|
4297
|
+
object: z35.string()
|
|
4298
|
+
}).passthrough();
|
|
4299
|
+
var ListGuardrailsResponseSchema = aiGatewayList(GatewayGuardrailSchema);
|
|
4300
|
+
var guardrailFeedbackActionSchema = z35.object({
|
|
4301
|
+
feedback: z35.object({ value: z35.number(), weight: z35.number(), metadata: z35.string() }).passthrough()
|
|
4302
|
+
}).passthrough();
|
|
4303
|
+
var GatewayGuardrailDetailSchema = GatewayGuardrailSchema.extend({
|
|
4304
|
+
checks: z35.array(
|
|
4305
|
+
z35.object({
|
|
4306
|
+
/** e.g. `panw-prisma-airs.intercept`, the Prisma AIRS intercept check. */
|
|
4307
|
+
id: z35.string(),
|
|
4308
|
+
parameters: z35.record(z35.unknown()),
|
|
4309
|
+
is_enabled: z35.boolean()
|
|
4310
|
+
}).passthrough()
|
|
4311
|
+
),
|
|
4312
|
+
actions: z35.object({
|
|
4313
|
+
deny: z35.boolean(),
|
|
4314
|
+
async: z35.boolean(),
|
|
4315
|
+
sequential: z35.boolean(),
|
|
4316
|
+
/** Absent when the guardrail was created without a pass/fail feedback action. */
|
|
4317
|
+
on_success: guardrailFeedbackActionSchema.optional(),
|
|
4318
|
+
on_fail: guardrailFeedbackActionSchema.optional()
|
|
4319
|
+
}).passthrough(),
|
|
4320
|
+
version_id: z35.string()
|
|
4321
|
+
}).passthrough();
|
|
4322
|
+
var GatewayGuardrailCreateResponseSchema = z35.object({
|
|
4323
|
+
id: z35.string(),
|
|
4324
|
+
version_id: z35.string(),
|
|
4325
|
+
slug: z35.string(),
|
|
4326
|
+
object: z35.string()
|
|
4327
|
+
}).passthrough();
|
|
4328
|
+
var GatewayProviderSchema = z35.object({
|
|
4329
|
+
id: z35.string(),
|
|
4330
|
+
name: z35.string().optional(),
|
|
4331
|
+
slug: z35.string().optional(),
|
|
4332
|
+
object: z35.string().optional()
|
|
4333
|
+
}).passthrough();
|
|
4334
|
+
var ListProvidersResponseSchema = aiGatewayList(GatewayProviderSchema);
|
|
4335
|
+
var GatewayProviderCreateResponseSchema = z35.object({
|
|
4336
|
+
id: z35.string(),
|
|
4337
|
+
slug: z35.string(),
|
|
4338
|
+
object: z35.string()
|
|
4339
|
+
}).passthrough();
|
|
4340
|
+
var GatewayApiKeySchema = z35.object({
|
|
4341
|
+
id: z35.string(),
|
|
4342
|
+
name: z35.string().optional(),
|
|
4343
|
+
object: z35.string().optional()
|
|
4344
|
+
}).passthrough();
|
|
4345
|
+
var ListApiKeysResponseSchema = aiGatewayList(GatewayApiKeySchema);
|
|
4346
|
+
var GatewayIntegrationSchema = z35.object({
|
|
4347
|
+
id: z35.string(),
|
|
4348
|
+
organisation_id: z35.string().optional(),
|
|
4349
|
+
name: z35.string(),
|
|
4350
|
+
owner_id: z35.string(),
|
|
4351
|
+
status: z35.string(),
|
|
4352
|
+
created_at: z35.string(),
|
|
4353
|
+
last_updated_at: z35.string(),
|
|
4354
|
+
slug: z35.string(),
|
|
4355
|
+
tags: z35.unknown().nullable(),
|
|
4356
|
+
description: z35.string().nullable(),
|
|
4357
|
+
workspaces_count: z35.number().optional(),
|
|
4358
|
+
type: z35.string().optional(),
|
|
4359
|
+
workspace_id: z35.string().nullable(),
|
|
4360
|
+
ai_provider_id: z35.string(),
|
|
4361
|
+
object: z35.string()
|
|
4362
|
+
}).passthrough();
|
|
4363
|
+
var ListIntegrationsResponseSchema = aiGatewayList(GatewayIntegrationSchema);
|
|
4364
|
+
var GatewayIntegrationModelsResponseSchema = z35.object({
|
|
4365
|
+
models: z35.array(z35.object({ slug: z35.string(), enabled: z35.boolean() }).passthrough()),
|
|
4366
|
+
allow_all_models: z35.boolean(),
|
|
4367
|
+
object: z35.string()
|
|
4368
|
+
}).passthrough();
|
|
4369
|
+
var GatewayIntegrationWorkspaceSchema = z35.object({
|
|
4370
|
+
id: z35.string(),
|
|
4371
|
+
usage_limits: z35.record(z35.unknown()).nullable(),
|
|
4372
|
+
rate_limits: z35.record(z35.unknown()).nullable(),
|
|
4373
|
+
enabled: z35.boolean(),
|
|
4374
|
+
status: z35.string(),
|
|
4375
|
+
created_at: z35.string(),
|
|
4376
|
+
last_updated_at: z35.string(),
|
|
4377
|
+
last_reset_at: z35.string().nullable()
|
|
4378
|
+
}).passthrough();
|
|
4379
|
+
var GatewayGlobalWorkspaceAccessSchema = z35.object({
|
|
4380
|
+
enabled: z35.boolean(),
|
|
4381
|
+
rate_limits: z35.record(z35.unknown()).nullable(),
|
|
4382
|
+
usage_limits: z35.record(z35.unknown()).nullable()
|
|
4383
|
+
}).passthrough();
|
|
4384
|
+
var GatewayIntegrationWorkspacesResponseSchema = z35.object({
|
|
4385
|
+
workspaces: z35.array(GatewayIntegrationWorkspaceSchema),
|
|
4386
|
+
global_workspace_access: GatewayGlobalWorkspaceAccessSchema,
|
|
4387
|
+
object: z35.string()
|
|
4388
|
+
}).passthrough();
|
|
4389
|
+
var McpIntegrationSchema = z35.object({
|
|
4390
|
+
id: z35.string(),
|
|
4391
|
+
organisation_id: z35.string(),
|
|
4392
|
+
name: z35.string(),
|
|
4393
|
+
owner_id: z35.string(),
|
|
4394
|
+
status: z35.string(),
|
|
4395
|
+
type: z35.string(),
|
|
4396
|
+
url: z35.string(),
|
|
4397
|
+
auth_type: z35.string(),
|
|
4398
|
+
transport: z35.string(),
|
|
4399
|
+
/**
|
|
4400
|
+
* JSON-encoded STRING on reads — the same request/response asymmetry as
|
|
4401
|
+
* `configs.config` (see {@link GatewayConfigDetailSchema}). The CREATE request
|
|
4402
|
+
* (`McpIntegrationCreateRequest.configurations`) sends an object; this is the read shape.
|
|
4403
|
+
*/
|
|
4404
|
+
configurations: z35.string(),
|
|
4405
|
+
created_at: z35.string(),
|
|
4406
|
+
last_updated_at: z35.string()
|
|
4407
|
+
}).passthrough();
|
|
4408
|
+
var ListMcpIntegrationsResponseSchema = aiGatewayList(McpIntegrationSchema);
|
|
4409
|
+
var GatewayDeploymentSchema = z35.object({
|
|
4410
|
+
id: z35.string(),
|
|
4411
|
+
name: z35.string(),
|
|
4412
|
+
slug: z35.string(),
|
|
4413
|
+
type: z35.string(),
|
|
4414
|
+
/** `active` | `archived`. DELETE archives rather than removes. */
|
|
4415
|
+
status: z35.string(),
|
|
4416
|
+
created_at: z35.string(),
|
|
4417
|
+
last_updated_at: z35.string(),
|
|
4418
|
+
last_synced_at: z35.string().nullable(),
|
|
4419
|
+
last_resynced_at: z35.string().nullable(),
|
|
4420
|
+
is_default: z35.number(),
|
|
4421
|
+
created_by: z35.string(),
|
|
4422
|
+
object: z35.string()
|
|
4423
|
+
}).passthrough();
|
|
4424
|
+
var GatewayDeploymentDetailSchema = GatewayDeploymentSchema.extend({
|
|
4425
|
+
credentials: z35.object({ username: z35.string(), password: z35.string() }).passthrough().optional(),
|
|
4426
|
+
deployment_config: z35.record(z35.unknown()).nullable(),
|
|
4427
|
+
auth_settings: z35.object({
|
|
4428
|
+
/** 0/1, not boolean — the create REQUEST sends a real boolean here. */
|
|
4429
|
+
disable_portkey_gateway: z35.number(),
|
|
4430
|
+
workspaces_allowed: z35.array(z35.string()),
|
|
4431
|
+
allow_all_workspaces: z35.number()
|
|
4432
|
+
}).passthrough().optional(),
|
|
4433
|
+
client_auth: z35.string().optional(),
|
|
4434
|
+
workspaces: z35.array(z35.object({ id: z35.string(), slug: z35.string() }).passthrough()).optional()
|
|
4435
|
+
}).passthrough();
|
|
4436
|
+
var GatewayDeploymentCreateResponseSchema = z35.object({
|
|
4437
|
+
id: z35.string(),
|
|
4438
|
+
client_auth: z35.string(),
|
|
4439
|
+
credentials: z35.object({ username: z35.string(), password: z35.string() }).passthrough(),
|
|
4440
|
+
/** Internal organisation UUID — NOT the TSG sent in the request. */
|
|
4441
|
+
organisation_id: z35.string(),
|
|
4442
|
+
object: z35.string()
|
|
4443
|
+
}).passthrough();
|
|
4444
|
+
var ListDeploymentsResponseSchema = aiGatewayList(GatewayDeploymentSchema);
|
|
4445
|
+
var GatewayPluginSchema = z35.object({
|
|
4446
|
+
id: z35.string(),
|
|
4447
|
+
integration_id: z35.string(),
|
|
4448
|
+
credentials: z35.record(z35.string()),
|
|
4449
|
+
owner_id: z35.string(),
|
|
4450
|
+
created_at: z35.string(),
|
|
4451
|
+
last_updated_at: z35.string(),
|
|
4452
|
+
status: z35.string(),
|
|
4453
|
+
integration_slug: z35.string(),
|
|
4454
|
+
plugin_provider_id: z35.string(),
|
|
4455
|
+
plugin_provider_slug: z35.string(),
|
|
4456
|
+
object: z35.string()
|
|
4457
|
+
}).passthrough();
|
|
4458
|
+
var ListPluginsResponseSchema = aiGatewayList(GatewayPluginSchema);
|
|
4459
|
+
var OrganisationSelfResponseSchema = z35.object({ success: z35.boolean(), data: z35.record(z35.unknown()) }).passthrough();
|
|
4460
|
+
var AuthSettingsResponseSchema = z35.object({ success: z35.boolean(), data: z35.record(z35.unknown()) }).passthrough();
|
|
4461
|
+
var GatewayAuditLogRecordSchema = z35.object({
|
|
4462
|
+
timestamp: z35.string(),
|
|
4463
|
+
method: z35.string(),
|
|
4464
|
+
uri: z35.string(),
|
|
4465
|
+
request_id: z35.string(),
|
|
4466
|
+
request_body: z35.string(),
|
|
4467
|
+
query_params: z35.string(),
|
|
4468
|
+
request_headers: z35.string(),
|
|
4469
|
+
user_id: z35.string(),
|
|
4470
|
+
user_type: z35.string(),
|
|
4471
|
+
organisation_id: z35.string(),
|
|
4472
|
+
workspace_id: z35.string(),
|
|
4473
|
+
response_status_code: z35.number(),
|
|
4474
|
+
resource_type: z35.string(),
|
|
4475
|
+
action: z35.string(),
|
|
4476
|
+
client_ip: z35.string(),
|
|
4477
|
+
country: z35.string()
|
|
4478
|
+
}).passthrough();
|
|
4479
|
+
var GatewayAuditLogsResponseSchema = z35.object({ records: z35.array(GatewayAuditLogRecordSchema) }).passthrough();
|
|
4480
|
+
|
|
3966
4481
|
// src/http/auth/oauth.ts
|
|
3967
4482
|
var OAuthAuth = class {
|
|
3968
4483
|
constructor(oauthClient) {
|
|
@@ -3985,12 +4500,12 @@ var OAuthAuth = class {
|
|
|
3985
4500
|
};
|
|
3986
4501
|
|
|
3987
4502
|
// src/models/oauth-token.ts
|
|
3988
|
-
import { z as
|
|
3989
|
-
var OAuthTokenResponseSchema =
|
|
3990
|
-
access_token:
|
|
3991
|
-
token_type:
|
|
3992
|
-
expires_in:
|
|
3993
|
-
scope:
|
|
4503
|
+
import { z as z36 } from "zod";
|
|
4504
|
+
var OAuthTokenResponseSchema = z36.object({
|
|
4505
|
+
access_token: z36.string(),
|
|
4506
|
+
token_type: z36.string().optional(),
|
|
4507
|
+
expires_in: z36.number(),
|
|
4508
|
+
scope: z36.string().optional()
|
|
3994
4509
|
}).passthrough();
|
|
3995
4510
|
|
|
3996
4511
|
// src/management/oauth-client.ts
|
|
@@ -4216,6 +4731,14 @@ function assertUuid(value, fieldName) {
|
|
|
4216
4731
|
);
|
|
4217
4732
|
}
|
|
4218
4733
|
}
|
|
4734
|
+
function assertNumericId(value, fieldName) {
|
|
4735
|
+
if (!/^\d+$/.test(value)) {
|
|
4736
|
+
throw new AISecSDKException(
|
|
4737
|
+
`Invalid ${fieldName}: ${value}`,
|
|
4738
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
4739
|
+
);
|
|
4740
|
+
}
|
|
4741
|
+
}
|
|
4219
4742
|
|
|
4220
4743
|
// src/management/profiles.ts
|
|
4221
4744
|
var ProfilesClient = class {
|
|
@@ -4975,7 +5498,7 @@ var ScanLogsClient = class {
|
|
|
4975
5498
|
};
|
|
4976
5499
|
|
|
4977
5500
|
// src/management/oauth-management.ts
|
|
4978
|
-
import { z as
|
|
5501
|
+
import { z as z37 } from "zod";
|
|
4979
5502
|
var OAuthManagementClient = class {
|
|
4980
5503
|
baseUrl;
|
|
4981
5504
|
auth;
|
|
@@ -5009,7 +5532,7 @@ var OAuthManagementClient = class {
|
|
|
5009
5532
|
path: MGMT_OAUTH_INVALIDATE_PATH,
|
|
5010
5533
|
params: { token },
|
|
5011
5534
|
body,
|
|
5012
|
-
responseSchema:
|
|
5535
|
+
responseSchema: z37.string(),
|
|
5013
5536
|
auth: this.auth,
|
|
5014
5537
|
numRetries: this.numRetries
|
|
5015
5538
|
});
|
|
@@ -6870,7 +7393,7 @@ var ModelSecurityClient = class {
|
|
|
6870
7393
|
};
|
|
6871
7394
|
|
|
6872
7395
|
// src/red-team/scans-client.ts
|
|
6873
|
-
import { z as
|
|
7396
|
+
import { z as z38 } from "zod";
|
|
6874
7397
|
var RedTeamScansClient = class {
|
|
6875
7398
|
baseUrl;
|
|
6876
7399
|
auth;
|
|
@@ -7007,7 +7530,7 @@ var RedTeamScansClient = class {
|
|
|
7007
7530
|
method: "GET",
|
|
7008
7531
|
baseUrl: this.baseUrl,
|
|
7009
7532
|
path: RED_TEAM_CATEGORIES_PATH,
|
|
7010
|
-
responseSchema:
|
|
7533
|
+
responseSchema: z38.array(CategoryModelSchema),
|
|
7011
7534
|
auth: this.auth,
|
|
7012
7535
|
numRetries: this.numRetries
|
|
7013
7536
|
});
|
|
@@ -7015,7 +7538,7 @@ var RedTeamScansClient = class {
|
|
|
7015
7538
|
};
|
|
7016
7539
|
|
|
7017
7540
|
// src/red-team/reports-client.ts
|
|
7018
|
-
import { z as
|
|
7541
|
+
import { z as z39 } from "zod";
|
|
7019
7542
|
var RedTeamReportsClient = class {
|
|
7020
7543
|
baseUrl;
|
|
7021
7544
|
auth;
|
|
@@ -7390,7 +7913,7 @@ var RedTeamReportsClient = class {
|
|
|
7390
7913
|
baseUrl: this.baseUrl,
|
|
7391
7914
|
path: `${RED_TEAM_REPORT_PATH}/${jobId}/download`,
|
|
7392
7915
|
params: { file_format: format },
|
|
7393
|
-
responseSchema:
|
|
7916
|
+
responseSchema: z39.unknown(),
|
|
7394
7917
|
auth: this.auth,
|
|
7395
7918
|
numRetries: this.numRetries
|
|
7396
7919
|
});
|
|
@@ -7414,7 +7937,7 @@ var RedTeamReportsClient = class {
|
|
|
7414
7937
|
method: "POST",
|
|
7415
7938
|
baseUrl: this.baseUrl,
|
|
7416
7939
|
path: `${RED_TEAM_REPORT_PATH}/${jobId}/generate-partial-report`,
|
|
7417
|
-
responseSchema:
|
|
7940
|
+
responseSchema: z39.unknown(),
|
|
7418
7941
|
auth: this.auth,
|
|
7419
7942
|
numRetries: this.numRetries
|
|
7420
7943
|
});
|
|
@@ -7422,7 +7945,7 @@ var RedTeamReportsClient = class {
|
|
|
7422
7945
|
};
|
|
7423
7946
|
|
|
7424
7947
|
// src/red-team/custom-attack-reports-client.ts
|
|
7425
|
-
import { z as
|
|
7948
|
+
import { z as z40 } from "zod";
|
|
7426
7949
|
var RedTeamCustomAttackReportsClient = class {
|
|
7427
7950
|
baseUrl;
|
|
7428
7951
|
auth;
|
|
@@ -7512,7 +8035,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
7512
8035
|
baseUrl: this.baseUrl,
|
|
7513
8036
|
path: `${RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH}/report/${jobId}/prompt-set/${promptSetId}/prompts`,
|
|
7514
8037
|
params,
|
|
7515
|
-
responseSchema:
|
|
8038
|
+
responseSchema: z40.array(PromptDetailResponseSchema),
|
|
7516
8039
|
auth: this.auth,
|
|
7517
8040
|
numRetries: this.numRetries
|
|
7518
8041
|
});
|
|
@@ -7606,7 +8129,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
7606
8129
|
method: "GET",
|
|
7607
8130
|
baseUrl: this.baseUrl,
|
|
7608
8131
|
path: `${RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH}/job/${jobId}/attack/${attackId}/list-outputs`,
|
|
7609
|
-
responseSchema:
|
|
8132
|
+
responseSchema: z40.array(CustomAttackOutputSchema),
|
|
7610
8133
|
auth: this.auth,
|
|
7611
8134
|
numRetries: this.numRetries
|
|
7612
8135
|
});
|
|
@@ -7631,7 +8154,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
7631
8154
|
method: "GET",
|
|
7632
8155
|
baseUrl: this.baseUrl,
|
|
7633
8156
|
path: `${RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH}/job/${jobId}/property-stats`,
|
|
7634
|
-
responseSchema:
|
|
8157
|
+
responseSchema: z40.array(PropertyStatisticSchema),
|
|
7635
8158
|
auth: this.auth,
|
|
7636
8159
|
numRetries: this.numRetries
|
|
7637
8160
|
});
|
|
@@ -7639,7 +8162,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
7639
8162
|
};
|
|
7640
8163
|
|
|
7641
8164
|
// src/red-team/targets-client.ts
|
|
7642
|
-
import { z as
|
|
8165
|
+
import { z as z41 } from "zod";
|
|
7643
8166
|
var RedTeamTargetsClient = class {
|
|
7644
8167
|
baseUrl;
|
|
7645
8168
|
auth;
|
|
@@ -7932,7 +8455,7 @@ var RedTeamTargetsClient = class {
|
|
|
7932
8455
|
method: "GET",
|
|
7933
8456
|
baseUrl: this.baseUrl,
|
|
7934
8457
|
path: `${RED_TEAM_TEMPLATE_PATH}/target-metadata`,
|
|
7935
|
-
responseSchema:
|
|
8458
|
+
responseSchema: z41.record(z41.unknown()),
|
|
7936
8459
|
auth: this.auth,
|
|
7937
8460
|
numRetries: this.numRetries
|
|
7938
8461
|
});
|
|
@@ -9355,9 +9878,1857 @@ var RedTeamClient = class {
|
|
|
9355
9878
|
});
|
|
9356
9879
|
}
|
|
9357
9880
|
};
|
|
9881
|
+
|
|
9882
|
+
// src/http/auth/tsg-header.ts
|
|
9883
|
+
var TsgHeaderAuth = class {
|
|
9884
|
+
constructor(inner, tsgId) {
|
|
9885
|
+
this.inner = inner;
|
|
9886
|
+
this.tsgId = tsgId;
|
|
9887
|
+
}
|
|
9888
|
+
async prepare(req) {
|
|
9889
|
+
const prepared = await this.inner.prepare(req);
|
|
9890
|
+
return {
|
|
9891
|
+
...prepared,
|
|
9892
|
+
headers: { ...prepared.headers, [TSG_ID_HEADER]: this.tsgId }
|
|
9893
|
+
};
|
|
9894
|
+
}
|
|
9895
|
+
async onUnauthorized(res) {
|
|
9896
|
+
return await this.inner.onUnauthorized?.(res) ?? false;
|
|
9897
|
+
}
|
|
9898
|
+
};
|
|
9899
|
+
|
|
9900
|
+
// src/ai-gateway/window.ts
|
|
9901
|
+
function toOffsetIso(d) {
|
|
9902
|
+
const pad = (n) => String(Math.floor(Math.abs(n))).padStart(2, "0");
|
|
9903
|
+
const offsetMin = -d.getTimezoneOffset();
|
|
9904
|
+
const sign = offsetMin >= 0 ? "+" : "-";
|
|
9905
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}${sign}${pad(offsetMin / 60)}:${pad(offsetMin % 60)}`;
|
|
9906
|
+
}
|
|
9907
|
+
function serializeWindow(tsgId, opts) {
|
|
9908
|
+
const end = opts.end ?? /* @__PURE__ */ new Date();
|
|
9909
|
+
const start = opts.start ?? new Date(end.getTime() - (opts.days ?? 7) * 864e5);
|
|
9910
|
+
return {
|
|
9911
|
+
organisationId: tsgId,
|
|
9912
|
+
workspaceSlug: opts.workspaceSlug,
|
|
9913
|
+
timeOfGenerationMin: toOffsetIso(start),
|
|
9914
|
+
timeOfGenerationMax: toOffsetIso(end)
|
|
9915
|
+
};
|
|
9916
|
+
}
|
|
9917
|
+
|
|
9918
|
+
// src/ai-gateway/telemetry-client.ts
|
|
9919
|
+
var AIGatewayTelemetryClient = class {
|
|
9920
|
+
baseUrl;
|
|
9921
|
+
auth;
|
|
9922
|
+
numRetries;
|
|
9923
|
+
tsgId;
|
|
9924
|
+
constructor(opts) {
|
|
9925
|
+
this.baseUrl = opts.baseUrl;
|
|
9926
|
+
this.auth = opts.auth;
|
|
9927
|
+
this.numRetries = opts.numRetries;
|
|
9928
|
+
this.tsgId = opts.tsgId;
|
|
9929
|
+
}
|
|
9930
|
+
/** @internal Shared GET for every `logs/charts/*` endpoint. */
|
|
9931
|
+
chart(metric, opts, schema) {
|
|
9932
|
+
return request({
|
|
9933
|
+
method: "GET",
|
|
9934
|
+
baseUrl: this.baseUrl,
|
|
9935
|
+
path: `${AI_GW_CHARTS_PATH}/${metric}`,
|
|
9936
|
+
params: serializeWindow(this.tsgId, opts),
|
|
9937
|
+
responseSchema: schema,
|
|
9938
|
+
auth: this.auth,
|
|
9939
|
+
numRetries: this.numRetries
|
|
9940
|
+
});
|
|
9941
|
+
}
|
|
9942
|
+
/**
|
|
9943
|
+
* Total and per-day spend. **Values are in cents.**
|
|
9944
|
+
* @param opts - Workspace slug and time window.
|
|
9945
|
+
* @returns Cost series plus the period total, in cents.
|
|
9946
|
+
* @example
|
|
9947
|
+
* ```ts
|
|
9948
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
9949
|
+
* const gw = new AIGatewayClient();
|
|
9950
|
+
*
|
|
9951
|
+
* const cost = await gw.telemetry.cost({ workspaceSlug: 'ws-main-a-349e0e', days: 7 });
|
|
9952
|
+
* console.log(`$${(cost.data.total / 100).toFixed(2)}`); // => "$4110.83"
|
|
9953
|
+
* ```
|
|
9954
|
+
*/
|
|
9955
|
+
async cost(opts) {
|
|
9956
|
+
return this.chart("cost", opts, CostChartResponseSchema);
|
|
9957
|
+
}
|
|
9958
|
+
/**
|
|
9959
|
+
* Per-day request counts.
|
|
9960
|
+
* @param opts - Workspace slug and time window.
|
|
9961
|
+
* @returns Request-count series plus the period total.
|
|
9962
|
+
* @example
|
|
9963
|
+
* ```ts
|
|
9964
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
9965
|
+
* const gw = new AIGatewayClient();
|
|
9966
|
+
*
|
|
9967
|
+
* const r = await gw.telemetry.requests({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
9968
|
+
* // r.data.total => 25746
|
|
9969
|
+
* ```
|
|
9970
|
+
*/
|
|
9971
|
+
async requests(opts) {
|
|
9972
|
+
return this.chart("requests", opts, CountChartResponseSchema);
|
|
9973
|
+
}
|
|
9974
|
+
/**
|
|
9975
|
+
* Latency in milliseconds. Percentiles are returned per-bucket and for the period.
|
|
9976
|
+
* @param opts - Workspace slug and time window.
|
|
9977
|
+
* @returns Latency series with p50/p90/p99; `data.total` is the period mean, not a sum.
|
|
9978
|
+
* @example
|
|
9979
|
+
* ```ts
|
|
9980
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
9981
|
+
* const gw = new AIGatewayClient();
|
|
9982
|
+
*
|
|
9983
|
+
* const l = await gw.telemetry.latency({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
9984
|
+
* // l.data.p99 => 8329.14
|
|
9985
|
+
* ```
|
|
9986
|
+
*/
|
|
9987
|
+
async latency(opts) {
|
|
9988
|
+
return this.chart("latency", opts, LatencyChartResponseSchema);
|
|
9989
|
+
}
|
|
9990
|
+
/**
|
|
9991
|
+
* Token usage, split into request and response units.
|
|
9992
|
+
* @param opts - Workspace slug and time window.
|
|
9993
|
+
* @returns Token series plus request/response unit totals.
|
|
9994
|
+
* @example
|
|
9995
|
+
* ```ts
|
|
9996
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
9997
|
+
* const gw = new AIGatewayClient();
|
|
9998
|
+
*
|
|
9999
|
+
* const t = await gw.telemetry.tokens({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10000
|
+
* // t.data.total_request_units => 4919015459
|
|
10001
|
+
* ```
|
|
10002
|
+
*/
|
|
10003
|
+
async tokens(opts) {
|
|
10004
|
+
return this.chart("tokens", opts, TokensChartResponseSchema);
|
|
10005
|
+
}
|
|
10006
|
+
/**
|
|
10007
|
+
* Per-day error counts.
|
|
10008
|
+
* @param opts - Workspace slug and time window.
|
|
10009
|
+
* @returns Error-count series plus the period total.
|
|
10010
|
+
* @example
|
|
10011
|
+
* ```ts
|
|
10012
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10013
|
+
* const gw = new AIGatewayClient();
|
|
10014
|
+
*
|
|
10015
|
+
* const e = await gw.telemetry.errors({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10016
|
+
* // e.data.total => 125
|
|
10017
|
+
* ```
|
|
10018
|
+
*/
|
|
10019
|
+
async errors(opts) {
|
|
10020
|
+
return this.chart("errors", opts, CountChartResponseSchema);
|
|
10021
|
+
}
|
|
10022
|
+
/**
|
|
10023
|
+
* Per-day distinct end-user counts.
|
|
10024
|
+
* @param opts - Workspace slug and time window.
|
|
10025
|
+
* @returns Unique-user series plus the period total.
|
|
10026
|
+
* @example
|
|
10027
|
+
* ```ts
|
|
10028
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10029
|
+
* const gw = new AIGatewayClient();
|
|
10030
|
+
*
|
|
10031
|
+
* const u = await gw.telemetry.users({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10032
|
+
* // u.data.total => 1
|
|
10033
|
+
* ```
|
|
10034
|
+
*/
|
|
10035
|
+
async users(opts) {
|
|
10036
|
+
return this.chart("users", opts, CountChartResponseSchema);
|
|
10037
|
+
}
|
|
10038
|
+
/**
|
|
10039
|
+
* Cache hit count, speedup, and average cached-response latency.
|
|
10040
|
+
* @param opts - Workspace slug and time window.
|
|
10041
|
+
* @returns Cache summary; `avgCacheLatency` is null when there were no hits.
|
|
10042
|
+
* @example
|
|
10043
|
+
* ```ts
|
|
10044
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10045
|
+
* const gw = new AIGatewayClient();
|
|
10046
|
+
*
|
|
10047
|
+
* const c = await gw.telemetry.cacheSummary({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10048
|
+
* // c.data.summary => { cacheHits: 0, avgCacheLatency: null, totalRequests: 25621, cacheSpeedup: 0 }
|
|
10049
|
+
* ```
|
|
10050
|
+
*/
|
|
10051
|
+
async cacheSummary(opts) {
|
|
10052
|
+
return this.chart("cache-summary", opts, CacheSummaryResponseSchema);
|
|
10053
|
+
}
|
|
10054
|
+
/**
|
|
10055
|
+
* Cache hit-rate trend and cumulative savings.
|
|
10056
|
+
* @param opts - Workspace slug and time window.
|
|
10057
|
+
* @returns Per-bucket hits and **cumulative** savings in cents — the last non-zero bucket is the period total.
|
|
10058
|
+
* @example
|
|
10059
|
+
* ```ts
|
|
10060
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10061
|
+
* const gw = new AIGatewayClient();
|
|
10062
|
+
*
|
|
10063
|
+
* const t = await gw.telemetry.cacheHitTrend({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10064
|
+
* const last = t.data.trend.at(-1);
|
|
10065
|
+
* const savedUsd = ((last?.cumulativeSimpleHitSavings ?? 0) + (last?.cumulativeSemanticHitSavings ?? 0)) / 100;
|
|
10066
|
+
* ```
|
|
10067
|
+
*/
|
|
10068
|
+
async cacheHitTrend(opts) {
|
|
10069
|
+
return this.chart("cache-hit-trend", opts, CacheHitTrendResponseSchema);
|
|
10070
|
+
}
|
|
10071
|
+
/**
|
|
10072
|
+
* Requests-per-user trend.
|
|
10073
|
+
* @param opts - Workspace slug and time window.
|
|
10074
|
+
* @returns Daily request counts plus `summary.avg` (requests per user).
|
|
10075
|
+
* @example
|
|
10076
|
+
* ```ts
|
|
10077
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10078
|
+
* const gw = new AIGatewayClient();
|
|
10079
|
+
*
|
|
10080
|
+
* const t = await gw.telemetry.userTrends({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10081
|
+
* // t.data.summary => { total: 25748, unique: 1, avg: 25748 }
|
|
10082
|
+
* ```
|
|
10083
|
+
*/
|
|
10084
|
+
async userTrends(opts) {
|
|
10085
|
+
return this.chart("user-trends", opts, UserTrendsResponseSchema);
|
|
10086
|
+
}
|
|
10087
|
+
/**
|
|
10088
|
+
* Error-rate trend as a percentage.
|
|
10089
|
+
* @param opts - Workspace slug and time window.
|
|
10090
|
+
* @returns Daily error percentages plus `summary.errorPercent` for the period.
|
|
10091
|
+
* @example
|
|
10092
|
+
* ```ts
|
|
10093
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10094
|
+
* const gw = new AIGatewayClient();
|
|
10095
|
+
*
|
|
10096
|
+
* const t = await gw.telemetry.errorTrends({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10097
|
+
* // t.data.summary.errorPercent => 0.485
|
|
10098
|
+
* ```
|
|
10099
|
+
*/
|
|
10100
|
+
async errorTrends(opts) {
|
|
10101
|
+
return this.chart("error-trends", opts, ErrorTrendsResponseSchema);
|
|
10102
|
+
}
|
|
10103
|
+
/**
|
|
10104
|
+
* Gateway auto-retry and fallback resilience. Sparse — only populated on upstream failures.
|
|
10105
|
+
* @param opts - Workspace slug and time window.
|
|
10106
|
+
* @returns Retry/fallback trends; note `trend[].y` is an **array**, not a scalar.
|
|
10107
|
+
* @example
|
|
10108
|
+
* ```ts
|
|
10109
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10110
|
+
* const gw = new AIGatewayClient();
|
|
10111
|
+
*
|
|
10112
|
+
* const r = await gw.telemetry.rescuedRetries({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10113
|
+
* // r.data.retryTotal => 0
|
|
10114
|
+
* ```
|
|
10115
|
+
*/
|
|
10116
|
+
async rescuedRetries(opts) {
|
|
10117
|
+
return this.chart("rescued-retries", opts, RescuedRetriesResponseSchema);
|
|
10118
|
+
}
|
|
10119
|
+
/**
|
|
10120
|
+
* Daily count of feedback submissions.
|
|
10121
|
+
* @param opts - Workspace slug and time window.
|
|
10122
|
+
* @returns Feedback-count series plus the period total.
|
|
10123
|
+
* @example
|
|
10124
|
+
* ```ts
|
|
10125
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10126
|
+
* const gw = new AIGatewayClient();
|
|
10127
|
+
*
|
|
10128
|
+
* const f = await gw.telemetry.feedbackTrend({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10129
|
+
* // f.data.total => 61
|
|
10130
|
+
* ```
|
|
10131
|
+
*/
|
|
10132
|
+
async feedbackTrend(opts) {
|
|
10133
|
+
return this.chart("feedback-trend", opts, CountChartResponseSchema);
|
|
10134
|
+
}
|
|
10135
|
+
/**
|
|
10136
|
+
* Weighted average feedback score, averaged over days.
|
|
10137
|
+
* @param opts - Workspace slug and time window.
|
|
10138
|
+
* @returns Weighted score series; `data.total` is null when there is no feedback.
|
|
10139
|
+
* @example
|
|
10140
|
+
* ```ts
|
|
10141
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10142
|
+
* const gw = new AIGatewayClient();
|
|
10143
|
+
*
|
|
10144
|
+
* const f = await gw.telemetry.feedbackWeighted({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10145
|
+
* // f.data.total => -2.58
|
|
10146
|
+
* ```
|
|
10147
|
+
*/
|
|
10148
|
+
async feedbackWeighted(opts) {
|
|
10149
|
+
return this.chart("feedback-weighted", opts, CountChartResponseSchema);
|
|
10150
|
+
}
|
|
10151
|
+
/**
|
|
10152
|
+
* Distribution of feedback scores. Feedback is binary: +5 (thumbs up) or -5 (thumbs down).
|
|
10153
|
+
* @param opts - Workspace slug and time window.
|
|
10154
|
+
* @returns Score histogram as `{x: score, y: count}` records.
|
|
10155
|
+
* @example
|
|
10156
|
+
* ```ts
|
|
10157
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10158
|
+
* const gw = new AIGatewayClient();
|
|
10159
|
+
*
|
|
10160
|
+
* const d = await gw.telemetry.feedbackScoreDistribution({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10161
|
+
* // d.data.records => [{ x: 5, y: 30 }, { x: -5, y: 33 }]
|
|
10162
|
+
* ```
|
|
10163
|
+
*/
|
|
10164
|
+
async feedbackScoreDistribution(opts) {
|
|
10165
|
+
return this.chart("feedback-score-distribution", opts, FeedbackScoreDistributionResponseSchema);
|
|
10166
|
+
}
|
|
10167
|
+
/**
|
|
10168
|
+
* Feedback broken down by AI model.
|
|
10169
|
+
* @param opts - Workspace slug and time window.
|
|
10170
|
+
* @returns Records where `x` is the model and `y` is an object, not a number.
|
|
10171
|
+
* @example
|
|
10172
|
+
* ```ts
|
|
10173
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10174
|
+
* const gw = new AIGatewayClient();
|
|
10175
|
+
*
|
|
10176
|
+
* const m = await gw.telemetry.feedbackModels({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10177
|
+
* // m.data.records[0] => { x: 'claude-sonnet-5', y: { avgWeightedFeedback: 4.2, feedbackCount: 12 } }
|
|
10178
|
+
* ```
|
|
10179
|
+
*/
|
|
10180
|
+
async feedbackModels(opts) {
|
|
10181
|
+
return this.chart("feedback-models", opts, FeedbackModelsResponseSchema);
|
|
10182
|
+
}
|
|
10183
|
+
/**
|
|
10184
|
+
* Aggregate requests by a dimension.
|
|
10185
|
+
* @param dimension - One of {@link AI_GW_GROUP_DIMENSIONS}. Underscore names only.
|
|
10186
|
+
* @param opts - Window plus optional extra columns.
|
|
10187
|
+
* @returns One row per distinct dimension value.
|
|
10188
|
+
* @example
|
|
10189
|
+
* ```ts
|
|
10190
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10191
|
+
* const gw = new AIGatewayClient();
|
|
10192
|
+
*
|
|
10193
|
+
* const byModel = await gw.telemetry.groupBy('model', {
|
|
10194
|
+
* workspaceSlug: 'ws-main-a-349e0e',
|
|
10195
|
+
* columns: ['cost', 'total_tokens'],
|
|
10196
|
+
* });
|
|
10197
|
+
* // byModel.data[0] => { model: 'claude-sonnet-5', requests: 10506, cost: 29704.16, ... }
|
|
10198
|
+
* ```
|
|
10199
|
+
*/
|
|
10200
|
+
async groupBy(dimension, opts) {
|
|
10201
|
+
const params = serializeWindow(this.tsgId, opts);
|
|
10202
|
+
if (opts.columns?.length) params.columns = opts.columns.join(",");
|
|
10203
|
+
return request({
|
|
10204
|
+
method: "GET",
|
|
10205
|
+
baseUrl: this.baseUrl,
|
|
10206
|
+
path: `${AI_GW_GROUPS_PATH}/${dimension}`,
|
|
10207
|
+
params,
|
|
10208
|
+
responseSchema: GroupListResponseSchema,
|
|
10209
|
+
auth: this.auth,
|
|
10210
|
+
numRetries: this.numRetries
|
|
10211
|
+
});
|
|
10212
|
+
}
|
|
10213
|
+
/**
|
|
10214
|
+
* Requests and cost per end user.
|
|
10215
|
+
* @param opts - Workspace slug and time window.
|
|
10216
|
+
* @returns One record per user; `_user: ''` means calls with no end-user id. Costs in cents.
|
|
10217
|
+
* @example
|
|
10218
|
+
* ```ts
|
|
10219
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10220
|
+
* const gw = new AIGatewayClient();
|
|
10221
|
+
*
|
|
10222
|
+
* const users = await gw.telemetry.byUser({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10223
|
+
* // users.data.records[0] => { _user: '', count: 25748, cost: 411060.85 }
|
|
10224
|
+
* ```
|
|
10225
|
+
*/
|
|
10226
|
+
async byUser(opts) {
|
|
10227
|
+
return request({
|
|
10228
|
+
method: "GET",
|
|
10229
|
+
baseUrl: this.baseUrl,
|
|
10230
|
+
path: `${AI_GW_GROUPS_PATH}/users`,
|
|
10231
|
+
params: serializeWindow(this.tsgId, opts),
|
|
10232
|
+
responseSchema: UserGroupResponseSchema,
|
|
10233
|
+
auth: this.auth,
|
|
10234
|
+
numRetries: this.numRetries
|
|
10235
|
+
});
|
|
10236
|
+
}
|
|
10237
|
+
/**
|
|
10238
|
+
* Requests grouped by HTTP status code.
|
|
10239
|
+
* @param opts - Window plus optional extra columns.
|
|
10240
|
+
* @returns One row per status. **446 = AIRS security block** (cost 0, never reached the LLM).
|
|
10241
|
+
* @example
|
|
10242
|
+
* ```ts
|
|
10243
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10244
|
+
* const gw = new AIGatewayClient();
|
|
10245
|
+
*
|
|
10246
|
+
* const codes = await gw.telemetry.byStatusCode({
|
|
10247
|
+
* workspaceSlug: 'ws-main-a-349e0e',
|
|
10248
|
+
* columns: ['cost', 'avg_latency'],
|
|
10249
|
+
* });
|
|
10250
|
+
* // codes.data => [{ status_code: 200, requests: 25623, ... }, { status_code: 446, ... }]
|
|
10251
|
+
* ```
|
|
10252
|
+
*/
|
|
10253
|
+
async byStatusCode(opts) {
|
|
10254
|
+
const params = serializeWindow(this.tsgId, opts);
|
|
10255
|
+
if (opts.columns?.length) params.columns = opts.columns.join(",");
|
|
10256
|
+
return request({
|
|
10257
|
+
method: "GET",
|
|
10258
|
+
baseUrl: this.baseUrl,
|
|
10259
|
+
path: `${AI_GW_GROUPS_PATH}/status_code`,
|
|
10260
|
+
params,
|
|
10261
|
+
responseSchema: GroupListResponseSchema,
|
|
10262
|
+
auth: this.auth,
|
|
10263
|
+
numRetries: this.numRetries
|
|
10264
|
+
});
|
|
10265
|
+
}
|
|
10266
|
+
/**
|
|
10267
|
+
* Raw per-request log rows — the deepest granularity this API offers.
|
|
10268
|
+
*
|
|
10269
|
+
* @remarks
|
|
10270
|
+
* Upstream pagination is broken: only `pageSize` works, and an unfiltered call always
|
|
10271
|
+
* returns the same most-recent batch (~50 rows) regardless of offset. To read beyond that,
|
|
10272
|
+
* filter by `statusCode`, which bypasses the cap and returns every match in the window.
|
|
10273
|
+
*
|
|
10274
|
+
* @param opts - Window plus `pageSize` / `traceId` / `statusCode` filters.
|
|
10275
|
+
* @returns Log records plus the full-period `total` (which you cannot page to).
|
|
10276
|
+
* @example
|
|
10277
|
+
* ```ts
|
|
10278
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10279
|
+
* const gw = new AIGatewayClient();
|
|
10280
|
+
*
|
|
10281
|
+
* // Every AIRS security block in the window, not just the most recent page.
|
|
10282
|
+
* const blocked = await gw.telemetry.logs({
|
|
10283
|
+
* workspaceSlug: 'ws-main-a-349e0e',
|
|
10284
|
+
* statusCode: 446,
|
|
10285
|
+
* });
|
|
10286
|
+
* // blocked.data.records[0] => { response_status_code: 446, cost: 0, is_success: 0, ... }
|
|
10287
|
+
* ```
|
|
10288
|
+
*/
|
|
10289
|
+
async logs(opts) {
|
|
10290
|
+
const params = serializeWindow(this.tsgId, opts);
|
|
10291
|
+
if (opts.pageSize !== void 0) params.pageSize = String(opts.pageSize);
|
|
10292
|
+
if (opts.traceId !== void 0) params.traceId = opts.traceId;
|
|
10293
|
+
if (opts.statusCode !== void 0) params.statusCode = String(opts.statusCode);
|
|
10294
|
+
return request({
|
|
10295
|
+
method: "GET",
|
|
10296
|
+
baseUrl: this.baseUrl,
|
|
10297
|
+
path: AI_GW_LOGS_PATH,
|
|
10298
|
+
params,
|
|
10299
|
+
responseSchema: GatewayLogsResponseSchema,
|
|
10300
|
+
auth: this.auth,
|
|
10301
|
+
numRetries: this.numRetries
|
|
10302
|
+
});
|
|
10303
|
+
}
|
|
10304
|
+
};
|
|
10305
|
+
|
|
10306
|
+
// src/ai-gateway/workspaces-client.ts
|
|
10307
|
+
var AIGatewayWorkspacesClient = class {
|
|
10308
|
+
baseUrl;
|
|
10309
|
+
auth;
|
|
10310
|
+
numRetries;
|
|
10311
|
+
constructor(opts) {
|
|
10312
|
+
this.baseUrl = opts.baseUrl;
|
|
10313
|
+
this.auth = opts.auth;
|
|
10314
|
+
this.numRetries = opts.numRetries;
|
|
10315
|
+
}
|
|
10316
|
+
/**
|
|
10317
|
+
* List workspaces visible to the caller.
|
|
10318
|
+
* @returns All workspaces, each with the `scope_name` that grants data-plane access to it.
|
|
10319
|
+
* @example
|
|
10320
|
+
* ```ts
|
|
10321
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10322
|
+
* const gw = new AIGatewayClient();
|
|
10323
|
+
*
|
|
10324
|
+
* const ws = await gw.workspaces.list();
|
|
10325
|
+
* // ws.data[0] => { slug: 'ws-main-a-349e0e', scope_name: 'main_airs_workspace_1852583913', ... }
|
|
10326
|
+
* ```
|
|
10327
|
+
*/
|
|
10328
|
+
async list() {
|
|
10329
|
+
return request({
|
|
10330
|
+
method: "GET",
|
|
10331
|
+
baseUrl: this.baseUrl,
|
|
10332
|
+
path: AI_GW_WORKSPACES_PATH,
|
|
10333
|
+
responseSchema: ListWorkspacesResponseSchema,
|
|
10334
|
+
auth: this.auth,
|
|
10335
|
+
numRetries: this.numRetries
|
|
10336
|
+
});
|
|
10337
|
+
}
|
|
10338
|
+
/**
|
|
10339
|
+
* Fetch one workspace, including its security and rate-limit settings.
|
|
10340
|
+
* @param workspaceId - Workspace UUID.
|
|
10341
|
+
* @returns Workspace detail; list rows do not carry the settings blocks.
|
|
10342
|
+
* @example
|
|
10343
|
+
* ```ts
|
|
10344
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10345
|
+
* const gw = new AIGatewayClient();
|
|
10346
|
+
*
|
|
10347
|
+
* const ws = await gw.workspaces.get('16f7e90d-382a-4e78-b577-1b01eb5f8297');
|
|
10348
|
+
* // ws.security_settings?.membersViewLogs => true
|
|
10349
|
+
* ```
|
|
10350
|
+
*/
|
|
10351
|
+
async get(workspaceId) {
|
|
10352
|
+
assertUuid(workspaceId, "workspaceId");
|
|
10353
|
+
return request({
|
|
10354
|
+
method: "GET",
|
|
10355
|
+
baseUrl: this.baseUrl,
|
|
10356
|
+
path: `${AI_GW_WORKSPACES_PATH}/${workspaceId}`,
|
|
10357
|
+
responseSchema: GatewayWorkspaceDetailSchema,
|
|
10358
|
+
auth: this.auth,
|
|
10359
|
+
numRetries: this.numRetries
|
|
10360
|
+
});
|
|
10361
|
+
}
|
|
10362
|
+
};
|
|
10363
|
+
|
|
10364
|
+
// src/ai-gateway/configs-client.ts
|
|
10365
|
+
var AIGatewayConfigsClient = class {
|
|
10366
|
+
baseUrl;
|
|
10367
|
+
auth;
|
|
10368
|
+
numRetries;
|
|
10369
|
+
constructor(opts) {
|
|
10370
|
+
this.baseUrl = opts.baseUrl;
|
|
10371
|
+
this.auth = opts.auth;
|
|
10372
|
+
this.numRetries = opts.numRetries;
|
|
10373
|
+
}
|
|
10374
|
+
/**
|
|
10375
|
+
* List configs in a workspace.
|
|
10376
|
+
*
|
|
10377
|
+
* @remarks
|
|
10378
|
+
* List rows are a strict 12-field subset of the detail read — they do NOT carry `config`,
|
|
10379
|
+
* `format`, `type`, or `version_id`. Call {@link get} for those.
|
|
10380
|
+
*
|
|
10381
|
+
* @param opts - Must include the workspace UUID.
|
|
10382
|
+
* @returns Config list rows.
|
|
10383
|
+
* @example
|
|
10384
|
+
* ```ts
|
|
10385
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10386
|
+
* const gw = new AIGatewayClient();
|
|
10387
|
+
*
|
|
10388
|
+
* const cfgs = await gw.configs.list({ workspaceId: '16f7e90d-382a-4e78-b577-1b01eb5f8297' });
|
|
10389
|
+
* // cfgs.data[0] => { name: 'claude-code', slug: 'pc-claude-e46fe6', status: 'active', ... }
|
|
10390
|
+
* ```
|
|
10391
|
+
*/
|
|
10392
|
+
async list(opts) {
|
|
10393
|
+
assertUuid(opts.workspaceId, "workspaceId");
|
|
10394
|
+
return request({
|
|
10395
|
+
method: "GET",
|
|
10396
|
+
baseUrl: this.baseUrl,
|
|
10397
|
+
path: AI_GW_CONFIGS_PATH,
|
|
10398
|
+
params: { workspace_id: opts.workspaceId },
|
|
10399
|
+
responseSchema: ListConfigsResponseSchema,
|
|
10400
|
+
auth: this.auth,
|
|
10401
|
+
numRetries: this.numRetries
|
|
10402
|
+
});
|
|
10403
|
+
}
|
|
10404
|
+
/**
|
|
10405
|
+
* Fetch one config.
|
|
10406
|
+
* @param configId - Config UUID.
|
|
10407
|
+
* @returns The config detail — adds `config` (a JSON-encoded string, not an object),
|
|
10408
|
+
* `format`, `type`, and `version_id` on top of the list row.
|
|
10409
|
+
* @example
|
|
10410
|
+
* ```ts
|
|
10411
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10412
|
+
* const gw = new AIGatewayClient();
|
|
10413
|
+
*
|
|
10414
|
+
* const cfg = await gw.configs.get('764cf9cd-4ebf-449e-b669-08149b0fbbbc');
|
|
10415
|
+
* const routing = JSON.parse(cfg.config) as Record<string, unknown>;
|
|
10416
|
+
* // routing.provider => '@anthropic-prod'
|
|
10417
|
+
* ```
|
|
10418
|
+
*/
|
|
10419
|
+
async get(configId) {
|
|
10420
|
+
assertUuid(configId, "configId");
|
|
10421
|
+
return request({
|
|
10422
|
+
method: "GET",
|
|
10423
|
+
baseUrl: this.baseUrl,
|
|
10424
|
+
path: `${AI_GW_CONFIGS_PATH}/${configId}`,
|
|
10425
|
+
responseSchema: GatewayConfigDetailSchema,
|
|
10426
|
+
auth: this.auth,
|
|
10427
|
+
numRetries: this.numRetries
|
|
10428
|
+
});
|
|
10429
|
+
}
|
|
10430
|
+
/**
|
|
10431
|
+
* Create a config.
|
|
10432
|
+
*
|
|
10433
|
+
* @remarks
|
|
10434
|
+
* The response is a **creation receipt** — `{ id, version_id, slug, object }` — not a
|
|
10435
|
+
* {@link GatewayConfigDetail}. Call {@link get} for the full record. Verified live
|
|
10436
|
+
* 2026-07-28.
|
|
10437
|
+
*
|
|
10438
|
+
* @param body - Name, workspace UUID, and the routing config object.
|
|
10439
|
+
* @returns The creation receipt.
|
|
10440
|
+
* @example
|
|
10441
|
+
* ```ts
|
|
10442
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10443
|
+
* const gw = new AIGatewayClient();
|
|
10444
|
+
*
|
|
10445
|
+
* const receipt = await gw.configs.create({
|
|
10446
|
+
* name: 'vertex-airs',
|
|
10447
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
10448
|
+
* config: { retry: { attempts: 3 }, cache: { mode: 'simple' } },
|
|
10449
|
+
* });
|
|
10450
|
+
* // receipt => { id: '...', version_id: '...', slug: 'pc-sdk-ve-14620d', object: 'config' }
|
|
10451
|
+
* ```
|
|
10452
|
+
*/
|
|
10453
|
+
async create(body) {
|
|
10454
|
+
assertUuid(body.workspace_id, "workspace_id");
|
|
10455
|
+
return request({
|
|
10456
|
+
method: "POST",
|
|
10457
|
+
baseUrl: this.baseUrl,
|
|
10458
|
+
path: AI_GW_CONFIGS_PATH,
|
|
10459
|
+
body,
|
|
10460
|
+
responseSchema: GatewayConfigCreateResponseSchema,
|
|
10461
|
+
auth: this.auth,
|
|
10462
|
+
numRetries: this.numRetries
|
|
10463
|
+
});
|
|
10464
|
+
}
|
|
10465
|
+
/**
|
|
10466
|
+
* Update a config.
|
|
10467
|
+
* @param configId - Config UUID.
|
|
10468
|
+
* @param body - Replacement fields.
|
|
10469
|
+
* @returns The raw update response. Shape unverified against a live tenant — see the PRD.
|
|
10470
|
+
* @example
|
|
10471
|
+
* ```ts
|
|
10472
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10473
|
+
* const gw = new AIGatewayClient();
|
|
10474
|
+
*
|
|
10475
|
+
* await gw.configs.update('764cf9cd-4ebf-449e-b669-08149b0fbbbc', {
|
|
10476
|
+
* name: 'claude-code',
|
|
10477
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
10478
|
+
* config: { retry: { attempts: 5 } },
|
|
10479
|
+
* });
|
|
10480
|
+
* ```
|
|
10481
|
+
*/
|
|
10482
|
+
async update(configId, body) {
|
|
10483
|
+
assertUuid(configId, "configId");
|
|
10484
|
+
assertUuid(body.workspace_id, "workspace_id");
|
|
10485
|
+
return request({
|
|
10486
|
+
method: "PUT",
|
|
10487
|
+
baseUrl: this.baseUrl,
|
|
10488
|
+
path: `${AI_GW_CONFIGS_PATH}/${configId}`,
|
|
10489
|
+
body,
|
|
10490
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
10491
|
+
auth: this.auth,
|
|
10492
|
+
numRetries: this.numRetries
|
|
10493
|
+
});
|
|
10494
|
+
}
|
|
10495
|
+
/**
|
|
10496
|
+
* Delete a config.
|
|
10497
|
+
*
|
|
10498
|
+
* @remarks
|
|
10499
|
+
* This is a **hard delete** — unlike {@link AIGatewayDeploymentsClient.delete | deployments.delete}
|
|
10500
|
+
* (which archives), the config disappears from {@link list} entirely. Verified live
|
|
10501
|
+
* 2026-07-28. No `organisation_id` query param is required, unlike deployments/integrations.
|
|
10502
|
+
*
|
|
10503
|
+
* @param configId - Config UUID.
|
|
10504
|
+
* @returns Nothing.
|
|
10505
|
+
* @example
|
|
10506
|
+
* ```ts
|
|
10507
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10508
|
+
* const gw = new AIGatewayClient();
|
|
10509
|
+
*
|
|
10510
|
+
* await gw.configs.delete('764cf9cd-4ebf-449e-b669-08149b0fbbbc');
|
|
10511
|
+
* // the config no longer appears in gw.configs.list()
|
|
10512
|
+
* ```
|
|
10513
|
+
*/
|
|
10514
|
+
async delete(configId) {
|
|
10515
|
+
assertUuid(configId, "configId");
|
|
10516
|
+
await request({
|
|
10517
|
+
method: "DELETE",
|
|
10518
|
+
baseUrl: this.baseUrl,
|
|
10519
|
+
path: `${AI_GW_CONFIGS_PATH}/${configId}`,
|
|
10520
|
+
auth: this.auth,
|
|
10521
|
+
numRetries: this.numRetries
|
|
10522
|
+
});
|
|
10523
|
+
}
|
|
10524
|
+
};
|
|
10525
|
+
|
|
10526
|
+
// src/ai-gateway/guardrails-client.ts
|
|
10527
|
+
var AIGatewayGuardrailsClient = class {
|
|
10528
|
+
baseUrl;
|
|
10529
|
+
auth;
|
|
10530
|
+
numRetries;
|
|
10531
|
+
constructor(opts) {
|
|
10532
|
+
this.baseUrl = opts.baseUrl;
|
|
10533
|
+
this.auth = opts.auth;
|
|
10534
|
+
this.numRetries = opts.numRetries;
|
|
10535
|
+
}
|
|
10536
|
+
/**
|
|
10537
|
+
* List guardrails in a workspace.
|
|
10538
|
+
* @param opts - Must include the workspace UUID.
|
|
10539
|
+
* @returns Guardrails defined on that workspace.
|
|
10540
|
+
* @example
|
|
10541
|
+
* ```ts
|
|
10542
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10543
|
+
* const gw = new AIGatewayClient();
|
|
10544
|
+
*
|
|
10545
|
+
* const g = await gw.guardrails.list({ workspaceId: '16f7e90d-382a-4e78-b577-1b01eb5f8297' });
|
|
10546
|
+
* // g.data[0].id => 'pg-prisma-099a16'
|
|
10547
|
+
* ```
|
|
10548
|
+
*/
|
|
10549
|
+
async list(opts) {
|
|
10550
|
+
assertUuid(opts.workspaceId, "workspaceId");
|
|
10551
|
+
return request({
|
|
10552
|
+
method: "GET",
|
|
10553
|
+
baseUrl: this.baseUrl,
|
|
10554
|
+
path: AI_GW_GUARDRAILS_PATH,
|
|
10555
|
+
params: { workspace_id: opts.workspaceId },
|
|
10556
|
+
responseSchema: ListGuardrailsResponseSchema,
|
|
10557
|
+
auth: this.auth,
|
|
10558
|
+
numRetries: this.numRetries
|
|
10559
|
+
});
|
|
10560
|
+
}
|
|
10561
|
+
/**
|
|
10562
|
+
* Fetch one guardrail.
|
|
10563
|
+
* @param guardrailId - Guardrail UUID.
|
|
10564
|
+
* @returns Guardrail detail — adds `checks`, `actions`, and `version_id` on top of the list
|
|
10565
|
+
* row.
|
|
10566
|
+
* @example
|
|
10567
|
+
* ```ts
|
|
10568
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10569
|
+
* const gw = new AIGatewayClient();
|
|
10570
|
+
*
|
|
10571
|
+
* const g = await gw.guardrails.get('9f6c2a8e-2b3d-4e5f-8a9b-0c1d2e3f4a5b');
|
|
10572
|
+
* // g.checks[0].id => 'panw-prisma-airs.intercept'
|
|
10573
|
+
* ```
|
|
10574
|
+
*/
|
|
10575
|
+
async get(guardrailId) {
|
|
10576
|
+
assertUuid(guardrailId, "guardrailId");
|
|
10577
|
+
return request({
|
|
10578
|
+
method: "GET",
|
|
10579
|
+
baseUrl: this.baseUrl,
|
|
10580
|
+
path: `${AI_GW_GUARDRAILS_PATH}/${guardrailId}`,
|
|
10581
|
+
responseSchema: GatewayGuardrailDetailSchema,
|
|
10582
|
+
auth: this.auth,
|
|
10583
|
+
numRetries: this.numRetries
|
|
10584
|
+
});
|
|
10585
|
+
}
|
|
10586
|
+
/**
|
|
10587
|
+
* Create a guardrail.
|
|
10588
|
+
*
|
|
10589
|
+
* @remarks
|
|
10590
|
+
* The response is a **creation receipt** — `{ id, version_id, slug, object }` — not a
|
|
10591
|
+
* {@link GatewayGuardrailDetail}. Call {@link get} for the full record. Verified live
|
|
10592
|
+
* 2026-07-28.
|
|
10593
|
+
*
|
|
10594
|
+
* @param body - Workspace UUID, name, checks, and pass/fail actions.
|
|
10595
|
+
* @returns The creation receipt.
|
|
10596
|
+
* @example
|
|
10597
|
+
* ```ts
|
|
10598
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10599
|
+
* const gw = new AIGatewayClient();
|
|
10600
|
+
*
|
|
10601
|
+
* const receipt = await gw.guardrails.create({
|
|
10602
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
10603
|
+
* name: 'PrismaAIRS',
|
|
10604
|
+
* checks: [{ id: 'panw-prisma-airs.intercept', parameters: { profile_name: 'AI Gateway - Strict' }, is_enabled: true }],
|
|
10605
|
+
* actions: { deny: false, async: false, sequential: false },
|
|
10606
|
+
* });
|
|
10607
|
+
* // receipt => { id: '...', version_id: '...', slug: 'pg-sdk-ve-874b62', object: 'guardrail' }
|
|
10608
|
+
* ```
|
|
10609
|
+
*/
|
|
10610
|
+
async create(body) {
|
|
10611
|
+
assertUuid(body.workspace_id, "workspace_id");
|
|
10612
|
+
return request({
|
|
10613
|
+
method: "POST",
|
|
10614
|
+
baseUrl: this.baseUrl,
|
|
10615
|
+
path: AI_GW_GUARDRAILS_PATH,
|
|
10616
|
+
body,
|
|
10617
|
+
responseSchema: GatewayGuardrailCreateResponseSchema,
|
|
10618
|
+
auth: this.auth,
|
|
10619
|
+
numRetries: this.numRetries
|
|
10620
|
+
});
|
|
10621
|
+
}
|
|
10622
|
+
/**
|
|
10623
|
+
* Delete a guardrail.
|
|
10624
|
+
*
|
|
10625
|
+
* @remarks
|
|
10626
|
+
* This is a **hard delete** — unlike {@link AIGatewayDeploymentsClient.delete | deployments.delete}
|
|
10627
|
+
* (which archives), the guardrail disappears from {@link list} entirely. Verified live
|
|
10628
|
+
* 2026-07-28. No `organisation_id` query param is required, unlike deployments/integrations.
|
|
10629
|
+
*
|
|
10630
|
+
* @param guardrailId - Guardrail UUID.
|
|
10631
|
+
* @returns Nothing.
|
|
10632
|
+
* @example
|
|
10633
|
+
* ```ts
|
|
10634
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10635
|
+
* const gw = new AIGatewayClient();
|
|
10636
|
+
*
|
|
10637
|
+
* await gw.guardrails.delete('9f6c2a8e-2b3d-4e5f-8a9b-0c1d2e3f4a5b');
|
|
10638
|
+
* // the guardrail no longer appears in gw.guardrails.list()
|
|
10639
|
+
* ```
|
|
10640
|
+
*/
|
|
10641
|
+
async delete(guardrailId) {
|
|
10642
|
+
assertUuid(guardrailId, "guardrailId");
|
|
10643
|
+
await request({
|
|
10644
|
+
method: "DELETE",
|
|
10645
|
+
baseUrl: this.baseUrl,
|
|
10646
|
+
path: `${AI_GW_GUARDRAILS_PATH}/${guardrailId}`,
|
|
10647
|
+
auth: this.auth,
|
|
10648
|
+
numRetries: this.numRetries
|
|
10649
|
+
});
|
|
10650
|
+
}
|
|
10651
|
+
};
|
|
10652
|
+
|
|
10653
|
+
// src/ai-gateway/providers-client.ts
|
|
10654
|
+
var AIGatewayProvidersClient = class {
|
|
10655
|
+
baseUrl;
|
|
10656
|
+
auth;
|
|
10657
|
+
numRetries;
|
|
10658
|
+
constructor(opts) {
|
|
10659
|
+
this.baseUrl = opts.baseUrl;
|
|
10660
|
+
this.auth = opts.auth;
|
|
10661
|
+
this.numRetries = opts.numRetries;
|
|
10662
|
+
}
|
|
10663
|
+
/**
|
|
10664
|
+
* List providers in a workspace.
|
|
10665
|
+
* @param opts - Must include the workspace UUID.
|
|
10666
|
+
* @returns Providers bound into that workspace.
|
|
10667
|
+
* @example
|
|
10668
|
+
* ```ts
|
|
10669
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10670
|
+
* const gw = new AIGatewayClient();
|
|
10671
|
+
*
|
|
10672
|
+
* const p = await gw.providers.list({ workspaceId: '16f7e90d-382a-4e78-b577-1b01eb5f8297' });
|
|
10673
|
+
* // p.data[0].slug => 'openai-calvin'
|
|
10674
|
+
* ```
|
|
10675
|
+
*/
|
|
10676
|
+
async list(opts) {
|
|
10677
|
+
assertUuid(opts.workspaceId, "workspaceId");
|
|
10678
|
+
return request({
|
|
10679
|
+
method: "GET",
|
|
10680
|
+
baseUrl: this.baseUrl,
|
|
10681
|
+
path: AI_GW_PROVIDERS_PATH,
|
|
10682
|
+
params: { workspace_id: opts.workspaceId },
|
|
10683
|
+
responseSchema: ListProvidersResponseSchema,
|
|
10684
|
+
auth: this.auth,
|
|
10685
|
+
numRetries: this.numRetries
|
|
10686
|
+
});
|
|
10687
|
+
}
|
|
10688
|
+
/**
|
|
10689
|
+
* Create a provider.
|
|
10690
|
+
*
|
|
10691
|
+
* @remarks
|
|
10692
|
+
* The response is a **creation receipt** — `{ id, slug, object }` — not a {@link
|
|
10693
|
+
* GatewayProvider}. Note it has **no `version_id`**, unlike the sibling receipts for
|
|
10694
|
+
* {@link AIGatewayConfigsClient.create | configs.create} and {@link
|
|
10695
|
+
* AIGatewayGuardrailsClient.create | guardrails.create}. Verified live 2026-07-28.
|
|
10696
|
+
*
|
|
10697
|
+
* @param body - Workspace UUID, upstream provider id, integration id, name, and slug.
|
|
10698
|
+
* @returns The creation receipt.
|
|
10699
|
+
* @example
|
|
10700
|
+
* ```ts
|
|
10701
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10702
|
+
* const gw = new AIGatewayClient();
|
|
10703
|
+
*
|
|
10704
|
+
* const receipt = await gw.providers.create({
|
|
10705
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
10706
|
+
* ai_provider_id: 'de7d7d50-31cd-11ee-b93b-0e06f1aa7f7c',
|
|
10707
|
+
* integration_id: 'f6692544-3265-49be-9711-bbdcebc079e4',
|
|
10708
|
+
* name: 'openai-calvin',
|
|
10709
|
+
* slug: 'openai-calvin',
|
|
10710
|
+
* });
|
|
10711
|
+
* // receipt => { id: '...', slug: 'sdk-verify-delete-me-provider', object: 'provider' }
|
|
10712
|
+
* ```
|
|
10713
|
+
*/
|
|
10714
|
+
async create(body) {
|
|
10715
|
+
assertUuid(body.workspace_id, "workspace_id");
|
|
10716
|
+
assertUuid(body.ai_provider_id, "ai_provider_id");
|
|
10717
|
+
assertUuid(body.integration_id, "integration_id");
|
|
10718
|
+
return request({
|
|
10719
|
+
method: "POST",
|
|
10720
|
+
baseUrl: this.baseUrl,
|
|
10721
|
+
path: AI_GW_PROVIDERS_PATH,
|
|
10722
|
+
body,
|
|
10723
|
+
responseSchema: GatewayProviderCreateResponseSchema,
|
|
10724
|
+
auth: this.auth,
|
|
10725
|
+
numRetries: this.numRetries
|
|
10726
|
+
});
|
|
10727
|
+
}
|
|
10728
|
+
/**
|
|
10729
|
+
* Delete a provider.
|
|
10730
|
+
*
|
|
10731
|
+
* @remarks
|
|
10732
|
+
* This is a **hard delete** — unlike {@link AIGatewayDeploymentsClient.delete | deployments.delete}
|
|
10733
|
+
* (which archives), the provider disappears from {@link list} entirely. Verified live
|
|
10734
|
+
* 2026-07-28. No `organisation_id` query param is required, unlike deployments/integrations.
|
|
10735
|
+
*
|
|
10736
|
+
* @param providerId - Provider UUID.
|
|
10737
|
+
* @returns Nothing.
|
|
10738
|
+
* @example
|
|
10739
|
+
* ```ts
|
|
10740
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10741
|
+
* const gw = new AIGatewayClient();
|
|
10742
|
+
*
|
|
10743
|
+
* await gw.providers.delete('f6692544-3265-49be-9711-bbdcebc079e4');
|
|
10744
|
+
* // the provider no longer appears in gw.providers.list()
|
|
10745
|
+
* ```
|
|
10746
|
+
*/
|
|
10747
|
+
async delete(providerId) {
|
|
10748
|
+
assertUuid(providerId, "providerId");
|
|
10749
|
+
await request({
|
|
10750
|
+
method: "DELETE",
|
|
10751
|
+
baseUrl: this.baseUrl,
|
|
10752
|
+
path: `${AI_GW_PROVIDERS_PATH}/${providerId}`,
|
|
10753
|
+
auth: this.auth,
|
|
10754
|
+
numRetries: this.numRetries
|
|
10755
|
+
});
|
|
10756
|
+
}
|
|
10757
|
+
};
|
|
10758
|
+
|
|
10759
|
+
// src/ai-gateway/api-keys-client.ts
|
|
10760
|
+
var AIGatewayApiKeysClient = class {
|
|
10761
|
+
baseUrl;
|
|
10762
|
+
auth;
|
|
10763
|
+
numRetries;
|
|
10764
|
+
constructor(opts) {
|
|
10765
|
+
this.baseUrl = opts.baseUrl;
|
|
10766
|
+
this.auth = opts.auth;
|
|
10767
|
+
this.numRetries = opts.numRetries;
|
|
10768
|
+
}
|
|
10769
|
+
/** @internal */
|
|
10770
|
+
listAt(path, opts) {
|
|
10771
|
+
assertUuid(opts.workspaceId, "workspaceId");
|
|
10772
|
+
return request({
|
|
10773
|
+
method: "GET",
|
|
10774
|
+
baseUrl: this.baseUrl,
|
|
10775
|
+
path,
|
|
10776
|
+
params: { workspace_id: opts.workspaceId },
|
|
10777
|
+
responseSchema: ListApiKeysResponseSchema,
|
|
10778
|
+
auth: this.auth,
|
|
10779
|
+
numRetries: this.numRetries
|
|
10780
|
+
});
|
|
10781
|
+
}
|
|
10782
|
+
/** @internal */
|
|
10783
|
+
writeAt(method, path, body) {
|
|
10784
|
+
assertUuid(body.workspace_id, "workspace_id");
|
|
10785
|
+
return request({
|
|
10786
|
+
method,
|
|
10787
|
+
baseUrl: this.baseUrl,
|
|
10788
|
+
path,
|
|
10789
|
+
body,
|
|
10790
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
10791
|
+
auth: this.auth,
|
|
10792
|
+
numRetries: this.numRetries
|
|
10793
|
+
});
|
|
10794
|
+
}
|
|
10795
|
+
/**
|
|
10796
|
+
* List service API keys in a workspace.
|
|
10797
|
+
* @param opts - Must include the workspace UUID.
|
|
10798
|
+
* @returns Service keys; the secret itself is only ever returned at creation.
|
|
10799
|
+
* @example
|
|
10800
|
+
* ```ts
|
|
10801
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10802
|
+
* const gw = new AIGatewayClient();
|
|
10803
|
+
*
|
|
10804
|
+
* const keys = await gw.apiKeys.listService({ workspaceId: '16f7e90d-382a-4e78-b577-1b01eb5f8297' });
|
|
10805
|
+
* // keys.total => 1
|
|
10806
|
+
* ```
|
|
10807
|
+
*/
|
|
10808
|
+
async listService(opts) {
|
|
10809
|
+
return this.listAt(AI_GW_API_KEYS_SERVICE_PATH, opts);
|
|
10810
|
+
}
|
|
10811
|
+
/**
|
|
10812
|
+
* List user API keys in a workspace.
|
|
10813
|
+
* @param opts - Must include the workspace UUID.
|
|
10814
|
+
* @returns User-scoped keys.
|
|
10815
|
+
* @example
|
|
10816
|
+
* ```ts
|
|
10817
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10818
|
+
* const gw = new AIGatewayClient();
|
|
10819
|
+
*
|
|
10820
|
+
* const keys = await gw.apiKeys.listUser({ workspaceId: '16f7e90d-382a-4e78-b577-1b01eb5f8297' });
|
|
10821
|
+
* // keys.total => 0
|
|
10822
|
+
* ```
|
|
10823
|
+
*/
|
|
10824
|
+
async listUser(opts) {
|
|
10825
|
+
return this.listAt(AI_GW_API_KEYS_USER_PATH, opts);
|
|
10826
|
+
}
|
|
10827
|
+
/**
|
|
10828
|
+
* Create a service API key.
|
|
10829
|
+
* @param body - Name, scopes, TSG, workspace UUID, and type.
|
|
10830
|
+
* @returns The raw create response — the only place the key secret appears. Capture it.
|
|
10831
|
+
* @example
|
|
10832
|
+
* ```ts
|
|
10833
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10834
|
+
* const gw = new AIGatewayClient();
|
|
10835
|
+
*
|
|
10836
|
+
* await gw.apiKeys.createService({
|
|
10837
|
+
* name: 'ci-runner',
|
|
10838
|
+
* scopes: ['completions.write', 'logs.write'],
|
|
10839
|
+
* organisation_id: '1852583913',
|
|
10840
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
10841
|
+
* type: 'workspace',
|
|
10842
|
+
* });
|
|
10843
|
+
* ```
|
|
10844
|
+
*/
|
|
10845
|
+
async createService(body) {
|
|
10846
|
+
return this.writeAt("POST", AI_GW_API_KEYS_SERVICE_PATH, body);
|
|
10847
|
+
}
|
|
10848
|
+
/**
|
|
10849
|
+
* Create a user API key.
|
|
10850
|
+
* @param body - As {@link createService}, plus `user_id`.
|
|
10851
|
+
* @returns The raw create response — the only place the key secret appears. Capture it.
|
|
10852
|
+
* @example
|
|
10853
|
+
* ```ts
|
|
10854
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10855
|
+
* const gw = new AIGatewayClient();
|
|
10856
|
+
*
|
|
10857
|
+
* await gw.apiKeys.createUser({
|
|
10858
|
+
* name: 'calvin-laptop',
|
|
10859
|
+
* scopes: ['completions.write'],
|
|
10860
|
+
* organisation_id: '1852583913',
|
|
10861
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
10862
|
+
* type: 'workspace',
|
|
10863
|
+
* user_id: 'fad91538-65a9-41f7-8b9c-6e4c0e8b9c5f',
|
|
10864
|
+
* });
|
|
10865
|
+
* ```
|
|
10866
|
+
*/
|
|
10867
|
+
async createUser(body) {
|
|
10868
|
+
return this.writeAt("POST", AI_GW_API_KEYS_USER_PATH, body);
|
|
10869
|
+
}
|
|
10870
|
+
/**
|
|
10871
|
+
* Update a service API key.
|
|
10872
|
+
* @param keyId - Key UUID.
|
|
10873
|
+
* @param body - Replacement fields.
|
|
10874
|
+
* @returns The raw update response. Shape unverified against a live tenant — see the PRD.
|
|
10875
|
+
* @example
|
|
10876
|
+
* ```ts
|
|
10877
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10878
|
+
* const gw = new AIGatewayClient();
|
|
10879
|
+
*
|
|
10880
|
+
* await gw.apiKeys.updateService('11111111-1111-4111-8111-111111111111', {
|
|
10881
|
+
* name: 'ci-runner',
|
|
10882
|
+
* scopes: ['completions.write'],
|
|
10883
|
+
* organisation_id: '1852583913',
|
|
10884
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
10885
|
+
* type: 'workspace',
|
|
10886
|
+
* });
|
|
10887
|
+
* ```
|
|
10888
|
+
*/
|
|
10889
|
+
async updateService(keyId, body) {
|
|
10890
|
+
assertUuid(keyId, "keyId");
|
|
10891
|
+
return this.writeAt("PUT", `${AI_GW_API_KEYS_SERVICE_PATH}/${keyId}`, body);
|
|
10892
|
+
}
|
|
10893
|
+
/**
|
|
10894
|
+
* Update a user API key.
|
|
10895
|
+
* @param keyId - Key UUID.
|
|
10896
|
+
* @param body - Replacement fields.
|
|
10897
|
+
* @returns The raw update response. Shape unverified against a live tenant — see the PRD.
|
|
10898
|
+
* @example
|
|
10899
|
+
* ```ts
|
|
10900
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10901
|
+
* const gw = new AIGatewayClient();
|
|
10902
|
+
*
|
|
10903
|
+
* await gw.apiKeys.updateUser('11111111-1111-4111-8111-111111111111', {
|
|
10904
|
+
* name: 'calvin-laptop',
|
|
10905
|
+
* scopes: ['completions.write'],
|
|
10906
|
+
* organisation_id: '1852583913',
|
|
10907
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
10908
|
+
* type: 'workspace',
|
|
10909
|
+
* user_id: 'fad91538-65a9-41f7-8b9c-6e4c0e8b9c5f',
|
|
10910
|
+
* });
|
|
10911
|
+
* ```
|
|
10912
|
+
*/
|
|
10913
|
+
async updateUser(keyId, body) {
|
|
10914
|
+
assertUuid(keyId, "keyId");
|
|
10915
|
+
return this.writeAt("PUT", `${AI_GW_API_KEYS_USER_PATH}/${keyId}`, body);
|
|
10916
|
+
}
|
|
10917
|
+
};
|
|
10918
|
+
|
|
10919
|
+
// src/ai-gateway/integrations-client.ts
|
|
10920
|
+
var AIGatewayIntegrationsClient = class {
|
|
10921
|
+
baseUrl;
|
|
10922
|
+
auth;
|
|
10923
|
+
numRetries;
|
|
10924
|
+
constructor(opts) {
|
|
10925
|
+
this.baseUrl = opts.baseUrl;
|
|
10926
|
+
this.auth = opts.auth;
|
|
10927
|
+
this.numRetries = opts.numRetries;
|
|
10928
|
+
}
|
|
10929
|
+
/**
|
|
10930
|
+
* List organisation integrations.
|
|
10931
|
+
* @returns All provider integrations defined on the organisation.
|
|
10932
|
+
* @example
|
|
10933
|
+
* ```ts
|
|
10934
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10935
|
+
* const gw = new AIGatewayClient();
|
|
10936
|
+
*
|
|
10937
|
+
* const ints = await gw.integrations.list();
|
|
10938
|
+
* // ints.data[0] => { name: 'openai-calvin', slug: 'openai-calvin', ... }
|
|
10939
|
+
* ```
|
|
10940
|
+
*/
|
|
10941
|
+
async list() {
|
|
10942
|
+
return request({
|
|
10943
|
+
method: "GET",
|
|
10944
|
+
baseUrl: this.baseUrl,
|
|
10945
|
+
path: AI_GW_INTEGRATIONS_PATH,
|
|
10946
|
+
responseSchema: ListIntegrationsResponseSchema,
|
|
10947
|
+
auth: this.auth,
|
|
10948
|
+
numRetries: this.numRetries
|
|
10949
|
+
});
|
|
10950
|
+
}
|
|
10951
|
+
/**
|
|
10952
|
+
* Fetch one integration.
|
|
10953
|
+
* @param integrationId - Integration UUID.
|
|
10954
|
+
* @returns The integration record.
|
|
10955
|
+
* @example
|
|
10956
|
+
* ```ts
|
|
10957
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10958
|
+
* const gw = new AIGatewayClient();
|
|
10959
|
+
*
|
|
10960
|
+
* const i = await gw.integrations.get('f6692544-3265-49be-9711-bbdcebc079e4');
|
|
10961
|
+
* // i.name => 'openai-calvin'
|
|
10962
|
+
* ```
|
|
10963
|
+
*/
|
|
10964
|
+
async get(integrationId) {
|
|
10965
|
+
assertUuid(integrationId, "integrationId");
|
|
10966
|
+
return request({
|
|
10967
|
+
method: "GET",
|
|
10968
|
+
baseUrl: this.baseUrl,
|
|
10969
|
+
path: `${AI_GW_INTEGRATIONS_PATH}/${integrationId}`,
|
|
10970
|
+
responseSchema: GatewayIntegrationSchema,
|
|
10971
|
+
auth: this.auth,
|
|
10972
|
+
numRetries: this.numRetries
|
|
10973
|
+
});
|
|
10974
|
+
}
|
|
10975
|
+
/**
|
|
10976
|
+
* Create an integration.
|
|
10977
|
+
*
|
|
10978
|
+
* @remarks
|
|
10979
|
+
* `body.key` (the provider API key) is a live secret. Setting `PANW_AI_SEC_DEBUG` will
|
|
10980
|
+
* print it, unredacted, to the SDK's own debug log.
|
|
10981
|
+
*
|
|
10982
|
+
* @param body - Provider id, name, slug, and provider-specific configuration.
|
|
10983
|
+
* @returns The raw create response. Shape unverified against a live tenant — see the PRD.
|
|
10984
|
+
* @example
|
|
10985
|
+
* ```ts
|
|
10986
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10987
|
+
* const gw = new AIGatewayClient();
|
|
10988
|
+
*
|
|
10989
|
+
* await gw.integrations.create({
|
|
10990
|
+
* organisation_id: '1852583913',
|
|
10991
|
+
* ai_provider_id: 'de7d7d50-31cd-11ee-b93b-0e06f1aa7f7c',
|
|
10992
|
+
* name: 'openai-prod',
|
|
10993
|
+
* slug: 'openai-prod',
|
|
10994
|
+
* key: process.env.OPENAI_API_KEY,
|
|
10995
|
+
* });
|
|
10996
|
+
* ```
|
|
10997
|
+
*/
|
|
10998
|
+
async create(body) {
|
|
10999
|
+
assertUuid(body.ai_provider_id, "ai_provider_id");
|
|
11000
|
+
return request({
|
|
11001
|
+
method: "POST",
|
|
11002
|
+
baseUrl: this.baseUrl,
|
|
11003
|
+
path: AI_GW_INTEGRATIONS_PATH,
|
|
11004
|
+
body,
|
|
11005
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11006
|
+
auth: this.auth,
|
|
11007
|
+
numRetries: this.numRetries
|
|
11008
|
+
});
|
|
11009
|
+
}
|
|
11010
|
+
/**
|
|
11011
|
+
* Update an integration.
|
|
11012
|
+
* @param integrationId - Integration UUID.
|
|
11013
|
+
* @param body - Replacement fields.
|
|
11014
|
+
* @returns The raw update response. Shape unverified against a live tenant — see the PRD.
|
|
11015
|
+
* @example
|
|
11016
|
+
* ```ts
|
|
11017
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11018
|
+
* const gw = new AIGatewayClient();
|
|
11019
|
+
*
|
|
11020
|
+
* await gw.integrations.update('f6692544-3265-49be-9711-bbdcebc079e4', {
|
|
11021
|
+
* name: 'openai-prod',
|
|
11022
|
+
* description: 'Production OpenAI',
|
|
11023
|
+
* });
|
|
11024
|
+
* ```
|
|
11025
|
+
*/
|
|
11026
|
+
async update(integrationId, body) {
|
|
11027
|
+
assertUuid(integrationId, "integrationId");
|
|
11028
|
+
if (body.ai_provider_id !== void 0) assertUuid(body.ai_provider_id, "ai_provider_id");
|
|
11029
|
+
return request({
|
|
11030
|
+
method: "PUT",
|
|
11031
|
+
baseUrl: this.baseUrl,
|
|
11032
|
+
path: `${AI_GW_INTEGRATIONS_PATH}/${integrationId}`,
|
|
11033
|
+
body,
|
|
11034
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11035
|
+
auth: this.auth,
|
|
11036
|
+
numRetries: this.numRetries
|
|
11037
|
+
});
|
|
11038
|
+
}
|
|
11039
|
+
/**
|
|
11040
|
+
* Delete an integration.
|
|
11041
|
+
* @param integrationId - Integration UUID.
|
|
11042
|
+
* @param organisationId - The TSG as a numeric string; sent as a query param.
|
|
11043
|
+
* @returns Nothing — the API replies 200 with an empty body.
|
|
11044
|
+
* @example
|
|
11045
|
+
* ```ts
|
|
11046
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11047
|
+
* const gw = new AIGatewayClient();
|
|
11048
|
+
*
|
|
11049
|
+
* await gw.integrations.delete('f6692544-3265-49be-9711-bbdcebc079e4', '1852583913');
|
|
11050
|
+
* ```
|
|
11051
|
+
*/
|
|
11052
|
+
async delete(integrationId, organisationId) {
|
|
11053
|
+
assertUuid(integrationId, "integrationId");
|
|
11054
|
+
assertNumericId(organisationId, "organisationId");
|
|
11055
|
+
await request({
|
|
11056
|
+
method: "DELETE",
|
|
11057
|
+
baseUrl: this.baseUrl,
|
|
11058
|
+
path: `${AI_GW_INTEGRATIONS_PATH}/${integrationId}`,
|
|
11059
|
+
params: { organisation_id: organisationId },
|
|
11060
|
+
auth: this.auth,
|
|
11061
|
+
numRetries: this.numRetries
|
|
11062
|
+
});
|
|
11063
|
+
}
|
|
11064
|
+
/**
|
|
11065
|
+
* Read which models this integration exposes.
|
|
11066
|
+
* @param integrationId - Integration UUID.
|
|
11067
|
+
* @returns Per-model enablement plus the `allow_all_models` flag.
|
|
11068
|
+
* @example
|
|
11069
|
+
* ```ts
|
|
11070
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11071
|
+
* const gw = new AIGatewayClient();
|
|
11072
|
+
*
|
|
11073
|
+
* const m = await gw.integrations.getModels('f6692544-3265-49be-9711-bbdcebc079e4');
|
|
11074
|
+
* // m.models[0] => { slug: 'gpt-4', enabled: true }
|
|
11075
|
+
* ```
|
|
11076
|
+
*/
|
|
11077
|
+
async getModels(integrationId) {
|
|
11078
|
+
assertUuid(integrationId, "integrationId");
|
|
11079
|
+
return request({
|
|
11080
|
+
method: "GET",
|
|
11081
|
+
baseUrl: this.baseUrl,
|
|
11082
|
+
path: `${AI_GW_INTEGRATIONS_PATH}/${integrationId}/models`,
|
|
11083
|
+
responseSchema: GatewayIntegrationModelsResponseSchema,
|
|
11084
|
+
auth: this.auth,
|
|
11085
|
+
numRetries: this.numRetries
|
|
11086
|
+
});
|
|
11087
|
+
}
|
|
11088
|
+
/**
|
|
11089
|
+
* Replace which models this integration exposes.
|
|
11090
|
+
* @param integrationId - Integration UUID.
|
|
11091
|
+
* @param body - Full model list; this is a replace, not a merge.
|
|
11092
|
+
* @returns The raw response. Shape unverified against a live tenant — see the PRD.
|
|
11093
|
+
* @example
|
|
11094
|
+
* ```ts
|
|
11095
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11096
|
+
* const gw = new AIGatewayClient();
|
|
11097
|
+
*
|
|
11098
|
+
* await gw.integrations.setModels('f6692544-3265-49be-9711-bbdcebc079e4', {
|
|
11099
|
+
* models: [{ slug: 'gpt-4', enabled: true }, { slug: 'gpt-4-32k', enabled: false }],
|
|
11100
|
+
* });
|
|
11101
|
+
* ```
|
|
11102
|
+
*/
|
|
11103
|
+
async setModels(integrationId, body) {
|
|
11104
|
+
assertUuid(integrationId, "integrationId");
|
|
11105
|
+
return request({
|
|
11106
|
+
method: "PUT",
|
|
11107
|
+
baseUrl: this.baseUrl,
|
|
11108
|
+
path: `${AI_GW_INTEGRATIONS_PATH}/${integrationId}/models`,
|
|
11109
|
+
body,
|
|
11110
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11111
|
+
auth: this.auth,
|
|
11112
|
+
numRetries: this.numRetries
|
|
11113
|
+
});
|
|
11114
|
+
}
|
|
11115
|
+
/**
|
|
11116
|
+
* Read which workspaces may use this integration.
|
|
11117
|
+
*
|
|
11118
|
+
* @remarks
|
|
11119
|
+
* `global_workspace_access` is an **object** on this read, not a boolean, despite the
|
|
11120
|
+
* field name — `{ enabled, rate_limits, usage_limits }`. The corresponding write
|
|
11121
|
+
* ({@link setWorkspaces}) DOES send a plain boolean; the two are not symmetric.
|
|
11122
|
+
*
|
|
11123
|
+
* @param integrationId - Integration UUID.
|
|
11124
|
+
* @returns Bound workspaces plus the `global_workspace_access` object.
|
|
11125
|
+
* @example
|
|
11126
|
+
* ```ts
|
|
11127
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11128
|
+
* const gw = new AIGatewayClient();
|
|
11129
|
+
*
|
|
11130
|
+
* const w = await gw.integrations.getWorkspaces('f6692544-3265-49be-9711-bbdcebc079e4');
|
|
11131
|
+
* // w.global_workspace_access => { enabled: false, rate_limits: null, usage_limits: null }
|
|
11132
|
+
* ```
|
|
11133
|
+
*/
|
|
11134
|
+
async getWorkspaces(integrationId) {
|
|
11135
|
+
assertUuid(integrationId, "integrationId");
|
|
11136
|
+
return request({
|
|
11137
|
+
method: "GET",
|
|
11138
|
+
baseUrl: this.baseUrl,
|
|
11139
|
+
path: `${AI_GW_INTEGRATIONS_PATH}/${integrationId}/workspaces`,
|
|
11140
|
+
responseSchema: GatewayIntegrationWorkspacesResponseSchema,
|
|
11141
|
+
auth: this.auth,
|
|
11142
|
+
numRetries: this.numRetries
|
|
11143
|
+
});
|
|
11144
|
+
}
|
|
11145
|
+
/**
|
|
11146
|
+
* Replace which workspaces may use this integration.
|
|
11147
|
+
* @param integrationId - Integration UUID.
|
|
11148
|
+
* @param body - Workspace bindings or a global-access flag.
|
|
11149
|
+
* @returns The raw response. Shape unverified against a live tenant — see the PRD.
|
|
11150
|
+
* @example
|
|
11151
|
+
* ```ts
|
|
11152
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11153
|
+
* const gw = new AIGatewayClient();
|
|
11154
|
+
*
|
|
11155
|
+
* await gw.integrations.setWorkspaces('f6692544-3265-49be-9711-bbdcebc079e4', {
|
|
11156
|
+
* global_workspace_access: true,
|
|
11157
|
+
* });
|
|
11158
|
+
* ```
|
|
11159
|
+
*/
|
|
11160
|
+
async setWorkspaces(integrationId, body) {
|
|
11161
|
+
assertUuid(integrationId, "integrationId");
|
|
11162
|
+
return request({
|
|
11163
|
+
method: "PUT",
|
|
11164
|
+
baseUrl: this.baseUrl,
|
|
11165
|
+
path: `${AI_GW_INTEGRATIONS_PATH}/${integrationId}/workspaces`,
|
|
11166
|
+
body,
|
|
11167
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11168
|
+
auth: this.auth,
|
|
11169
|
+
numRetries: this.numRetries
|
|
11170
|
+
});
|
|
11171
|
+
}
|
|
11172
|
+
};
|
|
11173
|
+
|
|
11174
|
+
// src/ai-gateway/mcp-integrations-client.ts
|
|
11175
|
+
var AIGatewayMcpIntegrationsClient = class {
|
|
11176
|
+
baseUrl;
|
|
11177
|
+
auth;
|
|
11178
|
+
numRetries;
|
|
11179
|
+
constructor(opts) {
|
|
11180
|
+
this.baseUrl = opts.baseUrl;
|
|
11181
|
+
this.auth = opts.auth;
|
|
11182
|
+
this.numRetries = opts.numRetries;
|
|
11183
|
+
}
|
|
11184
|
+
/**
|
|
11185
|
+
* List organisation MCP integrations.
|
|
11186
|
+
* @returns All MCP server integrations defined on the organisation.
|
|
11187
|
+
* @example
|
|
11188
|
+
* ```ts
|
|
11189
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11190
|
+
* const gw = new AIGatewayClient();
|
|
11191
|
+
*
|
|
11192
|
+
* const mcp = await gw.mcpIntegrations.list();
|
|
11193
|
+
* // mcp.data[0] => { name: 'Context 7', url: 'https://mcp.context7.com/mcp', transport: 'http', ... }
|
|
11194
|
+
* ```
|
|
11195
|
+
*/
|
|
11196
|
+
async list() {
|
|
11197
|
+
return request({
|
|
11198
|
+
method: "GET",
|
|
11199
|
+
baseUrl: this.baseUrl,
|
|
11200
|
+
path: AI_GW_MCP_INTEGRATIONS_PATH,
|
|
11201
|
+
responseSchema: ListMcpIntegrationsResponseSchema,
|
|
11202
|
+
auth: this.auth,
|
|
11203
|
+
numRetries: this.numRetries
|
|
11204
|
+
});
|
|
11205
|
+
}
|
|
11206
|
+
/**
|
|
11207
|
+
* Register an MCP server.
|
|
11208
|
+
* @param body - Name, server URL, auth type, transport, and provider-specific configuration.
|
|
11209
|
+
* @returns The raw create response. Shape unverified against a live tenant — see the PRD.
|
|
11210
|
+
* @example
|
|
11211
|
+
* ```ts
|
|
11212
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11213
|
+
* const gw = new AIGatewayClient();
|
|
11214
|
+
*
|
|
11215
|
+
* await gw.mcpIntegrations.create({
|
|
11216
|
+
* name: 'Context 7',
|
|
11217
|
+
* organisation_id: '1852583913',
|
|
11218
|
+
* slug: 'context-7',
|
|
11219
|
+
* url: 'https://mcp.context7.com/mcp',
|
|
11220
|
+
* auth_type: 'none',
|
|
11221
|
+
* transport: 'http',
|
|
11222
|
+
* });
|
|
11223
|
+
* ```
|
|
11224
|
+
*/
|
|
11225
|
+
async create(body) {
|
|
11226
|
+
return request({
|
|
11227
|
+
method: "POST",
|
|
11228
|
+
baseUrl: this.baseUrl,
|
|
11229
|
+
path: AI_GW_MCP_INTEGRATIONS_PATH,
|
|
11230
|
+
body,
|
|
11231
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11232
|
+
auth: this.auth,
|
|
11233
|
+
numRetries: this.numRetries
|
|
11234
|
+
});
|
|
11235
|
+
}
|
|
11236
|
+
/**
|
|
11237
|
+
* Replace which workspaces may use this MCP integration.
|
|
11238
|
+
* @param mcpIntegrationId - MCP integration UUID.
|
|
11239
|
+
* @param body - Workspace bindings or a global-access flag; this is a replace, not a merge.
|
|
11240
|
+
* @returns The raw response. Shape unverified against a live tenant — see the PRD.
|
|
11241
|
+
* @example
|
|
11242
|
+
* ```ts
|
|
11243
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11244
|
+
* const gw = new AIGatewayClient();
|
|
11245
|
+
*
|
|
11246
|
+
* await gw.mcpIntegrations.setWorkspaces('f6692544-3265-49be-9711-bbdcebc079e4', {
|
|
11247
|
+
* global_workspace_access: true,
|
|
11248
|
+
* });
|
|
11249
|
+
* ```
|
|
11250
|
+
*/
|
|
11251
|
+
async setWorkspaces(mcpIntegrationId, body) {
|
|
11252
|
+
assertUuid(mcpIntegrationId, "mcpIntegrationId");
|
|
11253
|
+
return request({
|
|
11254
|
+
method: "PUT",
|
|
11255
|
+
baseUrl: this.baseUrl,
|
|
11256
|
+
path: `${AI_GW_MCP_INTEGRATIONS_PATH}/${mcpIntegrationId}/workspaces`,
|
|
11257
|
+
body,
|
|
11258
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11259
|
+
auth: this.auth,
|
|
11260
|
+
numRetries: this.numRetries
|
|
11261
|
+
});
|
|
11262
|
+
}
|
|
11263
|
+
};
|
|
11264
|
+
|
|
11265
|
+
// src/ai-gateway/deployments-client.ts
|
|
11266
|
+
var AIGatewayDeploymentsClient = class {
|
|
11267
|
+
baseUrl;
|
|
11268
|
+
auth;
|
|
11269
|
+
numRetries;
|
|
11270
|
+
constructor(opts) {
|
|
11271
|
+
this.baseUrl = opts.baseUrl;
|
|
11272
|
+
this.auth = opts.auth;
|
|
11273
|
+
this.numRetries = opts.numRetries;
|
|
11274
|
+
}
|
|
11275
|
+
/**
|
|
11276
|
+
* List deployments.
|
|
11277
|
+
*
|
|
11278
|
+
* @remarks
|
|
11279
|
+
* Archived deployments are included — `delete()` is a soft-delete. Filter on
|
|
11280
|
+
* `status === 'active'` if you only want live ones.
|
|
11281
|
+
*
|
|
11282
|
+
* @returns All deployments, active and archived.
|
|
11283
|
+
* @example
|
|
11284
|
+
* ```ts
|
|
11285
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11286
|
+
* const gw = new AIGatewayClient();
|
|
11287
|
+
*
|
|
11288
|
+
* const all = await gw.deployments.list();
|
|
11289
|
+
* const live = all.data.filter((d) => d.status === 'active');
|
|
11290
|
+
* // live[0] => { name: 'talos', slug: 'dp-talos-f3b74e', status: 'active', ... }
|
|
11291
|
+
* ```
|
|
11292
|
+
*/
|
|
11293
|
+
async list() {
|
|
11294
|
+
return request({
|
|
11295
|
+
method: "GET",
|
|
11296
|
+
baseUrl: this.baseUrl,
|
|
11297
|
+
path: AI_GW_DEPLOYMENTS_PATH,
|
|
11298
|
+
responseSchema: ListDeploymentsResponseSchema,
|
|
11299
|
+
auth: this.auth,
|
|
11300
|
+
numRetries: this.numRetries
|
|
11301
|
+
});
|
|
11302
|
+
}
|
|
11303
|
+
/**
|
|
11304
|
+
* Fetch one deployment.
|
|
11305
|
+
* @param deploymentId - Deployment UUID.
|
|
11306
|
+
* @returns Deployment detail, including bound workspaces and masked credentials.
|
|
11307
|
+
* @example
|
|
11308
|
+
* ```ts
|
|
11309
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11310
|
+
* const gw = new AIGatewayClient();
|
|
11311
|
+
*
|
|
11312
|
+
* const d = await gw.deployments.get('32e8314e-7e68-4384-aacb-a476f6c3f91d');
|
|
11313
|
+
* // d.auth_settings?.allow_all_workspaces => 1 (a number, not a boolean)
|
|
11314
|
+
* ```
|
|
11315
|
+
*/
|
|
11316
|
+
async get(deploymentId) {
|
|
11317
|
+
assertUuid(deploymentId, "deploymentId");
|
|
11318
|
+
return request({
|
|
11319
|
+
method: "GET",
|
|
11320
|
+
baseUrl: this.baseUrl,
|
|
11321
|
+
path: `${AI_GW_DEPLOYMENTS_PATH}/${deploymentId}`,
|
|
11322
|
+
responseSchema: GatewayDeploymentDetailSchema,
|
|
11323
|
+
auth: this.auth,
|
|
11324
|
+
numRetries: this.numRetries
|
|
11325
|
+
});
|
|
11326
|
+
}
|
|
11327
|
+
/**
|
|
11328
|
+
* Create a deployment.
|
|
11329
|
+
*
|
|
11330
|
+
* @remarks
|
|
11331
|
+
* The response is a **creation receipt**, not a deployment record — it has 5 fields and
|
|
11332
|
+
* carries no `name`, `slug`, or `status`. Call {@link get} for the full record.
|
|
11333
|
+
*
|
|
11334
|
+
* This is the **only** time `credentials.password` and `client_auth` are readable; the
|
|
11335
|
+
* detail read masks them. Capture them here or they are unrecoverable. Never log them.
|
|
11336
|
+
* Note that setting `PANW_AI_SEC_DEBUG` will print the raw request/response, including
|
|
11337
|
+
* `credentials.password`, to the SDK's own debug log regardless of this warning.
|
|
11338
|
+
*
|
|
11339
|
+
* @param body - Name, type, TSG, and auth settings.
|
|
11340
|
+
* @returns The creation receipt including the deployment's gateway credentials.
|
|
11341
|
+
* @example
|
|
11342
|
+
* ```ts
|
|
11343
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11344
|
+
* const gw = new AIGatewayClient();
|
|
11345
|
+
*
|
|
11346
|
+
* const receipt = await gw.deployments.create({
|
|
11347
|
+
* name: 'prod-us',
|
|
11348
|
+
* type: 'production',
|
|
11349
|
+
* organisation_id: '1852583913',
|
|
11350
|
+
* auth_settings: { allow_all_workspaces: true },
|
|
11351
|
+
* });
|
|
11352
|
+
* // receipt => { id: '2141...', client_auth: 'client-auth-...', credentials: { username, password }, ... }
|
|
11353
|
+
* const full = await gw.deployments.get(receipt.id);
|
|
11354
|
+
* ```
|
|
11355
|
+
*/
|
|
11356
|
+
async create(body) {
|
|
11357
|
+
return request({
|
|
11358
|
+
method: "POST",
|
|
11359
|
+
baseUrl: this.baseUrl,
|
|
11360
|
+
path: AI_GW_DEPLOYMENTS_PATH,
|
|
11361
|
+
body,
|
|
11362
|
+
responseSchema: GatewayDeploymentCreateResponseSchema,
|
|
11363
|
+
auth: this.auth,
|
|
11364
|
+
numRetries: this.numRetries
|
|
11365
|
+
});
|
|
11366
|
+
}
|
|
11367
|
+
/**
|
|
11368
|
+
* Archive a deployment.
|
|
11369
|
+
*
|
|
11370
|
+
* @remarks
|
|
11371
|
+
* This is a **soft delete** — the one exception to the gateway's usual delete semantics.
|
|
11372
|
+
* The API returns 200 with an empty body and the record persists with `status:
|
|
11373
|
+
* 'archived'`, still visible in {@link list}. There is no observed hard-delete for
|
|
11374
|
+
* deployments specifically. Contrast with {@link AIGatewayConfigsClient.delete |
|
|
11375
|
+
* configs.delete}, {@link AIGatewayGuardrailsClient.delete | guardrails.delete}, and
|
|
11376
|
+
* {@link AIGatewayProvidersClient.delete | providers.delete}, all of which hard-delete —
|
|
11377
|
+
* do not assume archive-on-delete is a gateway-wide convention.
|
|
11378
|
+
*
|
|
11379
|
+
* @param deploymentId - Deployment UUID.
|
|
11380
|
+
* @param organisationId - The TSG as a numeric string; sent as a query param.
|
|
11381
|
+
* @returns Nothing.
|
|
11382
|
+
* @example
|
|
11383
|
+
* ```ts
|
|
11384
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11385
|
+
* const gw = new AIGatewayClient();
|
|
11386
|
+
*
|
|
11387
|
+
* await gw.deployments.delete('21414819-485e-4ba3-b3d3-3e1815580e43', '1852583913');
|
|
11388
|
+
* // the record remains in list() with status 'archived'
|
|
11389
|
+
* ```
|
|
11390
|
+
*/
|
|
11391
|
+
async delete(deploymentId, organisationId) {
|
|
11392
|
+
assertUuid(deploymentId, "deploymentId");
|
|
11393
|
+
assertNumericId(organisationId, "organisationId");
|
|
11394
|
+
await request({
|
|
11395
|
+
method: "DELETE",
|
|
11396
|
+
baseUrl: this.baseUrl,
|
|
11397
|
+
path: `${AI_GW_DEPLOYMENTS_PATH}/${deploymentId}`,
|
|
11398
|
+
params: { organisation_id: organisationId },
|
|
11399
|
+
auth: this.auth,
|
|
11400
|
+
numRetries: this.numRetries
|
|
11401
|
+
});
|
|
11402
|
+
}
|
|
11403
|
+
};
|
|
11404
|
+
|
|
11405
|
+
// src/ai-gateway/plugins-client.ts
|
|
11406
|
+
var AIGatewayPluginsClient = class {
|
|
11407
|
+
baseUrl;
|
|
11408
|
+
auth;
|
|
11409
|
+
numRetries;
|
|
11410
|
+
constructor(opts) {
|
|
11411
|
+
this.baseUrl = opts.baseUrl;
|
|
11412
|
+
this.auth = opts.auth;
|
|
11413
|
+
this.numRetries = opts.numRetries;
|
|
11414
|
+
}
|
|
11415
|
+
/**
|
|
11416
|
+
* List organisation plugin bindings.
|
|
11417
|
+
* @returns All plugins bound to the organisation, with masked credentials.
|
|
11418
|
+
* @example
|
|
11419
|
+
* ```ts
|
|
11420
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11421
|
+
* const gw = new AIGatewayClient();
|
|
11422
|
+
*
|
|
11423
|
+
* const p = await gw.plugins.list();
|
|
11424
|
+
* // p.data[0] => { integration_slug: 'panw-prisma-airs', credentials: { AIRS_API_KEY: 'sn*****Gul' }, ... }
|
|
11425
|
+
* ```
|
|
11426
|
+
*/
|
|
11427
|
+
async list() {
|
|
11428
|
+
return request({
|
|
11429
|
+
method: "GET",
|
|
11430
|
+
baseUrl: this.baseUrl,
|
|
11431
|
+
path: AI_GW_PLUGINS_PATH,
|
|
11432
|
+
responseSchema: ListPluginsResponseSchema,
|
|
11433
|
+
auth: this.auth,
|
|
11434
|
+
numRetries: this.numRetries
|
|
11435
|
+
});
|
|
11436
|
+
}
|
|
11437
|
+
/**
|
|
11438
|
+
* Bind a plugin to the organisation.
|
|
11439
|
+
*
|
|
11440
|
+
* @remarks
|
|
11441
|
+
* `body.credentials` (e.g. `AIRS_API_KEY`) is a live secret. Setting `PANW_AI_SEC_DEBUG`
|
|
11442
|
+
* will print it, unredacted, to the SDK's own debug log.
|
|
11443
|
+
*
|
|
11444
|
+
* @param body - Integration id and provider-specific credentials.
|
|
11445
|
+
* @returns The raw create response. Shape unverified against a live tenant — see the PRD.
|
|
11446
|
+
* @example
|
|
11447
|
+
* ```ts
|
|
11448
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11449
|
+
* const gw = new AIGatewayClient();
|
|
11450
|
+
*
|
|
11451
|
+
* await gw.plugins.create({
|
|
11452
|
+
* organisation_id: '1852583913',
|
|
11453
|
+
* integration_id: '232e45c4-809a-11f1-af60-2ca2a760eb7b',
|
|
11454
|
+
* credentials: { AIRS_API_KEY: process.env.PANW_AI_SEC_API_KEY ?? '' },
|
|
11455
|
+
* });
|
|
11456
|
+
* ```
|
|
11457
|
+
*/
|
|
11458
|
+
async create(body) {
|
|
11459
|
+
assertUuid(body.integration_id, "integration_id");
|
|
11460
|
+
return request({
|
|
11461
|
+
method: "POST",
|
|
11462
|
+
baseUrl: this.baseUrl,
|
|
11463
|
+
path: AI_GW_PLUGINS_PATH,
|
|
11464
|
+
body,
|
|
11465
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11466
|
+
auth: this.auth,
|
|
11467
|
+
numRetries: this.numRetries
|
|
11468
|
+
});
|
|
11469
|
+
}
|
|
11470
|
+
};
|
|
11471
|
+
|
|
11472
|
+
// src/ai-gateway/organisations-client.ts
|
|
11473
|
+
var AIGatewayOrganisationsClient = class {
|
|
11474
|
+
baseUrl;
|
|
11475
|
+
auth;
|
|
11476
|
+
numRetries;
|
|
11477
|
+
constructor(opts) {
|
|
11478
|
+
this.baseUrl = opts.baseUrl;
|
|
11479
|
+
this.auth = opts.auth;
|
|
11480
|
+
this.numRetries = opts.numRetries;
|
|
11481
|
+
}
|
|
11482
|
+
/**
|
|
11483
|
+
* Fetch the calling organisation's settings.
|
|
11484
|
+
* @returns The organisation record.
|
|
11485
|
+
* @example
|
|
11486
|
+
* ```ts
|
|
11487
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11488
|
+
* const gw = new AIGatewayClient();
|
|
11489
|
+
*
|
|
11490
|
+
* const org = await gw.organisations.getSelf();
|
|
11491
|
+
* // org.data.name => 'Acme Corp'
|
|
11492
|
+
* ```
|
|
11493
|
+
*/
|
|
11494
|
+
async getSelf() {
|
|
11495
|
+
return request({
|
|
11496
|
+
method: "GET",
|
|
11497
|
+
baseUrl: this.baseUrl,
|
|
11498
|
+
path: AI_GW_ORGANISATIONS_SELF_PATH,
|
|
11499
|
+
responseSchema: OrganisationSelfResponseSchema,
|
|
11500
|
+
auth: this.auth,
|
|
11501
|
+
numRetries: this.numRetries
|
|
11502
|
+
});
|
|
11503
|
+
}
|
|
11504
|
+
/**
|
|
11505
|
+
* Update the calling organisation's settings.
|
|
11506
|
+
* @param body - Replacement fields.
|
|
11507
|
+
* @returns The raw update response. Shape unverified against a live tenant — see the PRD.
|
|
11508
|
+
* @example
|
|
11509
|
+
* ```ts
|
|
11510
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11511
|
+
* const gw = new AIGatewayClient();
|
|
11512
|
+
*
|
|
11513
|
+
* await gw.organisations.updateSelf({ name: 'Acme Corp' });
|
|
11514
|
+
* ```
|
|
11515
|
+
*/
|
|
11516
|
+
async updateSelf(body) {
|
|
11517
|
+
return request({
|
|
11518
|
+
method: "PUT",
|
|
11519
|
+
baseUrl: this.baseUrl,
|
|
11520
|
+
path: AI_GW_ORGANISATIONS_SELF_PATH,
|
|
11521
|
+
body,
|
|
11522
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11523
|
+
auth: this.auth,
|
|
11524
|
+
numRetries: this.numRetries
|
|
11525
|
+
});
|
|
11526
|
+
}
|
|
11527
|
+
/**
|
|
11528
|
+
* Fetch an organisation's auth settings.
|
|
11529
|
+
*
|
|
11530
|
+
* @remarks
|
|
11531
|
+
* The response includes a `scim_token` — a live secret. Never log the returned object.
|
|
11532
|
+
* Note that setting `PANW_AI_SEC_DEBUG` will print it (unredacted) to the SDK's own debug
|
|
11533
|
+
* log regardless of this warning, since debug logging only sanitizes header values.
|
|
11534
|
+
*
|
|
11535
|
+
* @param tsgId - The TSG as a numeric string, not a UUID.
|
|
11536
|
+
* @returns Auth settings, including domains and the SCIM token.
|
|
11537
|
+
* @example
|
|
11538
|
+
* ```ts
|
|
11539
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11540
|
+
* const gw = new AIGatewayClient();
|
|
11541
|
+
*
|
|
11542
|
+
* const auth = await gw.organisations.getAuthSettings('1852583913');
|
|
11543
|
+
* // Object.keys(auth.data) => ['auth_settings', 'domains', 'scim_token', ...]
|
|
11544
|
+
* ```
|
|
11545
|
+
*/
|
|
11546
|
+
async getAuthSettings(tsgId) {
|
|
11547
|
+
assertNumericId(tsgId, "tsgId");
|
|
11548
|
+
return request({
|
|
11549
|
+
method: "GET",
|
|
11550
|
+
baseUrl: this.baseUrl,
|
|
11551
|
+
path: aiGwOrganisationsAuthSettingsPath(tsgId),
|
|
11552
|
+
responseSchema: AuthSettingsResponseSchema,
|
|
11553
|
+
auth: this.auth,
|
|
11554
|
+
numRetries: this.numRetries
|
|
11555
|
+
});
|
|
11556
|
+
}
|
|
11557
|
+
/**
|
|
11558
|
+
* Update an organisation's auth settings.
|
|
11559
|
+
* @param tsgId - The TSG as a numeric string, not a UUID.
|
|
11560
|
+
* @param body - Replacement fields.
|
|
11561
|
+
* @returns The raw update response. Shape unverified against a live tenant — see the PRD.
|
|
11562
|
+
* @example
|
|
11563
|
+
* ```ts
|
|
11564
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11565
|
+
* const gw = new AIGatewayClient();
|
|
11566
|
+
*
|
|
11567
|
+
* await gw.organisations.updateAuthSettings('1852583913', {
|
|
11568
|
+
* domains: ['acme.com'],
|
|
11569
|
+
* });
|
|
11570
|
+
* ```
|
|
11571
|
+
*/
|
|
11572
|
+
async updateAuthSettings(tsgId, body) {
|
|
11573
|
+
assertNumericId(tsgId, "tsgId");
|
|
11574
|
+
return request({
|
|
11575
|
+
method: "PUT",
|
|
11576
|
+
baseUrl: this.baseUrl,
|
|
11577
|
+
path: aiGwOrganisationsAuthSettingsPath(tsgId),
|
|
11578
|
+
body,
|
|
11579
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11580
|
+
auth: this.auth,
|
|
11581
|
+
numRetries: this.numRetries
|
|
11582
|
+
});
|
|
11583
|
+
}
|
|
11584
|
+
};
|
|
11585
|
+
|
|
11586
|
+
// src/ai-gateway/audit-logs-client.ts
|
|
11587
|
+
var AIGatewayAuditLogsClient = class {
|
|
11588
|
+
baseUrl;
|
|
11589
|
+
auth;
|
|
11590
|
+
numRetries;
|
|
11591
|
+
constructor(opts) {
|
|
11592
|
+
this.baseUrl = opts.baseUrl;
|
|
11593
|
+
this.auth = opts.auth;
|
|
11594
|
+
this.numRetries = opts.numRetries;
|
|
11595
|
+
}
|
|
11596
|
+
/**
|
|
11597
|
+
* Read organisation audit logs.
|
|
11598
|
+
*
|
|
11599
|
+
* @remarks
|
|
11600
|
+
* **Handle the result as sensitive.** The API returns each entry's `request_body`
|
|
11601
|
+
* **unredacted**, so records for credential-bearing calls (integrations, plugins) can
|
|
11602
|
+
* contain live secrets — private keys, provider API keys — in plaintext. The sibling
|
|
11603
|
+
* `request_headers` field is masked, but `request_body` is not. The SDK returns the
|
|
11604
|
+
* response faithfully rather than altering it; never log these records wholesale, and
|
|
11605
|
+
* never forward them to a third-party sink. Note that setting `PANW_AI_SEC_DEBUG` will
|
|
11606
|
+
* print the raw response — including these unredacted secrets — to the SDK's own debug
|
|
11607
|
+
* log regardless of this warning.
|
|
11608
|
+
*
|
|
11609
|
+
* @param opts - Inclusive start and end of the window.
|
|
11610
|
+
* @returns Audit records, newest first.
|
|
11611
|
+
* @example
|
|
11612
|
+
* ```ts
|
|
11613
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11614
|
+
* const gw = new AIGatewayClient();
|
|
11615
|
+
*
|
|
11616
|
+
* const logs = await gw.auditLogs.list({
|
|
11617
|
+
* start: new Date('2026-07-20T00:00:00Z'),
|
|
11618
|
+
* end: new Date(),
|
|
11619
|
+
* });
|
|
11620
|
+
* // Safe projection — never log the whole record.
|
|
11621
|
+
* const summary = logs.records.map((r) => `${r.timestamp} ${r.method} ${r.uri}`);
|
|
11622
|
+
* ```
|
|
11623
|
+
*/
|
|
11624
|
+
async list(opts) {
|
|
11625
|
+
return request({
|
|
11626
|
+
method: "GET",
|
|
11627
|
+
baseUrl: this.baseUrl,
|
|
11628
|
+
path: AI_GW_AUDIT_LOGS_PATH,
|
|
11629
|
+
params: {
|
|
11630
|
+
start_time: opts.start.toISOString(),
|
|
11631
|
+
end_time: opts.end.toISOString()
|
|
11632
|
+
},
|
|
11633
|
+
responseSchema: GatewayAuditLogsResponseSchema,
|
|
11634
|
+
auth: this.auth,
|
|
11635
|
+
numRetries: this.numRetries
|
|
11636
|
+
});
|
|
11637
|
+
}
|
|
11638
|
+
};
|
|
11639
|
+
|
|
11640
|
+
// src/ai-gateway/client.ts
|
|
11641
|
+
var AIGatewayClient = class {
|
|
11642
|
+
/** Runtime telemetry: charts, group-bys, and raw request logs. */
|
|
11643
|
+
telemetry;
|
|
11644
|
+
/** Workspace reads (data plane). */
|
|
11645
|
+
workspaces;
|
|
11646
|
+
/** Gateway routing configs. */
|
|
11647
|
+
configs;
|
|
11648
|
+
/** Workspace guardrails. */
|
|
11649
|
+
guardrails;
|
|
11650
|
+
/** Workspace-scoped provider bindings. */
|
|
11651
|
+
providers;
|
|
11652
|
+
/** Service and user API keys. */
|
|
11653
|
+
apiKeys;
|
|
11654
|
+
/** Organisation-level provider integrations (admin plane). */
|
|
11655
|
+
integrations;
|
|
11656
|
+
/** MCP server integrations (admin plane). */
|
|
11657
|
+
mcpIntegrations;
|
|
11658
|
+
/** Gateway deployments (admin plane). */
|
|
11659
|
+
deployments;
|
|
11660
|
+
/** Plugin bindings such as the Prisma AIRS scanner (admin plane). */
|
|
11661
|
+
plugins;
|
|
11662
|
+
/** Organisation and auth settings (admin plane). */
|
|
11663
|
+
organisations;
|
|
11664
|
+
/** Organisation audit logs (admin plane). */
|
|
11665
|
+
auditLogs;
|
|
11666
|
+
constructor(opts = {}) {
|
|
11667
|
+
const dataEndpoint = opts.dataEndpoint ?? process.env[AI_GW_DATA_ENDPOINT] ?? DEFAULT_AI_GW_DATA_ENDPOINT;
|
|
11668
|
+
const adminEndpoint = opts.adminEndpoint ?? process.env[AI_GW_ADMIN_ENDPOINT] ?? DEFAULT_AI_GW_ADMIN_ENDPOINT;
|
|
11669
|
+
const { oauthClient, numRetries, tsgId } = resolveOAuthConfig({
|
|
11670
|
+
clientId: opts.clientId,
|
|
11671
|
+
clientSecret: opts.clientSecret,
|
|
11672
|
+
tsgId: opts.tsgId,
|
|
11673
|
+
baseUrl: dataEndpoint,
|
|
11674
|
+
numRetries: opts.numRetries,
|
|
11675
|
+
tokenEndpoint: opts.tokenEndpoint,
|
|
11676
|
+
primaryEnvPrefix: "PANW_AI_GW",
|
|
11677
|
+
fallbackEnvPrefix: "PANW_MGMT"
|
|
11678
|
+
});
|
|
11679
|
+
const auth = new TsgHeaderAuth(new OAuthAuth(oauthClient), tsgId);
|
|
11680
|
+
const dataOpts = { baseUrl: dataEndpoint, auth, numRetries };
|
|
11681
|
+
const adminOpts = { baseUrl: adminEndpoint, auth, numRetries };
|
|
11682
|
+
this.telemetry = new AIGatewayTelemetryClient({ ...dataOpts, tsgId });
|
|
11683
|
+
this.workspaces = new AIGatewayWorkspacesClient(dataOpts);
|
|
11684
|
+
this.configs = new AIGatewayConfigsClient(dataOpts);
|
|
11685
|
+
this.guardrails = new AIGatewayGuardrailsClient(dataOpts);
|
|
11686
|
+
this.providers = new AIGatewayProvidersClient(dataOpts);
|
|
11687
|
+
this.apiKeys = new AIGatewayApiKeysClient(dataOpts);
|
|
11688
|
+
this.integrations = new AIGatewayIntegrationsClient(adminOpts);
|
|
11689
|
+
this.mcpIntegrations = new AIGatewayMcpIntegrationsClient(adminOpts);
|
|
11690
|
+
this.deployments = new AIGatewayDeploymentsClient(adminOpts);
|
|
11691
|
+
this.plugins = new AIGatewayPluginsClient(adminOpts);
|
|
11692
|
+
this.organisations = new AIGatewayOrganisationsClient(adminOpts);
|
|
11693
|
+
this.auditLogs = new AIGatewayAuditLogsClient(adminOpts);
|
|
11694
|
+
}
|
|
11695
|
+
};
|
|
9358
11696
|
export {
|
|
11697
|
+
AIGatewayApiKeysClient,
|
|
11698
|
+
AIGatewayAuditLogsClient,
|
|
11699
|
+
AIGatewayClient,
|
|
11700
|
+
AIGatewayConfigsClient,
|
|
11701
|
+
AIGatewayDeploymentsClient,
|
|
11702
|
+
AIGatewayGuardrailsClient,
|
|
11703
|
+
AIGatewayIntegrationsClient,
|
|
11704
|
+
AIGatewayMcpIntegrationsClient,
|
|
11705
|
+
AIGatewayOrganisationsClient,
|
|
11706
|
+
AIGatewayPluginsClient,
|
|
11707
|
+
AIGatewayProvidersClient,
|
|
11708
|
+
AIGatewayTelemetryClient,
|
|
11709
|
+
AIGatewayWorkspacesClient,
|
|
9359
11710
|
AIRS_ENDPOINTS,
|
|
9360
11711
|
AISecSDKException,
|
|
11712
|
+
AI_GW_ADMIN_ENDPOINT,
|
|
11713
|
+
AI_GW_API_KEYS_SERVICE_PATH,
|
|
11714
|
+
AI_GW_API_KEYS_USER_PATH,
|
|
11715
|
+
AI_GW_AUDIT_LOGS_PATH,
|
|
11716
|
+
AI_GW_CHARTS_PATH,
|
|
11717
|
+
AI_GW_CHART_METRICS,
|
|
11718
|
+
AI_GW_CONFIGS_PATH,
|
|
11719
|
+
AI_GW_DATA_ENDPOINT,
|
|
11720
|
+
AI_GW_DEPLOYMENTS_PATH,
|
|
11721
|
+
AI_GW_GROUPS_PATH,
|
|
11722
|
+
AI_GW_GROUP_COLUMNS,
|
|
11723
|
+
AI_GW_GROUP_DIMENSIONS,
|
|
11724
|
+
AI_GW_GUARDRAILS_PATH,
|
|
11725
|
+
AI_GW_INTEGRATIONS_PATH,
|
|
11726
|
+
AI_GW_LOGS_PATH,
|
|
11727
|
+
AI_GW_MCP_INTEGRATIONS_PATH,
|
|
11728
|
+
AI_GW_ORGANISATIONS_SELF_PATH,
|
|
11729
|
+
AI_GW_PLUGINS_PATH,
|
|
11730
|
+
AI_GW_PROVIDERS_PATH,
|
|
11731
|
+
AI_GW_WORKSPACES_PATH,
|
|
9361
11732
|
AI_SEC_API_ENDPOINT,
|
|
9362
11733
|
AI_SEC_API_KEY,
|
|
9363
11734
|
AI_SEC_API_TOKEN,
|
|
@@ -9391,6 +11762,7 @@ export {
|
|
|
9391
11762
|
AttackType,
|
|
9392
11763
|
AuditResponseSchema,
|
|
9393
11764
|
AuthConfigSchema,
|
|
11765
|
+
AuthSettingsResponseSchema,
|
|
9394
11766
|
AuthType,
|
|
9395
11767
|
BEARER,
|
|
9396
11768
|
BaseResponseSchema,
|
|
@@ -9398,6 +11770,8 @@ export {
|
|
|
9398
11770
|
BasicAuthLocation,
|
|
9399
11771
|
BedrockAccessConnectionParamsSchema,
|
|
9400
11772
|
BrandSubCategory,
|
|
11773
|
+
CacheHitTrendResponseSchema,
|
|
11774
|
+
CacheSummaryResponseSchema,
|
|
9401
11775
|
Category,
|
|
9402
11776
|
CategoryModelSchema,
|
|
9403
11777
|
CategoryReportSchema,
|
|
@@ -9419,7 +11793,9 @@ export {
|
|
|
9419
11793
|
Content,
|
|
9420
11794
|
ContentErrorSchema,
|
|
9421
11795
|
ContentErrorType,
|
|
11796
|
+
CostChartResponseSchema,
|
|
9422
11797
|
CountByNameSchema,
|
|
11798
|
+
CountChartResponseSchema,
|
|
9423
11799
|
CountedQuotaEnum,
|
|
9424
11800
|
CreateChannelRequestSchema,
|
|
9425
11801
|
CreateCustomTopicRequestSchema,
|
|
@@ -9449,6 +11825,8 @@ export {
|
|
|
9449
11825
|
CustomerAppSchema,
|
|
9450
11826
|
CustomerAppWithKeysSchema,
|
|
9451
11827
|
CustomerAppsClient,
|
|
11828
|
+
DEFAULT_AI_GW_ADMIN_ENDPOINT,
|
|
11829
|
+
DEFAULT_AI_GW_DATA_ENDPOINT,
|
|
9452
11830
|
DEFAULT_DLP_ENDPOINT,
|
|
9453
11831
|
DEFAULT_ENDPOINT,
|
|
9454
11832
|
DEFAULT_MGMT_ENDPOINT,
|
|
@@ -9553,6 +11931,7 @@ export {
|
|
|
9553
11931
|
ErrorResponseSchema,
|
|
9554
11932
|
ErrorSource,
|
|
9555
11933
|
ErrorStatus,
|
|
11934
|
+
ErrorTrendsResponseSchema,
|
|
9556
11935
|
ErrorType,
|
|
9557
11936
|
EulaAcceptRequestSchema,
|
|
9558
11937
|
EulaContentResponseSchema,
|
|
@@ -9563,16 +11942,46 @@ export {
|
|
|
9563
11942
|
ExclusionsSchema,
|
|
9564
11943
|
ExpressionOperatorTypeSchema,
|
|
9565
11944
|
ExpressionTreeNodeSchema,
|
|
11945
|
+
FeedbackModelsResponseSchema,
|
|
11946
|
+
FeedbackScoreDistributionResponseSchema,
|
|
9566
11947
|
FileFormat,
|
|
9567
11948
|
FileListSchema,
|
|
9568
11949
|
FileResponseSchema,
|
|
9569
11950
|
FileScanDataSchema,
|
|
9570
11951
|
FileScanResult,
|
|
9571
11952
|
FileType,
|
|
11953
|
+
GatewayApiKeySchema,
|
|
11954
|
+
GatewayAuditLogRecordSchema,
|
|
11955
|
+
GatewayAuditLogsResponseSchema,
|
|
11956
|
+
GatewayChartRecordSchema,
|
|
11957
|
+
GatewayConfigCreateResponseSchema,
|
|
11958
|
+
GatewayConfigDetailSchema,
|
|
11959
|
+
GatewayConfigSchema,
|
|
11960
|
+
GatewayDeploymentCreateResponseSchema,
|
|
11961
|
+
GatewayDeploymentDetailSchema,
|
|
11962
|
+
GatewayDeploymentSchema,
|
|
11963
|
+
GatewayGlobalWorkspaceAccessSchema,
|
|
11964
|
+
GatewayGroupRowSchema,
|
|
11965
|
+
GatewayGuardrailCreateResponseSchema,
|
|
11966
|
+
GatewayGuardrailDetailSchema,
|
|
11967
|
+
GatewayGuardrailSchema,
|
|
11968
|
+
GatewayIntegrationModelsResponseSchema,
|
|
11969
|
+
GatewayIntegrationSchema,
|
|
11970
|
+
GatewayIntegrationWorkspaceSchema,
|
|
11971
|
+
GatewayIntegrationWorkspacesResponseSchema,
|
|
11972
|
+
GatewayLogRecordSchema,
|
|
11973
|
+
GatewayLogsResponseSchema,
|
|
11974
|
+
GatewayPluginSchema,
|
|
11975
|
+
GatewayProviderCreateResponseSchema,
|
|
11976
|
+
GatewayProviderSchema,
|
|
11977
|
+
GatewayWorkspaceDetailSchema,
|
|
11978
|
+
GatewayWorkspaceSchema,
|
|
11979
|
+
GatewayWriteResponseSchema,
|
|
9572
11980
|
GoalListResponseSchema,
|
|
9573
11981
|
GoalSchema,
|
|
9574
11982
|
GoalType,
|
|
9575
11983
|
GoalTypeQueryParam,
|
|
11984
|
+
GroupListResponseSchema,
|
|
9576
11985
|
GuardrailAction,
|
|
9577
11986
|
HEADER_API_KEY,
|
|
9578
11987
|
HEADER_AUTH_TOKEN,
|
|
@@ -9599,9 +12008,19 @@ export {
|
|
|
9599
12008
|
LabelsCreateRequestSchema,
|
|
9600
12009
|
LabelsResponseSchema,
|
|
9601
12010
|
LanguageOptionSchema,
|
|
12011
|
+
LatencyChartResponseSchema,
|
|
12012
|
+
ListApiKeysResponseSchema,
|
|
12013
|
+
ListConfigsResponseSchema,
|
|
12014
|
+
ListDeploymentsResponseSchema,
|
|
12015
|
+
ListGuardrailsResponseSchema,
|
|
12016
|
+
ListIntegrationsResponseSchema,
|
|
12017
|
+
ListMcpIntegrationsResponseSchema,
|
|
9602
12018
|
ListModelSecurityGroupsResponseSchema,
|
|
9603
12019
|
ListModelSecurityRuleInstancesResponseSchema,
|
|
9604
12020
|
ListModelSecurityRulesResponseSchema,
|
|
12021
|
+
ListPluginsResponseSchema,
|
|
12022
|
+
ListProvidersResponseSchema,
|
|
12023
|
+
ListWorkspacesResponseSchema,
|
|
9605
12024
|
MAX_AI_PROFILE_NAME_LENGTH,
|
|
9606
12025
|
MAX_API_KEY_LENGTH,
|
|
9607
12026
|
MAX_CONNECTION_POOL_SIZE,
|
|
@@ -9659,6 +12078,7 @@ export {
|
|
|
9659
12078
|
MaskedDataSchema,
|
|
9660
12079
|
McEntrySchema,
|
|
9661
12080
|
McReportSchema,
|
|
12081
|
+
McpIntegrationSchema,
|
|
9662
12082
|
MetadataCriterionSchema,
|
|
9663
12083
|
MetadataSchema,
|
|
9664
12084
|
ModelConfigurationSchema,
|
|
@@ -9692,6 +12112,7 @@ export {
|
|
|
9692
12112
|
Oauth2TokenSchema,
|
|
9693
12113
|
OffsetSchema,
|
|
9694
12114
|
OpenAIConnectionParamsSchema,
|
|
12115
|
+
OrganisationSelfResponseSchema,
|
|
9695
12116
|
PAYLOAD_HASH,
|
|
9696
12117
|
PageDataFilteringProfileResponseSchema,
|
|
9697
12118
|
PageDataPatternResponseSchema,
|
|
@@ -9769,6 +12190,7 @@ export {
|
|
|
9769
12190
|
RegistryCredentialsSchema,
|
|
9770
12191
|
RemediationDetailSchema,
|
|
9771
12192
|
RemediationResponseSchema,
|
|
12193
|
+
RescuedRetriesResponseSchema,
|
|
9772
12194
|
ResourceModelExtensionSchema,
|
|
9773
12195
|
ResponseDetectedSchema,
|
|
9774
12196
|
ResponseDetectionDetailsSchema,
|
|
@@ -9843,6 +12265,7 @@ export {
|
|
|
9843
12265
|
StreamingConnectionParamsSchema,
|
|
9844
12266
|
SubCategoryModelSchema,
|
|
9845
12267
|
SubCategoryStatsSchema,
|
|
12268
|
+
TSG_ID_HEADER,
|
|
9846
12269
|
TargetAdditionalContextSchema,
|
|
9847
12270
|
TargetAuthType,
|
|
9848
12271
|
TargetAuthValidationRequestSchema,
|
|
@@ -9869,6 +12292,7 @@ export {
|
|
|
9869
12292
|
ThreatCategory,
|
|
9870
12293
|
ThreatScanReportSchema,
|
|
9871
12294
|
TokenStatsSchema,
|
|
12295
|
+
TokensChartResponseSchema,
|
|
9872
12296
|
ToolDetectedSchema,
|
|
9873
12297
|
ToolDetectionDetailsSchema,
|
|
9874
12298
|
ToolDetectionEntrySchema,
|
|
@@ -9883,6 +12307,8 @@ export {
|
|
|
9883
12307
|
UpdateChannelRequestSchema,
|
|
9884
12308
|
UrlCategorySchema,
|
|
9885
12309
|
UrlfEntrySchema,
|
|
12310
|
+
UserGroupResponseSchema,
|
|
12311
|
+
UserTrendsResponseSchema,
|
|
9886
12312
|
ValidationErrorSchema,
|
|
9887
12313
|
Verdict,
|
|
9888
12314
|
ViolationListSchema,
|
|
@@ -9891,6 +12317,7 @@ export {
|
|
|
9891
12317
|
ViolationSeverityCountsSchema,
|
|
9892
12318
|
WebSocketConnectionParamsSchema,
|
|
9893
12319
|
WeightedRegexSchema,
|
|
12320
|
+
aiGwOrganisationsAuthSettingsPath,
|
|
9894
12321
|
globalConfiguration,
|
|
9895
12322
|
init,
|
|
9896
12323
|
jsonNullable,
|