aira-sdk 3.4.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +41 -0
- package/dist/client.js +70 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -43,6 +43,47 @@ export declare class Aira {
|
|
|
43
43
|
updatePolicy(policyId: string, params: Record<string, any>): Promise<Record<string, any>>;
|
|
44
44
|
/** Delete a policy. */
|
|
45
45
|
deletePolicy(policyId: string): Promise<Record<string, any>>;
|
|
46
|
+
/** Activate a policy. */
|
|
47
|
+
activatePolicy(policyId: string): Promise<Record<string, any>>;
|
|
48
|
+
/** Deactivate a policy. */
|
|
49
|
+
deactivatePolicy(policyId: string): Promise<Record<string, any>>;
|
|
50
|
+
/** Test a policy against an action context without executing it. */
|
|
51
|
+
dryRunPolicy(policyId: string, actionContext: Record<string, any>): Promise<Record<string, any>>;
|
|
52
|
+
/** Scan text for PII, PHI, secrets, and prompt injection. */
|
|
53
|
+
sanitizeText(params: {
|
|
54
|
+
content: string;
|
|
55
|
+
policy?: string;
|
|
56
|
+
mode?: string;
|
|
57
|
+
aiModel?: string;
|
|
58
|
+
}): Promise<Record<string, any>>;
|
|
59
|
+
/** Reverse tokenization — map tokens back to original values. */
|
|
60
|
+
detokenize(params: {
|
|
61
|
+
content: string;
|
|
62
|
+
tokenMapping: Record<string, string>;
|
|
63
|
+
}): Promise<Record<string, any>>;
|
|
64
|
+
/** Create a webhook subscription. */
|
|
65
|
+
createWebhook(params: {
|
|
66
|
+
url: string;
|
|
67
|
+
events?: string[];
|
|
68
|
+
secret?: string;
|
|
69
|
+
}): Promise<Record<string, any>>;
|
|
70
|
+
/** List all webhooks for the organization. */
|
|
71
|
+
listWebhooks(): Promise<Array<Record<string, any>>>;
|
|
72
|
+
/** Delete a webhook. */
|
|
73
|
+
deleteWebhook(webhookId: string): Promise<Record<string, any>>;
|
|
74
|
+
/** Get usage summary for the current billing period. */
|
|
75
|
+
getUsage(): Promise<Record<string, any>>;
|
|
76
|
+
/** List individual usage events. */
|
|
77
|
+
listUsageEvents(params?: {
|
|
78
|
+
page?: number;
|
|
79
|
+
perPage?: number;
|
|
80
|
+
}): Promise<Record<string, any>>;
|
|
81
|
+
/** List available models. */
|
|
82
|
+
listModels(includeDisabled?: boolean): Promise<Array<Record<string, any>>>;
|
|
83
|
+
/** Get model preferences (disabled models list). */
|
|
84
|
+
getModelPreferences(): Promise<Record<string, any>>;
|
|
85
|
+
/** Update which models are disabled. */
|
|
86
|
+
updateModelPreferences(disabledModels: string[]): Promise<Record<string, any>>;
|
|
46
87
|
/** Get Aira's policy violations for a GitHub PR. */
|
|
47
88
|
getPrViolations(owner: string, repo: string, pullNumber: number): Promise<Array<Record<string, any>>>;
|
|
48
89
|
/**
|
package/dist/client.js
CHANGED
|
@@ -164,6 +164,76 @@ class Aira {
|
|
|
164
164
|
async deletePolicy(policyId) {
|
|
165
165
|
return this.del(`/policies/${policyId}`);
|
|
166
166
|
}
|
|
167
|
+
/** Activate a policy. */
|
|
168
|
+
async activatePolicy(policyId) {
|
|
169
|
+
return this.post(`/policies/${policyId}/activate`, {});
|
|
170
|
+
}
|
|
171
|
+
/** Deactivate a policy. */
|
|
172
|
+
async deactivatePolicy(policyId) {
|
|
173
|
+
return this.post(`/policies/${policyId}/deactivate`, {});
|
|
174
|
+
}
|
|
175
|
+
/** Test a policy against an action context without executing it. */
|
|
176
|
+
async dryRunPolicy(policyId, actionContext) {
|
|
177
|
+
return this.post(`/policies/${policyId}/dry-run`, { action_context: actionContext });
|
|
178
|
+
}
|
|
179
|
+
// ==================== Sanitize ====================
|
|
180
|
+
/** Scan text for PII, PHI, secrets, and prompt injection. */
|
|
181
|
+
async sanitizeText(params) {
|
|
182
|
+
return this.post("/sanitize", buildBody({
|
|
183
|
+
content: params.content,
|
|
184
|
+
policy: params.policy ?? "standard",
|
|
185
|
+
mode: params.mode ?? "flag",
|
|
186
|
+
ai_model: params.aiModel,
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
/** Reverse tokenization — map tokens back to original values. */
|
|
190
|
+
async detokenize(params) {
|
|
191
|
+
return this.post("/sanitize/detokenize", {
|
|
192
|
+
content: params.content,
|
|
193
|
+
token_mapping: params.tokenMapping,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
// ==================== Webhooks ====================
|
|
197
|
+
/** Create a webhook subscription. */
|
|
198
|
+
async createWebhook(params) {
|
|
199
|
+
return this.post("/webhooks", buildBody(params));
|
|
200
|
+
}
|
|
201
|
+
/** List all webhooks for the organization. */
|
|
202
|
+
async listWebhooks() {
|
|
203
|
+
return this.get("/webhooks");
|
|
204
|
+
}
|
|
205
|
+
/** Delete a webhook. */
|
|
206
|
+
async deleteWebhook(webhookId) {
|
|
207
|
+
return this.del(`/webhooks/${webhookId}`);
|
|
208
|
+
}
|
|
209
|
+
// ==================== Usage ====================
|
|
210
|
+
/** Get usage summary for the current billing period. */
|
|
211
|
+
async getUsage() {
|
|
212
|
+
return this.get("/usage");
|
|
213
|
+
}
|
|
214
|
+
/** List individual usage events. */
|
|
215
|
+
async listUsageEvents(params) {
|
|
216
|
+
const qs = new URLSearchParams();
|
|
217
|
+
if (params?.page)
|
|
218
|
+
qs.set("page", String(params.page));
|
|
219
|
+
if (params?.perPage)
|
|
220
|
+
qs.set("per_page", String(params.perPage));
|
|
221
|
+
return this.get(`/usage/events?${qs}`);
|
|
222
|
+
}
|
|
223
|
+
// ==================== Models ====================
|
|
224
|
+
/** List available models. */
|
|
225
|
+
async listModels(includeDisabled = false) {
|
|
226
|
+
const suffix = includeDisabled ? "?include_disabled=true" : "";
|
|
227
|
+
return this.get(`/models${suffix}`);
|
|
228
|
+
}
|
|
229
|
+
/** Get model preferences (disabled models list). */
|
|
230
|
+
async getModelPreferences() {
|
|
231
|
+
return this.get("/models/preferences");
|
|
232
|
+
}
|
|
233
|
+
/** Update which models are disabled. */
|
|
234
|
+
async updateModelPreferences(disabledModels) {
|
|
235
|
+
return this.put("/models/preferences", { disabled_models: disabledModels });
|
|
236
|
+
}
|
|
167
237
|
// ==================== Code Governance ====================
|
|
168
238
|
/** Get Aira's policy violations for a GitHub PR. */
|
|
169
239
|
async getPrViolations(owner, repo, pullNumber) {
|