g-ten-security-sdk 1.0.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/auth/authenticate.d.ts +30 -0
- package/dist/auth/authenticate.js +52 -0
- package/dist/auth/interceptor.d.ts +13 -0
- package/dist/auth/interceptor.js +74 -0
- package/dist/auth/tokenStore.d.ts +17 -0
- package/dist/auth/tokenStore.js +36 -0
- package/dist/client.d.ts +109 -0
- package/dist/client.js +157 -0
- package/dist/generated/src/apis/AuthApi.d.ts +139 -0
- package/dist/generated/src/apis/AuthApi.js +429 -0
- package/dist/generated/src/apis/BranchesApi.d.ts +77 -0
- package/dist/generated/src/apis/BranchesApi.js +228 -0
- package/dist/generated/src/apis/ChatApi.d.ts +34 -0
- package/dist/generated/src/apis/ChatApi.js +92 -0
- package/dist/generated/src/apis/DataApi.d.ts +112 -0
- package/dist/generated/src/apis/DataApi.js +297 -0
- package/dist/generated/src/apis/DefaultApi.d.ts +109 -0
- package/dist/generated/src/apis/DefaultApi.js +306 -0
- package/dist/generated/src/apis/DemoApi.d.ts +46 -0
- package/dist/generated/src/apis/DemoApi.js +129 -0
- package/dist/generated/src/apis/FraudApi.d.ts +311 -0
- package/dist/generated/src/apis/FraudApi.js +809 -0
- package/dist/generated/src/apis/HealthApi.d.ts +31 -0
- package/dist/generated/src/apis/HealthApi.js +92 -0
- package/dist/generated/src/apis/SchemaApi.d.ts +31 -0
- package/dist/generated/src/apis/SchemaApi.js +92 -0
- package/dist/generated/src/apis/WorkflowApi.d.ts +94 -0
- package/dist/generated/src/apis/WorkflowApi.js +269 -0
- package/dist/generated/src/apis/index.d.ts +10 -0
- package/dist/generated/src/apis/index.js +28 -0
- package/dist/generated/src/index.d.ts +3 -0
- package/dist/generated/src/index.js +21 -0
- package/dist/generated/src/models/Account.d.ts +122 -0
- package/dist/generated/src/models/Account.js +92 -0
- package/dist/generated/src/models/AlertStatusUpdate.d.ts +32 -0
- package/dist/generated/src/models/AlertStatusUpdate.js +50 -0
- package/dist/generated/src/models/AssignRequest.d.ts +32 -0
- package/dist/generated/src/models/AssignRequest.js +48 -0
- package/dist/generated/src/models/BranchCreate.d.ts +44 -0
- package/dist/generated/src/models/BranchCreate.js +56 -0
- package/dist/generated/src/models/BranchUpdate.d.ts +38 -0
- package/dist/generated/src/models/BranchUpdate.js +50 -0
- package/dist/generated/src/models/ChatRequest.d.ts +39 -0
- package/dist/generated/src/models/ChatRequest.js +53 -0
- package/dist/generated/src/models/ChatResponse.d.ts +32 -0
- package/dist/generated/src/models/ChatResponse.js +50 -0
- package/dist/generated/src/models/HTTPValidationError.d.ts +33 -0
- package/dist/generated/src/models/HTTPValidationError.js +49 -0
- package/dist/generated/src/models/HistoryTurn.d.ts +38 -0
- package/dist/generated/src/models/HistoryTurn.js +54 -0
- package/dist/generated/src/models/InjectPatternRequest.d.ts +32 -0
- package/dist/generated/src/models/InjectPatternRequest.js +50 -0
- package/dist/generated/src/models/LocationInner.d.ts +26 -0
- package/dist/generated/src/models/LocationInner.js +38 -0
- package/dist/generated/src/models/NarrativeRequest.d.ts +44 -0
- package/dist/generated/src/models/NarrativeRequest.js +52 -0
- package/dist/generated/src/models/NoteCreate.d.ts +38 -0
- package/dist/generated/src/models/NoteCreate.js +52 -0
- package/dist/generated/src/models/PasswordUpdate.d.ts +32 -0
- package/dist/generated/src/models/PasswordUpdate.js +50 -0
- package/dist/generated/src/models/StreamConfigRequest.d.ts +32 -0
- package/dist/generated/src/models/StreamConfigRequest.js +50 -0
- package/dist/generated/src/models/Token.d.ts +46 -0
- package/dist/generated/src/models/Token.js +58 -0
- package/dist/generated/src/models/Transaction.d.ts +74 -0
- package/dist/generated/src/models/Transaction.js +78 -0
- package/dist/generated/src/models/UserCreate.d.ts +56 -0
- package/dist/generated/src/models/UserCreate.js +62 -0
- package/dist/generated/src/models/UserOut.d.ts +62 -0
- package/dist/generated/src/models/UserOut.js +66 -0
- package/dist/generated/src/models/ValidationError.d.ts +57 -0
- package/dist/generated/src/models/ValidationError.js +63 -0
- package/dist/generated/src/models/index.d.ts +20 -0
- package/dist/generated/src/models/index.js +38 -0
- package/dist/generated/src/runtime.d.ts +184 -0
- package/dist/generated/src/runtime.js +353 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +40 -0
- package/dist/types/index.d.ts +85 -0
- package/dist/types/index.js +5 -0
- package/dist/utils/errors.d.ts +33 -0
- package/dist/utils/errors.js +52 -0
- package/dist/utils/validators.d.ts +10 -0
- package/dist/utils/validators.js +26 -0
- package/dist/wrappers/alerts.d.ts +29 -0
- package/dist/wrappers/alerts.js +52 -0
- package/dist/wrappers/analytics.d.ts +8 -0
- package/dist/wrappers/analytics.js +15 -0
- package/dist/wrappers/copilot.d.ts +8 -0
- package/dist/wrappers/copilot.js +20 -0
- package/dist/wrappers/data.d.ts +55 -0
- package/dist/wrappers/data.js +127 -0
- package/dist/wrappers/fraud.d.ts +46 -0
- package/dist/wrappers/fraud.js +84 -0
- package/dist/wrappers/investigation.d.ts +31 -0
- package/dist/wrappers/investigation.js +77 -0
- package/package.json +18 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
3
|
+
// G-TEN SDK — Public API
|
|
4
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.GTenNetworkError = exports.GTenValidationError = exports.GTenApiError = exports.GTenAuthError = exports.signOut = exports.authenticate = exports.GTenSDK = void 0;
|
|
21
|
+
// The recommended entry point — class-based SDK client
|
|
22
|
+
var client_1 = require("./client");
|
|
23
|
+
Object.defineProperty(exports, "GTenSDK", { enumerable: true, get: function () { return client_1.GTenSDK; } });
|
|
24
|
+
// Standalone functional APIs (for backward compatibility)
|
|
25
|
+
var authenticate_1 = require("./auth/authenticate");
|
|
26
|
+
Object.defineProperty(exports, "authenticate", { enumerable: true, get: function () { return authenticate_1.authenticate; } });
|
|
27
|
+
Object.defineProperty(exports, "signOut", { enumerable: true, get: function () { return authenticate_1.signOut; } });
|
|
28
|
+
// Wrapper functions (can be used standalone after calling authenticate())
|
|
29
|
+
__exportStar(require("./wrappers/alerts"), exports);
|
|
30
|
+
__exportStar(require("./wrappers/fraud"), exports);
|
|
31
|
+
__exportStar(require("./wrappers/analytics"), exports);
|
|
32
|
+
__exportStar(require("./wrappers/copilot"), exports);
|
|
33
|
+
// Error classes
|
|
34
|
+
var errors_1 = require("./utils/errors");
|
|
35
|
+
Object.defineProperty(exports, "GTenAuthError", { enumerable: true, get: function () { return errors_1.GTenAuthError; } });
|
|
36
|
+
Object.defineProperty(exports, "GTenApiError", { enumerable: true, get: function () { return errors_1.GTenApiError; } });
|
|
37
|
+
Object.defineProperty(exports, "GTenValidationError", { enumerable: true, get: function () { return errors_1.GTenValidationError; } });
|
|
38
|
+
Object.defineProperty(exports, "GTenNetworkError", { enumerable: true, get: function () { return errors_1.GTenNetworkError; } });
|
|
39
|
+
// Type definitions
|
|
40
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/** Configuration options for initializing the GTenSDK. */
|
|
2
|
+
export interface GTenSDKConfig {
|
|
3
|
+
/** The API key issued to the external client. */
|
|
4
|
+
apiKey: string;
|
|
5
|
+
/** The unique client identifier. */
|
|
6
|
+
clientId: string;
|
|
7
|
+
/** Optional base URL of the G-TEN API (defaults to http://localhost:8000). */
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
/** @deprecated Use GTenSDKConfig instead. */
|
|
11
|
+
export interface AuthCredentials {
|
|
12
|
+
apiKey: string;
|
|
13
|
+
clientId: string;
|
|
14
|
+
baseUrl?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Result returned after a successful authentication. */
|
|
17
|
+
export interface AuthResult {
|
|
18
|
+
username: string;
|
|
19
|
+
role: string;
|
|
20
|
+
authenticated: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** Narrative / commentary generation request parameters. */
|
|
23
|
+
export interface NarrativeRequest {
|
|
24
|
+
focused_pattern?: string;
|
|
25
|
+
all_patterns?: string[];
|
|
26
|
+
shap_features?: string[];
|
|
27
|
+
}
|
|
28
|
+
/** Response shape from the stats endpoint. */
|
|
29
|
+
export interface StatsResponse {
|
|
30
|
+
total_accounts: number;
|
|
31
|
+
total_transactions: number;
|
|
32
|
+
total_flagged: number;
|
|
33
|
+
critical_count: number;
|
|
34
|
+
dormant_count: number;
|
|
35
|
+
fraud_volume_30d: number;
|
|
36
|
+
accounts_scanned: number;
|
|
37
|
+
}
|
|
38
|
+
/** An individual alert in the system. */
|
|
39
|
+
export interface Alert {
|
|
40
|
+
alert_id: string;
|
|
41
|
+
account_id: string;
|
|
42
|
+
customer_name: string;
|
|
43
|
+
masked_account_number: string;
|
|
44
|
+
branch_name: string;
|
|
45
|
+
branch_code: string;
|
|
46
|
+
risk_level: string;
|
|
47
|
+
flagged_for: string[];
|
|
48
|
+
score: number;
|
|
49
|
+
total_amount: number | null;
|
|
50
|
+
status: string;
|
|
51
|
+
assigned_to: string | null;
|
|
52
|
+
assignee_id: string | null;
|
|
53
|
+
created_at: string;
|
|
54
|
+
detections: Record<string, {
|
|
55
|
+
detected: boolean;
|
|
56
|
+
confidence: number;
|
|
57
|
+
}>;
|
|
58
|
+
}
|
|
59
|
+
/** Paginated alerts response. */
|
|
60
|
+
export interface AlertsResponse {
|
|
61
|
+
total: number;
|
|
62
|
+
alerts: Alert[];
|
|
63
|
+
}
|
|
64
|
+
/** Risk score analysis result for a single account. */
|
|
65
|
+
export interface RiskScoreResult {
|
|
66
|
+
account_id: string;
|
|
67
|
+
is_flagged: boolean;
|
|
68
|
+
risk_level: string;
|
|
69
|
+
combined_score: number;
|
|
70
|
+
flagged_for: string[];
|
|
71
|
+
detections: Record<string, {
|
|
72
|
+
detected: boolean;
|
|
73
|
+
confidence?: number;
|
|
74
|
+
error?: string;
|
|
75
|
+
}>;
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
}
|
|
78
|
+
/** Fund-tracing result. */
|
|
79
|
+
export interface TraceResult {
|
|
80
|
+
detected: boolean;
|
|
81
|
+
fraud_type: string;
|
|
82
|
+
chain: any[];
|
|
83
|
+
amounts: number[];
|
|
84
|
+
[key: string]: any;
|
|
85
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
3
|
+
// G-TEN SDK — Type Definitions
|
|
4
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* G-TEN SDK — Error Classes
|
|
3
|
+
*
|
|
4
|
+
* Provides clean, typed error classes for SDK consumers.
|
|
5
|
+
* These are exported from the public SDK interface.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Thrown when a protected SDK function is called before `authenticate()`.
|
|
9
|
+
*/
|
|
10
|
+
export declare class GTenAuthError extends Error {
|
|
11
|
+
constructor(message?: string);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Thrown when the G-TEN API returns a non-2xx response.
|
|
15
|
+
*/
|
|
16
|
+
export declare class GTenApiError extends Error {
|
|
17
|
+
readonly statusCode: number;
|
|
18
|
+
readonly detail: string;
|
|
19
|
+
constructor(statusCode: number, detail: string);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Thrown when SDK input validation fails.
|
|
23
|
+
*/
|
|
24
|
+
export declare class GTenValidationError extends Error {
|
|
25
|
+
constructor(field: string, message: string);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Thrown when a network-level error occurs (DNS failure, timeout, connection refused, etc.).
|
|
29
|
+
*/
|
|
30
|
+
export declare class GTenNetworkError extends Error {
|
|
31
|
+
readonly cause: Error | undefined;
|
|
32
|
+
constructor(message?: string, cause?: Error);
|
|
33
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* G-TEN SDK — Error Classes
|
|
4
|
+
*
|
|
5
|
+
* Provides clean, typed error classes for SDK consumers.
|
|
6
|
+
* These are exported from the public SDK interface.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.GTenNetworkError = exports.GTenValidationError = exports.GTenApiError = exports.GTenAuthError = void 0;
|
|
10
|
+
/**
|
|
11
|
+
* Thrown when a protected SDK function is called before `authenticate()`.
|
|
12
|
+
*/
|
|
13
|
+
class GTenAuthError extends Error {
|
|
14
|
+
constructor(message = "SDK is not authenticated. Call authenticate() before using protected APIs.") {
|
|
15
|
+
super(message);
|
|
16
|
+
this.name = "GTenAuthError";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.GTenAuthError = GTenAuthError;
|
|
20
|
+
/**
|
|
21
|
+
* Thrown when the G-TEN API returns a non-2xx response.
|
|
22
|
+
*/
|
|
23
|
+
class GTenApiError extends Error {
|
|
24
|
+
constructor(statusCode, detail) {
|
|
25
|
+
super(`G-TEN API Error [${statusCode}]: ${detail}`);
|
|
26
|
+
this.name = "GTenApiError";
|
|
27
|
+
this.statusCode = statusCode;
|
|
28
|
+
this.detail = detail;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.GTenApiError = GTenApiError;
|
|
32
|
+
/**
|
|
33
|
+
* Thrown when SDK input validation fails.
|
|
34
|
+
*/
|
|
35
|
+
class GTenValidationError extends Error {
|
|
36
|
+
constructor(field, message) {
|
|
37
|
+
super(`Validation error on "${field}": ${message}`);
|
|
38
|
+
this.name = "GTenValidationError";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.GTenValidationError = GTenValidationError;
|
|
42
|
+
/**
|
|
43
|
+
* Thrown when a network-level error occurs (DNS failure, timeout, connection refused, etc.).
|
|
44
|
+
*/
|
|
45
|
+
class GTenNetworkError extends Error {
|
|
46
|
+
constructor(message = "A network error occurred while connecting to the G-TEN API.", cause) {
|
|
47
|
+
super(message);
|
|
48
|
+
this.name = "GTenNetworkError";
|
|
49
|
+
this.cause = cause;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.GTenNetworkError = GTenNetworkError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates that a string parameter is not null, undefined, or empty.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare function validateRequiredString(value: any, fieldName: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Validates that a number parameter is a positive integer.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare function validatePositiveInteger(value: any, fieldName: string): number;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateRequiredString = validateRequiredString;
|
|
4
|
+
exports.validatePositiveInteger = validatePositiveInteger;
|
|
5
|
+
const errors_1 = require("./errors");
|
|
6
|
+
/**
|
|
7
|
+
* Validates that a string parameter is not null, undefined, or empty.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
function validateRequiredString(value, fieldName) {
|
|
11
|
+
if (value === null || value === undefined || String(value).trim() === "") {
|
|
12
|
+
throw new errors_1.GTenValidationError(fieldName, "This field is required and cannot be empty.");
|
|
13
|
+
}
|
|
14
|
+
return String(value).trim();
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Validates that a number parameter is a positive integer.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
function validatePositiveInteger(value, fieldName) {
|
|
21
|
+
const num = Number(value);
|
|
22
|
+
if (isNaN(num) || !Number.isInteger(num) || num <= 0) {
|
|
23
|
+
throw new errors_1.GTenValidationError(fieldName, "Must be a positive integer.");
|
|
24
|
+
}
|
|
25
|
+
return num;
|
|
26
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AlertsResponse, Alert } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve a paginated list of active alerts from the system.
|
|
4
|
+
*
|
|
5
|
+
* @param limit Maximum number of alerts to return (default: 200)
|
|
6
|
+
* @returns Paginated alerts response containing total count and alert array
|
|
7
|
+
*/
|
|
8
|
+
export declare function getAlerts(limit?: number): Promise<AlertsResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Alias for `getAlerts` with a more descriptive name.
|
|
11
|
+
*
|
|
12
|
+
* @param limit Maximum number of alerts to return (default: 200)
|
|
13
|
+
* @returns Paginated alerts response
|
|
14
|
+
*/
|
|
15
|
+
export declare function listAlerts(limit?: number): Promise<AlertsResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Retrieve details for a specific alert by ID.
|
|
18
|
+
*
|
|
19
|
+
* @param alertId The alert identifier (e.g. "ALT-ACC001-LAYERING")
|
|
20
|
+
* @returns Alert details including evidence and audit data
|
|
21
|
+
*/
|
|
22
|
+
export declare function getAlert(alertId: string): Promise<Alert>;
|
|
23
|
+
/**
|
|
24
|
+
* Create a custom alert (placeholder for future SDK backend extension).
|
|
25
|
+
*
|
|
26
|
+
* @param payload Alert creation details
|
|
27
|
+
* @returns Created alert data
|
|
28
|
+
*/
|
|
29
|
+
export declare function createAlert(payload: any): Promise<any>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAlerts = getAlerts;
|
|
4
|
+
exports.listAlerts = listAlerts;
|
|
5
|
+
exports.getAlert = getAlert;
|
|
6
|
+
exports.createAlert = createAlert;
|
|
7
|
+
const interceptor_1 = require("../auth/interceptor");
|
|
8
|
+
const validators_1 = require("../utils/validators");
|
|
9
|
+
/**
|
|
10
|
+
* Retrieve a paginated list of active alerts from the system.
|
|
11
|
+
*
|
|
12
|
+
* @param limit Maximum number of alerts to return (default: 200)
|
|
13
|
+
* @returns Paginated alerts response containing total count and alert array
|
|
14
|
+
*/
|
|
15
|
+
async function getAlerts(limit = 200) {
|
|
16
|
+
return await (0, interceptor_1.sdkFetch)(`/sdk/v1/alerts?limit=${limit}`, {
|
|
17
|
+
method: "GET",
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Alias for `getAlerts` with a more descriptive name.
|
|
22
|
+
*
|
|
23
|
+
* @param limit Maximum number of alerts to return (default: 200)
|
|
24
|
+
* @returns Paginated alerts response
|
|
25
|
+
*/
|
|
26
|
+
async function listAlerts(limit = 200) {
|
|
27
|
+
return getAlerts(limit);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Retrieve details for a specific alert by ID.
|
|
31
|
+
*
|
|
32
|
+
* @param alertId The alert identifier (e.g. "ALT-ACC001-LAYERING")
|
|
33
|
+
* @returns Alert details including evidence and audit data
|
|
34
|
+
*/
|
|
35
|
+
async function getAlert(alertId) {
|
|
36
|
+
const validAlertId = (0, validators_1.validateRequiredString)(alertId, "alertId");
|
|
37
|
+
return await (0, interceptor_1.sdkFetch)(`/sdk/v1/alerts/${encodeURIComponent(validAlertId)}`, {
|
|
38
|
+
method: "GET",
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create a custom alert (placeholder for future SDK backend extension).
|
|
43
|
+
*
|
|
44
|
+
* @param payload Alert creation details
|
|
45
|
+
* @returns Created alert data
|
|
46
|
+
*/
|
|
47
|
+
async function createAlert(payload) {
|
|
48
|
+
return await (0, interceptor_1.sdkFetch)(`/sdk/v1/alerts`, {
|
|
49
|
+
method: "POST",
|
|
50
|
+
body: JSON.stringify(payload),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StatsResponse } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve platform-wide statistics and metrics.
|
|
4
|
+
* Includes account counts, transaction volumes, flagged entities, and fraud volumes.
|
|
5
|
+
*
|
|
6
|
+
* @returns Platform statistics
|
|
7
|
+
*/
|
|
8
|
+
export declare function getStats(): Promise<StatsResponse>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStats = getStats;
|
|
4
|
+
const interceptor_1 = require("../auth/interceptor");
|
|
5
|
+
/**
|
|
6
|
+
* Retrieve platform-wide statistics and metrics.
|
|
7
|
+
* Includes account counts, transaction volumes, flagged entities, and fraud volumes.
|
|
8
|
+
*
|
|
9
|
+
* @returns Platform statistics
|
|
10
|
+
*/
|
|
11
|
+
async function getStats() {
|
|
12
|
+
return await (0, interceptor_1.sdkFetch)(`/sdk/v1/stats`, {
|
|
13
|
+
method: "GET",
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Send a natural-language message to the G-TEN Copilot AI assistant.
|
|
3
|
+
* The Copilot uses Graph-RAG to answer questions about accounts, alerts, and fraud patterns.
|
|
4
|
+
*
|
|
5
|
+
* @param message The natural language query
|
|
6
|
+
* @returns The AI-generated response text
|
|
7
|
+
*/
|
|
8
|
+
export declare function chat(message: string): Promise<string>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.chat = chat;
|
|
4
|
+
const interceptor_1 = require("../auth/interceptor");
|
|
5
|
+
const validators_1 = require("../utils/validators");
|
|
6
|
+
/**
|
|
7
|
+
* Send a natural-language message to the G-TEN Copilot AI assistant.
|
|
8
|
+
* The Copilot uses Graph-RAG to answer questions about accounts, alerts, and fraud patterns.
|
|
9
|
+
*
|
|
10
|
+
* @param message The natural language query
|
|
11
|
+
* @returns The AI-generated response text
|
|
12
|
+
*/
|
|
13
|
+
async function chat(message) {
|
|
14
|
+
const validMessage = (0, validators_1.validateRequiredString)(message, "message");
|
|
15
|
+
const response = await (0, interceptor_1.sdkFetch)(`/sdk/v1/chat`, {
|
|
16
|
+
method: "POST",
|
|
17
|
+
body: JSON.stringify({ message: validMessage }),
|
|
18
|
+
});
|
|
19
|
+
return response.response;
|
|
20
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Account } from "../generated/src/models/Account";
|
|
2
|
+
import { Transaction } from "../generated/src/models/Transaction";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new account in the system.
|
|
5
|
+
*
|
|
6
|
+
* @param account The account details to create
|
|
7
|
+
*/
|
|
8
|
+
export declare function createAccount(account: Account): Promise<any>;
|
|
9
|
+
/**
|
|
10
|
+
* Retrieve account details by ID.
|
|
11
|
+
*
|
|
12
|
+
* @param accountId The account identifier
|
|
13
|
+
*/
|
|
14
|
+
export declare function getAccount(accountId: string): Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* Get a paginated list of all accounts.
|
|
17
|
+
*
|
|
18
|
+
* @param skip Number of items to skip for pagination (default: 0)
|
|
19
|
+
* @param limit Maximum number of items to return (default: 100)
|
|
20
|
+
* @param branchCode Optional branch code filter
|
|
21
|
+
*/
|
|
22
|
+
export declare function getAllAccounts(skip?: number, limit?: number, branchCode?: string): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new transaction in the system (this triggers live ML evaluation).
|
|
25
|
+
*
|
|
26
|
+
* @param transaction The transaction details to create
|
|
27
|
+
*/
|
|
28
|
+
export declare function createTransaction(transaction: Transaction): Promise<any>;
|
|
29
|
+
/**
|
|
30
|
+
* Retrieve a transaction by ID.
|
|
31
|
+
*
|
|
32
|
+
* @param txnId The transaction identifier
|
|
33
|
+
*/
|
|
34
|
+
export declare function getTransaction(txnId: string): Promise<any>;
|
|
35
|
+
/**
|
|
36
|
+
* Get a paginated list of all transactions.
|
|
37
|
+
*
|
|
38
|
+
* @param skip Number of items to skip for pagination (default: 0)
|
|
39
|
+
* @param limit Maximum number of items to return (default: 100)
|
|
40
|
+
*/
|
|
41
|
+
export declare function getAllTransactions(skip?: number, limit?: number): Promise<any>;
|
|
42
|
+
/**
|
|
43
|
+
* Add a note to an account's history.
|
|
44
|
+
*
|
|
45
|
+
* @param accountId The account identifier
|
|
46
|
+
* @param content The text content of the note
|
|
47
|
+
* @param author Optional author name (defaults to "FINnet Investigator")
|
|
48
|
+
*/
|
|
49
|
+
export declare function addAccountNote(accountId: string, content: string, author?: string): Promise<any>;
|
|
50
|
+
/**
|
|
51
|
+
* Get all notes associated with a specific account.
|
|
52
|
+
*
|
|
53
|
+
* @param accountId The account identifier
|
|
54
|
+
*/
|
|
55
|
+
export declare function getAccountNotes(accountId: string): Promise<any>;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAccount = createAccount;
|
|
4
|
+
exports.getAccount = getAccount;
|
|
5
|
+
exports.getAllAccounts = getAllAccounts;
|
|
6
|
+
exports.createTransaction = createTransaction;
|
|
7
|
+
exports.getTransaction = getTransaction;
|
|
8
|
+
exports.getAllTransactions = getAllTransactions;
|
|
9
|
+
exports.addAccountNote = addAccountNote;
|
|
10
|
+
exports.getAccountNotes = getAccountNotes;
|
|
11
|
+
const DataApi_1 = require("../generated/src/apis/DataApi");
|
|
12
|
+
const FraudApi_1 = require("../generated/src/apis/FraudApi");
|
|
13
|
+
const interceptor_1 = require("../auth/interceptor");
|
|
14
|
+
const validators_1 = require("../utils/validators");
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new account in the system.
|
|
17
|
+
*
|
|
18
|
+
* @param account The account details to create
|
|
19
|
+
*/
|
|
20
|
+
async function createAccount(account) {
|
|
21
|
+
const config = (0, interceptor_1.getAuthenticatedConfig)();
|
|
22
|
+
const api = new FraudApi_1.FraudApi(config);
|
|
23
|
+
return await api.createAccountApiV1AccountsPost({
|
|
24
|
+
account,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Retrieve account details by ID.
|
|
29
|
+
*
|
|
30
|
+
* @param accountId The account identifier
|
|
31
|
+
*/
|
|
32
|
+
async function getAccount(accountId) {
|
|
33
|
+
const validAccountId = (0, validators_1.validateRequiredString)(accountId, "accountId");
|
|
34
|
+
const config = (0, interceptor_1.getAuthenticatedConfig)();
|
|
35
|
+
const api = new DataApi_1.DataApi(config);
|
|
36
|
+
return await api.getAccountApiV1AccountsAccountIdGet({
|
|
37
|
+
accountId: validAccountId,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get a paginated list of all accounts.
|
|
42
|
+
*
|
|
43
|
+
* @param skip Number of items to skip for pagination (default: 0)
|
|
44
|
+
* @param limit Maximum number of items to return (default: 100)
|
|
45
|
+
* @param branchCode Optional branch code filter
|
|
46
|
+
*/
|
|
47
|
+
async function getAllAccounts(skip, limit, branchCode) {
|
|
48
|
+
const config = (0, interceptor_1.getAuthenticatedConfig)();
|
|
49
|
+
const api = new DataApi_1.DataApi(config);
|
|
50
|
+
return await api.getAllAccountsApiV1AccountsGet({
|
|
51
|
+
skip,
|
|
52
|
+
limit,
|
|
53
|
+
branchCode,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Creates a new transaction in the system (this triggers live ML evaluation).
|
|
58
|
+
*
|
|
59
|
+
* @param transaction The transaction details to create
|
|
60
|
+
*/
|
|
61
|
+
async function createTransaction(transaction) {
|
|
62
|
+
const config = (0, interceptor_1.getAuthenticatedConfig)();
|
|
63
|
+
const api = new FraudApi_1.FraudApi(config);
|
|
64
|
+
return await api.createTransactionApiV1TransactionsPost({
|
|
65
|
+
transaction,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Retrieve a transaction by ID.
|
|
70
|
+
*
|
|
71
|
+
* @param txnId The transaction identifier
|
|
72
|
+
*/
|
|
73
|
+
async function getTransaction(txnId) {
|
|
74
|
+
const validTxnId = (0, validators_1.validateRequiredString)(txnId, "txnId");
|
|
75
|
+
const config = (0, interceptor_1.getAuthenticatedConfig)();
|
|
76
|
+
const api = new DataApi_1.DataApi(config);
|
|
77
|
+
return await api.getTransactionApiV1TransactionsTxnIdGet({
|
|
78
|
+
txnId: validTxnId,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get a paginated list of all transactions.
|
|
83
|
+
*
|
|
84
|
+
* @param skip Number of items to skip for pagination (default: 0)
|
|
85
|
+
* @param limit Maximum number of items to return (default: 100)
|
|
86
|
+
*/
|
|
87
|
+
async function getAllTransactions(skip, limit) {
|
|
88
|
+
const config = (0, interceptor_1.getAuthenticatedConfig)();
|
|
89
|
+
const api = new DataApi_1.DataApi(config);
|
|
90
|
+
return await api.getAllTransactionsApiV1TransactionsGet({
|
|
91
|
+
skip,
|
|
92
|
+
limit,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Add a note to an account's history.
|
|
97
|
+
*
|
|
98
|
+
* @param accountId The account identifier
|
|
99
|
+
* @param content The text content of the note
|
|
100
|
+
* @param author Optional author name (defaults to "FINnet Investigator")
|
|
101
|
+
*/
|
|
102
|
+
async function addAccountNote(accountId, content, author) {
|
|
103
|
+
const validAccountId = (0, validators_1.validateRequiredString)(accountId, "accountId");
|
|
104
|
+
const validContent = (0, validators_1.validateRequiredString)(content, "content");
|
|
105
|
+
const config = (0, interceptor_1.getAuthenticatedConfig)();
|
|
106
|
+
const api = new DataApi_1.DataApi(config);
|
|
107
|
+
return await api.addAccountNoteApiV1AccountsAccountIdNotesPost({
|
|
108
|
+
accountId: validAccountId,
|
|
109
|
+
noteCreate: {
|
|
110
|
+
content: validContent,
|
|
111
|
+
author: author || "FINnet Investigator",
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get all notes associated with a specific account.
|
|
117
|
+
*
|
|
118
|
+
* @param accountId The account identifier
|
|
119
|
+
*/
|
|
120
|
+
async function getAccountNotes(accountId) {
|
|
121
|
+
const validAccountId = (0, validators_1.validateRequiredString)(accountId, "accountId");
|
|
122
|
+
const config = (0, interceptor_1.getAuthenticatedConfig)();
|
|
123
|
+
const api = new DataApi_1.DataApi(config);
|
|
124
|
+
return await api.getAccountNotesApiV1AccountsAccountIdNotesGet({
|
|
125
|
+
accountId: validAccountId,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { RiskScoreResult, TraceResult, NarrativeRequest } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Analyze a transaction/account for fraud risk.
|
|
4
|
+
* Runs the full ML scoring pipeline and returns a comprehensive risk assessment.
|
|
5
|
+
*
|
|
6
|
+
* @param accountId The account identifier to analyze
|
|
7
|
+
* @returns Full risk score result including detections, combined score, and risk level
|
|
8
|
+
*/
|
|
9
|
+
export declare function analyzeTransaction(accountId: string): Promise<RiskScoreResult>;
|
|
10
|
+
/**
|
|
11
|
+
* Get the risk score for a specific account.
|
|
12
|
+
* Alias for `analyzeTransaction` — provided for semantic clarity.
|
|
13
|
+
*
|
|
14
|
+
* @param accountId The account identifier
|
|
15
|
+
* @returns Risk score result
|
|
16
|
+
*/
|
|
17
|
+
export declare function getRiskScore(accountId: string): Promise<RiskScoreResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Run fraud detection on a specific account.
|
|
20
|
+
* Executes ML-based pattern detection (layering, smurfing, dormancy, KYC mismatch).
|
|
21
|
+
*
|
|
22
|
+
* @param accountId The account identifier
|
|
23
|
+
* @returns Detection results with flagged patterns and confidence scores
|
|
24
|
+
*/
|
|
25
|
+
export declare function detectFraud(accountId: string): Promise<RiskScoreResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Generate an AI-powered narrative commentary / investigation briefing for an account.
|
|
28
|
+
*
|
|
29
|
+
* @param accountId The account identifier
|
|
30
|
+
* @param request Optional narrative generation parameters (focused pattern, SHAP features, etc.)
|
|
31
|
+
* @returns Generated narrative text and supporting evidence
|
|
32
|
+
*/
|
|
33
|
+
export declare function generateCommentary(accountId: string, request?: NarrativeRequest): Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
* Trace the flow of funds from/to a specific account.
|
|
36
|
+
* Reveals layering chains, round-trip transfers, and connected entities.
|
|
37
|
+
*
|
|
38
|
+
* @param accountId The account identifier
|
|
39
|
+
* @param hint Optional hint to focus tracing (e.g. "layering", "round_trip")
|
|
40
|
+
* @returns Trace result including detected chains and amounts
|
|
41
|
+
*/
|
|
42
|
+
export declare function trackFunds(accountId: string, hint?: string): Promise<TraceResult>;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Use `analyzeTransaction()` or `getRiskScore()` instead.
|
|
45
|
+
*/
|
|
46
|
+
export declare function getScore(accountId: string): Promise<RiskScoreResult>;
|