@gibs-dev/sdk 0.1.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/LICENSE +21 -0
- package/README.md +206 -0
- package/dist/cjs/client.d.ts +151 -0
- package/dist/cjs/client.d.ts.map +1 -0
- package/dist/cjs/client.js +328 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/errors.d.ts +66 -0
- package/dist/cjs/errors.d.ts.map +1 -0
- package/dist/cjs/errors.js +99 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/index.d.ts +21 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +32 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/types.d.ts +163 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +10 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/client.d.ts +151 -0
- package/dist/esm/client.d.ts.map +1 -0
- package/dist/esm/client.js +324 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/errors.d.ts +66 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +90 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.d.ts +21 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +22 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types.d.ts +163 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +9 -0
- package/dist/esm/types.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Gibs API client.
|
|
4
|
+
*
|
|
5
|
+
* Provides typed methods for all Gibs compliance API endpoints.
|
|
6
|
+
* Uses native `fetch` -- works in Node.js 18+, browsers, Deno, and Bun.
|
|
7
|
+
*
|
|
8
|
+
* @module client
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.GibsClient = void 0;
|
|
12
|
+
const errors_js_1 = require("./errors.js");
|
|
13
|
+
const VERSION = '0.1.0';
|
|
14
|
+
const DEFAULT_BASE_URL = 'https://api.gibs.dev';
|
|
15
|
+
const DEFAULT_TIMEOUT_MS = 120_000;
|
|
16
|
+
const DEFAULT_MAX_RETRIES = 3;
|
|
17
|
+
/** Initial delay for exponential backoff, in milliseconds. */
|
|
18
|
+
const INITIAL_RETRY_DELAY_MS = 500;
|
|
19
|
+
/** Maximum delay between retries, in milliseconds. */
|
|
20
|
+
const MAX_RETRY_DELAY_MS = 30_000;
|
|
21
|
+
/** HTTP status codes that are safe to retry. */
|
|
22
|
+
const RETRYABLE_STATUS_CODES = new Set([408, 429, 500, 502, 503, 504]);
|
|
23
|
+
/**
|
|
24
|
+
* Official client for the Gibs multi-regulation compliance API.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { GibsClient } from '@gibs/sdk';
|
|
29
|
+
*
|
|
30
|
+
* const client = new GibsClient({ apiKey: 'gbs_live_xxx' });
|
|
31
|
+
*
|
|
32
|
+
* const result = await client.classify({
|
|
33
|
+
* description: 'Facial recognition system for airport security',
|
|
34
|
+
* });
|
|
35
|
+
* console.log(result.risk_level);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
class GibsClient {
|
|
39
|
+
apiKey;
|
|
40
|
+
baseUrl;
|
|
41
|
+
timeout;
|
|
42
|
+
maxRetries;
|
|
43
|
+
constructor(options) {
|
|
44
|
+
if (!options.apiKey) {
|
|
45
|
+
throw new Error('API key is required. Get one at https://gibs.dev');
|
|
46
|
+
}
|
|
47
|
+
this.apiKey = options.apiKey;
|
|
48
|
+
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, '');
|
|
49
|
+
this.timeout = options.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
50
|
+
this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
51
|
+
}
|
|
52
|
+
// ==========================================================================
|
|
53
|
+
// Public API Methods
|
|
54
|
+
// ==========================================================================
|
|
55
|
+
/**
|
|
56
|
+
* Classify an AI system under EU AI Act risk levels.
|
|
57
|
+
*
|
|
58
|
+
* Returns the risk classification, relevant obligations,
|
|
59
|
+
* and source citations from the legal corpus.
|
|
60
|
+
*
|
|
61
|
+
* @param request - Description of the AI system to classify.
|
|
62
|
+
* @returns Classification result with risk level and obligations.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const result = await client.classify({
|
|
67
|
+
* description: 'CV screening tool that ranks job applicants',
|
|
68
|
+
* sector: 'employment',
|
|
69
|
+
* data_types: ['biometric'],
|
|
70
|
+
* });
|
|
71
|
+
*
|
|
72
|
+
* console.log(result.risk_level); // "high"
|
|
73
|
+
* console.log(result.obligations); // [{id: "risk_mgmt", ...}, ...]
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
async classify(request) {
|
|
77
|
+
return this._request('POST', '/v1/classify', request);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Ask a compliance question and get a grounded answer with citations.
|
|
81
|
+
*
|
|
82
|
+
* Every claim in the answer is traceable to a specific article
|
|
83
|
+
* in the legal corpus. If the corpus doesn't cover the question,
|
|
84
|
+
* the response indicates abstention with a reason.
|
|
85
|
+
*
|
|
86
|
+
* @param request - The compliance question and optional context.
|
|
87
|
+
* @returns Answer with source citations and confidence level.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* const answer = await client.check({
|
|
92
|
+
* question: 'What are the transparency requirements for chatbots under the AI Act?',
|
|
93
|
+
* regulation: 'ai_act',
|
|
94
|
+
* });
|
|
95
|
+
*
|
|
96
|
+
* console.log(answer.answer);
|
|
97
|
+
* console.log(answer.sources);
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
async check(request) {
|
|
101
|
+
return this._request('POST', '/v1/check', request);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Check API health and component status.
|
|
105
|
+
*
|
|
106
|
+
* Does not require authentication.
|
|
107
|
+
*
|
|
108
|
+
* @returns Health status with component details.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* const health = await client.health();
|
|
113
|
+
* console.log(health.status); // "healthy"
|
|
114
|
+
* console.log(health.components); // {api: "healthy", qdrant: "healthy", ...}
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
async health() {
|
|
118
|
+
return this._request('GET', '/v1/health');
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* List all active API keys for your organization.
|
|
122
|
+
*
|
|
123
|
+
* Returns metadata only -- never includes the full key value.
|
|
124
|
+
*
|
|
125
|
+
* @returns Array of key metadata.
|
|
126
|
+
*/
|
|
127
|
+
async listKeys() {
|
|
128
|
+
return this._request('GET', '/v1/account/keys');
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Create a new API key for your organization.
|
|
132
|
+
*
|
|
133
|
+
* The full key value is returned exactly once in the response.
|
|
134
|
+
* Store it securely -- it cannot be retrieved again.
|
|
135
|
+
*
|
|
136
|
+
* Maximum 5 active keys per organization.
|
|
137
|
+
*
|
|
138
|
+
* @param request - Optional name for the key.
|
|
139
|
+
* @returns The created key including the full key value (shown once).
|
|
140
|
+
*/
|
|
141
|
+
async createKey(request) {
|
|
142
|
+
return this._request('POST', '/v1/account/keys', request);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Revoke an API key.
|
|
146
|
+
*
|
|
147
|
+
* The key must belong to your organization. You cannot revoke
|
|
148
|
+
* the key that is currently being used for authentication.
|
|
149
|
+
*
|
|
150
|
+
* @param keyId - Database ID of the key to revoke.
|
|
151
|
+
* @returns Confirmation with status "revoked".
|
|
152
|
+
*/
|
|
153
|
+
async deleteKey(keyId) {
|
|
154
|
+
return this._request('DELETE', `/v1/account/keys/${keyId}`);
|
|
155
|
+
}
|
|
156
|
+
// ==========================================================================
|
|
157
|
+
// Internal HTTP Layer
|
|
158
|
+
// ==========================================================================
|
|
159
|
+
/**
|
|
160
|
+
* Execute an HTTP request with retries, timeout, and error handling.
|
|
161
|
+
*/
|
|
162
|
+
async _request(method, path, body) {
|
|
163
|
+
const url = `${this.baseUrl}${path}`;
|
|
164
|
+
const headers = {
|
|
165
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
166
|
+
'Content-Type': 'application/json',
|
|
167
|
+
'User-Agent': `gibs-sdk-js/${VERSION}`,
|
|
168
|
+
'Accept': 'application/json',
|
|
169
|
+
};
|
|
170
|
+
let lastError = null;
|
|
171
|
+
for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
|
|
172
|
+
// Wait before retrying (skip delay on first attempt)
|
|
173
|
+
if (attempt > 0) {
|
|
174
|
+
const delay = this._retryDelay(attempt, lastError);
|
|
175
|
+
await this._sleep(delay);
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
const response = await this._fetchWithTimeout(url, {
|
|
179
|
+
method,
|
|
180
|
+
headers,
|
|
181
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
182
|
+
});
|
|
183
|
+
// Success -- parse and return
|
|
184
|
+
if (response.ok) {
|
|
185
|
+
return (await response.json());
|
|
186
|
+
}
|
|
187
|
+
// Parse error response
|
|
188
|
+
const responseHeaders = this._extractHeaders(response);
|
|
189
|
+
let errorMessage;
|
|
190
|
+
try {
|
|
191
|
+
const errorBody = await response.json();
|
|
192
|
+
errorMessage = errorBody.detail ?? `HTTP ${response.status}`;
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
errorMessage = `HTTP ${response.status}: ${response.statusText}`;
|
|
196
|
+
}
|
|
197
|
+
// Build the appropriate error
|
|
198
|
+
const error = this._buildError(response.status, errorMessage, responseHeaders);
|
|
199
|
+
// Don't retry non-retryable errors
|
|
200
|
+
if (!RETRYABLE_STATUS_CODES.has(response.status)) {
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
lastError = error;
|
|
204
|
+
}
|
|
205
|
+
catch (err) {
|
|
206
|
+
// If it's already one of our errors (non-retryable), rethrow
|
|
207
|
+
if (err instanceof errors_js_1.GibsAuthError) {
|
|
208
|
+
throw err;
|
|
209
|
+
}
|
|
210
|
+
if (err instanceof errors_js_1.GibsAPIError && !RETRYABLE_STATUS_CODES.has(err.status)) {
|
|
211
|
+
throw err;
|
|
212
|
+
}
|
|
213
|
+
// Timeout
|
|
214
|
+
if (err instanceof errors_js_1.GibsTimeoutError) {
|
|
215
|
+
lastError = err;
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
// Network errors
|
|
219
|
+
if (this._isNetworkError(err)) {
|
|
220
|
+
lastError = new errors_js_1.GibsConnectionError(`Connection failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
// Already a GibsError (retryable API error), keep retrying
|
|
224
|
+
if (err instanceof errors_js_1.GibsAPIError) {
|
|
225
|
+
lastError = err;
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
// Unknown error -- don't retry
|
|
229
|
+
throw err;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// All retries exhausted
|
|
233
|
+
throw lastError ?? new errors_js_1.GibsConnectionError('Request failed after all retries');
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Fetch with an AbortController-based timeout.
|
|
237
|
+
*/
|
|
238
|
+
async _fetchWithTimeout(url, init) {
|
|
239
|
+
const controller = new AbortController();
|
|
240
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
241
|
+
try {
|
|
242
|
+
const response = await fetch(url, {
|
|
243
|
+
...init,
|
|
244
|
+
signal: controller.signal,
|
|
245
|
+
});
|
|
246
|
+
return response;
|
|
247
|
+
}
|
|
248
|
+
catch (err) {
|
|
249
|
+
if (err instanceof DOMException && err.name === 'AbortError') {
|
|
250
|
+
throw new errors_js_1.GibsTimeoutError(this.timeout);
|
|
251
|
+
}
|
|
252
|
+
// Node.js uses a different error type for abort
|
|
253
|
+
if (err instanceof Error && err.name === 'AbortError') {
|
|
254
|
+
throw new errors_js_1.GibsTimeoutError(this.timeout);
|
|
255
|
+
}
|
|
256
|
+
throw err;
|
|
257
|
+
}
|
|
258
|
+
finally {
|
|
259
|
+
clearTimeout(timeoutId);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Build the correct error class for a given HTTP status code.
|
|
264
|
+
*/
|
|
265
|
+
_buildError(status, message, headers) {
|
|
266
|
+
switch (status) {
|
|
267
|
+
case 401:
|
|
268
|
+
return new errors_js_1.GibsAuthError(message, headers);
|
|
269
|
+
case 429:
|
|
270
|
+
return new errors_js_1.GibsRateLimitError(message, headers);
|
|
271
|
+
default:
|
|
272
|
+
return new errors_js_1.GibsAPIError(message, status, headers);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Calculate retry delay with exponential backoff and jitter.
|
|
277
|
+
*
|
|
278
|
+
* For rate limit errors, respects the Retry-After header.
|
|
279
|
+
*/
|
|
280
|
+
_retryDelay(attempt, lastError) {
|
|
281
|
+
// Respect Retry-After header for rate limit errors
|
|
282
|
+
if (lastError instanceof errors_js_1.GibsRateLimitError && lastError.retryAfter) {
|
|
283
|
+
return lastError.retryAfter * 1000;
|
|
284
|
+
}
|
|
285
|
+
// Exponential backoff: 500ms, 1000ms, 2000ms, ...
|
|
286
|
+
const exponentialDelay = INITIAL_RETRY_DELAY_MS * Math.pow(2, attempt - 1);
|
|
287
|
+
// Add jitter (0-25% of the delay)
|
|
288
|
+
const jitter = exponentialDelay * 0.25 * Math.random();
|
|
289
|
+
return Math.min(exponentialDelay + jitter, MAX_RETRY_DELAY_MS);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Extract response headers into a plain object.
|
|
293
|
+
*/
|
|
294
|
+
_extractHeaders(response) {
|
|
295
|
+
const headers = {};
|
|
296
|
+
response.headers.forEach((value, key) => {
|
|
297
|
+
headers[key.toLowerCase()] = value;
|
|
298
|
+
});
|
|
299
|
+
return headers;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Check if an error is a network-level error (no HTTP response received).
|
|
303
|
+
*/
|
|
304
|
+
_isNetworkError(err) {
|
|
305
|
+
if (!(err instanceof Error))
|
|
306
|
+
return false;
|
|
307
|
+
// Common network error indicators
|
|
308
|
+
const networkMessages = [
|
|
309
|
+
'fetch failed',
|
|
310
|
+
'network',
|
|
311
|
+
'ECONNREFUSED',
|
|
312
|
+
'ECONNRESET',
|
|
313
|
+
'ENOTFOUND',
|
|
314
|
+
'ETIMEDOUT',
|
|
315
|
+
'EAI_AGAIN',
|
|
316
|
+
];
|
|
317
|
+
const msg = err.message.toLowerCase();
|
|
318
|
+
return networkMessages.some((indicator) => msg.includes(indicator.toLowerCase()));
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Sleep for a given number of milliseconds.
|
|
322
|
+
*/
|
|
323
|
+
_sleep(ms) {
|
|
324
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
exports.GibsClient = GibsClient;
|
|
328
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,2CAMqB;AAcrB,MAAM,OAAO,GAAG,OAAO,CAAC;AACxB,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAChD,MAAM,kBAAkB,GAAG,OAAO,CAAC;AACnC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,8DAA8D;AAC9D,MAAM,sBAAsB,GAAG,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;IACjE,CAAC;IAED;;OAEG;IACK,eAAe,CAAC,QAAkB;QACxC,MAAM,OAAO,GAA2B,EAAE,CAAC;QAC3C,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACtC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;QACrC,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACK,eAAe,CAAC,GAAY;QAClC,IAAI,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAC1C,kCAAkC;QAClC,MAAM,eAAe,GAAG;YACtB,cAAc;YACd,SAAS;YACT,cAAc;YACd,YAAY;YACZ,WAAW;YACX,WAAW;YACX,WAAW;SACZ,CAAC;QACF,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACtC,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IACpF,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,EAAU;QACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF;AA7UD,gCA6UC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error classes for the Gibs SDK.
|
|
3
|
+
*
|
|
4
|
+
* All errors extend `GibsError` so consumers can catch broadly
|
|
5
|
+
* or narrowly depending on their needs.
|
|
6
|
+
*
|
|
7
|
+
* @module errors
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Base error for all Gibs SDK errors.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* try {
|
|
15
|
+
* await client.classify({ description: '...' });
|
|
16
|
+
* } catch (err) {
|
|
17
|
+
* if (err instanceof GibsError) {
|
|
18
|
+
* console.error('Gibs API error:', err.message);
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class GibsError extends Error {
|
|
24
|
+
constructor(message: string);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Thrown when the API returns an HTTP error (4xx or 5xx).
|
|
28
|
+
*
|
|
29
|
+
* Contains the status code and parsed error body.
|
|
30
|
+
*/
|
|
31
|
+
export declare class GibsAPIError extends GibsError {
|
|
32
|
+
/** HTTP status code returned by the API. */
|
|
33
|
+
readonly status: number;
|
|
34
|
+
/** Raw response headers. */
|
|
35
|
+
readonly headers: Record<string, string>;
|
|
36
|
+
constructor(message: string, status: number, headers?: Record<string, string>);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Thrown on HTTP 401 responses (missing or invalid API key).
|
|
40
|
+
*/
|
|
41
|
+
export declare class GibsAuthError extends GibsAPIError {
|
|
42
|
+
constructor(message: string, headers?: Record<string, string>);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Thrown on HTTP 429 responses (rate limit exceeded).
|
|
46
|
+
*
|
|
47
|
+
* Check `retryAfter` for the server-suggested wait time.
|
|
48
|
+
*/
|
|
49
|
+
export declare class GibsRateLimitError extends GibsAPIError {
|
|
50
|
+
/** Seconds to wait before retrying, parsed from `Retry-After` header. */
|
|
51
|
+
readonly retryAfter: number | null;
|
|
52
|
+
constructor(message: string, headers?: Record<string, string>);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Thrown when a request times out.
|
|
56
|
+
*/
|
|
57
|
+
export declare class GibsTimeoutError extends GibsError {
|
|
58
|
+
constructor(timeoutMs: number);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Thrown when a request fails due to network connectivity issues.
|
|
62
|
+
*/
|
|
63
|
+
export declare class GibsConnectionError extends GibsError {
|
|
64
|
+
constructor(message: string);
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;GAaG;AACH,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAM5B;AAED;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,SAAS;IACzC,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,4BAA4B;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;CAMlF;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,YAAY;gBACjC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;CAIlE;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;gBAEvB,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;CAOlE;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;gBACjC,SAAS,EAAE,MAAM;CAI9B;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Error classes for the Gibs SDK.
|
|
4
|
+
*
|
|
5
|
+
* All errors extend `GibsError` so consumers can catch broadly
|
|
6
|
+
* or narrowly depending on their needs.
|
|
7
|
+
*
|
|
8
|
+
* @module errors
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.GibsConnectionError = exports.GibsTimeoutError = exports.GibsRateLimitError = exports.GibsAuthError = exports.GibsAPIError = exports.GibsError = void 0;
|
|
12
|
+
/**
|
|
13
|
+
* Base error for all Gibs SDK errors.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* try {
|
|
18
|
+
* await client.classify({ description: '...' });
|
|
19
|
+
* } catch (err) {
|
|
20
|
+
* if (err instanceof GibsError) {
|
|
21
|
+
* console.error('Gibs API error:', err.message);
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
class GibsError extends Error {
|
|
27
|
+
constructor(message) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.name = 'GibsError';
|
|
30
|
+
// Maintain proper prototype chain for instanceof checks
|
|
31
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.GibsError = GibsError;
|
|
35
|
+
/**
|
|
36
|
+
* Thrown when the API returns an HTTP error (4xx or 5xx).
|
|
37
|
+
*
|
|
38
|
+
* Contains the status code and parsed error body.
|
|
39
|
+
*/
|
|
40
|
+
class GibsAPIError extends GibsError {
|
|
41
|
+
/** HTTP status code returned by the API. */
|
|
42
|
+
status;
|
|
43
|
+
/** Raw response headers. */
|
|
44
|
+
headers;
|
|
45
|
+
constructor(message, status, headers = {}) {
|
|
46
|
+
super(message);
|
|
47
|
+
this.name = 'GibsAPIError';
|
|
48
|
+
this.status = status;
|
|
49
|
+
this.headers = headers;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.GibsAPIError = GibsAPIError;
|
|
53
|
+
/**
|
|
54
|
+
* Thrown on HTTP 401 responses (missing or invalid API key).
|
|
55
|
+
*/
|
|
56
|
+
class GibsAuthError extends GibsAPIError {
|
|
57
|
+
constructor(message, headers = {}) {
|
|
58
|
+
super(message, 401, headers);
|
|
59
|
+
this.name = 'GibsAuthError';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.GibsAuthError = GibsAuthError;
|
|
63
|
+
/**
|
|
64
|
+
* Thrown on HTTP 429 responses (rate limit exceeded).
|
|
65
|
+
*
|
|
66
|
+
* Check `retryAfter` for the server-suggested wait time.
|
|
67
|
+
*/
|
|
68
|
+
class GibsRateLimitError extends GibsAPIError {
|
|
69
|
+
/** Seconds to wait before retrying, parsed from `Retry-After` header. */
|
|
70
|
+
retryAfter;
|
|
71
|
+
constructor(message, headers = {}) {
|
|
72
|
+
super(message, 429, headers);
|
|
73
|
+
this.name = 'GibsRateLimitError';
|
|
74
|
+
const retryHeader = headers['retry-after'];
|
|
75
|
+
this.retryAfter = retryHeader ? parseInt(retryHeader, 10) || null : null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.GibsRateLimitError = GibsRateLimitError;
|
|
79
|
+
/**
|
|
80
|
+
* Thrown when a request times out.
|
|
81
|
+
*/
|
|
82
|
+
class GibsTimeoutError extends GibsError {
|
|
83
|
+
constructor(timeoutMs) {
|
|
84
|
+
super(`Request timed out after ${timeoutMs}ms`);
|
|
85
|
+
this.name = 'GibsTimeoutError';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.GibsTimeoutError = GibsTimeoutError;
|
|
89
|
+
/**
|
|
90
|
+
* Thrown when a request fails due to network connectivity issues.
|
|
91
|
+
*/
|
|
92
|
+
class GibsConnectionError extends GibsError {
|
|
93
|
+
constructor(message) {
|
|
94
|
+
super(message);
|
|
95
|
+
this.name = 'GibsConnectionError';
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.GibsConnectionError = GibsConnectionError;
|
|
99
|
+
//# s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GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;QAC3C,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3E,CAAC;CACF;AAXD,gDAWC;AAED;;GAEG;AACH,MAAa,gBAAiB,SAAQ,SAAS;IAC7C,YAAY,SAAiB;QAC3B,KAAK,CAAC,2BAA2B,SAAS,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AALD,4CAKC;AAED;;GAEG;AACH,MAAa,mBAAoB,SAAQ,SAAS;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AALD,kDAKC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Official JavaScript/TypeScript SDK for the Gibs compliance API.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { GibsClient } from '@gibs/sdk';
|
|
7
|
+
*
|
|
8
|
+
* const client = new GibsClient({ apiKey: 'gbs_live_xxx' });
|
|
9
|
+
*
|
|
10
|
+
* const result = await client.classify({
|
|
11
|
+
* description: 'Facial recognition system for airport security',
|
|
12
|
+
* });
|
|
13
|
+
* console.log(result.risk_level);
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @packageDocumentation
|
|
17
|
+
*/
|
|
18
|
+
export { GibsClient } from './client.js';
|
|
19
|
+
export { GibsError, GibsAPIError, GibsAuthError, GibsRateLimitError, GibsTimeoutError, GibsConnectionError, } from './errors.js';
|
|
20
|
+
export type { GibsClientOptions, RiskLevel, ConfidenceLevel, Regulation, SourceCitation, Obligation, KeyInfo, ClassifyRequest, ClassifyResponse, CheckRequest, CheckResponse, HealthResponse, CreateKeyRequest, KeyCreatedResponse, KeyDeletedResponse, ErrorResponseBody, } from './types.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EACL,SAAS,EACT,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAGrB,YAAY,EAEV,iBAAiB,EAGjB,SAAS,EACT,eAAe,EACf,UAAU,EACV,cAAc,EACd,UAAU,EACV,OAAO,EAGP,eAAe,EACf,gBAAgB,EAGhB,YAAY,EACZ,aAAa,EAGb,cAAc,EAGd,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAGlB,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Official JavaScript/TypeScript SDK for the Gibs compliance API.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { GibsClient } from '@gibs/sdk';
|
|
8
|
+
*
|
|
9
|
+
* const client = new GibsClient({ apiKey: 'gbs_live_xxx' });
|
|
10
|
+
*
|
|
11
|
+
* const result = await client.classify({
|
|
12
|
+
* description: 'Facial recognition system for airport security',
|
|
13
|
+
* });
|
|
14
|
+
* console.log(result.risk_level);
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.GibsConnectionError = exports.GibsTimeoutError = exports.GibsRateLimitError = exports.GibsAuthError = exports.GibsAPIError = exports.GibsError = exports.GibsClient = void 0;
|
|
21
|
+
// Client
|
|
22
|
+
var client_js_1 = require("./client.js");
|
|
23
|
+
Object.defineProperty(exports, "GibsClient", { enumerable: true, get: function () { return client_js_1.GibsClient; } });
|
|
24
|
+
// Error classes
|
|
25
|
+
var errors_js_1 = require("./errors.js");
|
|
26
|
+
Object.defineProperty(exports, "GibsError", { enumerable: true, get: function () { return errors_js_1.GibsError; } });
|
|
27
|
+
Object.defineProperty(exports, "GibsAPIError", { enumerable: true, get: function () { return errors_js_1.GibsAPIError; } });
|
|
28
|
+
Object.defineProperty(exports, "GibsAuthError", { enumerable: true, get: function () { return errors_js_1.GibsAuthError; } });
|
|
29
|
+
Object.defineProperty(exports, "GibsRateLimitError", { enumerable: true, get: function () { return errors_js_1.GibsRateLimitError; } });
|
|
30
|
+
Object.defineProperty(exports, "GibsTimeoutError", { enumerable: true, get: function () { return errors_js_1.GibsTimeoutError; } });
|
|
31
|
+
Object.defineProperty(exports, "GibsConnectionError", { enumerable: true, get: function () { return errors_js_1.GibsConnectionError; } });
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,SAAS;AACT,yCAAyC;AAAhC,uGAAA,UAAU,OAAA;AAEnB,gBAAgB;AAChB,yCAOqB;AANnB,sGAAA,SAAS,OAAA;AACT,yGAAA,YAAY,OAAA;AACZ,0GAAA,aAAa,OAAA;AACb,+GAAA,kBAAkB,OAAA;AAClB,6GAAA,gBAAgB,OAAA;AAChB,gHAAA,mBAAmB,OAAA"}
|