@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,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,90 @@
|
|
|
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 class GibsError extends Error {
|
|
24
|
+
constructor(message) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = 'GibsError';
|
|
27
|
+
// Maintain proper prototype chain for instanceof checks
|
|
28
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Thrown when the API returns an HTTP error (4xx or 5xx).
|
|
33
|
+
*
|
|
34
|
+
* Contains the status code and parsed error body.
|
|
35
|
+
*/
|
|
36
|
+
export class GibsAPIError extends GibsError {
|
|
37
|
+
/** HTTP status code returned by the API. */
|
|
38
|
+
status;
|
|
39
|
+
/** Raw response headers. */
|
|
40
|
+
headers;
|
|
41
|
+
constructor(message, status, headers = {}) {
|
|
42
|
+
super(message);
|
|
43
|
+
this.name = 'GibsAPIError';
|
|
44
|
+
this.status = status;
|
|
45
|
+
this.headers = headers;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Thrown on HTTP 401 responses (missing or invalid API key).
|
|
50
|
+
*/
|
|
51
|
+
export class GibsAuthError extends GibsAPIError {
|
|
52
|
+
constructor(message, headers = {}) {
|
|
53
|
+
super(message, 401, headers);
|
|
54
|
+
this.name = 'GibsAuthError';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Thrown on HTTP 429 responses (rate limit exceeded).
|
|
59
|
+
*
|
|
60
|
+
* Check `retryAfter` for the server-suggested wait time.
|
|
61
|
+
*/
|
|
62
|
+
export class GibsRateLimitError extends GibsAPIError {
|
|
63
|
+
/** Seconds to wait before retrying, parsed from `Retry-After` header. */
|
|
64
|
+
retryAfter;
|
|
65
|
+
constructor(message, headers = {}) {
|
|
66
|
+
super(message, 429, headers);
|
|
67
|
+
this.name = 'GibsRateLimitError';
|
|
68
|
+
const retryHeader = headers['retry-after'];
|
|
69
|
+
this.retryAfter = retryHeader ? parseInt(retryHeader, 10) || null : null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Thrown when a request times out.
|
|
74
|
+
*/
|
|
75
|
+
export class GibsTimeoutError extends GibsError {
|
|
76
|
+
constructor(timeoutMs) {
|
|
77
|
+
super(`Request timed out after ${timeoutMs}ms`);
|
|
78
|
+
this.name = 'GibsTimeoutError';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Thrown when a request fails due to network connectivity issues.
|
|
83
|
+
*/
|
|
84
|
+
export class GibsConnectionError extends GibsError {
|
|
85
|
+
constructor(message) {
|
|
86
|
+
super(message);
|
|
87
|
+
this.name = 'GibsConnectionError';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAClC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,wDAAwD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I,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -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,22 @@
|
|
|
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
|
+
// Client
|
|
19
|
+
export { GibsClient } from './client.js';
|
|
20
|
+
// Error classes
|
|
21
|
+
export { GibsError, GibsAPIError, GibsAuthError, GibsRateLimitError, GibsTimeoutError, GibsConnectionError, } from './errors.js';
|
|
22
|
+
//# 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,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,gBAAgB;AAChB,OAAO,EACL,SAAS,EACT,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript type definitions for the Gibs compliance API.
|
|
3
|
+
*
|
|
4
|
+
* All types mirror the backend Pydantic schemas exactly.
|
|
5
|
+
*
|
|
6
|
+
* @module types
|
|
7
|
+
*/
|
|
8
|
+
/** Risk classification levels under the EU AI Act. */
|
|
9
|
+
export type RiskLevel = 'prohibited' | 'high' | 'limited' | 'minimal';
|
|
10
|
+
/** Confidence levels for compliance answers. */
|
|
11
|
+
export type ConfidenceLevel = 'high' | 'medium' | 'low';
|
|
12
|
+
/** Supported regulation identifiers. */
|
|
13
|
+
export type Regulation = 'ai_act' | 'gdpr' | 'both';
|
|
14
|
+
/** A source citation linking a claim to a specific legal article. */
|
|
15
|
+
export interface SourceCitation {
|
|
16
|
+
/** Article identifier, e.g., "ai_act_art6". */
|
|
17
|
+
article_id: string;
|
|
18
|
+
/** Article title. */
|
|
19
|
+
title: string;
|
|
20
|
+
/** Relevant excerpt from the article text. */
|
|
21
|
+
text_excerpt: string;
|
|
22
|
+
/** Relevance score between 0.0 and 1.0. */
|
|
23
|
+
relevance_score: number;
|
|
24
|
+
}
|
|
25
|
+
/** A compliance obligation the user must fulfill. */
|
|
26
|
+
export interface Obligation {
|
|
27
|
+
/** Obligation identifier. */
|
|
28
|
+
id: string;
|
|
29
|
+
/** Human-readable description of what must be done. */
|
|
30
|
+
description: string;
|
|
31
|
+
/** Article that defines this obligation, e.g., "Article 9". */
|
|
32
|
+
source_article: string;
|
|
33
|
+
/** Compliance deadline in ISO 8601 format, or null if none. */
|
|
34
|
+
deadline: string | null;
|
|
35
|
+
}
|
|
36
|
+
/** API key metadata (never includes the full key value). */
|
|
37
|
+
export interface KeyInfo {
|
|
38
|
+
/** Key database ID. */
|
|
39
|
+
id: number;
|
|
40
|
+
/** Human-readable key name. */
|
|
41
|
+
name: string;
|
|
42
|
+
/** First 13 characters of the key for identification. */
|
|
43
|
+
key_prefix: string;
|
|
44
|
+
/** Whether this is a test key. */
|
|
45
|
+
is_test: boolean;
|
|
46
|
+
/** ISO 8601 creation timestamp. */
|
|
47
|
+
created_at: string;
|
|
48
|
+
/** ISO 8601 last-used timestamp, or null if never used. */
|
|
49
|
+
last_used_at: string | null;
|
|
50
|
+
/** Total number of requests made with this key. */
|
|
51
|
+
request_count: number;
|
|
52
|
+
}
|
|
53
|
+
/** Request body for `POST /v1/classify`. */
|
|
54
|
+
export interface ClassifyRequest {
|
|
55
|
+
/** Description of the AI system to classify. 10-5000 characters. */
|
|
56
|
+
description: string;
|
|
57
|
+
/** Types of data processed, e.g., ["biometric", "health"]. */
|
|
58
|
+
data_types?: string[];
|
|
59
|
+
/** What decisions the AI system makes or influences. */
|
|
60
|
+
decision_scope?: string;
|
|
61
|
+
/** Industry sector, e.g., "healthcare", "finance", "employment". */
|
|
62
|
+
sector?: string;
|
|
63
|
+
/** Target jurisdiction. Currently only "EU" is supported. */
|
|
64
|
+
jurisdiction?: string;
|
|
65
|
+
}
|
|
66
|
+
/** Response body for `POST /v1/classify`. */
|
|
67
|
+
export interface ClassifyResponse {
|
|
68
|
+
/** AI Act risk classification. */
|
|
69
|
+
risk_level: RiskLevel;
|
|
70
|
+
/** Confidence in the classification (0.0 to 1.0). */
|
|
71
|
+
confidence: number;
|
|
72
|
+
/** Explanation of why this risk level applies. */
|
|
73
|
+
reasoning: string;
|
|
74
|
+
/** Required compliance obligations for this risk level. */
|
|
75
|
+
obligations: Obligation[];
|
|
76
|
+
/** Source citations supporting this classification. */
|
|
77
|
+
sources: SourceCitation[];
|
|
78
|
+
/** Unique request identifier for audit trail. */
|
|
79
|
+
request_id: string;
|
|
80
|
+
/** Version of the legal corpus used. */
|
|
81
|
+
corpus_version: string;
|
|
82
|
+
/** Processing time in milliseconds. */
|
|
83
|
+
processing_time_ms: number;
|
|
84
|
+
}
|
|
85
|
+
/** Request body for `POST /v1/check`. */
|
|
86
|
+
export interface CheckRequest {
|
|
87
|
+
/** Compliance question to answer. 10-2000 characters. */
|
|
88
|
+
question: string;
|
|
89
|
+
/** Optional context about the AI system (key-value pairs). */
|
|
90
|
+
system_context?: Record<string, string>;
|
|
91
|
+
/** Which regulation to check: "ai_act", "gdpr", or "both". Defaults to "both". */
|
|
92
|
+
regulation?: Regulation;
|
|
93
|
+
}
|
|
94
|
+
/** Response body for `POST /v1/check`. */
|
|
95
|
+
export interface CheckResponse {
|
|
96
|
+
/** Answer to the compliance question. */
|
|
97
|
+
answer: string;
|
|
98
|
+
/** Confidence level: "high", "medium", or "low". */
|
|
99
|
+
confidence: ConfidenceLevel;
|
|
100
|
+
/** Source citations supporting this answer. */
|
|
101
|
+
sources: SourceCitation[];
|
|
102
|
+
/** True if the sources don't contain enough information to answer. */
|
|
103
|
+
should_abstain: boolean;
|
|
104
|
+
/** Explanation of why the system abstained, if applicable. */
|
|
105
|
+
abstention_reason?: string | null;
|
|
106
|
+
/** Unique request identifier for audit trail. */
|
|
107
|
+
request_id: string;
|
|
108
|
+
/** Version of the legal corpus used. */
|
|
109
|
+
corpus_version: string;
|
|
110
|
+
/** Processing time in milliseconds. */
|
|
111
|
+
processing_time_ms: number;
|
|
112
|
+
}
|
|
113
|
+
/** Response body for `GET /v1/health`. */
|
|
114
|
+
export interface HealthResponse {
|
|
115
|
+
/** Overall system status: "healthy", "degraded", or "unhealthy". */
|
|
116
|
+
status: string;
|
|
117
|
+
/** Environment name, e.g., "production" or "staging". */
|
|
118
|
+
environment: string;
|
|
119
|
+
/** Version of the legal corpus. */
|
|
120
|
+
corpus_version: string;
|
|
121
|
+
/** Status of individual components. */
|
|
122
|
+
components: Record<string, string>;
|
|
123
|
+
}
|
|
124
|
+
/** Request body for `POST /v1/account/keys`. */
|
|
125
|
+
export interface CreateKeyRequest {
|
|
126
|
+
/** Human-readable name for the key. Defaults to "Default". */
|
|
127
|
+
name?: string;
|
|
128
|
+
}
|
|
129
|
+
/** Response body for `POST /v1/account/keys`. Full key shown only once. */
|
|
130
|
+
export interface KeyCreatedResponse {
|
|
131
|
+
/** Key database ID. */
|
|
132
|
+
id: number;
|
|
133
|
+
/** Full API key value. Store securely -- it cannot be retrieved again. */
|
|
134
|
+
api_key: string;
|
|
135
|
+
/** First 13 characters of the key for identification. */
|
|
136
|
+
key_prefix: string;
|
|
137
|
+
/** Human-readable key name. */
|
|
138
|
+
name: string;
|
|
139
|
+
/** ISO 8601 creation timestamp. */
|
|
140
|
+
created_at: string;
|
|
141
|
+
}
|
|
142
|
+
/** Response body for `DELETE /v1/account/keys/{key_id}`. */
|
|
143
|
+
export interface KeyDeletedResponse {
|
|
144
|
+
/** Status indicator. Always "revoked" on success. */
|
|
145
|
+
status: 'revoked';
|
|
146
|
+
}
|
|
147
|
+
/** Standard error response from the API. */
|
|
148
|
+
export interface ErrorResponseBody {
|
|
149
|
+
/** Error message or detail string. */
|
|
150
|
+
detail: string;
|
|
151
|
+
}
|
|
152
|
+
/** Configuration options for the GibsClient. */
|
|
153
|
+
export interface GibsClientOptions {
|
|
154
|
+
/** API key for authentication (e.g., "gbs_live_xxx"). Required. */
|
|
155
|
+
apiKey: string;
|
|
156
|
+
/** Base URL for the API. Defaults to "https://api.gibs.dev". */
|
|
157
|
+
baseUrl?: string;
|
|
158
|
+
/** Request timeout in milliseconds. Defaults to 120000 (120 seconds). */
|
|
159
|
+
timeout?: number;
|
|
160
|
+
/** Maximum number of retries on transient errors. Defaults to 3. */
|
|
161
|
+
maxRetries?: number;
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,sDAAsD;AACtD,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtE,gDAAgD;AAChD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAExD,wCAAwC;AACxC,MAAM,MAAM,UAA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EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAMD,gDAAgD;AAChD,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,2EAA2E;AAC3E,MAAM,WAAW,kBAAkB;IACjC,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,4DAA4D;AAC5D,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,MAAM,EAAE,SAAS,CAAC;CACnB;AAMD,4CAA4C;AAC5C,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD,gDAAgD;AAChD,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gibs-dev/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Official JavaScript/TypeScript SDK for the Gibs multi-regulation compliance API",
|
|
5
|
+
"author": "Gibbr AB",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://gibs.dev",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/gibbr-ab/gibs-sdk-js"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"compliance",
|
|
14
|
+
"ai-act",
|
|
15
|
+
"gdpr",
|
|
16
|
+
"eu-regulation",
|
|
17
|
+
"legal",
|
|
18
|
+
"risk-classification",
|
|
19
|
+
"api"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "./dist/cjs/index.js",
|
|
23
|
+
"module": "./dist/esm/index.js",
|
|
24
|
+
"types": "./dist/esm/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./dist/esm/index.d.ts",
|
|
29
|
+
"default": "./dist/esm/index.js"
|
|
30
|
+
},
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./dist/cjs/index.d.ts",
|
|
33
|
+
"default": "./dist/cjs/index.js"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"README.md",
|
|
40
|
+
"LICENSE"
|
|
41
|
+
],
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=18.0.0"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node scripts/fix-cjs.js",
|
|
47
|
+
"test": "node --import tsx --test tests/*.test.ts",
|
|
48
|
+
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
49
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"tsx": "^4.7.0",
|
|
53
|
+
"typescript": "^5.4.0"
|
|
54
|
+
}
|
|
55
|
+
}
|