@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.cjs
CHANGED
|
@@ -20,8 +20,41 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
AIGatewayApiKeysClient: () => AIGatewayApiKeysClient,
|
|
24
|
+
AIGatewayAuditLogsClient: () => AIGatewayAuditLogsClient,
|
|
25
|
+
AIGatewayClient: () => AIGatewayClient,
|
|
26
|
+
AIGatewayConfigsClient: () => AIGatewayConfigsClient,
|
|
27
|
+
AIGatewayDeploymentsClient: () => AIGatewayDeploymentsClient,
|
|
28
|
+
AIGatewayGuardrailsClient: () => AIGatewayGuardrailsClient,
|
|
29
|
+
AIGatewayIntegrationsClient: () => AIGatewayIntegrationsClient,
|
|
30
|
+
AIGatewayMcpIntegrationsClient: () => AIGatewayMcpIntegrationsClient,
|
|
31
|
+
AIGatewayOrganisationsClient: () => AIGatewayOrganisationsClient,
|
|
32
|
+
AIGatewayPluginsClient: () => AIGatewayPluginsClient,
|
|
33
|
+
AIGatewayProvidersClient: () => AIGatewayProvidersClient,
|
|
34
|
+
AIGatewayTelemetryClient: () => AIGatewayTelemetryClient,
|
|
35
|
+
AIGatewayWorkspacesClient: () => AIGatewayWorkspacesClient,
|
|
23
36
|
AIRS_ENDPOINTS: () => AIRS_ENDPOINTS,
|
|
24
37
|
AISecSDKException: () => AISecSDKException,
|
|
38
|
+
AI_GW_ADMIN_ENDPOINT: () => AI_GW_ADMIN_ENDPOINT,
|
|
39
|
+
AI_GW_API_KEYS_SERVICE_PATH: () => AI_GW_API_KEYS_SERVICE_PATH,
|
|
40
|
+
AI_GW_API_KEYS_USER_PATH: () => AI_GW_API_KEYS_USER_PATH,
|
|
41
|
+
AI_GW_AUDIT_LOGS_PATH: () => AI_GW_AUDIT_LOGS_PATH,
|
|
42
|
+
AI_GW_CHARTS_PATH: () => AI_GW_CHARTS_PATH,
|
|
43
|
+
AI_GW_CHART_METRICS: () => AI_GW_CHART_METRICS,
|
|
44
|
+
AI_GW_CONFIGS_PATH: () => AI_GW_CONFIGS_PATH,
|
|
45
|
+
AI_GW_DATA_ENDPOINT: () => AI_GW_DATA_ENDPOINT,
|
|
46
|
+
AI_GW_DEPLOYMENTS_PATH: () => AI_GW_DEPLOYMENTS_PATH,
|
|
47
|
+
AI_GW_GROUPS_PATH: () => AI_GW_GROUPS_PATH,
|
|
48
|
+
AI_GW_GROUP_COLUMNS: () => AI_GW_GROUP_COLUMNS,
|
|
49
|
+
AI_GW_GROUP_DIMENSIONS: () => AI_GW_GROUP_DIMENSIONS,
|
|
50
|
+
AI_GW_GUARDRAILS_PATH: () => AI_GW_GUARDRAILS_PATH,
|
|
51
|
+
AI_GW_INTEGRATIONS_PATH: () => AI_GW_INTEGRATIONS_PATH,
|
|
52
|
+
AI_GW_LOGS_PATH: () => AI_GW_LOGS_PATH,
|
|
53
|
+
AI_GW_MCP_INTEGRATIONS_PATH: () => AI_GW_MCP_INTEGRATIONS_PATH,
|
|
54
|
+
AI_GW_ORGANISATIONS_SELF_PATH: () => AI_GW_ORGANISATIONS_SELF_PATH,
|
|
55
|
+
AI_GW_PLUGINS_PATH: () => AI_GW_PLUGINS_PATH,
|
|
56
|
+
AI_GW_PROVIDERS_PATH: () => AI_GW_PROVIDERS_PATH,
|
|
57
|
+
AI_GW_WORKSPACES_PATH: () => AI_GW_WORKSPACES_PATH,
|
|
25
58
|
AI_SEC_API_ENDPOINT: () => AI_SEC_API_ENDPOINT,
|
|
26
59
|
AI_SEC_API_KEY: () => AI_SEC_API_KEY,
|
|
27
60
|
AI_SEC_API_TOKEN: () => AI_SEC_API_TOKEN,
|
|
@@ -55,6 +88,7 @@ __export(index_exports, {
|
|
|
55
88
|
AttackType: () => AttackType,
|
|
56
89
|
AuditResponseSchema: () => AuditResponseSchema,
|
|
57
90
|
AuthConfigSchema: () => AuthConfigSchema,
|
|
91
|
+
AuthSettingsResponseSchema: () => AuthSettingsResponseSchema,
|
|
58
92
|
AuthType: () => AuthType,
|
|
59
93
|
BEARER: () => BEARER,
|
|
60
94
|
BaseResponseSchema: () => BaseResponseSchema,
|
|
@@ -62,6 +96,8 @@ __export(index_exports, {
|
|
|
62
96
|
BasicAuthLocation: () => BasicAuthLocation,
|
|
63
97
|
BedrockAccessConnectionParamsSchema: () => BedrockAccessConnectionParamsSchema,
|
|
64
98
|
BrandSubCategory: () => BrandSubCategory,
|
|
99
|
+
CacheHitTrendResponseSchema: () => CacheHitTrendResponseSchema,
|
|
100
|
+
CacheSummaryResponseSchema: () => CacheSummaryResponseSchema,
|
|
65
101
|
Category: () => Category,
|
|
66
102
|
CategoryModelSchema: () => CategoryModelSchema,
|
|
67
103
|
CategoryReportSchema: () => CategoryReportSchema,
|
|
@@ -83,7 +119,9 @@ __export(index_exports, {
|
|
|
83
119
|
Content: () => Content,
|
|
84
120
|
ContentErrorSchema: () => ContentErrorSchema,
|
|
85
121
|
ContentErrorType: () => ContentErrorType,
|
|
122
|
+
CostChartResponseSchema: () => CostChartResponseSchema,
|
|
86
123
|
CountByNameSchema: () => CountByNameSchema,
|
|
124
|
+
CountChartResponseSchema: () => CountChartResponseSchema,
|
|
87
125
|
CountedQuotaEnum: () => CountedQuotaEnum,
|
|
88
126
|
CreateChannelRequestSchema: () => CreateChannelRequestSchema,
|
|
89
127
|
CreateCustomTopicRequestSchema: () => CreateCustomTopicRequestSchema,
|
|
@@ -113,6 +151,8 @@ __export(index_exports, {
|
|
|
113
151
|
CustomerAppSchema: () => CustomerAppSchema,
|
|
114
152
|
CustomerAppWithKeysSchema: () => CustomerAppWithKeysSchema,
|
|
115
153
|
CustomerAppsClient: () => CustomerAppsClient,
|
|
154
|
+
DEFAULT_AI_GW_ADMIN_ENDPOINT: () => DEFAULT_AI_GW_ADMIN_ENDPOINT,
|
|
155
|
+
DEFAULT_AI_GW_DATA_ENDPOINT: () => DEFAULT_AI_GW_DATA_ENDPOINT,
|
|
116
156
|
DEFAULT_DLP_ENDPOINT: () => DEFAULT_DLP_ENDPOINT,
|
|
117
157
|
DEFAULT_ENDPOINT: () => DEFAULT_ENDPOINT,
|
|
118
158
|
DEFAULT_MGMT_ENDPOINT: () => DEFAULT_MGMT_ENDPOINT,
|
|
@@ -217,6 +257,7 @@ __export(index_exports, {
|
|
|
217
257
|
ErrorResponseSchema: () => ErrorResponseSchema,
|
|
218
258
|
ErrorSource: () => ErrorSource,
|
|
219
259
|
ErrorStatus: () => ErrorStatus,
|
|
260
|
+
ErrorTrendsResponseSchema: () => ErrorTrendsResponseSchema,
|
|
220
261
|
ErrorType: () => ErrorType,
|
|
221
262
|
EulaAcceptRequestSchema: () => EulaAcceptRequestSchema,
|
|
222
263
|
EulaContentResponseSchema: () => EulaContentResponseSchema,
|
|
@@ -227,16 +268,46 @@ __export(index_exports, {
|
|
|
227
268
|
ExclusionsSchema: () => ExclusionsSchema,
|
|
228
269
|
ExpressionOperatorTypeSchema: () => ExpressionOperatorTypeSchema,
|
|
229
270
|
ExpressionTreeNodeSchema: () => ExpressionTreeNodeSchema,
|
|
271
|
+
FeedbackModelsResponseSchema: () => FeedbackModelsResponseSchema,
|
|
272
|
+
FeedbackScoreDistributionResponseSchema: () => FeedbackScoreDistributionResponseSchema,
|
|
230
273
|
FileFormat: () => FileFormat,
|
|
231
274
|
FileListSchema: () => FileListSchema,
|
|
232
275
|
FileResponseSchema: () => FileResponseSchema,
|
|
233
276
|
FileScanDataSchema: () => FileScanDataSchema,
|
|
234
277
|
FileScanResult: () => FileScanResult,
|
|
235
278
|
FileType: () => FileType,
|
|
279
|
+
GatewayApiKeySchema: () => GatewayApiKeySchema,
|
|
280
|
+
GatewayAuditLogRecordSchema: () => GatewayAuditLogRecordSchema,
|
|
281
|
+
GatewayAuditLogsResponseSchema: () => GatewayAuditLogsResponseSchema,
|
|
282
|
+
GatewayChartRecordSchema: () => GatewayChartRecordSchema,
|
|
283
|
+
GatewayConfigCreateResponseSchema: () => GatewayConfigCreateResponseSchema,
|
|
284
|
+
GatewayConfigDetailSchema: () => GatewayConfigDetailSchema,
|
|
285
|
+
GatewayConfigSchema: () => GatewayConfigSchema,
|
|
286
|
+
GatewayDeploymentCreateResponseSchema: () => GatewayDeploymentCreateResponseSchema,
|
|
287
|
+
GatewayDeploymentDetailSchema: () => GatewayDeploymentDetailSchema,
|
|
288
|
+
GatewayDeploymentSchema: () => GatewayDeploymentSchema,
|
|
289
|
+
GatewayGlobalWorkspaceAccessSchema: () => GatewayGlobalWorkspaceAccessSchema,
|
|
290
|
+
GatewayGroupRowSchema: () => GatewayGroupRowSchema,
|
|
291
|
+
GatewayGuardrailCreateResponseSchema: () => GatewayGuardrailCreateResponseSchema,
|
|
292
|
+
GatewayGuardrailDetailSchema: () => GatewayGuardrailDetailSchema,
|
|
293
|
+
GatewayGuardrailSchema: () => GatewayGuardrailSchema,
|
|
294
|
+
GatewayIntegrationModelsResponseSchema: () => GatewayIntegrationModelsResponseSchema,
|
|
295
|
+
GatewayIntegrationSchema: () => GatewayIntegrationSchema,
|
|
296
|
+
GatewayIntegrationWorkspaceSchema: () => GatewayIntegrationWorkspaceSchema,
|
|
297
|
+
GatewayIntegrationWorkspacesResponseSchema: () => GatewayIntegrationWorkspacesResponseSchema,
|
|
298
|
+
GatewayLogRecordSchema: () => GatewayLogRecordSchema,
|
|
299
|
+
GatewayLogsResponseSchema: () => GatewayLogsResponseSchema,
|
|
300
|
+
GatewayPluginSchema: () => GatewayPluginSchema,
|
|
301
|
+
GatewayProviderCreateResponseSchema: () => GatewayProviderCreateResponseSchema,
|
|
302
|
+
GatewayProviderSchema: () => GatewayProviderSchema,
|
|
303
|
+
GatewayWorkspaceDetailSchema: () => GatewayWorkspaceDetailSchema,
|
|
304
|
+
GatewayWorkspaceSchema: () => GatewayWorkspaceSchema,
|
|
305
|
+
GatewayWriteResponseSchema: () => GatewayWriteResponseSchema,
|
|
236
306
|
GoalListResponseSchema: () => GoalListResponseSchema,
|
|
237
307
|
GoalSchema: () => GoalSchema,
|
|
238
308
|
GoalType: () => GoalType,
|
|
239
309
|
GoalTypeQueryParam: () => GoalTypeQueryParam,
|
|
310
|
+
GroupListResponseSchema: () => GroupListResponseSchema,
|
|
240
311
|
GuardrailAction: () => GuardrailAction,
|
|
241
312
|
HEADER_API_KEY: () => HEADER_API_KEY,
|
|
242
313
|
HEADER_AUTH_TOKEN: () => HEADER_AUTH_TOKEN,
|
|
@@ -263,9 +334,19 @@ __export(index_exports, {
|
|
|
263
334
|
LabelsCreateRequestSchema: () => LabelsCreateRequestSchema,
|
|
264
335
|
LabelsResponseSchema: () => LabelsResponseSchema,
|
|
265
336
|
LanguageOptionSchema: () => LanguageOptionSchema,
|
|
337
|
+
LatencyChartResponseSchema: () => LatencyChartResponseSchema,
|
|
338
|
+
ListApiKeysResponseSchema: () => ListApiKeysResponseSchema,
|
|
339
|
+
ListConfigsResponseSchema: () => ListConfigsResponseSchema,
|
|
340
|
+
ListDeploymentsResponseSchema: () => ListDeploymentsResponseSchema,
|
|
341
|
+
ListGuardrailsResponseSchema: () => ListGuardrailsResponseSchema,
|
|
342
|
+
ListIntegrationsResponseSchema: () => ListIntegrationsResponseSchema,
|
|
343
|
+
ListMcpIntegrationsResponseSchema: () => ListMcpIntegrationsResponseSchema,
|
|
266
344
|
ListModelSecurityGroupsResponseSchema: () => ListModelSecurityGroupsResponseSchema,
|
|
267
345
|
ListModelSecurityRuleInstancesResponseSchema: () => ListModelSecurityRuleInstancesResponseSchema,
|
|
268
346
|
ListModelSecurityRulesResponseSchema: () => ListModelSecurityRulesResponseSchema,
|
|
347
|
+
ListPluginsResponseSchema: () => ListPluginsResponseSchema,
|
|
348
|
+
ListProvidersResponseSchema: () => ListProvidersResponseSchema,
|
|
349
|
+
ListWorkspacesResponseSchema: () => ListWorkspacesResponseSchema,
|
|
269
350
|
MAX_AI_PROFILE_NAME_LENGTH: () => MAX_AI_PROFILE_NAME_LENGTH,
|
|
270
351
|
MAX_API_KEY_LENGTH: () => MAX_API_KEY_LENGTH,
|
|
271
352
|
MAX_CONNECTION_POOL_SIZE: () => MAX_CONNECTION_POOL_SIZE,
|
|
@@ -323,6 +404,7 @@ __export(index_exports, {
|
|
|
323
404
|
MaskedDataSchema: () => MaskedDataSchema,
|
|
324
405
|
McEntrySchema: () => McEntrySchema,
|
|
325
406
|
McReportSchema: () => McReportSchema,
|
|
407
|
+
McpIntegrationSchema: () => McpIntegrationSchema,
|
|
326
408
|
MetadataCriterionSchema: () => MetadataCriterionSchema,
|
|
327
409
|
MetadataSchema: () => MetadataSchema,
|
|
328
410
|
ModelConfigurationSchema: () => ModelConfigurationSchema,
|
|
@@ -356,6 +438,7 @@ __export(index_exports, {
|
|
|
356
438
|
Oauth2TokenSchema: () => Oauth2TokenSchema,
|
|
357
439
|
OffsetSchema: () => OffsetSchema,
|
|
358
440
|
OpenAIConnectionParamsSchema: () => OpenAIConnectionParamsSchema,
|
|
441
|
+
OrganisationSelfResponseSchema: () => OrganisationSelfResponseSchema,
|
|
359
442
|
PAYLOAD_HASH: () => PAYLOAD_HASH,
|
|
360
443
|
PageDataFilteringProfileResponseSchema: () => PageDataFilteringProfileResponseSchema,
|
|
361
444
|
PageDataPatternResponseSchema: () => PageDataPatternResponseSchema,
|
|
@@ -433,6 +516,7 @@ __export(index_exports, {
|
|
|
433
516
|
RegistryCredentialsSchema: () => RegistryCredentialsSchema,
|
|
434
517
|
RemediationDetailSchema: () => RemediationDetailSchema,
|
|
435
518
|
RemediationResponseSchema: () => RemediationResponseSchema,
|
|
519
|
+
RescuedRetriesResponseSchema: () => RescuedRetriesResponseSchema,
|
|
436
520
|
ResourceModelExtensionSchema: () => ResourceModelExtensionSchema,
|
|
437
521
|
ResponseDetectedSchema: () => ResponseDetectedSchema,
|
|
438
522
|
ResponseDetectionDetailsSchema: () => ResponseDetectionDetailsSchema,
|
|
@@ -507,6 +591,7 @@ __export(index_exports, {
|
|
|
507
591
|
StreamingConnectionParamsSchema: () => StreamingConnectionParamsSchema,
|
|
508
592
|
SubCategoryModelSchema: () => SubCategoryModelSchema,
|
|
509
593
|
SubCategoryStatsSchema: () => SubCategoryStatsSchema,
|
|
594
|
+
TSG_ID_HEADER: () => TSG_ID_HEADER,
|
|
510
595
|
TargetAdditionalContextSchema: () => TargetAdditionalContextSchema,
|
|
511
596
|
TargetAuthType: () => TargetAuthType,
|
|
512
597
|
TargetAuthValidationRequestSchema: () => TargetAuthValidationRequestSchema,
|
|
@@ -533,6 +618,7 @@ __export(index_exports, {
|
|
|
533
618
|
ThreatCategory: () => ThreatCategory,
|
|
534
619
|
ThreatScanReportSchema: () => ThreatScanReportSchema,
|
|
535
620
|
TokenStatsSchema: () => TokenStatsSchema,
|
|
621
|
+
TokensChartResponseSchema: () => TokensChartResponseSchema,
|
|
536
622
|
ToolDetectedSchema: () => ToolDetectedSchema,
|
|
537
623
|
ToolDetectionDetailsSchema: () => ToolDetectionDetailsSchema,
|
|
538
624
|
ToolDetectionEntrySchema: () => ToolDetectionEntrySchema,
|
|
@@ -547,6 +633,8 @@ __export(index_exports, {
|
|
|
547
633
|
UpdateChannelRequestSchema: () => UpdateChannelRequestSchema,
|
|
548
634
|
UrlCategorySchema: () => UrlCategorySchema,
|
|
549
635
|
UrlfEntrySchema: () => UrlfEntrySchema,
|
|
636
|
+
UserGroupResponseSchema: () => UserGroupResponseSchema,
|
|
637
|
+
UserTrendsResponseSchema: () => UserTrendsResponseSchema,
|
|
550
638
|
ValidationErrorSchema: () => ValidationErrorSchema,
|
|
551
639
|
Verdict: () => Verdict,
|
|
552
640
|
ViolationListSchema: () => ViolationListSchema,
|
|
@@ -555,6 +643,7 @@ __export(index_exports, {
|
|
|
555
643
|
ViolationSeverityCountsSchema: () => ViolationSeverityCountsSchema,
|
|
556
644
|
WebSocketConnectionParamsSchema: () => WebSocketConnectionParamsSchema,
|
|
557
645
|
WeightedRegexSchema: () => WeightedRegexSchema,
|
|
646
|
+
aiGwOrganisationsAuthSettingsPath: () => aiGwOrganisationsAuthSettingsPath,
|
|
558
647
|
globalConfiguration: () => globalConfiguration,
|
|
559
648
|
init: () => init,
|
|
560
649
|
jsonNullable: () => jsonNullable,
|
|
@@ -593,7 +682,7 @@ var MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 20;
|
|
|
593
682
|
var MAX_CONNECTION_POOL_SIZE = 100;
|
|
594
683
|
var MAX_NUMBER_OF_RETRIES = 5;
|
|
595
684
|
var HTTP_FORCE_RETRY_STATUS_CODES = [500, 502, 503, 504];
|
|
596
|
-
var SDK_VERSION = "0.
|
|
685
|
+
var SDK_VERSION = "0.14.1";
|
|
597
686
|
var USER_AGENT = `PAN-AIRS/${SDK_VERSION}-typescript-sdk`;
|
|
598
687
|
var DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
|
|
599
688
|
var DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
|
|
@@ -676,6 +765,55 @@ var RED_TEAM_CUSTOM_ATTACK_PATH = "/v1/custom-attack";
|
|
|
676
765
|
var RED_TEAM_MGMT_DASHBOARD_PATH = "/v1/dashboard/overview";
|
|
677
766
|
var RED_TEAM_CHANNELS_PATH = "/v1/channels";
|
|
678
767
|
var RED_TEAM_CHANNELS_STATS_PATH = "/v1/channels/stats";
|
|
768
|
+
var DEFAULT_AI_GW_DATA_ENDPOINT = "https://api.apps.paloaltonetworks.com/ai_gw/v2";
|
|
769
|
+
var DEFAULT_AI_GW_ADMIN_ENDPOINT = "https://api.apps.paloaltonetworks.com/ai_gw/admin/v2";
|
|
770
|
+
var AI_GW_DATA_ENDPOINT = "PANW_AI_GW_DATA_ENDPOINT";
|
|
771
|
+
var AI_GW_ADMIN_ENDPOINT = "PANW_AI_GW_ADMIN_ENDPOINT";
|
|
772
|
+
var TSG_ID_HEADER = "x-tsg-id";
|
|
773
|
+
var AI_GW_WORKSPACES_PATH = "/workspaces";
|
|
774
|
+
var AI_GW_CONFIGS_PATH = "/configs";
|
|
775
|
+
var AI_GW_GUARDRAILS_PATH = "/guardrails";
|
|
776
|
+
var AI_GW_PROVIDERS_PATH = "/providers";
|
|
777
|
+
var AI_GW_API_KEYS_SERVICE_PATH = "/api-keys/service";
|
|
778
|
+
var AI_GW_API_KEYS_USER_PATH = "/api-keys/user";
|
|
779
|
+
var AI_GW_LOGS_PATH = "/logs";
|
|
780
|
+
var AI_GW_CHARTS_PATH = "/logs/charts";
|
|
781
|
+
var AI_GW_GROUPS_PATH = "/logs/groups";
|
|
782
|
+
var AI_GW_INTEGRATIONS_PATH = "/integrations";
|
|
783
|
+
var AI_GW_MCP_INTEGRATIONS_PATH = "/mcp-integrations";
|
|
784
|
+
var AI_GW_DEPLOYMENTS_PATH = "/deployments";
|
|
785
|
+
var AI_GW_PLUGINS_PATH = "/plugins";
|
|
786
|
+
var AI_GW_ORGANISATIONS_SELF_PATH = "/organisations/self";
|
|
787
|
+
var AI_GW_AUDIT_LOGS_PATH = "/audit-logs";
|
|
788
|
+
function aiGwOrganisationsAuthSettingsPath(tsgId) {
|
|
789
|
+
return `/organisations/${tsgId}/auth-settings`;
|
|
790
|
+
}
|
|
791
|
+
var AI_GW_CHART_METRICS = [
|
|
792
|
+
"cost",
|
|
793
|
+
"requests",
|
|
794
|
+
"latency",
|
|
795
|
+
"tokens",
|
|
796
|
+
"errors",
|
|
797
|
+
"users",
|
|
798
|
+
"cache-summary",
|
|
799
|
+
"cache-hit-trend",
|
|
800
|
+
"user-trends",
|
|
801
|
+
"error-trends",
|
|
802
|
+
"rescued-retries",
|
|
803
|
+
"feedback-trend",
|
|
804
|
+
"feedback-weighted",
|
|
805
|
+
"feedback-score-distribution",
|
|
806
|
+
"feedback-models"
|
|
807
|
+
];
|
|
808
|
+
var AI_GW_GROUP_DIMENSIONS = ["ai_service", "model", "api_key", "provider"];
|
|
809
|
+
var AI_GW_GROUP_COLUMNS = [
|
|
810
|
+
"cost",
|
|
811
|
+
"avg_latency",
|
|
812
|
+
"avg_tokens",
|
|
813
|
+
"total_tokens",
|
|
814
|
+
"success_rate",
|
|
815
|
+
"last_seen"
|
|
816
|
+
];
|
|
679
817
|
|
|
680
818
|
// src/errors.ts
|
|
681
819
|
var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
|
|
@@ -838,7 +976,10 @@ function classifyErrorType(status) {
|
|
|
838
976
|
function extractErrorMessage(body, status) {
|
|
839
977
|
try {
|
|
840
978
|
const parsed = JSON.parse(body);
|
|
841
|
-
|
|
979
|
+
const data = parsed.data;
|
|
980
|
+
const code = data?.errorCode ?? void 0;
|
|
981
|
+
const base = parsed.error_message ?? parsed.message ?? data?.message ?? parsed.error?.message ?? parsed.msg ?? `API error ${status}`;
|
|
982
|
+
return code ? `${base} (errorCode: ${code})` : base;
|
|
842
983
|
} catch {
|
|
843
984
|
return body ? `API error ${status}: ${body}` : `API error ${status}`;
|
|
844
985
|
}
|
|
@@ -4527,6 +4668,469 @@ var ChannelStatsSchema = import_zod34.z.object({
|
|
|
4527
4668
|
client_version: import_zod34.z.string().nullable().optional()
|
|
4528
4669
|
}).passthrough();
|
|
4529
4670
|
|
|
4671
|
+
// src/models/ai-gateway.ts
|
|
4672
|
+
var import_zod35 = require("zod");
|
|
4673
|
+
var aiGatewayEnvelope = (data) => import_zod35.z.object({ success: import_zod35.z.boolean(), data }).passthrough();
|
|
4674
|
+
var aiGatewayList = (item) => import_zod35.z.object({
|
|
4675
|
+
object: import_zod35.z.string(),
|
|
4676
|
+
total: import_zod35.z.number(),
|
|
4677
|
+
has_more: import_zod35.z.boolean().optional(),
|
|
4678
|
+
data: import_zod35.z.array(item)
|
|
4679
|
+
}).passthrough();
|
|
4680
|
+
var aiGatewayGroupList = (item) => import_zod35.z.object({
|
|
4681
|
+
object: import_zod35.z.string(),
|
|
4682
|
+
is_quota_exceeded: import_zod35.z.boolean(),
|
|
4683
|
+
total: import_zod35.z.number(),
|
|
4684
|
+
data: import_zod35.z.array(item)
|
|
4685
|
+
}).passthrough();
|
|
4686
|
+
var quotaFlag = { isQuotaExceeded: import_zod35.z.boolean() };
|
|
4687
|
+
var GatewayChartRecordSchema = import_zod35.z.object({ x: import_zod35.z.string(), y: import_zod35.z.number(), avg: import_zod35.z.number().optional() }).passthrough();
|
|
4688
|
+
var CostChartResponseSchema = aiGatewayEnvelope(
|
|
4689
|
+
import_zod35.z.object({
|
|
4690
|
+
records: import_zod35.z.array(GatewayChartRecordSchema),
|
|
4691
|
+
total: import_zod35.z.number(),
|
|
4692
|
+
avg: import_zod35.z.number(),
|
|
4693
|
+
...quotaFlag
|
|
4694
|
+
}).passthrough()
|
|
4695
|
+
);
|
|
4696
|
+
var CountChartResponseSchema = aiGatewayEnvelope(
|
|
4697
|
+
import_zod35.z.object({
|
|
4698
|
+
records: import_zod35.z.array(GatewayChartRecordSchema),
|
|
4699
|
+
total: import_zod35.z.number().nullable(),
|
|
4700
|
+
...quotaFlag
|
|
4701
|
+
}).passthrough()
|
|
4702
|
+
);
|
|
4703
|
+
var LatencyChartResponseSchema = aiGatewayEnvelope(
|
|
4704
|
+
import_zod35.z.object({
|
|
4705
|
+
records: import_zod35.z.array(
|
|
4706
|
+
import_zod35.z.object({
|
|
4707
|
+
x: import_zod35.z.string(),
|
|
4708
|
+
y: import_zod35.z.number(),
|
|
4709
|
+
p50: import_zod35.z.number(),
|
|
4710
|
+
p90: import_zod35.z.number(),
|
|
4711
|
+
p99: import_zod35.z.number()
|
|
4712
|
+
}).passthrough()
|
|
4713
|
+
),
|
|
4714
|
+
total: import_zod35.z.number(),
|
|
4715
|
+
p50: import_zod35.z.number(),
|
|
4716
|
+
p90: import_zod35.z.number(),
|
|
4717
|
+
p99: import_zod35.z.number(),
|
|
4718
|
+
...quotaFlag
|
|
4719
|
+
}).passthrough()
|
|
4720
|
+
);
|
|
4721
|
+
var TokensChartResponseSchema = aiGatewayEnvelope(
|
|
4722
|
+
import_zod35.z.object({
|
|
4723
|
+
records: import_zod35.z.array(
|
|
4724
|
+
import_zod35.z.object({
|
|
4725
|
+
x: import_zod35.z.string(),
|
|
4726
|
+
y: import_zod35.z.number(),
|
|
4727
|
+
total_request_units: import_zod35.z.number(),
|
|
4728
|
+
total_response_units: import_zod35.z.number(),
|
|
4729
|
+
avg: import_zod35.z.number()
|
|
4730
|
+
}).passthrough()
|
|
4731
|
+
),
|
|
4732
|
+
total: import_zod35.z.number(),
|
|
4733
|
+
avg: import_zod35.z.number(),
|
|
4734
|
+
total_request_units: import_zod35.z.number(),
|
|
4735
|
+
total_response_units: import_zod35.z.number(),
|
|
4736
|
+
...quotaFlag
|
|
4737
|
+
}).passthrough()
|
|
4738
|
+
);
|
|
4739
|
+
var CacheSummaryResponseSchema = aiGatewayEnvelope(
|
|
4740
|
+
import_zod35.z.object({
|
|
4741
|
+
summary: import_zod35.z.object({
|
|
4742
|
+
cacheHits: import_zod35.z.number(),
|
|
4743
|
+
avgCacheLatency: import_zod35.z.number().nullable(),
|
|
4744
|
+
totalRequests: import_zod35.z.number(),
|
|
4745
|
+
cacheSpeedup: import_zod35.z.number()
|
|
4746
|
+
}).passthrough(),
|
|
4747
|
+
...quotaFlag
|
|
4748
|
+
}).passthrough()
|
|
4749
|
+
);
|
|
4750
|
+
var CacheHitTrendResponseSchema = aiGatewayEnvelope(
|
|
4751
|
+
import_zod35.z.object({
|
|
4752
|
+
trend: import_zod35.z.array(
|
|
4753
|
+
import_zod35.z.object({
|
|
4754
|
+
x: import_zod35.z.string(),
|
|
4755
|
+
simpleHits: import_zod35.z.number(),
|
|
4756
|
+
semanticHits: import_zod35.z.number(),
|
|
4757
|
+
hitRate: import_zod35.z.number(),
|
|
4758
|
+
cumulativeSimpleHitSavings: import_zod35.z.number(),
|
|
4759
|
+
cumulativeSemanticHitSavings: import_zod35.z.number()
|
|
4760
|
+
}).passthrough()
|
|
4761
|
+
),
|
|
4762
|
+
total: import_zod35.z.number(),
|
|
4763
|
+
summary: import_zod35.z.object({ totalCacheHits: import_zod35.z.number(), hitRate: import_zod35.z.number() }).passthrough(),
|
|
4764
|
+
...quotaFlag
|
|
4765
|
+
}).passthrough()
|
|
4766
|
+
);
|
|
4767
|
+
var UserTrendsResponseSchema = aiGatewayEnvelope(
|
|
4768
|
+
import_zod35.z.object({
|
|
4769
|
+
summary: import_zod35.z.object({ total: import_zod35.z.number(), unique: import_zod35.z.number(), avg: import_zod35.z.number() }).passthrough(),
|
|
4770
|
+
trend: import_zod35.z.array(GatewayChartRecordSchema),
|
|
4771
|
+
...quotaFlag
|
|
4772
|
+
}).passthrough()
|
|
4773
|
+
);
|
|
4774
|
+
var ErrorTrendsResponseSchema = aiGatewayEnvelope(
|
|
4775
|
+
import_zod35.z.object({
|
|
4776
|
+
summary: import_zod35.z.object({ errorPercent: import_zod35.z.number() }).passthrough(),
|
|
4777
|
+
trend: import_zod35.z.array(GatewayChartRecordSchema),
|
|
4778
|
+
...quotaFlag
|
|
4779
|
+
}).passthrough()
|
|
4780
|
+
);
|
|
4781
|
+
var RescuedRetriesResponseSchema = aiGatewayEnvelope(
|
|
4782
|
+
import_zod35.z.object({
|
|
4783
|
+
trend: import_zod35.z.array(
|
|
4784
|
+
import_zod35.z.object({
|
|
4785
|
+
x: import_zod35.z.string(),
|
|
4786
|
+
// Element shape unobserved — sample tenants only ever produced an empty array.
|
|
4787
|
+
// Treated like the sibling trends[].retry/fallback below until a tenant with
|
|
4788
|
+
// actual gateway retries lets us confirm the real shape. See open questions in
|
|
4789
|
+
// PRD-ai-gateway-client.md.
|
|
4790
|
+
y: import_zod35.z.array(import_zod35.z.unknown())
|
|
4791
|
+
}).passthrough()
|
|
4792
|
+
),
|
|
4793
|
+
total: import_zod35.z.number(),
|
|
4794
|
+
trends: import_zod35.z.array(
|
|
4795
|
+
import_zod35.z.object({ x: import_zod35.z.string(), retry: import_zod35.z.array(import_zod35.z.unknown()), fallback: import_zod35.z.array(import_zod35.z.unknown()) }).passthrough()
|
|
4796
|
+
),
|
|
4797
|
+
retryTotal: import_zod35.z.number(),
|
|
4798
|
+
fallbackTotal: import_zod35.z.number(),
|
|
4799
|
+
...quotaFlag
|
|
4800
|
+
}).passthrough()
|
|
4801
|
+
);
|
|
4802
|
+
var FeedbackScoreDistributionResponseSchema = aiGatewayEnvelope(
|
|
4803
|
+
import_zod35.z.object({
|
|
4804
|
+
records: import_zod35.z.array(import_zod35.z.object({ x: import_zod35.z.number(), y: import_zod35.z.number() }).passthrough()),
|
|
4805
|
+
total: import_zod35.z.number().nullable(),
|
|
4806
|
+
...quotaFlag
|
|
4807
|
+
}).passthrough()
|
|
4808
|
+
);
|
|
4809
|
+
var FeedbackModelsResponseSchema = aiGatewayEnvelope(
|
|
4810
|
+
import_zod35.z.object({
|
|
4811
|
+
records: import_zod35.z.array(
|
|
4812
|
+
import_zod35.z.object({
|
|
4813
|
+
x: import_zod35.z.string(),
|
|
4814
|
+
y: import_zod35.z.object({ avgWeightedFeedback: import_zod35.z.number(), feedbackCount: import_zod35.z.number() }).passthrough()
|
|
4815
|
+
}).passthrough()
|
|
4816
|
+
),
|
|
4817
|
+
...quotaFlag
|
|
4818
|
+
}).passthrough()
|
|
4819
|
+
);
|
|
4820
|
+
var GatewayGroupRowSchema = import_zod35.z.object({
|
|
4821
|
+
requests: import_zod35.z.number(),
|
|
4822
|
+
cost: import_zod35.z.number().optional(),
|
|
4823
|
+
avg_latency: import_zod35.z.number().optional(),
|
|
4824
|
+
avg_tokens: import_zod35.z.number().optional(),
|
|
4825
|
+
total_tokens: import_zod35.z.number().optional(),
|
|
4826
|
+
success_rate: import_zod35.z.number().optional(),
|
|
4827
|
+
last_seen: import_zod35.z.string().optional(),
|
|
4828
|
+
object: import_zod35.z.string()
|
|
4829
|
+
}).passthrough();
|
|
4830
|
+
var GroupListResponseSchema = aiGatewayGroupList(GatewayGroupRowSchema);
|
|
4831
|
+
var UserGroupResponseSchema = aiGatewayEnvelope(
|
|
4832
|
+
import_zod35.z.object({
|
|
4833
|
+
records: import_zod35.z.array(
|
|
4834
|
+
import_zod35.z.object({ _user: import_zod35.z.string(), count: import_zod35.z.number(), cost: import_zod35.z.number() }).passthrough()
|
|
4835
|
+
),
|
|
4836
|
+
total: import_zod35.z.number(),
|
|
4837
|
+
...quotaFlag
|
|
4838
|
+
}).passthrough()
|
|
4839
|
+
);
|
|
4840
|
+
var GatewayLogRecordSchema = import_zod35.z.object({
|
|
4841
|
+
id: import_zod35.z.string(),
|
|
4842
|
+
workspace_slug: import_zod35.z.string(),
|
|
4843
|
+
ai_model: import_zod35.z.string(),
|
|
4844
|
+
_user: import_zod35.z.string(),
|
|
4845
|
+
total_units: import_zod35.z.number(),
|
|
4846
|
+
/** Cents. */
|
|
4847
|
+
cost: import_zod35.z.number(),
|
|
4848
|
+
trace_id: import_zod35.z.string(),
|
|
4849
|
+
/** 0/1, not boolean. */
|
|
4850
|
+
is_proxy_call: import_zod35.z.number(),
|
|
4851
|
+
created_at: import_zod35.z.string(),
|
|
4852
|
+
/** 0/1, not boolean. */
|
|
4853
|
+
is_success: import_zod35.z.number(),
|
|
4854
|
+
/** `HIT` | `MISS` | `DISABLED`. */
|
|
4855
|
+
cache_status: import_zod35.z.string(),
|
|
4856
|
+
retry_success_count: import_zod35.z.number(),
|
|
4857
|
+
mode: import_zod35.z.string(),
|
|
4858
|
+
last_used_option_index: import_zod35.z.number(),
|
|
4859
|
+
/** 200 success, 446 AIRS security block (cost 0), 400 validation. */
|
|
4860
|
+
response_status_code: import_zod35.z.number(),
|
|
4861
|
+
request_url: import_zod35.z.string(),
|
|
4862
|
+
request_method: import_zod35.z.string(),
|
|
4863
|
+
ai_org: import_zod35.z.string(),
|
|
4864
|
+
api_key_id: import_zod35.z.string(),
|
|
4865
|
+
license_id: import_zod35.z.string(),
|
|
4866
|
+
log_store_file_path_format: import_zod35.z.string(),
|
|
4867
|
+
metadataKey: import_zod35.z.array(import_zod35.z.string()),
|
|
4868
|
+
metadataValue: import_zod35.z.array(import_zod35.z.string()),
|
|
4869
|
+
prompt_slug: import_zod35.z.string(),
|
|
4870
|
+
feedback: import_zod35.z.array(import_zod35.z.unknown())
|
|
4871
|
+
}).passthrough();
|
|
4872
|
+
var GatewayLogsResponseSchema = aiGatewayEnvelope(
|
|
4873
|
+
import_zod35.z.object({
|
|
4874
|
+
records: import_zod35.z.array(GatewayLogRecordSchema),
|
|
4875
|
+
total: import_zod35.z.number(),
|
|
4876
|
+
capturedTotal: import_zod35.z.number(),
|
|
4877
|
+
...quotaFlag
|
|
4878
|
+
}).passthrough()
|
|
4879
|
+
);
|
|
4880
|
+
var GatewayWriteResponseSchema = import_zod35.z.object({}).passthrough();
|
|
4881
|
+
var GatewayWorkspaceSchema = import_zod35.z.object({
|
|
4882
|
+
id: import_zod35.z.string(),
|
|
4883
|
+
slug: import_zod35.z.string(),
|
|
4884
|
+
name: import_zod35.z.string(),
|
|
4885
|
+
icon: import_zod35.z.string().nullable(),
|
|
4886
|
+
description: import_zod35.z.string(),
|
|
4887
|
+
created_at: import_zod35.z.string(),
|
|
4888
|
+
last_updated_at: import_zod35.z.string(),
|
|
4889
|
+
is_default: import_zod35.z.number(),
|
|
4890
|
+
status: import_zod35.z.string(),
|
|
4891
|
+
scope_name: import_zod35.z.string(),
|
|
4892
|
+
object: import_zod35.z.string()
|
|
4893
|
+
}).passthrough();
|
|
4894
|
+
var GatewayWorkspaceDetailSchema = import_zod35.z.object({
|
|
4895
|
+
id: import_zod35.z.string(),
|
|
4896
|
+
name: import_zod35.z.string(),
|
|
4897
|
+
description: import_zod35.z.string(),
|
|
4898
|
+
created_at: import_zod35.z.string(),
|
|
4899
|
+
last_updated_at: import_zod35.z.string(),
|
|
4900
|
+
is_default: import_zod35.z.number(),
|
|
4901
|
+
slug: import_zod35.z.string(),
|
|
4902
|
+
icon: import_zod35.z.string().nullable(),
|
|
4903
|
+
defaults: import_zod35.z.record(import_zod35.z.unknown()).nullable(),
|
|
4904
|
+
usage_limits: import_zod35.z.record(import_zod35.z.unknown()).nullable(),
|
|
4905
|
+
rate_limits: import_zod35.z.record(import_zod35.z.unknown()).nullable(),
|
|
4906
|
+
security_settings: import_zod35.z.record(import_zod35.z.boolean()).optional(),
|
|
4907
|
+
data_plane_security_settings: import_zod35.z.record(import_zod35.z.unknown()).optional(),
|
|
4908
|
+
settings: import_zod35.z.record(import_zod35.z.unknown()).optional()
|
|
4909
|
+
}).passthrough();
|
|
4910
|
+
var ListWorkspacesResponseSchema = aiGatewayList(GatewayWorkspaceSchema);
|
|
4911
|
+
var GatewayConfigSchema = import_zod35.z.object({
|
|
4912
|
+
id: import_zod35.z.string(),
|
|
4913
|
+
name: import_zod35.z.string(),
|
|
4914
|
+
slug: import_zod35.z.string(),
|
|
4915
|
+
/** Internal organisation UUID — NOT the TSG that write requests take. */
|
|
4916
|
+
organisation_id: import_zod35.z.string(),
|
|
4917
|
+
is_default: import_zod35.z.number(),
|
|
4918
|
+
status: import_zod35.z.string(),
|
|
4919
|
+
owner_id: import_zod35.z.string(),
|
|
4920
|
+
updated_by: import_zod35.z.string(),
|
|
4921
|
+
created_at: import_zod35.z.string(),
|
|
4922
|
+
last_updated_at: import_zod35.z.string(),
|
|
4923
|
+
workspace_id: import_zod35.z.string(),
|
|
4924
|
+
object: import_zod35.z.string()
|
|
4925
|
+
}).passthrough();
|
|
4926
|
+
var ListConfigsResponseSchema = aiGatewayList(GatewayConfigSchema);
|
|
4927
|
+
var GatewayConfigDetailSchema = GatewayConfigSchema.extend({
|
|
4928
|
+
config: import_zod35.z.string(),
|
|
4929
|
+
format: import_zod35.z.string(),
|
|
4930
|
+
type: import_zod35.z.string(),
|
|
4931
|
+
version_id: import_zod35.z.string()
|
|
4932
|
+
}).passthrough();
|
|
4933
|
+
var GatewayConfigCreateResponseSchema = import_zod35.z.object({
|
|
4934
|
+
id: import_zod35.z.string(),
|
|
4935
|
+
version_id: import_zod35.z.string(),
|
|
4936
|
+
slug: import_zod35.z.string(),
|
|
4937
|
+
object: import_zod35.z.string()
|
|
4938
|
+
}).passthrough();
|
|
4939
|
+
var GatewayGuardrailSchema = import_zod35.z.object({
|
|
4940
|
+
id: import_zod35.z.string(),
|
|
4941
|
+
name: import_zod35.z.string(),
|
|
4942
|
+
slug: import_zod35.z.string(),
|
|
4943
|
+
organisation_id: import_zod35.z.string(),
|
|
4944
|
+
status: import_zod35.z.string(),
|
|
4945
|
+
owner_id: import_zod35.z.string(),
|
|
4946
|
+
updated_by: import_zod35.z.string().nullable(),
|
|
4947
|
+
created_at: import_zod35.z.string(),
|
|
4948
|
+
last_updated_at: import_zod35.z.string(),
|
|
4949
|
+
workspace_id: import_zod35.z.string(),
|
|
4950
|
+
object: import_zod35.z.string()
|
|
4951
|
+
}).passthrough();
|
|
4952
|
+
var ListGuardrailsResponseSchema = aiGatewayList(GatewayGuardrailSchema);
|
|
4953
|
+
var guardrailFeedbackActionSchema = import_zod35.z.object({
|
|
4954
|
+
feedback: import_zod35.z.object({ value: import_zod35.z.number(), weight: import_zod35.z.number(), metadata: import_zod35.z.string() }).passthrough()
|
|
4955
|
+
}).passthrough();
|
|
4956
|
+
var GatewayGuardrailDetailSchema = GatewayGuardrailSchema.extend({
|
|
4957
|
+
checks: import_zod35.z.array(
|
|
4958
|
+
import_zod35.z.object({
|
|
4959
|
+
/** e.g. `panw-prisma-airs.intercept`, the Prisma AIRS intercept check. */
|
|
4960
|
+
id: import_zod35.z.string(),
|
|
4961
|
+
parameters: import_zod35.z.record(import_zod35.z.unknown()),
|
|
4962
|
+
is_enabled: import_zod35.z.boolean()
|
|
4963
|
+
}).passthrough()
|
|
4964
|
+
),
|
|
4965
|
+
actions: import_zod35.z.object({
|
|
4966
|
+
deny: import_zod35.z.boolean(),
|
|
4967
|
+
async: import_zod35.z.boolean(),
|
|
4968
|
+
sequential: import_zod35.z.boolean(),
|
|
4969
|
+
/** Absent when the guardrail was created without a pass/fail feedback action. */
|
|
4970
|
+
on_success: guardrailFeedbackActionSchema.optional(),
|
|
4971
|
+
on_fail: guardrailFeedbackActionSchema.optional()
|
|
4972
|
+
}).passthrough(),
|
|
4973
|
+
version_id: import_zod35.z.string()
|
|
4974
|
+
}).passthrough();
|
|
4975
|
+
var GatewayGuardrailCreateResponseSchema = import_zod35.z.object({
|
|
4976
|
+
id: import_zod35.z.string(),
|
|
4977
|
+
version_id: import_zod35.z.string(),
|
|
4978
|
+
slug: import_zod35.z.string(),
|
|
4979
|
+
object: import_zod35.z.string()
|
|
4980
|
+
}).passthrough();
|
|
4981
|
+
var GatewayProviderSchema = import_zod35.z.object({
|
|
4982
|
+
id: import_zod35.z.string(),
|
|
4983
|
+
name: import_zod35.z.string().optional(),
|
|
4984
|
+
slug: import_zod35.z.string().optional(),
|
|
4985
|
+
object: import_zod35.z.string().optional()
|
|
4986
|
+
}).passthrough();
|
|
4987
|
+
var ListProvidersResponseSchema = aiGatewayList(GatewayProviderSchema);
|
|
4988
|
+
var GatewayProviderCreateResponseSchema = import_zod35.z.object({
|
|
4989
|
+
id: import_zod35.z.string(),
|
|
4990
|
+
slug: import_zod35.z.string(),
|
|
4991
|
+
object: import_zod35.z.string()
|
|
4992
|
+
}).passthrough();
|
|
4993
|
+
var GatewayApiKeySchema = import_zod35.z.object({
|
|
4994
|
+
id: import_zod35.z.string(),
|
|
4995
|
+
name: import_zod35.z.string().optional(),
|
|
4996
|
+
object: import_zod35.z.string().optional()
|
|
4997
|
+
}).passthrough();
|
|
4998
|
+
var ListApiKeysResponseSchema = aiGatewayList(GatewayApiKeySchema);
|
|
4999
|
+
var GatewayIntegrationSchema = import_zod35.z.object({
|
|
5000
|
+
id: import_zod35.z.string(),
|
|
5001
|
+
organisation_id: import_zod35.z.string().optional(),
|
|
5002
|
+
name: import_zod35.z.string(),
|
|
5003
|
+
owner_id: import_zod35.z.string(),
|
|
5004
|
+
status: import_zod35.z.string(),
|
|
5005
|
+
created_at: import_zod35.z.string(),
|
|
5006
|
+
last_updated_at: import_zod35.z.string(),
|
|
5007
|
+
slug: import_zod35.z.string(),
|
|
5008
|
+
tags: import_zod35.z.unknown().nullable(),
|
|
5009
|
+
description: import_zod35.z.string().nullable(),
|
|
5010
|
+
workspaces_count: import_zod35.z.number().optional(),
|
|
5011
|
+
type: import_zod35.z.string().optional(),
|
|
5012
|
+
workspace_id: import_zod35.z.string().nullable(),
|
|
5013
|
+
ai_provider_id: import_zod35.z.string(),
|
|
5014
|
+
object: import_zod35.z.string()
|
|
5015
|
+
}).passthrough();
|
|
5016
|
+
var ListIntegrationsResponseSchema = aiGatewayList(GatewayIntegrationSchema);
|
|
5017
|
+
var GatewayIntegrationModelsResponseSchema = import_zod35.z.object({
|
|
5018
|
+
models: import_zod35.z.array(import_zod35.z.object({ slug: import_zod35.z.string(), enabled: import_zod35.z.boolean() }).passthrough()),
|
|
5019
|
+
allow_all_models: import_zod35.z.boolean(),
|
|
5020
|
+
object: import_zod35.z.string()
|
|
5021
|
+
}).passthrough();
|
|
5022
|
+
var GatewayIntegrationWorkspaceSchema = import_zod35.z.object({
|
|
5023
|
+
id: import_zod35.z.string(),
|
|
5024
|
+
usage_limits: import_zod35.z.record(import_zod35.z.unknown()).nullable(),
|
|
5025
|
+
rate_limits: import_zod35.z.record(import_zod35.z.unknown()).nullable(),
|
|
5026
|
+
enabled: import_zod35.z.boolean(),
|
|
5027
|
+
status: import_zod35.z.string(),
|
|
5028
|
+
created_at: import_zod35.z.string(),
|
|
5029
|
+
last_updated_at: import_zod35.z.string(),
|
|
5030
|
+
last_reset_at: import_zod35.z.string().nullable()
|
|
5031
|
+
}).passthrough();
|
|
5032
|
+
var GatewayGlobalWorkspaceAccessSchema = import_zod35.z.object({
|
|
5033
|
+
enabled: import_zod35.z.boolean(),
|
|
5034
|
+
rate_limits: import_zod35.z.record(import_zod35.z.unknown()).nullable(),
|
|
5035
|
+
usage_limits: import_zod35.z.record(import_zod35.z.unknown()).nullable()
|
|
5036
|
+
}).passthrough();
|
|
5037
|
+
var GatewayIntegrationWorkspacesResponseSchema = import_zod35.z.object({
|
|
5038
|
+
workspaces: import_zod35.z.array(GatewayIntegrationWorkspaceSchema),
|
|
5039
|
+
global_workspace_access: GatewayGlobalWorkspaceAccessSchema,
|
|
5040
|
+
object: import_zod35.z.string()
|
|
5041
|
+
}).passthrough();
|
|
5042
|
+
var McpIntegrationSchema = import_zod35.z.object({
|
|
5043
|
+
id: import_zod35.z.string(),
|
|
5044
|
+
organisation_id: import_zod35.z.string(),
|
|
5045
|
+
name: import_zod35.z.string(),
|
|
5046
|
+
owner_id: import_zod35.z.string(),
|
|
5047
|
+
status: import_zod35.z.string(),
|
|
5048
|
+
type: import_zod35.z.string(),
|
|
5049
|
+
url: import_zod35.z.string(),
|
|
5050
|
+
auth_type: import_zod35.z.string(),
|
|
5051
|
+
transport: import_zod35.z.string(),
|
|
5052
|
+
/**
|
|
5053
|
+
* JSON-encoded STRING on reads — the same request/response asymmetry as
|
|
5054
|
+
* `configs.config` (see {@link GatewayConfigDetailSchema}). The CREATE request
|
|
5055
|
+
* (`McpIntegrationCreateRequest.configurations`) sends an object; this is the read shape.
|
|
5056
|
+
*/
|
|
5057
|
+
configurations: import_zod35.z.string(),
|
|
5058
|
+
created_at: import_zod35.z.string(),
|
|
5059
|
+
last_updated_at: import_zod35.z.string()
|
|
5060
|
+
}).passthrough();
|
|
5061
|
+
var ListMcpIntegrationsResponseSchema = aiGatewayList(McpIntegrationSchema);
|
|
5062
|
+
var GatewayDeploymentSchema = import_zod35.z.object({
|
|
5063
|
+
id: import_zod35.z.string(),
|
|
5064
|
+
name: import_zod35.z.string(),
|
|
5065
|
+
slug: import_zod35.z.string(),
|
|
5066
|
+
type: import_zod35.z.string(),
|
|
5067
|
+
/** `active` | `archived`. DELETE archives rather than removes. */
|
|
5068
|
+
status: import_zod35.z.string(),
|
|
5069
|
+
created_at: import_zod35.z.string(),
|
|
5070
|
+
last_updated_at: import_zod35.z.string(),
|
|
5071
|
+
last_synced_at: import_zod35.z.string().nullable(),
|
|
5072
|
+
last_resynced_at: import_zod35.z.string().nullable(),
|
|
5073
|
+
is_default: import_zod35.z.number(),
|
|
5074
|
+
created_by: import_zod35.z.string(),
|
|
5075
|
+
object: import_zod35.z.string()
|
|
5076
|
+
}).passthrough();
|
|
5077
|
+
var GatewayDeploymentDetailSchema = GatewayDeploymentSchema.extend({
|
|
5078
|
+
credentials: import_zod35.z.object({ username: import_zod35.z.string(), password: import_zod35.z.string() }).passthrough().optional(),
|
|
5079
|
+
deployment_config: import_zod35.z.record(import_zod35.z.unknown()).nullable(),
|
|
5080
|
+
auth_settings: import_zod35.z.object({
|
|
5081
|
+
/** 0/1, not boolean — the create REQUEST sends a real boolean here. */
|
|
5082
|
+
disable_portkey_gateway: import_zod35.z.number(),
|
|
5083
|
+
workspaces_allowed: import_zod35.z.array(import_zod35.z.string()),
|
|
5084
|
+
allow_all_workspaces: import_zod35.z.number()
|
|
5085
|
+
}).passthrough().optional(),
|
|
5086
|
+
client_auth: import_zod35.z.string().optional(),
|
|
5087
|
+
workspaces: import_zod35.z.array(import_zod35.z.object({ id: import_zod35.z.string(), slug: import_zod35.z.string() }).passthrough()).optional()
|
|
5088
|
+
}).passthrough();
|
|
5089
|
+
var GatewayDeploymentCreateResponseSchema = import_zod35.z.object({
|
|
5090
|
+
id: import_zod35.z.string(),
|
|
5091
|
+
client_auth: import_zod35.z.string(),
|
|
5092
|
+
credentials: import_zod35.z.object({ username: import_zod35.z.string(), password: import_zod35.z.string() }).passthrough(),
|
|
5093
|
+
/** Internal organisation UUID — NOT the TSG sent in the request. */
|
|
5094
|
+
organisation_id: import_zod35.z.string(),
|
|
5095
|
+
object: import_zod35.z.string()
|
|
5096
|
+
}).passthrough();
|
|
5097
|
+
var ListDeploymentsResponseSchema = aiGatewayList(GatewayDeploymentSchema);
|
|
5098
|
+
var GatewayPluginSchema = import_zod35.z.object({
|
|
5099
|
+
id: import_zod35.z.string(),
|
|
5100
|
+
integration_id: import_zod35.z.string(),
|
|
5101
|
+
credentials: import_zod35.z.record(import_zod35.z.string()),
|
|
5102
|
+
owner_id: import_zod35.z.string(),
|
|
5103
|
+
created_at: import_zod35.z.string(),
|
|
5104
|
+
last_updated_at: import_zod35.z.string(),
|
|
5105
|
+
status: import_zod35.z.string(),
|
|
5106
|
+
integration_slug: import_zod35.z.string(),
|
|
5107
|
+
plugin_provider_id: import_zod35.z.string(),
|
|
5108
|
+
plugin_provider_slug: import_zod35.z.string(),
|
|
5109
|
+
object: import_zod35.z.string()
|
|
5110
|
+
}).passthrough();
|
|
5111
|
+
var ListPluginsResponseSchema = aiGatewayList(GatewayPluginSchema);
|
|
5112
|
+
var OrganisationSelfResponseSchema = import_zod35.z.object({ success: import_zod35.z.boolean(), data: import_zod35.z.record(import_zod35.z.unknown()) }).passthrough();
|
|
5113
|
+
var AuthSettingsResponseSchema = import_zod35.z.object({ success: import_zod35.z.boolean(), data: import_zod35.z.record(import_zod35.z.unknown()) }).passthrough();
|
|
5114
|
+
var GatewayAuditLogRecordSchema = import_zod35.z.object({
|
|
5115
|
+
timestamp: import_zod35.z.string(),
|
|
5116
|
+
method: import_zod35.z.string(),
|
|
5117
|
+
uri: import_zod35.z.string(),
|
|
5118
|
+
request_id: import_zod35.z.string(),
|
|
5119
|
+
request_body: import_zod35.z.string(),
|
|
5120
|
+
query_params: import_zod35.z.string(),
|
|
5121
|
+
request_headers: import_zod35.z.string(),
|
|
5122
|
+
user_id: import_zod35.z.string(),
|
|
5123
|
+
user_type: import_zod35.z.string(),
|
|
5124
|
+
organisation_id: import_zod35.z.string(),
|
|
5125
|
+
workspace_id: import_zod35.z.string(),
|
|
5126
|
+
response_status_code: import_zod35.z.number(),
|
|
5127
|
+
resource_type: import_zod35.z.string(),
|
|
5128
|
+
action: import_zod35.z.string(),
|
|
5129
|
+
client_ip: import_zod35.z.string(),
|
|
5130
|
+
country: import_zod35.z.string()
|
|
5131
|
+
}).passthrough();
|
|
5132
|
+
var GatewayAuditLogsResponseSchema = import_zod35.z.object({ records: import_zod35.z.array(GatewayAuditLogRecordSchema) }).passthrough();
|
|
5133
|
+
|
|
4530
5134
|
// src/http/auth/oauth.ts
|
|
4531
5135
|
var OAuthAuth = class {
|
|
4532
5136
|
constructor(oauthClient) {
|
|
@@ -4549,12 +5153,12 @@ var OAuthAuth = class {
|
|
|
4549
5153
|
};
|
|
4550
5154
|
|
|
4551
5155
|
// src/models/oauth-token.ts
|
|
4552
|
-
var
|
|
4553
|
-
var OAuthTokenResponseSchema =
|
|
4554
|
-
access_token:
|
|
4555
|
-
token_type:
|
|
4556
|
-
expires_in:
|
|
4557
|
-
scope:
|
|
5156
|
+
var import_zod36 = require("zod");
|
|
5157
|
+
var OAuthTokenResponseSchema = import_zod36.z.object({
|
|
5158
|
+
access_token: import_zod36.z.string(),
|
|
5159
|
+
token_type: import_zod36.z.string().optional(),
|
|
5160
|
+
expires_in: import_zod36.z.number(),
|
|
5161
|
+
scope: import_zod36.z.string().optional()
|
|
4558
5162
|
}).passthrough();
|
|
4559
5163
|
|
|
4560
5164
|
// src/management/oauth-client.ts
|
|
@@ -4780,6 +5384,14 @@ function assertUuid(value, fieldName) {
|
|
|
4780
5384
|
);
|
|
4781
5385
|
}
|
|
4782
5386
|
}
|
|
5387
|
+
function assertNumericId(value, fieldName) {
|
|
5388
|
+
if (!/^\d+$/.test(value)) {
|
|
5389
|
+
throw new AISecSDKException(
|
|
5390
|
+
`Invalid ${fieldName}: ${value}`,
|
|
5391
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
5392
|
+
);
|
|
5393
|
+
}
|
|
5394
|
+
}
|
|
4783
5395
|
|
|
4784
5396
|
// src/management/profiles.ts
|
|
4785
5397
|
var ProfilesClient = class {
|
|
@@ -5539,7 +6151,7 @@ var ScanLogsClient = class {
|
|
|
5539
6151
|
};
|
|
5540
6152
|
|
|
5541
6153
|
// src/management/oauth-management.ts
|
|
5542
|
-
var
|
|
6154
|
+
var import_zod37 = require("zod");
|
|
5543
6155
|
var OAuthManagementClient = class {
|
|
5544
6156
|
baseUrl;
|
|
5545
6157
|
auth;
|
|
@@ -5573,7 +6185,7 @@ var OAuthManagementClient = class {
|
|
|
5573
6185
|
path: MGMT_OAUTH_INVALIDATE_PATH,
|
|
5574
6186
|
params: { token },
|
|
5575
6187
|
body,
|
|
5576
|
-
responseSchema:
|
|
6188
|
+
responseSchema: import_zod37.z.string(),
|
|
5577
6189
|
auth: this.auth,
|
|
5578
6190
|
numRetries: this.numRetries
|
|
5579
6191
|
});
|
|
@@ -7434,7 +8046,7 @@ var ModelSecurityClient = class {
|
|
|
7434
8046
|
};
|
|
7435
8047
|
|
|
7436
8048
|
// src/red-team/scans-client.ts
|
|
7437
|
-
var
|
|
8049
|
+
var import_zod38 = require("zod");
|
|
7438
8050
|
var RedTeamScansClient = class {
|
|
7439
8051
|
baseUrl;
|
|
7440
8052
|
auth;
|
|
@@ -7571,7 +8183,7 @@ var RedTeamScansClient = class {
|
|
|
7571
8183
|
method: "GET",
|
|
7572
8184
|
baseUrl: this.baseUrl,
|
|
7573
8185
|
path: RED_TEAM_CATEGORIES_PATH,
|
|
7574
|
-
responseSchema:
|
|
8186
|
+
responseSchema: import_zod38.z.array(CategoryModelSchema),
|
|
7575
8187
|
auth: this.auth,
|
|
7576
8188
|
numRetries: this.numRetries
|
|
7577
8189
|
});
|
|
@@ -7579,7 +8191,7 @@ var RedTeamScansClient = class {
|
|
|
7579
8191
|
};
|
|
7580
8192
|
|
|
7581
8193
|
// src/red-team/reports-client.ts
|
|
7582
|
-
var
|
|
8194
|
+
var import_zod39 = require("zod");
|
|
7583
8195
|
var RedTeamReportsClient = class {
|
|
7584
8196
|
baseUrl;
|
|
7585
8197
|
auth;
|
|
@@ -7954,7 +8566,7 @@ var RedTeamReportsClient = class {
|
|
|
7954
8566
|
baseUrl: this.baseUrl,
|
|
7955
8567
|
path: `${RED_TEAM_REPORT_PATH}/${jobId}/download`,
|
|
7956
8568
|
params: { file_format: format },
|
|
7957
|
-
responseSchema:
|
|
8569
|
+
responseSchema: import_zod39.z.unknown(),
|
|
7958
8570
|
auth: this.auth,
|
|
7959
8571
|
numRetries: this.numRetries
|
|
7960
8572
|
});
|
|
@@ -7978,7 +8590,7 @@ var RedTeamReportsClient = class {
|
|
|
7978
8590
|
method: "POST",
|
|
7979
8591
|
baseUrl: this.baseUrl,
|
|
7980
8592
|
path: `${RED_TEAM_REPORT_PATH}/${jobId}/generate-partial-report`,
|
|
7981
|
-
responseSchema:
|
|
8593
|
+
responseSchema: import_zod39.z.unknown(),
|
|
7982
8594
|
auth: this.auth,
|
|
7983
8595
|
numRetries: this.numRetries
|
|
7984
8596
|
});
|
|
@@ -7986,7 +8598,7 @@ var RedTeamReportsClient = class {
|
|
|
7986
8598
|
};
|
|
7987
8599
|
|
|
7988
8600
|
// src/red-team/custom-attack-reports-client.ts
|
|
7989
|
-
var
|
|
8601
|
+
var import_zod40 = require("zod");
|
|
7990
8602
|
var RedTeamCustomAttackReportsClient = class {
|
|
7991
8603
|
baseUrl;
|
|
7992
8604
|
auth;
|
|
@@ -8076,7 +8688,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
8076
8688
|
baseUrl: this.baseUrl,
|
|
8077
8689
|
path: `${RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH}/report/${jobId}/prompt-set/${promptSetId}/prompts`,
|
|
8078
8690
|
params,
|
|
8079
|
-
responseSchema:
|
|
8691
|
+
responseSchema: import_zod40.z.array(PromptDetailResponseSchema),
|
|
8080
8692
|
auth: this.auth,
|
|
8081
8693
|
numRetries: this.numRetries
|
|
8082
8694
|
});
|
|
@@ -8170,7 +8782,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
8170
8782
|
method: "GET",
|
|
8171
8783
|
baseUrl: this.baseUrl,
|
|
8172
8784
|
path: `${RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH}/job/${jobId}/attack/${attackId}/list-outputs`,
|
|
8173
|
-
responseSchema:
|
|
8785
|
+
responseSchema: import_zod40.z.array(CustomAttackOutputSchema),
|
|
8174
8786
|
auth: this.auth,
|
|
8175
8787
|
numRetries: this.numRetries
|
|
8176
8788
|
});
|
|
@@ -8195,7 +8807,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
8195
8807
|
method: "GET",
|
|
8196
8808
|
baseUrl: this.baseUrl,
|
|
8197
8809
|
path: `${RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH}/job/${jobId}/property-stats`,
|
|
8198
|
-
responseSchema:
|
|
8810
|
+
responseSchema: import_zod40.z.array(PropertyStatisticSchema),
|
|
8199
8811
|
auth: this.auth,
|
|
8200
8812
|
numRetries: this.numRetries
|
|
8201
8813
|
});
|
|
@@ -8203,7 +8815,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
8203
8815
|
};
|
|
8204
8816
|
|
|
8205
8817
|
// src/red-team/targets-client.ts
|
|
8206
|
-
var
|
|
8818
|
+
var import_zod41 = require("zod");
|
|
8207
8819
|
var RedTeamTargetsClient = class {
|
|
8208
8820
|
baseUrl;
|
|
8209
8821
|
auth;
|
|
@@ -8496,7 +9108,7 @@ var RedTeamTargetsClient = class {
|
|
|
8496
9108
|
method: "GET",
|
|
8497
9109
|
baseUrl: this.baseUrl,
|
|
8498
9110
|
path: `${RED_TEAM_TEMPLATE_PATH}/target-metadata`,
|
|
8499
|
-
responseSchema:
|
|
9111
|
+
responseSchema: import_zod41.z.record(import_zod41.z.unknown()),
|
|
8500
9112
|
auth: this.auth,
|
|
8501
9113
|
numRetries: this.numRetries
|
|
8502
9114
|
});
|
|
@@ -9919,10 +10531,1858 @@ var RedTeamClient = class {
|
|
|
9919
10531
|
});
|
|
9920
10532
|
}
|
|
9921
10533
|
};
|
|
10534
|
+
|
|
10535
|
+
// src/http/auth/tsg-header.ts
|
|
10536
|
+
var TsgHeaderAuth = class {
|
|
10537
|
+
constructor(inner, tsgId) {
|
|
10538
|
+
this.inner = inner;
|
|
10539
|
+
this.tsgId = tsgId;
|
|
10540
|
+
}
|
|
10541
|
+
async prepare(req) {
|
|
10542
|
+
const prepared = await this.inner.prepare(req);
|
|
10543
|
+
return {
|
|
10544
|
+
...prepared,
|
|
10545
|
+
headers: { ...prepared.headers, [TSG_ID_HEADER]: this.tsgId }
|
|
10546
|
+
};
|
|
10547
|
+
}
|
|
10548
|
+
async onUnauthorized(res) {
|
|
10549
|
+
return await this.inner.onUnauthorized?.(res) ?? false;
|
|
10550
|
+
}
|
|
10551
|
+
};
|
|
10552
|
+
|
|
10553
|
+
// src/ai-gateway/window.ts
|
|
10554
|
+
function toOffsetIso(d) {
|
|
10555
|
+
const pad = (n) => String(Math.floor(Math.abs(n))).padStart(2, "0");
|
|
10556
|
+
const offsetMin = -d.getTimezoneOffset();
|
|
10557
|
+
const sign = offsetMin >= 0 ? "+" : "-";
|
|
10558
|
+
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)}`;
|
|
10559
|
+
}
|
|
10560
|
+
function serializeWindow(tsgId, opts) {
|
|
10561
|
+
const end = opts.end ?? /* @__PURE__ */ new Date();
|
|
10562
|
+
const start = opts.start ?? new Date(end.getTime() - (opts.days ?? 7) * 864e5);
|
|
10563
|
+
return {
|
|
10564
|
+
organisationId: tsgId,
|
|
10565
|
+
workspaceSlug: opts.workspaceSlug,
|
|
10566
|
+
timeOfGenerationMin: toOffsetIso(start),
|
|
10567
|
+
timeOfGenerationMax: toOffsetIso(end)
|
|
10568
|
+
};
|
|
10569
|
+
}
|
|
10570
|
+
|
|
10571
|
+
// src/ai-gateway/telemetry-client.ts
|
|
10572
|
+
var AIGatewayTelemetryClient = class {
|
|
10573
|
+
baseUrl;
|
|
10574
|
+
auth;
|
|
10575
|
+
numRetries;
|
|
10576
|
+
tsgId;
|
|
10577
|
+
constructor(opts) {
|
|
10578
|
+
this.baseUrl = opts.baseUrl;
|
|
10579
|
+
this.auth = opts.auth;
|
|
10580
|
+
this.numRetries = opts.numRetries;
|
|
10581
|
+
this.tsgId = opts.tsgId;
|
|
10582
|
+
}
|
|
10583
|
+
/** @internal Shared GET for every `logs/charts/*` endpoint. */
|
|
10584
|
+
chart(metric, opts, schema) {
|
|
10585
|
+
return request({
|
|
10586
|
+
method: "GET",
|
|
10587
|
+
baseUrl: this.baseUrl,
|
|
10588
|
+
path: `${AI_GW_CHARTS_PATH}/${metric}`,
|
|
10589
|
+
params: serializeWindow(this.tsgId, opts),
|
|
10590
|
+
responseSchema: schema,
|
|
10591
|
+
auth: this.auth,
|
|
10592
|
+
numRetries: this.numRetries
|
|
10593
|
+
});
|
|
10594
|
+
}
|
|
10595
|
+
/**
|
|
10596
|
+
* Total and per-day spend. **Values are in cents.**
|
|
10597
|
+
* @param opts - Workspace slug and time window.
|
|
10598
|
+
* @returns Cost series plus the period total, in cents.
|
|
10599
|
+
* @example
|
|
10600
|
+
* ```ts
|
|
10601
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10602
|
+
* const gw = new AIGatewayClient();
|
|
10603
|
+
*
|
|
10604
|
+
* const cost = await gw.telemetry.cost({ workspaceSlug: 'ws-main-a-349e0e', days: 7 });
|
|
10605
|
+
* console.log(`$${(cost.data.total / 100).toFixed(2)}`); // => "$4110.83"
|
|
10606
|
+
* ```
|
|
10607
|
+
*/
|
|
10608
|
+
async cost(opts) {
|
|
10609
|
+
return this.chart("cost", opts, CostChartResponseSchema);
|
|
10610
|
+
}
|
|
10611
|
+
/**
|
|
10612
|
+
* Per-day request counts.
|
|
10613
|
+
* @param opts - Workspace slug and time window.
|
|
10614
|
+
* @returns Request-count series plus the period total.
|
|
10615
|
+
* @example
|
|
10616
|
+
* ```ts
|
|
10617
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10618
|
+
* const gw = new AIGatewayClient();
|
|
10619
|
+
*
|
|
10620
|
+
* const r = await gw.telemetry.requests({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10621
|
+
* // r.data.total => 25746
|
|
10622
|
+
* ```
|
|
10623
|
+
*/
|
|
10624
|
+
async requests(opts) {
|
|
10625
|
+
return this.chart("requests", opts, CountChartResponseSchema);
|
|
10626
|
+
}
|
|
10627
|
+
/**
|
|
10628
|
+
* Latency in milliseconds. Percentiles are returned per-bucket and for the period.
|
|
10629
|
+
* @param opts - Workspace slug and time window.
|
|
10630
|
+
* @returns Latency series with p50/p90/p99; `data.total` is the period mean, not a sum.
|
|
10631
|
+
* @example
|
|
10632
|
+
* ```ts
|
|
10633
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10634
|
+
* const gw = new AIGatewayClient();
|
|
10635
|
+
*
|
|
10636
|
+
* const l = await gw.telemetry.latency({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10637
|
+
* // l.data.p99 => 8329.14
|
|
10638
|
+
* ```
|
|
10639
|
+
*/
|
|
10640
|
+
async latency(opts) {
|
|
10641
|
+
return this.chart("latency", opts, LatencyChartResponseSchema);
|
|
10642
|
+
}
|
|
10643
|
+
/**
|
|
10644
|
+
* Token usage, split into request and response units.
|
|
10645
|
+
* @param opts - Workspace slug and time window.
|
|
10646
|
+
* @returns Token series plus request/response unit totals.
|
|
10647
|
+
* @example
|
|
10648
|
+
* ```ts
|
|
10649
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10650
|
+
* const gw = new AIGatewayClient();
|
|
10651
|
+
*
|
|
10652
|
+
* const t = await gw.telemetry.tokens({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10653
|
+
* // t.data.total_request_units => 4919015459
|
|
10654
|
+
* ```
|
|
10655
|
+
*/
|
|
10656
|
+
async tokens(opts) {
|
|
10657
|
+
return this.chart("tokens", opts, TokensChartResponseSchema);
|
|
10658
|
+
}
|
|
10659
|
+
/**
|
|
10660
|
+
* Per-day error counts.
|
|
10661
|
+
* @param opts - Workspace slug and time window.
|
|
10662
|
+
* @returns Error-count series plus the period total.
|
|
10663
|
+
* @example
|
|
10664
|
+
* ```ts
|
|
10665
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10666
|
+
* const gw = new AIGatewayClient();
|
|
10667
|
+
*
|
|
10668
|
+
* const e = await gw.telemetry.errors({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10669
|
+
* // e.data.total => 125
|
|
10670
|
+
* ```
|
|
10671
|
+
*/
|
|
10672
|
+
async errors(opts) {
|
|
10673
|
+
return this.chart("errors", opts, CountChartResponseSchema);
|
|
10674
|
+
}
|
|
10675
|
+
/**
|
|
10676
|
+
* Per-day distinct end-user counts.
|
|
10677
|
+
* @param opts - Workspace slug and time window.
|
|
10678
|
+
* @returns Unique-user series plus the period total.
|
|
10679
|
+
* @example
|
|
10680
|
+
* ```ts
|
|
10681
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10682
|
+
* const gw = new AIGatewayClient();
|
|
10683
|
+
*
|
|
10684
|
+
* const u = await gw.telemetry.users({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10685
|
+
* // u.data.total => 1
|
|
10686
|
+
* ```
|
|
10687
|
+
*/
|
|
10688
|
+
async users(opts) {
|
|
10689
|
+
return this.chart("users", opts, CountChartResponseSchema);
|
|
10690
|
+
}
|
|
10691
|
+
/**
|
|
10692
|
+
* Cache hit count, speedup, and average cached-response latency.
|
|
10693
|
+
* @param opts - Workspace slug and time window.
|
|
10694
|
+
* @returns Cache summary; `avgCacheLatency` is null when there were no hits.
|
|
10695
|
+
* @example
|
|
10696
|
+
* ```ts
|
|
10697
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10698
|
+
* const gw = new AIGatewayClient();
|
|
10699
|
+
*
|
|
10700
|
+
* const c = await gw.telemetry.cacheSummary({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10701
|
+
* // c.data.summary => { cacheHits: 0, avgCacheLatency: null, totalRequests: 25621, cacheSpeedup: 0 }
|
|
10702
|
+
* ```
|
|
10703
|
+
*/
|
|
10704
|
+
async cacheSummary(opts) {
|
|
10705
|
+
return this.chart("cache-summary", opts, CacheSummaryResponseSchema);
|
|
10706
|
+
}
|
|
10707
|
+
/**
|
|
10708
|
+
* Cache hit-rate trend and cumulative savings.
|
|
10709
|
+
* @param opts - Workspace slug and time window.
|
|
10710
|
+
* @returns Per-bucket hits and **cumulative** savings in cents — the last non-zero bucket is the period total.
|
|
10711
|
+
* @example
|
|
10712
|
+
* ```ts
|
|
10713
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10714
|
+
* const gw = new AIGatewayClient();
|
|
10715
|
+
*
|
|
10716
|
+
* const t = await gw.telemetry.cacheHitTrend({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10717
|
+
* const last = t.data.trend.at(-1);
|
|
10718
|
+
* const savedUsd = ((last?.cumulativeSimpleHitSavings ?? 0) + (last?.cumulativeSemanticHitSavings ?? 0)) / 100;
|
|
10719
|
+
* ```
|
|
10720
|
+
*/
|
|
10721
|
+
async cacheHitTrend(opts) {
|
|
10722
|
+
return this.chart("cache-hit-trend", opts, CacheHitTrendResponseSchema);
|
|
10723
|
+
}
|
|
10724
|
+
/**
|
|
10725
|
+
* Requests-per-user trend.
|
|
10726
|
+
* @param opts - Workspace slug and time window.
|
|
10727
|
+
* @returns Daily request counts plus `summary.avg` (requests per user).
|
|
10728
|
+
* @example
|
|
10729
|
+
* ```ts
|
|
10730
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10731
|
+
* const gw = new AIGatewayClient();
|
|
10732
|
+
*
|
|
10733
|
+
* const t = await gw.telemetry.userTrends({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10734
|
+
* // t.data.summary => { total: 25748, unique: 1, avg: 25748 }
|
|
10735
|
+
* ```
|
|
10736
|
+
*/
|
|
10737
|
+
async userTrends(opts) {
|
|
10738
|
+
return this.chart("user-trends", opts, UserTrendsResponseSchema);
|
|
10739
|
+
}
|
|
10740
|
+
/**
|
|
10741
|
+
* Error-rate trend as a percentage.
|
|
10742
|
+
* @param opts - Workspace slug and time window.
|
|
10743
|
+
* @returns Daily error percentages plus `summary.errorPercent` for the period.
|
|
10744
|
+
* @example
|
|
10745
|
+
* ```ts
|
|
10746
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10747
|
+
* const gw = new AIGatewayClient();
|
|
10748
|
+
*
|
|
10749
|
+
* const t = await gw.telemetry.errorTrends({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10750
|
+
* // t.data.summary.errorPercent => 0.485
|
|
10751
|
+
* ```
|
|
10752
|
+
*/
|
|
10753
|
+
async errorTrends(opts) {
|
|
10754
|
+
return this.chart("error-trends", opts, ErrorTrendsResponseSchema);
|
|
10755
|
+
}
|
|
10756
|
+
/**
|
|
10757
|
+
* Gateway auto-retry and fallback resilience. Sparse — only populated on upstream failures.
|
|
10758
|
+
* @param opts - Workspace slug and time window.
|
|
10759
|
+
* @returns Retry/fallback trends; note `trend[].y` is an **array**, not a scalar.
|
|
10760
|
+
* @example
|
|
10761
|
+
* ```ts
|
|
10762
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10763
|
+
* const gw = new AIGatewayClient();
|
|
10764
|
+
*
|
|
10765
|
+
* const r = await gw.telemetry.rescuedRetries({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10766
|
+
* // r.data.retryTotal => 0
|
|
10767
|
+
* ```
|
|
10768
|
+
*/
|
|
10769
|
+
async rescuedRetries(opts) {
|
|
10770
|
+
return this.chart("rescued-retries", opts, RescuedRetriesResponseSchema);
|
|
10771
|
+
}
|
|
10772
|
+
/**
|
|
10773
|
+
* Daily count of feedback submissions.
|
|
10774
|
+
* @param opts - Workspace slug and time window.
|
|
10775
|
+
* @returns Feedback-count series plus the period total.
|
|
10776
|
+
* @example
|
|
10777
|
+
* ```ts
|
|
10778
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10779
|
+
* const gw = new AIGatewayClient();
|
|
10780
|
+
*
|
|
10781
|
+
* const f = await gw.telemetry.feedbackTrend({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10782
|
+
* // f.data.total => 61
|
|
10783
|
+
* ```
|
|
10784
|
+
*/
|
|
10785
|
+
async feedbackTrend(opts) {
|
|
10786
|
+
return this.chart("feedback-trend", opts, CountChartResponseSchema);
|
|
10787
|
+
}
|
|
10788
|
+
/**
|
|
10789
|
+
* Weighted average feedback score, averaged over days.
|
|
10790
|
+
* @param opts - Workspace slug and time window.
|
|
10791
|
+
* @returns Weighted score series; `data.total` is null when there is no feedback.
|
|
10792
|
+
* @example
|
|
10793
|
+
* ```ts
|
|
10794
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10795
|
+
* const gw = new AIGatewayClient();
|
|
10796
|
+
*
|
|
10797
|
+
* const f = await gw.telemetry.feedbackWeighted({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10798
|
+
* // f.data.total => -2.58
|
|
10799
|
+
* ```
|
|
10800
|
+
*/
|
|
10801
|
+
async feedbackWeighted(opts) {
|
|
10802
|
+
return this.chart("feedback-weighted", opts, CountChartResponseSchema);
|
|
10803
|
+
}
|
|
10804
|
+
/**
|
|
10805
|
+
* Distribution of feedback scores. Feedback is binary: +5 (thumbs up) or -5 (thumbs down).
|
|
10806
|
+
* @param opts - Workspace slug and time window.
|
|
10807
|
+
* @returns Score histogram as `{x: score, y: count}` records.
|
|
10808
|
+
* @example
|
|
10809
|
+
* ```ts
|
|
10810
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10811
|
+
* const gw = new AIGatewayClient();
|
|
10812
|
+
*
|
|
10813
|
+
* const d = await gw.telemetry.feedbackScoreDistribution({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10814
|
+
* // d.data.records => [{ x: 5, y: 30 }, { x: -5, y: 33 }]
|
|
10815
|
+
* ```
|
|
10816
|
+
*/
|
|
10817
|
+
async feedbackScoreDistribution(opts) {
|
|
10818
|
+
return this.chart("feedback-score-distribution", opts, FeedbackScoreDistributionResponseSchema);
|
|
10819
|
+
}
|
|
10820
|
+
/**
|
|
10821
|
+
* Feedback broken down by AI model.
|
|
10822
|
+
* @param opts - Workspace slug and time window.
|
|
10823
|
+
* @returns Records where `x` is the model and `y` is an object, not a number.
|
|
10824
|
+
* @example
|
|
10825
|
+
* ```ts
|
|
10826
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10827
|
+
* const gw = new AIGatewayClient();
|
|
10828
|
+
*
|
|
10829
|
+
* const m = await gw.telemetry.feedbackModels({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10830
|
+
* // m.data.records[0] => { x: 'claude-sonnet-5', y: { avgWeightedFeedback: 4.2, feedbackCount: 12 } }
|
|
10831
|
+
* ```
|
|
10832
|
+
*/
|
|
10833
|
+
async feedbackModels(opts) {
|
|
10834
|
+
return this.chart("feedback-models", opts, FeedbackModelsResponseSchema);
|
|
10835
|
+
}
|
|
10836
|
+
/**
|
|
10837
|
+
* Aggregate requests by a dimension.
|
|
10838
|
+
* @param dimension - One of {@link AI_GW_GROUP_DIMENSIONS}. Underscore names only.
|
|
10839
|
+
* @param opts - Window plus optional extra columns.
|
|
10840
|
+
* @returns One row per distinct dimension value.
|
|
10841
|
+
* @example
|
|
10842
|
+
* ```ts
|
|
10843
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10844
|
+
* const gw = new AIGatewayClient();
|
|
10845
|
+
*
|
|
10846
|
+
* const byModel = await gw.telemetry.groupBy('model', {
|
|
10847
|
+
* workspaceSlug: 'ws-main-a-349e0e',
|
|
10848
|
+
* columns: ['cost', 'total_tokens'],
|
|
10849
|
+
* });
|
|
10850
|
+
* // byModel.data[0] => { model: 'claude-sonnet-5', requests: 10506, cost: 29704.16, ... }
|
|
10851
|
+
* ```
|
|
10852
|
+
*/
|
|
10853
|
+
async groupBy(dimension, opts) {
|
|
10854
|
+
const params = serializeWindow(this.tsgId, opts);
|
|
10855
|
+
if (opts.columns?.length) params.columns = opts.columns.join(",");
|
|
10856
|
+
return request({
|
|
10857
|
+
method: "GET",
|
|
10858
|
+
baseUrl: this.baseUrl,
|
|
10859
|
+
path: `${AI_GW_GROUPS_PATH}/${dimension}`,
|
|
10860
|
+
params,
|
|
10861
|
+
responseSchema: GroupListResponseSchema,
|
|
10862
|
+
auth: this.auth,
|
|
10863
|
+
numRetries: this.numRetries
|
|
10864
|
+
});
|
|
10865
|
+
}
|
|
10866
|
+
/**
|
|
10867
|
+
* Requests and cost per end user.
|
|
10868
|
+
* @param opts - Workspace slug and time window.
|
|
10869
|
+
* @returns One record per user; `_user: ''` means calls with no end-user id. Costs in cents.
|
|
10870
|
+
* @example
|
|
10871
|
+
* ```ts
|
|
10872
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10873
|
+
* const gw = new AIGatewayClient();
|
|
10874
|
+
*
|
|
10875
|
+
* const users = await gw.telemetry.byUser({ workspaceSlug: 'ws-main-a-349e0e' });
|
|
10876
|
+
* // users.data.records[0] => { _user: '', count: 25748, cost: 411060.85 }
|
|
10877
|
+
* ```
|
|
10878
|
+
*/
|
|
10879
|
+
async byUser(opts) {
|
|
10880
|
+
return request({
|
|
10881
|
+
method: "GET",
|
|
10882
|
+
baseUrl: this.baseUrl,
|
|
10883
|
+
path: `${AI_GW_GROUPS_PATH}/users`,
|
|
10884
|
+
params: serializeWindow(this.tsgId, opts),
|
|
10885
|
+
responseSchema: UserGroupResponseSchema,
|
|
10886
|
+
auth: this.auth,
|
|
10887
|
+
numRetries: this.numRetries
|
|
10888
|
+
});
|
|
10889
|
+
}
|
|
10890
|
+
/**
|
|
10891
|
+
* Requests grouped by HTTP status code.
|
|
10892
|
+
* @param opts - Window plus optional extra columns.
|
|
10893
|
+
* @returns One row per status. **446 = AIRS security block** (cost 0, never reached the LLM).
|
|
10894
|
+
* @example
|
|
10895
|
+
* ```ts
|
|
10896
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10897
|
+
* const gw = new AIGatewayClient();
|
|
10898
|
+
*
|
|
10899
|
+
* const codes = await gw.telemetry.byStatusCode({
|
|
10900
|
+
* workspaceSlug: 'ws-main-a-349e0e',
|
|
10901
|
+
* columns: ['cost', 'avg_latency'],
|
|
10902
|
+
* });
|
|
10903
|
+
* // codes.data => [{ status_code: 200, requests: 25623, ... }, { status_code: 446, ... }]
|
|
10904
|
+
* ```
|
|
10905
|
+
*/
|
|
10906
|
+
async byStatusCode(opts) {
|
|
10907
|
+
const params = serializeWindow(this.tsgId, opts);
|
|
10908
|
+
if (opts.columns?.length) params.columns = opts.columns.join(",");
|
|
10909
|
+
return request({
|
|
10910
|
+
method: "GET",
|
|
10911
|
+
baseUrl: this.baseUrl,
|
|
10912
|
+
path: `${AI_GW_GROUPS_PATH}/status_code`,
|
|
10913
|
+
params,
|
|
10914
|
+
responseSchema: GroupListResponseSchema,
|
|
10915
|
+
auth: this.auth,
|
|
10916
|
+
numRetries: this.numRetries
|
|
10917
|
+
});
|
|
10918
|
+
}
|
|
10919
|
+
/**
|
|
10920
|
+
* Raw per-request log rows — the deepest granularity this API offers.
|
|
10921
|
+
*
|
|
10922
|
+
* @remarks
|
|
10923
|
+
* Upstream pagination is broken: only `pageSize` works, and an unfiltered call always
|
|
10924
|
+
* returns the same most-recent batch (~50 rows) regardless of offset. To read beyond that,
|
|
10925
|
+
* filter by `statusCode`, which bypasses the cap and returns every match in the window.
|
|
10926
|
+
*
|
|
10927
|
+
* @param opts - Window plus `pageSize` / `traceId` / `statusCode` filters.
|
|
10928
|
+
* @returns Log records plus the full-period `total` (which you cannot page to).
|
|
10929
|
+
* @example
|
|
10930
|
+
* ```ts
|
|
10931
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10932
|
+
* const gw = new AIGatewayClient();
|
|
10933
|
+
*
|
|
10934
|
+
* // Every AIRS security block in the window, not just the most recent page.
|
|
10935
|
+
* const blocked = await gw.telemetry.logs({
|
|
10936
|
+
* workspaceSlug: 'ws-main-a-349e0e',
|
|
10937
|
+
* statusCode: 446,
|
|
10938
|
+
* });
|
|
10939
|
+
* // blocked.data.records[0] => { response_status_code: 446, cost: 0, is_success: 0, ... }
|
|
10940
|
+
* ```
|
|
10941
|
+
*/
|
|
10942
|
+
async logs(opts) {
|
|
10943
|
+
const params = serializeWindow(this.tsgId, opts);
|
|
10944
|
+
if (opts.pageSize !== void 0) params.pageSize = String(opts.pageSize);
|
|
10945
|
+
if (opts.traceId !== void 0) params.traceId = opts.traceId;
|
|
10946
|
+
if (opts.statusCode !== void 0) params.statusCode = String(opts.statusCode);
|
|
10947
|
+
return request({
|
|
10948
|
+
method: "GET",
|
|
10949
|
+
baseUrl: this.baseUrl,
|
|
10950
|
+
path: AI_GW_LOGS_PATH,
|
|
10951
|
+
params,
|
|
10952
|
+
responseSchema: GatewayLogsResponseSchema,
|
|
10953
|
+
auth: this.auth,
|
|
10954
|
+
numRetries: this.numRetries
|
|
10955
|
+
});
|
|
10956
|
+
}
|
|
10957
|
+
};
|
|
10958
|
+
|
|
10959
|
+
// src/ai-gateway/workspaces-client.ts
|
|
10960
|
+
var AIGatewayWorkspacesClient = class {
|
|
10961
|
+
baseUrl;
|
|
10962
|
+
auth;
|
|
10963
|
+
numRetries;
|
|
10964
|
+
constructor(opts) {
|
|
10965
|
+
this.baseUrl = opts.baseUrl;
|
|
10966
|
+
this.auth = opts.auth;
|
|
10967
|
+
this.numRetries = opts.numRetries;
|
|
10968
|
+
}
|
|
10969
|
+
/**
|
|
10970
|
+
* List workspaces visible to the caller.
|
|
10971
|
+
* @returns All workspaces, each with the `scope_name` that grants data-plane access to it.
|
|
10972
|
+
* @example
|
|
10973
|
+
* ```ts
|
|
10974
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10975
|
+
* const gw = new AIGatewayClient();
|
|
10976
|
+
*
|
|
10977
|
+
* const ws = await gw.workspaces.list();
|
|
10978
|
+
* // ws.data[0] => { slug: 'ws-main-a-349e0e', scope_name: 'main_airs_workspace_1852583913', ... }
|
|
10979
|
+
* ```
|
|
10980
|
+
*/
|
|
10981
|
+
async list() {
|
|
10982
|
+
return request({
|
|
10983
|
+
method: "GET",
|
|
10984
|
+
baseUrl: this.baseUrl,
|
|
10985
|
+
path: AI_GW_WORKSPACES_PATH,
|
|
10986
|
+
responseSchema: ListWorkspacesResponseSchema,
|
|
10987
|
+
auth: this.auth,
|
|
10988
|
+
numRetries: this.numRetries
|
|
10989
|
+
});
|
|
10990
|
+
}
|
|
10991
|
+
/**
|
|
10992
|
+
* Fetch one workspace, including its security and rate-limit settings.
|
|
10993
|
+
* @param workspaceId - Workspace UUID.
|
|
10994
|
+
* @returns Workspace detail; list rows do not carry the settings blocks.
|
|
10995
|
+
* @example
|
|
10996
|
+
* ```ts
|
|
10997
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
10998
|
+
* const gw = new AIGatewayClient();
|
|
10999
|
+
*
|
|
11000
|
+
* const ws = await gw.workspaces.get('16f7e90d-382a-4e78-b577-1b01eb5f8297');
|
|
11001
|
+
* // ws.security_settings?.membersViewLogs => true
|
|
11002
|
+
* ```
|
|
11003
|
+
*/
|
|
11004
|
+
async get(workspaceId) {
|
|
11005
|
+
assertUuid(workspaceId, "workspaceId");
|
|
11006
|
+
return request({
|
|
11007
|
+
method: "GET",
|
|
11008
|
+
baseUrl: this.baseUrl,
|
|
11009
|
+
path: `${AI_GW_WORKSPACES_PATH}/${workspaceId}`,
|
|
11010
|
+
responseSchema: GatewayWorkspaceDetailSchema,
|
|
11011
|
+
auth: this.auth,
|
|
11012
|
+
numRetries: this.numRetries
|
|
11013
|
+
});
|
|
11014
|
+
}
|
|
11015
|
+
};
|
|
11016
|
+
|
|
11017
|
+
// src/ai-gateway/configs-client.ts
|
|
11018
|
+
var AIGatewayConfigsClient = class {
|
|
11019
|
+
baseUrl;
|
|
11020
|
+
auth;
|
|
11021
|
+
numRetries;
|
|
11022
|
+
constructor(opts) {
|
|
11023
|
+
this.baseUrl = opts.baseUrl;
|
|
11024
|
+
this.auth = opts.auth;
|
|
11025
|
+
this.numRetries = opts.numRetries;
|
|
11026
|
+
}
|
|
11027
|
+
/**
|
|
11028
|
+
* List configs in a workspace.
|
|
11029
|
+
*
|
|
11030
|
+
* @remarks
|
|
11031
|
+
* List rows are a strict 12-field subset of the detail read — they do NOT carry `config`,
|
|
11032
|
+
* `format`, `type`, or `version_id`. Call {@link get} for those.
|
|
11033
|
+
*
|
|
11034
|
+
* @param opts - Must include the workspace UUID.
|
|
11035
|
+
* @returns Config list rows.
|
|
11036
|
+
* @example
|
|
11037
|
+
* ```ts
|
|
11038
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11039
|
+
* const gw = new AIGatewayClient();
|
|
11040
|
+
*
|
|
11041
|
+
* const cfgs = await gw.configs.list({ workspaceId: '16f7e90d-382a-4e78-b577-1b01eb5f8297' });
|
|
11042
|
+
* // cfgs.data[0] => { name: 'claude-code', slug: 'pc-claude-e46fe6', status: 'active', ... }
|
|
11043
|
+
* ```
|
|
11044
|
+
*/
|
|
11045
|
+
async list(opts) {
|
|
11046
|
+
assertUuid(opts.workspaceId, "workspaceId");
|
|
11047
|
+
return request({
|
|
11048
|
+
method: "GET",
|
|
11049
|
+
baseUrl: this.baseUrl,
|
|
11050
|
+
path: AI_GW_CONFIGS_PATH,
|
|
11051
|
+
params: { workspace_id: opts.workspaceId },
|
|
11052
|
+
responseSchema: ListConfigsResponseSchema,
|
|
11053
|
+
auth: this.auth,
|
|
11054
|
+
numRetries: this.numRetries
|
|
11055
|
+
});
|
|
11056
|
+
}
|
|
11057
|
+
/**
|
|
11058
|
+
* Fetch one config.
|
|
11059
|
+
* @param configId - Config UUID.
|
|
11060
|
+
* @returns The config detail — adds `config` (a JSON-encoded string, not an object),
|
|
11061
|
+
* `format`, `type`, and `version_id` on top of the list row.
|
|
11062
|
+
* @example
|
|
11063
|
+
* ```ts
|
|
11064
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11065
|
+
* const gw = new AIGatewayClient();
|
|
11066
|
+
*
|
|
11067
|
+
* const cfg = await gw.configs.get('764cf9cd-4ebf-449e-b669-08149b0fbbbc');
|
|
11068
|
+
* const routing = JSON.parse(cfg.config) as Record<string, unknown>;
|
|
11069
|
+
* // routing.provider => '@anthropic-prod'
|
|
11070
|
+
* ```
|
|
11071
|
+
*/
|
|
11072
|
+
async get(configId) {
|
|
11073
|
+
assertUuid(configId, "configId");
|
|
11074
|
+
return request({
|
|
11075
|
+
method: "GET",
|
|
11076
|
+
baseUrl: this.baseUrl,
|
|
11077
|
+
path: `${AI_GW_CONFIGS_PATH}/${configId}`,
|
|
11078
|
+
responseSchema: GatewayConfigDetailSchema,
|
|
11079
|
+
auth: this.auth,
|
|
11080
|
+
numRetries: this.numRetries
|
|
11081
|
+
});
|
|
11082
|
+
}
|
|
11083
|
+
/**
|
|
11084
|
+
* Create a config.
|
|
11085
|
+
*
|
|
11086
|
+
* @remarks
|
|
11087
|
+
* The response is a **creation receipt** — `{ id, version_id, slug, object }` — not a
|
|
11088
|
+
* {@link GatewayConfigDetail}. Call {@link get} for the full record. Verified live
|
|
11089
|
+
* 2026-07-28.
|
|
11090
|
+
*
|
|
11091
|
+
* @param body - Name, workspace UUID, and the routing config object.
|
|
11092
|
+
* @returns The creation receipt.
|
|
11093
|
+
* @example
|
|
11094
|
+
* ```ts
|
|
11095
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11096
|
+
* const gw = new AIGatewayClient();
|
|
11097
|
+
*
|
|
11098
|
+
* const receipt = await gw.configs.create({
|
|
11099
|
+
* name: 'vertex-airs',
|
|
11100
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
11101
|
+
* config: { retry: { attempts: 3 }, cache: { mode: 'simple' } },
|
|
11102
|
+
* });
|
|
11103
|
+
* // receipt => { id: '...', version_id: '...', slug: 'pc-sdk-ve-14620d', object: 'config' }
|
|
11104
|
+
* ```
|
|
11105
|
+
*/
|
|
11106
|
+
async create(body) {
|
|
11107
|
+
assertUuid(body.workspace_id, "workspace_id");
|
|
11108
|
+
return request({
|
|
11109
|
+
method: "POST",
|
|
11110
|
+
baseUrl: this.baseUrl,
|
|
11111
|
+
path: AI_GW_CONFIGS_PATH,
|
|
11112
|
+
body,
|
|
11113
|
+
responseSchema: GatewayConfigCreateResponseSchema,
|
|
11114
|
+
auth: this.auth,
|
|
11115
|
+
numRetries: this.numRetries
|
|
11116
|
+
});
|
|
11117
|
+
}
|
|
11118
|
+
/**
|
|
11119
|
+
* Update a config.
|
|
11120
|
+
* @param configId - Config UUID.
|
|
11121
|
+
* @param body - Replacement fields.
|
|
11122
|
+
* @returns The raw update response. Shape unverified against a live tenant — see the PRD.
|
|
11123
|
+
* @example
|
|
11124
|
+
* ```ts
|
|
11125
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11126
|
+
* const gw = new AIGatewayClient();
|
|
11127
|
+
*
|
|
11128
|
+
* await gw.configs.update('764cf9cd-4ebf-449e-b669-08149b0fbbbc', {
|
|
11129
|
+
* name: 'claude-code',
|
|
11130
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
11131
|
+
* config: { retry: { attempts: 5 } },
|
|
11132
|
+
* });
|
|
11133
|
+
* ```
|
|
11134
|
+
*/
|
|
11135
|
+
async update(configId, body) {
|
|
11136
|
+
assertUuid(configId, "configId");
|
|
11137
|
+
assertUuid(body.workspace_id, "workspace_id");
|
|
11138
|
+
return request({
|
|
11139
|
+
method: "PUT",
|
|
11140
|
+
baseUrl: this.baseUrl,
|
|
11141
|
+
path: `${AI_GW_CONFIGS_PATH}/${configId}`,
|
|
11142
|
+
body,
|
|
11143
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11144
|
+
auth: this.auth,
|
|
11145
|
+
numRetries: this.numRetries
|
|
11146
|
+
});
|
|
11147
|
+
}
|
|
11148
|
+
/**
|
|
11149
|
+
* Delete a config.
|
|
11150
|
+
*
|
|
11151
|
+
* @remarks
|
|
11152
|
+
* This is a **hard delete** — unlike {@link AIGatewayDeploymentsClient.delete | deployments.delete}
|
|
11153
|
+
* (which archives), the config disappears from {@link list} entirely. Verified live
|
|
11154
|
+
* 2026-07-28. No `organisation_id` query param is required, unlike deployments/integrations.
|
|
11155
|
+
*
|
|
11156
|
+
* @param configId - Config UUID.
|
|
11157
|
+
* @returns Nothing.
|
|
11158
|
+
* @example
|
|
11159
|
+
* ```ts
|
|
11160
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11161
|
+
* const gw = new AIGatewayClient();
|
|
11162
|
+
*
|
|
11163
|
+
* await gw.configs.delete('764cf9cd-4ebf-449e-b669-08149b0fbbbc');
|
|
11164
|
+
* // the config no longer appears in gw.configs.list()
|
|
11165
|
+
* ```
|
|
11166
|
+
*/
|
|
11167
|
+
async delete(configId) {
|
|
11168
|
+
assertUuid(configId, "configId");
|
|
11169
|
+
await request({
|
|
11170
|
+
method: "DELETE",
|
|
11171
|
+
baseUrl: this.baseUrl,
|
|
11172
|
+
path: `${AI_GW_CONFIGS_PATH}/${configId}`,
|
|
11173
|
+
auth: this.auth,
|
|
11174
|
+
numRetries: this.numRetries
|
|
11175
|
+
});
|
|
11176
|
+
}
|
|
11177
|
+
};
|
|
11178
|
+
|
|
11179
|
+
// src/ai-gateway/guardrails-client.ts
|
|
11180
|
+
var AIGatewayGuardrailsClient = class {
|
|
11181
|
+
baseUrl;
|
|
11182
|
+
auth;
|
|
11183
|
+
numRetries;
|
|
11184
|
+
constructor(opts) {
|
|
11185
|
+
this.baseUrl = opts.baseUrl;
|
|
11186
|
+
this.auth = opts.auth;
|
|
11187
|
+
this.numRetries = opts.numRetries;
|
|
11188
|
+
}
|
|
11189
|
+
/**
|
|
11190
|
+
* List guardrails in a workspace.
|
|
11191
|
+
* @param opts - Must include the workspace UUID.
|
|
11192
|
+
* @returns Guardrails defined on that workspace.
|
|
11193
|
+
* @example
|
|
11194
|
+
* ```ts
|
|
11195
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11196
|
+
* const gw = new AIGatewayClient();
|
|
11197
|
+
*
|
|
11198
|
+
* const g = await gw.guardrails.list({ workspaceId: '16f7e90d-382a-4e78-b577-1b01eb5f8297' });
|
|
11199
|
+
* // g.data[0].id => 'pg-prisma-099a16'
|
|
11200
|
+
* ```
|
|
11201
|
+
*/
|
|
11202
|
+
async list(opts) {
|
|
11203
|
+
assertUuid(opts.workspaceId, "workspaceId");
|
|
11204
|
+
return request({
|
|
11205
|
+
method: "GET",
|
|
11206
|
+
baseUrl: this.baseUrl,
|
|
11207
|
+
path: AI_GW_GUARDRAILS_PATH,
|
|
11208
|
+
params: { workspace_id: opts.workspaceId },
|
|
11209
|
+
responseSchema: ListGuardrailsResponseSchema,
|
|
11210
|
+
auth: this.auth,
|
|
11211
|
+
numRetries: this.numRetries
|
|
11212
|
+
});
|
|
11213
|
+
}
|
|
11214
|
+
/**
|
|
11215
|
+
* Fetch one guardrail.
|
|
11216
|
+
* @param guardrailId - Guardrail UUID.
|
|
11217
|
+
* @returns Guardrail detail — adds `checks`, `actions`, and `version_id` on top of the list
|
|
11218
|
+
* row.
|
|
11219
|
+
* @example
|
|
11220
|
+
* ```ts
|
|
11221
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11222
|
+
* const gw = new AIGatewayClient();
|
|
11223
|
+
*
|
|
11224
|
+
* const g = await gw.guardrails.get('9f6c2a8e-2b3d-4e5f-8a9b-0c1d2e3f4a5b');
|
|
11225
|
+
* // g.checks[0].id => 'panw-prisma-airs.intercept'
|
|
11226
|
+
* ```
|
|
11227
|
+
*/
|
|
11228
|
+
async get(guardrailId) {
|
|
11229
|
+
assertUuid(guardrailId, "guardrailId");
|
|
11230
|
+
return request({
|
|
11231
|
+
method: "GET",
|
|
11232
|
+
baseUrl: this.baseUrl,
|
|
11233
|
+
path: `${AI_GW_GUARDRAILS_PATH}/${guardrailId}`,
|
|
11234
|
+
responseSchema: GatewayGuardrailDetailSchema,
|
|
11235
|
+
auth: this.auth,
|
|
11236
|
+
numRetries: this.numRetries
|
|
11237
|
+
});
|
|
11238
|
+
}
|
|
11239
|
+
/**
|
|
11240
|
+
* Create a guardrail.
|
|
11241
|
+
*
|
|
11242
|
+
* @remarks
|
|
11243
|
+
* The response is a **creation receipt** — `{ id, version_id, slug, object }` — not a
|
|
11244
|
+
* {@link GatewayGuardrailDetail}. Call {@link get} for the full record. Verified live
|
|
11245
|
+
* 2026-07-28.
|
|
11246
|
+
*
|
|
11247
|
+
* @param body - Workspace UUID, name, checks, and pass/fail actions.
|
|
11248
|
+
* @returns The creation receipt.
|
|
11249
|
+
* @example
|
|
11250
|
+
* ```ts
|
|
11251
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11252
|
+
* const gw = new AIGatewayClient();
|
|
11253
|
+
*
|
|
11254
|
+
* const receipt = await gw.guardrails.create({
|
|
11255
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
11256
|
+
* name: 'PrismaAIRS',
|
|
11257
|
+
* checks: [{ id: 'panw-prisma-airs.intercept', parameters: { profile_name: 'AI Gateway - Strict' }, is_enabled: true }],
|
|
11258
|
+
* actions: { deny: false, async: false, sequential: false },
|
|
11259
|
+
* });
|
|
11260
|
+
* // receipt => { id: '...', version_id: '...', slug: 'pg-sdk-ve-874b62', object: 'guardrail' }
|
|
11261
|
+
* ```
|
|
11262
|
+
*/
|
|
11263
|
+
async create(body) {
|
|
11264
|
+
assertUuid(body.workspace_id, "workspace_id");
|
|
11265
|
+
return request({
|
|
11266
|
+
method: "POST",
|
|
11267
|
+
baseUrl: this.baseUrl,
|
|
11268
|
+
path: AI_GW_GUARDRAILS_PATH,
|
|
11269
|
+
body,
|
|
11270
|
+
responseSchema: GatewayGuardrailCreateResponseSchema,
|
|
11271
|
+
auth: this.auth,
|
|
11272
|
+
numRetries: this.numRetries
|
|
11273
|
+
});
|
|
11274
|
+
}
|
|
11275
|
+
/**
|
|
11276
|
+
* Delete a guardrail.
|
|
11277
|
+
*
|
|
11278
|
+
* @remarks
|
|
11279
|
+
* This is a **hard delete** — unlike {@link AIGatewayDeploymentsClient.delete | deployments.delete}
|
|
11280
|
+
* (which archives), the guardrail disappears from {@link list} entirely. Verified live
|
|
11281
|
+
* 2026-07-28. No `organisation_id` query param is required, unlike deployments/integrations.
|
|
11282
|
+
*
|
|
11283
|
+
* @param guardrailId - Guardrail UUID.
|
|
11284
|
+
* @returns Nothing.
|
|
11285
|
+
* @example
|
|
11286
|
+
* ```ts
|
|
11287
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11288
|
+
* const gw = new AIGatewayClient();
|
|
11289
|
+
*
|
|
11290
|
+
* await gw.guardrails.delete('9f6c2a8e-2b3d-4e5f-8a9b-0c1d2e3f4a5b');
|
|
11291
|
+
* // the guardrail no longer appears in gw.guardrails.list()
|
|
11292
|
+
* ```
|
|
11293
|
+
*/
|
|
11294
|
+
async delete(guardrailId) {
|
|
11295
|
+
assertUuid(guardrailId, "guardrailId");
|
|
11296
|
+
await request({
|
|
11297
|
+
method: "DELETE",
|
|
11298
|
+
baseUrl: this.baseUrl,
|
|
11299
|
+
path: `${AI_GW_GUARDRAILS_PATH}/${guardrailId}`,
|
|
11300
|
+
auth: this.auth,
|
|
11301
|
+
numRetries: this.numRetries
|
|
11302
|
+
});
|
|
11303
|
+
}
|
|
11304
|
+
};
|
|
11305
|
+
|
|
11306
|
+
// src/ai-gateway/providers-client.ts
|
|
11307
|
+
var AIGatewayProvidersClient = class {
|
|
11308
|
+
baseUrl;
|
|
11309
|
+
auth;
|
|
11310
|
+
numRetries;
|
|
11311
|
+
constructor(opts) {
|
|
11312
|
+
this.baseUrl = opts.baseUrl;
|
|
11313
|
+
this.auth = opts.auth;
|
|
11314
|
+
this.numRetries = opts.numRetries;
|
|
11315
|
+
}
|
|
11316
|
+
/**
|
|
11317
|
+
* List providers in a workspace.
|
|
11318
|
+
* @param opts - Must include the workspace UUID.
|
|
11319
|
+
* @returns Providers bound into that workspace.
|
|
11320
|
+
* @example
|
|
11321
|
+
* ```ts
|
|
11322
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11323
|
+
* const gw = new AIGatewayClient();
|
|
11324
|
+
*
|
|
11325
|
+
* const p = await gw.providers.list({ workspaceId: '16f7e90d-382a-4e78-b577-1b01eb5f8297' });
|
|
11326
|
+
* // p.data[0].slug => 'openai-calvin'
|
|
11327
|
+
* ```
|
|
11328
|
+
*/
|
|
11329
|
+
async list(opts) {
|
|
11330
|
+
assertUuid(opts.workspaceId, "workspaceId");
|
|
11331
|
+
return request({
|
|
11332
|
+
method: "GET",
|
|
11333
|
+
baseUrl: this.baseUrl,
|
|
11334
|
+
path: AI_GW_PROVIDERS_PATH,
|
|
11335
|
+
params: { workspace_id: opts.workspaceId },
|
|
11336
|
+
responseSchema: ListProvidersResponseSchema,
|
|
11337
|
+
auth: this.auth,
|
|
11338
|
+
numRetries: this.numRetries
|
|
11339
|
+
});
|
|
11340
|
+
}
|
|
11341
|
+
/**
|
|
11342
|
+
* Create a provider.
|
|
11343
|
+
*
|
|
11344
|
+
* @remarks
|
|
11345
|
+
* The response is a **creation receipt** — `{ id, slug, object }` — not a {@link
|
|
11346
|
+
* GatewayProvider}. Note it has **no `version_id`**, unlike the sibling receipts for
|
|
11347
|
+
* {@link AIGatewayConfigsClient.create | configs.create} and {@link
|
|
11348
|
+
* AIGatewayGuardrailsClient.create | guardrails.create}. Verified live 2026-07-28.
|
|
11349
|
+
*
|
|
11350
|
+
* @param body - Workspace UUID, upstream provider id, integration id, name, and slug.
|
|
11351
|
+
* @returns The creation receipt.
|
|
11352
|
+
* @example
|
|
11353
|
+
* ```ts
|
|
11354
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11355
|
+
* const gw = new AIGatewayClient();
|
|
11356
|
+
*
|
|
11357
|
+
* const receipt = await gw.providers.create({
|
|
11358
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
11359
|
+
* ai_provider_id: 'de7d7d50-31cd-11ee-b93b-0e06f1aa7f7c',
|
|
11360
|
+
* integration_id: 'f6692544-3265-49be-9711-bbdcebc079e4',
|
|
11361
|
+
* name: 'openai-calvin',
|
|
11362
|
+
* slug: 'openai-calvin',
|
|
11363
|
+
* });
|
|
11364
|
+
* // receipt => { id: '...', slug: 'sdk-verify-delete-me-provider', object: 'provider' }
|
|
11365
|
+
* ```
|
|
11366
|
+
*/
|
|
11367
|
+
async create(body) {
|
|
11368
|
+
assertUuid(body.workspace_id, "workspace_id");
|
|
11369
|
+
assertUuid(body.ai_provider_id, "ai_provider_id");
|
|
11370
|
+
assertUuid(body.integration_id, "integration_id");
|
|
11371
|
+
return request({
|
|
11372
|
+
method: "POST",
|
|
11373
|
+
baseUrl: this.baseUrl,
|
|
11374
|
+
path: AI_GW_PROVIDERS_PATH,
|
|
11375
|
+
body,
|
|
11376
|
+
responseSchema: GatewayProviderCreateResponseSchema,
|
|
11377
|
+
auth: this.auth,
|
|
11378
|
+
numRetries: this.numRetries
|
|
11379
|
+
});
|
|
11380
|
+
}
|
|
11381
|
+
/**
|
|
11382
|
+
* Delete a provider.
|
|
11383
|
+
*
|
|
11384
|
+
* @remarks
|
|
11385
|
+
* This is a **hard delete** — unlike {@link AIGatewayDeploymentsClient.delete | deployments.delete}
|
|
11386
|
+
* (which archives), the provider disappears from {@link list} entirely. Verified live
|
|
11387
|
+
* 2026-07-28. No `organisation_id` query param is required, unlike deployments/integrations.
|
|
11388
|
+
*
|
|
11389
|
+
* @param providerId - Provider UUID.
|
|
11390
|
+
* @returns Nothing.
|
|
11391
|
+
* @example
|
|
11392
|
+
* ```ts
|
|
11393
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11394
|
+
* const gw = new AIGatewayClient();
|
|
11395
|
+
*
|
|
11396
|
+
* await gw.providers.delete('f6692544-3265-49be-9711-bbdcebc079e4');
|
|
11397
|
+
* // the provider no longer appears in gw.providers.list()
|
|
11398
|
+
* ```
|
|
11399
|
+
*/
|
|
11400
|
+
async delete(providerId) {
|
|
11401
|
+
assertUuid(providerId, "providerId");
|
|
11402
|
+
await request({
|
|
11403
|
+
method: "DELETE",
|
|
11404
|
+
baseUrl: this.baseUrl,
|
|
11405
|
+
path: `${AI_GW_PROVIDERS_PATH}/${providerId}`,
|
|
11406
|
+
auth: this.auth,
|
|
11407
|
+
numRetries: this.numRetries
|
|
11408
|
+
});
|
|
11409
|
+
}
|
|
11410
|
+
};
|
|
11411
|
+
|
|
11412
|
+
// src/ai-gateway/api-keys-client.ts
|
|
11413
|
+
var AIGatewayApiKeysClient = class {
|
|
11414
|
+
baseUrl;
|
|
11415
|
+
auth;
|
|
11416
|
+
numRetries;
|
|
11417
|
+
constructor(opts) {
|
|
11418
|
+
this.baseUrl = opts.baseUrl;
|
|
11419
|
+
this.auth = opts.auth;
|
|
11420
|
+
this.numRetries = opts.numRetries;
|
|
11421
|
+
}
|
|
11422
|
+
/** @internal */
|
|
11423
|
+
listAt(path, opts) {
|
|
11424
|
+
assertUuid(opts.workspaceId, "workspaceId");
|
|
11425
|
+
return request({
|
|
11426
|
+
method: "GET",
|
|
11427
|
+
baseUrl: this.baseUrl,
|
|
11428
|
+
path,
|
|
11429
|
+
params: { workspace_id: opts.workspaceId },
|
|
11430
|
+
responseSchema: ListApiKeysResponseSchema,
|
|
11431
|
+
auth: this.auth,
|
|
11432
|
+
numRetries: this.numRetries
|
|
11433
|
+
});
|
|
11434
|
+
}
|
|
11435
|
+
/** @internal */
|
|
11436
|
+
writeAt(method, path, body) {
|
|
11437
|
+
assertUuid(body.workspace_id, "workspace_id");
|
|
11438
|
+
return request({
|
|
11439
|
+
method,
|
|
11440
|
+
baseUrl: this.baseUrl,
|
|
11441
|
+
path,
|
|
11442
|
+
body,
|
|
11443
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11444
|
+
auth: this.auth,
|
|
11445
|
+
numRetries: this.numRetries
|
|
11446
|
+
});
|
|
11447
|
+
}
|
|
11448
|
+
/**
|
|
11449
|
+
* List service API keys in a workspace.
|
|
11450
|
+
* @param opts - Must include the workspace UUID.
|
|
11451
|
+
* @returns Service keys; the secret itself is only ever returned at creation.
|
|
11452
|
+
* @example
|
|
11453
|
+
* ```ts
|
|
11454
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11455
|
+
* const gw = new AIGatewayClient();
|
|
11456
|
+
*
|
|
11457
|
+
* const keys = await gw.apiKeys.listService({ workspaceId: '16f7e90d-382a-4e78-b577-1b01eb5f8297' });
|
|
11458
|
+
* // keys.total => 1
|
|
11459
|
+
* ```
|
|
11460
|
+
*/
|
|
11461
|
+
async listService(opts) {
|
|
11462
|
+
return this.listAt(AI_GW_API_KEYS_SERVICE_PATH, opts);
|
|
11463
|
+
}
|
|
11464
|
+
/**
|
|
11465
|
+
* List user API keys in a workspace.
|
|
11466
|
+
* @param opts - Must include the workspace UUID.
|
|
11467
|
+
* @returns User-scoped keys.
|
|
11468
|
+
* @example
|
|
11469
|
+
* ```ts
|
|
11470
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11471
|
+
* const gw = new AIGatewayClient();
|
|
11472
|
+
*
|
|
11473
|
+
* const keys = await gw.apiKeys.listUser({ workspaceId: '16f7e90d-382a-4e78-b577-1b01eb5f8297' });
|
|
11474
|
+
* // keys.total => 0
|
|
11475
|
+
* ```
|
|
11476
|
+
*/
|
|
11477
|
+
async listUser(opts) {
|
|
11478
|
+
return this.listAt(AI_GW_API_KEYS_USER_PATH, opts);
|
|
11479
|
+
}
|
|
11480
|
+
/**
|
|
11481
|
+
* Create a service API key.
|
|
11482
|
+
* @param body - Name, scopes, TSG, workspace UUID, and type.
|
|
11483
|
+
* @returns The raw create response — the only place the key secret appears. Capture it.
|
|
11484
|
+
* @example
|
|
11485
|
+
* ```ts
|
|
11486
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11487
|
+
* const gw = new AIGatewayClient();
|
|
11488
|
+
*
|
|
11489
|
+
* await gw.apiKeys.createService({
|
|
11490
|
+
* name: 'ci-runner',
|
|
11491
|
+
* scopes: ['completions.write', 'logs.write'],
|
|
11492
|
+
* organisation_id: '1852583913',
|
|
11493
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
11494
|
+
* type: 'workspace',
|
|
11495
|
+
* });
|
|
11496
|
+
* ```
|
|
11497
|
+
*/
|
|
11498
|
+
async createService(body) {
|
|
11499
|
+
return this.writeAt("POST", AI_GW_API_KEYS_SERVICE_PATH, body);
|
|
11500
|
+
}
|
|
11501
|
+
/**
|
|
11502
|
+
* Create a user API key.
|
|
11503
|
+
* @param body - As {@link createService}, plus `user_id`.
|
|
11504
|
+
* @returns The raw create response — the only place the key secret appears. Capture it.
|
|
11505
|
+
* @example
|
|
11506
|
+
* ```ts
|
|
11507
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11508
|
+
* const gw = new AIGatewayClient();
|
|
11509
|
+
*
|
|
11510
|
+
* await gw.apiKeys.createUser({
|
|
11511
|
+
* name: 'calvin-laptop',
|
|
11512
|
+
* scopes: ['completions.write'],
|
|
11513
|
+
* organisation_id: '1852583913',
|
|
11514
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
11515
|
+
* type: 'workspace',
|
|
11516
|
+
* user_id: 'fad91538-65a9-41f7-8b9c-6e4c0e8b9c5f',
|
|
11517
|
+
* });
|
|
11518
|
+
* ```
|
|
11519
|
+
*/
|
|
11520
|
+
async createUser(body) {
|
|
11521
|
+
return this.writeAt("POST", AI_GW_API_KEYS_USER_PATH, body);
|
|
11522
|
+
}
|
|
11523
|
+
/**
|
|
11524
|
+
* Update a service API key.
|
|
11525
|
+
* @param keyId - Key UUID.
|
|
11526
|
+
* @param body - Replacement fields.
|
|
11527
|
+
* @returns The raw update response. Shape unverified against a live tenant — see the PRD.
|
|
11528
|
+
* @example
|
|
11529
|
+
* ```ts
|
|
11530
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11531
|
+
* const gw = new AIGatewayClient();
|
|
11532
|
+
*
|
|
11533
|
+
* await gw.apiKeys.updateService('11111111-1111-4111-8111-111111111111', {
|
|
11534
|
+
* name: 'ci-runner',
|
|
11535
|
+
* scopes: ['completions.write'],
|
|
11536
|
+
* organisation_id: '1852583913',
|
|
11537
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
11538
|
+
* type: 'workspace',
|
|
11539
|
+
* });
|
|
11540
|
+
* ```
|
|
11541
|
+
*/
|
|
11542
|
+
async updateService(keyId, body) {
|
|
11543
|
+
assertUuid(keyId, "keyId");
|
|
11544
|
+
return this.writeAt("PUT", `${AI_GW_API_KEYS_SERVICE_PATH}/${keyId}`, body);
|
|
11545
|
+
}
|
|
11546
|
+
/**
|
|
11547
|
+
* Update a user API key.
|
|
11548
|
+
* @param keyId - Key UUID.
|
|
11549
|
+
* @param body - Replacement fields.
|
|
11550
|
+
* @returns The raw update response. Shape unverified against a live tenant — see the PRD.
|
|
11551
|
+
* @example
|
|
11552
|
+
* ```ts
|
|
11553
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11554
|
+
* const gw = new AIGatewayClient();
|
|
11555
|
+
*
|
|
11556
|
+
* await gw.apiKeys.updateUser('11111111-1111-4111-8111-111111111111', {
|
|
11557
|
+
* name: 'calvin-laptop',
|
|
11558
|
+
* scopes: ['completions.write'],
|
|
11559
|
+
* organisation_id: '1852583913',
|
|
11560
|
+
* workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
|
|
11561
|
+
* type: 'workspace',
|
|
11562
|
+
* user_id: 'fad91538-65a9-41f7-8b9c-6e4c0e8b9c5f',
|
|
11563
|
+
* });
|
|
11564
|
+
* ```
|
|
11565
|
+
*/
|
|
11566
|
+
async updateUser(keyId, body) {
|
|
11567
|
+
assertUuid(keyId, "keyId");
|
|
11568
|
+
return this.writeAt("PUT", `${AI_GW_API_KEYS_USER_PATH}/${keyId}`, body);
|
|
11569
|
+
}
|
|
11570
|
+
};
|
|
11571
|
+
|
|
11572
|
+
// src/ai-gateway/integrations-client.ts
|
|
11573
|
+
var AIGatewayIntegrationsClient = class {
|
|
11574
|
+
baseUrl;
|
|
11575
|
+
auth;
|
|
11576
|
+
numRetries;
|
|
11577
|
+
constructor(opts) {
|
|
11578
|
+
this.baseUrl = opts.baseUrl;
|
|
11579
|
+
this.auth = opts.auth;
|
|
11580
|
+
this.numRetries = opts.numRetries;
|
|
11581
|
+
}
|
|
11582
|
+
/**
|
|
11583
|
+
* List organisation integrations.
|
|
11584
|
+
* @returns All provider integrations defined on the organisation.
|
|
11585
|
+
* @example
|
|
11586
|
+
* ```ts
|
|
11587
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11588
|
+
* const gw = new AIGatewayClient();
|
|
11589
|
+
*
|
|
11590
|
+
* const ints = await gw.integrations.list();
|
|
11591
|
+
* // ints.data[0] => { name: 'openai-calvin', slug: 'openai-calvin', ... }
|
|
11592
|
+
* ```
|
|
11593
|
+
*/
|
|
11594
|
+
async list() {
|
|
11595
|
+
return request({
|
|
11596
|
+
method: "GET",
|
|
11597
|
+
baseUrl: this.baseUrl,
|
|
11598
|
+
path: AI_GW_INTEGRATIONS_PATH,
|
|
11599
|
+
responseSchema: ListIntegrationsResponseSchema,
|
|
11600
|
+
auth: this.auth,
|
|
11601
|
+
numRetries: this.numRetries
|
|
11602
|
+
});
|
|
11603
|
+
}
|
|
11604
|
+
/**
|
|
11605
|
+
* Fetch one integration.
|
|
11606
|
+
* @param integrationId - Integration UUID.
|
|
11607
|
+
* @returns The integration record.
|
|
11608
|
+
* @example
|
|
11609
|
+
* ```ts
|
|
11610
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11611
|
+
* const gw = new AIGatewayClient();
|
|
11612
|
+
*
|
|
11613
|
+
* const i = await gw.integrations.get('f6692544-3265-49be-9711-bbdcebc079e4');
|
|
11614
|
+
* // i.name => 'openai-calvin'
|
|
11615
|
+
* ```
|
|
11616
|
+
*/
|
|
11617
|
+
async get(integrationId) {
|
|
11618
|
+
assertUuid(integrationId, "integrationId");
|
|
11619
|
+
return request({
|
|
11620
|
+
method: "GET",
|
|
11621
|
+
baseUrl: this.baseUrl,
|
|
11622
|
+
path: `${AI_GW_INTEGRATIONS_PATH}/${integrationId}`,
|
|
11623
|
+
responseSchema: GatewayIntegrationSchema,
|
|
11624
|
+
auth: this.auth,
|
|
11625
|
+
numRetries: this.numRetries
|
|
11626
|
+
});
|
|
11627
|
+
}
|
|
11628
|
+
/**
|
|
11629
|
+
* Create an integration.
|
|
11630
|
+
*
|
|
11631
|
+
* @remarks
|
|
11632
|
+
* `body.key` (the provider API key) is a live secret. Setting `PANW_AI_SEC_DEBUG` will
|
|
11633
|
+
* print it, unredacted, to the SDK's own debug log.
|
|
11634
|
+
*
|
|
11635
|
+
* @param body - Provider id, name, slug, and provider-specific configuration.
|
|
11636
|
+
* @returns The raw create response. Shape unverified against a live tenant — see the PRD.
|
|
11637
|
+
* @example
|
|
11638
|
+
* ```ts
|
|
11639
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11640
|
+
* const gw = new AIGatewayClient();
|
|
11641
|
+
*
|
|
11642
|
+
* await gw.integrations.create({
|
|
11643
|
+
* organisation_id: '1852583913',
|
|
11644
|
+
* ai_provider_id: 'de7d7d50-31cd-11ee-b93b-0e06f1aa7f7c',
|
|
11645
|
+
* name: 'openai-prod',
|
|
11646
|
+
* slug: 'openai-prod',
|
|
11647
|
+
* key: process.env.OPENAI_API_KEY,
|
|
11648
|
+
* });
|
|
11649
|
+
* ```
|
|
11650
|
+
*/
|
|
11651
|
+
async create(body) {
|
|
11652
|
+
assertUuid(body.ai_provider_id, "ai_provider_id");
|
|
11653
|
+
return request({
|
|
11654
|
+
method: "POST",
|
|
11655
|
+
baseUrl: this.baseUrl,
|
|
11656
|
+
path: AI_GW_INTEGRATIONS_PATH,
|
|
11657
|
+
body,
|
|
11658
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11659
|
+
auth: this.auth,
|
|
11660
|
+
numRetries: this.numRetries
|
|
11661
|
+
});
|
|
11662
|
+
}
|
|
11663
|
+
/**
|
|
11664
|
+
* Update an integration.
|
|
11665
|
+
* @param integrationId - Integration UUID.
|
|
11666
|
+
* @param body - Replacement fields.
|
|
11667
|
+
* @returns The raw update response. Shape unverified against a live tenant — see the PRD.
|
|
11668
|
+
* @example
|
|
11669
|
+
* ```ts
|
|
11670
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11671
|
+
* const gw = new AIGatewayClient();
|
|
11672
|
+
*
|
|
11673
|
+
* await gw.integrations.update('f6692544-3265-49be-9711-bbdcebc079e4', {
|
|
11674
|
+
* name: 'openai-prod',
|
|
11675
|
+
* description: 'Production OpenAI',
|
|
11676
|
+
* });
|
|
11677
|
+
* ```
|
|
11678
|
+
*/
|
|
11679
|
+
async update(integrationId, body) {
|
|
11680
|
+
assertUuid(integrationId, "integrationId");
|
|
11681
|
+
if (body.ai_provider_id !== void 0) assertUuid(body.ai_provider_id, "ai_provider_id");
|
|
11682
|
+
return request({
|
|
11683
|
+
method: "PUT",
|
|
11684
|
+
baseUrl: this.baseUrl,
|
|
11685
|
+
path: `${AI_GW_INTEGRATIONS_PATH}/${integrationId}`,
|
|
11686
|
+
body,
|
|
11687
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11688
|
+
auth: this.auth,
|
|
11689
|
+
numRetries: this.numRetries
|
|
11690
|
+
});
|
|
11691
|
+
}
|
|
11692
|
+
/**
|
|
11693
|
+
* Delete an integration.
|
|
11694
|
+
* @param integrationId - Integration UUID.
|
|
11695
|
+
* @param organisationId - The TSG as a numeric string; sent as a query param.
|
|
11696
|
+
* @returns Nothing — the API replies 200 with an empty body.
|
|
11697
|
+
* @example
|
|
11698
|
+
* ```ts
|
|
11699
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11700
|
+
* const gw = new AIGatewayClient();
|
|
11701
|
+
*
|
|
11702
|
+
* await gw.integrations.delete('f6692544-3265-49be-9711-bbdcebc079e4', '1852583913');
|
|
11703
|
+
* ```
|
|
11704
|
+
*/
|
|
11705
|
+
async delete(integrationId, organisationId) {
|
|
11706
|
+
assertUuid(integrationId, "integrationId");
|
|
11707
|
+
assertNumericId(organisationId, "organisationId");
|
|
11708
|
+
await request({
|
|
11709
|
+
method: "DELETE",
|
|
11710
|
+
baseUrl: this.baseUrl,
|
|
11711
|
+
path: `${AI_GW_INTEGRATIONS_PATH}/${integrationId}`,
|
|
11712
|
+
params: { organisation_id: organisationId },
|
|
11713
|
+
auth: this.auth,
|
|
11714
|
+
numRetries: this.numRetries
|
|
11715
|
+
});
|
|
11716
|
+
}
|
|
11717
|
+
/**
|
|
11718
|
+
* Read which models this integration exposes.
|
|
11719
|
+
* @param integrationId - Integration UUID.
|
|
11720
|
+
* @returns Per-model enablement plus the `allow_all_models` flag.
|
|
11721
|
+
* @example
|
|
11722
|
+
* ```ts
|
|
11723
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11724
|
+
* const gw = new AIGatewayClient();
|
|
11725
|
+
*
|
|
11726
|
+
* const m = await gw.integrations.getModels('f6692544-3265-49be-9711-bbdcebc079e4');
|
|
11727
|
+
* // m.models[0] => { slug: 'gpt-4', enabled: true }
|
|
11728
|
+
* ```
|
|
11729
|
+
*/
|
|
11730
|
+
async getModels(integrationId) {
|
|
11731
|
+
assertUuid(integrationId, "integrationId");
|
|
11732
|
+
return request({
|
|
11733
|
+
method: "GET",
|
|
11734
|
+
baseUrl: this.baseUrl,
|
|
11735
|
+
path: `${AI_GW_INTEGRATIONS_PATH}/${integrationId}/models`,
|
|
11736
|
+
responseSchema: GatewayIntegrationModelsResponseSchema,
|
|
11737
|
+
auth: this.auth,
|
|
11738
|
+
numRetries: this.numRetries
|
|
11739
|
+
});
|
|
11740
|
+
}
|
|
11741
|
+
/**
|
|
11742
|
+
* Replace which models this integration exposes.
|
|
11743
|
+
* @param integrationId - Integration UUID.
|
|
11744
|
+
* @param body - Full model list; this is a replace, not a merge.
|
|
11745
|
+
* @returns The raw response. Shape unverified against a live tenant — see the PRD.
|
|
11746
|
+
* @example
|
|
11747
|
+
* ```ts
|
|
11748
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11749
|
+
* const gw = new AIGatewayClient();
|
|
11750
|
+
*
|
|
11751
|
+
* await gw.integrations.setModels('f6692544-3265-49be-9711-bbdcebc079e4', {
|
|
11752
|
+
* models: [{ slug: 'gpt-4', enabled: true }, { slug: 'gpt-4-32k', enabled: false }],
|
|
11753
|
+
* });
|
|
11754
|
+
* ```
|
|
11755
|
+
*/
|
|
11756
|
+
async setModels(integrationId, body) {
|
|
11757
|
+
assertUuid(integrationId, "integrationId");
|
|
11758
|
+
return request({
|
|
11759
|
+
method: "PUT",
|
|
11760
|
+
baseUrl: this.baseUrl,
|
|
11761
|
+
path: `${AI_GW_INTEGRATIONS_PATH}/${integrationId}/models`,
|
|
11762
|
+
body,
|
|
11763
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11764
|
+
auth: this.auth,
|
|
11765
|
+
numRetries: this.numRetries
|
|
11766
|
+
});
|
|
11767
|
+
}
|
|
11768
|
+
/**
|
|
11769
|
+
* Read which workspaces may use this integration.
|
|
11770
|
+
*
|
|
11771
|
+
* @remarks
|
|
11772
|
+
* `global_workspace_access` is an **object** on this read, not a boolean, despite the
|
|
11773
|
+
* field name — `{ enabled, rate_limits, usage_limits }`. The corresponding write
|
|
11774
|
+
* ({@link setWorkspaces}) DOES send a plain boolean; the two are not symmetric.
|
|
11775
|
+
*
|
|
11776
|
+
* @param integrationId - Integration UUID.
|
|
11777
|
+
* @returns Bound workspaces plus the `global_workspace_access` object.
|
|
11778
|
+
* @example
|
|
11779
|
+
* ```ts
|
|
11780
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11781
|
+
* const gw = new AIGatewayClient();
|
|
11782
|
+
*
|
|
11783
|
+
* const w = await gw.integrations.getWorkspaces('f6692544-3265-49be-9711-bbdcebc079e4');
|
|
11784
|
+
* // w.global_workspace_access => { enabled: false, rate_limits: null, usage_limits: null }
|
|
11785
|
+
* ```
|
|
11786
|
+
*/
|
|
11787
|
+
async getWorkspaces(integrationId) {
|
|
11788
|
+
assertUuid(integrationId, "integrationId");
|
|
11789
|
+
return request({
|
|
11790
|
+
method: "GET",
|
|
11791
|
+
baseUrl: this.baseUrl,
|
|
11792
|
+
path: `${AI_GW_INTEGRATIONS_PATH}/${integrationId}/workspaces`,
|
|
11793
|
+
responseSchema: GatewayIntegrationWorkspacesResponseSchema,
|
|
11794
|
+
auth: this.auth,
|
|
11795
|
+
numRetries: this.numRetries
|
|
11796
|
+
});
|
|
11797
|
+
}
|
|
11798
|
+
/**
|
|
11799
|
+
* Replace which workspaces may use this integration.
|
|
11800
|
+
* @param integrationId - Integration UUID.
|
|
11801
|
+
* @param body - Workspace bindings or a global-access flag.
|
|
11802
|
+
* @returns The raw response. Shape unverified against a live tenant — see the PRD.
|
|
11803
|
+
* @example
|
|
11804
|
+
* ```ts
|
|
11805
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11806
|
+
* const gw = new AIGatewayClient();
|
|
11807
|
+
*
|
|
11808
|
+
* await gw.integrations.setWorkspaces('f6692544-3265-49be-9711-bbdcebc079e4', {
|
|
11809
|
+
* global_workspace_access: true,
|
|
11810
|
+
* });
|
|
11811
|
+
* ```
|
|
11812
|
+
*/
|
|
11813
|
+
async setWorkspaces(integrationId, body) {
|
|
11814
|
+
assertUuid(integrationId, "integrationId");
|
|
11815
|
+
return request({
|
|
11816
|
+
method: "PUT",
|
|
11817
|
+
baseUrl: this.baseUrl,
|
|
11818
|
+
path: `${AI_GW_INTEGRATIONS_PATH}/${integrationId}/workspaces`,
|
|
11819
|
+
body,
|
|
11820
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11821
|
+
auth: this.auth,
|
|
11822
|
+
numRetries: this.numRetries
|
|
11823
|
+
});
|
|
11824
|
+
}
|
|
11825
|
+
};
|
|
11826
|
+
|
|
11827
|
+
// src/ai-gateway/mcp-integrations-client.ts
|
|
11828
|
+
var AIGatewayMcpIntegrationsClient = class {
|
|
11829
|
+
baseUrl;
|
|
11830
|
+
auth;
|
|
11831
|
+
numRetries;
|
|
11832
|
+
constructor(opts) {
|
|
11833
|
+
this.baseUrl = opts.baseUrl;
|
|
11834
|
+
this.auth = opts.auth;
|
|
11835
|
+
this.numRetries = opts.numRetries;
|
|
11836
|
+
}
|
|
11837
|
+
/**
|
|
11838
|
+
* List organisation MCP integrations.
|
|
11839
|
+
* @returns All MCP server integrations defined on the organisation.
|
|
11840
|
+
* @example
|
|
11841
|
+
* ```ts
|
|
11842
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11843
|
+
* const gw = new AIGatewayClient();
|
|
11844
|
+
*
|
|
11845
|
+
* const mcp = await gw.mcpIntegrations.list();
|
|
11846
|
+
* // mcp.data[0] => { name: 'Context 7', url: 'https://mcp.context7.com/mcp', transport: 'http', ... }
|
|
11847
|
+
* ```
|
|
11848
|
+
*/
|
|
11849
|
+
async list() {
|
|
11850
|
+
return request({
|
|
11851
|
+
method: "GET",
|
|
11852
|
+
baseUrl: this.baseUrl,
|
|
11853
|
+
path: AI_GW_MCP_INTEGRATIONS_PATH,
|
|
11854
|
+
responseSchema: ListMcpIntegrationsResponseSchema,
|
|
11855
|
+
auth: this.auth,
|
|
11856
|
+
numRetries: this.numRetries
|
|
11857
|
+
});
|
|
11858
|
+
}
|
|
11859
|
+
/**
|
|
11860
|
+
* Register an MCP server.
|
|
11861
|
+
* @param body - Name, server URL, auth type, transport, and provider-specific configuration.
|
|
11862
|
+
* @returns The raw create response. Shape unverified against a live tenant — see the PRD.
|
|
11863
|
+
* @example
|
|
11864
|
+
* ```ts
|
|
11865
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11866
|
+
* const gw = new AIGatewayClient();
|
|
11867
|
+
*
|
|
11868
|
+
* await gw.mcpIntegrations.create({
|
|
11869
|
+
* name: 'Context 7',
|
|
11870
|
+
* organisation_id: '1852583913',
|
|
11871
|
+
* slug: 'context-7',
|
|
11872
|
+
* url: 'https://mcp.context7.com/mcp',
|
|
11873
|
+
* auth_type: 'none',
|
|
11874
|
+
* transport: 'http',
|
|
11875
|
+
* });
|
|
11876
|
+
* ```
|
|
11877
|
+
*/
|
|
11878
|
+
async create(body) {
|
|
11879
|
+
return request({
|
|
11880
|
+
method: "POST",
|
|
11881
|
+
baseUrl: this.baseUrl,
|
|
11882
|
+
path: AI_GW_MCP_INTEGRATIONS_PATH,
|
|
11883
|
+
body,
|
|
11884
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11885
|
+
auth: this.auth,
|
|
11886
|
+
numRetries: this.numRetries
|
|
11887
|
+
});
|
|
11888
|
+
}
|
|
11889
|
+
/**
|
|
11890
|
+
* Replace which workspaces may use this MCP integration.
|
|
11891
|
+
* @param mcpIntegrationId - MCP integration UUID.
|
|
11892
|
+
* @param body - Workspace bindings or a global-access flag; this is a replace, not a merge.
|
|
11893
|
+
* @returns The raw response. Shape unverified against a live tenant — see the PRD.
|
|
11894
|
+
* @example
|
|
11895
|
+
* ```ts
|
|
11896
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11897
|
+
* const gw = new AIGatewayClient();
|
|
11898
|
+
*
|
|
11899
|
+
* await gw.mcpIntegrations.setWorkspaces('f6692544-3265-49be-9711-bbdcebc079e4', {
|
|
11900
|
+
* global_workspace_access: true,
|
|
11901
|
+
* });
|
|
11902
|
+
* ```
|
|
11903
|
+
*/
|
|
11904
|
+
async setWorkspaces(mcpIntegrationId, body) {
|
|
11905
|
+
assertUuid(mcpIntegrationId, "mcpIntegrationId");
|
|
11906
|
+
return request({
|
|
11907
|
+
method: "PUT",
|
|
11908
|
+
baseUrl: this.baseUrl,
|
|
11909
|
+
path: `${AI_GW_MCP_INTEGRATIONS_PATH}/${mcpIntegrationId}/workspaces`,
|
|
11910
|
+
body,
|
|
11911
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
11912
|
+
auth: this.auth,
|
|
11913
|
+
numRetries: this.numRetries
|
|
11914
|
+
});
|
|
11915
|
+
}
|
|
11916
|
+
};
|
|
11917
|
+
|
|
11918
|
+
// src/ai-gateway/deployments-client.ts
|
|
11919
|
+
var AIGatewayDeploymentsClient = class {
|
|
11920
|
+
baseUrl;
|
|
11921
|
+
auth;
|
|
11922
|
+
numRetries;
|
|
11923
|
+
constructor(opts) {
|
|
11924
|
+
this.baseUrl = opts.baseUrl;
|
|
11925
|
+
this.auth = opts.auth;
|
|
11926
|
+
this.numRetries = opts.numRetries;
|
|
11927
|
+
}
|
|
11928
|
+
/**
|
|
11929
|
+
* List deployments.
|
|
11930
|
+
*
|
|
11931
|
+
* @remarks
|
|
11932
|
+
* Archived deployments are included — `delete()` is a soft-delete. Filter on
|
|
11933
|
+
* `status === 'active'` if you only want live ones.
|
|
11934
|
+
*
|
|
11935
|
+
* @returns All deployments, active and archived.
|
|
11936
|
+
* @example
|
|
11937
|
+
* ```ts
|
|
11938
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11939
|
+
* const gw = new AIGatewayClient();
|
|
11940
|
+
*
|
|
11941
|
+
* const all = await gw.deployments.list();
|
|
11942
|
+
* const live = all.data.filter((d) => d.status === 'active');
|
|
11943
|
+
* // live[0] => { name: 'talos', slug: 'dp-talos-f3b74e', status: 'active', ... }
|
|
11944
|
+
* ```
|
|
11945
|
+
*/
|
|
11946
|
+
async list() {
|
|
11947
|
+
return request({
|
|
11948
|
+
method: "GET",
|
|
11949
|
+
baseUrl: this.baseUrl,
|
|
11950
|
+
path: AI_GW_DEPLOYMENTS_PATH,
|
|
11951
|
+
responseSchema: ListDeploymentsResponseSchema,
|
|
11952
|
+
auth: this.auth,
|
|
11953
|
+
numRetries: this.numRetries
|
|
11954
|
+
});
|
|
11955
|
+
}
|
|
11956
|
+
/**
|
|
11957
|
+
* Fetch one deployment.
|
|
11958
|
+
* @param deploymentId - Deployment UUID.
|
|
11959
|
+
* @returns Deployment detail, including bound workspaces and masked credentials.
|
|
11960
|
+
* @example
|
|
11961
|
+
* ```ts
|
|
11962
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11963
|
+
* const gw = new AIGatewayClient();
|
|
11964
|
+
*
|
|
11965
|
+
* const d = await gw.deployments.get('32e8314e-7e68-4384-aacb-a476f6c3f91d');
|
|
11966
|
+
* // d.auth_settings?.allow_all_workspaces => 1 (a number, not a boolean)
|
|
11967
|
+
* ```
|
|
11968
|
+
*/
|
|
11969
|
+
async get(deploymentId) {
|
|
11970
|
+
assertUuid(deploymentId, "deploymentId");
|
|
11971
|
+
return request({
|
|
11972
|
+
method: "GET",
|
|
11973
|
+
baseUrl: this.baseUrl,
|
|
11974
|
+
path: `${AI_GW_DEPLOYMENTS_PATH}/${deploymentId}`,
|
|
11975
|
+
responseSchema: GatewayDeploymentDetailSchema,
|
|
11976
|
+
auth: this.auth,
|
|
11977
|
+
numRetries: this.numRetries
|
|
11978
|
+
});
|
|
11979
|
+
}
|
|
11980
|
+
/**
|
|
11981
|
+
* Create a deployment.
|
|
11982
|
+
*
|
|
11983
|
+
* @remarks
|
|
11984
|
+
* The response is a **creation receipt**, not a deployment record — it has 5 fields and
|
|
11985
|
+
* carries no `name`, `slug`, or `status`. Call {@link get} for the full record.
|
|
11986
|
+
*
|
|
11987
|
+
* This is the **only** time `credentials.password` and `client_auth` are readable; the
|
|
11988
|
+
* detail read masks them. Capture them here or they are unrecoverable. Never log them.
|
|
11989
|
+
* Note that setting `PANW_AI_SEC_DEBUG` will print the raw request/response, including
|
|
11990
|
+
* `credentials.password`, to the SDK's own debug log regardless of this warning.
|
|
11991
|
+
*
|
|
11992
|
+
* @param body - Name, type, TSG, and auth settings.
|
|
11993
|
+
* @returns The creation receipt including the deployment's gateway credentials.
|
|
11994
|
+
* @example
|
|
11995
|
+
* ```ts
|
|
11996
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
11997
|
+
* const gw = new AIGatewayClient();
|
|
11998
|
+
*
|
|
11999
|
+
* const receipt = await gw.deployments.create({
|
|
12000
|
+
* name: 'prod-us',
|
|
12001
|
+
* type: 'production',
|
|
12002
|
+
* organisation_id: '1852583913',
|
|
12003
|
+
* auth_settings: { allow_all_workspaces: true },
|
|
12004
|
+
* });
|
|
12005
|
+
* // receipt => { id: '2141...', client_auth: 'client-auth-...', credentials: { username, password }, ... }
|
|
12006
|
+
* const full = await gw.deployments.get(receipt.id);
|
|
12007
|
+
* ```
|
|
12008
|
+
*/
|
|
12009
|
+
async create(body) {
|
|
12010
|
+
return request({
|
|
12011
|
+
method: "POST",
|
|
12012
|
+
baseUrl: this.baseUrl,
|
|
12013
|
+
path: AI_GW_DEPLOYMENTS_PATH,
|
|
12014
|
+
body,
|
|
12015
|
+
responseSchema: GatewayDeploymentCreateResponseSchema,
|
|
12016
|
+
auth: this.auth,
|
|
12017
|
+
numRetries: this.numRetries
|
|
12018
|
+
});
|
|
12019
|
+
}
|
|
12020
|
+
/**
|
|
12021
|
+
* Archive a deployment.
|
|
12022
|
+
*
|
|
12023
|
+
* @remarks
|
|
12024
|
+
* This is a **soft delete** — the one exception to the gateway's usual delete semantics.
|
|
12025
|
+
* The API returns 200 with an empty body and the record persists with `status:
|
|
12026
|
+
* 'archived'`, still visible in {@link list}. There is no observed hard-delete for
|
|
12027
|
+
* deployments specifically. Contrast with {@link AIGatewayConfigsClient.delete |
|
|
12028
|
+
* configs.delete}, {@link AIGatewayGuardrailsClient.delete | guardrails.delete}, and
|
|
12029
|
+
* {@link AIGatewayProvidersClient.delete | providers.delete}, all of which hard-delete —
|
|
12030
|
+
* do not assume archive-on-delete is a gateway-wide convention.
|
|
12031
|
+
*
|
|
12032
|
+
* @param deploymentId - Deployment UUID.
|
|
12033
|
+
* @param organisationId - The TSG as a numeric string; sent as a query param.
|
|
12034
|
+
* @returns Nothing.
|
|
12035
|
+
* @example
|
|
12036
|
+
* ```ts
|
|
12037
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
12038
|
+
* const gw = new AIGatewayClient();
|
|
12039
|
+
*
|
|
12040
|
+
* await gw.deployments.delete('21414819-485e-4ba3-b3d3-3e1815580e43', '1852583913');
|
|
12041
|
+
* // the record remains in list() with status 'archived'
|
|
12042
|
+
* ```
|
|
12043
|
+
*/
|
|
12044
|
+
async delete(deploymentId, organisationId) {
|
|
12045
|
+
assertUuid(deploymentId, "deploymentId");
|
|
12046
|
+
assertNumericId(organisationId, "organisationId");
|
|
12047
|
+
await request({
|
|
12048
|
+
method: "DELETE",
|
|
12049
|
+
baseUrl: this.baseUrl,
|
|
12050
|
+
path: `${AI_GW_DEPLOYMENTS_PATH}/${deploymentId}`,
|
|
12051
|
+
params: { organisation_id: organisationId },
|
|
12052
|
+
auth: this.auth,
|
|
12053
|
+
numRetries: this.numRetries
|
|
12054
|
+
});
|
|
12055
|
+
}
|
|
12056
|
+
};
|
|
12057
|
+
|
|
12058
|
+
// src/ai-gateway/plugins-client.ts
|
|
12059
|
+
var AIGatewayPluginsClient = class {
|
|
12060
|
+
baseUrl;
|
|
12061
|
+
auth;
|
|
12062
|
+
numRetries;
|
|
12063
|
+
constructor(opts) {
|
|
12064
|
+
this.baseUrl = opts.baseUrl;
|
|
12065
|
+
this.auth = opts.auth;
|
|
12066
|
+
this.numRetries = opts.numRetries;
|
|
12067
|
+
}
|
|
12068
|
+
/**
|
|
12069
|
+
* List organisation plugin bindings.
|
|
12070
|
+
* @returns All plugins bound to the organisation, with masked credentials.
|
|
12071
|
+
* @example
|
|
12072
|
+
* ```ts
|
|
12073
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
12074
|
+
* const gw = new AIGatewayClient();
|
|
12075
|
+
*
|
|
12076
|
+
* const p = await gw.plugins.list();
|
|
12077
|
+
* // p.data[0] => { integration_slug: 'panw-prisma-airs', credentials: { AIRS_API_KEY: 'sn*****Gul' }, ... }
|
|
12078
|
+
* ```
|
|
12079
|
+
*/
|
|
12080
|
+
async list() {
|
|
12081
|
+
return request({
|
|
12082
|
+
method: "GET",
|
|
12083
|
+
baseUrl: this.baseUrl,
|
|
12084
|
+
path: AI_GW_PLUGINS_PATH,
|
|
12085
|
+
responseSchema: ListPluginsResponseSchema,
|
|
12086
|
+
auth: this.auth,
|
|
12087
|
+
numRetries: this.numRetries
|
|
12088
|
+
});
|
|
12089
|
+
}
|
|
12090
|
+
/**
|
|
12091
|
+
* Bind a plugin to the organisation.
|
|
12092
|
+
*
|
|
12093
|
+
* @remarks
|
|
12094
|
+
* `body.credentials` (e.g. `AIRS_API_KEY`) is a live secret. Setting `PANW_AI_SEC_DEBUG`
|
|
12095
|
+
* will print it, unredacted, to the SDK's own debug log.
|
|
12096
|
+
*
|
|
12097
|
+
* @param body - Integration id and provider-specific credentials.
|
|
12098
|
+
* @returns The raw create response. Shape unverified against a live tenant — see the PRD.
|
|
12099
|
+
* @example
|
|
12100
|
+
* ```ts
|
|
12101
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
12102
|
+
* const gw = new AIGatewayClient();
|
|
12103
|
+
*
|
|
12104
|
+
* await gw.plugins.create({
|
|
12105
|
+
* organisation_id: '1852583913',
|
|
12106
|
+
* integration_id: '232e45c4-809a-11f1-af60-2ca2a760eb7b',
|
|
12107
|
+
* credentials: { AIRS_API_KEY: process.env.PANW_AI_SEC_API_KEY ?? '' },
|
|
12108
|
+
* });
|
|
12109
|
+
* ```
|
|
12110
|
+
*/
|
|
12111
|
+
async create(body) {
|
|
12112
|
+
assertUuid(body.integration_id, "integration_id");
|
|
12113
|
+
return request({
|
|
12114
|
+
method: "POST",
|
|
12115
|
+
baseUrl: this.baseUrl,
|
|
12116
|
+
path: AI_GW_PLUGINS_PATH,
|
|
12117
|
+
body,
|
|
12118
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
12119
|
+
auth: this.auth,
|
|
12120
|
+
numRetries: this.numRetries
|
|
12121
|
+
});
|
|
12122
|
+
}
|
|
12123
|
+
};
|
|
12124
|
+
|
|
12125
|
+
// src/ai-gateway/organisations-client.ts
|
|
12126
|
+
var AIGatewayOrganisationsClient = class {
|
|
12127
|
+
baseUrl;
|
|
12128
|
+
auth;
|
|
12129
|
+
numRetries;
|
|
12130
|
+
constructor(opts) {
|
|
12131
|
+
this.baseUrl = opts.baseUrl;
|
|
12132
|
+
this.auth = opts.auth;
|
|
12133
|
+
this.numRetries = opts.numRetries;
|
|
12134
|
+
}
|
|
12135
|
+
/**
|
|
12136
|
+
* Fetch the calling organisation's settings.
|
|
12137
|
+
* @returns The organisation record.
|
|
12138
|
+
* @example
|
|
12139
|
+
* ```ts
|
|
12140
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
12141
|
+
* const gw = new AIGatewayClient();
|
|
12142
|
+
*
|
|
12143
|
+
* const org = await gw.organisations.getSelf();
|
|
12144
|
+
* // org.data.name => 'Acme Corp'
|
|
12145
|
+
* ```
|
|
12146
|
+
*/
|
|
12147
|
+
async getSelf() {
|
|
12148
|
+
return request({
|
|
12149
|
+
method: "GET",
|
|
12150
|
+
baseUrl: this.baseUrl,
|
|
12151
|
+
path: AI_GW_ORGANISATIONS_SELF_PATH,
|
|
12152
|
+
responseSchema: OrganisationSelfResponseSchema,
|
|
12153
|
+
auth: this.auth,
|
|
12154
|
+
numRetries: this.numRetries
|
|
12155
|
+
});
|
|
12156
|
+
}
|
|
12157
|
+
/**
|
|
12158
|
+
* Update the calling organisation's settings.
|
|
12159
|
+
* @param body - Replacement fields.
|
|
12160
|
+
* @returns The raw update response. Shape unverified against a live tenant — see the PRD.
|
|
12161
|
+
* @example
|
|
12162
|
+
* ```ts
|
|
12163
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
12164
|
+
* const gw = new AIGatewayClient();
|
|
12165
|
+
*
|
|
12166
|
+
* await gw.organisations.updateSelf({ name: 'Acme Corp' });
|
|
12167
|
+
* ```
|
|
12168
|
+
*/
|
|
12169
|
+
async updateSelf(body) {
|
|
12170
|
+
return request({
|
|
12171
|
+
method: "PUT",
|
|
12172
|
+
baseUrl: this.baseUrl,
|
|
12173
|
+
path: AI_GW_ORGANISATIONS_SELF_PATH,
|
|
12174
|
+
body,
|
|
12175
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
12176
|
+
auth: this.auth,
|
|
12177
|
+
numRetries: this.numRetries
|
|
12178
|
+
});
|
|
12179
|
+
}
|
|
12180
|
+
/**
|
|
12181
|
+
* Fetch an organisation's auth settings.
|
|
12182
|
+
*
|
|
12183
|
+
* @remarks
|
|
12184
|
+
* The response includes a `scim_token` — a live secret. Never log the returned object.
|
|
12185
|
+
* Note that setting `PANW_AI_SEC_DEBUG` will print it (unredacted) to the SDK's own debug
|
|
12186
|
+
* log regardless of this warning, since debug logging only sanitizes header values.
|
|
12187
|
+
*
|
|
12188
|
+
* @param tsgId - The TSG as a numeric string, not a UUID.
|
|
12189
|
+
* @returns Auth settings, including domains and the SCIM token.
|
|
12190
|
+
* @example
|
|
12191
|
+
* ```ts
|
|
12192
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
12193
|
+
* const gw = new AIGatewayClient();
|
|
12194
|
+
*
|
|
12195
|
+
* const auth = await gw.organisations.getAuthSettings('1852583913');
|
|
12196
|
+
* // Object.keys(auth.data) => ['auth_settings', 'domains', 'scim_token', ...]
|
|
12197
|
+
* ```
|
|
12198
|
+
*/
|
|
12199
|
+
async getAuthSettings(tsgId) {
|
|
12200
|
+
assertNumericId(tsgId, "tsgId");
|
|
12201
|
+
return request({
|
|
12202
|
+
method: "GET",
|
|
12203
|
+
baseUrl: this.baseUrl,
|
|
12204
|
+
path: aiGwOrganisationsAuthSettingsPath(tsgId),
|
|
12205
|
+
responseSchema: AuthSettingsResponseSchema,
|
|
12206
|
+
auth: this.auth,
|
|
12207
|
+
numRetries: this.numRetries
|
|
12208
|
+
});
|
|
12209
|
+
}
|
|
12210
|
+
/**
|
|
12211
|
+
* Update an organisation's auth settings.
|
|
12212
|
+
* @param tsgId - The TSG as a numeric string, not a UUID.
|
|
12213
|
+
* @param body - Replacement fields.
|
|
12214
|
+
* @returns The raw update response. Shape unverified against a live tenant — see the PRD.
|
|
12215
|
+
* @example
|
|
12216
|
+
* ```ts
|
|
12217
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
12218
|
+
* const gw = new AIGatewayClient();
|
|
12219
|
+
*
|
|
12220
|
+
* await gw.organisations.updateAuthSettings('1852583913', {
|
|
12221
|
+
* domains: ['acme.com'],
|
|
12222
|
+
* });
|
|
12223
|
+
* ```
|
|
12224
|
+
*/
|
|
12225
|
+
async updateAuthSettings(tsgId, body) {
|
|
12226
|
+
assertNumericId(tsgId, "tsgId");
|
|
12227
|
+
return request({
|
|
12228
|
+
method: "PUT",
|
|
12229
|
+
baseUrl: this.baseUrl,
|
|
12230
|
+
path: aiGwOrganisationsAuthSettingsPath(tsgId),
|
|
12231
|
+
body,
|
|
12232
|
+
responseSchema: GatewayWriteResponseSchema,
|
|
12233
|
+
auth: this.auth,
|
|
12234
|
+
numRetries: this.numRetries
|
|
12235
|
+
});
|
|
12236
|
+
}
|
|
12237
|
+
};
|
|
12238
|
+
|
|
12239
|
+
// src/ai-gateway/audit-logs-client.ts
|
|
12240
|
+
var AIGatewayAuditLogsClient = class {
|
|
12241
|
+
baseUrl;
|
|
12242
|
+
auth;
|
|
12243
|
+
numRetries;
|
|
12244
|
+
constructor(opts) {
|
|
12245
|
+
this.baseUrl = opts.baseUrl;
|
|
12246
|
+
this.auth = opts.auth;
|
|
12247
|
+
this.numRetries = opts.numRetries;
|
|
12248
|
+
}
|
|
12249
|
+
/**
|
|
12250
|
+
* Read organisation audit logs.
|
|
12251
|
+
*
|
|
12252
|
+
* @remarks
|
|
12253
|
+
* **Handle the result as sensitive.** The API returns each entry's `request_body`
|
|
12254
|
+
* **unredacted**, so records for credential-bearing calls (integrations, plugins) can
|
|
12255
|
+
* contain live secrets — private keys, provider API keys — in plaintext. The sibling
|
|
12256
|
+
* `request_headers` field is masked, but `request_body` is not. The SDK returns the
|
|
12257
|
+
* response faithfully rather than altering it; never log these records wholesale, and
|
|
12258
|
+
* never forward them to a third-party sink. Note that setting `PANW_AI_SEC_DEBUG` will
|
|
12259
|
+
* print the raw response — including these unredacted secrets — to the SDK's own debug
|
|
12260
|
+
* log regardless of this warning.
|
|
12261
|
+
*
|
|
12262
|
+
* @param opts - Inclusive start and end of the window.
|
|
12263
|
+
* @returns Audit records, newest first.
|
|
12264
|
+
* @example
|
|
12265
|
+
* ```ts
|
|
12266
|
+
* import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
12267
|
+
* const gw = new AIGatewayClient();
|
|
12268
|
+
*
|
|
12269
|
+
* const logs = await gw.auditLogs.list({
|
|
12270
|
+
* start: new Date('2026-07-20T00:00:00Z'),
|
|
12271
|
+
* end: new Date(),
|
|
12272
|
+
* });
|
|
12273
|
+
* // Safe projection — never log the whole record.
|
|
12274
|
+
* const summary = logs.records.map((r) => `${r.timestamp} ${r.method} ${r.uri}`);
|
|
12275
|
+
* ```
|
|
12276
|
+
*/
|
|
12277
|
+
async list(opts) {
|
|
12278
|
+
return request({
|
|
12279
|
+
method: "GET",
|
|
12280
|
+
baseUrl: this.baseUrl,
|
|
12281
|
+
path: AI_GW_AUDIT_LOGS_PATH,
|
|
12282
|
+
params: {
|
|
12283
|
+
start_time: opts.start.toISOString(),
|
|
12284
|
+
end_time: opts.end.toISOString()
|
|
12285
|
+
},
|
|
12286
|
+
responseSchema: GatewayAuditLogsResponseSchema,
|
|
12287
|
+
auth: this.auth,
|
|
12288
|
+
numRetries: this.numRetries
|
|
12289
|
+
});
|
|
12290
|
+
}
|
|
12291
|
+
};
|
|
12292
|
+
|
|
12293
|
+
// src/ai-gateway/client.ts
|
|
12294
|
+
var AIGatewayClient = class {
|
|
12295
|
+
/** Runtime telemetry: charts, group-bys, and raw request logs. */
|
|
12296
|
+
telemetry;
|
|
12297
|
+
/** Workspace reads (data plane). */
|
|
12298
|
+
workspaces;
|
|
12299
|
+
/** Gateway routing configs. */
|
|
12300
|
+
configs;
|
|
12301
|
+
/** Workspace guardrails. */
|
|
12302
|
+
guardrails;
|
|
12303
|
+
/** Workspace-scoped provider bindings. */
|
|
12304
|
+
providers;
|
|
12305
|
+
/** Service and user API keys. */
|
|
12306
|
+
apiKeys;
|
|
12307
|
+
/** Organisation-level provider integrations (admin plane). */
|
|
12308
|
+
integrations;
|
|
12309
|
+
/** MCP server integrations (admin plane). */
|
|
12310
|
+
mcpIntegrations;
|
|
12311
|
+
/** Gateway deployments (admin plane). */
|
|
12312
|
+
deployments;
|
|
12313
|
+
/** Plugin bindings such as the Prisma AIRS scanner (admin plane). */
|
|
12314
|
+
plugins;
|
|
12315
|
+
/** Organisation and auth settings (admin plane). */
|
|
12316
|
+
organisations;
|
|
12317
|
+
/** Organisation audit logs (admin plane). */
|
|
12318
|
+
auditLogs;
|
|
12319
|
+
constructor(opts = {}) {
|
|
12320
|
+
const dataEndpoint = opts.dataEndpoint ?? process.env[AI_GW_DATA_ENDPOINT] ?? DEFAULT_AI_GW_DATA_ENDPOINT;
|
|
12321
|
+
const adminEndpoint = opts.adminEndpoint ?? process.env[AI_GW_ADMIN_ENDPOINT] ?? DEFAULT_AI_GW_ADMIN_ENDPOINT;
|
|
12322
|
+
const { oauthClient, numRetries, tsgId } = resolveOAuthConfig({
|
|
12323
|
+
clientId: opts.clientId,
|
|
12324
|
+
clientSecret: opts.clientSecret,
|
|
12325
|
+
tsgId: opts.tsgId,
|
|
12326
|
+
baseUrl: dataEndpoint,
|
|
12327
|
+
numRetries: opts.numRetries,
|
|
12328
|
+
tokenEndpoint: opts.tokenEndpoint,
|
|
12329
|
+
primaryEnvPrefix: "PANW_AI_GW",
|
|
12330
|
+
fallbackEnvPrefix: "PANW_MGMT"
|
|
12331
|
+
});
|
|
12332
|
+
const auth = new TsgHeaderAuth(new OAuthAuth(oauthClient), tsgId);
|
|
12333
|
+
const dataOpts = { baseUrl: dataEndpoint, auth, numRetries };
|
|
12334
|
+
const adminOpts = { baseUrl: adminEndpoint, auth, numRetries };
|
|
12335
|
+
this.telemetry = new AIGatewayTelemetryClient({ ...dataOpts, tsgId });
|
|
12336
|
+
this.workspaces = new AIGatewayWorkspacesClient(dataOpts);
|
|
12337
|
+
this.configs = new AIGatewayConfigsClient(dataOpts);
|
|
12338
|
+
this.guardrails = new AIGatewayGuardrailsClient(dataOpts);
|
|
12339
|
+
this.providers = new AIGatewayProvidersClient(dataOpts);
|
|
12340
|
+
this.apiKeys = new AIGatewayApiKeysClient(dataOpts);
|
|
12341
|
+
this.integrations = new AIGatewayIntegrationsClient(adminOpts);
|
|
12342
|
+
this.mcpIntegrations = new AIGatewayMcpIntegrationsClient(adminOpts);
|
|
12343
|
+
this.deployments = new AIGatewayDeploymentsClient(adminOpts);
|
|
12344
|
+
this.plugins = new AIGatewayPluginsClient(adminOpts);
|
|
12345
|
+
this.organisations = new AIGatewayOrganisationsClient(adminOpts);
|
|
12346
|
+
this.auditLogs = new AIGatewayAuditLogsClient(adminOpts);
|
|
12347
|
+
}
|
|
12348
|
+
};
|
|
9922
12349
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9923
12350
|
0 && (module.exports = {
|
|
12351
|
+
AIGatewayApiKeysClient,
|
|
12352
|
+
AIGatewayAuditLogsClient,
|
|
12353
|
+
AIGatewayClient,
|
|
12354
|
+
AIGatewayConfigsClient,
|
|
12355
|
+
AIGatewayDeploymentsClient,
|
|
12356
|
+
AIGatewayGuardrailsClient,
|
|
12357
|
+
AIGatewayIntegrationsClient,
|
|
12358
|
+
AIGatewayMcpIntegrationsClient,
|
|
12359
|
+
AIGatewayOrganisationsClient,
|
|
12360
|
+
AIGatewayPluginsClient,
|
|
12361
|
+
AIGatewayProvidersClient,
|
|
12362
|
+
AIGatewayTelemetryClient,
|
|
12363
|
+
AIGatewayWorkspacesClient,
|
|
9924
12364
|
AIRS_ENDPOINTS,
|
|
9925
12365
|
AISecSDKException,
|
|
12366
|
+
AI_GW_ADMIN_ENDPOINT,
|
|
12367
|
+
AI_GW_API_KEYS_SERVICE_PATH,
|
|
12368
|
+
AI_GW_API_KEYS_USER_PATH,
|
|
12369
|
+
AI_GW_AUDIT_LOGS_PATH,
|
|
12370
|
+
AI_GW_CHARTS_PATH,
|
|
12371
|
+
AI_GW_CHART_METRICS,
|
|
12372
|
+
AI_GW_CONFIGS_PATH,
|
|
12373
|
+
AI_GW_DATA_ENDPOINT,
|
|
12374
|
+
AI_GW_DEPLOYMENTS_PATH,
|
|
12375
|
+
AI_GW_GROUPS_PATH,
|
|
12376
|
+
AI_GW_GROUP_COLUMNS,
|
|
12377
|
+
AI_GW_GROUP_DIMENSIONS,
|
|
12378
|
+
AI_GW_GUARDRAILS_PATH,
|
|
12379
|
+
AI_GW_INTEGRATIONS_PATH,
|
|
12380
|
+
AI_GW_LOGS_PATH,
|
|
12381
|
+
AI_GW_MCP_INTEGRATIONS_PATH,
|
|
12382
|
+
AI_GW_ORGANISATIONS_SELF_PATH,
|
|
12383
|
+
AI_GW_PLUGINS_PATH,
|
|
12384
|
+
AI_GW_PROVIDERS_PATH,
|
|
12385
|
+
AI_GW_WORKSPACES_PATH,
|
|
9926
12386
|
AI_SEC_API_ENDPOINT,
|
|
9927
12387
|
AI_SEC_API_KEY,
|
|
9928
12388
|
AI_SEC_API_TOKEN,
|
|
@@ -9956,6 +12416,7 @@ var RedTeamClient = class {
|
|
|
9956
12416
|
AttackType,
|
|
9957
12417
|
AuditResponseSchema,
|
|
9958
12418
|
AuthConfigSchema,
|
|
12419
|
+
AuthSettingsResponseSchema,
|
|
9959
12420
|
AuthType,
|
|
9960
12421
|
BEARER,
|
|
9961
12422
|
BaseResponseSchema,
|
|
@@ -9963,6 +12424,8 @@ var RedTeamClient = class {
|
|
|
9963
12424
|
BasicAuthLocation,
|
|
9964
12425
|
BedrockAccessConnectionParamsSchema,
|
|
9965
12426
|
BrandSubCategory,
|
|
12427
|
+
CacheHitTrendResponseSchema,
|
|
12428
|
+
CacheSummaryResponseSchema,
|
|
9966
12429
|
Category,
|
|
9967
12430
|
CategoryModelSchema,
|
|
9968
12431
|
CategoryReportSchema,
|
|
@@ -9984,7 +12447,9 @@ var RedTeamClient = class {
|
|
|
9984
12447
|
Content,
|
|
9985
12448
|
ContentErrorSchema,
|
|
9986
12449
|
ContentErrorType,
|
|
12450
|
+
CostChartResponseSchema,
|
|
9987
12451
|
CountByNameSchema,
|
|
12452
|
+
CountChartResponseSchema,
|
|
9988
12453
|
CountedQuotaEnum,
|
|
9989
12454
|
CreateChannelRequestSchema,
|
|
9990
12455
|
CreateCustomTopicRequestSchema,
|
|
@@ -10014,6 +12479,8 @@ var RedTeamClient = class {
|
|
|
10014
12479
|
CustomerAppSchema,
|
|
10015
12480
|
CustomerAppWithKeysSchema,
|
|
10016
12481
|
CustomerAppsClient,
|
|
12482
|
+
DEFAULT_AI_GW_ADMIN_ENDPOINT,
|
|
12483
|
+
DEFAULT_AI_GW_DATA_ENDPOINT,
|
|
10017
12484
|
DEFAULT_DLP_ENDPOINT,
|
|
10018
12485
|
DEFAULT_ENDPOINT,
|
|
10019
12486
|
DEFAULT_MGMT_ENDPOINT,
|
|
@@ -10118,6 +12585,7 @@ var RedTeamClient = class {
|
|
|
10118
12585
|
ErrorResponseSchema,
|
|
10119
12586
|
ErrorSource,
|
|
10120
12587
|
ErrorStatus,
|
|
12588
|
+
ErrorTrendsResponseSchema,
|
|
10121
12589
|
ErrorType,
|
|
10122
12590
|
EulaAcceptRequestSchema,
|
|
10123
12591
|
EulaContentResponseSchema,
|
|
@@ -10128,16 +12596,46 @@ var RedTeamClient = class {
|
|
|
10128
12596
|
ExclusionsSchema,
|
|
10129
12597
|
ExpressionOperatorTypeSchema,
|
|
10130
12598
|
ExpressionTreeNodeSchema,
|
|
12599
|
+
FeedbackModelsResponseSchema,
|
|
12600
|
+
FeedbackScoreDistributionResponseSchema,
|
|
10131
12601
|
FileFormat,
|
|
10132
12602
|
FileListSchema,
|
|
10133
12603
|
FileResponseSchema,
|
|
10134
12604
|
FileScanDataSchema,
|
|
10135
12605
|
FileScanResult,
|
|
10136
12606
|
FileType,
|
|
12607
|
+
GatewayApiKeySchema,
|
|
12608
|
+
GatewayAuditLogRecordSchema,
|
|
12609
|
+
GatewayAuditLogsResponseSchema,
|
|
12610
|
+
GatewayChartRecordSchema,
|
|
12611
|
+
GatewayConfigCreateResponseSchema,
|
|
12612
|
+
GatewayConfigDetailSchema,
|
|
12613
|
+
GatewayConfigSchema,
|
|
12614
|
+
GatewayDeploymentCreateResponseSchema,
|
|
12615
|
+
GatewayDeploymentDetailSchema,
|
|
12616
|
+
GatewayDeploymentSchema,
|
|
12617
|
+
GatewayGlobalWorkspaceAccessSchema,
|
|
12618
|
+
GatewayGroupRowSchema,
|
|
12619
|
+
GatewayGuardrailCreateResponseSchema,
|
|
12620
|
+
GatewayGuardrailDetailSchema,
|
|
12621
|
+
GatewayGuardrailSchema,
|
|
12622
|
+
GatewayIntegrationModelsResponseSchema,
|
|
12623
|
+
GatewayIntegrationSchema,
|
|
12624
|
+
GatewayIntegrationWorkspaceSchema,
|
|
12625
|
+
GatewayIntegrationWorkspacesResponseSchema,
|
|
12626
|
+
GatewayLogRecordSchema,
|
|
12627
|
+
GatewayLogsResponseSchema,
|
|
12628
|
+
GatewayPluginSchema,
|
|
12629
|
+
GatewayProviderCreateResponseSchema,
|
|
12630
|
+
GatewayProviderSchema,
|
|
12631
|
+
GatewayWorkspaceDetailSchema,
|
|
12632
|
+
GatewayWorkspaceSchema,
|
|
12633
|
+
GatewayWriteResponseSchema,
|
|
10137
12634
|
GoalListResponseSchema,
|
|
10138
12635
|
GoalSchema,
|
|
10139
12636
|
GoalType,
|
|
10140
12637
|
GoalTypeQueryParam,
|
|
12638
|
+
GroupListResponseSchema,
|
|
10141
12639
|
GuardrailAction,
|
|
10142
12640
|
HEADER_API_KEY,
|
|
10143
12641
|
HEADER_AUTH_TOKEN,
|
|
@@ -10164,9 +12662,19 @@ var RedTeamClient = class {
|
|
|
10164
12662
|
LabelsCreateRequestSchema,
|
|
10165
12663
|
LabelsResponseSchema,
|
|
10166
12664
|
LanguageOptionSchema,
|
|
12665
|
+
LatencyChartResponseSchema,
|
|
12666
|
+
ListApiKeysResponseSchema,
|
|
12667
|
+
ListConfigsResponseSchema,
|
|
12668
|
+
ListDeploymentsResponseSchema,
|
|
12669
|
+
ListGuardrailsResponseSchema,
|
|
12670
|
+
ListIntegrationsResponseSchema,
|
|
12671
|
+
ListMcpIntegrationsResponseSchema,
|
|
10167
12672
|
ListModelSecurityGroupsResponseSchema,
|
|
10168
12673
|
ListModelSecurityRuleInstancesResponseSchema,
|
|
10169
12674
|
ListModelSecurityRulesResponseSchema,
|
|
12675
|
+
ListPluginsResponseSchema,
|
|
12676
|
+
ListProvidersResponseSchema,
|
|
12677
|
+
ListWorkspacesResponseSchema,
|
|
10170
12678
|
MAX_AI_PROFILE_NAME_LENGTH,
|
|
10171
12679
|
MAX_API_KEY_LENGTH,
|
|
10172
12680
|
MAX_CONNECTION_POOL_SIZE,
|
|
@@ -10224,6 +12732,7 @@ var RedTeamClient = class {
|
|
|
10224
12732
|
MaskedDataSchema,
|
|
10225
12733
|
McEntrySchema,
|
|
10226
12734
|
McReportSchema,
|
|
12735
|
+
McpIntegrationSchema,
|
|
10227
12736
|
MetadataCriterionSchema,
|
|
10228
12737
|
MetadataSchema,
|
|
10229
12738
|
ModelConfigurationSchema,
|
|
@@ -10257,6 +12766,7 @@ var RedTeamClient = class {
|
|
|
10257
12766
|
Oauth2TokenSchema,
|
|
10258
12767
|
OffsetSchema,
|
|
10259
12768
|
OpenAIConnectionParamsSchema,
|
|
12769
|
+
OrganisationSelfResponseSchema,
|
|
10260
12770
|
PAYLOAD_HASH,
|
|
10261
12771
|
PageDataFilteringProfileResponseSchema,
|
|
10262
12772
|
PageDataPatternResponseSchema,
|
|
@@ -10334,6 +12844,7 @@ var RedTeamClient = class {
|
|
|
10334
12844
|
RegistryCredentialsSchema,
|
|
10335
12845
|
RemediationDetailSchema,
|
|
10336
12846
|
RemediationResponseSchema,
|
|
12847
|
+
RescuedRetriesResponseSchema,
|
|
10337
12848
|
ResourceModelExtensionSchema,
|
|
10338
12849
|
ResponseDetectedSchema,
|
|
10339
12850
|
ResponseDetectionDetailsSchema,
|
|
@@ -10408,6 +12919,7 @@ var RedTeamClient = class {
|
|
|
10408
12919
|
StreamingConnectionParamsSchema,
|
|
10409
12920
|
SubCategoryModelSchema,
|
|
10410
12921
|
SubCategoryStatsSchema,
|
|
12922
|
+
TSG_ID_HEADER,
|
|
10411
12923
|
TargetAdditionalContextSchema,
|
|
10412
12924
|
TargetAuthType,
|
|
10413
12925
|
TargetAuthValidationRequestSchema,
|
|
@@ -10434,6 +12946,7 @@ var RedTeamClient = class {
|
|
|
10434
12946
|
ThreatCategory,
|
|
10435
12947
|
ThreatScanReportSchema,
|
|
10436
12948
|
TokenStatsSchema,
|
|
12949
|
+
TokensChartResponseSchema,
|
|
10437
12950
|
ToolDetectedSchema,
|
|
10438
12951
|
ToolDetectionDetailsSchema,
|
|
10439
12952
|
ToolDetectionEntrySchema,
|
|
@@ -10448,6 +12961,8 @@ var RedTeamClient = class {
|
|
|
10448
12961
|
UpdateChannelRequestSchema,
|
|
10449
12962
|
UrlCategorySchema,
|
|
10450
12963
|
UrlfEntrySchema,
|
|
12964
|
+
UserGroupResponseSchema,
|
|
12965
|
+
UserTrendsResponseSchema,
|
|
10451
12966
|
ValidationErrorSchema,
|
|
10452
12967
|
Verdict,
|
|
10453
12968
|
ViolationListSchema,
|
|
@@ -10456,6 +12971,7 @@ var RedTeamClient = class {
|
|
|
10456
12971
|
ViolationSeverityCountsSchema,
|
|
10457
12972
|
WebSocketConnectionParamsSchema,
|
|
10458
12973
|
WeightedRegexSchema,
|
|
12974
|
+
aiGwOrganisationsAuthSettingsPath,
|
|
10459
12975
|
globalConfiguration,
|
|
10460
12976
|
init,
|
|
10461
12977
|
jsonNullable,
|