qati-sdk 1.0.4 → 1.0.6
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 +144 -8
- package/dist/index.cjs +105 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +95 -1
- package/dist/index.d.ts +95 -1
- package/dist/index.js +105 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -701,6 +701,27 @@ declare class ExplainResource {
|
|
|
701
701
|
get(entityKey: string, atTimestamp?: Date | string, topDominantNeighbors?: number, topEvents?: number): Promise<ExplainResponse>;
|
|
702
702
|
}
|
|
703
703
|
|
|
704
|
+
type QuotaUpdateRequest = {
|
|
705
|
+
max_tracked_entities: number;
|
|
706
|
+
max_monthly_events: number;
|
|
707
|
+
max_events_per_second: number;
|
|
708
|
+
};
|
|
709
|
+
type QuotaResponse = {
|
|
710
|
+
id: string;
|
|
711
|
+
tenant_id: string;
|
|
712
|
+
max_tracked_entities: number;
|
|
713
|
+
max_monthly_events: number;
|
|
714
|
+
max_events_per_second: number;
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
declare class QuotaResource {
|
|
718
|
+
private readonly _http;
|
|
719
|
+
private readonly apiName;
|
|
720
|
+
constructor(_http: HttpClient);
|
|
721
|
+
get(tenantId: string): Promise<QuotaResponse>;
|
|
722
|
+
upsert(tenantId: string, body: QuotaUpdateRequest): Promise<QuotaResponse>;
|
|
723
|
+
}
|
|
724
|
+
|
|
704
725
|
/**
|
|
705
726
|
* Response body for `GET /v1/tenants/verify-credentials` (Query API).
|
|
706
727
|
*/
|
|
@@ -822,6 +843,63 @@ declare class TrustStateResource {
|
|
|
822
843
|
getTrustStates(entityType: EntityTypeLowerCase, entityIds: readonly string[], options?: TrustStateOptions): Promise<TrustState[]>;
|
|
823
844
|
}
|
|
824
845
|
|
|
846
|
+
type WebhookCreateRequest = {
|
|
847
|
+
url: string;
|
|
848
|
+
subscribed_event_types?: string[];
|
|
849
|
+
enabled?: boolean;
|
|
850
|
+
};
|
|
851
|
+
type WebhookCreateResponse = {
|
|
852
|
+
id: string;
|
|
853
|
+
tenant_id: string;
|
|
854
|
+
url: string;
|
|
855
|
+
subscribed_event_types: string[];
|
|
856
|
+
enabled: boolean;
|
|
857
|
+
secret: string;
|
|
858
|
+
created_at: string;
|
|
859
|
+
};
|
|
860
|
+
type WebhookResponse = {
|
|
861
|
+
id: string;
|
|
862
|
+
tenant_id: string;
|
|
863
|
+
url: string;
|
|
864
|
+
subscribed_event_types: string[];
|
|
865
|
+
enabled: boolean;
|
|
866
|
+
consecutive_failures: number;
|
|
867
|
+
disabled_at: string | null;
|
|
868
|
+
created_at: string;
|
|
869
|
+
updated_at: string;
|
|
870
|
+
new_secret?: string | null;
|
|
871
|
+
};
|
|
872
|
+
type WebhookPatchRequest = {
|
|
873
|
+
url?: string;
|
|
874
|
+
subscribed_event_types?: string[];
|
|
875
|
+
enabled?: boolean;
|
|
876
|
+
rotate_secret?: boolean;
|
|
877
|
+
};
|
|
878
|
+
type WebhookTestDeliveryResponse = {
|
|
879
|
+
delivery_id: string;
|
|
880
|
+
};
|
|
881
|
+
type WebhookEventEnvelope = {
|
|
882
|
+
/** Delivery id; also present in the X-QATI-Event-Id request header. */
|
|
883
|
+
id: string;
|
|
884
|
+
/** Registered webhook endpoint id. */
|
|
885
|
+
webhook_id: string;
|
|
886
|
+
type: string;
|
|
887
|
+
tenant_id: string;
|
|
888
|
+
triggered_at: string;
|
|
889
|
+
data: TrustState | AdvisoryResponse;
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
declare class WebhookResource {
|
|
893
|
+
private readonly _http;
|
|
894
|
+
private readonly apiName;
|
|
895
|
+
constructor(_http: HttpClient);
|
|
896
|
+
list(tenantId: string): Promise<WebhookResponse[]>;
|
|
897
|
+
create(tenantId: string, body: WebhookCreateRequest): Promise<WebhookCreateResponse>;
|
|
898
|
+
patch(tenantId: string, webhookId: string, body: WebhookPatchRequest): Promise<WebhookResponse>;
|
|
899
|
+
delete(tenantId: string, webhookId: string): Promise<void>;
|
|
900
|
+
test(tenantId: string, webhookId: string): Promise<WebhookTestDeliveryResponse>;
|
|
901
|
+
}
|
|
902
|
+
|
|
825
903
|
/**
|
|
826
904
|
* High-level QATI API client: namespaces for tenant, trust state, advisories, explain, and batched event ingestion.
|
|
827
905
|
*
|
|
@@ -841,6 +919,8 @@ declare class Client extends HttpClient {
|
|
|
841
919
|
private readonly _advisory;
|
|
842
920
|
private readonly _explain;
|
|
843
921
|
private readonly _events;
|
|
922
|
+
private readonly _webhooks;
|
|
923
|
+
private readonly _quotas;
|
|
844
924
|
/**
|
|
845
925
|
* @param config - Resolved SDK configuration (typically `session.config`).
|
|
846
926
|
* @param axiosInstances - Optional per-API `axios` instances; see {@link Session#createClient}.
|
|
@@ -877,6 +957,20 @@ declare class Client extends HttpClient {
|
|
|
877
957
|
* @returns {@link EventResource} for the Query API.
|
|
878
958
|
*/
|
|
879
959
|
get events(): EventResource;
|
|
960
|
+
/**
|
|
961
|
+
* Webhook endpoint management for a tenant (create, list, patch, delete, test delivery).
|
|
962
|
+
*
|
|
963
|
+
* All methods require `tenantId` explicitly; resolve it once via `client.tenant.verifyCredentials()`.
|
|
964
|
+
*
|
|
965
|
+
* @returns {@link WebhookResource} for the Query API.
|
|
966
|
+
*/
|
|
967
|
+
get webhooks(): WebhookResource;
|
|
968
|
+
/**
|
|
969
|
+
* Tenant quota configuration (get and upsert numeric caps).
|
|
970
|
+
*
|
|
971
|
+
* @returns {@link QuotaResource} for the Query API.
|
|
972
|
+
*/
|
|
973
|
+
get quotas(): QuotaResource;
|
|
880
974
|
/**
|
|
881
975
|
* Flushes the event ingestion buffer (best-effort), then shuts down the batch scheduler.
|
|
882
976
|
* Call this on process shutdown so queued events are not lost.
|
|
@@ -4225,4 +4319,4 @@ type WorkflowActionSignalEvent = z.infer<typeof WorkflowActionSignalSchema>;
|
|
|
4225
4319
|
*/
|
|
4226
4320
|
declare const createWorkflowActionEvent: (event: WorkflowActionSignalEvent) => RawEventRequest;
|
|
4227
4321
|
|
|
4228
|
-
export { type APIErrorDetail, API_REGISTRY, type AdvisoryListResponse, type AdvisoryResponse, type AdvisorySeverity, type AdvisoryType, type AnomalyFlagSignalEvent, type ApiCallSignalEvent, type AuthSignalEvent, type BaseEvent, type BatchEventResponse, type BehaviorSignalEvent, type ContextIntegritySignalEvent, type EntityType, type EntityTypeLowerCase, type EventAcknowledgement, type EventError, type EventResourceOptions, type ExplainResponse, type ExplanationTrace, type ListAdvisoriesOptions, type ModelOutputSignalEvent, type NetworkSignalEvent, type PolicyEventSignalEvent, type PromptInputSignalEvent, QatiAPIError, QatiAuthError, QatiConfigError, type QatiConfigInput, type QatiConfigOutput, QatiNotFoundError, QatiRateLimitError, QatiSDKError, QatiServerError, type RagRetrievalSignalEvent, type RawEventRequest, RawEventRequestSchema, type RecommendedAction, Session, type SessionSignalEvent, type SystemTelemetrySignalEvent, type ToolCallSignalEvent, type TopContributor, type TransactionSignalEvent, type TrustState, type TrustStateOptions, type UserFeedbackSignalEvent, type VerifyCredentialsResponse, type WorkflowActionSignalEvent, baseUrlFor, createAnomalyFlagEvent, createApiCallEvent, createAuthEvent, createBehaviorEvent, createContextIntegrityEvent, createModelOutputEvent, createNetworkEvent, createPolicyEvent, createPromptInputEvent, createRagRetrievalEvent, createSessionEvent, createSystemTelemetryEvent, createToolCallEvent, createTransactionEvent, createUserFeedbackEvent, createWorkflowActionEvent, parseQatiConfig, resolveQatiConfig };
|
|
4322
|
+
export { type APIErrorDetail, API_REGISTRY, type AdvisoryListResponse, type AdvisoryResponse, type AdvisorySeverity, type AdvisoryType, type AnomalyFlagSignalEvent, type ApiCallSignalEvent, type AuthSignalEvent, type BaseEvent, type BatchEventResponse, type BehaviorSignalEvent, type ContextIntegritySignalEvent, type EntityType, type EntityTypeLowerCase, type EventAcknowledgement, type EventError, type EventResourceOptions, type ExplainResponse, type ExplanationTrace, type ListAdvisoriesOptions, type ModelOutputSignalEvent, type NetworkSignalEvent, type PolicyEventSignalEvent, type PromptInputSignalEvent, QatiAPIError, QatiAuthError, QatiConfigError, type QatiConfigInput, type QatiConfigOutput, QatiNotFoundError, QatiRateLimitError, QatiSDKError, QatiServerError, type QuotaResponse, type QuotaUpdateRequest, type RagRetrievalSignalEvent, type RawEventRequest, RawEventRequestSchema, type RecommendedAction, Session, type SessionSignalEvent, type SystemTelemetrySignalEvent, type ToolCallSignalEvent, type TopContributor, type TransactionSignalEvent, type TrustState, type TrustStateOptions, type UserFeedbackSignalEvent, type VerifyCredentialsResponse, type WebhookCreateRequest, type WebhookCreateResponse, type WebhookEventEnvelope, type WebhookPatchRequest, type WebhookResponse, type WebhookTestDeliveryResponse, type WorkflowActionSignalEvent, baseUrlFor, createAnomalyFlagEvent, createApiCallEvent, createAuthEvent, createBehaviorEvent, createContextIntegrityEvent, createModelOutputEvent, createNetworkEvent, createPolicyEvent, createPromptInputEvent, createRagRetrievalEvent, createSessionEvent, createSystemTelemetryEvent, createToolCallEvent, createTransactionEvent, createUserFeedbackEvent, createWorkflowActionEvent, parseQatiConfig, resolveQatiConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -701,6 +701,27 @@ declare class ExplainResource {
|
|
|
701
701
|
get(entityKey: string, atTimestamp?: Date | string, topDominantNeighbors?: number, topEvents?: number): Promise<ExplainResponse>;
|
|
702
702
|
}
|
|
703
703
|
|
|
704
|
+
type QuotaUpdateRequest = {
|
|
705
|
+
max_tracked_entities: number;
|
|
706
|
+
max_monthly_events: number;
|
|
707
|
+
max_events_per_second: number;
|
|
708
|
+
};
|
|
709
|
+
type QuotaResponse = {
|
|
710
|
+
id: string;
|
|
711
|
+
tenant_id: string;
|
|
712
|
+
max_tracked_entities: number;
|
|
713
|
+
max_monthly_events: number;
|
|
714
|
+
max_events_per_second: number;
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
declare class QuotaResource {
|
|
718
|
+
private readonly _http;
|
|
719
|
+
private readonly apiName;
|
|
720
|
+
constructor(_http: HttpClient);
|
|
721
|
+
get(tenantId: string): Promise<QuotaResponse>;
|
|
722
|
+
upsert(tenantId: string, body: QuotaUpdateRequest): Promise<QuotaResponse>;
|
|
723
|
+
}
|
|
724
|
+
|
|
704
725
|
/**
|
|
705
726
|
* Response body for `GET /v1/tenants/verify-credentials` (Query API).
|
|
706
727
|
*/
|
|
@@ -822,6 +843,63 @@ declare class TrustStateResource {
|
|
|
822
843
|
getTrustStates(entityType: EntityTypeLowerCase, entityIds: readonly string[], options?: TrustStateOptions): Promise<TrustState[]>;
|
|
823
844
|
}
|
|
824
845
|
|
|
846
|
+
type WebhookCreateRequest = {
|
|
847
|
+
url: string;
|
|
848
|
+
subscribed_event_types?: string[];
|
|
849
|
+
enabled?: boolean;
|
|
850
|
+
};
|
|
851
|
+
type WebhookCreateResponse = {
|
|
852
|
+
id: string;
|
|
853
|
+
tenant_id: string;
|
|
854
|
+
url: string;
|
|
855
|
+
subscribed_event_types: string[];
|
|
856
|
+
enabled: boolean;
|
|
857
|
+
secret: string;
|
|
858
|
+
created_at: string;
|
|
859
|
+
};
|
|
860
|
+
type WebhookResponse = {
|
|
861
|
+
id: string;
|
|
862
|
+
tenant_id: string;
|
|
863
|
+
url: string;
|
|
864
|
+
subscribed_event_types: string[];
|
|
865
|
+
enabled: boolean;
|
|
866
|
+
consecutive_failures: number;
|
|
867
|
+
disabled_at: string | null;
|
|
868
|
+
created_at: string;
|
|
869
|
+
updated_at: string;
|
|
870
|
+
new_secret?: string | null;
|
|
871
|
+
};
|
|
872
|
+
type WebhookPatchRequest = {
|
|
873
|
+
url?: string;
|
|
874
|
+
subscribed_event_types?: string[];
|
|
875
|
+
enabled?: boolean;
|
|
876
|
+
rotate_secret?: boolean;
|
|
877
|
+
};
|
|
878
|
+
type WebhookTestDeliveryResponse = {
|
|
879
|
+
delivery_id: string;
|
|
880
|
+
};
|
|
881
|
+
type WebhookEventEnvelope = {
|
|
882
|
+
/** Delivery id; also present in the X-QATI-Event-Id request header. */
|
|
883
|
+
id: string;
|
|
884
|
+
/** Registered webhook endpoint id. */
|
|
885
|
+
webhook_id: string;
|
|
886
|
+
type: string;
|
|
887
|
+
tenant_id: string;
|
|
888
|
+
triggered_at: string;
|
|
889
|
+
data: TrustState | AdvisoryResponse;
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
declare class WebhookResource {
|
|
893
|
+
private readonly _http;
|
|
894
|
+
private readonly apiName;
|
|
895
|
+
constructor(_http: HttpClient);
|
|
896
|
+
list(tenantId: string): Promise<WebhookResponse[]>;
|
|
897
|
+
create(tenantId: string, body: WebhookCreateRequest): Promise<WebhookCreateResponse>;
|
|
898
|
+
patch(tenantId: string, webhookId: string, body: WebhookPatchRequest): Promise<WebhookResponse>;
|
|
899
|
+
delete(tenantId: string, webhookId: string): Promise<void>;
|
|
900
|
+
test(tenantId: string, webhookId: string): Promise<WebhookTestDeliveryResponse>;
|
|
901
|
+
}
|
|
902
|
+
|
|
825
903
|
/**
|
|
826
904
|
* High-level QATI API client: namespaces for tenant, trust state, advisories, explain, and batched event ingestion.
|
|
827
905
|
*
|
|
@@ -841,6 +919,8 @@ declare class Client extends HttpClient {
|
|
|
841
919
|
private readonly _advisory;
|
|
842
920
|
private readonly _explain;
|
|
843
921
|
private readonly _events;
|
|
922
|
+
private readonly _webhooks;
|
|
923
|
+
private readonly _quotas;
|
|
844
924
|
/**
|
|
845
925
|
* @param config - Resolved SDK configuration (typically `session.config`).
|
|
846
926
|
* @param axiosInstances - Optional per-API `axios` instances; see {@link Session#createClient}.
|
|
@@ -877,6 +957,20 @@ declare class Client extends HttpClient {
|
|
|
877
957
|
* @returns {@link EventResource} for the Query API.
|
|
878
958
|
*/
|
|
879
959
|
get events(): EventResource;
|
|
960
|
+
/**
|
|
961
|
+
* Webhook endpoint management for a tenant (create, list, patch, delete, test delivery).
|
|
962
|
+
*
|
|
963
|
+
* All methods require `tenantId` explicitly; resolve it once via `client.tenant.verifyCredentials()`.
|
|
964
|
+
*
|
|
965
|
+
* @returns {@link WebhookResource} for the Query API.
|
|
966
|
+
*/
|
|
967
|
+
get webhooks(): WebhookResource;
|
|
968
|
+
/**
|
|
969
|
+
* Tenant quota configuration (get and upsert numeric caps).
|
|
970
|
+
*
|
|
971
|
+
* @returns {@link QuotaResource} for the Query API.
|
|
972
|
+
*/
|
|
973
|
+
get quotas(): QuotaResource;
|
|
880
974
|
/**
|
|
881
975
|
* Flushes the event ingestion buffer (best-effort), then shuts down the batch scheduler.
|
|
882
976
|
* Call this on process shutdown so queued events are not lost.
|
|
@@ -4225,4 +4319,4 @@ type WorkflowActionSignalEvent = z.infer<typeof WorkflowActionSignalSchema>;
|
|
|
4225
4319
|
*/
|
|
4226
4320
|
declare const createWorkflowActionEvent: (event: WorkflowActionSignalEvent) => RawEventRequest;
|
|
4227
4321
|
|
|
4228
|
-
export { type APIErrorDetail, API_REGISTRY, type AdvisoryListResponse, type AdvisoryResponse, type AdvisorySeverity, type AdvisoryType, type AnomalyFlagSignalEvent, type ApiCallSignalEvent, type AuthSignalEvent, type BaseEvent, type BatchEventResponse, type BehaviorSignalEvent, type ContextIntegritySignalEvent, type EntityType, type EntityTypeLowerCase, type EventAcknowledgement, type EventError, type EventResourceOptions, type ExplainResponse, type ExplanationTrace, type ListAdvisoriesOptions, type ModelOutputSignalEvent, type NetworkSignalEvent, type PolicyEventSignalEvent, type PromptInputSignalEvent, QatiAPIError, QatiAuthError, QatiConfigError, type QatiConfigInput, type QatiConfigOutput, QatiNotFoundError, QatiRateLimitError, QatiSDKError, QatiServerError, type RagRetrievalSignalEvent, type RawEventRequest, RawEventRequestSchema, type RecommendedAction, Session, type SessionSignalEvent, type SystemTelemetrySignalEvent, type ToolCallSignalEvent, type TopContributor, type TransactionSignalEvent, type TrustState, type TrustStateOptions, type UserFeedbackSignalEvent, type VerifyCredentialsResponse, type WorkflowActionSignalEvent, baseUrlFor, createAnomalyFlagEvent, createApiCallEvent, createAuthEvent, createBehaviorEvent, createContextIntegrityEvent, createModelOutputEvent, createNetworkEvent, createPolicyEvent, createPromptInputEvent, createRagRetrievalEvent, createSessionEvent, createSystemTelemetryEvent, createToolCallEvent, createTransactionEvent, createUserFeedbackEvent, createWorkflowActionEvent, parseQatiConfig, resolveQatiConfig };
|
|
4322
|
+
export { type APIErrorDetail, API_REGISTRY, type AdvisoryListResponse, type AdvisoryResponse, type AdvisorySeverity, type AdvisoryType, type AnomalyFlagSignalEvent, type ApiCallSignalEvent, type AuthSignalEvent, type BaseEvent, type BatchEventResponse, type BehaviorSignalEvent, type ContextIntegritySignalEvent, type EntityType, type EntityTypeLowerCase, type EventAcknowledgement, type EventError, type EventResourceOptions, type ExplainResponse, type ExplanationTrace, type ListAdvisoriesOptions, type ModelOutputSignalEvent, type NetworkSignalEvent, type PolicyEventSignalEvent, type PromptInputSignalEvent, QatiAPIError, QatiAuthError, QatiConfigError, type QatiConfigInput, type QatiConfigOutput, QatiNotFoundError, QatiRateLimitError, QatiSDKError, QatiServerError, type QuotaResponse, type QuotaUpdateRequest, type RagRetrievalSignalEvent, type RawEventRequest, RawEventRequestSchema, type RecommendedAction, Session, type SessionSignalEvent, type SystemTelemetrySignalEvent, type ToolCallSignalEvent, type TopContributor, type TransactionSignalEvent, type TrustState, type TrustStateOptions, type UserFeedbackSignalEvent, type VerifyCredentialsResponse, type WebhookCreateRequest, type WebhookCreateResponse, type WebhookEventEnvelope, type WebhookPatchRequest, type WebhookResponse, type WebhookTestDeliveryResponse, type WorkflowActionSignalEvent, baseUrlFor, createAnomalyFlagEvent, createApiCallEvent, createAuthEvent, createBehaviorEvent, createContextIntegrityEvent, createModelOutputEvent, createNetworkEvent, createPolicyEvent, createPromptInputEvent, createRagRetrievalEvent, createSessionEvent, createSystemTelemetryEvent, createToolCallEvent, createTransactionEvent, createUserFeedbackEvent, createWorkflowActionEvent, parseQatiConfig, resolveQatiConfig };
|
package/dist/index.js
CHANGED
|
@@ -72,19 +72,6 @@ var QatiConfigError = class extends QatiSDKError {
|
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
// src/config.ts
|
|
75
|
-
var EV_VARIABLES_NAMES = [
|
|
76
|
-
"QATI_TENANT_API_KEY",
|
|
77
|
-
"QATI_QUERY_API_BASE_URL",
|
|
78
|
-
"QATI_INGESTION_API_BASE_URL",
|
|
79
|
-
"QATI_TIMEOUT",
|
|
80
|
-
"QATI_MAX_RETRIES",
|
|
81
|
-
"QATI_INGESTION_BATCH_SIZE",
|
|
82
|
-
"QATI_INGESTION_FLUSH_INTERVAL_SECONDS",
|
|
83
|
-
"QATI_RETRY_BACKOFF_INITIAL_SECONDS",
|
|
84
|
-
"QATI_RETRY_BACKOFF_MAX_SECONDS",
|
|
85
|
-
"QATI_RETRY_JITTER_FRACTION",
|
|
86
|
-
"QATI_MAX_RETRIES"
|
|
87
|
-
];
|
|
88
75
|
var API_REGISTRY = {
|
|
89
76
|
query_api: "queryApiBaseUrl",
|
|
90
77
|
ingestion_api: "ingestionApiBaseUrl"
|
|
@@ -109,14 +96,22 @@ var stripUndefined = (obj) => {
|
|
|
109
96
|
};
|
|
110
97
|
var readEnvOverrides = () => {
|
|
111
98
|
const e = process.env;
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
99
|
+
const num = (key) => {
|
|
100
|
+
const v = e[key];
|
|
101
|
+
return v !== void 0 ? Number(v) : void 0;
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
tenantApiKey: e["QATI_TENANT_API_KEY"],
|
|
105
|
+
queryApiBaseUrl: e["QATI_QUERY_API_BASE_URL"],
|
|
106
|
+
ingestionApiBaseUrl: e["QATI_INGESTION_API_BASE_URL"],
|
|
107
|
+
timeout: num("QATI_TIMEOUT"),
|
|
108
|
+
maxRetries: num("QATI_MAX_RETRIES"),
|
|
109
|
+
ingestionBatchSize: num("QATI_INGESTION_BATCH_SIZE"),
|
|
110
|
+
ingestionFlushIntervalSeconds: num("QATI_INGESTION_FLUSH_INTERVAL_SECONDS"),
|
|
111
|
+
retryBackoffInitialSeconds: num("QATI_RETRY_BACKOFF_INITIAL_SECONDS"),
|
|
112
|
+
retryBackoffMaxSeconds: num("QATI_RETRY_BACKOFF_MAX_SECONDS"),
|
|
113
|
+
retryJitterFraction: num("QATI_RETRY_JITTER_FRACTION")
|
|
114
|
+
};
|
|
120
115
|
};
|
|
121
116
|
var resolveQatiConfig = (input) => {
|
|
122
117
|
config({ path: ".env" });
|
|
@@ -601,6 +596,29 @@ var ExplainResource = class {
|
|
|
601
596
|
}
|
|
602
597
|
};
|
|
603
598
|
|
|
599
|
+
// src/resources/quota-resource.ts
|
|
600
|
+
var QuotaResource = class {
|
|
601
|
+
constructor(_http) {
|
|
602
|
+
this._http = _http;
|
|
603
|
+
}
|
|
604
|
+
_http;
|
|
605
|
+
apiName = "query_api";
|
|
606
|
+
async get(tenantId) {
|
|
607
|
+
return this._http.request(
|
|
608
|
+
"GET",
|
|
609
|
+
`/v1/tenants/${encodeURIComponent(tenantId)}/quotas`,
|
|
610
|
+
{ api_name: this.apiName }
|
|
611
|
+
);
|
|
612
|
+
}
|
|
613
|
+
async upsert(tenantId, body) {
|
|
614
|
+
return this._http.request(
|
|
615
|
+
"PUT",
|
|
616
|
+
`/v1/tenants/${encodeURIComponent(tenantId)}/quotas`,
|
|
617
|
+
{ api_name: this.apiName, data: body }
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
|
|
604
622
|
// src/resources/tenant-resource.ts
|
|
605
623
|
var TenantResource = class {
|
|
606
624
|
constructor(_http) {
|
|
@@ -674,6 +692,50 @@ var TrustStateResource = class {
|
|
|
674
692
|
}
|
|
675
693
|
};
|
|
676
694
|
|
|
695
|
+
// src/resources/webhook-resource.ts
|
|
696
|
+
var WebhookResource = class {
|
|
697
|
+
constructor(_http) {
|
|
698
|
+
this._http = _http;
|
|
699
|
+
}
|
|
700
|
+
_http;
|
|
701
|
+
apiName = "query_api";
|
|
702
|
+
async list(tenantId) {
|
|
703
|
+
return this._http.request(
|
|
704
|
+
"GET",
|
|
705
|
+
`/v1/tenants/${encodeURIComponent(tenantId)}/webhooks`,
|
|
706
|
+
{ api_name: this.apiName }
|
|
707
|
+
);
|
|
708
|
+
}
|
|
709
|
+
async create(tenantId, body) {
|
|
710
|
+
return this._http.request(
|
|
711
|
+
"POST",
|
|
712
|
+
`/v1/tenants/${encodeURIComponent(tenantId)}/webhooks`,
|
|
713
|
+
{ api_name: this.apiName, data: body }
|
|
714
|
+
);
|
|
715
|
+
}
|
|
716
|
+
async patch(tenantId, webhookId, body) {
|
|
717
|
+
return this._http.request(
|
|
718
|
+
"PATCH",
|
|
719
|
+
`/v1/tenants/${encodeURIComponent(tenantId)}/webhooks/${encodeURIComponent(webhookId)}`,
|
|
720
|
+
{ api_name: this.apiName, data: body }
|
|
721
|
+
);
|
|
722
|
+
}
|
|
723
|
+
async delete(tenantId, webhookId) {
|
|
724
|
+
const instance = this._http.getClient(this.apiName);
|
|
725
|
+
await instance.request({
|
|
726
|
+
method: "DELETE",
|
|
727
|
+
url: `/v1/tenants/${encodeURIComponent(tenantId)}/webhooks/${encodeURIComponent(webhookId)}`
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
async test(tenantId, webhookId) {
|
|
731
|
+
return this._http.request(
|
|
732
|
+
"POST",
|
|
733
|
+
`/v1/tenants/${encodeURIComponent(tenantId)}/webhooks/${encodeURIComponent(webhookId)}/test`,
|
|
734
|
+
{ api_name: this.apiName }
|
|
735
|
+
);
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
|
|
677
739
|
// src/client/client.ts
|
|
678
740
|
var Client = class extends HttpClient {
|
|
679
741
|
_tenant;
|
|
@@ -681,6 +743,8 @@ var Client = class extends HttpClient {
|
|
|
681
743
|
_advisory;
|
|
682
744
|
_explain;
|
|
683
745
|
_events;
|
|
746
|
+
_webhooks;
|
|
747
|
+
_quotas;
|
|
684
748
|
/**
|
|
685
749
|
* @param config - Resolved SDK configuration (typically `session.config`).
|
|
686
750
|
* @param axiosInstances - Optional per-API `axios` instances; see {@link Session#createClient}.
|
|
@@ -693,6 +757,8 @@ var Client = class extends HttpClient {
|
|
|
693
757
|
this._advisory = new AdvisoryResource(this);
|
|
694
758
|
this._explain = new ExplainResource(this);
|
|
695
759
|
this._events = new EventResource(this);
|
|
760
|
+
this._webhooks = new WebhookResource(this);
|
|
761
|
+
this._quotas = new QuotaResource(this);
|
|
696
762
|
}
|
|
697
763
|
/**
|
|
698
764
|
* Tenant API surface (credentials verification).
|
|
@@ -734,6 +800,24 @@ var Client = class extends HttpClient {
|
|
|
734
800
|
get events() {
|
|
735
801
|
return this._events;
|
|
736
802
|
}
|
|
803
|
+
/**
|
|
804
|
+
* Webhook endpoint management for a tenant (create, list, patch, delete, test delivery).
|
|
805
|
+
*
|
|
806
|
+
* All methods require `tenantId` explicitly; resolve it once via `client.tenant.verifyCredentials()`.
|
|
807
|
+
*
|
|
808
|
+
* @returns {@link WebhookResource} for the Query API.
|
|
809
|
+
*/
|
|
810
|
+
get webhooks() {
|
|
811
|
+
return this._webhooks;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Tenant quota configuration (get and upsert numeric caps).
|
|
815
|
+
*
|
|
816
|
+
* @returns {@link QuotaResource} for the Query API.
|
|
817
|
+
*/
|
|
818
|
+
get quotas() {
|
|
819
|
+
return this._quotas;
|
|
820
|
+
}
|
|
737
821
|
/**
|
|
738
822
|
* Flushes the event ingestion buffer (best-effort), then shuts down the batch scheduler.
|
|
739
823
|
* Call this on process shutdown so queued events are not lost.
|